Re: union
Vladimir S. Oka wrote:
Michael Mair wrote:
ramu wrote:
Vladimir S. Oka wrote:
<snip>
PS
Don't get into habit of using floats. Use double instead.
Will you please tell that why we have to use double instead of floats?
float has fewer significant digits and you get inexact results
_much_ earlier. Usually, you cannot even store all long values
exactly in a float variable.
double has only slightly better guarantees with respect to
the number of digits but in practice has many more.
Using double thus means that you most of the time can forget
about precision (numerics and excessive financial calculation
excluded).
<OT> Apart from that, double is definitely not slower on modern
host PCs </OT>
Also, in many context in a C program, floats will be promoted/converted
to doubles anyway (and maybe then back to float again, if you assign
expression result to a float variable), thus negating any performance
gains you may think you got.
Thanks -- I forgot to mention this; was in my head but did
not run through the fingers... :-)
Cheers
Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.
.
Relevant Pages
- Re: Extremely wierd problem I just cannot explain...works in debug, does not work in release.
... a float or double should be used to store _only_ measured ... kimi no koto omoidasu hi nante nai no wa ... kimi no koto wasureta toki ga nai kara ... (microsoft.public.dotnet.languages.csharp) - Re: Float value changes unexpectedly when performing math on field
... Float fields, by definition, have some built-in imprecision. ... This is a side effect being able to store very large numbers in smaller spaces. ... So, ideally, if that is not what you want, you should NUMERIC or DECIMAL, but not float. ... rollover to zero so I have a rollover count and rollover point so I can ... (microsoft.public.sqlserver.server) - Re: storing floating point data with using float or double
... I don't intend to store all of the 100,000 datapoints, but rather a subset ... I don't need the precision of a float, the above values would be fine to ... A couple of ideas I have come up with is to try compressing the array of ... though about breaking the values into an sbyte and a byte like this: ... (microsoft.public.dotnet.languages.csharp) - Re: storing floating point data with using float or double
... You can store the values as fixed point values in shorts. ... You would be able to get a precision of three decimals if you'd like. ... The numbers you could store this way would range from -32.768 to 32.767. ... Recently it was requested that I add the ability to generate graphs from the raw, un formatted test results (100,000+ float values) ... (microsoft.public.dotnet.languages.csharp) - Re: decode-float vs integer-decode-float
... >>concerned but I'm hoping maybe someone can explain to me the reason ... >>one that the first value is an float in one case and an integer in the ... > Suppose you want to store stuff to a file using WRITE-BYTE. ... use DECODE-FLOAT. ... (comp.lang.lisp) |
|