P: n/a

Hi,
The precision of builtin 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
highprecision number such as the number with 50 digits after the
decimal point. Can we define a user date type?  
Share this Question
P: n/a

In article <11**********************@i39g2000cwa.googlegroups .com>,
Donkey <ne********@hotmail.com> wrote: The precision of builtin 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 highprecision number such as the number with 50 digits after the decimal point. Can we define a user date type?
No, if you want longer precision that is provided by the compiler,
then you either have to program the calculation routines yourself,
or else find a prewritten extended precision library and use it.

Programming is what happens while you're busy making other plans.  
P: n/a

"Donkey" <ne********@hotmail.com> writes: The precision of builtin 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 highprecision number such as the number with 50 digits after the decimal point. Can we define a user date type?
Use a library such as GNU GMP (google it).

Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.  
P: n/a

Donkey wrote: Hi, The precision of builtin 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 highprecision 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 (1e15 * 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
1e4391 to 1e4392 on my implementation), I would seriously consider
whether I had pathologogical data or an algorithm that needed fixing.  
P: n/a

Donkey a écrit : Hi, The precision of builtin 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 highprecision number such as the number with 50 digits after the decimal point. Can we define a user date type?
The lccwin32 compiler offers the qfloat data type with 103 digits
precision and 350 bits
#include <stdio.h>
#include <qfloat.h>
int main(void)
{
qfloat s = sinq(1.0q);
printf("%118.109qf\n",s);
}
Output:
0.841470984807896506652502321630298999622563060798 37106567275170999191040439123966894863974354305269 5854349  
P: n/a

On Fri, 31 Mar 2006 06:45:30 GMT, in comp.lang.c , Martin Ambuhl
<ma*****@earthlink.net> wrote: 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.
OTOH, when buying a couple of tonnes of Platinum in Tunisian Dinar,
its easy to rapidly lose all 15 digits, and the discrepancy is quite
expensive... :)
The place that greater precision becomes meaningful is in intermendiate results in some arithmetic operations.
This is absolutely true.
If I found my problem required values beyond the capabilities of long doubles (18 significant figures and a range of 1e4391 to 1e4392 on my implementation), I would seriously consider whether I had pathologogical data or an algorithm that needed fixing.
Or you work in astronomy or finance...
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
Brian Kernighan  
P: n/a

Mark McIntyre wrote: On Fri, 31 Mar 2006 06:45:30 GMT, in comp.lang.c , Martin Ambuhl <ma*****@earthlink.net> wrote:
[...]If I found my problem required values beyond the capabilities of long doubles (18 significant figures and a range of 1e4391 to 1e4392 on my implementation), I would seriously consider whether I had pathologogical data or an algorithm that needed fixing.
Or you work in astronomy or finance...
Nonsense. Astronomers are often ecstatic with data of much less
significance than is guaranteed even for a float. Consider that the
relative error for G, the Newtonian gravitational constant, is 1.5e4 in
the 2002 CODATA values. Astronomy is an extremely poorly chosen example
for your purposes.
Nonsense. No sane person is using floating point types for finance, in
the first place. Such a person will be fired before the day is out,
anyway, so the number of significant digits is irrelevant.
Let's assume a less than sane person did use long doubles of my
implementation for finance. It is unlikely that such a person would
deal in numbers larger than those for the United States government. The
estimated revenues for 2011 (the largest numbers available) are
$3.034861e12 ($2.233286e12 on budget) and estimated expenditures are
$3.23879e12 ($2.648669e12 on budget). These numbers are all expressible
to the penny in 15 decimal digits. They would need to be 1000 times as
large to cause concern with 18 significant digits. Of course, the Bush
experience has taught us that these numbers might not even have one
significant digit. Finance is an extremely poorly chose example for
your purposes.  
P: n/a

