
(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 10 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 (or (<= y -5e+52) (not (<= y 1e+43))) (* y (- 1.0 (/ x z))) (+ y (/ x (/ z (- 1.0 y))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -5e+52) || !(y <= 1e+43)) {
tmp = y * (1.0 - (x / z));
} else {
tmp = y + (x / (z / (1.0 - 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 <= (-5d+52)) .or. (.not. (y <= 1d+43))) then
tmp = y * (1.0d0 - (x / z))
else
tmp = y + (x / (z / (1.0d0 - y)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -5e+52) || !(y <= 1e+43)) {
tmp = y * (1.0 - (x / z));
} else {
tmp = y + (x / (z / (1.0 - y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -5e+52) or not (y <= 1e+43): tmp = y * (1.0 - (x / z)) else: tmp = y + (x / (z / (1.0 - y))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -5e+52) || !(y <= 1e+43)) tmp = Float64(y * Float64(1.0 - Float64(x / z))); else tmp = Float64(y + Float64(x / Float64(z / Float64(1.0 - y)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -5e+52) || ~((y <= 1e+43))) tmp = y * (1.0 - (x / z)); else tmp = y + (x / (z / (1.0 - y))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -5e+52], N[Not[LessEqual[y, 1e+43]], $MachinePrecision]], N[(y * N[(1.0 - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + N[(x / N[(z / N[(1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{+52} \lor \neg \left(y \leq 10^{+43}\right):\\
\;\;\;\;y \cdot \left(1 - \frac{x}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{\frac{z}{1 - y}}\\
\end{array}
\end{array}
if y < -5e52 or 1.00000000000000001e43 < y Initial program 74.8%
Taylor expanded in y around inf 74.8%
associate-/l*99.9%
div-sub99.9%
sub-neg99.9%
*-inverses99.9%
sub-neg99.9%
Simplified99.9%
if -5e52 < y < 1.00000000000000001e43Initial program 98.6%
Taylor expanded in x around 0 99.7%
+-commutative99.7%
mul-1-neg99.7%
sub-neg99.7%
div-sub99.7%
clear-num99.7%
un-div-inv100.0%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (x y z) :precision binary64 (if (<= y -5e-10) y (if (<= y 3.6e-12) (/ x z) (if (<= y 2.8e+292) y (/ (- x) z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -5e-10) {
tmp = y;
} else if (y <= 3.6e-12) {
tmp = x / z;
} else if (y <= 2.8e+292) {
tmp = y;
} else {
tmp = -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 <= (-5d-10)) then
tmp = y
else if (y <= 3.6d-12) then
tmp = x / z
else if (y <= 2.8d+292) then
tmp = y
else
tmp = -x / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -5e-10) {
tmp = y;
} else if (y <= 3.6e-12) {
tmp = x / z;
} else if (y <= 2.8e+292) {
tmp = y;
} else {
tmp = -x / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -5e-10: tmp = y elif y <= 3.6e-12: tmp = x / z elif y <= 2.8e+292: tmp = y else: tmp = -x / z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -5e-10) tmp = y; elseif (y <= 3.6e-12) tmp = Float64(x / z); elseif (y <= 2.8e+292) tmp = y; else tmp = Float64(Float64(-x) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -5e-10) tmp = y; elseif (y <= 3.6e-12) tmp = x / z; elseif (y <= 2.8e+292) tmp = y; else tmp = -x / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -5e-10], y, If[LessEqual[y, 3.6e-12], N[(x / z), $MachinePrecision], If[LessEqual[y, 2.8e+292], y, N[((-x) / z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{-10}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 3.6 \cdot 10^{-12}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{+292}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{z}\\
\end{array}
\end{array}
if y < -5.00000000000000031e-10 or 3.6e-12 < y < 2.8000000000000002e292Initial program 76.0%
Taylor expanded in x around 0 51.9%
if -5.00000000000000031e-10 < y < 3.6e-12Initial program 100.0%
Taylor expanded in y around 0 78.6%
if 2.8000000000000002e292 < y Initial program 91.0%
Taylor expanded in y around 0 0.3%
div-inv0.3%
Applied egg-rr0.3%
un-div-inv0.3%
frac-2neg0.3%
add-sqr-sqrt0.2%
sqrt-unprod20.6%
sqr-neg20.6%
sqrt-unprod10.9%
add-sqr-sqrt52.0%
Applied egg-rr52.0%
Final simplification64.4%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.55e+20) (not (<= y 5.5e-9))) (* y (- 1.0 (/ x z))) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.55e+20) || !(y <= 5.5e-9)) {
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 <= (-2.55d+20)) .or. (.not. (y <= 5.5d-9))) 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 <= -2.55e+20) || !(y <= 5.5e-9)) {
tmp = y * (1.0 - (x / z));
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.55e+20) or not (y <= 5.5e-9): tmp = y * (1.0 - (x / z)) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.55e+20) || !(y <= 5.5e-9)) 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 <= -2.55e+20) || ~((y <= 5.5e-9))) tmp = y * (1.0 - (x / z)); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.55e+20], N[Not[LessEqual[y, 5.5e-9]], $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 -2.55 \cdot 10^{+20} \lor \neg \left(y \leq 5.5 \cdot 10^{-9}\right):\\
\;\;\;\;y \cdot \left(1 - \frac{x}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if y < -2.55e20 or 5.4999999999999996e-9 < y Initial program 76.6%
Taylor expanded in y around inf 76.6%
associate-/l*99.9%
div-sub99.9%
sub-neg99.9%
*-inverses99.9%
sub-neg99.9%
Simplified99.9%
if -2.55e20 < y < 5.4999999999999996e-9Initial program 100.0%
Taylor expanded in x around 0 99.6%
Taylor expanded in y around 0 99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (<= y 5.5e-9) (+ y (/ x z)) (if (<= y 1.35e+251) (- y (/ x z)) (/ (* y (- x)) z))))
double code(double x, double y, double z) {
double tmp;
if (y <= 5.5e-9) {
tmp = y + (x / z);
} else if (y <= 1.35e+251) {
tmp = y - (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 <= 5.5d-9) then
tmp = y + (x / z)
else if (y <= 1.35d+251) then
tmp = y - (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 <= 5.5e-9) {
tmp = y + (x / z);
} else if (y <= 1.35e+251) {
tmp = y - (x / z);
} else {
tmp = (y * -x) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 5.5e-9: tmp = y + (x / z) elif y <= 1.35e+251: tmp = y - (x / z) else: tmp = (y * -x) / z return tmp
function code(x, y, z) tmp = 0.0 if (y <= 5.5e-9) tmp = Float64(y + Float64(x / z)); elseif (y <= 1.35e+251) tmp = Float64(y - Float64(x / z)); else tmp = Float64(Float64(y * Float64(-x)) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 5.5e-9) tmp = y + (x / z); elseif (y <= 1.35e+251) tmp = y - (x / z); else tmp = (y * -x) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 5.5e-9], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.35e+251], N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision], N[(N[(y * (-x)), $MachinePrecision] / z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.5 \cdot 10^{-9}:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+251}:\\
\;\;\;\;y - \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot \left(-x\right)}{z}\\
\end{array}
\end{array}
if y < 5.4999999999999996e-9Initial program 90.2%
Taylor expanded in x around 0 94.8%
Taylor expanded in y around 0 86.9%
if 5.4999999999999996e-9 < y < 1.3500000000000001e251Initial program 78.2%
Taylor expanded in x around 0 90.1%
Taylor expanded in y around 0 52.4%
add-sqr-sqrt32.3%
sqrt-unprod48.2%
sqr-neg48.2%
sqrt-unprod23.1%
add-sqr-sqrt66.4%
distribute-frac-neg266.4%
sub-neg66.4%
Applied egg-rr66.4%
if 1.3500000000000001e251 < y Initial program 87.9%
Taylor expanded in y around inf 87.9%
Taylor expanded in z around 0 86.9%
mul-1-neg86.9%
distribute-lft-neg-out86.9%
*-commutative86.9%
Simplified86.9%
(FPCore (x y z) :precision binary64 (if (<= y 5.5e-9) (+ y (/ x z)) (if (<= y 2.2e+250) (- y (/ x z)) (* y (/ (- x) z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 5.5e-9) {
tmp = y + (x / z);
} else if (y <= 2.2e+250) {
tmp = y - (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 <= 5.5d-9) then
tmp = y + (x / z)
else if (y <= 2.2d+250) then
tmp = y - (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 <= 5.5e-9) {
tmp = y + (x / z);
} else if (y <= 2.2e+250) {
tmp = y - (x / z);
} else {
tmp = y * (-x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 5.5e-9: tmp = y + (x / z) elif y <= 2.2e+250: tmp = y - (x / z) else: tmp = y * (-x / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 5.5e-9) tmp = Float64(y + Float64(x / z)); elseif (y <= 2.2e+250) tmp = Float64(y - Float64(x / z)); else tmp = Float64(y * Float64(Float64(-x) / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 5.5e-9) tmp = y + (x / z); elseif (y <= 2.2e+250) tmp = y - (x / z); else tmp = y * (-x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 5.5e-9], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.2e+250], N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision], N[(y * N[((-x) / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.5 \cdot 10^{-9}:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{elif}\;y \leq 2.2 \cdot 10^{+250}:\\
\;\;\;\;y - \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{-x}{z}\\
\end{array}
\end{array}
if y < 5.4999999999999996e-9Initial program 90.2%
Taylor expanded in x around 0 94.8%
Taylor expanded in y around 0 86.9%
if 5.4999999999999996e-9 < y < 2.20000000000000014e250Initial program 78.2%
Taylor expanded in x around 0 90.1%
Taylor expanded in y around 0 52.4%
add-sqr-sqrt32.3%
sqrt-unprod48.2%
sqr-neg48.2%
sqrt-unprod23.1%
add-sqr-sqrt66.4%
distribute-frac-neg266.4%
sub-neg66.4%
Applied egg-rr66.4%
if 2.20000000000000014e250 < y Initial program 87.9%
Taylor expanded in y around inf 87.9%
associate-/l*100.0%
div-sub100.0%
sub-neg100.0%
*-inverses100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 86.9%
mul-1-neg86.9%
distribute-frac-neg286.9%
Simplified86.9%
Final simplification83.0%
(FPCore (x y z) :precision binary64 (if (<= y -4.2e-8) y (if (<= y 4.1e-10) (/ x z) (* z (/ y z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -4.2e-8) {
tmp = y;
} else if (y <= 4.1e-10) {
tmp = x / z;
} else {
tmp = z * (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 <= (-4.2d-8)) then
tmp = y
else if (y <= 4.1d-10) then
tmp = x / z
else
tmp = z * (y / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -4.2e-8) {
tmp = y;
} else if (y <= 4.1e-10) {
tmp = x / z;
} else {
tmp = z * (y / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -4.2e-8: tmp = y elif y <= 4.1e-10: tmp = x / z else: tmp = z * (y / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -4.2e-8) tmp = y; elseif (y <= 4.1e-10) tmp = Float64(x / z); else tmp = Float64(z * Float64(y / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -4.2e-8) tmp = y; elseif (y <= 4.1e-10) tmp = x / z; else tmp = z * (y / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -4.2e-8], y, If[LessEqual[y, 4.1e-10], N[(x / z), $MachinePrecision], N[(z * N[(y / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.2 \cdot 10^{-8}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 4.1 \cdot 10^{-10}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{z}\\
\end{array}
\end{array}
if y < -4.19999999999999989e-8Initial program 74.2%
Taylor expanded in x around 0 53.1%
if -4.19999999999999989e-8 < y < 4.0999999999999998e-10Initial program 100.0%
Taylor expanded in y around 0 78.6%
if 4.0999999999999998e-10 < y Initial program 80.5%
Taylor expanded in y around inf 80.5%
div-inv80.3%
*-commutative80.3%
associate-*l*92.2%
div-inv92.4%
Applied egg-rr92.4%
Taylor expanded in z around inf 50.3%
(FPCore (x y z) :precision binary64 (if (<= y -6.5e-11) y (if (<= y 1.1e-9) (/ x z) y)))
double code(double x, double y, double z) {
double tmp;
if (y <= -6.5e-11) {
tmp = y;
} else if (y <= 1.1e-9) {
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 <= (-6.5d-11)) then
tmp = y
else if (y <= 1.1d-9) 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 <= -6.5e-11) {
tmp = y;
} else if (y <= 1.1e-9) {
tmp = x / z;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -6.5e-11: tmp = y elif y <= 1.1e-9: tmp = x / z else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (y <= -6.5e-11) tmp = y; elseif (y <= 1.1e-9) tmp = Float64(x / z); else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -6.5e-11) tmp = y; elseif (y <= 1.1e-9) tmp = x / z; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -6.5e-11], y, If[LessEqual[y, 1.1e-9], N[(x / z), $MachinePrecision], y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.5 \cdot 10^{-11}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{-9}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -6.49999999999999953e-11 or 1.0999999999999999e-9 < y Initial program 77.1%
Taylor expanded in x around 0 48.9%
if -6.49999999999999953e-11 < y < 1.0999999999999999e-9Initial program 100.0%
Taylor expanded in y around 0 78.6%
(FPCore (x y z) :precision binary64 (if (<= y 5.5e-9) (+ y (/ x z)) (- y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if (y <= 5.5e-9) {
tmp = y + (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 <= 5.5d-9) then
tmp = y + (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 <= 5.5e-9) {
tmp = y + (x / z);
} else {
tmp = y - (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 5.5e-9: tmp = y + (x / z) else: tmp = y - (x / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 5.5e-9) tmp = Float64(y + 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 <= 5.5e-9) tmp = y + (x / z); else tmp = y - (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 5.5e-9], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.5 \cdot 10^{-9}:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y - \frac{x}{z}\\
\end{array}
\end{array}
if y < 5.4999999999999996e-9Initial program 90.2%
Taylor expanded in x around 0 94.8%
Taylor expanded in y around 0 86.9%
if 5.4999999999999996e-9 < y Initial program 80.5%
Taylor expanded in x around 0 92.5%
Taylor expanded in y around 0 43.5%
add-sqr-sqrt26.3%
sqrt-unprod51.0%
sqr-neg51.0%
sqrt-unprod25.9%
add-sqr-sqrt62.2%
distribute-frac-neg262.2%
sub-neg62.2%
Applied egg-rr62.2%
(FPCore (x y z) :precision binary64 (if (<= y 8e+172) (+ y (/ x z)) (* z (/ y z))))
double code(double x, double y, double z) {
double tmp;
if (y <= 8e+172) {
tmp = y + (x / z);
} else {
tmp = z * (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 <= 8d+172) then
tmp = y + (x / z)
else
tmp = z * (y / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 8e+172) {
tmp = y + (x / z);
} else {
tmp = z * (y / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 8e+172: tmp = y + (x / z) else: tmp = z * (y / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 8e+172) tmp = Float64(y + Float64(x / z)); else tmp = Float64(z * Float64(y / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 8e+172) tmp = y + (x / z); else tmp = z * (y / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 8e+172], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], N[(z * N[(y / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 8 \cdot 10^{+172}:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{z}\\
\end{array}
\end{array}
if y < 8.0000000000000007e172Initial program 89.1%
Taylor expanded in x around 0 94.7%
Taylor expanded in y around 0 82.3%
if 8.0000000000000007e172 < y Initial program 78.9%
Taylor expanded in y around inf 78.9%
div-inv78.8%
*-commutative78.8%
associate-*l*90.9%
div-inv90.9%
Applied egg-rr90.9%
Taylor expanded in z around inf 45.9%
(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.8%
Taylor expanded in x around 0 36.9%
(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 2024157
(FPCore (x y z)
:name "Diagrams.Backend.Rasterific:rasterificRadialGradient from diagrams-rasterific-1.3.1.3"
:precision binary64
:alt
(! :herbie-platform default (- (+ y (/ x z)) (/ y (/ z x))))
(/ (+ x (* y (- z x))) z))