
(FPCore (x y z) :precision binary64 (+ x (/ (- y x) z)))
double code(double x, double y, double z) {
return x + ((y - x) / z);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + ((y - x) / z)
end function
public static double code(double x, double y, double z) {
return x + ((y - x) / z);
}
def code(x, y, z): return x + ((y - x) / z)
function code(x, y, z) return Float64(x + Float64(Float64(y - x) / z)) end
function tmp = code(x, y, z) tmp = x + ((y - x) / z); end
code[x_, y_, z_] := N[(x + N[(N[(y - x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y - x}{z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ x (/ (- y x) z)))
double code(double x, double y, double z) {
return x + ((y - x) / z);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + ((y - x) / z)
end function
public static double code(double x, double y, double z) {
return x + ((y - x) / z);
}
def code(x, y, z): return x + ((y - x) / z)
function code(x, y, z) return Float64(x + Float64(Float64(y - x) / z)) end
function tmp = code(x, y, z) tmp = x + ((y - x) / z); end
code[x_, y_, z_] := N[(x + N[(N[(y - x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y - x}{z}
\end{array}
(FPCore (x y z) :precision binary64 (+ x (/ (- y x) z)))
double code(double x, double y, double z) {
return x + ((y - x) / z);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + ((y - x) / z)
end function
public static double code(double x, double y, double z) {
return x + ((y - x) / z);
}
def code(x, y, z): return x + ((y - x) / z)
function code(x, y, z) return Float64(x + Float64(Float64(y - x) / z)) end
function tmp = code(x, y, z) tmp = x + ((y - x) / z); end
code[x_, y_, z_] := N[(x + N[(N[(y - x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y - x}{z}
\end{array}
Initial program 100.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ x (- z))))
(if (<= z -4e+150)
x
(if (<= z -0.27)
(/ y z)
(if (<= z -1.8e-170)
t_0
(if (<= z 6.8e-272)
(/ y z)
(if (<= z 1.55e-199)
t_0
(if (<= z 5.8e-106)
(/ y z)
(if (<= z 1.15e-31) t_0 (if (<= z 2e+116) (/ y z) x))))))))))
double code(double x, double y, double z) {
double t_0 = x / -z;
double tmp;
if (z <= -4e+150) {
tmp = x;
} else if (z <= -0.27) {
tmp = y / z;
} else if (z <= -1.8e-170) {
tmp = t_0;
} else if (z <= 6.8e-272) {
tmp = y / z;
} else if (z <= 1.55e-199) {
tmp = t_0;
} else if (z <= 5.8e-106) {
tmp = y / z;
} else if (z <= 1.15e-31) {
tmp = t_0;
} else if (z <= 2e+116) {
tmp = y / z;
} else {
tmp = 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) :: tmp
t_0 = x / -z
if (z <= (-4d+150)) then
tmp = x
else if (z <= (-0.27d0)) then
tmp = y / z
else if (z <= (-1.8d-170)) then
tmp = t_0
else if (z <= 6.8d-272) then
tmp = y / z
else if (z <= 1.55d-199) then
tmp = t_0
else if (z <= 5.8d-106) then
tmp = y / z
else if (z <= 1.15d-31) then
tmp = t_0
else if (z <= 2d+116) then
tmp = y / z
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x / -z;
double tmp;
if (z <= -4e+150) {
tmp = x;
} else if (z <= -0.27) {
tmp = y / z;
} else if (z <= -1.8e-170) {
tmp = t_0;
} else if (z <= 6.8e-272) {
tmp = y / z;
} else if (z <= 1.55e-199) {
tmp = t_0;
} else if (z <= 5.8e-106) {
tmp = y / z;
} else if (z <= 1.15e-31) {
tmp = t_0;
} else if (z <= 2e+116) {
tmp = y / z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): t_0 = x / -z tmp = 0 if z <= -4e+150: tmp = x elif z <= -0.27: tmp = y / z elif z <= -1.8e-170: tmp = t_0 elif z <= 6.8e-272: tmp = y / z elif z <= 1.55e-199: tmp = t_0 elif z <= 5.8e-106: tmp = y / z elif z <= 1.15e-31: tmp = t_0 elif z <= 2e+116: tmp = y / z else: tmp = x return tmp
function code(x, y, z) t_0 = Float64(x / Float64(-z)) tmp = 0.0 if (z <= -4e+150) tmp = x; elseif (z <= -0.27) tmp = Float64(y / z); elseif (z <= -1.8e-170) tmp = t_0; elseif (z <= 6.8e-272) tmp = Float64(y / z); elseif (z <= 1.55e-199) tmp = t_0; elseif (z <= 5.8e-106) tmp = Float64(y / z); elseif (z <= 1.15e-31) tmp = t_0; elseif (z <= 2e+116) tmp = Float64(y / z); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x / -z; tmp = 0.0; if (z <= -4e+150) tmp = x; elseif (z <= -0.27) tmp = y / z; elseif (z <= -1.8e-170) tmp = t_0; elseif (z <= 6.8e-272) tmp = y / z; elseif (z <= 1.55e-199) tmp = t_0; elseif (z <= 5.8e-106) tmp = y / z; elseif (z <= 1.15e-31) tmp = t_0; elseif (z <= 2e+116) tmp = y / z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x / (-z)), $MachinePrecision]}, If[LessEqual[z, -4e+150], x, If[LessEqual[z, -0.27], N[(y / z), $MachinePrecision], If[LessEqual[z, -1.8e-170], t$95$0, If[LessEqual[z, 6.8e-272], N[(y / z), $MachinePrecision], If[LessEqual[z, 1.55e-199], t$95$0, If[LessEqual[z, 5.8e-106], N[(y / z), $MachinePrecision], If[LessEqual[z, 1.15e-31], t$95$0, If[LessEqual[z, 2e+116], N[(y / z), $MachinePrecision], x]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{-z}\\
\mathbf{if}\;z \leq -4 \cdot 10^{+150}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq -0.27:\\
\;\;\;\;\frac{y}{z}\\
\mathbf{elif}\;z \leq -1.8 \cdot 10^{-170}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 6.8 \cdot 10^{-272}:\\
\;\;\;\;\frac{y}{z}\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{-199}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 5.8 \cdot 10^{-106}:\\
\;\;\;\;\frac{y}{z}\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{-31}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 2 \cdot 10^{+116}:\\
\;\;\;\;\frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -3.99999999999999992e150 or 2.00000000000000003e116 < z Initial program 100.0%
div-sub100.0%
sub-neg100.0%
distribute-frac-neg100.0%
+-commutative100.0%
associate-+r+100.0%
distribute-frac-neg100.0%
sub-neg100.0%
associate--r-100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in z around inf 81.1%
if -3.99999999999999992e150 < z < -0.27000000000000002 or -1.8000000000000002e-170 < z < 6.8000000000000006e-272 or 1.55000000000000006e-199 < z < 5.8000000000000001e-106 or 1.1499999999999999e-31 < z < 2.00000000000000003e116Initial program 100.0%
div-sub97.4%
sub-neg97.4%
distribute-frac-neg97.4%
+-commutative97.4%
associate-+r+97.4%
distribute-frac-neg97.4%
sub-neg97.4%
associate--r-97.4%
div-sub100.0%
Simplified100.0%
Taylor expanded in x around 0 67.5%
if -0.27000000000000002 < z < -1.8000000000000002e-170 or 6.8000000000000006e-272 < z < 1.55000000000000006e-199 or 5.8000000000000001e-106 < z < 1.1499999999999999e-31Initial program 100.0%
div-sub92.7%
sub-neg92.7%
distribute-frac-neg92.7%
+-commutative92.7%
associate-+r+92.7%
distribute-frac-neg92.7%
sub-neg92.7%
associate--r-92.7%
div-sub100.0%
Simplified100.0%
Taylor expanded in x around inf 71.5%
distribute-lft-out--71.5%
*-rgt-identity71.5%
associate-*r/71.7%
*-rgt-identity71.7%
Simplified71.7%
Taylor expanded in z around 0 68.7%
mul-1-neg68.7%
distribute-frac-neg268.7%
Simplified68.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (/ y z))) (t_1 (/ x (- z))))
(if (<= z -0.27)
t_0
(if (<= z -1.55e-170)
t_1
(if (<= z 1.15e-274)
t_0
(if (<= z 2.1e-198)
t_1
(if (<= z 1.75e-105) (/ y z) (if (<= z 8e-35) t_1 t_0))))))))
double code(double x, double y, double z) {
double t_0 = x + (y / z);
double t_1 = x / -z;
double tmp;
if (z <= -0.27) {
tmp = t_0;
} else if (z <= -1.55e-170) {
tmp = t_1;
} else if (z <= 1.15e-274) {
tmp = t_0;
} else if (z <= 2.1e-198) {
tmp = t_1;
} else if (z <= 1.75e-105) {
tmp = y / z;
} else if (z <= 8e-35) {
tmp = t_1;
} else {
tmp = t_0;
}
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 = x + (y / z)
t_1 = x / -z
if (z <= (-0.27d0)) then
tmp = t_0
else if (z <= (-1.55d-170)) then
tmp = t_1
else if (z <= 1.15d-274) then
tmp = t_0
else if (z <= 2.1d-198) then
tmp = t_1
else if (z <= 1.75d-105) then
tmp = y / z
else if (z <= 8d-35) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x + (y / z);
double t_1 = x / -z;
double tmp;
if (z <= -0.27) {
tmp = t_0;
} else if (z <= -1.55e-170) {
tmp = t_1;
} else if (z <= 1.15e-274) {
tmp = t_0;
} else if (z <= 2.1e-198) {
tmp = t_1;
} else if (z <= 1.75e-105) {
tmp = y / z;
} else if (z <= 8e-35) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x + (y / z) t_1 = x / -z tmp = 0 if z <= -0.27: tmp = t_0 elif z <= -1.55e-170: tmp = t_1 elif z <= 1.15e-274: tmp = t_0 elif z <= 2.1e-198: tmp = t_1 elif z <= 1.75e-105: tmp = y / z elif z <= 8e-35: tmp = t_1 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x + Float64(y / z)) t_1 = Float64(x / Float64(-z)) tmp = 0.0 if (z <= -0.27) tmp = t_0; elseif (z <= -1.55e-170) tmp = t_1; elseif (z <= 1.15e-274) tmp = t_0; elseif (z <= 2.1e-198) tmp = t_1; elseif (z <= 1.75e-105) tmp = Float64(y / z); elseif (z <= 8e-35) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x + (y / z); t_1 = x / -z; tmp = 0.0; if (z <= -0.27) tmp = t_0; elseif (z <= -1.55e-170) tmp = t_1; elseif (z <= 1.15e-274) tmp = t_0; elseif (z <= 2.1e-198) tmp = t_1; elseif (z <= 1.75e-105) tmp = y / z; elseif (z <= 8e-35) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(y / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x / (-z)), $MachinePrecision]}, If[LessEqual[z, -0.27], t$95$0, If[LessEqual[z, -1.55e-170], t$95$1, If[LessEqual[z, 1.15e-274], t$95$0, If[LessEqual[z, 2.1e-198], t$95$1, If[LessEqual[z, 1.75e-105], N[(y / z), $MachinePrecision], If[LessEqual[z, 8e-35], t$95$1, t$95$0]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \frac{y}{z}\\
t_1 := \frac{x}{-z}\\
\mathbf{if}\;z \leq -0.27:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -1.55 \cdot 10^{-170}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{-274}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{-198}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{-105}:\\
\;\;\;\;\frac{y}{z}\\
\mathbf{elif}\;z \leq 8 \cdot 10^{-35}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -0.27000000000000002 or -1.54999999999999993e-170 < z < 1.14999999999999998e-274 or 8.00000000000000006e-35 < z Initial program 100.0%
div-sub98.1%
sub-neg98.1%
distribute-frac-neg98.1%
+-commutative98.1%
associate-+r+98.1%
distribute-frac-neg98.1%
sub-neg98.1%
associate--r-98.1%
div-sub100.0%
Simplified100.0%
Taylor expanded in x around 0 90.3%
neg-mul-190.3%
Simplified90.3%
sub-neg90.3%
distribute-frac-neg90.3%
remove-double-neg90.3%
+-commutative90.3%
Applied egg-rr90.3%
if -0.27000000000000002 < z < -1.54999999999999993e-170 or 1.14999999999999998e-274 < z < 2.09999999999999993e-198 or 1.75e-105 < z < 8.00000000000000006e-35Initial program 100.0%
div-sub92.7%
sub-neg92.7%
distribute-frac-neg92.7%
+-commutative92.7%
associate-+r+92.7%
distribute-frac-neg92.7%
sub-neg92.7%
associate--r-92.7%
div-sub100.0%
Simplified100.0%
Taylor expanded in x around inf 71.5%
distribute-lft-out--71.5%
*-rgt-identity71.5%
associate-*r/71.7%
*-rgt-identity71.7%
Simplified71.7%
Taylor expanded in z around 0 68.7%
mul-1-neg68.7%
distribute-frac-neg268.7%
Simplified68.7%
if 2.09999999999999993e-198 < z < 1.75e-105Initial program 100.0%
div-sub100.0%
sub-neg100.0%
distribute-frac-neg100.0%
+-commutative100.0%
associate-+r+100.0%
distribute-frac-neg100.0%
sub-neg100.0%
associate--r-100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in x around 0 76.9%
Final simplification83.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -230.0) (not (<= z 5.1e-8))) (+ x (/ y z)) (/ (- y x) z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -230.0) || !(z <= 5.1e-8)) {
tmp = x + (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 ((z <= (-230.0d0)) .or. (.not. (z <= 5.1d-8))) then
tmp = x + (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 ((z <= -230.0) || !(z <= 5.1e-8)) {
tmp = x + (y / z);
} else {
tmp = (y - x) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -230.0) or not (z <= 5.1e-8): tmp = x + (y / z) else: tmp = (y - x) / z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -230.0) || !(z <= 5.1e-8)) tmp = Float64(x + Float64(y / z)); else tmp = Float64(Float64(y - x) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -230.0) || ~((z <= 5.1e-8))) tmp = x + (y / z); else tmp = (y - x) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -230.0], N[Not[LessEqual[z, 5.1e-8]], $MachinePrecision]], N[(x + N[(y / z), $MachinePrecision]), $MachinePrecision], N[(N[(y - x), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -230 \lor \neg \left(z \leq 5.1 \cdot 10^{-8}\right):\\
\;\;\;\;x + \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y - x}{z}\\
\end{array}
\end{array}
if z < -230 or 5.10000000000000001e-8 < z Initial program 100.0%
div-sub100.0%
sub-neg100.0%
distribute-frac-neg100.0%
+-commutative100.0%
associate-+r+100.0%
distribute-frac-neg100.0%
sub-neg100.0%
associate--r-100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in x around 0 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%
if -230 < z < 5.10000000000000001e-8Initial program 100.0%
div-sub93.9%
sub-neg93.9%
distribute-frac-neg93.9%
+-commutative93.9%
associate-+r+93.9%
distribute-frac-neg93.9%
sub-neg93.9%
associate--r-93.9%
div-sub100.0%
Simplified100.0%
Taylor expanded in z around 0 98.1%
Final simplification97.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -6e-82) (not (<= y 4.2e-12))) (+ x (/ y z)) (- x (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -6e-82) || !(y <= 4.2e-12)) {
tmp = x + (y / z);
} else {
tmp = x - (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 <= (-6d-82)) .or. (.not. (y <= 4.2d-12))) then
tmp = x + (y / z)
else
tmp = x - (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -6e-82) || !(y <= 4.2e-12)) {
tmp = x + (y / z);
} else {
tmp = x - (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -6e-82) or not (y <= 4.2e-12): tmp = x + (y / z) else: tmp = x - (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -6e-82) || !(y <= 4.2e-12)) tmp = Float64(x + Float64(y / z)); else tmp = Float64(x - Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -6e-82) || ~((y <= 4.2e-12))) tmp = x + (y / z); else tmp = x - (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -6e-82], N[Not[LessEqual[y, 4.2e-12]], $MachinePrecision]], N[(x + N[(y / z), $MachinePrecision]), $MachinePrecision], N[(x - N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6 \cdot 10^{-82} \lor \neg \left(y \leq 4.2 \cdot 10^{-12}\right):\\
\;\;\;\;x + \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{x}{z}\\
\end{array}
\end{array}
if y < -5.9999999999999998e-82 or 4.19999999999999988e-12 < y Initial program 100.0%
div-sub94.5%
sub-neg94.5%
distribute-frac-neg94.5%
+-commutative94.5%
associate-+r+94.5%
distribute-frac-neg94.5%
sub-neg94.5%
associate--r-94.5%
div-sub100.0%
Simplified100.0%
Taylor expanded in x around 0 86.7%
neg-mul-186.7%
Simplified86.7%
sub-neg86.7%
distribute-frac-neg86.7%
remove-double-neg86.7%
+-commutative86.7%
Applied egg-rr86.7%
if -5.9999999999999998e-82 < y < 4.19999999999999988e-12Initial program 100.0%
div-sub100.0%
sub-neg100.0%
distribute-frac-neg100.0%
+-commutative100.0%
associate-+r+100.0%
distribute-frac-neg100.0%
sub-neg100.0%
associate--r-100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in x around inf 86.4%
distribute-lft-out--86.4%
*-rgt-identity86.4%
associate-*r/86.5%
*-rgt-identity86.5%
Simplified86.5%
Final simplification86.6%
(FPCore (x y z) :precision binary64 (if (<= z -1.3e+144) x (if (<= z 2.8e+115) (/ y z) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.3e+144) {
tmp = x;
} else if (z <= 2.8e+115) {
tmp = y / z;
} else {
tmp = 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.3d+144)) then
tmp = x
else if (z <= 2.8d+115) then
tmp = y / z
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.3e+144) {
tmp = x;
} else if (z <= 2.8e+115) {
tmp = y / z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.3e+144: tmp = x elif z <= 2.8e+115: tmp = y / z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.3e+144) tmp = x; elseif (z <= 2.8e+115) tmp = Float64(y / z); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.3e+144) tmp = x; elseif (z <= 2.8e+115) tmp = y / z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.3e+144], x, If[LessEqual[z, 2.8e+115], N[(y / z), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{+144}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{+115}:\\
\;\;\;\;\frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.2999999999999999e144 or 2.8e115 < z Initial program 100.0%
div-sub100.0%
sub-neg100.0%
distribute-frac-neg100.0%
+-commutative100.0%
associate-+r+100.0%
distribute-frac-neg100.0%
sub-neg100.0%
associate--r-100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in z around inf 81.1%
if -1.2999999999999999e144 < z < 2.8e115Initial program 100.0%
div-sub95.7%
sub-neg95.7%
distribute-frac-neg95.7%
+-commutative95.7%
associate-+r+95.7%
distribute-frac-neg95.7%
sub-neg95.7%
associate--r-95.7%
div-sub100.0%
Simplified100.0%
Taylor expanded in x around 0 54.6%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 100.0%
div-sub96.9%
sub-neg96.9%
distribute-frac-neg96.9%
+-commutative96.9%
associate-+r+96.9%
distribute-frac-neg96.9%
sub-neg96.9%
associate--r-96.9%
div-sub100.0%
Simplified100.0%
Taylor expanded in z around inf 31.1%
herbie shell --seed 2024111
(FPCore (x y z)
:name "Statistics.Sample:$swelfordMean from math-functions-0.1.5.2"
:precision binary64
(+ x (/ (- y x) z)))