#275 Illegal postscript - div by zero


This command generates bad postscript output
(according to gsview32) (a division by zero):

(C12) plot3d(2^(-u^2+v^2),[u,-5,5],[v,-7,7], [plot_format,

AFPL Ghostscript 7.0 (2001-04-08)
Copyright (C) 2001 artofcode LLC, Benicia, CA. All
rights reserved.
This software comes with NO WARRANTY: see the file
PUBLIC for details.
Displaying non DSC file C:/Documents and
Unrecoverable error: undefinedresult in div
Operand stack:
0.0 1.5

--- Begin offending input ---

--- End offending input ---
file offset = 1024
gsapi_run_string_continue returns -23
The problem occurs at the beginning of the postscript:
306.0000 396.0000 translate
0.0000 0.0000
-0.0000 -229823356100963.3000 translate
1.5 0.0000 div setlinewidth
/Helvetica findfont 14 0.0000 div scalefont setfont

etc etc

This one is fine:

(C13) plot3d(x^2-y^2,[x,-2,2],[y,-2,2],[grid,30,30],
[plot_format, ps], [RUN_VIEWER,FALSE]);

306.0000 396.0000 translate
79.8396 79.8396
0.0000 -0.0000 translate
1.5 79.8396 div setlinewidth
/Helvetica findfont 14 79.8396 div scalefont setfont


I expect that this is OS independent, but for the record I
was working on Windows with the release version.

Thanks for the work.

Mike Thomas (miketh@brisbane.paradigmgeo.com)


  • Robert Dodier

    Robert Dodier - 2003-12-08

    Logged In: YES

    The problem shown here appears to be a result of the
    extremely large range of z (from approximately 0 to 2^49).

    I believe the immediate problem is that a fixed-point format
    was used to print the scaling factors, so that a small
    number was printed as 0. That could be dependent on the Lisp
    version. The function which prints the scaling factors (and
    everything else) is (defun p ...) in plot.lisp.

    (However, even if the number format is changed, it's still
    possible to cause gv to barf, if the scaling factors are
    large or small enough. I don't know what the general answer is.)

    On my system (cvs version of 20031128, clisp 2.31, linux
    2.4.2) the scaling factors are printed using the exponential
    notation, so for "plot3d(2^(-u^2+v^2),[u,-5,5],[v,-7,7],
    [plot_format, ps], [RUN_VIEWER,FALSE]);" the PS file begins:

    306.0 396.0 translate
    1.4359E-12 1.4359E-12
    -8.8818E-16 -2.2982E+14 translate
    1.5 1.4359E-12
    div setlinewidth
    /Helvetica findfont 14 1.4359E-12
    div scalefont setfont
    /dotradius .05 def

    and this is displayed without error (although it is not an
    interesting picture because the horizontal range is squished
    very small).

    For " plot3d(2^(-u^2+v^2),[u,-16,16],[v,-18,18],
    [plot_format, ps], [RUN_VIEWER,FALSE]);" gv (ghostview)
    complains "/limitcheck in -file-" which could mean an
    arithmetic overflow, I think.

  • Robert Dodier

    Robert Dodier - 2006-07-04

    Logged In: YES

    Reassign category. The built-in postscript code produces
    very ugly output and should simply be cut out IMHO.

  • Robert Dodier

    Robert Dodier - 2006-07-04
    • labels: 460522 --> Lisp Core - Plotting
  • Robert Dodier

    Robert Dodier - 2007-06-04

    Logged In: YES
    Originator: NO

    The built-in Postscript output was cut out some months ago. Gnuplot Postscript output does not trigger the error mentioned in this bug report. Closing this report as "Out of Date".

  • Robert Dodier

    Robert Dodier - 2007-06-04
    • status: open --> closed

Log in to post a comment.