bc Non-zero Scale in Exponent
This page answers questions like these:
- Why is bc saying “non-zero scale in exponent”?
- How to fix bc saying “non-zero scale in exponent”?
Related Links:
dc Non-zero Scale In Exponent
dc Stop Line Breaks
bc Runtime warning (func=(main), adr=9): non-zero scale in exponent:
$ bc -l
2^2.5
Runtime warning (func=(main), adr=9): non-zero scale in exponent
4
- When trying to calculate BASE ^ EXPONENT using bc, it gives an error, then outputs the result as if the exponent were integral, so in the example above it outputs 4 which is 2^2.
- One way to get around this is to use the built-in natural logarithm functions as below.
- N.B. The function “l()” below has a lowercase L at the front, not a 1 (one).
$ bc -l
e(l(2)*2.5) <-- i.e. This calculates 2 ^ 2.5.
5.65685424949238019507
e(l(2)*0.5) <-- i.e. This calculates 2 ^ 0.5, i.e. √2.
1.41421356237309504878
e(l(2)*-0.5) <-- i.e. This calculates 2 ^ -0.5, i.e. 1 / √2.
.70710678118654752440
- Pros: Works even if BASE is nonintegral. Works even if EXPONENT is negative.
Related Links:
dc Non-zero Scale In Exponent
dc Stop Line Breaks
Home > Linux / Unix > bc Non-zero Scale in Exponent
Tags: non-zero scale in exponent, bc non-zero scale in exponent, runtime warning, exponent, non-zero, scale, calculator, linux, unix, solaris, bsd, aix
Copyright © HelpDoco.com
bc-non-zero-scale-in-exponent.txt
Linux-Unix/bc-non-zero-scale-in-exponent.htm
1