
(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 (+ y (/ (- 1.0 y) (/ z x))))
double code(double x, double y, double z) {
return y + ((1.0 - 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 + ((1.0d0 - y) / (z / x))
end function
public static double code(double x, double y, double z) {
return y + ((1.0 - y) / (z / x));
}
def code(x, y, z): return y + ((1.0 - y) / (z / x))
function code(x, y, z) return Float64(y + Float64(Float64(1.0 - y) / Float64(z / x))) end
function tmp = code(x, y, z) tmp = y + ((1.0 - y) / (z / x)); end
code[x_, y_, z_] := N[(y + N[(N[(1.0 - y), $MachinePrecision] / N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y + \frac{1 - y}{\frac{z}{x}}
\end{array}
Initial program 87.9%
Taylor expanded in x around 0 96.6%
+-commutative96.6%
mul-1-neg96.6%
sub-neg96.6%
div-sub96.6%
associate-*r/96.6%
clear-num96.6%
frac-2neg96.6%
metadata-eval96.6%
associate-/r*99.9%
Applied egg-rr99.9%
distribute-frac-neg299.9%
distribute-neg-frac99.9%
metadata-eval99.9%
associate-/r/99.9%
associate-*l/99.9%
*-lft-identity99.9%
Simplified99.9%
(FPCore (x y z) :precision binary64 (if (<= y -1.55e-17) (* z (/ y z)) (if (or (<= y 3e-98) (and (not (<= y 7.5e-82)) (<= y 5.8e-14))) (/ x z) y)))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.55e-17) {
tmp = z * (y / z);
} else if ((y <= 3e-98) || (!(y <= 7.5e-82) && (y <= 5.8e-14))) {
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 <= (-1.55d-17)) then
tmp = z * (y / z)
else if ((y <= 3d-98) .or. (.not. (y <= 7.5d-82)) .and. (y <= 5.8d-14)) 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 <= -1.55e-17) {
tmp = z * (y / z);
} else if ((y <= 3e-98) || (!(y <= 7.5e-82) && (y <= 5.8e-14))) {
tmp = x / z;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.55e-17: tmp = z * (y / z) elif (y <= 3e-98) or (not (y <= 7.5e-82) and (y <= 5.8e-14)): tmp = x / z else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.55e-17) tmp = Float64(z * Float64(y / z)); elseif ((y <= 3e-98) || (!(y <= 7.5e-82) && (y <= 5.8e-14))) tmp = Float64(x / z); else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.55e-17) tmp = z * (y / z); elseif ((y <= 3e-98) || (~((y <= 7.5e-82)) && (y <= 5.8e-14))) tmp = x / z; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.55e-17], N[(z * N[(y / z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, 3e-98], And[N[Not[LessEqual[y, 7.5e-82]], $MachinePrecision], LessEqual[y, 5.8e-14]]], N[(x / z), $MachinePrecision], y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.55 \cdot 10^{-17}:\\
\;\;\;\;z \cdot \frac{y}{z}\\
\mathbf{elif}\;y \leq 3 \cdot 10^{-98} \lor \neg \left(y \leq 7.5 \cdot 10^{-82}\right) \land y \leq 5.8 \cdot 10^{-14}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -1.5499999999999999e-17Initial program 79.0%
Taylor expanded in y around inf 79.0%
Taylor expanded in z around inf 30.1%
*-commutative30.1%
Simplified30.1%
associate-/l*52.5%
*-commutative52.5%
Applied egg-rr52.5%
if -1.5499999999999999e-17 < y < 3e-98 or 7.4999999999999997e-82 < y < 5.8000000000000005e-14Initial program 99.9%
Taylor expanded in y around 0 74.4%
if 3e-98 < y < 7.4999999999999997e-82 or 5.8000000000000005e-14 < y Initial program 74.7%
Taylor expanded in x around 0 66.5%
Final simplification67.1%
(FPCore (x y z) :precision binary64 (if (<= y -8e-17) y (if (or (<= y 2e-99) (and (not (<= y 8.5e-82)) (<= y 1.55e-7))) (/ x z) y)))
double code(double x, double y, double z) {
double tmp;
if (y <= -8e-17) {
tmp = y;
} else if ((y <= 2e-99) || (!(y <= 8.5e-82) && (y <= 1.55e-7))) {
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 <= (-8d-17)) then
tmp = y
else if ((y <= 2d-99) .or. (.not. (y <= 8.5d-82)) .and. (y <= 1.55d-7)) 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 <= -8e-17) {
tmp = y;
} else if ((y <= 2e-99) || (!(y <= 8.5e-82) && (y <= 1.55e-7))) {
tmp = x / z;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -8e-17: tmp = y elif (y <= 2e-99) or (not (y <= 8.5e-82) and (y <= 1.55e-7)): tmp = x / z else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (y <= -8e-17) tmp = y; elseif ((y <= 2e-99) || (!(y <= 8.5e-82) && (y <= 1.55e-7))) tmp = Float64(x / z); else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -8e-17) tmp = y; elseif ((y <= 2e-99) || (~((y <= 8.5e-82)) && (y <= 1.55e-7))) tmp = x / z; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -8e-17], y, If[Or[LessEqual[y, 2e-99], And[N[Not[LessEqual[y, 8.5e-82]], $MachinePrecision], LessEqual[y, 1.55e-7]]], N[(x / z), $MachinePrecision], y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8 \cdot 10^{-17}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 2 \cdot 10^{-99} \lor \neg \left(y \leq 8.5 \cdot 10^{-82}\right) \land y \leq 1.55 \cdot 10^{-7}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -8.00000000000000057e-17 or 2e-99 < y < 8.4999999999999997e-82 or 1.55e-7 < y Initial program 76.6%
Taylor expanded in x around 0 56.9%
if -8.00000000000000057e-17 < y < 2e-99 or 8.4999999999999997e-82 < y < 1.55e-7Initial program 99.9%
Taylor expanded in y around 0 74.4%
Final simplification65.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (/ x (- z)))))
(if (<= y -8.8e+86)
t_0
(if (<= y 2.15e+80) (+ y (/ x z)) (if (<= y 1.2e+116) t_0 y)))))
double code(double x, double y, double z) {
double t_0 = y * (x / -z);
double tmp;
if (y <= -8.8e+86) {
tmp = t_0;
} else if (y <= 2.15e+80) {
tmp = y + (x / z);
} else if (y <= 1.2e+116) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = y * (x / -z)
if (y <= (-8.8d+86)) then
tmp = t_0
else if (y <= 2.15d+80) then
tmp = y + (x / z)
else if (y <= 1.2d+116) then
tmp = t_0
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y * (x / -z);
double tmp;
if (y <= -8.8e+86) {
tmp = t_0;
} else if (y <= 2.15e+80) {
tmp = y + (x / z);
} else if (y <= 1.2e+116) {
tmp = t_0;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): t_0 = y * (x / -z) tmp = 0 if y <= -8.8e+86: tmp = t_0 elif y <= 2.15e+80: tmp = y + (x / z) elif y <= 1.2e+116: tmp = t_0 else: tmp = y return tmp
function code(x, y, z) t_0 = Float64(y * Float64(x / Float64(-z))) tmp = 0.0 if (y <= -8.8e+86) tmp = t_0; elseif (y <= 2.15e+80) tmp = Float64(y + Float64(x / z)); elseif (y <= 1.2e+116) tmp = t_0; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * (x / -z); tmp = 0.0; if (y <= -8.8e+86) tmp = t_0; elseif (y <= 2.15e+80) tmp = y + (x / z); elseif (y <= 1.2e+116) tmp = t_0; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(x / (-z)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -8.8e+86], t$95$0, If[LessEqual[y, 2.15e+80], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.2e+116], t$95$0, y]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \frac{x}{-z}\\
\mathbf{if}\;y \leq -8.8 \cdot 10^{+86}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 2.15 \cdot 10^{+80}:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{+116}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -8.80000000000000013e86 or 2.15000000000000002e80 < y < 1.2e116Initial program 71.3%
Taylor expanded in x around inf 62.7%
mul-1-neg62.7%
unsub-neg62.7%
Simplified62.7%
Taylor expanded in y around inf 62.7%
mul-1-neg62.7%
distribute-rgt-neg-out62.7%
Simplified62.7%
frac-2neg62.7%
distribute-frac-neg62.7%
add-sqr-sqrt16.5%
sqrt-unprod17.5%
sqr-neg17.5%
sqrt-unprod0.8%
add-sqr-sqrt0.9%
distribute-rgt-neg-in0.9%
frac-2neg0.9%
*-commutative0.9%
associate-/l*1.0%
add-sqr-sqrt0.9%
sqrt-unprod19.1%
sqr-neg19.1%
sqrt-unprod18.3%
add-sqr-sqrt72.0%
Applied egg-rr72.0%
if -8.80000000000000013e86 < y < 2.15000000000000002e80Initial program 99.3%
Taylor expanded in x around 0 99.9%
Taylor expanded in y around 0 96.5%
if 1.2e116 < y Initial program 65.5%
Taylor expanded in x around 0 71.5%
Final simplification87.3%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.0) (not (<= y 6.2e-5))) (* y (- 1.0 (/ x z))) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.0) || !(y <= 6.2e-5)) {
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 <= 6.2d-5))) 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 <= 6.2e-5)) {
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 <= 6.2e-5): 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 <= 6.2e-5)) 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 <= 6.2e-5))) 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, 6.2e-5]], $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 6.2 \cdot 10^{-5}\right):\\
\;\;\;\;y \cdot \left(1 - \frac{x}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if y < -1 or 6.20000000000000027e-5 < y Initial program 74.4%
Taylor expanded in y around inf 73.9%
associate-/l*99.4%
div-sub99.4%
*-inverses99.4%
Simplified99.4%
if -1 < y < 6.20000000000000027e-5Initial program 99.9%
Taylor expanded in x around 0 99.8%
Taylor expanded in y around 0 99.3%
Final simplification99.3%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.46e+142) (not (<= x 1.25e+18))) (* x (/ (- 1.0 y) z)) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.46e+142) || !(x <= 1.25e+18)) {
tmp = x * ((1.0 - y) / 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 ((x <= (-1.46d+142)) .or. (.not. (x <= 1.25d+18))) then
tmp = x * ((1.0d0 - y) / 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 ((x <= -1.46e+142) || !(x <= 1.25e+18)) {
tmp = x * ((1.0 - y) / z);
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.46e+142) or not (x <= 1.25e+18): tmp = x * ((1.0 - y) / z) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.46e+142) || !(x <= 1.25e+18)) tmp = Float64(x * Float64(Float64(1.0 - y) / z)); else tmp = Float64(y + Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.46e+142) || ~((x <= 1.25e+18))) tmp = x * ((1.0 - y) / z); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.46e+142], N[Not[LessEqual[x, 1.25e+18]], $MachinePrecision]], N[(x * N[(N[(1.0 - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.46 \cdot 10^{+142} \lor \neg \left(x \leq 1.25 \cdot 10^{+18}\right):\\
\;\;\;\;x \cdot \frac{1 - y}{z}\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if x < -1.4600000000000001e142 or 1.25e18 < x Initial program 90.3%
Taylor expanded in x around inf 85.5%
associate-/l*88.2%
mul-1-neg88.2%
unsub-neg88.2%
Simplified88.2%
if -1.4600000000000001e142 < x < 1.25e18Initial program 86.4%
Taylor expanded in x around 0 94.6%
Taylor expanded in y around 0 89.2%
Final simplification88.8%
(FPCore (x y z) :precision binary64 (if (<= y -1.0) (* y (- 1.0 (/ x z))) (if (<= y 6.2e-5) (+ y (/ x z)) (- y (* y (/ 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 <= 6.2e-5) {
tmp = y + (x / z);
} else {
tmp = y - (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)) then
tmp = y * (1.0d0 - (x / z))
else if (y <= 6.2d-5) then
tmp = y + (x / z)
else
tmp = y - (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) {
tmp = y * (1.0 - (x / z));
} else if (y <= 6.2e-5) {
tmp = y + (x / z);
} else {
tmp = y - (y * (x / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.0: tmp = y * (1.0 - (x / z)) elif y <= 6.2e-5: tmp = y + (x / z) else: tmp = y - (y * (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 <= 6.2e-5) tmp = Float64(y + Float64(x / z)); else tmp = Float64(y - Float64(y * Float64(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 <= 6.2e-5) tmp = y + (x / z); else tmp = y - (y * (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, 6.2e-5], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], N[(y - N[(y * N[(x / z), $MachinePrecision]), $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 6.2 \cdot 10^{-5}:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y - y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if y < -1Initial program 77.4%
Taylor expanded in y around inf 76.2%
associate-/l*98.7%
div-sub98.7%
*-inverses98.7%
Simplified98.7%
if -1 < y < 6.20000000000000027e-5Initial program 99.9%
Taylor expanded in x around 0 99.8%
Taylor expanded in y around 0 99.3%
if 6.20000000000000027e-5 < y Initial program 72.1%
Taylor expanded in x around 0 91.5%
+-commutative91.5%
mul-1-neg91.5%
sub-neg91.5%
div-sub91.5%
associate-*r/94.2%
clear-num94.2%
frac-2neg94.2%
metadata-eval94.2%
associate-/r*99.9%
Applied egg-rr99.9%
distribute-frac-neg299.9%
distribute-neg-frac99.9%
metadata-eval99.9%
associate-/r/99.9%
associate-*l/99.9%
*-lft-identity99.9%
Simplified99.9%
Taylor expanded in y around inf 94.2%
associate-*r/94.2%
*-commutative94.2%
mul-1-neg94.2%
distribute-rgt-neg-out94.2%
associate-*r/99.9%
Simplified99.9%
Final simplification99.3%
(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 87.9%
Taylor expanded in x around 0 96.6%
Taylor expanded in y around 0 82.0%
(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 87.9%
Taylor expanded in x around 0 42.8%
(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 2024086
(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))