
(FPCore (x y z) :precision binary64 (/ (+ x (* y (- z x))) z))
double code(double x, double y, double z) {
return (x + (y * (z - 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 * (z - x))) / z
end function
public static double code(double x, double y, double z) {
return (x + (y * (z - x))) / z;
}
def code(x, y, z): return (x + (y * (z - x))) / z
function code(x, y, z) return Float64(Float64(x + Float64(y * Float64(z - x))) / z) end
function tmp = code(x, y, z) tmp = (x + (y * (z - x))) / z; end
code[x_, y_, z_] := N[(N[(x + N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + y \cdot \left(z - x\right)}{z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (+ x (* y (- z x))) z))
double code(double x, double y, double z) {
return (x + (y * (z - 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 * (z - x))) / z
end function
public static double code(double x, double y, double z) {
return (x + (y * (z - x))) / z;
}
def code(x, y, z): return (x + (y * (z - x))) / z
function code(x, y, z) return Float64(Float64(x + Float64(y * Float64(z - x))) / z) end
function tmp = code(x, y, z) tmp = (x + (y * (z - x))) / z; end
code[x_, y_, z_] := N[(N[(x + N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + y \cdot \left(z - x\right)}{z}
\end{array}
(FPCore (x y z) :precision binary64 (if (<= y -5e+51) (* y (- 1.0 (/ x z))) (+ y (/ (* x (- 1.0 y)) z))))
double code(double x, double y, double z) {
double tmp;
if (y <= -5e+51) {
tmp = y * (1.0 - (x / z));
} else {
tmp = y + ((x * (1.0 - y)) / z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-5d+51)) then
tmp = y * (1.0d0 - (x / z))
else
tmp = y + ((x * (1.0d0 - y)) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -5e+51) {
tmp = y * (1.0 - (x / z));
} else {
tmp = y + ((x * (1.0 - y)) / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -5e+51: tmp = y * (1.0 - (x / z)) else: tmp = y + ((x * (1.0 - y)) / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -5e+51) tmp = Float64(y * Float64(1.0 - Float64(x / z))); else tmp = Float64(y + Float64(Float64(x * Float64(1.0 - y)) / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -5e+51) tmp = y * (1.0 - (x / z)); else tmp = y + ((x * (1.0 - y)) / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -5e+51], N[(y * N[(1.0 - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + N[(N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{+51}:\\
\;\;\;\;y \cdot \left(1 - \frac{x}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x \cdot \left(1 - y\right)}{z}\\
\end{array}
\end{array}
if y < -5e51Initial program 75.3%
Taylor expanded in y around inf 75.3%
associate-/l*99.9%
div-sub99.9%
*-inverses99.9%
Simplified99.9%
if -5e51 < y Initial program 96.7%
Taylor expanded in x around inf 91.7%
associate-+r+91.7%
+-commutative91.7%
mul-1-neg91.7%
unsub-neg91.7%
div-sub91.7%
Simplified91.7%
Taylor expanded in z around inf 99.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ y (/ x z))) (t_1 (* y (/ (- x) z))))
(if (<= y -4.1e+121)
t_0
(if (<= y -2.5e+37)
t_1
(if (<= y 6.4e+19) t_0 (if (<= y 1.52e+75) t_1 (/ (* y x) x)))))))
double code(double x, double y, double z) {
double t_0 = y + (x / z);
double t_1 = y * (-x / z);
double tmp;
if (y <= -4.1e+121) {
tmp = t_0;
} else if (y <= -2.5e+37) {
tmp = t_1;
} else if (y <= 6.4e+19) {
tmp = t_0;
} else if (y <= 1.52e+75) {
tmp = t_1;
} else {
tmp = (y * x) / x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = y + (x / z)
t_1 = y * (-x / z)
if (y <= (-4.1d+121)) then
tmp = t_0
else if (y <= (-2.5d+37)) then
tmp = t_1
else if (y <= 6.4d+19) then
tmp = t_0
else if (y <= 1.52d+75) then
tmp = t_1
else
tmp = (y * x) / x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y + (x / z);
double t_1 = y * (-x / z);
double tmp;
if (y <= -4.1e+121) {
tmp = t_0;
} else if (y <= -2.5e+37) {
tmp = t_1;
} else if (y <= 6.4e+19) {
tmp = t_0;
} else if (y <= 1.52e+75) {
tmp = t_1;
} else {
tmp = (y * x) / x;
}
return tmp;
}
def code(x, y, z): t_0 = y + (x / z) t_1 = y * (-x / z) tmp = 0 if y <= -4.1e+121: tmp = t_0 elif y <= -2.5e+37: tmp = t_1 elif y <= 6.4e+19: tmp = t_0 elif y <= 1.52e+75: tmp = t_1 else: tmp = (y * x) / x return tmp
function code(x, y, z) t_0 = Float64(y + Float64(x / z)) t_1 = Float64(y * Float64(Float64(-x) / z)) tmp = 0.0 if (y <= -4.1e+121) tmp = t_0; elseif (y <= -2.5e+37) tmp = t_1; elseif (y <= 6.4e+19) tmp = t_0; elseif (y <= 1.52e+75) tmp = t_1; else tmp = Float64(Float64(y * x) / x); end return tmp end
function tmp_2 = code(x, y, z) t_0 = y + (x / z); t_1 = y * (-x / z); tmp = 0.0; if (y <= -4.1e+121) tmp = t_0; elseif (y <= -2.5e+37) tmp = t_1; elseif (y <= 6.4e+19) tmp = t_0; elseif (y <= 1.52e+75) tmp = t_1; else tmp = (y * x) / x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y * N[((-x) / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.1e+121], t$95$0, If[LessEqual[y, -2.5e+37], t$95$1, If[LessEqual[y, 6.4e+19], t$95$0, If[LessEqual[y, 1.52e+75], t$95$1, N[(N[(y * x), $MachinePrecision] / x), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y + \frac{x}{z}\\
t_1 := y \cdot \frac{-x}{z}\\
\mathbf{if}\;y \leq -4.1 \cdot 10^{+121}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -2.5 \cdot 10^{+37}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 6.4 \cdot 10^{+19}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.52 \cdot 10^{+75}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x}{x}\\
\end{array}
\end{array}
if y < -4.1e121 or -2.49999999999999994e37 < y < 6.4e19Initial program 92.5%
Taylor expanded in z around inf 85.7%
Taylor expanded in x around 0 91.7%
+-commutative91.7%
Simplified91.7%
if -4.1e121 < y < -2.49999999999999994e37 or 6.4e19 < y < 1.5199999999999999e75Initial program 99.8%
Taylor expanded in y around inf 99.8%
associate-/l*99.9%
div-sub99.9%
*-inverses99.9%
Simplified99.9%
Taylor expanded in x around inf 82.5%
associate-*r/82.5%
mul-1-neg82.5%
distribute-rgt-neg-out82.5%
Simplified82.5%
Taylor expanded in x around 0 82.5%
associate-*r/82.5%
*-commutative82.5%
mul-1-neg82.5%
distribute-rgt-neg-in82.5%
associate-*r/82.6%
Simplified82.6%
if 1.5199999999999999e75 < y Initial program 83.2%
Taylor expanded in x around inf 61.4%
associate-+r+61.4%
+-commutative61.4%
mul-1-neg61.4%
unsub-neg61.4%
div-sub61.4%
Simplified61.4%
Taylor expanded in z around inf 23.0%
*-commutative23.0%
associate-*l/66.1%
Applied egg-rr66.1%
Final simplification86.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.0) (not (<= y 1.0))) (* y (- 1.0 (/ x z))) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.0) || !(y <= 1.0)) {
tmp = y * (1.0 - (x / z));
} else {
tmp = y + (x / z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-1.0d0)) .or. (.not. (y <= 1.0d0))) then
tmp = y * (1.0d0 - (x / z))
else
tmp = y + (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.0) || !(y <= 1.0)) {
tmp = y * (1.0 - (x / z));
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.0) or not (y <= 1.0): tmp = y * (1.0 - (x / z)) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.0) || !(y <= 1.0)) tmp = Float64(y * Float64(1.0 - Float64(x / z))); else tmp = Float64(y + Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.0) || ~((y <= 1.0))) tmp = y * (1.0 - (x / z)); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 1.0]], $MachinePrecision]], N[(y * N[(1.0 - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 1\right):\\
\;\;\;\;y \cdot \left(1 - \frac{x}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if y < -1 or 1 < y Initial program 82.9%
Taylor expanded in y around inf 81.5%
associate-/l*98.5%
div-sub98.5%
*-inverses98.5%
Simplified98.5%
if -1 < y < 1Initial program 100.0%
Taylor expanded in z around inf 99.6%
Taylor expanded in x around 0 99.7%
+-commutative99.7%
Simplified99.7%
Final simplification99.1%
(FPCore (x y z) :precision binary64 (if (<= y -1.0) (* y (- 1.0 (/ x z))) (if (<= y 1.0) (+ y (/ x z)) (* y (/ (- z x) z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.0) {
tmp = y * (1.0 - (x / z));
} else if (y <= 1.0) {
tmp = y + (x / z);
} else {
tmp = y * ((z - x) / z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-1.0d0)) then
tmp = y * (1.0d0 - (x / z))
else if (y <= 1.0d0) then
tmp = y + (x / z)
else
tmp = y * ((z - x) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.0) {
tmp = y * (1.0 - (x / z));
} else if (y <= 1.0) {
tmp = y + (x / z);
} else {
tmp = y * ((z - x) / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.0: tmp = y * (1.0 - (x / z)) elif y <= 1.0: tmp = y + (x / z) else: tmp = y * ((z - x) / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.0) tmp = Float64(y * Float64(1.0 - Float64(x / z))); elseif (y <= 1.0) tmp = Float64(y + Float64(x / z)); else tmp = Float64(y * Float64(Float64(z - x) / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.0) tmp = y * (1.0 - (x / z)); elseif (y <= 1.0) tmp = y + (x / z); else tmp = y * ((z - x) / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.0], N[(y * N[(1.0 - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.0], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(z - x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;y \cdot \left(1 - \frac{x}{z}\right)\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z - x}{z}\\
\end{array}
\end{array}
if y < -1Initial program 79.9%
Taylor expanded in y around inf 77.3%
associate-/l*97.3%
div-sub97.4%
*-inverses97.4%
Simplified97.4%
if -1 < y < 1Initial program 100.0%
Taylor expanded in z around inf 99.6%
Taylor expanded in x around 0 99.7%
+-commutative99.7%
Simplified99.7%
if 1 < y Initial program 87.1%
Taylor expanded in y around inf 87.1%
associate-/l*100.0%
Simplified100.0%
Final simplification99.1%
(FPCore (x y z) :precision binary64 (if (<= y 9.2e+22) (+ y (/ x z)) (if (<= y 4.8e+67) (* x (/ y (- z))) (/ (* y x) x))))
double code(double x, double y, double z) {
double tmp;
if (y <= 9.2e+22) {
tmp = y + (x / z);
} else if (y <= 4.8e+67) {
tmp = x * (y / -z);
} else {
tmp = (y * x) / x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 9.2d+22) then
tmp = y + (x / z)
else if (y <= 4.8d+67) then
tmp = x * (y / -z)
else
tmp = (y * x) / x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 9.2e+22) {
tmp = y + (x / z);
} else if (y <= 4.8e+67) {
tmp = x * (y / -z);
} else {
tmp = (y * x) / x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 9.2e+22: tmp = y + (x / z) elif y <= 4.8e+67: tmp = x * (y / -z) else: tmp = (y * x) / x return tmp
function code(x, y, z) tmp = 0.0 if (y <= 9.2e+22) tmp = Float64(y + Float64(x / z)); elseif (y <= 4.8e+67) tmp = Float64(x * Float64(y / Float64(-z))); else tmp = Float64(Float64(y * x) / x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 9.2e+22) tmp = y + (x / z); elseif (y <= 4.8e+67) tmp = x * (y / -z); else tmp = (y * x) / x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 9.2e+22], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.8e+67], N[(x * N[(y / (-z)), $MachinePrecision]), $MachinePrecision], N[(N[(y * x), $MachinePrecision] / x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 9.2 \cdot 10^{+22}:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{elif}\;y \leq 4.8 \cdot 10^{+67}:\\
\;\;\;\;x \cdot \frac{y}{-z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x}{x}\\
\end{array}
\end{array}
if y < 9.2000000000000008e22Initial program 93.2%
Taylor expanded in z around inf 82.3%
Taylor expanded in x around 0 87.8%
+-commutative87.8%
Simplified87.8%
if 9.2000000000000008e22 < y < 4.80000000000000004e67Initial program 99.8%
Taylor expanded in y around inf 99.8%
associate-/l*99.8%
div-sub99.8%
*-inverses99.8%
Simplified99.8%
Taylor expanded in x around inf 99.8%
mul-1-neg99.8%
associate-/l*99.7%
distribute-rgt-neg-in99.7%
distribute-neg-frac99.7%
Simplified99.7%
if 4.80000000000000004e67 < y Initial program 83.2%
Taylor expanded in x around inf 61.4%
associate-+r+61.4%
+-commutative61.4%
mul-1-neg61.4%
unsub-neg61.4%
div-sub61.4%
Simplified61.4%
Taylor expanded in z around inf 23.0%
*-commutative23.0%
associate-*l/66.1%
Applied egg-rr66.1%
Final simplification85.0%
(FPCore (x y z) :precision binary64 (if (<= y -30.0) y (if (<= y 2.3e-37) (/ x z) y)))
double code(double x, double y, double z) {
double tmp;
if (y <= -30.0) {
tmp = y;
} else if (y <= 2.3e-37) {
tmp = x / z;
} else {
tmp = y;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-30.0d0)) then
tmp = y
else if (y <= 2.3d-37) then
tmp = x / z
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -30.0) {
tmp = y;
} else if (y <= 2.3e-37) {
tmp = x / z;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -30.0: tmp = y elif y <= 2.3e-37: tmp = x / z else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (y <= -30.0) tmp = y; elseif (y <= 2.3e-37) tmp = Float64(x / z); else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -30.0) tmp = y; elseif (y <= 2.3e-37) tmp = x / z; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -30.0], y, If[LessEqual[y, 2.3e-37], N[(x / z), $MachinePrecision], y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -30:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 2.3 \cdot 10^{-37}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -30 or 2.3e-37 < y Initial program 83.3%
Taylor expanded in x around 0 49.3%
if -30 < y < 2.3e-37Initial program 100.0%
Taylor expanded in y around 0 70.7%
(FPCore (x y z) :precision binary64 (if (<= y 1.0) (+ y (/ x z)) (/ (* y x) x)))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.0) {
tmp = y + (x / z);
} else {
tmp = (y * x) / x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 1.0d0) then
tmp = y + (x / z)
else
tmp = (y * x) / x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 1.0) {
tmp = y + (x / z);
} else {
tmp = (y * x) / x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 1.0: tmp = y + (x / z) else: tmp = (y * x) / x return tmp
function code(x, y, z) tmp = 0.0 if (y <= 1.0) tmp = Float64(y + Float64(x / z)); else tmp = Float64(Float64(y * x) / x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 1.0) tmp = y + (x / z); else tmp = (y * x) / x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 1.0], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], N[(N[(y * x), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x}{x}\\
\end{array}
\end{array}
if y < 1Initial program 93.1%
Taylor expanded in z around inf 82.2%
Taylor expanded in x around 0 87.7%
+-commutative87.7%
Simplified87.7%
if 1 < y Initial program 87.1%
Taylor expanded in x around inf 70.4%
associate-+r+70.4%
+-commutative70.4%
mul-1-neg70.4%
unsub-neg70.4%
div-sub70.4%
Simplified70.4%
Taylor expanded in z around inf 21.9%
*-commutative21.9%
associate-*l/54.9%
Applied egg-rr54.9%
Final simplification81.2%
(FPCore (x y z) :precision binary64 (+ y (/ x z)))
double code(double x, double y, double z) {
return 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 = y + (x / z)
end function
public static double code(double x, double y, double z) {
return y + (x / z);
}
def code(x, y, z): return y + (x / z)
function code(x, y, z) return Float64(y + Float64(x / z)) end
function tmp = code(x, y, z) tmp = y + (x / z); end
code[x_, y_, z_] := N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y + \frac{x}{z}
\end{array}
Initial program 91.9%
Taylor expanded in z around inf 72.9%
Taylor expanded in x around 0 79.5%
+-commutative79.5%
Simplified79.5%
Final simplification79.5%
(FPCore (x y z) :precision binary64 y)
double code(double x, double y, double z) {
return y;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = y
end function
public static double code(double x, double y, double z) {
return y;
}
def code(x, y, z): return y
function code(x, y, z) return y end
function tmp = code(x, y, z) tmp = y; end
code[x_, y_, z_] := y
\begin{array}{l}
\\
y
\end{array}
Initial program 91.9%
Taylor expanded in x around 0 40.0%
(FPCore (x y z) :precision binary64 (- (+ y (/ x z)) (/ y (/ z x))))
double code(double x, double y, double z) {
return (y + (x / z)) - (y / (z / x));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (y + (x / z)) - (y / (z / x))
end function
public static double code(double x, double y, double z) {
return (y + (x / z)) - (y / (z / x));
}
def code(x, y, z): return (y + (x / z)) - (y / (z / x))
function code(x, y, z) return Float64(Float64(y + Float64(x / z)) - Float64(y / Float64(z / x))) end
function tmp = code(x, y, z) tmp = (y + (x / z)) - (y / (z / x)); end
code[x_, y_, z_] := N[(N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision] - N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(y + \frac{x}{z}\right) - \frac{y}{\frac{z}{x}}
\end{array}
herbie shell --seed 2024090
(FPCore (x y z)
:name "Diagrams.Backend.Rasterific:rasterificRadialGradient from diagrams-rasterific-1.3.1.3"
:precision binary64
:alt
(- (+ y (/ x z)) (/ y (/ z x)))
(/ (+ x (* y (- z x))) z))