read float in other base

nicolas cellier ncellier at ifrance.com
Fri Apr 21 20:55:33 UTC 2006


Still playing with Number readFrom: and printStringBase:,
I have something smelling like a bug, not a great one,
just some never used and never cleaned dusty corners of code...

    "this should be the maximum floating point value in IEEE 754 double 
precision"
    (Number readFrom: ((String new: 100) writeStream
        nextPutAll: '2r1.';
        next: 52 put: $1;
        nextPutAll: 'e1023';
        contents)) printStringBase: 16.

"will print as 16r1.0e255"
    (Number readFrom: ((String new: 100) writeStream
        nextPutAll: '2r1.';
        next: 52 put: $1;
        nextPutAll: 'e1020';
        contents)) printStringBase: 16.

"will print as 16r2.0e255"

look at http://bugs.impara.de/view.php?id=3493 for further details

Nicolas




More information about the Squeak-dev mailing list