compute-engine icon indicating copy to clipboard operation
compute-engine copied to clipboard

odd nth roots of negative numbers evaluate to NaN

Open mdavis7168 opened this issue 1 year ago • 1 comments

Description

See title

Steps to Reproduce

Reproducible on the MathLive demo site: Screenshot from 2024-10-18 11-32-52

Actual Result

E.g. (-1)^{1/3}, (-32)^{1/5} evaluate to NaN

Expected Result

(-1)^{1/3} should evaluate to -1, (-32)^{1/5} to -2

Environment

Is this a regression: did it use to work in a previous version?

Compute Engine version If using the cortexjs.io site, the version is displayed at the bottom of the page. If using the library, the version is available as window[Symbol.for('io.cortexjs.compute-engine')].version in the browser or by importing version from the library.

MathLive version 0.101.1 ComputeEngine version 0.26.4

mdavis7168 avatar Oct 18 '24 18:10 mdavis7168

To clarify:

ce.parse('(-1)^{1/3}').evaluate().print();
// -> -1

but

ce.parse('(-1)^{1/3}').N().print();
// NaN

arnog avatar Oct 18 '24 19:10 arnog