Re: Initializing constants



"newsposter0123" <newsposter0123@xxxxxxxxx> writes:

Ben Pfaff wrote:
"newsposter0123" <newsposter0123@xxxxxxxxx> writes:

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.
Yep. Some hardware provides an 128bit long double.

When you obtain your device with greater precision,
you will have to change the code anyhow.

Depending on how the application was implemented, maybe. If the
calculations could be completed using the long double type, then no.
But the library/ api providing and/or using the constant would not
require adjustment.

You said, in the article that I originally replied to, that you
wanted to use an i386-specific instruction to obtain the value of
pi. You can't use that to obtain more than 80 bits of precision,
and you can't use it except on an i386 machine. Now you're
telling me that this will allow you to obtain greater precision
on a new device without adjusting the library or API.

So I don't see the
benefit.
Much easier for the programmer to implement.

I don't see how it's easier to use an i386-specific instruction
to obtain 80 bits of pi that to write a floating-point constant
that contains 80 bits of pi, and I certainly don't see how it
makes the code more extensible to better precision.

BTW, this is off topic, but if a measurment device (micrometer) is
graduated in thousands of an inch and has range 0-2 inch, would the
measurement .053 contain 3 or 4 significant digits and be written as
5.300e-2 or 5.30e-2? I'm pretty sure the measurement 1.053 would have
4.

Sounds like a trick question to me. I would think that .053 has
2 significant digits.
--
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: Singles to Doubles
    ... The one time science/math teacher in me has to beg to differ, ... significant digits. ... If you have some data, such as a measurement, recorded as 0.3026, what you have ... The various statements about accuracy, precision, and exactness are really ...
    (microsoft.public.vb.general.discussion)
  • 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)