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

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.5
Target0.2
Herbie0.2
\[\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. Simplified0.2

    \[\leadsto \color{blue}{\frac{60}{\frac{z - t}{x - y}} + a \cdot 120} \]
    Proof
    (+.f64 (/.f64 60 (/.f64 (-.f64 z t) (-.f64 x y))) (*.f64 a 120)): 0 points increase in error, 0 points decrease in error
    (+.f64 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 60 (-.f64 x y)) (-.f64 z t))) (*.f64 a 120)): 26 points increase in error, 13 points decrease in error
  3. Final simplification0.2

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

Alternatives

Alternative 1
Error15.9
Cost1632
\[\begin{array}{l} t_1 := a \cdot 120 + 60 \cdot \frac{x - y}{z}\\ t_2 := a \cdot 120 + -60 \cdot \frac{x}{t}\\ t_3 := 60 \cdot \frac{y - x}{t - z}\\ \mathbf{if}\;a \leq -6.6 \cdot 10^{-9}:\\ \;\;\;\;a \cdot 120\\ \mathbf{elif}\;a \leq -6 \cdot 10^{-40}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;a \leq -1 \cdot 10^{-99}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \leq -4.4 \cdot 10^{-129}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 1.42 \cdot 10^{-151}:\\ \;\;\;\;\frac{60}{\frac{z - t}{x - y}}\\ \mathbf{elif}\;a \leq 5.3 \cdot 10^{-14}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 8.6 \cdot 10^{+27}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \leq 7.8 \cdot 10^{+32}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;a \cdot 120\\ \end{array} \]
Alternative 2
Error15.8
Cost1500
\[\begin{array}{l} t_1 := 60 \cdot \frac{y - x}{t - z}\\ \mathbf{if}\;a \leq -3.4 \cdot 10^{-9}:\\ \;\;\;\;a \cdot 120\\ \mathbf{elif}\;a \leq -3 \cdot 10^{-40}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq -2.1 \cdot 10^{-97}:\\ \;\;\;\;a \cdot 120 + -60 \cdot \frac{x}{t}\\ \mathbf{elif}\;a \leq -5.6 \cdot 10^{-129}:\\ \;\;\;\;a \cdot 120 + 60 \cdot \frac{x}{z}\\ \mathbf{elif}\;a \leq 1.22 \cdot 10^{-51}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 3.2 \cdot 10^{+26}:\\ \;\;\;\;a \cdot 120 + \frac{y \cdot -60}{z}\\ \mathbf{elif}\;a \leq 3.8 \cdot 10^{+32}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;a \cdot 120\\ \end{array} \]
Alternative 3
Error15.9
Cost1500
\[\begin{array}{l} t_1 := 60 \cdot \frac{y - x}{t - z}\\ \mathbf{if}\;a \leq -26:\\ \;\;\;\;a \cdot 120\\ \mathbf{elif}\;a \leq -6.5 \cdot 10^{-40}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq -8 \cdot 10^{-96}:\\ \;\;\;\;a \cdot 120 + -60 \cdot \frac{x}{t}\\ \mathbf{elif}\;a \leq -5.6 \cdot 10^{-129}:\\ \;\;\;\;a \cdot 120 + 60 \cdot \frac{x}{z}\\ \mathbf{elif}\;a \leq 9.2 \cdot 10^{-48}:\\ \;\;\;\;\frac{60}{\frac{z - t}{x - y}}\\ \mathbf{elif}\;a \leq 1.3 \cdot 10^{+27}:\\ \;\;\;\;a \cdot 120 + \frac{y \cdot -60}{z}\\ \mathbf{elif}\;a \leq 3.7 \cdot 10^{+32}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;a \cdot 120\\ \end{array} \]
Alternative 4
Error24.8
Cost1372
\[\begin{array}{l} t_1 := 60 \cdot \frac{y}{t - z}\\ t_2 := -60 \cdot \frac{x}{t - z}\\ \mathbf{if}\;a \leq -5.8 \cdot 10^{-95}:\\ \;\;\;\;a \cdot 120\\ \mathbf{elif}\;a \leq -1.7 \cdot 10^{-160}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \leq -2.2 \cdot 10^{-172}:\\ \;\;\;\;a \cdot 120\\ \mathbf{elif}\;a \leq -5 \cdot 10^{-267}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 8.5 \cdot 10^{-268}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \leq 4.4 \cdot 10^{-182}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 1.3 \cdot 10^{-69}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;a \cdot 120\\ \end{array} \]
Alternative 5
Error15.5
Cost1236
\[\begin{array}{l} t_1 := 60 \cdot \frac{y - x}{t - z}\\ \mathbf{if}\;a \leq -3.05 \cdot 10^{-9}:\\ \;\;\;\;a \cdot 120\\ \mathbf{elif}\;a \leq -6.7 \cdot 10^{-40}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq -1.85 \cdot 10^{-98}:\\ \;\;\;\;a \cdot 120 + -60 \cdot \frac{x}{t}\\ \mathbf{elif}\;a \leq -5.6 \cdot 10^{-129}:\\ \;\;\;\;a \cdot 120 + 60 \cdot \frac{x}{z}\\ \mathbf{elif}\;a \leq 8.2 \cdot 10^{-62}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;a \cdot 120\\ \end{array} \]
Alternative 6
Error24.8
Cost976
\[\begin{array}{l} t_1 := 60 \cdot \frac{x - y}{z}\\ \mathbf{if}\;a \leq -7.4 \cdot 10^{-97}:\\ \;\;\;\;a \cdot 120\\ \mathbf{elif}\;a \leq 7.8 \cdot 10^{-268}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 1.7 \cdot 10^{-187}:\\ \;\;\;\;60 \cdot \frac{y}{t - z}\\ \mathbf{elif}\;a \leq 2.1 \cdot 10^{-66}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;a \cdot 120\\ \end{array} \]
Alternative 7
Error24.7
Cost976
\[\begin{array}{l} t_1 := 60 \cdot \frac{x - y}{z}\\ \mathbf{if}\;a \leq -1.08 \cdot 10^{-97}:\\ \;\;\;\;a \cdot 120\\ \mathbf{elif}\;a \leq 7.8 \cdot 10^{-268}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 1.8 \cdot 10^{-185}:\\ \;\;\;\;\frac{60}{\frac{t - z}{y}}\\ \mathbf{elif}\;a \leq 3.2 \cdot 10^{-69}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;a \cdot 120\\ \end{array} \]
Alternative 8
Error11.8
Cost968
\[\begin{array}{l} t_1 := \frac{60 \cdot x}{z - t} + a \cdot 120\\ \mathbf{if}\;t \leq -8.4 \cdot 10^{-95}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 4.5 \cdot 10^{-22}:\\ \;\;\;\;a \cdot 120 + 60 \cdot \frac{x - y}{z}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Error28.8
Cost848
\[\begin{array}{l} t_1 := 60 \cdot \frac{x}{z}\\ \mathbf{if}\;a \leq -6.8 \cdot 10^{-130}:\\ \;\;\;\;a \cdot 120\\ \mathbf{elif}\;a \leq 8.2 \cdot 10^{-268}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 2.2 \cdot 10^{-215}:\\ \;\;\;\;60 \cdot \frac{y}{t}\\ \mathbf{elif}\;a \leq 7.5 \cdot 10^{-63}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;a \cdot 120\\ \end{array} \]
Alternative 10
Error28.9
Cost848
\[\begin{array}{l} \mathbf{if}\;a \leq -1.55 \cdot 10^{-129}:\\ \;\;\;\;a \cdot 120\\ \mathbf{elif}\;a \leq 7.5 \cdot 10^{-268}:\\ \;\;\;\;60 \cdot \frac{x}{z}\\ \mathbf{elif}\;a \leq 2.7 \cdot 10^{-214}:\\ \;\;\;\;60 \cdot \frac{y}{t}\\ \mathbf{elif}\;a \leq 3.25 \cdot 10^{-62}:\\ \;\;\;\;x \cdot \frac{60}{z}\\ \mathbf{else}:\\ \;\;\;\;a \cdot 120\\ \end{array} \]
Alternative 11
Error28.8
Cost848
\[\begin{array}{l} \mathbf{if}\;a \leq -1 \cdot 10^{-129}:\\ \;\;\;\;a \cdot 120\\ \mathbf{elif}\;a \leq 8.2 \cdot 10^{-268}:\\ \;\;\;\;60 \cdot \frac{x}{z}\\ \mathbf{elif}\;a \leq 7.2 \cdot 10^{-215}:\\ \;\;\;\;\frac{60}{\frac{t}{y}}\\ \mathbf{elif}\;a \leq 6.8 \cdot 10^{-63}:\\ \;\;\;\;x \cdot \frac{60}{z}\\ \mathbf{else}:\\ \;\;\;\;a \cdot 120\\ \end{array} \]
Alternative 12
Error28.9
Cost848
\[\begin{array}{l} \mathbf{if}\;a \leq -3.35 \cdot 10^{-130}:\\ \;\;\;\;a \cdot 120\\ \mathbf{elif}\;a \leq 8.5 \cdot 10^{-268}:\\ \;\;\;\;\frac{60}{\frac{z}{x}}\\ \mathbf{elif}\;a \leq 2.1 \cdot 10^{-215}:\\ \;\;\;\;\frac{60}{\frac{t}{y}}\\ \mathbf{elif}\;a \leq 6.8 \cdot 10^{-63}:\\ \;\;\;\;x \cdot \frac{60}{z}\\ \mathbf{else}:\\ \;\;\;\;a \cdot 120\\ \end{array} \]
Alternative 13
Error28.9
Cost848
\[\begin{array}{l} \mathbf{if}\;a \leq -1.02 \cdot 10^{-129}:\\ \;\;\;\;a \cdot 120\\ \mathbf{elif}\;a \leq 8.4 \cdot 10^{-268}:\\ \;\;\;\;\frac{60}{\frac{z}{x}}\\ \mathbf{elif}\;a \leq 9 \cdot 10^{-215}:\\ \;\;\;\;\frac{60 \cdot y}{t}\\ \mathbf{elif}\;a \leq 3.3 \cdot 10^{-62}:\\ \;\;\;\;x \cdot \frac{60}{z}\\ \mathbf{else}:\\ \;\;\;\;a \cdot 120\\ \end{array} \]
Alternative 14
Error14.8
Cost840
\[\begin{array}{l} \mathbf{if}\;a \leq -0.00152:\\ \;\;\;\;a \cdot 120\\ \mathbf{elif}\;a \leq 3.6 \cdot 10^{-60}:\\ \;\;\;\;60 \cdot \frac{y - x}{t - z}\\ \mathbf{else}:\\ \;\;\;\;a \cdot 120\\ \end{array} \]
Alternative 15
Error24.7
Cost712
\[\begin{array}{l} \mathbf{if}\;a \leq -1.35 \cdot 10^{-94}:\\ \;\;\;\;a \cdot 120\\ \mathbf{elif}\;a \leq 9 \cdot 10^{-65}:\\ \;\;\;\;-60 \cdot \frac{x}{t - z}\\ \mathbf{else}:\\ \;\;\;\;a \cdot 120\\ \end{array} \]
Alternative 16
Error29.2
Cost584
\[\begin{array}{l} \mathbf{if}\;t \leq -1.1 \cdot 10^{-182}:\\ \;\;\;\;a \cdot 120\\ \mathbf{elif}\;t \leq -4.3 \cdot 10^{-243}:\\ \;\;\;\;-60 \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;a \cdot 120\\ \end{array} \]
Alternative 17
Error28.7
Cost584
\[\begin{array}{l} \mathbf{if}\;a \leq -4.4 \cdot 10^{-129}:\\ \;\;\;\;a \cdot 120\\ \mathbf{elif}\;a \leq 3.4 \cdot 10^{-62}:\\ \;\;\;\;60 \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;a \cdot 120\\ \end{array} \]
Alternative 18
Error28.6
Cost192
\[a \cdot 120 \]

Error

Reproduce

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