Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

say 1.0000000000000000000000000000001 makes wrong denominator #3030

Open
p6rt opened this issue Jan 16, 2013 · 3 comments
Open

say 1.0000000000000000000000000000001 makes wrong denominator #3030

p6rt opened this issue Jan 16, 2013 · 3 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jan 16, 2013

Migrated from rt.perl.org#116423 (status was 'new')

Searchable as RT116423$

@p6rt
Copy link
Author

p6rt commented Jan 16, 2013

From @bbkr

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.

@p6rt
Copy link
Author

p6rt commented Apr 7, 2016

From @diakopter

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

1 similar comment
@p6rt
Copy link
Author

p6rt commented Apr 7, 2016

From @diakopter

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

@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant