Re: How to Define High-precision Date type



Donkey a écrit :
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 lcc-win32 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.841470984807896506652502321630298999622563060798371065672751709991910404391239668948639743543052695854349
.



Relevant Pages

  • Re: How to Define High-precision Date type
    ... double float type or double float type, we can only use 12 or 16 digits ... The place that greater precision becomes meaningful is in intermendiate results in some arithmetic operations. ...
    (comp.lang.c)
  • Re: Turn $6 into $6.000
    ... Well, you could use a float type instead of an int, but be careful for ... rounding errors. ... you only need two places of precision to ...
    (comp.programming)
  • How to Define High-precision Date type
    ... The precision of built-in date type of C is very low. ... double float type or double float type, we can only use 12 or 16 digits ...
    (comp.lang.c)
  • Re: This calculation is just wrong / computer cant count!
    ... Think of the float type like you would a ... it is as correct as it can be given the amount of storage ... I expected the C++ basic data types to be able to handle simple maths ... Clearly it can only store digits to a certain number binary ...
    (microsoft.public.vc.mfc)
  • [OT] Re: right truncate of float variable
    ... Keith Thompson wrote: ... >>Sorry back ground is that I will be always getting a number of float type, ... nerdy kids dared each other to recite the digits of pi. ... Prev by Date: ...
    (comp.lang.c)