Sam Ruby wrote:
> On Fri, Aug 22, 2008 at 5:06 PM, Waldemar Horwat <[EMAIL PROTECTED]> wrote:
>> Sam Ruby wrote:
>>> 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?
>> Sorry, I meant 5.4.2.
> 
> I still don't see the conflict.  If we desire, we can provide multiple
> mechanisms for converting binary64 floating point numbers to
> decimal128 floating point numbers.  At a minimum, we should provide an
> analog to ES's existing parseFloat.  I'd suggest that it be named
> Decimal.parse instead, and that it make use of
> decimal128-convertFromDecimalCharacter.

Now we've gone full circle without actually answering the question I asked:  
What should the full result of converting 1.1 to a Decimal be in ECMAScript?

"An error" or "you can't do it" is not a valid answer because it violates IEEE 
P754.

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

Reply via email to