
(FPCore (x y z) :precision binary64 (/ (* x (- y z)) y))
double code(double x, double y, double z) {
return (x * (y - z)) / y;
}
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)) / y
end function
public static double code(double x, double y, double z) {
return (x * (y - z)) / y;
}
def code(x, y, z): return (x * (y - z)) / y
function code(x, y, z) return Float64(Float64(x * Float64(y - z)) / y) end
function tmp = code(x, y, z) tmp = (x * (y - z)) / y; end
code[x_, y_, z_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(y - z\right)}{y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (* x (- y z)) y))
double code(double x, double y, double z) {
return (x * (y - z)) / y;
}
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)) / y
end function
public static double code(double x, double y, double z) {
return (x * (y - z)) / y;
}
def code(x, y, z): return (x * (y - z)) / y
function code(x, y, z) return Float64(Float64(x * Float64(y - z)) / y) end
function tmp = code(x, y, z) tmp = (x * (y - z)) / y; end
code[x_, y_, z_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(y - z\right)}{y}
\end{array}
(FPCore (x y z) :precision binary64 (if (or (<= y -2.7e-115) (not (<= y 7.4e-177))) (- x (/ x (/ y z))) (- x (* z (/ x y)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.7e-115) || !(y <= 7.4e-177)) {
tmp = x - (x / (y / z));
} else {
tmp = x - (z * (x / 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 <= (-2.7d-115)) .or. (.not. (y <= 7.4d-177))) then
tmp = x - (x / (y / z))
else
tmp = x - (z * (x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -2.7e-115) || !(y <= 7.4e-177)) {
tmp = x - (x / (y / z));
} else {
tmp = x - (z * (x / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.7e-115) or not (y <= 7.4e-177): tmp = x - (x / (y / z)) else: tmp = x - (z * (x / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.7e-115) || !(y <= 7.4e-177)) tmp = Float64(x - Float64(x / Float64(y / z))); else tmp = Float64(x - Float64(z * Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -2.7e-115) || ~((y <= 7.4e-177))) tmp = x - (x / (y / z)); else tmp = x - (z * (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.7e-115], N[Not[LessEqual[y, 7.4e-177]], $MachinePrecision]], N[(x - N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.7 \cdot 10^{-115} \lor \neg \left(y \leq 7.4 \cdot 10^{-177}\right):\\
\;\;\;\;x - \frac{x}{\frac{y}{z}}\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot \frac{x}{y}\\
\end{array}
\end{array}
if y < -2.7e-115 or 7.39999999999999986e-177 < y Initial program 80.7%
associate-*l/80.6%
distribute-rgt-out--79.6%
associate-*r/72.9%
associate-*l/91.5%
*-inverses91.5%
*-lft-identity91.5%
Simplified91.5%
Taylor expanded in z around 0 93.1%
*-commutative93.1%
associate-/l*99.4%
Simplified99.4%
if -2.7e-115 < y < 7.39999999999999986e-177Initial program 88.9%
associate-*l/98.1%
distribute-rgt-out--88.3%
associate-*r/90.9%
associate-*l/98.2%
*-inverses98.2%
*-lft-identity98.2%
Simplified98.2%
Final simplification99.2%
(FPCore (x y z)
:precision binary64
(if (or (<= z -1.15e+61)
(and (not (<= z 3800000000000.0))
(or (<= z 3.5e+70) (not (<= z 7.6e+117)))))
(* x (/ (- z) y))
x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.15e+61) || (!(z <= 3800000000000.0) && ((z <= 3.5e+70) || !(z <= 7.6e+117)))) {
tmp = x * (-z / y);
} 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.15d+61)) .or. (.not. (z <= 3800000000000.0d0)) .and. (z <= 3.5d+70) .or. (.not. (z <= 7.6d+117))) then
tmp = x * (-z / y)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.15e+61) || (!(z <= 3800000000000.0) && ((z <= 3.5e+70) || !(z <= 7.6e+117)))) {
tmp = x * (-z / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.15e+61) or (not (z <= 3800000000000.0) and ((z <= 3.5e+70) or not (z <= 7.6e+117))): tmp = x * (-z / y) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.15e+61) || (!(z <= 3800000000000.0) && ((z <= 3.5e+70) || !(z <= 7.6e+117)))) tmp = Float64(x * Float64(Float64(-z) / y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.15e+61) || (~((z <= 3800000000000.0)) && ((z <= 3.5e+70) || ~((z <= 7.6e+117))))) tmp = x * (-z / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.15e+61], And[N[Not[LessEqual[z, 3800000000000.0]], $MachinePrecision], Or[LessEqual[z, 3.5e+70], N[Not[LessEqual[z, 7.6e+117]], $MachinePrecision]]]], N[(x * N[((-z) / y), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{+61} \lor \neg \left(z \leq 3800000000000\right) \land \left(z \leq 3.5 \cdot 10^{+70} \lor \neg \left(z \leq 7.6 \cdot 10^{+117}\right)\right):\\
\;\;\;\;x \cdot \frac{-z}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.15e61 or 3.8e12 < z < 3.50000000000000002e70 or 7.6000000000000003e117 < z Initial program 88.9%
associate-*l/83.6%
distribute-rgt-out--80.1%
associate-*r/78.4%
associate-*l/89.4%
*-inverses89.4%
*-lft-identity89.4%
Simplified89.4%
Taylor expanded in z around inf 76.6%
mul-1-neg76.6%
associate-*l/71.5%
distribute-rgt-neg-in71.5%
Simplified71.5%
if -1.15e61 < z < 3.8e12 or 3.50000000000000002e70 < z < 7.6000000000000003e117Initial program 77.1%
associate-*l/84.5%
distribute-rgt-out--82.4%
associate-*r/75.0%
associate-*l/95.4%
*-inverses95.4%
*-lft-identity95.4%
Simplified95.4%
Taylor expanded in z around 0 77.1%
Final simplification74.6%
(FPCore (x y z)
:precision binary64
(if (<= z -2.9e+60)
(* x (/ (- z) y))
(if (<= z 30000000000.0)
x
(if (or (<= z 2.2e+71) (not (<= z 8e+117))) (/ x (/ (- y) z)) x))))
double code(double x, double y, double z) {
double tmp;
if (z <= -2.9e+60) {
tmp = x * (-z / y);
} else if (z <= 30000000000.0) {
tmp = x;
} else if ((z <= 2.2e+71) || !(z <= 8e+117)) {
tmp = x / (-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 <= (-2.9d+60)) then
tmp = x * (-z / y)
else if (z <= 30000000000.0d0) then
tmp = x
else if ((z <= 2.2d+71) .or. (.not. (z <= 8d+117))) then
tmp = x / (-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 <= -2.9e+60) {
tmp = x * (-z / y);
} else if (z <= 30000000000.0) {
tmp = x;
} else if ((z <= 2.2e+71) || !(z <= 8e+117)) {
tmp = x / (-y / z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2.9e+60: tmp = x * (-z / y) elif z <= 30000000000.0: tmp = x elif (z <= 2.2e+71) or not (z <= 8e+117): tmp = x / (-y / z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2.9e+60) tmp = Float64(x * Float64(Float64(-z) / y)); elseif (z <= 30000000000.0) tmp = x; elseif ((z <= 2.2e+71) || !(z <= 8e+117)) tmp = Float64(x / Float64(Float64(-y) / z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -2.9e+60) tmp = x * (-z / y); elseif (z <= 30000000000.0) tmp = x; elseif ((z <= 2.2e+71) || ~((z <= 8e+117))) tmp = x / (-y / z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2.9e+60], N[(x * N[((-z) / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 30000000000.0], x, If[Or[LessEqual[z, 2.2e+71], N[Not[LessEqual[z, 8e+117]], $MachinePrecision]], N[(x / N[((-y) / z), $MachinePrecision]), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.9 \cdot 10^{+60}:\\
\;\;\;\;x \cdot \frac{-z}{y}\\
\mathbf{elif}\;z \leq 30000000000:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{+71} \lor \neg \left(z \leq 8 \cdot 10^{+117}\right):\\
\;\;\;\;\frac{x}{\frac{-y}{z}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.9e60Initial program 88.9%
associate-*l/77.7%
distribute-rgt-out--73.1%
associate-*r/75.4%
associate-*l/82.2%
*-inverses82.2%
*-lft-identity82.2%
Simplified82.2%
Taylor expanded in z around inf 75.4%
mul-1-neg75.4%
associate-*l/73.2%
distribute-rgt-neg-in73.2%
Simplified73.2%
if -2.9e60 < z < 3e10 or 2.19999999999999995e71 < z < 8.0000000000000004e117Initial program 77.1%
associate-*l/84.5%
distribute-rgt-out--82.4%
associate-*r/75.0%
associate-*l/95.4%
*-inverses95.4%
*-lft-identity95.4%
Simplified95.4%
Taylor expanded in z around 0 77.1%
if 3e10 < z < 2.19999999999999995e71 or 8.0000000000000004e117 < z Initial program 89.0%
associate-*l/87.3%
distribute-rgt-out--84.4%
associate-*r/80.2%
associate-*l/94.0%
*-inverses94.0%
*-lft-identity94.0%
Simplified94.0%
Taylor expanded in z around inf 77.3%
mul-1-neg77.3%
associate-*l/70.5%
distribute-rgt-neg-in70.5%
Simplified70.5%
add-sqr-sqrt42.2%
sqrt-unprod34.2%
sqr-neg34.2%
sqrt-unprod0.4%
clear-num0.4%
add-sqr-sqrt1.9%
associate-/r/1.9%
frac-2neg1.9%
clear-num1.9%
add-sqr-sqrt1.5%
sqrt-unprod26.8%
sqr-neg26.8%
sqrt-unprod29.6%
add-sqr-sqrt72.2%
distribute-neg-frac72.2%
Applied egg-rr72.2%
Final simplification75.1%
(FPCore (x y z)
:precision binary64
(if (<= z -3e+60)
(* x (/ (- z) y))
(if (<= z 12500000000.0)
x
(if (<= z 2.9e+84)
(/ (- z) (/ y x))
(if (<= z 7.6e+117) (/ y (/ y x)) (/ x (/ (- y) z)))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -3e+60) {
tmp = x * (-z / y);
} else if (z <= 12500000000.0) {
tmp = x;
} else if (z <= 2.9e+84) {
tmp = -z / (y / x);
} else if (z <= 7.6e+117) {
tmp = y / (y / x);
} 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) :: tmp
if (z <= (-3d+60)) then
tmp = x * (-z / y)
else if (z <= 12500000000.0d0) then
tmp = x
else if (z <= 2.9d+84) then
tmp = -z / (y / x)
else if (z <= 7.6d+117) then
tmp = y / (y / x)
else
tmp = x / (-y / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -3e+60) {
tmp = x * (-z / y);
} else if (z <= 12500000000.0) {
tmp = x;
} else if (z <= 2.9e+84) {
tmp = -z / (y / x);
} else if (z <= 7.6e+117) {
tmp = y / (y / x);
} else {
tmp = x / (-y / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -3e+60: tmp = x * (-z / y) elif z <= 12500000000.0: tmp = x elif z <= 2.9e+84: tmp = -z / (y / x) elif z <= 7.6e+117: tmp = y / (y / x) else: tmp = x / (-y / z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -3e+60) tmp = Float64(x * Float64(Float64(-z) / y)); elseif (z <= 12500000000.0) tmp = x; elseif (z <= 2.9e+84) tmp = Float64(Float64(-z) / Float64(y / x)); elseif (z <= 7.6e+117) tmp = Float64(y / Float64(y / x)); else tmp = Float64(x / Float64(Float64(-y) / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -3e+60) tmp = x * (-z / y); elseif (z <= 12500000000.0) tmp = x; elseif (z <= 2.9e+84) tmp = -z / (y / x); elseif (z <= 7.6e+117) tmp = y / (y / x); else tmp = x / (-y / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -3e+60], N[(x * N[((-z) / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 12500000000.0], x, If[LessEqual[z, 2.9e+84], N[((-z) / N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.6e+117], N[(y / N[(y / x), $MachinePrecision]), $MachinePrecision], N[(x / N[((-y) / z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3 \cdot 10^{+60}:\\
\;\;\;\;x \cdot \frac{-z}{y}\\
\mathbf{elif}\;z \leq 12500000000:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{+84}:\\
\;\;\;\;\frac{-z}{\frac{y}{x}}\\
\mathbf{elif}\;z \leq 7.6 \cdot 10^{+117}:\\
\;\;\;\;\frac{y}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{-y}{z}}\\
\end{array}
\end{array}
if z < -2.9999999999999998e60Initial program 88.9%
associate-*l/77.7%
distribute-rgt-out--73.1%
associate-*r/75.4%
associate-*l/82.2%
*-inverses82.2%
*-lft-identity82.2%
Simplified82.2%
Taylor expanded in z around inf 75.4%
mul-1-neg75.4%
associate-*l/73.2%
distribute-rgt-neg-in73.2%
Simplified73.2%
if -2.9999999999999998e60 < z < 1.25e10Initial program 78.0%
associate-*l/83.7%
distribute-rgt-out--81.2%
associate-*r/75.5%
associate-*l/94.7%
*-inverses94.7%
*-lft-identity94.7%
Simplified94.7%
Taylor expanded in z around 0 79.6%
if 1.25e10 < z < 2.89999999999999989e84Initial program 82.3%
associate-*l/90.9%
distribute-rgt-out--87.8%
associate-*r/82.2%
associate-*l/99.7%
*-inverses99.7%
*-lft-identity99.7%
Simplified99.7%
Taylor expanded in z around inf 65.4%
mul-1-neg65.4%
associate-*l/50.7%
distribute-rgt-neg-in50.7%
Simplified50.7%
distribute-rgt-neg-out50.7%
associate-/r/65.5%
distribute-neg-frac65.5%
Applied egg-rr65.5%
if 2.89999999999999989e84 < z < 7.6000000000000003e117Initial program 55.0%
Taylor expanded in y around inf 27.8%
associate-/l*81.0%
div-inv80.7%
clear-num80.9%
Applied egg-rr80.9%
clear-num80.7%
un-div-inv81.0%
Applied egg-rr81.0%
if 7.6000000000000003e117 < z Initial program 93.6%
associate-*l/83.2%
distribute-rgt-out--81.0%
associate-*r/80.6%
associate-*l/91.1%
*-inverses91.1%
*-lft-identity91.1%
Simplified91.1%
Taylor expanded in z around inf 81.8%
mul-1-neg81.8%
associate-*l/77.7%
distribute-rgt-neg-in77.7%
Simplified77.7%
add-sqr-sqrt46.9%
sqrt-unprod38.2%
sqr-neg38.2%
sqrt-unprod0.3%
clear-num0.3%
add-sqr-sqrt1.8%
associate-/r/1.8%
frac-2neg1.8%
clear-num1.8%
add-sqr-sqrt1.5%
sqrt-unprod28.4%
sqr-neg28.4%
sqrt-unprod30.6%
add-sqr-sqrt77.8%
distribute-neg-frac77.8%
Applied egg-rr77.8%
Final simplification76.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (* x (- z)) y)))
(if (<= z -1.2e+61)
t_0
(if (<= z 2.2e+16)
x
(if (<= z 4.8e+84)
(/ (- z) (/ y x))
(if (<= z 7.8e+117) (/ y (/ y x)) t_0))))))
double code(double x, double y, double z) {
double t_0 = (x * -z) / y;
double tmp;
if (z <= -1.2e+61) {
tmp = t_0;
} else if (z <= 2.2e+16) {
tmp = x;
} else if (z <= 4.8e+84) {
tmp = -z / (y / x);
} else if (z <= 7.8e+117) {
tmp = y / (y / x);
} 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 = (x * -z) / y
if (z <= (-1.2d+61)) then
tmp = t_0
else if (z <= 2.2d+16) then
tmp = x
else if (z <= 4.8d+84) then
tmp = -z / (y / x)
else if (z <= 7.8d+117) then
tmp = y / (y / x)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (x * -z) / y;
double tmp;
if (z <= -1.2e+61) {
tmp = t_0;
} else if (z <= 2.2e+16) {
tmp = x;
} else if (z <= 4.8e+84) {
tmp = -z / (y / x);
} else if (z <= 7.8e+117) {
tmp = y / (y / x);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (x * -z) / y tmp = 0 if z <= -1.2e+61: tmp = t_0 elif z <= 2.2e+16: tmp = x elif z <= 4.8e+84: tmp = -z / (y / x) elif z <= 7.8e+117: tmp = y / (y / x) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(x * Float64(-z)) / y) tmp = 0.0 if (z <= -1.2e+61) tmp = t_0; elseif (z <= 2.2e+16) tmp = x; elseif (z <= 4.8e+84) tmp = Float64(Float64(-z) / Float64(y / x)); elseif (z <= 7.8e+117) tmp = Float64(y / Float64(y / x)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x * -z) / y; tmp = 0.0; if (z <= -1.2e+61) tmp = t_0; elseif (z <= 2.2e+16) tmp = x; elseif (z <= 4.8e+84) tmp = -z / (y / x); elseif (z <= 7.8e+117) tmp = y / (y / x); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x * (-z)), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[z, -1.2e+61], t$95$0, If[LessEqual[z, 2.2e+16], x, If[LessEqual[z, 4.8e+84], N[((-z) / N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.8e+117], N[(y / N[(y / x), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x \cdot \left(-z\right)}{y}\\
\mathbf{if}\;z \leq -1.2 \cdot 10^{+61}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{+16}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{+84}:\\
\;\;\;\;\frac{-z}{\frac{y}{x}}\\
\mathbf{elif}\;z \leq 7.8 \cdot 10^{+117}:\\
\;\;\;\;\frac{y}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -1.1999999999999999e61 or 7.79999999999999981e117 < z Initial program 91.3%
associate-*l/80.6%
distribute-rgt-out--77.2%
associate-*r/78.1%
associate-*l/86.8%
*-inverses86.8%
*-lft-identity86.8%
Simplified86.8%
Taylor expanded in z around inf 78.7%
associate-*r/78.7%
neg-mul-178.7%
distribute-rgt-neg-in78.7%
Simplified78.7%
if -1.1999999999999999e61 < z < 2.2e16Initial program 78.0%
associate-*l/83.7%
distribute-rgt-out--81.2%
associate-*r/75.5%
associate-*l/94.7%
*-inverses94.7%
*-lft-identity94.7%
Simplified94.7%
Taylor expanded in z around 0 79.6%
if 2.2e16 < z < 4.7999999999999999e84Initial program 82.3%
associate-*l/90.9%
distribute-rgt-out--87.8%
associate-*r/82.2%
associate-*l/99.7%
*-inverses99.7%
*-lft-identity99.7%
Simplified99.7%
Taylor expanded in z around inf 65.4%
mul-1-neg65.4%
associate-*l/50.7%
distribute-rgt-neg-in50.7%
Simplified50.7%
distribute-rgt-neg-out50.7%
associate-/r/65.5%
distribute-neg-frac65.5%
Applied egg-rr65.5%
if 4.7999999999999999e84 < z < 7.79999999999999981e117Initial program 55.0%
Taylor expanded in y around inf 27.8%
associate-/l*81.0%
div-inv80.7%
clear-num80.9%
Applied egg-rr80.9%
clear-num80.7%
un-div-inv81.0%
Applied egg-rr81.0%
Final simplification77.6%
(FPCore (x y z) :precision binary64 (if (<= z -5.8e+212) (/ (* x (- z)) y) (- x (* z (/ x y)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -5.8e+212) {
tmp = (x * -z) / y;
} else {
tmp = x - (z * (x / 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 (z <= (-5.8d+212)) then
tmp = (x * -z) / y
else
tmp = x - (z * (x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -5.8e+212) {
tmp = (x * -z) / y;
} else {
tmp = x - (z * (x / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -5.8e+212: tmp = (x * -z) / y else: tmp = x - (z * (x / y)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -5.8e+212) tmp = Float64(Float64(x * Float64(-z)) / y); else tmp = Float64(x - Float64(z * Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -5.8e+212) tmp = (x * -z) / y; else tmp = x - (z * (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -5.8e+212], N[(N[(x * (-z)), $MachinePrecision] / y), $MachinePrecision], N[(x - N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+212}:\\
\;\;\;\;\frac{x \cdot \left(-z\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot \frac{x}{y}\\
\end{array}
\end{array}
if z < -5.7999999999999997e212Initial program 94.9%
associate-*l/64.5%
distribute-rgt-out--59.3%
associate-*r/64.8%
associate-*l/64.8%
*-inverses64.8%
*-lft-identity64.8%
Simplified64.8%
Taylor expanded in z around inf 94.1%
associate-*r/94.1%
neg-mul-194.1%
distribute-rgt-neg-in94.1%
Simplified94.1%
if -5.7999999999999997e212 < z Initial program 81.3%
associate-*l/85.7%
distribute-rgt-out--83.1%
associate-*r/77.4%
associate-*l/95.0%
*-inverses95.0%
*-lft-identity95.0%
Simplified95.0%
Final simplification95.0%
(FPCore (x y z) :precision binary64 (if (<= x 2e-8) x (* y (/ x y))))
double code(double x, double y, double z) {
double tmp;
if (x <= 2e-8) {
tmp = x;
} else {
tmp = y * (x / 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 (x <= 2d-8) then
tmp = x
else
tmp = y * (x / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 2e-8) {
tmp = x;
} else {
tmp = y * (x / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 2e-8: tmp = x else: tmp = y * (x / y) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 2e-8) tmp = x; else tmp = Float64(y * Float64(x / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 2e-8) tmp = x; else tmp = y * (x / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 2e-8], x, N[(y * N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2 \cdot 10^{-8}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{y}\\
\end{array}
\end{array}
if x < 2e-8Initial program 86.9%
associate-*l/79.8%
distribute-rgt-out--77.1%
associate-*r/80.2%
associate-*l/91.4%
*-inverses91.4%
*-lft-identity91.4%
Simplified91.4%
Taylor expanded in z around 0 53.2%
if 2e-8 < x Initial program 68.7%
Taylor expanded in y around inf 29.1%
associate-/l*62.4%
div-inv62.3%
clear-num62.4%
Applied egg-rr62.4%
Final simplification55.5%
(FPCore (x y z) :precision binary64 (if (<= x 1e+42) x (/ y (/ y x))))
double code(double x, double y, double z) {
double tmp;
if (x <= 1e+42) {
tmp = x;
} else {
tmp = y / (y / 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 (x <= 1d+42) then
tmp = x
else
tmp = y / (y / x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 1e+42) {
tmp = x;
} else {
tmp = y / (y / x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 1e+42: tmp = x else: tmp = y / (y / x) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 1e+42) tmp = x; else tmp = Float64(y / Float64(y / x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 1e+42) tmp = x; else tmp = y / (y / x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 1e+42], x, N[(y / N[(y / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 10^{+42}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{y}{x}}\\
\end{array}
\end{array}
if x < 1.00000000000000004e42Initial program 87.3%
associate-*l/80.4%
distribute-rgt-out--77.8%
associate-*r/80.8%
associate-*l/91.6%
*-inverses91.6%
*-lft-identity91.6%
Simplified91.6%
Taylor expanded in z around 0 53.1%
if 1.00000000000000004e42 < x Initial program 65.6%
Taylor expanded in y around inf 26.8%
associate-/l*63.5%
div-inv63.4%
clear-num63.5%
Applied egg-rr63.5%
clear-num63.4%
un-div-inv63.5%
Applied egg-rr63.5%
Final simplification55.5%
(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 82.3%
associate-*l/84.1%
distribute-rgt-out--81.3%
associate-*r/76.5%
associate-*l/92.8%
*-inverses92.8%
*-lft-identity92.8%
Simplified92.8%
Taylor expanded in z around 0 53.4%
Final simplification53.4%
(FPCore (x y z) :precision binary64 (if (< z -2.060202331921739e+104) (- x (/ (* z x) y)) (if (< z 1.6939766013828526e+213) (/ x (/ y (- y z))) (* (- y z) (/ x y)))))
double code(double x, double y, double z) {
double tmp;
if (z < -2.060202331921739e+104) {
tmp = x - ((z * x) / y);
} else if (z < 1.6939766013828526e+213) {
tmp = x / (y / (y - z));
} else {
tmp = (y - z) * (x / 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 (z < (-2.060202331921739d+104)) then
tmp = x - ((z * x) / y)
else if (z < 1.6939766013828526d+213) then
tmp = x / (y / (y - z))
else
tmp = (y - z) * (x / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z < -2.060202331921739e+104) {
tmp = x - ((z * x) / y);
} else if (z < 1.6939766013828526e+213) {
tmp = x / (y / (y - z));
} else {
tmp = (y - z) * (x / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z < -2.060202331921739e+104: tmp = x - ((z * x) / y) elif z < 1.6939766013828526e+213: tmp = x / (y / (y - z)) else: tmp = (y - z) * (x / y) return tmp
function code(x, y, z) tmp = 0.0 if (z < -2.060202331921739e+104) tmp = Float64(x - Float64(Float64(z * x) / y)); elseif (z < 1.6939766013828526e+213) tmp = Float64(x / Float64(y / Float64(y - z))); else tmp = Float64(Float64(y - z) * Float64(x / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z < -2.060202331921739e+104) tmp = x - ((z * x) / y); elseif (z < 1.6939766013828526e+213) tmp = x / (y / (y - z)); else tmp = (y - z) * (x / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Less[z, -2.060202331921739e+104], N[(x - N[(N[(z * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[Less[z, 1.6939766013828526e+213], N[(x / N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z < -2.060202331921739 \cdot 10^{+104}:\\
\;\;\;\;x - \frac{z \cdot x}{y}\\
\mathbf{elif}\;z < 1.6939766013828526 \cdot 10^{+213}:\\
\;\;\;\;\frac{x}{\frac{y}{y - z}}\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{x}{y}\\
\end{array}
\end{array}
herbie shell --seed 2023228
(FPCore (x y z)
:name "Diagrams.Backend.Cairo.Internal:setTexture from diagrams-cairo-1.3.0.3"
:precision binary64
:herbie-target
(if (< z -2.060202331921739e+104) (- x (/ (* z x) y)) (if (< z 1.6939766013828526e+213) (/ x (/ y (- y z))) (* (- y z) (/ x y))))
(/ (* x (- y z)) y))