printOn: bug on FloatD

Roland Plüss <[email protected]>
Newsgroups gmane.comp.lang.smalltalk.gnu.general
Message-ID <[email protected]>
Seen on 3.2.5 , also reproducable on 3.2.91

Run "gst" and enter "0.01" and you get

Object: 1 error: The program attempted to divide a number by zero
ZeroDivide(Exception)>>signal (ExcHandling.st:254)
SmallInteger(Number)>>zeroDivide (SysExcept.st:1386)
Fraction>>setNumerator:setDenominator: (Fraction.st:485)
Fraction class>>numerator:denominator: (Fraction.st:66)
Fraction>>- (Fraction.st:151)
FloatD(Float)>>printOn:special: (Float.st:535)
FloatD(Float)>>printOn: (Float.st:436)
FloatD(Object)>>printString (Object.st:546)
FloatD(Object)>>printNl (Object.st:582)

Reducable: always if FloatD is used, not if Float is used

Problem seems to be in Fraction.st:151 triggered by the line:

sameDown := sameDown and: [(num - eps) // weight = digit].

in Float.st:533

The "num - eps" part triggers the failure in the first run of the loop.

-- 
Yours sincerely
Plüss Roland

Leader and Head Programmer
- Game: Epsylon ( http://www.indiedb.com/games/epsylon )
- Game Engine: Drag[en]gine ( http://www.indiedb.com/engines/dragengine
, http://dragengine.rptd.ch/wiki )
- As well as various Blender export scripts und game tools

_______________________________________________
help-smalltalk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
signature.asc (application/pgp-signature, 195 B)
-----BEGIN PGP SIGNATURE-----

iF0EARECAB0WIQQ3QLC1n1sjrH5cSAqMoa73KxFZ+gUCW/Gq/AAKCRCMoa73KxFZ
+sy1AJ9cemXcO0I1WgBaTSgzPdwT05TxyQCfTOLsMstquZzXQknOmBZBtVIwy98=
=Uguw
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.