On Fri, Aug 22, 2008 at 4:18 PM, Waldemar Horwat <[EMAIL PROTECTED]> wrote:
> Sam Ruby wrote:
>> On Fri, Aug 22, 2008 at 3:55 PM, Waldemar Horwat <[EMAIL PROTECTED]> wrote:
>
>>> Here's a question for you:
>>>
>>> What should the full result of converting 1.1 to a Decimal be in 
>>> ECMAScript?  Describe the precise answer and justify your choice of answer. 
>>>  Hint:  This would behave remarkably differently depending on whether we 
>>> settle on Decimal64 or Decimal128.
>>
>> At the present time, I am only suggesting that ECMAScript support
>> Decimal128, and that there not by *any* implicit conversions to
>> Decimal.
>>
>> Decimal.parse(n) would take n.ToString() and then parse that as a
>> Decimal128 value.  If (in the future) additional precisions were
>> allowed by the standard, then there would be a second parameter on
>> Decimal.parse that would allow the precision to be specified.
>> Meanwhile:
>>
>> true: Decimal.parse(1.1) == 1.1m
>
> An interesting choice.  This produces more sensible results but directly 
> violates IEEE P754 section 5.3.3.

I'm looking at DRAFT P754, April 24, 2008.  Section 5.3.3 in this
draft is entitled "logBFormat operations".  I doubt that's what you
are referring to.  Can you provide me with a bit more context?

> If we're using Decimal64, then there are no major issues.  Converting 1.1 do 
> decimal would produce 1.1m, as both you and I desire.
>
> If we're using Decimal128, then IEEE P754 mandates that binary floats be 
> convertible to decimal floats and that the result of the conversion of 1.1 to 
> decimal be 1.100000000000000088817841970012523m.
>
> Hence, a dilemma if we choose Decimal128.  Do we obey the standard?

Deviations from the standard merit bug reports.

>    Waldemar
> _______________________________________________
> Es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
_______________________________________________
Es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to