On Fri, 31 Mar 2006 22:55:53 GMT, in comp.lang.c , Martin Ambuhl
<ma*****@earthlink.net> wrote: Mark McIntyre wrote:
Or you work in astronomy or finance...
Nonsense. Astronomers are often ecstatic with data of much less significance than is guaranteed even for a float.
Oh, sure. Apparently you don't do much spectroscopy or
astronavigation.
Consider that the relative error for G, the Newtonian gravitational constant, is 1.5e4 in the 2002 CODATA values.
This is a /physically observed/ constant. Its by definition not
accurate.
Astronomy is an extremely poorly chosen example for your purposes.
Apparently you're not an astronomer.
Nonsense. No sane person is using floating point types for finance, in the first place. Such a person will be fired before the day is out, anyway, so the number of significant digits is irrelevant.
Go tell that to the thousands of people using it every single day in
the City, New York .Tokyo, Frankfurt. etc.
Sorry, but you really have absolutely no idea what you're talking
about. I've worked in the City for 15 years now, and I do.
It is unlikely that such a person would deal in numbers larger than those for the United States government.
Rolls on the floor laughing. A few words to play with: leverage,
options, exchange rates. Do you have any idea the total value of FX
and FX options traded last year?
Finance is an extremely poorly chose example for your purposes.
Actually, since I was pointing out that often 15sf isn't enough
precision, I think its a very good example.
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
Brian Kernighan  
P: n/a

"Mark McIntyre" <ma**********@spamcop.net> wrote in message
news:io********************************@4ax.com... On Fri, 31 Mar 2006 22:55:53 GMT, in comp.lang.c , Martin Ambuhl <ma*****@earthlink.net> wrote:
Mark McIntyre wrote: Consider that the relative error for G, the Newtonian gravitational constant, is 1.5e4 in the 2002 CODATA values.
This is a /physically observed/ constant. Its by definition not accurate.
Well, many physical constants are meausred through experiments. I think the
relatively low accuracy in the measurement of the gravitational constant is
due to the fact that gravitational forces are rather weak. Astronomy is an extremely poorly chosen example for your purposes.
Apparently you're not an astronomer.
Nonsense. No sane person is using floating point types for finance, in the first place. Such a person will be fired before the day is out, anyway, so the number of significant digits is irrelevant.
Go tell that to the thousands of people using it every single day in the City, New York .Tokyo, Frankfurt. etc.
Sorry, but you really have absolutely no idea what you're talking about. I've worked in the City for 15 years now, and I do.
I apologize for my ignorance: City==London?  
P: n/a

stathis gotsis wrote: "Mark McIntyre" <ma**********@spamcop.net> wrote in message news:io********************************@4ax.com... On Fri, 31 Mar 2006 22:55:53 GMT, in comp.lang.c , Martin Ambuhl <ma*****@earthlink.net> wrote:
Mark McIntyre wrote: Consider that the relative error for G, the Newtonian gravitational constant, is 1.5e4 in the 2002 CODATA values. This is a /physically observed/ constant. Its by definition not accurate.
Well, many physical constants are meausred through experiments. I think the relatively low accuracy in the measurement of the gravitational constant is due to the fact that gravitational forces are rather weak.
Astronomy is an extremely poorly chosen example for your purposes. Apparently you're not an astronomer.
Nonsense. No sane person is using floating point types for finance, in the first place. Such a person will be fired before the day is out, anyway, so the number of significant digits is irrelevant. Go tell that to the thousands of people using it every single day in the City, New York .Tokyo, Frankfurt. etc.
Sorry, but you really have absolutely no idea what you're talking about. I've worked in the City for 15 years now, and I do.
I apologize for my ignorance: City==London?
Not exactly. The City is part of London, where the banks are. Piccadilly
and Hyde Park are also parts of London but are not The City.

Joe Wright
"Everything should be made as simple as possible, but not simpler."
 Albert Einstein   
P: n/a

