[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnu3dkit-dev] Commit: G3DDefs.h
From: |
Brent Gulanowski |
Subject: |
[Gnu3dkit-dev] Commit: G3DDefs.h |
Date: |
Mon, 21 Oct 2002 01:43:42 -0400 |
I have improved the precision of the following definitions to take full
advantage of the double type:
#define DEG2RAD
#define RAD2DEG
#define TWOPI
#define PIOVER2
#define E
#define SQRT2
#define SQRT3
Also, I replaced the fractional definition of DEG2RAD and RAD2DEG with
precalculated values.
The replacement values are accurate to 16 decimal digits. IEEE764
double precision floation point types contain 52 bits devoted to the
mantissa, plus one hidden bit to the left of the decimal. The
right-most binary bit has a value 2^-52 relative to the left-most
(hidden) bit, or 2e-16 decimal.
Values were taken from a math page on the internet, the math.h header
(usr/include/architecture/ppc/math.h in Mac OS X), and values output by
the sqrt() function, double- and triple-checking where possible.
DEG2RAD and RAD2DEG were calculated using a program and printing with
printf().
--
Brent Gulanowski address@hidden
"Of course the Universe hates you. You're working to reduce chaos by
expending a lot of energy to do your job. Thus, you're contributing to
the eventual heat death of the universe, and it's just protecting
itself from you." -- John Batzel
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnu3dkit-dev] Commit: G3DDefs.h,
Brent Gulanowski <=