pow function problem
Posted: Mon Oct 19, 2020 9:11 am
I have some problems with the pow function:
In Mathematica (WolframAlpha):
A simple solution:
Why newLISP result is 1.#IND?
Code: Select all
(pow 3 0.33)
;-> 1.436977652184852
(pow -3 0.33)
;-> 1.#IND
Code: Select all
3^0.33 = 1.436977652184852
-3^0.33 = -1.436977652184852
Code: Select all
(define (pow-ext x n)
(if (< x 0)
(sub 0 (pow (sub 0 x) n))
(pow x n)))
(pow-ext 3 0.33)
;-> 1.436977652184852
;(pow-ext -3 0.33)
;-> -1.436977652184852