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

LTA error messages on literals with too many decimals in Rakudo #1566

Closed
p6rt opened this issue Mar 2, 2010 · 11 comments
Closed

LTA error messages on literals with too many decimals in Rakudo #1566

p6rt opened this issue Mar 2, 2010 · 11 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Mar 2, 2010

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

Searchable as RT73236$

@p6rt
Copy link
Author

p6rt commented Mar 2, 2010

From @masak

<masak> rakudo​: say 0.00000000000000000000 # also by diakopterbot
<p6eval> rakudo 6867a5​: OUTPUT«No applicable candidates found to
dispatch to for 'infix​:<div>' [...]
<masak> rakudo​: say 0.0000000000000000000
<p6eval> rakudo 6867a5​: OUTPUT«Nominal type check failed for parameter
'$b'; expected Int but got Num instead [...]
* masak submits rakudobug

Here it's just a question of catching the error sooner and emitting a
nice error message. At least until we can actually handle arbitrarily
long decimal expansions.

@p6rt
Copy link
Author

p6rt commented Mar 2, 2010

From @masak

<lue> rakudo​: say 0.00000000000000000000000000000000​
0000000000000000000000000000000000
<p6eval> rakudo 5e5969​: OUTPUT«Divide by zero␤current instr.​:
'infix​:<div>' [...]
<iakopter> nice! 3 different bugs
<lue> the exact error changes with the number of extra 0's you have!
<lue> rakudo​: say 0.0000000000000000000000000000000​
00000000001000000000000000000000 # hee hee
<p6eval> rakudo 5e5969​: OUTPUT«Nominal type check failed for
parameter '$a'; expected Int but got Num instead [...]
<diakopter> omg
<lue> first $b, now $a!
<diakopter> 4 different bugs

@p6rt
Copy link
Author

p6rt commented Mar 2, 2010

From [Unknown Contact. See original ticket]

<lue> rakudo​: say 0.00000000000000000000000000000000​
0000000000000000000000000000000000
<p6eval> rakudo 5e5969​: OUTPUT«Divide by zero␤current instr.​:
'infix​:<div>' [...]
<iakopter> nice! 3 different bugs
<lue> the exact error changes with the number of extra 0's you have!
<lue> rakudo​: say 0.0000000000000000000000000000000​
00000000001000000000000000000000 # hee hee
<p6eval> rakudo 5e5969​: OUTPUT«Nominal type check failed for
parameter '$a'; expected Int but got Num instead [...]
<diakopter> omg
<lue> first $b, now $a!
<diakopter> 4 different bugs

@p6rt
Copy link
Author

p6rt commented Mar 2, 2010

@masak - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Jul 5, 2010

From @bbkr

all cases work on Kiev build, taking for tests.

@p6rt
Copy link
Author

p6rt commented Jul 12, 2010

From @bbkr

It looks like it's not resolved yet for very long decimal part​:

$ perl6 -e 'eval "say 0." ~ "0" x 1024; say $!'
Divide by zero

Leaving open.

@p6rt
Copy link
Author

p6rt commented Jul 30, 2010

From @bbkr

last case works on * release

perl6 -e 'eval "say 0." ~ "0" x 1024; say $!'
0
Any()

@p6rt
Copy link
Author

p6rt commented Aug 3, 2010

From @bbkr

also did tests using following code​:

use Test; my $e = "0."; for 1..1024 { $e ~= "0"; eval_lives_ok $e }

and all cases passed

@p6rt
Copy link
Author

p6rt commented Aug 3, 2010

From @bbkr

tests added in t/spec/S02-literals/numeric.t

@p6rt
Copy link
Author

p6rt commented Aug 3, 2010

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

@p6rt p6rt closed this as completed Aug 3, 2010
@p6rt
Copy link
Author

p6rt commented Aug 3, 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 806c7d7a2efa5235bb9ee53d0d0a60a7ebe94a74
Author​: bbkr <bbkr@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Tue Aug 3 11​:59​:02 2010 +0000

  [t/spec] tests for RT #​73236 LTA error messages on literals with too many decimals
 
  git-svn-id​: http://svn.pugscode.org/pugs@&#8203;31892 c213334d-75ef-0310-aa23-eaa082d1ae64

Inline Patch
diff --git a/t/spec/S02-literals/numeric.t b/t/spec/S02-literals/numeric.t
index 135fb87..921358f 100644
--- a/t/spec/S02-literals/numeric.t
+++ b/t/spec/S02-literals/numeric.t
@@ -31,6 +31,24 @@ nok 1+1i ~~ Real, '1+1i is not Real';
 is_approx 3.14159265358979323846264338327950288419716939937510e0,
           3.141592, 'very long Num literals';
 
+# RT #73236
+{
+    eval_lives_ok '0.' ~ '0' x 19,
+        'parsing 0.000... with 19 decimal places lives';
+
+    eval_lives_ok '0.' ~ '0' x 20,
+        'parsing 0.000... with 20 decimal places lives';
+
+    eval_lives_ok '0.' ~ '0' x 63,
+        'parsing 0.000... with 63 decimal places lives';
+
+    eval_lives_ok '0.' ~ '0' x 66,
+        'parsing 0.000... with 66 decimal places lives';
+
+    eval_lives_ok '0.' ~ '0' x 1024,
+        'parsing 0.000... with 1024 decimal places lives';
+}
+
 done_testing;
 
 # vim: ft=perl6 sw=4 ts=4 expandtab

@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