ASKSAGE: Sage Q&A Forum - Individual question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 28 Apr 2019 21:39:30 -0500Weird behaviour/bug with pi and rational exponentshttps://ask.sagemath.org/question/46390/weird-behaviourbug-with-pi-and-rational-exponents/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 ?Sun, 28 Apr 2019 08:50:23 -0500https://ask.sagemath.org/question/46390/weird-behaviourbug-with-pi-and-rational-exponents/Comment by vdelecroix for <p>When I type this:</p>
<pre><code>print numerical_approx((4/pi())^(2/1))
print numerical_approx((4/3.14159265358979)^(2/1))
</code></pre>
<p>I get </p>
<pre><code>sage: 3.90303389783585e2585827972
1.62113893827741
</code></pre>
<p>(note the letter "e" in the 1st line)</p>
<p>This happens on my notebook, on the COCALC server there is a crash.</p>
<p>Has anyone else seen this ? What is the problem there ?</p>
https://ask.sagemath.org/question/46390/weird-behaviourbug-with-pi-and-rational-exponents/?comment=46398#post-id-46398Even 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) # segfaultsSun, 28 Apr 2019 21:39:30 -0500https://ask.sagemath.org/question/46390/weird-behaviourbug-with-pi-and-rational-exponents/?comment=46398#post-id-46398Comment by slelievre for <p>When I type this:</p>
<pre><code>print numerical_approx((4/pi())^(2/1))
print numerical_approx((4/3.14159265358979)^(2/1))
</code></pre>
<p>I get </p>
<pre><code>sage: 3.90303389783585e2585827972
1.62113893827741
</code></pre>
<p>(note the letter "e" in the 1st line)</p>
<p>This happens on my notebook, on the COCALC server there is a crash.</p>
<p>Has anyone else seen this ? What is the problem there ?</p>
https://ask.sagemath.org/question/46390/weird-behaviourbug-with-pi-and-rational-exponents/?comment=46393#post-id-46393I 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.Sun, 28 Apr 2019 15:39:33 -0500https://ask.sagemath.org/question/46390/weird-behaviourbug-with-pi-and-rational-exponents/?comment=46393#post-id-46393