To properly support $tcl_precision in tcl, I need to change how I'm
currently implementing {$tcl_precision == 0}. Right now, I just fake
it by setting the precision to 16, but that isn't right.
What I really want is something like this in src/pmc/tclfloat.pmc:
if (precision)
buff = Parrot_sprintf_c(INTERP, "%.*vg", precision,
PMC_num_val(SELF));
else
buff = Parrot_sprintf_c(INTERP, "%g", PMC_num_val(SELF));
Which is really close, but it leads to failures: where something like
{expr acos(0)} should output:
1.5707963267948966
it outputs (with the above C code)
1.5708
And in partcl's current state, it outputs
1.570796326794897
So I'm assuming that there is a magic format parameter to sprintf_c is
to get this precision. I've tried "%lg" and "%Hg", but neither works
(one dies with an exception, the other returns nan.0)
Anyone have my missing clue?
--
Will "Coke" Coleda