🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.ghostscript.bug
Article #148

Re: Retraction re 'div'

#148
From: Kevin Grover
Date: Mon, 27 Jul 1992 19:13
54 lines
3036 bytes
In article <9207251241.0.UUL1.3#5127@aladdin.com>, ghost@aladdin.COM (L. Peter Deutsch) writes:
) From: ghost@aladdin.COM (L. Peter Deutsch)
) Subject: Retraction re 'div'
) Organization: GNUs Not Usenet
) Date: Sat, 25 Jul 92 12:41:06 PDT
) 
) A recent poster claimed that Ghostscript's 'div' operator incorrectly
) produced an integer result when dividing two integers with no
) remainder, e.g.
) 	40 10 div ==
) prints
) 	4
) 
) The poster was wrong.  The result of 'div' is always a real.
) However, Ghostscript, unlike some other PostScript language
) interpreters, may print a real number with no fractional part without
) the decimal point.
) 
) I suppose it would be better if Ghostscript always printed reals with
) a decimal point, since that would guarantee that printing out a real
) and reading it back in again would produce a real rather than an
) integer, but since all operators in the PostScript language that
) accept reals also accept integers, printing reals without a decimal
) point cannot cause trouble in this respect.
) 
) Bottom line: I'm not going to bother changing the print routine (I
) just use sprintf with a %g format) unless someone can show me a real
) file on which this difference causes the wrong thing to happen.
) 

Well, I'm the original poster of the "difference".  I reason I know
about it is because I program I wrote using GhostScript did not work
on at least two other systems.  The reason: the extra ".0" that the
other systems included overflowed the buffer I was using the "cws" the
number to a string.

I posted a response to a request in comp.lang.postscript for a
"compress rose".  There were two replies saying that it didn't work,
there was a rangecheck error on the cvs command.  It ran the program
on a NeXT, and sure enough the program was there.  So, I added in a
"cvi" command and all was well.

This piece of code works in GS:
	50 10 div 2 string cvs
but returns "rangecheck" error on at least a NeXT and a SUN with NeWS
and at least 1 other system (I can' remember the other reply to my post).

Personally, I think the way gs handles it is cleaner.  I just wanted
to warn people of the difference.

--------------------------------------------------------------------------
 Kevin O. Grover      | UNLV Computer Science and Electrical Engineering
 grover@isri.unlv.edu | ISRI - Information Science Research Institute
 CServe: [73627,1677] | 4505 S. Maryland Parkway, Las Vegas NV 89154-1017
Technical Details
Message-ID: <1992Jul27.191359.2674@unlv.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!mighty-joe.isri.unlv.edu!grover
References: <9207251241.0.UUL1.3#5127@aladdin.com>

Show Full Headers
Complete Article Headers
Newsgroups: gnu.ghostscript.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!mighty-joe.isri.unlv.edu!grover
From: grover@mighty-joe.isri.unlv.edu (Kevin Grover)
Subject: Re: Retraction re 'div'
Message-ID: <1992Jul27.191359.2674@unlv.edu>
Sender: gnulists@ai.mit.edu
Reply-To: grover@isri.unlv.edu
Organization: Information Science Research Institute (UNLV-ISRI)
References: <9207251241.0.UUL1.3#5127@aladdin.com>
Distribution: gnu
Date: Mon, 27 Jul 1992 19:13:59 GMT
Approved: bug-ghostscript@prep.ai.mit.edu
Lines: 55