c++ - Possible Code Speed Optimisations? -
ok have trig class use store static table of values faster execution of sin, cos, , tan functions in program. there comments and/or speed improvements made on current method? previous answers, feeling more competent c++. trig.h #pragma once #include <math.h> class trig { private: struct table { static const int multiple = 10; // accurately stores values 1/10 of degree double sin[360*multiple]; table(); }; static const table table; static void shrinkrange(double*); // shrinks degrees range 0-359 proper array indexing public: static double sin(double); static double cos(double); static double tan(double); }; trig.cpp #include "trig.h" trig::table::table() // table constructor { double const pi = 3.14159265358979323; double const degtorad = pi/180.0; double const incr = 1.0/multiple; int index = 0; (double angle = 0; index != 360*table.multiple; angle += incr) table::sin[index...