Average Error: 0.3 → 0.2
Time: 5.6s
Precision: binary64
\[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
\[\left(120 \cdot a + 60 \cdot \frac{x}{z - t}\right) + \frac{-60}{\frac{z - t}{y}} \]
(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
 (+ (+ (* 120.0 a) (* 60.0 (/ x (- z t)))) (/ -60.0 (/ (- z t) y))))
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 ((120.0 * a) + (60.0 * (x / (z - t)))) + (-60.0 / ((z - t) / y));
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    code = ((60.0d0 * (x - y)) / (z - t)) + (a * 120.0d0)
end function
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    code = ((120.0d0 * a) + (60.0d0 * (x / (z - t)))) + ((-60.0d0) / ((z - t) / y))
end function
public static double code(double x, double y, double z, double t, double a) {
	return ((60.0 * (x - y)) / (z - t)) + (a * 120.0);
}
public static double code(double x, double y, double z, double t, double a) {
	return ((120.0 * a) + (60.0 * (x / (z - t)))) + (-60.0 / ((z - t) / y));
}
def code(x, y, z, t, a):
	return ((60.0 * (x - y)) / (z - t)) + (a * 120.0)
def code(x, y, z, t, a):
	return ((120.0 * a) + (60.0 * (x / (z - t)))) + (-60.0 / ((z - t) / y))
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(Float64(120.0 * a) + Float64(60.0 * Float64(x / Float64(z - t)))) + Float64(-60.0 / Float64(Float64(z - t) / y)))
end
function tmp = code(x, y, z, t, a)
	tmp = ((60.0 * (x - y)) / (z - t)) + (a * 120.0);
end
function tmp = code(x, y, z, t, a)
	tmp = ((120.0 * a) + (60.0 * (x / (z - t)))) + (-60.0 / ((z - t) / y));
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[(120.0 * a), $MachinePrecision] + N[(60.0 * N[(x / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-60.0 / N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120
\left(120 \cdot a + 60 \cdot \frac{x}{z - t}\right) + \frac{-60}{\frac{z - t}{y}}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 0.3

    \[\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120 \]
  2. Simplified0.2

    \[\leadsto \color{blue}{\mathsf{fma}\left(60, \frac{x - y}{z - t}, a \cdot 120\right)} \]
  3. Taylor expanded in x around 0 0.2

    \[\leadsto \color{blue}{\left(120 \cdot a + 60 \cdot \frac{x}{z - t}\right) - 60 \cdot \frac{y}{z - t}} \]
  4. Applied egg-rr0.2

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

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

Reproduce

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