Robbert,

>> I believe the bleeding edge version of Avail has a of-by-one error while 
>> pretty printing doubles.
>>
>> Using the evaluator:
>>
>> !1.2341
>> 1.234
>>
>> !6.2
>> 6.

It looks like the print representation is generated directly by Java
(DoubleDescriptor.java:214, printObjectOnAvoidingIndent).
Double.longBitsToDouble(long) is used to produce a double from two
AvailObject int slots, and then StringBuilder.append(double) generates
the print representation. Apparently that doesn't work correctly.

I have updated the code to use Formatter.format() (disguised as
String.format()), and to use %.8g for the print representation of
doubles. This produces 8 digits in the magnitude after rounding
(specifically, it is *not* the number of digits after the radix point).

This seems to be a fix. I'll let Robbert be the judge of that, though.

-- 
Todd L Smith
CEO | The Avail Foundation, LLC
www.availlang.org

Reply via email to