diff --git a/strings/0584E61A2D1B862807FBF88799688901872335DFE186A55DE72883490FDAA2 b/strings/0584E61A2D1B862807FBF88799688901872335DFE186A55DE72883490FDAA2 new file mode 100644 index 00000000..58fce093 --- /dev/null +++ b/strings/0584E61A2D1B862807FBF88799688901872335DFE186A55DE72883490FDAA2 @@ -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 diff --git a/tools/generate_constants.cc b/tools/generate_constants.cc index 712e6213..2f3c2cd7 100644 --- a/tools/generate_constants.cc +++ b/tools/generate_constants.cc @@ -58,16 +58,6 @@ std::vector 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 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 ),