Function Range Number Max Error Rate
-------------------------------------------------------------------------
sinf [-3.14, 3.14] 500000 5.94e-006% 100.00%
sinf_c [-3.14, 3.14] 500000 8.35e-003% 193.75%
cosf [-3.14, 3.14] 500000 5.92e-006% 100.00%
cosf_c [-3.14, 3.14] 500000 1.59e-002% 93.75%
tanf [-0.79, 0.79] 500000 5.95e-006% 100.00%
tanf_c [-0.79, 0.79] 500000 7.75e-004% 151.61%
asinf [-1.00, 1.00] 500000 5.95e-006% 100.00%
asinf_c [-1.00, 1.00] 500000 1.06e-002% 131.91%
acosf [-1.00, 1.00] 500000 5.95e-006% 100.00%
acosf_c [-1.00, 1.00] 500000 5.98e-003% 136.96%
atanf [-1.00, 1.00] 500000 5.93e-006% 100.00%
atanf_c [-1.00, 1.00] 500000 2.12e-002% 193.75%
sinhf [-3.14, 3.14] 500000 0.00e+000% 100.00%
sinhf_c [-3.14, 3.14] 500000 3.49e-003% 200.00%
coshf [-3.14, 3.14] 500000 0.00e+000% 100.00%
coshf_c [-3.14, 3.14] 500000 1.19e-005% 200.00%
tanhf [-3.14, 3.14] 500000 0.00e+000% 100.00%
tanhf_c [-3.14, 3.14] 500000 3.62e-003% 290.63%
expf [0.00, 50.00] 500000 0.00e+000% 100.00%
expf_c [0.00, 50.00] 500000 2.38e-005% 196.88%
logf [1.00, 1000.00] 5000000 5.96e-006% 100.00%
logf_c [1.00, 1000.00] 5000000 5.00e-003% 182.98%
log10f [1.00, 1000.00] 5000000 5.95e-006% 100.00%
log10f_c [1.00, 1000.00] 5000000 6.56e-003% 202.15%
floorf [1.00, 1000.00] 5000000 0.00e+000% 100.00%
floorf_c [1.00, 1000.00] 5000000 0.00e+000% 178.48%
ceilf [1.00, 1000.00] 5000000 0.00e+000% 100.00%
ceilf_c [1.00, 1000.00] 5000000 0.00e+000% 179.49%
fabsf [1.00, 1000.00] 5000000 0.00e+000% 100.00%
fabsf_c [1.00, 1000.00] 5000000 0.00e+000% 48.39%
sqrtf [1.00, 1000.00] 500000 5.96e-006% 100.00%
sqrtf_c [1.00, 1000.00] 500000 1.04e-003% 100.00%
atan2f [0.10, 10.00] 10000 5.95e-006% 100.00%
atan2f_c [0.10, 10.00] 10000 2.23e-002% 83.87%
powf [1.00, 10.00] 10000 0.00e+000% 100.00%
powf_c [1.00, 10.00] 10000 9.92e-004% 327.42%
fmodf [1.00, 10.00] 10000 0.00e+000% 100.00%
fmodf_c [1.00, 10.00] 10000 0.00e+000% 34.04%
Vorporeal said:From what I can tell, it looks like your increased speed comes with decreased accuracy. That's fine for most applications, but some situations will need the added accuracy more than the faster execution.
Thats the idea of the library. If you want cmath like accuracy for many functions you need significant branches to subdivide the range, each of which cause a >20 cycle NEON & ARM stall. Also remember that this is simply relative peak error (as a percentage) over the range I've specified, in general it is a very bad characterization of error.From what I can tell, it looks like your increased speed comes with decreased accuracy. That's fine for most applications, but some situations will need the added accuracy more than the faster execution.
Function Range Number ABS Max Error REL Max Error RMS Error Rate
------------------------------------------------------------------------------------
sinf [-3.14, 3.14] 500000 2.98e-008 5.94e-006% 1.45e-008 100.00%
sinf_c [-3.14, 3.14] 500000 7.29e-007 1.00e+002% 4.08e-007 213.33%
cosf [-3.14, 3.14] 500000 2.98e-008 5.92e-006% 1.46e-008 100.00%
cosf_c [-3.14, 3.14] 500000 7.65e-007 1.31e+000% 4.16e-007 193.75%
tanf [-0.79, 0.79] 500000 4.37e-008 5.95e-006% 1.21e-008 100.00%
tanf_c [-0.79, 0.79] 500000 2.79e-006 7.75e-004% 1.31e-006 100.00%
asinf [-1.00, 1.00] 500000 5.96e-008 5.95e-006% 1.77e-008 100.00%
asinf_c [-1.00, 1.00] 500000 5.53e-005 1.06e-002% 1.68e-005 193.75%
acosf [-1.00, 1.00] 500000 1.19e-007 5.95e-006% 4.47e-008 100.00%
acosf_c [-1.00, 1.00] 500000 5.54e-005 5.98e-003% 1.68e-005 134.04%
atanf [-1.00, 1.00] 500000 2.98e-008 5.93e-006% 1.26e-008 100.00%
atanf_c [-1.00, 1.00] 500000 1.67e-004 2.12e-002% 7.39e-005 100.00%
sinhf [-3.14, 3.14] 500000 0.00e+000 0.00e+000% 0.00e+000 100.00%
sinhf_c [-3.14, 3.14] 500000 9.54e-007 1.00e+002% 2.18e-007 197.87%
coshf [-3.14, 3.14] 500000 0.00e+000 0.00e+000% 0.00e+000 100.00%
coshf_c [-3.14, 3.14] 500000 9.54e-007 1.19e-005% 2.21e-007 293.75%
tanhf [-3.14, 3.14] 500000 0.00e+000 0.00e+000% 0.00e+000 100.00%
tanhf_c [-3.14, 3.14] 500000 1.19e-005 1.00e+002% 5.49e-006 351.61%
expf [0.00, 50.00] 500000 0.00e+000 0.00e+000% 0.00e+000 100.00%
expf_c [0.00, 50.00] 500000 1.13e+015 2.38e-005% 6.42e+013 520.00%
logf [1.00, 1000.00] 5000000 2.38e-007 5.96e-006% 1.35e-007 100.00%
logf_c [1.00, 1000.00] 5000000 1.14e-006 1.#Je+000% 4.05e-007 182.98%
log10f [1.00, 1000.00] 5000000 1.19e-007 5.95e-006% 6.60e-008 100.00%
log10f_c [1.00, 1000.00] 5000000 1.07e-006 1.#Je+000% 2.73e-007 239.74%
floorf [1.00, 1000.00] 5000000 0.00e+000 0.00e+000% 0.00e+000 100.00%
floorf_c [1.00, 1000.00] 5000000 0.00e+000 0.00e+000% 0.00e+000 177.22%
ceilf [1.00, 1000.00] 5000000 0.00e+000 0.00e+000% 0.00e+000 100.00%
ceilf_c [1.00, 1000.00] 5000000 0.00e+000 0.00e+000% 0.00e+000 150.54%
fabsf [1.00, 1000.00] 5000000 0.00e+000 0.00e+000% 0.00e+000 100.00%
fabsf_c [1.00, 1000.00] 5000000 0.00e+000 0.00e+000% 0.00e+000 100.00%
sqrtf [1.00, 1000.00] 500000 9.54e-007 5.96e-006% 4.91e-007 100.00%
sqrtf_c [1.00, 1000.00] 500000 2.29e-004 1.04e-003% 8.68e-005 100.00%
atan2f [0.10, 10.00] 10000 5.96e-008 5.95e-006% 0.00e+000 100.00%
atan2f_c [0.10, 10.00] 10000 1.72e-004 2.23e-002% 0.00e+000 82.98%
powf [1.00, 10.00] 10000 0.00e+000 0.00e+000% 0.00e+000 100.00%
powf_c [1.00, 10.00] 10000 2.66e+004 9.92e-004% 0.00e+000 322.22%
fmodf [1.00, 10.00] 10000 0.00e+000 0.00e+000% 0.00e+000 100.00%
fmodf_c [1.00, 10.00] 10000 9.97e+000 0.00e+000% 0.00e+000 31.91%
------------------------------------------------------------------------------------
while i'd agree that more often than not videogames give more weight to speed than precision, robust numerical algorithms can be as important to a video game as to any other form of scientific-derived computing. /pseudo-offendedlulzfish said:For something like a video game, I wouldn't worry about anything less than gigantic, glaring errors, anyway.
If you were relying on cmath for a high accuracy, scientific application you would have to be pretty stupid. My algorithms are in general not significantly less precise than cmath. For instance the cmath implementations i've seen of sinf have a peak absolute error of ~3.0e-7, as you can see from the list above my function differs from this by at most ~7e-7 therefore the maximum error in my function relative to an actual sine curve is less than ~1.0e-6.darkblu said:while i'd agree that more often than not videogames give more weight to speed than precision, robust numerical algorithms can be as important to a video game as to any other form of scientific-derived computing. /pseudo-offendedlulzfish said:For something like a video game, I wouldn't worry about anything less than gigantic, glaring errors, anyway.