On Sun, 2 Apr 2006 03:31:21 +0300, in comp.lang.c , "stathis gotsis"
<st***********@hotmail.com> wrote: about. I've worked in the City for 15 years now, and I do.
I apologize for my ignorance: City==London?
Yes, the City of London is the actual name of the borough that
comprises the central part of London. It contains the financial and
commerce district, barring a few weirdos who've moved to Docklands. http://www.cityoflondon.gov.uk/Corpo...undary_map.htm
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
Brian Kernighan  
P: n/a

Joe Wright <jo********@comcast.net> wrote: stathis gotsis wrote: "Mark McIntyre" <ma**********@spamcop.net> wrote in message news:io********************************@4ax.com... On Fri, 31 Mar 2006 22:55:53 GMT, in comp.lang.c , Martin Ambuhl <ma*****@earthlink.net> wrote:
Nonsense. No sane person is using floating point types for finance, in the first place. Such a person will be fired before the day is out, anyway, so the number of significant digits is irrelevant. Go tell that to the thousands of people using it every single day in the City, New York .Tokyo, Frankfurt. etc.
Sorry, but you really have absolutely no idea what you're talking about. I've worked in the City for 15 years now, and I do.
He said _sane_ people. Given the position of economy on the scientific
ladder (basically that of an amputated walrus trying desperately to
climb up, but too stupid and ungainly to find the first rung), it
shouldn't surprise anyone that major financial centres run on what is
basically guesswork. Scare, perhaps, but not surprise.
I apologize for my ignorance: City==London?
Not exactly. The City is part of London, where the banks are. Piccadilly and Hyde Park are also parts of London but are not The City.
Not officially. The City is London, also known as the Square Mile (which
is more or less accurate). Piccadilly is Westminster, and so is Hyde
Park. What you're thinking of is Greater London.
Richard  
P: n/a

On Mon, 03 Apr 2006 07:00:23 GMT, in comp.lang.c , rl*@hoekstrauitgeverij.nl (Richard Bos) wrote: He said _sane_ people.
Sorry, I missed that bit. The wall sign was actually invented by us
city types I think. :)
shouldn't surprise anyone that major financial centres run on what is basically guesswork.
Options pricing, anyone?
Scare, perhaps, but not surprise.
And most of it runs on Windows desktops.....
you can run, but you cant' hide... > I apologize for my ignorance: City==London?
Not exactly. The City is part of London, where the banks are. Piccadilly and Hyde Park are also parts of London but are not The City.
Not officially. The City is London, also known as the Square Mile (which is more or less accurate). Piccadilly is Westminster, and so is Hyde Park. What you're thinking of is Greater London.
Yer all wrong. The City Of London is an entire city all of its own,
surrounded by more plebeian regions such as Islington, Westminster,
Southwark etc....
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
Brian Kernighan  
P: n/a

Mark McIntyre <ma**********@spamcop.net> wrote: On Mon, 03 Apr 2006 07:00:23 GMT, in comp.lang.c , rl*@hoekstrauitgeverij.nl (Richard Bos) wrote:
> I apologize for my ignorance: City==London?
Not exactly. The City is part of London, where the banks are. Piccadilly and Hyde Park are also parts of London but are not The City.
Not officially. The City is London, also known as the Square Mile (which is more or less accurate). Piccadilly is Westminster, and so is Hyde Park. What you're thinking of is Greater London.
Yer all wrong. The City Of London is an entire city all of its own, surrounded by more plebeian regions such as Islington, Westminster, Southwark etc....
That's what I said, innit? Although I wouldn't describe Westmonasterium
as plebeian. Upstart, perhaps.
Of course, all poor saps who _work_ in the City actually come from the
borough to the NorthEast...
Richard  
P: n/a

Martin Ambuhl wrote: 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.
Just a nit:
I believe you mean high precision, not accuracy. One could say the
distance from the earth to the sun is 0.123456789 meters which is
(relatively) very precise, but not accurate.
REH   This discussion thread is closed Replies have been disabled for this discussion.   Question stats  viewed: 3583
 replies: 15
 date asked: Mar 31 '06
