Re: Initializing constants
- From: Ben Pfaff <blp@xxxxxxxxxxxxxxx>
- Date: Thu, 31 Aug 2006 11:25:42 -0700
"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;}
.
- Follow-Ups:
- Re: Initializing constants
- From: newsposter0123
- Re: Initializing constants
- References:
- Initializing constants
- From: newsposter0123
- Re: Initializing constants
- From: Ben Pfaff
- Re: Initializing constants
- From: newsposter0123
- Initializing constants
- Prev by Date: Re: strcpy, strtok and strcat problem...
- Next by Date: Re: c code reusability
- Previous by thread: Re: Initializing constants
- Next by thread: Re: Initializing constants
- Index(es):
Relevant Pages
|