Replace the sin polynomial with the one used in the C64
This commit is contained in:
1 parent
797df05dc6
commit
bdd293d089
2 files changed
+9
-10
No files matched your search
@@ -0,0 +1 @@
|
||||
The polynomial for sin approximation. This is a well known polynomial taken from the book "Computer Approximations" by John Fraser Hart et al. (ISBN 0-88275-642-7) according to https://www.c64-wiki.com/wiki/POLY1
|
||||
@@ -58,16 +58,6 @@ std::vector<ConstEntry> GLOBAL_constants =
|
||||
ConstEntry( "LOG_2", std::log(2.0) ),
|
||||
ConstEntry( "INV_LOG_2", 1.0 / std::log(2.0) ),
|
||||
|
||||
// Constants for sine approximation, minimized abs. error, degree 11, for [0, pi/2], from:
|
||||
// - https://publik-void.github.io/sin-cos-approximations/
|
||||
|
||||
ConstEntry( "POLY_SIN_1", -2.3794713545277060334805162803882547e-8 ),
|
||||
ConstEntry( "POLY_SIN_2", 2.75188556386854406868696924998396177e-6 ),
|
||||
ConstEntry( "POLY_SIN_3", -0.000198407028626057951892931706291369095 ),
|
||||
ConstEntry( "POLY_SIN_4", 0.00833332926445715285723741015926085083 ),
|
||||
ConstEntry( "POLY_SIN_5", -0.166666665414391662957238076832950332 ),
|
||||
ConstEntry( "POLY_SIN_6", 0.99999999988985190065414932682350994 ),
|
||||
|
||||
// Constants for exp approximation, taken from https://www.c64-wiki.com/wiki/POLY1
|
||||
// original source is probably "Computer Approximations" by John Fraser Hart et al. (ISBN 0-88275-642-7)
|
||||
ConstEntry( "POLY_EXP_1", 2.1498763701e-5 ),
|
||||
@@ -79,6 +69,14 @@ std::vector<ConstEntry> GLOBAL_constants =
|
||||
ConstEntry( "POLY_EXP_7", 0.69314718618 ),
|
||||
ConstEntry( "POLY_EXP_8", 1.0 ),
|
||||
|
||||
// Constants for sin approximation, source as for exp above
|
||||
ConstEntry( "POLY_SIN_1", -14.381390672 ),
|
||||
ConstEntry( "POLY_SIN_2", 42.007797122 ),
|
||||
ConstEntry( "POLY_SIN_3", -76.704170257 ),
|
||||
ConstEntry( "POLY_SIN_4", 81.605223686 ),
|
||||
ConstEntry( "POLY_SIN_5", -41.341702104 ),
|
||||
ConstEntry( "POLY_SIN_6", 6.2831853069 ),
|
||||
|
||||
// Constants for log approximation, source as for exp above
|
||||
ConstEntry( "POLY_LOG_1", 0.43425594189 ),
|
||||
ConstEntry( "POLY_LOG_2", 0.57658454124 ),
|
||||
|
||||
Reference in new issue
Block a user