Dear All
I've found a simple case of a bug in writeln():
program sumbug(input,output);
begin writeln(10.0*0.01); writeln(100.0*0.001); writeln(1.0*0.1); end.
All should print 0.1 I guess, but I get:
% ./bug :.000000000000000e-02 :.000000000000000e-02 1.000000000000000e-01
Interestingly ':' is the next character after '9' in the ASCII table, so it appears to be trying to print out the ASCII chacter for '10' (ten). 10.0e-02 is 0.1 after all !
This happens with the latest gpc-20011123 and also gpc-20010512 (that's all I've tested).
Many thanks
Ian
On Fri, 30 Nov 2001, Ian Thurlbeck wrote:
I've found a simple case of a bug in writeln():
program sumbug(input,output);
begin writeln(10.0*0.01); writeln(100.0*0.001); writeln(1.0*0.1); end.
All should print 0.1 I guess, but I get:
% ./bug :.000000000000000e-02 :.000000000000000e-02 1.000000000000000e-01
I've got:
./sumbug
1.000000000000000e-01 1.000000000000000e-01 1.000000000000000e-01
(With gpc-20011116/gcc-2.95.3 on alpha-dec-osf4.0b, and gpc-20010924/2.95.2 on ultrasparc-sun-solaris2.7)
Interestingly ':' is the next character after '9' in the ASCII table, so it appears to be trying to print out the ASCII chacter for '10' (ten). 10.0e-02 is 0.1 after all !
This happens with the latest gpc-20011123 and also gpc-20010512 (that's all I've tested).
Probably it could help if architecture/OS details would be included in bug report :-), since this is either introduced since 20011116, or platform-dependent ...
Mirsad
-- This message has been made up using recycled ideas and language constructs. No plant or animal has been injured in process of making this message.
Ian Thurlbeck wrote:
I've found a simple case of a bug in writeln():
program sumbug(input,output);
begin writeln(10.0*0.01); writeln(100.0*0.001); writeln(1.0*0.1); end.
All should print 0.1 I guess, but I get:
% ./bug :.000000000000000e-02 :.000000000000000e-02 1.000000000000000e-01
Interestingly ':' is the next character after '9' in the ASCII table, so it appears to be trying to print out the ASCII chacter for '10' (ten). 10.0e-02 is 0.1 after all !
Correct diagnosis. Thanks. Fix attached (will also be in the next GPC update, of course).
Frank