Re: Rounding off double precision
- From: Ron Shepard <ron-shepard@xxxxxxxxxxxxxxxxxx>
- Date: Fri, 28 Mar 2008 23:45:52 -0500
In article
<3277fc93-726f-428f-82cd-aae971d0711f@xxxxxxxxxxxxxxxxxxxxxxxxxxx>,
Bamm <bammster@xxxxxxxxx> wrote:
I'm trying some calculations in double precision, and I'd like the
output rounded off so that errors in calculation are not shown. For
instance, the result of COS(90 * 3.141592653589793238d0 / 180.) is
-4.37113886E-06. I'd like it to be zero. Thanks for any help.
The closest number is "never" going to be zero because there are
simply too many nonzero numbers near zero compared to floating point
numbers near the exact value of pi/2. However, I get
6.12323399573676604E-017 for the result of your expression, which is
a lot closer to zero than your value.
$.02 -Ron Shepard
.
- References:
- Rounding off double precision
- From: Bamm
- Rounding off double precision
- Prev by Date: Re: Rounding off double precision
- Next by Date: Re: Rounding off double precision
- Previous by thread: Re: Rounding off double precision
- Next by thread: Re: Rounding off double precision
- Index(es):
Relevant Pages
|
|