Average Error: 0.0 → 0.0
Time: 7.5s
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.0

    \[x + \frac{y - x}{z} \]
  2. Simplified0.0

    \[\leadsto \color{blue}{x - \frac{x - y}{z}} \]
  3. Final simplification0.0

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

Alternatives

Alternative 1
Error13.8
Cost848
\[\begin{array}{l} t_0 := x + \frac{y}{z}\\ t_1 := \frac{-x}{z}\\ \mathbf{if}\;y \leq -3.352107844179885 \cdot 10^{-290}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 3.6645356111221677 \cdot 10^{-242}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 2.119267278529334 \cdot 10^{-185}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 4.2971969880538484 \cdot 10^{-157}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error23.6
Cost720
\[\begin{array}{l} \mathbf{if}\;z \leq -1.798997311531756 \cdot 10^{+34}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq -1.1 \cdot 10^{-292}:\\ \;\;\;\;\frac{y}{z}\\ \mathbf{elif}\;z \leq 0.0011290443335734708:\\ \;\;\;\;\frac{-x}{z}\\ \mathbf{elif}\;z \leq 4.380123430700242 \cdot 10^{+48}:\\ \;\;\;\;\frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 3
Error7.2
Cost584
\[\begin{array}{l} t_0 := x + \frac{y}{z}\\ \mathbf{if}\;y \leq -1.7361442744847176 \cdot 10^{-109}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 4.2792598538232 \cdot 10^{-65}:\\ \;\;\;\;x - \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error0.9
Cost584
\[\begin{array}{l} t_0 := x + \frac{y}{z}\\ \mathbf{if}\;z \leq -11173254449.201303:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 0.0011290443335734708:\\ \;\;\;\;\frac{y - x}{z}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error24.1
Cost456
\[\begin{array}{l} \mathbf{if}\;z \leq -1.798997311531756 \cdot 10^{+34}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 4.380123430700242 \cdot 10^{+48}:\\ \;\;\;\;\frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 6
Error35.1
Cost64
\[x \]

Error

Reproduce

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