diff options
author | S. Gilles <sgilles@math.umd.edu> | 2018-05-10 10:42:25 -0400 |
---|---|---|
committer | S. Gilles <sgilles@math.umd.edu> | 2018-05-10 10:42:25 -0400 |
commit | 66a472dc689c3a7b2b8f077fdf01c0dc2fdc1f7d (patch) | |
tree | ed949586ac1c84b852324941b0e730064cc6b898 /lib/math/poly-impl.myr | |
parent | 3853fa79b7d297f4bd3aaf318a147a95dd088bc9 (diff) | |
download | mc-66a472dc689c3a7b2b8f077fdf01c0dc2fdc1f7d.tar.gz |
Use x as input variable instead of f.
Some algorithm descriptions use f as an auxiliary variable. Since
we attempt to match variable naming to the relevant algorithm
description, this becomes a problem. For uniformity, change everywhere.
Diffstat (limited to 'lib/math/poly-impl.myr')
-rw-r--r-- | lib/math/poly-impl.myr | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/math/poly-impl.myr b/lib/math/poly-impl.myr index e7d645b..94118a0 100644 --- a/lib/math/poly-impl.myr +++ b/lib/math/poly-impl.myr @@ -2,44 +2,44 @@ use std /* See [Mul16], section 5.1 */ pkg math = - pkglocal const horner_poly32 : (f : flt32, a : flt32[:] -> flt32) - pkglocal const horner_poly64 : (f : flt64, a : flt64[:] -> flt64) + pkglocal const horner_poly32 : (x : flt32, a : flt32[:] -> flt32) + pkglocal const horner_poly64 : (x : flt64, a : flt64[:] -> flt64) - pkglocal const horner_polyu32 : (f : flt32, a : uint32[:] -> flt32) - pkglocal const horner_polyu64 : (f : flt64, a : uint64[:] -> flt64) + pkglocal const horner_polyu32 : (x : flt32, a : uint32[:] -> flt32) + pkglocal const horner_polyu64 : (x : flt64, a : uint64[:] -> flt64) ;; extern const fma32 : (x : flt32, y : flt32, z : flt32 -> flt32) extern const fma64 : (x : flt64, y : flt64, z : flt64 -> flt64) -const horner_poly32 = {f : flt32, a : flt32[:] +const horner_poly32 = {x : flt32, a : flt32[:] var r : flt32 = 0.0 for var j = a.len - 1; j >= 0; j-- - r = fma32(r, f, a[j]) + r = fma32(r, x, a[j]) ;; -> r } -const horner_poly64 = {f : flt64, a : flt64[:] +const horner_poly64 = {x : flt64, a : flt64[:] var r : flt64 = 0.0 for var j = a.len - 1; j >= 0; j-- - r = fma64(r, f, a[j]) + r = fma64(r, x, a[j]) ;; -> r } -const horner_polyu32 = {f : flt32, a : uint32[:] +const horner_polyu32 = {x : flt32, a : uint32[:] var r : flt32 = 0.0 for var j = a.len - 1; j >= 0; j-- - r = fma32(r, f, std.flt32frombits(a[j])) + r = fma32(r, x, std.flt32frombits(a[j])) ;; -> r } -const horner_polyu64 = {f : flt64, a : uint64[:] +const horner_polyu64 = {x : flt64, a : uint64[:] var r : flt64 = 0.0 for var j = a.len - 1; j >= 0; j-- - r = fma64(r, f, std.flt64frombits(a[j])) + r = fma64(r, x, std.flt64frombits(a[j])) ;; -> r } |