Weird behaviour/bug with pi and rational exponents

asked 2019-04-28 16:01:22 +0200

kenJ0428 gravatar image

updated 2019-08-29 18:29:17 +0200

FrédéricC gravatar image

When I type this:

print numerical_approx((4/pi())^(2/1))
print numerical_approx((4/3.14159265358979)^(2/1))

I get

sage: 3.90303389783585e2585827972
1.62113893827741

(note the letter "e" in the 1st line)

This happens on my notebook, on the COCALC server there is a crash.

Has anyone else seen this ? What is the problem there ?

edit retag flag offensive close merge delete

Comments

I can reproduce this in the Sage REPL of Python3-based Sage 8.8.beta3 on macOS too.

Minimal example: (4/pi)^2 and (4/I)^(2/1) work fine but (4/pi)^(2/1) and (4/e)^(2/1) misbehave, going into some intense long-lasting computation. Interrupting this long computation gives

Unhandled SIGSEGV: A segmentation fault occurred.
This probably occurred because a *compiled* module has a bug
in it and is not properly wrapped with sig_on(), sig_off().
Python will now terminate.
slelievre gravatar imageslelievre ( 2019-04-28 22:39:33 +0200 )edit

Even more minimal (2/pi)^(2/1) :-) This looks like a bug in Pynac/Ginac that is called for constructing the string representation

sage: a = (2/pi)^(2/1)   # works fine
sage: b = SR._repr_element_(a)    # segfaults
vdelecroix gravatar imagevdelecroix ( 2019-04-29 04:39:30 +0200 )edit