diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2013-07-18 20:50:17 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2013-07-18 20:51:55 -0700 |
commit | 52bbd1ce31f1adf2b7145b9d6183f6b866fa9301 (patch) | |
tree | 08a1fea4fc5655eaf3611c6df6f4e914bd8a8ab4 /Clock.c | |
parent | 69de4eaa3be6cc177eb53a4754cb6bd35340c585 (diff) |
Store sine & cosine tables as doubles instead of floats
Since they're used as doubles in the calculations, might as well store them
that way instead of converting when read from the table at runtime.
Costs about 4k more storage in the binary for the doubled tables.
Also gets rid of 900 clang warnings, of the form:
Clock.c:1708:11: warning: implicit conversion loses floating-point precision:
'double' to 'float' [-Wconversion]
0.000000, 0.001745, 0.003490, 0.005235, 0.006981, 0.008726, 0.010471, 0.012217,
(one for each table entry)
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'Clock.c')
-rw-r--r-- | Clock.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1704,7 +1704,7 @@ erase_hands(ClockWidget w, struct tm *tm) } } -static float const Sines[] = { +static double const Sines[] = { 0.000000, 0.001745, 0.003490, 0.005235, 0.006981, 0.008726, 0.010471, 0.012217, 0.013962, 0.015707, 0.017452, 0.019197, 0.020942, 0.022687, 0.024432, 0.026176, 0.027921, 0.029666, 0.031410, 0.033155, 0.034899, 0.036643, 0.038387, 0.040131, @@ -1763,7 +1763,7 @@ static float const Sines[] = { 0.694658, 0.695912, 0.697165, 0.698415, 0.699663, 0.700909, 0.702153, 0.703394, 0.704634, 0.705871, 0.707106, }; -static float const Cosines[] = { +static double const Cosines[] = { 1.000000, 0.999998, 0.999993, 0.999986, 0.999975, 0.999961, 0.999945, 0.999925, 0.999902, 0.999876, 0.999847, 0.999815, 0.999780, 0.999742, 0.999701, 0.999657, 0.999610, 0.999559, 0.999506, 0.999450, 0.999390, 0.999328, 0.999262, 0.999194, |