Perhaps we need an ASH "format" function that interfaces the Java's DecimalFormat.
Of course Veracity was referring to a native ASH function, but where's the fun in that?

I've implemented a simple decimal_format function using existing ASH functions.
string decimal_format( float, [int], [boolean] )
Returns a string formatted to the specified precision (defaults to 7) and rounding (defaults to true).
It's not going to be perfect due to the way some floats work, but it's something.
Code:
> call decimal_format.ash 0.1
0.1
> call decimal_format.ash 1.1
1.1
> call decimal_format.ash 1.123
1.123
> call decimal_format.ash 123.456
123.4560012
> call decimal_format.ash 123456789.123456789
123456792.0
Attachments
Last edited: