> > That's quite interesting though - it is spotting that 0.1 can't be
> > represented in a float and complaining, but it is OK with the other
> > values that can be represented.
> > That said, I don't think you can represent 0.1 as a double either...
> > Maybe there's a tolerance margin...
> >
> > Still, seems odd. Maybe that's too high a warning level? I 
> don't use the
> > VC tools so have no real opinion (or knowledge) about them.
> 
> No miracles. You can't represent 0.1 with zero error in any binary
> float format. Always exists small difference from the exact value.
> (There is no problem for 1, 0.5, 0.25 and others).
> Thus 0.1F != 0.1LF and the compiler reports about wrong cast of type.

Yup - I know that, and I guess Albrecht does too; my point was rather
that I found it curious that it only warns on the inexact conversion,
but not on the exact conversions.

I'd have thought the "easy" case for the compiler is just to treat all
these implicit double-to-float conversions as worthy of comment, but
here it is clearly only warning about the case where there will be some
(additional) loss of precision.

In any case, it seems to me to be slightly spurious, as it is clear (to
us humanoids) from the context that float is intended - though the
compiler can't assume that of course.
Maybe we should just add the trailing "f" qualifiers and make the
problem go away once and for all...






SELEX Galileo Ltd
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 
3EL
A company registered in England & Wales.  Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to