?

Average Error: 0.02% → 0.02%
Time: 8.7s
Precision: binary64
Cost: 448

?

\[x + \frac{y - x}{z} \]
\[x + \frac{y - x}{z} \]
(FPCore (x y z) :precision binary64 (+ x (/ (- y x) z)))
(FPCore (x y z) :precision binary64 (+ x (/ (- y x) z)))
double code(double x, double y, double z) {
	return x + ((y - x) / z);
}
double code(double x, double y, double z) {
	return x + ((y - x) / z);
}
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 - x) / z)
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 - x) / z)
end function
public static double code(double x, double y, double z) {
	return x + ((y - x) / z);
}
public static double code(double x, double y, double z) {
	return x + ((y - x) / z);
}
def code(x, y, z):
	return x + ((y - x) / z)
def code(x, y, z):
	return x + ((y - x) / z)
function code(x, y, z)
	return Float64(x + Float64(Float64(y - x) / z))
end
function code(x, y, z)
	return Float64(x + Float64(Float64(y - x) / z))
end
function tmp = code(x, y, z)
	tmp = x + ((y - x) / z);
end
function tmp = code(x, y, z)
	tmp = x + ((y - x) / z);
end
code[x_, y_, z_] := N[(x + N[(N[(y - x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := N[(x + N[(N[(y - x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
x + \frac{y - x}{z}
x + \frac{y - x}{z}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 0.02

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

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

Alternatives

Alternative 1
Error36.74%
Cost1180
\[\begin{array}{l} t_0 := \frac{-x}{z}\\ \mathbf{if}\;z \leq -4.6 \cdot 10^{+14}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq -1.18 \cdot 10^{-11}:\\ \;\;\;\;\frac{y}{z}\\ \mathbf{elif}\;z \leq 7.4 \cdot 10^{-150}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.7 \cdot 10^{-118}:\\ \;\;\;\;\frac{y}{z}\\ \mathbf{elif}\;z \leq 1.85 \cdot 10^{-63}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{-34}:\\ \;\;\;\;\frac{y}{z}\\ \mathbf{elif}\;z \leq 0.000232:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 2
Error18.67%
Cost1112
\[\begin{array}{l} t_0 := x + \frac{y}{z}\\ t_1 := \frac{-x}{z}\\ \mathbf{if}\;z \leq -7 \cdot 10^{-12}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.42 \cdot 10^{-152}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 5.2 \cdot 10^{-117}:\\ \;\;\;\;\frac{y}{z}\\ \mathbf{elif}\;z \leq 2.7 \cdot 10^{-62}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 8.2 \cdot 10^{-35}:\\ \;\;\;\;\frac{y}{z}\\ \mathbf{elif}\;z \leq 3.6 \cdot 10^{-7}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error12.29%
Cost585
\[\begin{array}{l} \mathbf{if}\;y \leq -1.46 \cdot 10^{-205} \lor \neg \left(y \leq 2.45 \cdot 10^{-60}\right):\\ \;\;\;\;x + \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{x}{z}\\ \end{array} \]
Alternative 4
Error1.4%
Cost585
\[\begin{array}{l} \mathbf{if}\;z \leq -115 \lor \neg \left(z \leq 0.000232\right):\\ \;\;\;\;x + \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y - x}{z}\\ \end{array} \]
Alternative 5
Error36.46%
Cost456
\[\begin{array}{l} \mathbf{if}\;z \leq -1.42 \cdot 10^{+14}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 2.65 \cdot 10^{+42}:\\ \;\;\;\;\frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 6
Error54.56%
Cost64
\[x \]

Error

Reproduce?

herbie shell --seed 2023115 
(FPCore (x y z)
  :name "Statistics.Sample:$swelfordMean from math-functions-0.1.5.2"
  :precision binary64
  (+ x (/ (- y x) z)))