
(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 13 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 (pow (/ (/ z x) (+ y -1.0)) -1.0)))
double code(double x, double y, double z) {
return y - pow(((z / x) / (y + -1.0)), -1.0);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = y - (((z / x) / (y + (-1.0d0))) ** (-1.0d0))
end function
public static double code(double x, double y, double z) {
return y - Math.pow(((z / x) / (y + -1.0)), -1.0);
}
def code(x, y, z): return y - math.pow(((z / x) / (y + -1.0)), -1.0)
function code(x, y, z) return Float64(y - (Float64(Float64(z / x) / Float64(y + -1.0)) ^ -1.0)) end
function tmp = code(x, y, z) tmp = y - (((z / x) / (y + -1.0)) ^ -1.0); end
code[x_, y_, z_] := N[(y - N[Power[N[(N[(z / x), $MachinePrecision] / N[(y + -1.0), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y - {\left(\frac{\frac{z}{x}}{y + -1}\right)}^{-1}
\end{array}
Initial program 90.7%
Taylor expanded in y around 0 95.6%
Taylor expanded in x around 0 96.1%
distribute-lft-in93.0%
mul-1-neg93.0%
distribute-rgt-neg-in93.0%
associate-/l*93.4%
mul-1-neg93.4%
associate-*r/93.5%
*-rgt-identity93.5%
remove-double-neg93.5%
distribute-frac-neg293.5%
unsub-neg93.5%
mul-1-neg93.5%
distribute-frac-neg293.5%
div-sub96.7%
unsub-neg96.7%
mul-1-neg96.7%
+-commutative96.7%
distribute-neg-frac296.7%
unsub-neg96.7%
Simplified96.7%
clear-num96.5%
inv-pow96.5%
associate-/r*99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (x y z)
:precision binary64
(if (or (<= z -1.4e-169)
(not (or (<= z 3e-293) (and (not (<= z 6.2e-208)) (<= z 8.6e-121)))))
(+ y (/ x z))
(/ y (/ z (- x)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.4e-169) || !((z <= 3e-293) || (!(z <= 6.2e-208) && (z <= 8.6e-121)))) {
tmp = y + (x / z);
} else {
tmp = y / (z / -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 ((z <= (-1.4d-169)) .or. (.not. (z <= 3d-293) .or. (.not. (z <= 6.2d-208)) .and. (z <= 8.6d-121))) then
tmp = y + (x / z)
else
tmp = y / (z / -x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.4e-169) || !((z <= 3e-293) || (!(z <= 6.2e-208) && (z <= 8.6e-121)))) {
tmp = y + (x / z);
} else {
tmp = y / (z / -x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.4e-169) or not ((z <= 3e-293) or (not (z <= 6.2e-208) and (z <= 8.6e-121))): tmp = y + (x / z) else: tmp = y / (z / -x) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.4e-169) || !((z <= 3e-293) || (!(z <= 6.2e-208) && (z <= 8.6e-121)))) tmp = Float64(y + Float64(x / z)); else tmp = Float64(y / Float64(z / Float64(-x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.4e-169) || ~(((z <= 3e-293) || (~((z <= 6.2e-208)) && (z <= 8.6e-121))))) tmp = y + (x / z); else tmp = y / (z / -x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.4e-169], N[Not[Or[LessEqual[z, 3e-293], And[N[Not[LessEqual[z, 6.2e-208]], $MachinePrecision], LessEqual[z, 8.6e-121]]]], $MachinePrecision]], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], N[(y / N[(z / (-x)), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{-169} \lor \neg \left(z \leq 3 \cdot 10^{-293} \lor \neg \left(z \leq 6.2 \cdot 10^{-208}\right) \land z \leq 8.6 \cdot 10^{-121}\right):\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{z}{-x}}\\
\end{array}
\end{array}
if z < -1.39999999999999994e-169 or 3.0000000000000002e-293 < z < 6.1999999999999996e-208 or 8.5999999999999993e-121 < z Initial program 88.1%
Taylor expanded in y around 0 98.4%
Taylor expanded in x around 0 96.9%
distribute-lft-in95.9%
mul-1-neg95.9%
distribute-rgt-neg-in95.9%
associate-/l*94.6%
mul-1-neg94.6%
associate-*r/94.7%
*-rgt-identity94.7%
remove-double-neg94.7%
distribute-frac-neg294.7%
unsub-neg94.7%
mul-1-neg94.7%
distribute-frac-neg294.7%
div-sub95.7%
unsub-neg95.7%
mul-1-neg95.7%
+-commutative95.7%
distribute-neg-frac295.7%
unsub-neg95.7%
Simplified95.7%
Taylor expanded in y around 0 79.5%
associate-*r/79.5%
neg-mul-179.5%
Simplified79.5%
sub-neg79.5%
distribute-frac-neg79.5%
remove-double-neg79.5%
+-commutative79.5%
Applied egg-rr79.5%
if -1.39999999999999994e-169 < z < 3.0000000000000002e-293 or 6.1999999999999996e-208 < z < 8.5999999999999993e-121Initial program 99.8%
Taylor expanded in y around inf 78.4%
associate-/l*80.0%
div-sub80.1%
sub-neg80.1%
*-inverses80.1%
sub-neg80.1%
Simplified80.1%
Taylor expanded in x around inf 71.4%
associate-*r/71.4%
mul-1-neg71.4%
distribute-rgt-neg-in71.4%
associate-*r/66.7%
Simplified66.7%
distribute-frac-neg66.7%
distribute-rgt-neg-out66.7%
associate-/l*71.4%
*-commutative71.4%
associate-/l*73.0%
Applied egg-rr73.0%
clear-num73.0%
un-div-inv73.0%
Applied egg-rr73.0%
Final simplification78.1%
(FPCore (x y z)
:precision binary64
(if (or (<= z -2.6e-171)
(not
(or (<= z 1.4e-293) (and (not (<= z 2.3e-210)) (<= z 2.25e-119)))))
(+ y (/ x z))
(* y (/ x (- z)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.6e-171) || !((z <= 1.4e-293) || (!(z <= 2.3e-210) && (z <= 2.25e-119)))) {
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 ((z <= (-2.6d-171)) .or. (.not. (z <= 1.4d-293) .or. (.not. (z <= 2.3d-210)) .and. (z <= 2.25d-119))) 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 ((z <= -2.6e-171) || !((z <= 1.4e-293) || (!(z <= 2.3e-210) && (z <= 2.25e-119)))) {
tmp = y + (x / z);
} else {
tmp = y * (x / -z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.6e-171) or not ((z <= 1.4e-293) or (not (z <= 2.3e-210) and (z <= 2.25e-119))): tmp = y + (x / z) else: tmp = y * (x / -z) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.6e-171) || !((z <= 1.4e-293) || (!(z <= 2.3e-210) && (z <= 2.25e-119)))) tmp = Float64(y + Float64(x / z)); else tmp = Float64(y * Float64(x / Float64(-z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -2.6e-171) || ~(((z <= 1.4e-293) || (~((z <= 2.3e-210)) && (z <= 2.25e-119))))) tmp = y + (x / z); else tmp = y * (x / -z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.6e-171], N[Not[Or[LessEqual[z, 1.4e-293], And[N[Not[LessEqual[z, 2.3e-210]], $MachinePrecision], LessEqual[z, 2.25e-119]]]], $MachinePrecision]], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / (-z)), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.6 \cdot 10^{-171} \lor \neg \left(z \leq 1.4 \cdot 10^{-293} \lor \neg \left(z \leq 2.3 \cdot 10^{-210}\right) \land z \leq 2.25 \cdot 10^{-119}\right):\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{-z}\\
\end{array}
\end{array}
if z < -2.60000000000000005e-171 or 1.40000000000000013e-293 < z < 2.3e-210 or 2.2500000000000001e-119 < z Initial program 88.1%
Taylor expanded in y around 0 98.4%
Taylor expanded in x around 0 96.9%
distribute-lft-in95.9%
mul-1-neg95.9%
distribute-rgt-neg-in95.9%
associate-/l*94.6%
mul-1-neg94.6%
associate-*r/94.7%
*-rgt-identity94.7%
remove-double-neg94.7%
distribute-frac-neg294.7%
unsub-neg94.7%
mul-1-neg94.7%
distribute-frac-neg294.7%
div-sub95.7%
unsub-neg95.7%
mul-1-neg95.7%
+-commutative95.7%
distribute-neg-frac295.7%
unsub-neg95.7%
Simplified95.7%
Taylor expanded in y around 0 79.5%
associate-*r/79.5%
neg-mul-179.5%
Simplified79.5%
sub-neg79.5%
distribute-frac-neg79.5%
remove-double-neg79.5%
+-commutative79.5%
Applied egg-rr79.5%
if -2.60000000000000005e-171 < z < 1.40000000000000013e-293 or 2.3e-210 < z < 2.2500000000000001e-119Initial program 99.8%
Taylor expanded in y around inf 78.4%
associate-/l*80.0%
div-sub80.1%
sub-neg80.1%
*-inverses80.1%
sub-neg80.1%
Simplified80.1%
Taylor expanded in x around inf 71.4%
associate-*r/71.4%
mul-1-neg71.4%
distribute-rgt-neg-in71.4%
associate-*r/66.7%
Simplified66.7%
distribute-frac-neg66.7%
distribute-rgt-neg-out66.7%
associate-/l*71.4%
*-commutative71.4%
associate-/l*73.0%
Applied egg-rr73.0%
Final simplification78.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ y (/ x z))))
(if (<= z -1.02e-169)
t_0
(if (<= z 3.8e-293)
(/ y (/ z (- x)))
(if (or (<= z 3.1e-208) (not (<= z 8e-121))) t_0 (* x (- (/ y z))))))))
double code(double x, double y, double z) {
double t_0 = y + (x / z);
double tmp;
if (z <= -1.02e-169) {
tmp = t_0;
} else if (z <= 3.8e-293) {
tmp = y / (z / -x);
} else if ((z <= 3.1e-208) || !(z <= 8e-121)) {
tmp = t_0;
} else {
tmp = x * -(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) :: t_0
real(8) :: tmp
t_0 = y + (x / z)
if (z <= (-1.02d-169)) then
tmp = t_0
else if (z <= 3.8d-293) then
tmp = y / (z / -x)
else if ((z <= 3.1d-208) .or. (.not. (z <= 8d-121))) then
tmp = t_0
else
tmp = x * -(y / z)
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 (z <= -1.02e-169) {
tmp = t_0;
} else if (z <= 3.8e-293) {
tmp = y / (z / -x);
} else if ((z <= 3.1e-208) || !(z <= 8e-121)) {
tmp = t_0;
} else {
tmp = x * -(y / z);
}
return tmp;
}
def code(x, y, z): t_0 = y + (x / z) tmp = 0 if z <= -1.02e-169: tmp = t_0 elif z <= 3.8e-293: tmp = y / (z / -x) elif (z <= 3.1e-208) or not (z <= 8e-121): tmp = t_0 else: tmp = x * -(y / z) return tmp
function code(x, y, z) t_0 = Float64(y + Float64(x / z)) tmp = 0.0 if (z <= -1.02e-169) tmp = t_0; elseif (z <= 3.8e-293) tmp = Float64(y / Float64(z / Float64(-x))); elseif ((z <= 3.1e-208) || !(z <= 8e-121)) tmp = t_0; else tmp = Float64(x * Float64(-Float64(y / z))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = y + (x / z); tmp = 0.0; if (z <= -1.02e-169) tmp = t_0; elseif (z <= 3.8e-293) tmp = y / (z / -x); elseif ((z <= 3.1e-208) || ~((z <= 8e-121))) tmp = t_0; else tmp = x * -(y / z); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.02e-169], t$95$0, If[LessEqual[z, 3.8e-293], N[(y / N[(z / (-x)), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 3.1e-208], N[Not[LessEqual[z, 8e-121]], $MachinePrecision]], t$95$0, N[(x * (-N[(y / z), $MachinePrecision])), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y + \frac{x}{z}\\
\mathbf{if}\;z \leq -1.02 \cdot 10^{-169}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{-293}:\\
\;\;\;\;\frac{y}{\frac{z}{-x}}\\
\mathbf{elif}\;z \leq 3.1 \cdot 10^{-208} \lor \neg \left(z \leq 8 \cdot 10^{-121}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-\frac{y}{z}\right)\\
\end{array}
\end{array}
if z < -1.01999999999999996e-169 or 3.8e-293 < z < 3.0999999999999998e-208 or 7.9999999999999998e-121 < z Initial program 88.1%
Taylor expanded in y around 0 98.4%
Taylor expanded in x around 0 96.9%
distribute-lft-in95.9%
mul-1-neg95.9%
distribute-rgt-neg-in95.9%
associate-/l*94.6%
mul-1-neg94.6%
associate-*r/94.7%
*-rgt-identity94.7%
remove-double-neg94.7%
distribute-frac-neg294.7%
unsub-neg94.7%
mul-1-neg94.7%
distribute-frac-neg294.7%
div-sub95.7%
unsub-neg95.7%
mul-1-neg95.7%
+-commutative95.7%
distribute-neg-frac295.7%
unsub-neg95.7%
Simplified95.7%
Taylor expanded in y around 0 79.5%
associate-*r/79.5%
neg-mul-179.5%
Simplified79.5%
sub-neg79.5%
distribute-frac-neg79.5%
remove-double-neg79.5%
+-commutative79.5%
Applied egg-rr79.5%
if -1.01999999999999996e-169 < z < 3.8e-293Initial program 99.9%
Taylor expanded in y around inf 75.7%
associate-/l*78.3%
div-sub78.3%
sub-neg78.3%
*-inverses78.3%
sub-neg78.3%
Simplified78.3%
Taylor expanded in x around inf 69.7%
associate-*r/69.7%
mul-1-neg69.7%
distribute-rgt-neg-in69.7%
associate-*r/62.3%
Simplified62.3%
distribute-frac-neg62.3%
distribute-rgt-neg-out62.3%
associate-/l*69.7%
*-commutative69.7%
associate-/l*72.3%
Applied egg-rr72.3%
clear-num72.3%
un-div-inv72.3%
Applied egg-rr72.3%
if 3.0999999999999998e-208 < z < 7.9999999999999998e-121Initial program 99.8%
Taylor expanded in y around inf 83.0%
associate-/l*83.1%
div-sub83.1%
sub-neg83.1%
*-inverses83.1%
sub-neg83.1%
Simplified83.1%
Taylor expanded in x around inf 74.1%
associate-*r/74.1%
mul-1-neg74.1%
distribute-rgt-neg-in74.1%
associate-*r/74.3%
Simplified74.3%
Final simplification78.1%
(FPCore (x y z) :precision binary64 (if (or (<= y -122.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 <= -122.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 <= (-122.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 <= -122.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 <= -122.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 <= -122.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 <= -122.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, -122.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 -122 \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 < -122 or 1 < y Initial program 82.6%
Taylor expanded in y around inf 81.6%
associate-/l*98.8%
div-sub98.8%
sub-neg98.8%
*-inverses98.8%
sub-neg98.8%
Simplified98.8%
if -122 < y < 1Initial program 99.9%
Taylor expanded in y around 0 95.8%
Taylor expanded in x around 0 99.7%
distribute-lft-in98.1%
mul-1-neg98.1%
distribute-rgt-neg-in98.1%
associate-/l*98.1%
mul-1-neg98.1%
associate-*r/98.3%
*-rgt-identity98.3%
remove-double-neg98.3%
distribute-frac-neg298.3%
unsub-neg98.3%
mul-1-neg98.3%
distribute-frac-neg298.3%
div-sub100.0%
unsub-neg100.0%
mul-1-neg100.0%
+-commutative100.0%
distribute-neg-frac2100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 97.4%
associate-*r/97.4%
neg-mul-197.4%
Simplified97.4%
sub-neg97.4%
distribute-frac-neg97.4%
remove-double-neg97.4%
+-commutative97.4%
Applied egg-rr97.4%
Final simplification98.2%
(FPCore (x y z) :precision binary64 (if (or (<= x -2.4e+66) (not (<= x 9.8e-71))) (* x (/ (- 1.0 y) z)) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -2.4e+66) || !(x <= 9.8e-71)) {
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 <= (-2.4d+66)) .or. (.not. (x <= 9.8d-71))) 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 <= -2.4e+66) || !(x <= 9.8e-71)) {
tmp = x * ((1.0 - y) / z);
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -2.4e+66) or not (x <= 9.8e-71): tmp = x * ((1.0 - y) / z) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -2.4e+66) || !(x <= 9.8e-71)) 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 <= -2.4e+66) || ~((x <= 9.8e-71))) tmp = x * ((1.0 - y) / z); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -2.4e+66], N[Not[LessEqual[x, 9.8e-71]], $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 -2.4 \cdot 10^{+66} \lor \neg \left(x \leq 9.8 \cdot 10^{-71}\right):\\
\;\;\;\;x \cdot \frac{1 - y}{z}\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if x < -2.4000000000000002e66 or 9.7999999999999994e-71 < x Initial program 93.2%
Taylor expanded in x around inf 81.1%
associate-/l*83.6%
mul-1-neg83.6%
unsub-neg83.6%
Simplified83.6%
if -2.4000000000000002e66 < x < 9.7999999999999994e-71Initial program 87.8%
Taylor expanded in y around 0 99.9%
Taylor expanded in x around 0 92.6%
distribute-lft-in92.5%
mul-1-neg92.5%
distribute-rgt-neg-in92.5%
associate-/l*99.2%
mul-1-neg99.2%
associate-*r/99.3%
*-rgt-identity99.3%
remove-double-neg99.3%
distribute-frac-neg299.3%
unsub-neg99.3%
mul-1-neg99.3%
distribute-frac-neg299.3%
div-sub99.3%
unsub-neg99.3%
mul-1-neg99.3%
+-commutative99.3%
distribute-neg-frac299.3%
unsub-neg99.3%
Simplified99.3%
Taylor expanded in y around 0 85.8%
associate-*r/85.8%
neg-mul-185.8%
Simplified85.8%
sub-neg85.8%
distribute-frac-neg85.8%
remove-double-neg85.8%
+-commutative85.8%
Applied egg-rr85.8%
Final simplification84.6%
(FPCore (x y z) :precision binary64 (if (<= z 2e-15) (- y (/ (* x (+ y -1.0)) z)) (+ (/ x z) (* y (- 1.0 (/ x z))))))
double code(double x, double y, double z) {
double tmp;
if (z <= 2e-15) {
tmp = y - ((x * (y + -1.0)) / z);
} else {
tmp = (x / z) + (y * (1.0 - (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 (z <= 2d-15) then
tmp = y - ((x * (y + (-1.0d0))) / z)
else
tmp = (x / z) + (y * (1.0d0 - (x / z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 2e-15) {
tmp = y - ((x * (y + -1.0)) / z);
} else {
tmp = (x / z) + (y * (1.0 - (x / z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 2e-15: tmp = y - ((x * (y + -1.0)) / z) else: tmp = (x / z) + (y * (1.0 - (x / z))) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 2e-15) tmp = Float64(y - Float64(Float64(x * Float64(y + -1.0)) / z)); else tmp = Float64(Float64(x / z) + Float64(y * Float64(1.0 - Float64(x / z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 2e-15) tmp = y - ((x * (y + -1.0)) / z); else tmp = (x / z) + (y * (1.0 - (x / z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 2e-15], N[(y - N[(N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] + N[(y * N[(1.0 - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2 \cdot 10^{-15}:\\
\;\;\;\;y - \frac{x \cdot \left(y + -1\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} + y \cdot \left(1 - \frac{x}{z}\right)\\
\end{array}
\end{array}
if z < 2.0000000000000002e-15Initial program 94.7%
Taylor expanded in y around 0 94.0%
Taylor expanded in x around 0 94.7%
distribute-lft-in90.3%
mul-1-neg90.3%
distribute-rgt-neg-in90.3%
associate-/l*94.4%
mul-1-neg94.4%
associate-*r/94.5%
*-rgt-identity94.5%
remove-double-neg94.5%
distribute-frac-neg294.5%
unsub-neg94.5%
mul-1-neg94.5%
distribute-frac-neg294.5%
div-sub98.8%
unsub-neg98.8%
mul-1-neg98.8%
+-commutative98.8%
distribute-neg-frac298.8%
unsub-neg98.8%
Simplified98.8%
if 2.0000000000000002e-15 < z Initial program 80.5%
Taylor expanded in y around 0 99.9%
Final simplification99.1%
(FPCore (x y z) :precision binary64 (if (<= x -2e+36) (* x (+ (/ (- 1.0 y) z) (/ y x))) (- y (/ (* x (+ y -1.0)) z))))
double code(double x, double y, double z) {
double tmp;
if (x <= -2e+36) {
tmp = x * (((1.0 - y) / z) + (y / x));
} else {
tmp = y - ((x * (y + -1.0)) / 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 <= (-2d+36)) then
tmp = x * (((1.0d0 - y) / z) + (y / x))
else
tmp = y - ((x * (y + (-1.0d0))) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -2e+36) {
tmp = x * (((1.0 - y) / z) + (y / x));
} else {
tmp = y - ((x * (y + -1.0)) / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2e+36: tmp = x * (((1.0 - y) / z) + (y / x)) else: tmp = y - ((x * (y + -1.0)) / z) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2e+36) tmp = Float64(x * Float64(Float64(Float64(1.0 - y) / z) + Float64(y / x))); else tmp = Float64(y - Float64(Float64(x * Float64(y + -1.0)) / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -2e+36) tmp = x * (((1.0 - y) / z) + (y / x)); else tmp = y - ((x * (y + -1.0)) / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2e+36], N[(x * N[(N[(N[(1.0 - y), $MachinePrecision] / z), $MachinePrecision] + N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y - N[(N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{+36}:\\
\;\;\;\;x \cdot \left(\frac{1 - y}{z} + \frac{y}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;y - \frac{x \cdot \left(y + -1\right)}{z}\\
\end{array}
\end{array}
if x < -2.00000000000000008e36Initial program 88.9%
Taylor expanded in x around inf 99.7%
associate-+r+99.7%
+-commutative99.7%
mul-1-neg99.7%
unsub-neg99.7%
div-sub99.7%
Simplified99.7%
if -2.00000000000000008e36 < x Initial program 91.4%
Taylor expanded in y around 0 98.3%
Taylor expanded in x around 0 94.8%
distribute-lft-in93.2%
mul-1-neg93.2%
distribute-rgt-neg-in93.2%
associate-/l*96.3%
mul-1-neg96.3%
associate-*r/96.4%
*-rgt-identity96.4%
remove-double-neg96.4%
distribute-frac-neg296.4%
unsub-neg96.4%
mul-1-neg96.4%
distribute-frac-neg296.4%
div-sub98.0%
unsub-neg98.0%
mul-1-neg98.0%
+-commutative98.0%
distribute-neg-frac298.0%
unsub-neg98.0%
Simplified98.0%
Final simplification98.4%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.3e-51) (not (<= y 6.5e-24))) (* z (/ y z)) (/ x z)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.3e-51) || !(y <= 6.5e-24)) {
tmp = z * (y / z);
} 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 <= (-2.3d-51)) .or. (.not. (y <= 6.5d-24))) then
tmp = z * (y / z)
else
tmp = x / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -2.3e-51) || !(y <= 6.5e-24)) {
tmp = z * (y / z);
} else {
tmp = x / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.3e-51) or not (y <= 6.5e-24): tmp = z * (y / z) else: tmp = x / z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.3e-51) || !(y <= 6.5e-24)) tmp = Float64(z * Float64(y / z)); else tmp = Float64(x / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -2.3e-51) || ~((y <= 6.5e-24))) tmp = z * (y / z); else tmp = x / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.3e-51], N[Not[LessEqual[y, 6.5e-24]], $MachinePrecision]], N[(z * N[(y / z), $MachinePrecision]), $MachinePrecision], N[(x / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.3 \cdot 10^{-51} \lor \neg \left(y \leq 6.5 \cdot 10^{-24}\right):\\
\;\;\;\;z \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z}\\
\end{array}
\end{array}
if y < -2.30000000000000002e-51 or 6.5e-24 < y Initial program 84.4%
Taylor expanded in x around 0 34.1%
*-commutative34.1%
associate-/l*51.1%
Applied egg-rr51.1%
if -2.30000000000000002e-51 < y < 6.5e-24Initial program 100.0%
Taylor expanded in y around 0 76.2%
Final simplification61.3%
(FPCore (x y z) :precision binary64 (if (<= y -5.5e+15) (* y (- 1.0 (/ x z))) (- y (/ (* x (+ y -1.0)) z))))
double code(double x, double y, double z) {
double tmp;
if (y <= -5.5e+15) {
tmp = y * (1.0 - (x / z));
} else {
tmp = y - ((x * (y + -1.0)) / 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+15)) then
tmp = y * (1.0d0 - (x / z))
else
tmp = y - ((x * (y + (-1.0d0))) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -5.5e+15) {
tmp = y * (1.0 - (x / z));
} else {
tmp = y - ((x * (y + -1.0)) / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -5.5e+15: tmp = y * (1.0 - (x / z)) else: tmp = y - ((x * (y + -1.0)) / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -5.5e+15) tmp = Float64(y * Float64(1.0 - Float64(x / z))); else tmp = Float64(y - Float64(Float64(x * Float64(y + -1.0)) / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -5.5e+15) tmp = y * (1.0 - (x / z)); else tmp = y - ((x * (y + -1.0)) / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -5.5e+15], N[(y * N[(1.0 - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y - N[(N[(x * N[(y + -1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.5 \cdot 10^{+15}:\\
\;\;\;\;y \cdot \left(1 - \frac{x}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;y - \frac{x \cdot \left(y + -1\right)}{z}\\
\end{array}
\end{array}
if y < -5.5e15Initial program 83.2%
Taylor expanded in y around inf 83.2%
associate-/l*99.8%
div-sub99.8%
sub-neg99.8%
*-inverses99.8%
sub-neg99.8%
Simplified99.8%
if -5.5e15 < y Initial program 93.4%
Taylor expanded in y around 0 94.1%
Taylor expanded in x around 0 97.8%
distribute-lft-in93.6%
mul-1-neg93.6%
distribute-rgt-neg-in93.6%
associate-/l*93.6%
mul-1-neg93.6%
associate-*r/93.7%
*-rgt-identity93.7%
remove-double-neg93.7%
distribute-frac-neg293.7%
unsub-neg93.7%
mul-1-neg93.7%
distribute-frac-neg293.7%
div-sub97.9%
unsub-neg97.9%
mul-1-neg97.9%
+-commutative97.9%
distribute-neg-frac297.9%
unsub-neg97.9%
Simplified97.9%
Final simplification98.4%
(FPCore (x y z) :precision binary64 (if (<= y -1e-105) y (if (<= y 5e-23) (/ x z) y)))
double code(double x, double y, double z) {
double tmp;
if (y <= -1e-105) {
tmp = y;
} else if (y <= 5e-23) {
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 <= (-1d-105)) then
tmp = y
else if (y <= 5d-23) 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 <= -1e-105) {
tmp = y;
} else if (y <= 5e-23) {
tmp = x / z;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1e-105: tmp = y elif y <= 5e-23: tmp = x / z else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1e-105) tmp = y; elseif (y <= 5e-23) tmp = Float64(x / z); else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1e-105) tmp = y; elseif (y <= 5e-23) tmp = x / z; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1e-105], y, If[LessEqual[y, 5e-23], N[(x / z), $MachinePrecision], y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \cdot 10^{-105}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 5 \cdot 10^{-23}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -9.99999999999999965e-106 or 5.0000000000000002e-23 < y Initial program 85.6%
Taylor expanded in x around 0 46.5%
if -9.99999999999999965e-106 < y < 5.0000000000000002e-23Initial program 100.0%
Taylor expanded in y around 0 80.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 90.7%
Taylor expanded in y around 0 95.6%
Taylor expanded in x around 0 96.1%
distribute-lft-in93.0%
mul-1-neg93.0%
distribute-rgt-neg-in93.0%
associate-/l*93.4%
mul-1-neg93.4%
associate-*r/93.5%
*-rgt-identity93.5%
remove-double-neg93.5%
distribute-frac-neg293.5%
unsub-neg93.5%
mul-1-neg93.5%
distribute-frac-neg293.5%
div-sub96.7%
unsub-neg96.7%
mul-1-neg96.7%
+-commutative96.7%
distribute-neg-frac296.7%
unsub-neg96.7%
Simplified96.7%
Taylor expanded in y around 0 71.7%
associate-*r/71.7%
neg-mul-171.7%
Simplified71.7%
sub-neg71.7%
distribute-frac-neg71.7%
remove-double-neg71.7%
+-commutative71.7%
Applied egg-rr71.7%
Final simplification71.7%
(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 90.7%
Taylor expanded in x around 0 37.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 2024085
(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))