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

10 ** -1 is a Num, but should probably be a Rat since it can in Rakudo #4253

Closed
p6rt opened this issue May 18, 2015 · 8 comments
Closed

10 ** -1 is a Num, but should probably be a Rat since it can in Rakudo #4253

p6rt opened this issue May 18, 2015 · 8 comments

Comments

@p6rt
Copy link

p6rt commented May 18, 2015

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

Searchable as RT125215$

@p6rt
Copy link
Author

p6rt commented May 18, 2015

From @masak

<jercos> m​: for -1..2 ->\_{(10 ** _).WHAT.say}
<camelia> rakudo-moar 3fc98b​: OUTPUT«(Num)␤(Int)␤(Int)␤(Int)␤»
<TimToady> one supposes that first one could be Rat
<jercos> I would expect negative exponents to be Rat until Rat overflows.
<TimToady> could be worth an RT
* masak submits rakudobug
<masak> m​: say (10 ** -1).^name
<camelia> rakudo-moar 3fc98b​: OUTPUT«Num␤»
<masak> m​: say (1/ 10).^name
<camelia> rakudo-moar 3fc98b​: OUTPUT«Rat␤»
<TimToady> question after that is whether it should underflow to
FatRat, but probably should just go to Num
<masak> TimToady​: yeah, I think Num is less surprising somehow.
<masak> TimToady​: otherwise people might run into unexpected slowness
for unrequited precision.
<jercos> I think Num is fairly reasonable for the under/overflow, yeah.

@p6rt
Copy link
Author

p6rt commented May 18, 2015

From @pmichaud

Having (10 ** -1) produce a Rat sounds potentially slippery-slope to me.

For example, what about (9 ** 0.5) ?

Also, while researching this I ran into the following​:

  > say (9.0 ** -1)
  Type check failed in binding nu; expected 'Int' but got 'Num'
  in block <unit> at <unknown file>​:1

Pm

@p6rt
Copy link
Author

p6rt commented May 18, 2015

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

@p6rt
Copy link
Author

p6rt commented Nov 12, 2015

From @usev6

As a status update​: 10 ** -1 is now a Rat​:

$ perl6-m -e 'say (10 ** -1).WHAT'
(Rat)

9.0 ** -1 is also a Rat, and there is no type check error​:

$ perl6-m -e 'say (9.0 ** -1).WHAT'
(Rat)

$ perl6-m -e 'say (9.0 ** -1)'
0.111111

9 ** 0.5 is a Num​:

$ perl6-m -e 'say (9 ** 0.5).WHAT'
(Num)

1 similar comment
@p6rt
Copy link
Author

p6rt commented Nov 12, 2015

From @usev6

As a status update​: 10 ** -1 is now a Rat​:

$ perl6-m -e 'say (10 ** -1).WHAT'
(Rat)

9.0 ** -1 is also a Rat, and there is no type check error​:

$ perl6-m -e 'say (9.0 ** -1).WHAT'
(Rat)

$ perl6-m -e 'say (9.0 ** -1)'
0.111111

9 ** 0.5 is a Num​:

$ perl6-m -e 'say (9 ** 0.5).WHAT'
(Num)

@p6rt
Copy link
Author

p6rt commented Oct 3, 2017

From @AlexDaniel

Yes, this was fixed in rakudo/rakudo@563abdd

Testneeded.

On 2015-11-12 12​:19​:37, bartolin@​gmx.de wrote​:

As a status update​: 10 ** -1 is now a Rat​:

$ perl6-m -e 'say (10 ** -1).WHAT'
(Rat)

9.0 ** -1 is also a Rat, and there is no type check error​:

$ perl6-m -e 'say (9.0 ** -1).WHAT'
(Rat)

$ perl6-m -e 'say (9.0 ** -1)'
0.111111

9 ** 0.5 is a Num​:

$ perl6-m -e 'say (9 ** 0.5).WHAT'
(Num)

@p6rt
Copy link
Author

p6rt commented Oct 8, 2017

From @zoffixznet

Tests in Raku/roast#346

@p6rt p6rt closed this as completed Oct 8, 2017
@p6rt
Copy link
Author

p6rt commented Oct 8, 2017

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

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

No branches or pull requests

1 participant