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

Fix Integral values of Inf/NaN #520

Closed
p6rt opened this issue Dec 22, 2008 · 21 comments
Closed

Fix Integral values of Inf/NaN #520

p6rt opened this issue Dec 22, 2008 · 21 comments

Comments

@p6rt
Copy link

@p6rt p6rt commented Dec 22, 2008

Migrated from rt.perl.org#61602 (status was 'rejected')

Searchable as RT61602$

@p6rt
Copy link
Author

@p6rt p6rt commented Dec 22, 2008

From @cspencer

When calling the .int method on Inf/Nan, the reported value is incorrect​:

  "Inf.int.say" produces "-2147483648"

and

  "NaN.int.say" produces "-2147483648"

@p6rt
Copy link
Author

@p6rt p6rt commented Dec 22, 2008

From @pmichaud

On Mon, Dec 22, 2008 at 06​:00​:31AM -0800, Cory Spencer wrote​:

When calling the .int method on Inf/Nan, the reported value is incorrect​:
"Inf.int.say" produces "-2147483648"
and
"NaN.int.say" produces "-2147483648"

This turns out to be the way that Parrot converts infinities to
integers -- it makes them all into -2147483648. I'm not quite sure
how we'll deal with this yet. Since PDD14 (NaN/Inf) is undergoing
revision this month, I figure we might wait a few weeks to see if/how
Parrot changes first.

Pm

@p6rt
Copy link
Author

@p6rt p6rt commented Dec 22, 2008

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

@p6rt
Copy link
Author

@p6rt p6rt commented Feb 24, 2009

From @coke

Originally reported against parrot, this is apparently a rakudo issue.

Resolving the issue there; details about the issue can still be found at​:

https://trac.parrot.org/parrot/ticket/370

--
Will "Coke" Coleda

@p6rt
Copy link
Author

@p6rt p6rt commented Dec 3, 2009

From @masak

<masak> rakudo​: my Int $a = Inf
<p6eval> rakudo 7ce13d​: Assignment type check failed; expected Int,
but got Num [...]
<masak> that seems less than reasonable to me.
<Wolfman2000> Infinity is a Num
<masak> infinity, as we all know, is an integer. :)
<Wolfman2000> masak​: is it?
<masak> Wolfman2000​: sure. if not, can you name its decimal expansion? :P
* masak submits rakudobug

Not, but seriously. S02​:649 says that Int should be able to hold Inf
and NaN values. So it's not just me. :)

@p6rt
Copy link
Author

@p6rt p6rt commented Apr 10, 2010

From @ShimmerFairy

Just so you know, that's not the only number it returns.
64-bit​: returns -9223372036854775808 (a 64 digit binary number with the
most significant bit set to 1, all other bits are 0)
32-bit (Intel)​: returns -2147483648 (a 32 digit binary number with the
most significant bit set to 1, all other bits 0)
Which implies that Rakudo/Parrot simply returns the largest number it
can muster (why it doesn't go to all 1's, who knows?)

(As a side note, 32-bit PowerPC returns 2147483647, which is a 31 digit
binary number with all 1's)
--
Don't Panic!

@p6rt
Copy link
Author

@p6rt p6rt commented Aug 18, 2010

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

@p6rt
Copy link
Author

@p6rt p6rt commented Feb 5, 2011

From @masak

<masak> rakudo​: my Int $x = NaN; say $x
<TimToady> yes, it says
<p6eval> rakudo 924242​: OUTPUT«Type check failed for assignment␤ in
'&infix​:<=>' [...]
<masak> TimToady​: what does it say? :)
<TimToady> S02​:675
* masak submits rakudobug

@p6rt
Copy link
Author

@p6rt p6rt commented Aug 31, 2011

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

@p6rt
Copy link
Author

@p6rt p6rt commented Aug 31, 2011

From @pmichaud

We'll have to stall this ticket until we decide how to make NaN fit into
an Int constrained container.

Pm

@p6rt
Copy link
Author

@p6rt p6rt commented Aug 31, 2011

@pmichaud - Status changed from 'open' to 'stalled'

@p6rt
Copy link
Author

@p6rt p6rt commented Sep 11, 2011

From @bbkr

NOM​: still broken, looks like it's related to Int being converted to Num
when it exceeds int32.

bbkr​:nom bbkr$ ./perl6 -e 'my Int $a = Inf'
Type check failed in assignment to '$a'; expected 'Int' but got 'Num'

@p6rt
Copy link
Author

@p6rt p6rt commented Sep 30, 2011

From @coke

On Mon Dec 22 06​:00​:30 2008, cspencer wrote​:

When calling the .int method on Inf/Nan, the reported value is
incorrect​:

"Inf.int.say" produces "-2147483648"

and

"NaN.int.say" produces "-2147483648"

I think the method for this is now ".Int", but the answers aren't
righter​:

19​:12 < [Coke]> rakudo​: say Inf.Int;
19​:12 <+p6eval> rakudo ebd4d8​: OUTPUT«-9223372036854775808␤»
19​:13 < [Coke]> rakudo​: say NaN.Int
19​:13 <+p6eval> rakudo ebd4d8​: OUTPUT«-9223372036854775808␤»

--
Will "Coke" Coleda

@p6rt
Copy link
Author

@p6rt p6rt commented Oct 1, 2011

From @moritz

I'm collecting the Inf + Int tickets here in one place, since a fix for
them will likely cover all cases at once.

@p6rt
Copy link
Author

@p6rt p6rt commented Apr 22, 2012

From @masak

<masak> p6​: say Inf.Int; say NaN.Int
<p6eval> ..rakudo 80f140​: OUTPUT«Cannot coerce Inf to an Int␤ in method
gist at src/gen/CORE.setting​:8666 [...]
* masak updates https://rt-archive.perl.org/perl6/Ticket/Display.html?id=61602
since the behavior has now changed

@p6rt
Copy link
Author

@p6rt p6rt commented Dec 30, 2012

From @moritz

I've opened Raku/old-design-docs#27 to discuss some
spec issue the need to be addressed before we can fix this in rakudo.

@p6rt
Copy link
Author

@p6rt p6rt commented Aug 30, 2015

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

@p6rt
Copy link
Author

@p6rt p6rt commented Sep 17, 2015

From @coke

On Sun Dec 30 05​:26​:51 2012, moritz wrote​:

I've opened Raku/old-design-docs#27 to discuss some
spec issue the need to be addressed before we can fix this in rakudo.

I'm rejecting this ticket from RT - If the spec issues are ever resolved, we can reopen this to track the implementation work.

--
Will "Coke" Coleda

@p6rt
Copy link
Author

@p6rt p6rt commented Sep 17, 2015

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

@p6rt
Copy link
Author

@p6rt p6rt commented Sep 17, 2015

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

@p6rt p6rt closed this as completed Sep 17, 2015
@p6rt
Copy link
Author

@p6rt p6rt commented Jul 11, 2016

From @zoffixznet

Tests added in Raku/roast@697b460581

--
Cheers,
ZZ | https://twitter.com/zoffix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant