On Tue, Nov 08, 2011 at 11:32:15AM -0500, Ted Unangst wrote:
> bc -l
> l(100)
> 4.60517018598809136803
> l(10000000000000000000000)
> dc: scale must be a nonnegative number
> 50.65687204586900504839
>
> huh? Why is it complaining about scale?
The definitions used by -l plays games with scale. Increase initial
scale to be at least the length of your arg (iirc) and you should be
fine. See for details the lib file itself:
At the start there's a line:
scale = 20
and in the implementation of l(x):
scale = scale + scale(x) - length(x) + 1
So if the length of x is long enough, the expression will become
negative.
It's a bug indeed... but kinda tricky to fix.
-Otto