Average Error: 11.6 → 2.2
Time: 9.3s
Precision: binary64
Cost: 576
\[\frac{x \cdot \left(y - z\right)}{t - z} \]
\[x \cdot \frac{y - z}{t - z} \]
(FPCore (x y z t) :precision binary64 (/ (* x (- y z)) (- t z)))
(FPCore (x y z t) :precision binary64 (* x (/ (- y z) (- t z))))
double code(double x, double y, double z, double t) {
	return (x * (y - z)) / (t - z);
}
double code(double x, double y, double z, double t) {
	return x * ((y - z) / (t - z));
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = (x * (y - z)) / (t - z)
end function
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = x * ((y - z) / (t - z))
end function
public static double code(double x, double y, double z, double t) {
	return (x * (y - z)) / (t - z);
}
public static double code(double x, double y, double z, double t) {
	return x * ((y - z) / (t - z));
}
def code(x, y, z, t):
	return (x * (y - z)) / (t - z)
def code(x, y, z, t):
	return x * ((y - z) / (t - z))
function code(x, y, z, t)
	return Float64(Float64(x * Float64(y - z)) / Float64(t - z))
end
function code(x, y, z, t)
	return Float64(x * Float64(Float64(y - z) / Float64(t - z)))
end
function tmp = code(x, y, z, t)
	tmp = (x * (y - z)) / (t - z);
end
function tmp = code(x, y, z, t)
	tmp = x * ((y - z) / (t - z));
end
code[x_, y_, z_, t_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := N[(x * N[(N[(y - z), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{x \cdot \left(y - z\right)}{t - z}
x \cdot \frac{y - z}{t - z}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original11.6
Target2.1
Herbie2.2
\[\frac{x}{\frac{t - z}{y - z}} \]

Derivation

  1. Initial program 11.6

    \[\frac{x \cdot \left(y - z\right)}{t - z} \]
  2. Simplified2.2

    \[\leadsto \color{blue}{x \cdot \frac{y - z}{t - z}} \]
    Proof
    (*.f64 x (/.f64 (-.f64 y z) (-.f64 t z))): 0 points increase in error, 0 points decrease in error
    (Rewrite=> associate-*r/_binary64 (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z))): 74 points increase in error, 29 points decrease in error
  3. Final simplification2.2

    \[\leadsto x \cdot \frac{y - z}{t - z} \]

Alternatives

Alternative 1
Error16.5
Cost1108
\[\begin{array}{l} t_1 := \frac{x}{1 - \frac{t}{z}}\\ t_2 := x \cdot \frac{y}{t - z}\\ \mathbf{if}\;z \leq -2.45 \cdot 10^{+123}:\\ \;\;\;\;x - x \cdot \frac{y}{z}\\ \mathbf{elif}\;z \leq -5500000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 3.1 \cdot 10^{-165}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 1.95 \cdot 10^{-25}:\\ \;\;\;\;\left(y - z\right) \cdot \frac{x}{t}\\ \mathbf{elif}\;z \leq 1.95 \cdot 10^{+51}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error20.8
Cost976
\[\begin{array}{l} t_1 := x \cdot \frac{y}{t - z}\\ \mathbf{if}\;z \leq -2.05 \cdot 10^{+64}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 3.4 \cdot 10^{-163}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 6.1 \cdot 10^{-26}:\\ \;\;\;\;\left(y - z\right) \cdot \frac{x}{t}\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{+51}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 3
Error16.8
Cost976
\[\begin{array}{l} t_1 := x \cdot \frac{y}{t - z}\\ t_2 := x - x \cdot \frac{y}{z}\\ \mathbf{if}\;z \leq -1.65 \cdot 10^{+14}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 1.28 \cdot 10^{-164}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 5.5 \cdot 10^{-26}:\\ \;\;\;\;\left(y - z\right) \cdot \frac{x}{t}\\ \mathbf{elif}\;z \leq 1.08 \cdot 10^{+52}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 4
Error16.9
Cost976
\[\begin{array}{l} t_1 := \frac{x}{\frac{t}{y - z}}\\ t_2 := x - x \cdot \frac{y}{z}\\ \mathbf{if}\;z \leq -6.2 \cdot 10^{+63}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 1.95 \cdot 10^{-25}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 150000000000:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 4.4 \cdot 10^{+51}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{1 - \frac{t}{z}}\\ \end{array} \]
Alternative 5
Error20.5
Cost712
\[\begin{array}{l} \mathbf{if}\;z \leq -1.2 \cdot 10^{+65}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 5 \cdot 10^{+51}:\\ \;\;\;\;x \cdot \frac{y}{t - z}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 6
Error25.9
Cost584
\[\begin{array}{l} \mathbf{if}\;z \leq -60:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 4.3 \cdot 10^{+52}:\\ \;\;\;\;y \cdot \frac{x}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 7
Error24.8
Cost584
\[\begin{array}{l} \mathbf{if}\;z \leq -6.5 \cdot 10^{+18}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 7.5 \cdot 10^{+51}:\\ \;\;\;\;x \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 8
Error24.7
Cost584
\[\begin{array}{l} \mathbf{if}\;z \leq -8.2 \cdot 10^{+18}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.35 \cdot 10^{+52}:\\ \;\;\;\;\frac{x}{\frac{t}{y}}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 9
Error39.5
Cost64
\[x \]

Error

Reproduce

herbie shell --seed 2022325 
(FPCore (x y z t)
  :name "Graphics.Rendering.Chart.Plot.AreaSpots:renderAreaSpots4D from Chart-1.5.3"
  :precision binary64

  :herbie-target
  (/ x (/ (- t z) (- y z)))

  (/ (* x (- y z)) (- t z)))