
(FPCore (x y z) :precision binary64 (/ (* x (+ (- y z) 1.0)) z))
double code(double x, double y, double z) {
return (x * ((y - z) + 1.0)) / 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) + 1.0d0)) / z
end function
public static double code(double x, double y, double z) {
return (x * ((y - z) + 1.0)) / z;
}
def code(x, y, z): return (x * ((y - z) + 1.0)) / z
function code(x, y, z) return Float64(Float64(x * Float64(Float64(y - z) + 1.0)) / z) end
function tmp = code(x, y, z) tmp = (x * ((y - z) + 1.0)) / z; end
code[x_, y_, z_] := N[(N[(x * N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (* x (+ (- y z) 1.0)) z))
double code(double x, double y, double z) {
return (x * ((y - z) + 1.0)) / 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) + 1.0d0)) / z
end function
public static double code(double x, double y, double z) {
return (x * ((y - z) + 1.0)) / z;
}
def code(x, y, z): return (x * ((y - z) + 1.0)) / z
function code(x, y, z) return Float64(Float64(x * Float64(Float64(y - z) + 1.0)) / z) end
function tmp = code(x, y, z) tmp = (x * ((y - z) + 1.0)) / z; end
code[x_, y_, z_] := N[(N[(x * N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z}
\end{array}
(FPCore (x y z) :precision binary64 (if (or (<= z -0.4) (not (<= z 3.8e-161))) (/ x (/ z (- y (+ z -1.0)))) (/ (* x (+ 1.0 (- y z))) z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.4) || !(z <= 3.8e-161)) {
tmp = x / (z / (y - (z + -1.0)));
} else {
tmp = (x * (1.0 + (y - z))) / 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 <= (-0.4d0)) .or. (.not. (z <= 3.8d-161))) then
tmp = x / (z / (y - (z + (-1.0d0))))
else
tmp = (x * (1.0d0 + (y - z))) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -0.4) || !(z <= 3.8e-161)) {
tmp = x / (z / (y - (z + -1.0)));
} else {
tmp = (x * (1.0 + (y - z))) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.4) or not (z <= 3.8e-161): tmp = x / (z / (y - (z + -1.0))) else: tmp = (x * (1.0 + (y - z))) / z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.4) || !(z <= 3.8e-161)) tmp = Float64(x / Float64(z / Float64(y - Float64(z + -1.0)))); else tmp = Float64(Float64(x * Float64(1.0 + Float64(y - z))) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -0.4) || ~((z <= 3.8e-161))) tmp = x / (z / (y - (z + -1.0))); else tmp = (x * (1.0 + (y - z))) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.4], N[Not[LessEqual[z, 3.8e-161]], $MachinePrecision]], N[(x / N[(z / N[(y - N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(1.0 + N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.4 \lor \neg \left(z \leq 3.8 \cdot 10^{-161}\right):\\
\;\;\;\;\frac{x}{\frac{z}{y - \left(z + -1\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(1 + \left(y - z\right)\right)}{z}\\
\end{array}
\end{array}
if z < -0.40000000000000002 or 3.8000000000000001e-161 < z Initial program 86.6%
associate-/l*99.9%
associate-/r/75.8%
Applied egg-rr75.8%
associate-*l/86.6%
associate-/l*99.9%
associate-+l-99.9%
sub-neg99.9%
metadata-eval99.9%
Applied egg-rr99.9%
if -0.40000000000000002 < z < 3.8000000000000001e-161Initial program 100.0%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (/ x z))))
(if (<= z -4.5e+17)
(- x)
(if (<= z -2.45e-218)
t_0
(if (<= z 7e-227)
(/ x z)
(if (<= z 7e-116) t_0 (if (<= z 4.2e-6) (/ x z) (- x))))))))
double code(double x, double y, double z) {
double t_0 = y * (x / z);
double tmp;
if (z <= -4.5e+17) {
tmp = -x;
} else if (z <= -2.45e-218) {
tmp = t_0;
} else if (z <= 7e-227) {
tmp = x / z;
} else if (z <= 7e-116) {
tmp = t_0;
} else if (z <= 4.2e-6) {
tmp = x / 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 = y * (x / z)
if (z <= (-4.5d+17)) then
tmp = -x
else if (z <= (-2.45d-218)) then
tmp = t_0
else if (z <= 7d-227) then
tmp = x / z
else if (z <= 7d-116) then
tmp = t_0
else if (z <= 4.2d-6) then
tmp = x / z
else
tmp = -x
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 <= -4.5e+17) {
tmp = -x;
} else if (z <= -2.45e-218) {
tmp = t_0;
} else if (z <= 7e-227) {
tmp = x / z;
} else if (z <= 7e-116) {
tmp = t_0;
} else if (z <= 4.2e-6) {
tmp = x / z;
} else {
tmp = -x;
}
return tmp;
}
def code(x, y, z): t_0 = y * (x / z) tmp = 0 if z <= -4.5e+17: tmp = -x elif z <= -2.45e-218: tmp = t_0 elif z <= 7e-227: tmp = x / z elif z <= 7e-116: tmp = t_0 elif z <= 4.2e-6: tmp = x / z else: tmp = -x return tmp
function code(x, y, z) t_0 = Float64(y * Float64(x / z)) tmp = 0.0 if (z <= -4.5e+17) tmp = Float64(-x); elseif (z <= -2.45e-218) tmp = t_0; elseif (z <= 7e-227) tmp = Float64(x / z); elseif (z <= 7e-116) tmp = t_0; elseif (z <= 4.2e-6) tmp = Float64(x / z); else tmp = Float64(-x); end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * (x / z); tmp = 0.0; if (z <= -4.5e+17) tmp = -x; elseif (z <= -2.45e-218) tmp = t_0; elseif (z <= 7e-227) tmp = x / z; elseif (z <= 7e-116) tmp = t_0; elseif (z <= 4.2e-6) tmp = x / z; else tmp = -x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.5e+17], (-x), If[LessEqual[z, -2.45e-218], t$95$0, If[LessEqual[z, 7e-227], N[(x / z), $MachinePrecision], If[LessEqual[z, 7e-116], t$95$0, If[LessEqual[z, 4.2e-6], N[(x / z), $MachinePrecision], (-x)]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \frac{x}{z}\\
\mathbf{if}\;z \leq -4.5 \cdot 10^{+17}:\\
\;\;\;\;-x\\
\mathbf{elif}\;z \leq -2.45 \cdot 10^{-218}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 7 \cdot 10^{-227}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;z \leq 7 \cdot 10^{-116}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{-6}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
\end{array}
if z < -4.5e17 or 4.1999999999999996e-6 < z Initial program 82.9%
Taylor expanded in z around inf 76.4%
neg-mul-176.4%
Simplified76.4%
if -4.5e17 < z < -2.44999999999999989e-218 or 7.0000000000000002e-227 < z < 6.99999999999999968e-116Initial program 99.9%
Taylor expanded in y around inf 63.3%
associate-/l*65.8%
div-inv67.0%
clear-num67.0%
Applied egg-rr67.0%
if -2.44999999999999989e-218 < z < 7.0000000000000002e-227 or 6.99999999999999968e-116 < z < 4.1999999999999996e-6Initial program 100.0%
Taylor expanded in z around inf 100.0%
Taylor expanded in y around 0 69.3%
+-commutative69.3%
mul-1-neg69.3%
unsub-neg69.3%
Simplified69.3%
Taylor expanded in z around 0 68.3%
Final simplification71.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -7.5e+18) (not (<= z 5.5e+113))) (- (/ (* y x) z) x) (* (+ 1.0 (- y z)) (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -7.5e+18) || !(z <= 5.5e+113)) {
tmp = ((y * x) / z) - x;
} else {
tmp = (1.0 + (y - z)) * (x / z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-7.5d+18)) .or. (.not. (z <= 5.5d+113))) then
tmp = ((y * x) / z) - x
else
tmp = (1.0d0 + (y - z)) * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -7.5e+18) || !(z <= 5.5e+113)) {
tmp = ((y * x) / z) - x;
} else {
tmp = (1.0 + (y - z)) * (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -7.5e+18) or not (z <= 5.5e+113): tmp = ((y * x) / z) - x else: tmp = (1.0 + (y - z)) * (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -7.5e+18) || !(z <= 5.5e+113)) tmp = Float64(Float64(Float64(y * x) / z) - x); else tmp = Float64(Float64(1.0 + Float64(y - z)) * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -7.5e+18) || ~((z <= 5.5e+113))) tmp = ((y * x) / z) - x; else tmp = (1.0 + (y - z)) * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -7.5e+18], N[Not[LessEqual[z, 5.5e+113]], $MachinePrecision]], N[(N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision] - x), $MachinePrecision], N[(N[(1.0 + N[(y - z), $MachinePrecision]), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{+18} \lor \neg \left(z \leq 5.5 \cdot 10^{+113}\right):\\
\;\;\;\;\frac{y \cdot x}{z} - x\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \left(y - z\right)\right) \cdot \frac{x}{z}\\
\end{array}
\end{array}
if z < -7.5e18 or 5.5000000000000001e113 < z Initial program 81.6%
Taylor expanded in z around inf 95.9%
Taylor expanded in y around inf 95.9%
if -7.5e18 < z < 5.5000000000000001e113Initial program 98.3%
associate-/l*89.5%
associate-/r/99.3%
Applied egg-rr99.3%
Final simplification98.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -6.6e-16) (not (<= z 5e-161))) (/ x (/ z (- y (+ z -1.0)))) (/ (+ x (* y x)) z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -6.6e-16) || !(z <= 5e-161)) {
tmp = x / (z / (y - (z + -1.0)));
} else {
tmp = (x + (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 <= (-6.6d-16)) .or. (.not. (z <= 5d-161))) then
tmp = x / (z / (y - (z + (-1.0d0))))
else
tmp = (x + (y * x)) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -6.6e-16) || !(z <= 5e-161)) {
tmp = x / (z / (y - (z + -1.0)));
} else {
tmp = (x + (y * x)) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -6.6e-16) or not (z <= 5e-161): tmp = x / (z / (y - (z + -1.0))) else: tmp = (x + (y * x)) / z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -6.6e-16) || !(z <= 5e-161)) tmp = Float64(x / Float64(z / Float64(y - Float64(z + -1.0)))); else tmp = Float64(Float64(x + Float64(y * x)) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -6.6e-16) || ~((z <= 5e-161))) tmp = x / (z / (y - (z + -1.0))); else tmp = (x + (y * x)) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -6.6e-16], N[Not[LessEqual[z, 5e-161]], $MachinePrecision]], N[(x / N[(z / N[(y - N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(y * x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.6 \cdot 10^{-16} \lor \neg \left(z \leq 5 \cdot 10^{-161}\right):\\
\;\;\;\;\frac{x}{\frac{z}{y - \left(z + -1\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + y \cdot x}{z}\\
\end{array}
\end{array}
if z < -6.59999999999999976e-16 or 4.9999999999999999e-161 < z Initial program 86.8%
associate-/l*99.9%
associate-/r/76.2%
Applied egg-rr76.2%
associate-*l/86.8%
associate-/l*99.9%
associate-+l-99.9%
sub-neg99.9%
metadata-eval99.9%
Applied egg-rr99.9%
if -6.59999999999999976e-16 < z < 4.9999999999999999e-161Initial program 99.9%
distribute-lft-in100.0%
fma-def100.0%
*-rgt-identity100.0%
Simplified100.0%
Taylor expanded in z around 0 100.0%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (<= z -7.5e+142) (- x) (if (<= z 4.6e+132) (* (+ 1.0 (- y z)) (/ x z)) (- (/ x z) x))))
double code(double x, double y, double z) {
double tmp;
if (z <= -7.5e+142) {
tmp = -x;
} else if (z <= 4.6e+132) {
tmp = (1.0 + (y - z)) * (x / z);
} else {
tmp = (x / 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 <= (-7.5d+142)) then
tmp = -x
else if (z <= 4.6d+132) then
tmp = (1.0d0 + (y - z)) * (x / z)
else
tmp = (x / z) - x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -7.5e+142) {
tmp = -x;
} else if (z <= 4.6e+132) {
tmp = (1.0 + (y - z)) * (x / z);
} else {
tmp = (x / z) - x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -7.5e+142: tmp = -x elif z <= 4.6e+132: tmp = (1.0 + (y - z)) * (x / z) else: tmp = (x / z) - x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -7.5e+142) tmp = Float64(-x); elseif (z <= 4.6e+132) tmp = Float64(Float64(1.0 + Float64(y - z)) * Float64(x / z)); else tmp = Float64(Float64(x / z) - x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -7.5e+142) tmp = -x; elseif (z <= 4.6e+132) tmp = (1.0 + (y - z)) * (x / z); else tmp = (x / z) - x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -7.5e+142], (-x), If[LessEqual[z, 4.6e+132], N[(N[(1.0 + N[(y - z), $MachinePrecision]), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{+142}:\\
\;\;\;\;-x\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{+132}:\\
\;\;\;\;\left(1 + \left(y - z\right)\right) \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} - x\\
\end{array}
\end{array}
if z < -7.5000000000000002e142Initial program 70.1%
Taylor expanded in z around inf 90.3%
neg-mul-190.3%
Simplified90.3%
if -7.5000000000000002e142 < z < 4.6000000000000003e132Initial program 98.0%
associate-/l*90.9%
associate-/r/97.0%
Applied egg-rr97.0%
if 4.6000000000000003e132 < z Initial program 84.1%
Taylor expanded in z around inf 96.9%
Taylor expanded in y around 0 88.0%
+-commutative88.0%
mul-1-neg88.0%
unsub-neg88.0%
Simplified88.0%
Final simplification95.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -160.0) (not (<= y 9.8e+55))) (/ (+ x (* y x)) z) (- (/ x z) x)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -160.0) || !(y <= 9.8e+55)) {
tmp = (x + (y * x)) / z;
} else {
tmp = (x / 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 ((y <= (-160.0d0)) .or. (.not. (y <= 9.8d+55))) then
tmp = (x + (y * x)) / z
else
tmp = (x / z) - x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -160.0) || !(y <= 9.8e+55)) {
tmp = (x + (y * x)) / z;
} else {
tmp = (x / z) - x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -160.0) or not (y <= 9.8e+55): tmp = (x + (y * x)) / z else: tmp = (x / z) - x return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -160.0) || !(y <= 9.8e+55)) tmp = Float64(Float64(x + Float64(y * x)) / z); else tmp = Float64(Float64(x / z) - x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -160.0) || ~((y <= 9.8e+55))) tmp = (x + (y * x)) / z; else tmp = (x / z) - x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -160.0], N[Not[LessEqual[y, 9.8e+55]], $MachinePrecision]], N[(N[(x + N[(y * x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -160 \lor \neg \left(y \leq 9.8 \cdot 10^{+55}\right):\\
\;\;\;\;\frac{x + y \cdot x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} - x\\
\end{array}
\end{array}
if y < -160 or 9.80000000000000029e55 < y Initial program 94.2%
distribute-lft-in94.2%
fma-def94.2%
*-rgt-identity94.2%
Simplified94.2%
Taylor expanded in z around 0 80.9%
if -160 < y < 9.80000000000000029e55Initial program 90.6%
Taylor expanded in z around inf 98.6%
Taylor expanded in y around 0 97.0%
+-commutative97.0%
mul-1-neg97.0%
unsub-neg97.0%
Simplified97.0%
Final simplification89.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -14000.0) (not (<= y 1.7e+53))) (* y (/ x z)) (- (/ x z) x)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -14000.0) || !(y <= 1.7e+53)) {
tmp = y * (x / z);
} else {
tmp = (x / 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 ((y <= (-14000.0d0)) .or. (.not. (y <= 1.7d+53))) then
tmp = y * (x / z)
else
tmp = (x / z) - x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -14000.0) || !(y <= 1.7e+53)) {
tmp = y * (x / z);
} else {
tmp = (x / z) - x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -14000.0) or not (y <= 1.7e+53): tmp = y * (x / z) else: tmp = (x / z) - x return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -14000.0) || !(y <= 1.7e+53)) tmp = Float64(y * Float64(x / z)); else tmp = Float64(Float64(x / z) - x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -14000.0) || ~((y <= 1.7e+53))) tmp = y * (x / z); else tmp = (x / z) - x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -14000.0], N[Not[LessEqual[y, 1.7e+53]], $MachinePrecision]], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -14000 \lor \neg \left(y \leq 1.7 \cdot 10^{+53}\right):\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} - x\\
\end{array}
\end{array}
if y < -14000 or 1.69999999999999999e53 < y Initial program 94.0%
Taylor expanded in y around inf 81.5%
associate-/l*78.1%
div-inv78.1%
clear-num78.4%
Applied egg-rr78.4%
if -14000 < y < 1.69999999999999999e53Initial program 90.9%
Taylor expanded in z around inf 98.7%
Taylor expanded in y around 0 95.7%
+-commutative95.7%
mul-1-neg95.7%
unsub-neg95.7%
Simplified95.7%
Final simplification88.2%
(FPCore (x y z) :precision binary64 (if (or (<= y -11000.0) (not (<= y 1.5e+54))) (/ (* y x) z) (- (/ x z) x)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -11000.0) || !(y <= 1.5e+54)) {
tmp = (y * x) / z;
} else {
tmp = (x / 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 ((y <= (-11000.0d0)) .or. (.not. (y <= 1.5d+54))) then
tmp = (y * x) / z
else
tmp = (x / z) - x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -11000.0) || !(y <= 1.5e+54)) {
tmp = (y * x) / z;
} else {
tmp = (x / z) - x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -11000.0) or not (y <= 1.5e+54): tmp = (y * x) / z else: tmp = (x / z) - x return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -11000.0) || !(y <= 1.5e+54)) tmp = Float64(Float64(y * x) / z); else tmp = Float64(Float64(x / z) - x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -11000.0) || ~((y <= 1.5e+54))) tmp = (y * x) / z; else tmp = (x / z) - x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -11000.0], N[Not[LessEqual[y, 1.5e+54]], $MachinePrecision]], N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -11000 \lor \neg \left(y \leq 1.5 \cdot 10^{+54}\right):\\
\;\;\;\;\frac{y \cdot x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} - x\\
\end{array}
\end{array}
if y < -11000 or 1.4999999999999999e54 < y Initial program 94.0%
Taylor expanded in y around inf 81.5%
if -11000 < y < 1.4999999999999999e54Initial program 90.9%
Taylor expanded in z around inf 98.7%
Taylor expanded in y around 0 95.7%
+-commutative95.7%
mul-1-neg95.7%
unsub-neg95.7%
Simplified95.7%
Final simplification89.5%
(FPCore (x y z) :precision binary64 (- (/ (* (+ 1.0 y) x) z) x))
double code(double x, double y, double z) {
return (((1.0 + y) * x) / 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 = (((1.0d0 + y) * x) / z) - x
end function
public static double code(double x, double y, double z) {
return (((1.0 + y) * x) / z) - x;
}
def code(x, y, z): return (((1.0 + y) * x) / z) - x
function code(x, y, z) return Float64(Float64(Float64(Float64(1.0 + y) * x) / z) - x) end
function tmp = code(x, y, z) tmp = (((1.0 + y) * x) / z) - x; end
code[x_, y_, z_] := N[(N[(N[(N[(1.0 + y), $MachinePrecision] * x), $MachinePrecision] / z), $MachinePrecision] - x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 + y\right) \cdot x}{z} - x
\end{array}
Initial program 92.2%
Taylor expanded in z around inf 97.7%
Final simplification97.7%
(FPCore (x y z) :precision binary64 (if (<= z -32000000000.0) (- x) (if (<= z 4.2e-6) (/ x z) (- x))))
double code(double x, double y, double z) {
double tmp;
if (z <= -32000000000.0) {
tmp = -x;
} else if (z <= 4.2e-6) {
tmp = x / 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 <= (-32000000000.0d0)) then
tmp = -x
else if (z <= 4.2d-6) then
tmp = x / z
else
tmp = -x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -32000000000.0) {
tmp = -x;
} else if (z <= 4.2e-6) {
tmp = x / z;
} else {
tmp = -x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -32000000000.0: tmp = -x elif z <= 4.2e-6: tmp = x / z else: tmp = -x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -32000000000.0) tmp = Float64(-x); elseif (z <= 4.2e-6) tmp = Float64(x / z); else tmp = Float64(-x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -32000000000.0) tmp = -x; elseif (z <= 4.2e-6) tmp = x / z; else tmp = -x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -32000000000.0], (-x), If[LessEqual[z, 4.2e-6], N[(x / z), $MachinePrecision], (-x)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -32000000000:\\
\;\;\;\;-x\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{-6}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
\end{array}
if z < -3.2e10 or 4.1999999999999996e-6 < z Initial program 83.2%
Taylor expanded in z around inf 75.9%
neg-mul-175.9%
Simplified75.9%
if -3.2e10 < z < 4.1999999999999996e-6Initial program 99.9%
Taylor expanded in z around inf 99.9%
Taylor expanded in y around 0 57.5%
+-commutative57.5%
mul-1-neg57.5%
unsub-neg57.5%
Simplified57.5%
Taylor expanded in z around 0 56.5%
Final simplification65.4%
(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 Float64(-x) end
function tmp = code(x, y, z) tmp = -x; end
code[x_, y_, z_] := (-x)
\begin{array}{l}
\\
-x
\end{array}
Initial program 92.2%
Taylor expanded in z around inf 36.7%
neg-mul-136.7%
Simplified36.7%
Final simplification36.7%
(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 92.2%
Taylor expanded in z around inf 31.5%
mul-1-neg31.5%
distribute-rgt-neg-in31.5%
Simplified31.5%
expm1-log1p-u26.5%
expm1-udef7.9%
div-inv7.9%
associate-*l*12.6%
add-sqr-sqrt11.1%
sqrt-unprod11.7%
sqr-neg11.7%
sqrt-unprod4.1%
add-sqr-sqrt5.0%
div-inv5.0%
Applied egg-rr5.0%
expm1-def5.0%
expm1-log1p8.9%
associate-*r/2.8%
associate-*l/2.9%
*-inverses2.9%
*-lft-identity2.9%
Simplified2.9%
Final simplification2.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (* (+ 1.0 y) (/ x z)) x)))
(if (< x -2.71483106713436e-162)
t_0
(if (< x 3.874108816439546e-197)
(* (* x (+ (- y z) 1.0)) (/ 1.0 z))
t_0))))
double code(double x, double y, double z) {
double t_0 = ((1.0 + y) * (x / z)) - x;
double tmp;
if (x < -2.71483106713436e-162) {
tmp = t_0;
} else if (x < 3.874108816439546e-197) {
tmp = (x * ((y - z) + 1.0)) * (1.0 / z);
} 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) :: tmp
t_0 = ((1.0d0 + y) * (x / z)) - x
if (x < (-2.71483106713436d-162)) then
tmp = t_0
else if (x < 3.874108816439546d-197) then
tmp = (x * ((y - z) + 1.0d0)) * (1.0d0 / z)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = ((1.0 + y) * (x / z)) - x;
double tmp;
if (x < -2.71483106713436e-162) {
tmp = t_0;
} else if (x < 3.874108816439546e-197) {
tmp = (x * ((y - z) + 1.0)) * (1.0 / z);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = ((1.0 + y) * (x / z)) - x tmp = 0 if x < -2.71483106713436e-162: tmp = t_0 elif x < 3.874108816439546e-197: tmp = (x * ((y - z) + 1.0)) * (1.0 / z) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(1.0 + y) * Float64(x / z)) - x) tmp = 0.0 if (x < -2.71483106713436e-162) tmp = t_0; elseif (x < 3.874108816439546e-197) tmp = Float64(Float64(x * Float64(Float64(y - z) + 1.0)) * Float64(1.0 / z)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = ((1.0 + y) * (x / z)) - x; tmp = 0.0; if (x < -2.71483106713436e-162) tmp = t_0; elseif (x < 3.874108816439546e-197) tmp = (x * ((y - z) + 1.0)) * (1.0 / z); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(1.0 + y), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]}, If[Less[x, -2.71483106713436e-162], t$95$0, If[Less[x, 3.874108816439546e-197], N[(N[(x * N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * N[(1.0 / z), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 + y\right) \cdot \frac{x}{z} - x\\
\mathbf{if}\;x < -2.71483106713436 \cdot 10^{-162}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x < 3.874108816439546 \cdot 10^{-197}:\\
\;\;\;\;\left(x \cdot \left(\left(y - z\right) + 1\right)\right) \cdot \frac{1}{z}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
herbie shell --seed 2023279
(FPCore (x y z)
:name "Diagrams.TwoD.Segment.Bernstein:evaluateBernstein from diagrams-lib-1.3.0.3"
:precision binary64
:herbie-target
(if (< x -2.71483106713436e-162) (- (* (+ 1.0 y) (/ x z)) x) (if (< x 3.874108816439546e-197) (* (* x (+ (- y z) 1.0)) (/ 1.0 z)) (- (* (+ 1.0 y) (/ x z)) x)))
(/ (* x (+ (- y z) 1.0)) z))