lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

2018-06-07 4:04 GMT+02:00 KHMan <>:
> On 6/6/2018 8:53 PM, Albert Chan wrote:
>> strtod("123456789e-20", NULL)
>> = 123456789 / 1e20   -- both numbers exactly represented in double
>> = 1.23456789e-012    -- division guaranteed correct rounding
> Here is a different approach (the long story approach):
> =======================================================
> So it's no problem for most of us. But if mathematicians keep thinking about
> ideal situations and keep trying to hit exact points on the value line, then
> they should keep on doing so and not bother the rest of us about it.

Well, you two have really been talking at cross purposes. All of what
you say is true, but you think Albert does not know that. He thinks he

Albert's point (see his second post) applies to the situation where
floating-point to a certain precision is all you have. In that
situation, there are algorithms that deliver additional precision by
doing clever things — but those algorithms rely on knowing what kind
of rounding the processor does, all the time, every time. Now if you
explicitly set rounding mode, you know that. If you don't set it, you
don't know. It's like seeding a pseudo-random number generator [1].

Where my point of view differs from Albert's that he thinks it
strengthens his case by pointing out that Windows is an example of a
system that gives undesired results. I think that it triggers the
reaction: yet another case where Windows is sloppy — so what?

But the issue is just this: a failure to initialize something gives
undesired results.

I think it is a valid point with a very simple, cost-free workaround.

-- Dirk

[1] I use this comparison with trepidation, recalling some previous
threads on this list.