Average Error: 0.0 → 0.0
Time: 7.6s
Precision: binary64
Cost: 448
\[\frac{x - y}{z - y} \]
\[\frac{x - y}{z - y} \]
(FPCore (x y z) :precision binary64 (/ (- x y) (- z y)))
(FPCore (x y z) :precision binary64 (/ (- x y) (- z y)))
double code(double x, double y, double z) {
	return (x - y) / (z - y);
}
double code(double x, double y, double z) {
	return (x - y) / (z - y);
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x - y) / (z - y)
end function
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x - y) / (z - y)
end function
public static double code(double x, double y, double z) {
	return (x - y) / (z - y);
}
public static double code(double x, double y, double z) {
	return (x - y) / (z - y);
}
def code(x, y, z):
	return (x - y) / (z - y)
def code(x, y, z):
	return (x - y) / (z - y)
function code(x, y, z)
	return Float64(Float64(x - y) / Float64(z - y))
end
function code(x, y, z)
	return Float64(Float64(x - y) / Float64(z - y))
end
function tmp = code(x, y, z)
	tmp = (x - y) / (z - y);
end
function tmp = code(x, y, z)
	tmp = (x - y) / (z - y);
end
code[x_, y_, z_] := N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]
\frac{x - y}{z - y}
\frac{x - y}{z - y}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.0
Target0.0
Herbie0.0
\[\frac{x}{z - y} - \frac{y}{z - y} \]

Derivation

  1. Initial program 0.0

    \[\frac{x - y}{z - y} \]
  2. Final simplification0.0

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

Alternatives

Alternative 1
Error25.1
Cost1376
\[\begin{array}{l} t_0 := 1 + \frac{z}{y}\\ t_1 := \frac{-x}{y}\\ \mathbf{if}\;y \leq -1.45 \cdot 10^{+68}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -7.5 \cdot 10^{+40}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -1.65 \cdot 10^{-9}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 1.12 \cdot 10^{-41}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;y \leq 100000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 8.8 \cdot 10^{+32}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;y \leq 4.2 \cdot 10^{+124}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 2.4 \cdot 10^{+135}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error25.0
Cost1312
\[\begin{array}{l} t_0 := \frac{-x}{y}\\ \mathbf{if}\;y \leq -1.35 \cdot 10^{+67}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq -1.62 \cdot 10^{+41}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -5 \cdot 10^{-7}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 1.12 \cdot 10^{-41}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;y \leq 48000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 4.7 \cdot 10^{+31}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;y \leq 4.2 \cdot 10^{+124}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 2.4 \cdot 10^{+135}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 3
Error25.8
Cost1180
\[\begin{array}{l} t_0 := \frac{y}{y - z}\\ t_1 := \frac{-x}{y}\\ \mathbf{if}\;x \leq -1.45 \cdot 10^{+168}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -2.3 \cdot 10^{+108}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;x \leq -6.6 \cdot 10^{-37}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -2.9 \cdot 10^{-108}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;x \leq 6 \cdot 10^{+89}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 5 \cdot 10^{+164}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;x \leq 7 \cdot 10^{+217}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z}\\ \end{array} \]
Alternative 4
Error17.3
Cost912
\[\begin{array}{l} t_0 := \frac{-x}{y - z}\\ t_1 := \frac{y}{y - z}\\ \mathbf{if}\;x \leq -5.2 \cdot 10^{+82}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -4.3 \cdot 10^{-32}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -2.9 \cdot 10^{-108}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 6.3 \cdot 10^{+88}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error15.2
Cost848
\[\begin{array}{l} t_0 := \frac{y}{y - z}\\ \mathbf{if}\;y \leq -5.9 \cdot 10^{-22}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1.9 \cdot 10^{+29}:\\ \;\;\;\;\frac{x - y}{z}\\ \mathbf{elif}\;y \leq 6.5 \cdot 10^{+125}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 2.4 \cdot 10^{+135}:\\ \;\;\;\;\frac{-x}{y}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Error15.0
Cost848
\[\begin{array}{l} t_0 := \frac{y}{y - z}\\ \mathbf{if}\;y \leq -2.55 \cdot 10^{+154}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -7.9 \cdot 10^{+37}:\\ \;\;\;\;\frac{y - x}{y}\\ \mathbf{elif}\;y \leq -1.7 \cdot 10^{-23}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1.75 \cdot 10^{+29}:\\ \;\;\;\;\frac{x - y}{z}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 7
Error24.4
Cost456
\[\begin{array}{l} \mathbf{if}\;y \leq -5.5 \cdot 10^{-6}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 1.5 \cdot 10^{+32}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 8
Error40.6
Cost64
\[1 \]

Error

Reproduce

herbie shell --seed 2022325 
(FPCore (x y z)
  :name "Graphics.Rasterific.Shading:$sgradientColorAt from Rasterific-0.6.1"
  :precision binary64

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

  (/ (- x y) (- z y)))