Re: sin (M_PI)
- From: jacob navia <jacob@xxxxxxxxxxxxxxxx>
- Date: Thu, 12 Jul 2007 15:20:53 +0200
Tim Prince wrote:
Adam wrote:Hi,
I am using the following code:
printf("%g", sin(M_PI))
and getting 1.22461e-16 instead of zero.
Does anyone have any idea why, and what I can do about it?
As the other responders have pointed out, this is to be expected. If you had opened up your search engine, you surely would have found some close references.
As you haven't said anything about your goals for modifying this behavior, the suggestion about sinl(M_PIl) is as good as any, keeping in mind that default Windows behavior is for long double to be simply an alias for double.
This is wrong. The lcc-win32 compiler features full precision (80 bits
floating point) for long double. The long double equals double
feature is just a feature of one compiler system under windows:
Microsoft MSVC. Other compilers under windows offer more precision.
jacob
.
- References:
- sin (M_PI)
- From: Adam
- Re: sin (M_PI)
- From: Tim Prince
- sin (M_PI)
- Prev by Date: Re: sin (M_PI)
- Next by Date: Re: sin (M_PI)
- Previous by thread: Re: sin (M_PI)
- Next by thread: Re: sin (M_PI)
- Index(es):
Relevant Pages
|