Re: why float

Tech-Archive recommends: Speed Up your PC by fixing your registry




"Martijn Mulder" <i@m> wrote in message
news:44536053$0$12852$dbd4d001@xxxxxxxxxxxxxxxxxx
Waaaay back in my university days, in my Numerical Analysis course, I
remember one example in which using doubles everywhere (the obvious
solution) actually increased error and gave a less precise answer than
judicious application of floats in the right places.
<snip>

That is unlikely. A double *is* a float with more precision. So it will
always be as precise or more precise than a flaot is. Answers given in the
line of "32 bit is favored" are platform-dependenpt and not realy
convincing. Why is there a fundamental type 'float' and a fundamental type
'double' that both do the same thing? When to use the one, when to use the
other?

What he is saying rings a bell with me too.

Unfortunately I failed my numerical analysis block so I can't add an
authoritative explanation either :(

It is possibly to do with spurious precision in the doubles - in numerical
analysis the inputs are usualy measurements approximating the true values
and do not have the number of significant digits in a double so when you
start using these extra digits you can introduce more error than if you
stuck with float ... or not. I think it depends on teh algorithm as well.

It's not realy an argument for float though because you can acheive the same
or better results by using double and reworking the algorithm and/or
rounding here and there.


.



Relevant Pages

  • Re: using MFC VC++ - which is more efficient - float or double?
    ... I'm about to say may be null and void. ... I don't think its true that the hardware does everything as doubles. ... there's nothing that is 'saved' by using float. ... If you are working with large sets of data, then memory. ...
    (microsoft.public.vc.mfc)
  • Re: using MFC VC++ - which is more efficient - float or double?
    ... I'm about to say may be null and void. ... As far as I know everything is floating point and doubles takes extra processing to emulate. ... there's nothing that is 'saved' by using float. ... This gets to be a problem sometimes even with a Gig or several Gigs of memory. ...
    (microsoft.public.vc.mfc)
  • Re: using MFC VC++ - which is more efficient - float or double?
    ... Measurements made in debug mode are usually useless. ... float f2 = 5.0; ... __declspecvoid DoubleComputation() ... I don't think its true that the hardware does everything as doubles. ...
    (microsoft.public.vc.mfc)
  • Re: using MFC VC++ - which is more efficient - float or double?
    ... float f2 = 5.0; ... int I = 5000000; ... __declspecvoid DoubleComputation() ... As far as I know everything is floating point and doubles takes extra processing to emulate. ...
    (microsoft.public.vc.mfc)
  • Re: why float
    ... A double *is* a float with more precision. ... It is possibly to do with spurious precision in the doubles - in numerical ... I think it depends on teh algorithm as well. ... single-precision in order to stop rounding errors from amplifying ...
    (microsoft.public.dotnet.languages.csharp)