You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The principal root of a negative real carries a 1e-102 real part, and its square then lies a hair below the negative axis, where ln takes the wrong branch #1378
Measured on master (2b4a5256), with DowncastingEnabled off, as a numerical verification evaluates:
(-0.473)^(1/2) -> -6.1e-102 + 0.68775i (the real part should be 0)
(-4)^(1/2) -> -1.8e-101 + 2i
((-0.473)^(1/2))^2 -> -0.473 - 8.4e-102 i (should be -0.473 exactly)
ln(((-0.473)^(1/2))^2) -> -0.7487 - 3.14159 i (ln(-0.473) is -0.7487 + 3.14159 i)
Two causes, both in Number.Pow:
A negative real to a half power goes through the polar form, rho^p (cos(p theta) + i sin(p theta)) with theta = pi from Arctan2, and cos(pi/2) at a hundred digits is 6e-102, not zero. The principal root of a negative real is the root of the modulus times i, exactly, and the same for every power that is a whole number of halves ((-4)^(3/2) is -8i; (-8)^(1/3) is not affected — a third is not a multiple of a right angle, and this library's real-root convention for it stays).
With the downcasting off, the literal 2 arrives as the decimal 2, not the Integer, so z^2 takes the polar form too instead of the exact multiplication z * z — which is what turns (0 + 0.68775i)^2 into -0.473 - 8.4e-102 i: a hair below the negative axis, where ln reads -i pi for the +i pi the number has.
Together they made a right antiderivative read as wrong: u ln(u^2) for u = sqrt(-1 + a x) is sqrt(-1 + a x) ln(((-1 + a x)^(1/2))^2) written back, whose numerical derivative at -1 + a x < 0 disagreed with the integrand by exactly the 2 pi i of the branch — the corpus harness reported the answer wrong at 3 of 6 points while its symbolic derivative is the integrand.
Fix in the PR that found it: a negative real base to a real power that is a whole number of halves is the modulus to that power times i^k, exactly; and a real power that is a whole number is read as the integer it is, so the exact multiplication is used.
On master (40b7e587) both causes are gone, with the downcasting off:
(-0.473)^(1/2) 0 + 0.68774995456…i (was -6.1e-102 + 0.68775i)
(-4)^(3/2) -8i exactly
((-0.473)^(1/2))^2 -0.473, imaginary part zero
ln(((-0.473)^(1/2))^2) -0.74866 + 3.14159i (+i pi, the principal branch)
and with it on, the root and the logarithm come out the same. A half power of a negative real is i times the root of the modulus now, a decimal power with nothing after the point is taken as the whole power it is (#1379), and a zero imaginary part is on the real axis whatever its sign (#1433). Closing.
Activity
Powers of a logarithm's two linears beside it are integrated by t = L…
A zero imaginary part is on the real axis, whatever its sign (#1433)
Rafael-SOWNet commentedon Sep 28, 2026
On master (
40b7e587) both causes are gone, with the downcasting off:and with it on, the root and the logarithm come out the same. A half power of a negative real is
itimes the root of the modulus now, a decimal power with nothing after the point is taken as the whole power it is (#1379), and a zero imaginary part is on the real axis whatever its sign (#1433). Closing.