Skip Menu |
Report information
Id: 116423
Status: new
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: pawel.pabian [at] implix.com
Cc:
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: weird: say 1.0000000000000000000000000000001 prints trailing zeros
Date: Wed, 16 Jan 2013 15:49:34 +0100
To: "rakudobug [...] perl.org" <rakudobug [...] perl.org>
From: Paweł Pabian <pawel.pabian [...] implix.com>
Download (untitled) / with headers
text/plain 981b
bbkr_ r: say 1.0000000000000000000000000000001 
p6eval rakudo efac0f: OUTPUT«1.000000000000000000000000000000100»

discussion followed

moritz bbkr_: if the spec says trailing zeros aren't allowed, then it's a bug
bbkr_ moritz: spec does not forbid trailing zeros. it's "common sense" type of issue
masak I don't really see what's wrong with trailing zeroes.
bbkr_ masak: IMO number should be printed in simplest form possible. and it works that way up to 1.0000000000000000001 (no trailing zeros).
masak I'll go so far as agree that it's a bit weird that those zeroes are there.
bbkr_ this may cause problems when using in some fixed-width environment (tables, protocols using stringified value, etc)
FROGGS well, might use sprintf for that
[Coke] if you're using a fixed width, i'd argue you shoudl be using sprintf.


So this is not something that should be put in spec tests (because it is not forbidden by spec) but just a inconsistent behavior to investigate.










RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 1.7k
13:56 < diakopter> m: say 1.0000000000000000000000000000001 # Rat fail? 13:56 <+camelia> rakudo-moar 61d231: OUTPUT«1.00000000000000003641037050347531␤» 13:57 < psch> m: say 1.0000000000000000000000000000001.WHAT 13:57 <+camelia> rakudo-moar 61d231: OUTPUT«(Rat)␤» 13:57 < psch> m: say 1.0000000000000000000000000000001.nude 13:57 <+camelia> rakudo-moar 61d231: OUTPUT«(10000000000000000000000000000001 9999999999999999635896294965248)␤» 13:57 < diakopter> ooo 13:57 < psch> m: say Rat.nu.^type 13:57 <+camelia> rakudo-moar 61d231: OUTPUT«Method 'nu' not found for invocant of class 'Rat'␤ in block <unit> at /tmp/h_fcFeWJyh line 1␤␤» 13:57 < psch> grml 13:57 < psch> m: say Rat.numerator.^type 13:57 <+camelia> rakudo-moar 61d231: OUTPUT«Cannot look up attributes in a type object␤ in method numerator at /home/camelia/rakudo-m-inst-1/share/perl6/runtime/CORE.setting.moarvm line 1␤ in block <unit> at /tmp/Gcg8Bcf6uC line 1␤␤» 13:58 < psch> m: say (1/3).numerator.^type 13:58 <+camelia> rakudo-moar 61d231: OUTPUT«Method 'type' not found for invocant of class 'Perl6::Metamodel::ClassHOW'␤ in block <unit> at /tmp/WW_ex0WwjU line 1␤␤» 13:58 < psch> oh whatever /o\ 13:58 < psch> m: say (1/3).numerator.WHAT 13:58 <+camelia> rakudo-moar 61d231: OUTPUT«(Int)␤» 13:58 -!- _nadim [~lab@197.0.193.100] has joined #perl6 13:58 < diakopter> the denominator is wrongish 13:58 < psch> m: my Int $x = 9999999999999999635896294965248; say ++$x 13:58 <+camelia> rakudo-moar 61d231: OUTPUT«9999999999999999635896294965249␤» 13:58 < psch> we have a few tickets with numbers in that area being weird iirc 13:59 < psch> probably mostly related to Rat 13:59 < diakopter> updating #116423


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org