?

Average Error: 0.04% → 0.04%
Time: 3.7s
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.04%
Target0.03%
Herbie0.04%
\[\frac{x}{z - y} - \frac{y}{z - y} \]

Derivation?

  1. Initial program 0.04

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

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

Alternatives

Alternative 1
Error25.37%
Cost1176
\[\begin{array}{l} t_0 := \frac{x - y}{z}\\ t_1 := 1 - \frac{x}{y}\\ \mathbf{if}\;y \leq -3.5 \cdot 10^{+131}:\\ \;\;\;\;\frac{y}{y - z}\\ \mathbf{elif}\;y \leq -9.2 \cdot 10^{+76}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -2.6 \cdot 10^{+34}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -3400:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -3.8 \cdot 10^{-81}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1.7 \cdot 10^{+51}:\\ \;\;\;\;\frac{-x}{y - z}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error44.23%
Cost1048
\[\begin{array}{l} t_0 := \frac{-x}{y}\\ \mathbf{if}\;y \leq -4.6 \cdot 10^{+177}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq -3.6 \cdot 10^{+131}:\\ \;\;\;\;\frac{-y}{z}\\ \mathbf{elif}\;y \leq -0.00115:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 2.9 \cdot 10^{+49}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;y \leq 4.1 \cdot 10^{+114}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 1.38 \cdot 10^{+166}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 3
Error25.32%
Cost982
\[\begin{array}{l} \mathbf{if}\;y \leq -1.35 \cdot 10^{+131}:\\ \;\;\;\;\frac{y}{y - z}\\ \mathbf{elif}\;y \leq -3.1 \cdot 10^{+80} \lor \neg \left(y \leq -2.9 \cdot 10^{+34}\right) \land \left(y \leq -52 \lor \neg \left(y \leq 1.4 \cdot 10^{+49}\right)\right):\\ \;\;\;\;1 - \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x - y}{z}\\ \end{array} \]
Alternative 4
Error42.25%
Cost916
\[\begin{array}{l} t_0 := \frac{-x}{y}\\ \mathbf{if}\;y \leq -1.4 \cdot 10^{+108}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq -0.00165:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 6.8 \cdot 10^{+52}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;y \leq 4.2 \cdot 10^{+114}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 1.38 \cdot 10^{+166}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 5
Error30%
Cost848
\[\begin{array}{l} t_0 := \frac{y}{y - z}\\ t_1 := 1 - \frac{x}{y}\\ \mathbf{if}\;y \leq -4.8 \cdot 10^{+132}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -320000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -1.4 \cdot 10^{-73}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 3.35 \cdot 10^{-71}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error30.36%
Cost585
\[\begin{array}{l} \mathbf{if}\;y \leq -0.0005 \lor \neg \left(y \leq 3.5 \cdot 10^{-71}\right):\\ \;\;\;\;1 - \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z}\\ \end{array} \]
Alternative 7
Error40.88%
Cost456
\[\begin{array}{l} \mathbf{if}\;y \leq -1.8 \cdot 10^{+79}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 9 \cdot 10^{+48}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 8
Error63.94%
Cost64
\[1 \]

Error

Reproduce?

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