Thoughts on IEEE P754

Breton Slivka zen at zenpsycho.com
Sat Aug 23 04:01:46 PDT 2008


On Sat, Aug 23, 2008 at 7:08 PM, David Jones <drj at ravenbrook.com> wrote:
>
> On 22 Aug 2008, at 22:46, Mark S. Miller wrote:
>>
>> Finally, I'd like to take a poll: Other than people working on decimal
>> at IBM and people on the EcmaScript committee, is there anyone on this
>> list who thinks that decimal adds significant value to EcmaScript? If
>> so, please speak up. Thanks.
>
> Yes.  I think decimal adds value, but I'm afraid my strongest reason
> for thinking so is that decimal is getting added to other languages
> (C#, C++, Python) and JavaScript will be perceived as "not as useful/
> modern/fashionable" if it doesn't have it and therefore get used less
> and therefore have a less healthy community of users.
>
> I have other reasons too, but that's the strongest.
>
> drj


forgive me if this is a dumb question, from a dumb user, but is there
any significant advantage to using decimal arithmetic other than being
able to do more accurate financial calculations? If no, is there any
significant advantage to using decimal arthithmetic over using integer
arithmetic? Ecmascript seems quite capable of doing integer arithmetic
quite well and without any rounding errors, and it's not that
difficult to do calculations in cents instead of dollars. In fact I do
just that in my own programs.

Is decimal being considered because it's more intuitive? it might be,
but if that's the only reason for its existance, aside from politics,
then I can't say that it's a feature that I'm hurting for. Plenty of
other nicer features to hurt for.  If financial calculations are the
only reason for its existance, then it seems to me that simpler
solutions lie in what an interpreter does with what's already there,
rather than try to add new language features.

As I understand, spidermonkey detects if you're only using integers,
and internally only uses integers up until the point that a floating
point calculation is introduced. Is it anywhere in the realm of
possibility to do something similar for numbers with only two decimal
places? In my own programs, if I need anything more than two decimal
places, I don't care that much at all about the kinds of rounding
errors that floating point arithmetic introduces. (notwithstanding
uses that I'm not aware of)


More information about the Es-discuss mailing list