Opened 11 years ago

Closed 6 years ago

# integer_rational_power problems

Reported by: Owned by: gerbicz AlexGhitza major sage-7.4 algebra leif, darij, tscrim Frédéric Chapoton Travis Scrimshaw N/A ff92822 ff92822014f3efa9fc6518b44f20517179535088

### Description

The following answers are all wrongs/inconsistent with the documentation:

```from sage.rings.rational import integer_rational_power
print integer_rational_power(-10, 1/1)
print integer_rational_power(-10, 2/2)
print integer_rational_power(-10, 4/2)
print integer_rational_power(-10, 6/3)
print integer_rational_power(0, 0/1)
print integer_rational_power(0, 1/2)
print integer_rational_power(10, 0/1)

sage gives:
None
None
None
None
0
0
1

From the first four examples it is clear that sage is unable to observe
if b evaluate as an integer when compute a^b for negative "a" value.
The fifth example: as 0^0 is undefined it should return by None.
The sixth example: 0^(1/2)=0 is correct but shows that the documentation
is broken, because from it: "The positive real root is taken for
even denominators.", here 2 is even, but the result 0 is not positive.
The seventh example: 10^(0/1)=1 is correct, but from the
documentation: "b -- a positive Rational", so change the
documentation or return by None.}}}
```

### comment:1 Changed 8 years ago by leif

• Status changed from new to needs_info

SomeoneTM should check what of the above still applies.

### comment:2 Changed 6 years ago by chapoton

• Authors set to Frédéric Chapoton
• Branch set to u/chapoton/11228
• Commit set to ff92822014f3efa9fc6518b44f20517179535088
• Milestone set to sage-7.4
• Status changed from needs_info to needs_review

New commits:

 ​ff92822 `trac 11228 fine details in integer_rational_power`

### comment:3 Changed 6 years ago by chapoton

a little bit of ticket necromancy..

### comment:4 Changed 6 years ago by tscrim

• Reviewers set to Travis Scrimshaw
• Status changed from needs_review to positive_review

muhahahaha

### comment:5 Changed 6 years ago by leif

`./sage -Wunused-function`?

(If you want to have further fun, perhaps take a look at `rational_power_parts()` in the same file, the only instance in the Sage library where `integer_rational_power()` is used at all.)

### comment:6 Changed 6 years ago by vbraun

• Branch changed from u/chapoton/11228 to ff92822014f3efa9fc6518b44f20517179535088
• Resolution set to fixed
• Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.