Re: Initializing constants



"newsposter0123" <newsposter0123@xxxxxxxxx> writes:

Ben Pfaff wrote:
When compiling on i386 systems for i386 targets and using the
coprocessor, LDBL_PI evaluates to the 80bit value of fldpi instruction,
and when compiling on non i386 systems for i386 targets, an emulation
value is calculated from available resources.

What's the value in getting pi from an i386 instruction? I would
suggest just writing out enough digits of pi to cover the desired
level of significance.

Hardware generally provides constants other than pi.

For one, when converting numbers. Ideally you would like to get the
original number back. Especially when adjusting bases. But that debate
rages elsewhere.

Provided the precision of the measurements device was known in advance,
then the number of significant digits could be predetermined. If a
device with greater precision were used, then the constant would be
require adjustment (and no longer be a constant).

But the i386 floating-point architecture also has a fixed
precision. When you obtain your device with greater precision,
you will have to change the code anyhow. So I don't see the
benefit.
--
int main(void){char p[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.\
\n",*q="kl BIcNBFr.NKEzjwCIxNJC";int i=sizeof p/2;char *strchr();int putchar(\
);while(*q){i+=strchr(p,*q++)-p;if(i>=(int)sizeof p)i-=sizeof p-1;putchar(p[i]\
);}return 0;}
.



Relevant Pages

  • Re: Initializing constants
    ... coprocessor, LDBL_PI evaluates to the 80bit value of fldpi instruction, ... Provided the precision of the measurements device was known in advance, ... then the number of significant digits could be predetermined. ...
    (comp.lang.c)
  • Re: Arent decimals safely lumped under rationals?
    ... I don't think it's true that Lisp avoids things like floats, substituting another single way of doing things. ... where, of course, DECIMAL-RATIO is the type we've been discussing. ... And we'd need to fight over the digits of precision problem, ... fond memories of whacky Mr. Visco in 9th grade physical science spending a week or two on significant digits (which I think is how I will handle my requirements. ...
    (comp.lang.lisp)
  • Re: status of quadruple precision arithmetic in g95 and gfortran?
    ... But, a loop like ... will accumulate the representation error. ... the most significant digits cancel ... precision, using the Intel compiler which supports Real*16 (and ...
    (comp.lang.fortran)
  • Re: its just simple questions..please answer these.
    ... >operations on a calculator. ... >expressed with the precision of the least precise number. ... Your book should discuss 'significant digits' or 'significant ... It is not correct to 'round' intermediate calculations the way I did ...
    (sci.math)
  • Re: decimal precision
    ... I know that floats are approximated but I did not ... allowed in single precision floats... ... is a small number that fits easily in 15 significant digits? ... and to explicitely ask for displaying no more than this precision, ...
    (comp.lang.scheme)