[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-gsl] Why the PI in the file trig.c of the GNU Scientific Library b
From: |
易昕 |
Subject: |
[Help-gsl] Why the PI in the file trig.c of the GNU Scientific Library be divided in three parts? |
Date: |
Sat, 24 Sep 2016 19:16:41 +0800 |
In code below, why is Pi divided in three constants P1, P2 and P3? Is there
some related math theory? If it is for improve the compute accuracy for r, I
run the code on higher precision but without any improve than just Pi.(The code
from gsl/specfunc/trig.c:576)
const double P1 = 4 * 7.85398125648498535156e-01;
const double P2 = 4 * 3.77489470793079817668e-08;
const double P3 = 4 * 2.69515142907905952645e-15;
const double TwoPi = 2*(P1 + P2 + P3);
const double y = 2*floor(theta/TwoPi);
double r = ((theta - y*P1) - y*P2) - y*P3;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Help-gsl] Why the PI in the file trig.c of the GNU Scientific Library be divided in three parts?,
易昕 <=