Re: Integer arithmetic vs double precision arithmetic

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

 



Shriramana Sharma wrote:

> > Why do you consider doubles to store time values?
> 
> Oh, I need to use fractional days (in Julian Day Numbers) for astronomical 
> calculations.

So store time in seconds or milliseconds and divide by 86400 or
86400000 to get days. If 32 bits isn't enough, use "long long".

Floating-point is meant for the situation where you want a constant
relative error rather than a constant absolute error. For timescales,
a constant absolute error is usually more useful.

-- 
Glynn Clements <glynn@xxxxxxxxxxxxxxxxxx>
-
: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [C Programming]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

  Powered by Linux