javascript - toExponential() on Infinity number -
i'm trying first 7-8 numbers after digit on number infinity
.
i.e. console.log((4^3)/(3^3));
result in infinity
while real result 2.370370370...
. want number in 2.370370370e+-60
form.
i tried make result.toexponential(8);
no effects far. tips/answers appreciated.
in javascript, exponentiation made math.pow
function. there no inline operator ^
(as in python **
).
you should instead compute
math.pow(4, 3) / math.pow(3, 3)
a part that,
you computing (4 xor 3) / (3 xor 3)
, evaluates 7 / 0, infinity.
Comments
Post a Comment