(FPCore (x y z t a) :precision binary64 (+ (/ (* 60.0 (- x y)) (- z t)) (* a 120.0)))
(FPCore (x y z t a) :precision binary64 (fma 120.0 a (/ (- x y) (/ (- z t) 60.0))))
double code(double x, double y, double z, double t, double a) {
return ((60.0 * (x - y)) / (z - t)) + (a * 120.0);
}
double code(double x, double y, double z, double t, double a) {
return fma(120.0, a, ((x - y) / ((z - t) / 60.0)));
}
function code(x, y, z, t, a) return Float64(Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t)) + Float64(a * 120.0)) end
function code(x, y, z, t, a) return fma(120.0, a, Float64(Float64(x - y) / Float64(Float64(z - t) / 60.0))) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(60.0 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision] + N[(a * 120.0), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_] := N[(120.0 * a + N[(N[(x - y), $MachinePrecision] / N[(N[(z - t), $MachinePrecision] / 60.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120
\mathsf{fma}\left(120, a, \frac{x - y}{\frac{z - t}{60}}\right)




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
| Original | 0.3 |
|---|---|
| Target | 0.2 |
| Herbie | 0.1 |
Initial program 0.3
Simplified0.1
Taylor expanded in a around 0 0.1
Simplified0.3
Applied egg-rr0.1
Final simplification0.1
herbie shell --seed 2022170
(FPCore (x y z t a)
:name "Data.Colour.RGB:hslsv from colour-2.3.3, B"
:precision binary64
:herbie-target
(+ (/ 60.0 (/ (- z t) (- x y))) (* a 120.0))
(+ (/ (* 60.0 (- x y)) (- z t)) (* a 120.0)))