lmi
[Top][All Lists]

## Re: [lmi] Two kinds of precision loss

 From: Vadim Zeitlin Subject: Re: [lmi] Two kinds of precision loss Date: Thu, 23 Mar 2017 02:48:38 +0100

```On Thu, 23 Mar 2017 00:27:46 +0000 Greg Chicares <address@hidden> wrote:

GC> I'm not sure a round-trip guarantee is even feasible.

[...snipping the (seriously) fascinating discussion of numeric curiosities,
if I have time, I'll try to return to it later, but for now I'd like to
concentrate on just the part about the practical consequences...]

GC> A round-trip guarantee would forbid casting almost any double to float.
GC> I think that demonstrates that such a guarantee is too restrictive to
GC> be useful.

Why? AFAICS lmi doesn't use float type anywhere, so why should we bother
casting double (or anything else) to it?

If the problem is difficult, but we don't need to solve it, can't we just
ignore it altogether? It may be a cowardly strategy, but it doesn't mean
it's an unwise one...

GC> >  Pragmatically speaking, my preferred solution would be to not solve this
GC> > problem at all unless we really have to. So for me the immediate question
GC> > is: do we need to allow double-to-float conversions in bourn_cast<>?
GC>
GC> Here's the decision tree as I see it:
GC>
GC>  - Abandon the goal that value_cast should convert anything to anything,
GC>    including floating <-> integral? I'm not willing to do that.

It's fine to convert between int and doubles when the value of double
represents an integer. I am not convinced that we need anything else. I'm
more than ready to trust you if you say that we do, but are you actually