Re: How to Define High-precision Date type
- From: Martin Ambuhl <mambuhl@xxxxxxxxxxxxx>
- Date: Fri, 31 Mar 2006 06:45:30 GMT
Donkey wrote:
Hi,
The precision of built-in date type of C is very low. Even using long
double float type or double float type, we can only use 12 or 16 digits
after the decimal point. What can we do if we want to use
high-precision number such as the number with 50 digits after the
decimal point. Can we define a user date type?
The average distance from the sun to Earth is about 149.598e6 km. Supose DBL_DIG to be 15. A (1e-15 * sun_to_earth_distance) is about .15 mm.
Be careful is assuming stating that 15 significant digits ("digits after the decimal point" is meaningless) is "very low". When 15 significant decimal digits allows expressing the average distance from the sun to the earth to with 0.15 mm, that is high accuracy, indeed.
The place that greater precision becomes meaningful is in intermendiate results in some arithmetic operations. You might want higher precision in, say, matrix inversion. There are several things to say about this:
1) long double *might* be sufficient, or
2) many packages exist for doing arithmetic with greater precision, or
3) you are making a serious mistake.
Point (3) is significant. If I found my problem required values beyond the capabilities of long doubles (18 significant figures and a range of 1e-4391 to 1e4392 on my implementation), I would seriously consider whether I had pathologogical data or an algorithm that needed fixing.
.
- Follow-Ups:
- Re: How to Define High-precision Date type
- From: Mark McIntyre
- Re: How to Define High-precision Date type
- References:
- How to Define High-precision Date type
- From: Donkey
- How to Define High-precision Date type
- Prev by Date: Re: How to Define High-precision Date type
- Next by Date: Re: Something About Date Type
- Previous by thread: Re: How to Define High-precision Date type
- Next by thread: Re: How to Define High-precision Date type
- Index(es):
Relevant Pages
|