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

Rakudo gets confused when the exponent in scientific notation is large enough #1403

Closed
p6rt opened this issue Nov 17, 2009 · 10 comments
Closed
Labels

Comments

@p6rt
Copy link

p6rt commented Nov 17, 2009

Migrated from rt.perl.org#70600 (status was 'resolved')

Searchable as RT70600$

@p6rt
Copy link
Author

p6rt commented Nov 17, 2009

From @masak

<diakopter> rakudo​: say 0e99999999999 # masak
<p6eval> rakudo 7347ec​: undefined identifier 'NaN' [...]
<moritz_> ng​: say 0e99999999999
<p6eval> ng 94fa72​: error​:imcc​:syntax error, unexpected IDENTIFIER,
expecting COMMA or ')' ('NaN')
<diakopter> whoa
* masak submits rakudobug

@p6rt
Copy link
Author

p6rt commented Aug 18, 2010

From @coke

On Tue Nov 17 08​:32​:14 2009, masak wrote​:

<diakopter> rakudo​: say 0e99999999999 # masak
<p6eval> rakudo 7347ec​: undefined identifier 'NaN' [...]
<moritz_> ng​: say 0e99999999999
<p6eval> ng 94fa72​: error​:imcc​:syntax error, unexpected IDENTIFIER,
expecting COMMA or ')' ('NaN')
<diakopter> whoa
* masak submits rakudobug

00​:29 <[Coke]> rakudo​: say 0e99999999999
00​:29 <p6eval> rakudo 67778a​: OUTPUT«NaN␤»

That looks better. assigning to moritz++ for testification.

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Aug 18, 2010

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Aug 18, 2010

From @masak

On Tue Aug 17 21​:30​:02 2010, coke wrote​:

On Tue Nov 17 08​:32​:14 2009, masak wrote​:

<diakopter> rakudo​: say 0e99999999999 # masak
<p6eval> rakudo 7347ec​: undefined identifier 'NaN' [...]
<moritz_> ng​: say 0e99999999999
<p6eval> ng 94fa72​: error​:imcc​:syntax error, unexpected IDENTIFIER,
expecting COMMA or ')' ('NaN')
<diakopter> whoa
* masak submits rakudobug

00​:29 <[Coke]> rakudo​: say 0e99999999999
00​:29 <p6eval> rakudo 67778a​: OUTPUT«NaN␤»

That looks better. assigning to moritz++ for testification.

It does indeed "look better", in the sense that the original bug looked like crap. But it still
qualifies as Rakudo getting confused.

0e99999999999 is zero, not NaN. No amount of nines after the 'e' should make it not zero.

@p6rt
Copy link
Author

p6rt commented Aug 18, 2010

From @nwc10

On Tue, Aug 17, 2010 at 09​:30​:03PM -0700, Will Coleda via RT wrote​:

On Tue Nov 17 08​:32​:14 2009, masak wrote​:

<diakopter> rakudo​: say 0e99999999999 # masak
<p6eval> rakudo 7347ec​: undefined identifier 'NaN' [...]
<moritz_> ng​: say 0e99999999999
<p6eval> ng 94fa72​: error​:imcc​:syntax error, unexpected IDENTIFIER,
expecting COMMA or ')' ('NaN')
<diakopter> whoa
* masak submits rakudobug

00​:29 <[Coke]> rakudo​: say 0e99999999999
00​:29 <p6eval> rakudo 67778a​: OUTPUT«NaN???»

That looks better. assigning to moritz++ for testification.

NaN?

Perl 5 thinks​:

$ perl -le 'print 0e99999999999'
0
$ perl -le 'print 1e99999999999'
inf

and I find its answers more pleasing.

Nicholas Clark

@p6rt
Copy link
Author

p6rt commented Aug 18, 2010

From @coke

On Wed, Aug 18, 2010 at 12​:41 PM, Nicholas Clark <nick@​ccl4.org> wrote​:

On Tue, Aug 17, 2010 at 09​:30​:03PM -0700, Will Coleda via RT wrote​:

On Tue Nov 17 08​:32​:14 2009, masak wrote​:

<diakopter> rakudo​: say 0e99999999999 # masak
<p6eval> rakudo 7347ec​: undefined identifier 'NaN' [...]
<moritz_> ng​: say 0e99999999999
<p6eval> ng 94fa72​: error​:imcc​:syntax error, unexpected IDENTIFIER,
expecting COMMA or ')' ('NaN')
<diakopter> whoa
* masak submits rakudobug

00​:29 <[Coke]> rakudo​: say 0e99999999999
00​:29 <p6eval> rakudo 67778a​: OUTPUT«NaN???»

That looks better. assigning to moritz++ for testification.

NaN?

Perl 5 thinks​:

$ perl -le 'print  0e99999999999'
0
$ perl -le 'print  1e99999999999'
inf

and I find its answers more pleasing.

Nicholas Clark

Whoops, I meant better in that it actually returned a value instead of
vomiting. =-)

Agreed that the actual value is wrong.

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Aug 19, 2010

From @kyleha

This is an automatically generated mail to inform you that tests are now available in t/spec/S02-literals/numeric.t

commit 7dd40fee588f6cb3b615506a106d67430d481f3c
Author​: moritz <moritz@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Thu Aug 19 19​:27​:29 2010 +0000

  [t/spec] test for RT #​70600, 0e9999999
 
  git-svn-id​: http://svn.pugscode.org/pugs@&#8203;32061 c213334d-75ef-0310-aa23-eaa082d1ae64

Inline Patch
diff --git a/t/spec/S02-literals/numeric.t b/t/spec/S02-literals/numeric.t
index 921358f..a3ca469 100644
--- a/t/spec/S02-literals/numeric.t
+++ b/t/spec/S02-literals/numeric.t
@@ -49,6 +49,10 @@ is_approx 3.14159265358979323846264338327950288419716939937510e0,
         'parsing 0.000... with 1024 decimal places lives';
 }
 
+# RT #70600
+#?todo 'RT 70600'
+ok 0e999999999999999 == 0, '0e999999999999 equals zero';
+
 done_testing;
 
 # vim: ft=perl6 sw=4 ts=4 expandtab

@p6rt
Copy link
Author

p6rt commented Sep 11, 2011

From @bbkr

NOM​: still broken

bbkr​:nom bbkr$ ./perl6 -e 'say so 0e999999999999999 == 0'
Bool​::False

@p6rt
Copy link
Author

p6rt commented Nov 30, 2011

From @coke

On Sun Sep 11 13​:27​:22 2011, bbkr wrote​:

NOM​: still broken

bbkr​:nom bbkr$ ./perl6 -e 'say so 0e999999999999999 == 0'
Bool​::False

Now reports true. Unfudged test in roast, closing ticket.

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Nov 30, 2011

@coke - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Nov 30, 2011
@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