D
Dr John Stockton
Occasional problems have been found in the old functions SigFigNo and
SigFigExp used on my web site (toFixed, toExponential, and toPrecision
are not available to me, even if they do what I want) - they are
intended to present results to a given number of significant figures
(the StrU family provides a given number of decimal places, which is not
the same).
New replacement code is at
<URL:http://www.merlyn.demon.co.uk/js-index.htm#DoRV> and needs testing.
There are comparatively brief methods using mainly arithmetic, which can
show rounding error, and somewhat longer ones relying more on string
manipulation. They handle undefined, Infinity, and NaN.
I don't mind if a fixed-point method reverts to javascript default
format for numbers of unreasonable size.
Would anyone like to inspect, comment, offer alternatives, etc.?
SigFigExp used on my web site (toFixed, toExponential, and toPrecision
are not available to me, even if they do what I want) - they are
intended to present results to a given number of significant figures
(the StrU family provides a given number of decimal places, which is not
the same).
New replacement code is at
<URL:http://www.merlyn.demon.co.uk/js-index.htm#DoRV> and needs testing.
There are comparatively brief methods using mainly arithmetic, which can
show rounding error, and somewhat longer ones relying more on string
manipulation. They handle undefined, Infinity, and NaN.
I don't mind if a fixed-point method reverts to javascript default
format for numbers of unreasonable size.
Would anyone like to inspect, comment, offer alternatives, etc.?