Average Error: 0.5 → 0.5
Time: 5.1s
Precision: binary64
\[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
\[\frac{\mathsf{fma}\left(x, 60, y \cdot -60\right)}{z - t} + a \cdot 120 \]
(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 x 60.0 (* y -60.0)) (- z t)) (* a 120.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(x, 60.0, (y * -60.0)) / (z - t)) + (a * 120.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 Float64(Float64(fma(x, 60.0, Float64(y * -60.0)) / Float64(z - t)) + Float64(a * 120.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[(N[(N[(x * 60.0 + N[(y * -60.0), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision] + N[(a * 120.0), $MachinePrecision]), $MachinePrecision]
\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120
\frac{\mathsf{fma}\left(x, 60, y \cdot -60\right)}{z - t} + a \cdot 120

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original0.5
Target0.1
Herbie0.5
\[\frac{60}{\frac{z - t}{x - y}} + a \cdot 120 \]

Derivation

  1. Initial program 0.5

    \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
  2. Taylor expanded in x around 0 0.5

    \[\leadsto \frac{\color{blue}{60 \cdot x - 60 \cdot y}}{z - t} + a \cdot 120 \]
  3. Applied egg-rr0.5

    \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(x, 60, y \cdot -60\right)}}{z - t} + a \cdot 120 \]
  4. Final simplification0.5

    \[\leadsto \frac{\mathsf{fma}\left(x, 60, y \cdot -60\right)}{z - t} + a \cdot 120 \]

Reproduce

herbie shell --seed 2022150 
(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)))