dc Non-zero Scale in Exponent
This page answers questions like these:
- Why is dc saying “non-zero scale in exponent”?
- How to fix dc saying “non-zero scale in exponent”?
Related Links:
dc Remainder By Zero
dc Stop Line Breaks
bc Non-zero Scale In Exponent
dc Runtime warning: non-zero scale in exponent:
$ dc
2 2.5 ^ p
Runtime warning: non-zero scale in exponent
4
- When trying to calculate BASE ^ EXPONENT using dc, 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 of bc (not dc) 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 Remainder By Zero
dc Stop Line Breaks
bc Non-zero Scale In Exponent
Home > Linux / Unix > dc Non-zero Scale in Exponent
Tags: non-zero scale in exponent, dc non-zero scale in exponent, runtime warning, dc, exponent, non-zero, scale, exponent, calculator, linux, unix, solaris, bsd, aix
Copyright © HelpDoco.com
dc-non-zero-scale-in-exponent.txt
Linux-Unix/dc-non-zero-scale-in-exponent.htm
1