
(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 11 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 (<= z 6.2e+191) (- x (/ x (/ y z))) (/ (* x (- y z)) y)))
double code(double x, double y, double z) {
double tmp;
if (z <= 6.2e+191) {
tmp = x - (x / (y / z));
} else {
tmp = (x * (y - z)) / 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 <= 6.2d+191) then
tmp = x - (x / (y / z))
else
tmp = (x * (y - z)) / y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 6.2e+191) {
tmp = x - (x / (y / z));
} else {
tmp = (x * (y - z)) / y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 6.2e+191: tmp = x - (x / (y / z)) else: tmp = (x * (y - z)) / y return tmp
function code(x, y, z) tmp = 0.0 if (z <= 6.2e+191) tmp = Float64(x - Float64(x / Float64(y / z))); else tmp = Float64(Float64(x * Float64(y - z)) / y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 6.2e+191) tmp = x - (x / (y / z)); else tmp = (x * (y - z)) / y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 6.2e+191], N[(x - N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 6.2 \cdot 10^{+191}:\\
\;\;\;\;x - \frac{x}{\frac{y}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(y - z\right)}{y}\\
\end{array}
\end{array}
if z < 6.19999999999999997e191Initial program 85.6%
remove-double-neg85.6%
distribute-frac-neg285.6%
distribute-frac-neg85.6%
distribute-rgt-neg-in85.6%
associate-/l*98.6%
distribute-frac-neg98.6%
distribute-frac-neg298.6%
remove-double-neg98.6%
div-sub98.6%
*-inverses98.6%
Simplified98.6%
sub-neg98.6%
distribute-rgt-in98.6%
*-un-lft-identity98.6%
distribute-neg-frac298.6%
Applied egg-rr98.6%
associate-*l/95.1%
add-sqr-sqrt47.9%
sqrt-unprod63.9%
sqr-neg63.9%
sqrt-unprod24.9%
add-sqr-sqrt51.6%
associate-*r/50.8%
*-commutative50.8%
cancel-sign-sub50.8%
distribute-lft-neg-out50.8%
distribute-rgt-neg-out50.8%
associate-/r/52.4%
frac-2neg52.4%
Applied egg-rr99.0%
if 6.19999999999999997e191 < z Initial program 94.4%
Final simplification98.4%
(FPCore (x y z)
:precision binary64
(if (or (<= z -1.7e-85)
(not (or (<= z 4.8e-75) (and (not (<= z 1.2e+48)) (<= z 2.9e+110)))))
(* x (/ z (- y)))
x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.7e-85) || !((z <= 4.8e-75) || (!(z <= 1.2e+48) && (z <= 2.9e+110)))) {
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.7d-85)) .or. (.not. (z <= 4.8d-75) .or. (.not. (z <= 1.2d+48)) .and. (z <= 2.9d+110))) 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.7e-85) || !((z <= 4.8e-75) || (!(z <= 1.2e+48) && (z <= 2.9e+110)))) {
tmp = x * (z / -y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.7e-85) or not ((z <= 4.8e-75) or (not (z <= 1.2e+48) and (z <= 2.9e+110))): tmp = x * (z / -y) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.7e-85) || !((z <= 4.8e-75) || (!(z <= 1.2e+48) && (z <= 2.9e+110)))) tmp = Float64(x * Float64(z / Float64(-y))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.7e-85) || ~(((z <= 4.8e-75) || (~((z <= 1.2e+48)) && (z <= 2.9e+110))))) tmp = x * (z / -y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.7e-85], N[Not[Or[LessEqual[z, 4.8e-75], And[N[Not[LessEqual[z, 1.2e+48]], $MachinePrecision], LessEqual[z, 2.9e+110]]]], $MachinePrecision]], N[(x * N[(z / (-y)), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.7 \cdot 10^{-85} \lor \neg \left(z \leq 4.8 \cdot 10^{-75} \lor \neg \left(z \leq 1.2 \cdot 10^{+48}\right) \land z \leq 2.9 \cdot 10^{+110}\right):\\
\;\;\;\;x \cdot \frac{z}{-y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.7e-85 or 4.80000000000000039e-75 < z < 1.2000000000000001e48 or 2.9e110 < z Initial program 88.9%
remove-double-neg88.9%
distribute-frac-neg288.9%
distribute-frac-neg88.9%
distribute-rgt-neg-in88.9%
associate-/l*92.2%
distribute-frac-neg92.2%
distribute-frac-neg292.2%
remove-double-neg92.2%
div-sub92.2%
*-inverses92.2%
Simplified92.2%
Taylor expanded in z around inf 71.2%
mul-1-neg71.2%
distribute-frac-neg271.2%
Simplified71.2%
if -1.7e-85 < z < 4.80000000000000039e-75 or 1.2000000000000001e48 < z < 2.9e110Initial program 84.0%
remove-double-neg84.0%
distribute-frac-neg284.0%
distribute-frac-neg84.0%
distribute-rgt-neg-in84.0%
associate-/l*99.9%
distribute-frac-neg99.9%
distribute-frac-neg299.9%
remove-double-neg99.9%
div-sub99.9%
*-inverses99.9%
Simplified99.9%
Taylor expanded in z around 0 83.2%
Final simplification76.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (/ z (- y)))))
(if (<= z -1e-85)
t_0
(if (<= z 1.85e-73)
x
(if (<= z 1.2e+48) t_0 (if (<= z 2.9e+110) x (* z (/ x (- y)))))))))
double code(double x, double y, double z) {
double t_0 = x * (z / -y);
double tmp;
if (z <= -1e-85) {
tmp = t_0;
} else if (z <= 1.85e-73) {
tmp = x;
} else if (z <= 1.2e+48) {
tmp = t_0;
} else if (z <= 2.9e+110) {
tmp = x;
} else {
tmp = 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) :: t_0
real(8) :: tmp
t_0 = x * (z / -y)
if (z <= (-1d-85)) then
tmp = t_0
else if (z <= 1.85d-73) then
tmp = x
else if (z <= 1.2d+48) then
tmp = t_0
else if (z <= 2.9d+110) then
tmp = x
else
tmp = z * (x / -y)
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 <= -1e-85) {
tmp = t_0;
} else if (z <= 1.85e-73) {
tmp = x;
} else if (z <= 1.2e+48) {
tmp = t_0;
} else if (z <= 2.9e+110) {
tmp = x;
} else {
tmp = z * (x / -y);
}
return tmp;
}
def code(x, y, z): t_0 = x * (z / -y) tmp = 0 if z <= -1e-85: tmp = t_0 elif z <= 1.85e-73: tmp = x elif z <= 1.2e+48: tmp = t_0 elif z <= 2.9e+110: tmp = x else: tmp = z * (x / -y) return tmp
function code(x, y, z) t_0 = Float64(x * Float64(z / Float64(-y))) tmp = 0.0 if (z <= -1e-85) tmp = t_0; elseif (z <= 1.85e-73) tmp = x; elseif (z <= 1.2e+48) tmp = t_0; elseif (z <= 2.9e+110) tmp = x; else tmp = Float64(z * Float64(x / Float64(-y))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (z / -y); tmp = 0.0; if (z <= -1e-85) tmp = t_0; elseif (z <= 1.85e-73) tmp = x; elseif (z <= 1.2e+48) tmp = t_0; elseif (z <= 2.9e+110) tmp = x; else tmp = z * (x / -y); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(z / (-y)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1e-85], t$95$0, If[LessEqual[z, 1.85e-73], x, If[LessEqual[z, 1.2e+48], t$95$0, If[LessEqual[z, 2.9e+110], x, N[(z * N[(x / (-y)), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{z}{-y}\\
\mathbf{if}\;z \leq -1 \cdot 10^{-85}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.85 \cdot 10^{-73}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{+48}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{+110}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{x}{-y}\\
\end{array}
\end{array}
if z < -9.9999999999999998e-86 or 1.85e-73 < z < 1.2000000000000001e48Initial program 85.3%
remove-double-neg85.3%
distribute-frac-neg285.3%
distribute-frac-neg85.3%
distribute-rgt-neg-in85.3%
associate-/l*97.7%
distribute-frac-neg97.7%
distribute-frac-neg297.7%
remove-double-neg97.7%
div-sub97.7%
*-inverses97.7%
Simplified97.7%
Taylor expanded in z around inf 70.1%
mul-1-neg70.1%
distribute-frac-neg270.1%
Simplified70.1%
if -9.9999999999999998e-86 < z < 1.85e-73 or 1.2000000000000001e48 < z < 2.9e110Initial program 84.0%
remove-double-neg84.0%
distribute-frac-neg284.0%
distribute-frac-neg84.0%
distribute-rgt-neg-in84.0%
associate-/l*99.9%
distribute-frac-neg99.9%
distribute-frac-neg299.9%
remove-double-neg99.9%
div-sub99.9%
*-inverses99.9%
Simplified99.9%
Taylor expanded in z around 0 83.2%
if 2.9e110 < z Initial program 94.7%
remove-double-neg94.7%
distribute-frac-neg294.7%
distribute-frac-neg94.7%
distribute-rgt-neg-in94.7%
associate-/l*83.2%
distribute-frac-neg83.2%
distribute-frac-neg283.2%
remove-double-neg83.2%
div-sub83.2%
*-inverses83.2%
Simplified83.2%
*-inverses83.2%
div-sub83.2%
clear-num83.1%
un-div-inv86.1%
Applied egg-rr86.1%
Taylor expanded in y around 0 87.7%
mul-1-neg87.7%
distribute-neg-frac287.7%
neg-mul-187.7%
*-commutative87.7%
*-commutative87.7%
associate-/l*87.4%
*-commutative87.4%
neg-mul-187.4%
Simplified87.4%
Final simplification79.5%
(FPCore (x y z)
:precision binary64
(if (<= z -3.1e-85)
(/ x (/ (- y) z))
(if (<= z 3.7e-74)
x
(if (<= z 1.2e+48)
(* x (/ z (- y)))
(if (<= z 2.9e+110) x (* z (/ x (- y))))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -3.1e-85) {
tmp = x / (-y / z);
} else if (z <= 3.7e-74) {
tmp = x;
} else if (z <= 1.2e+48) {
tmp = x * (z / -y);
} else if (z <= 2.9e+110) {
tmp = x;
} else {
tmp = 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 <= (-3.1d-85)) then
tmp = x / (-y / z)
else if (z <= 3.7d-74) then
tmp = x
else if (z <= 1.2d+48) then
tmp = x * (z / -y)
else if (z <= 2.9d+110) then
tmp = x
else
tmp = z * (x / -y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -3.1e-85) {
tmp = x / (-y / z);
} else if (z <= 3.7e-74) {
tmp = x;
} else if (z <= 1.2e+48) {
tmp = x * (z / -y);
} else if (z <= 2.9e+110) {
tmp = x;
} else {
tmp = z * (x / -y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -3.1e-85: tmp = x / (-y / z) elif z <= 3.7e-74: tmp = x elif z <= 1.2e+48: tmp = x * (z / -y) elif z <= 2.9e+110: tmp = x else: tmp = z * (x / -y) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -3.1e-85) tmp = Float64(x / Float64(Float64(-y) / z)); elseif (z <= 3.7e-74) tmp = x; elseif (z <= 1.2e+48) tmp = Float64(x * Float64(z / Float64(-y))); elseif (z <= 2.9e+110) tmp = x; else tmp = Float64(z * Float64(x / Float64(-y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -3.1e-85) tmp = x / (-y / z); elseif (z <= 3.7e-74) tmp = x; elseif (z <= 1.2e+48) tmp = x * (z / -y); elseif (z <= 2.9e+110) tmp = x; else tmp = z * (x / -y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -3.1e-85], N[(x / N[((-y) / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.7e-74], x, If[LessEqual[z, 1.2e+48], N[(x * N[(z / (-y)), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.9e+110], x, N[(z * N[(x / (-y)), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.1 \cdot 10^{-85}:\\
\;\;\;\;\frac{x}{\frac{-y}{z}}\\
\mathbf{elif}\;z \leq 3.7 \cdot 10^{-74}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{+48}:\\
\;\;\;\;x \cdot \frac{z}{-y}\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{+110}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{x}{-y}\\
\end{array}
\end{array}
if z < -3.1000000000000002e-85Initial program 88.3%
remove-double-neg88.3%
distribute-frac-neg288.3%
distribute-frac-neg88.3%
distribute-rgt-neg-in88.3%
associate-/l*97.0%
distribute-frac-neg97.0%
distribute-frac-neg297.0%
remove-double-neg97.0%
div-sub97.0%
*-inverses97.0%
Simplified97.0%
*-inverses97.0%
div-sub97.0%
clear-num96.9%
un-div-inv97.1%
Applied egg-rr97.1%
Taylor expanded in y around 0 73.4%
mul-1-neg73.4%
distribute-neg-frac273.4%
Simplified73.4%
if -3.1000000000000002e-85 < z < 3.69999999999999994e-74 or 1.2000000000000001e48 < z < 2.9e110Initial program 84.0%
remove-double-neg84.0%
distribute-frac-neg284.0%
distribute-frac-neg84.0%
distribute-rgt-neg-in84.0%
associate-/l*99.9%
distribute-frac-neg99.9%
distribute-frac-neg299.9%
remove-double-neg99.9%
div-sub99.9%
*-inverses99.9%
Simplified99.9%
Taylor expanded in z around 0 83.2%
if 3.69999999999999994e-74 < z < 1.2000000000000001e48Initial program 77.2%
remove-double-neg77.2%
distribute-frac-neg277.2%
distribute-frac-neg77.2%
distribute-rgt-neg-in77.2%
associate-/l*99.8%
distribute-frac-neg99.8%
distribute-frac-neg299.8%
remove-double-neg99.8%
div-sub99.8%
*-inverses99.8%
Simplified99.8%
Taylor expanded in z around inf 61.5%
mul-1-neg61.5%
distribute-frac-neg261.5%
Simplified61.5%
if 2.9e110 < z Initial program 94.7%
remove-double-neg94.7%
distribute-frac-neg294.7%
distribute-frac-neg94.7%
distribute-rgt-neg-in94.7%
associate-/l*83.2%
distribute-frac-neg83.2%
distribute-frac-neg283.2%
remove-double-neg83.2%
div-sub83.2%
*-inverses83.2%
Simplified83.2%
*-inverses83.2%
div-sub83.2%
clear-num83.1%
un-div-inv86.1%
Applied egg-rr86.1%
Taylor expanded in y around 0 87.7%
mul-1-neg87.7%
distribute-neg-frac287.7%
neg-mul-187.7%
*-commutative87.7%
*-commutative87.7%
associate-/l*87.4%
*-commutative87.4%
neg-mul-187.4%
Simplified87.4%
Final simplification79.5%
(FPCore (x y z)
:precision binary64
(if (<= z -4.2e-85)
(/ x (/ (- y) z))
(if (<= z 5.8e-73)
x
(if (<= z 1.2e+48)
(* x (/ z (- y)))
(if (<= z 2.9e+110) x (/ (* z (- x)) y))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -4.2e-85) {
tmp = x / (-y / z);
} else if (z <= 5.8e-73) {
tmp = x;
} else if (z <= 1.2e+48) {
tmp = x * (z / -y);
} else if (z <= 2.9e+110) {
tmp = x;
} else {
tmp = (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 <= (-4.2d-85)) then
tmp = x / (-y / z)
else if (z <= 5.8d-73) then
tmp = x
else if (z <= 1.2d+48) then
tmp = x * (z / -y)
else if (z <= 2.9d+110) then
tmp = x
else
tmp = (z * -x) / y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -4.2e-85) {
tmp = x / (-y / z);
} else if (z <= 5.8e-73) {
tmp = x;
} else if (z <= 1.2e+48) {
tmp = x * (z / -y);
} else if (z <= 2.9e+110) {
tmp = x;
} else {
tmp = (z * -x) / y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -4.2e-85: tmp = x / (-y / z) elif z <= 5.8e-73: tmp = x elif z <= 1.2e+48: tmp = x * (z / -y) elif z <= 2.9e+110: tmp = x else: tmp = (z * -x) / y return tmp
function code(x, y, z) tmp = 0.0 if (z <= -4.2e-85) tmp = Float64(x / Float64(Float64(-y) / z)); elseif (z <= 5.8e-73) tmp = x; elseif (z <= 1.2e+48) tmp = Float64(x * Float64(z / Float64(-y))); elseif (z <= 2.9e+110) tmp = x; else tmp = Float64(Float64(z * Float64(-x)) / y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -4.2e-85) tmp = x / (-y / z); elseif (z <= 5.8e-73) tmp = x; elseif (z <= 1.2e+48) tmp = x * (z / -y); elseif (z <= 2.9e+110) tmp = x; else tmp = (z * -x) / y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -4.2e-85], N[(x / N[((-y) / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.8e-73], x, If[LessEqual[z, 1.2e+48], N[(x * N[(z / (-y)), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.9e+110], x, N[(N[(z * (-x)), $MachinePrecision] / y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{-85}:\\
\;\;\;\;\frac{x}{\frac{-y}{z}}\\
\mathbf{elif}\;z \leq 5.8 \cdot 10^{-73}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{+48}:\\
\;\;\;\;x \cdot \frac{z}{-y}\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{+110}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot \left(-x\right)}{y}\\
\end{array}
\end{array}
if z < -4.2e-85Initial program 88.3%
remove-double-neg88.3%
distribute-frac-neg288.3%
distribute-frac-neg88.3%
distribute-rgt-neg-in88.3%
associate-/l*97.0%
distribute-frac-neg97.0%
distribute-frac-neg297.0%
remove-double-neg97.0%
div-sub97.0%
*-inverses97.0%
Simplified97.0%
*-inverses97.0%
div-sub97.0%
clear-num96.9%
un-div-inv97.1%
Applied egg-rr97.1%
Taylor expanded in y around 0 73.4%
mul-1-neg73.4%
distribute-neg-frac273.4%
Simplified73.4%
if -4.2e-85 < z < 5.8e-73 or 1.2000000000000001e48 < z < 2.9e110Initial program 84.0%
remove-double-neg84.0%
distribute-frac-neg284.0%
distribute-frac-neg84.0%
distribute-rgt-neg-in84.0%
associate-/l*99.9%
distribute-frac-neg99.9%
distribute-frac-neg299.9%
remove-double-neg99.9%
div-sub99.9%
*-inverses99.9%
Simplified99.9%
Taylor expanded in z around 0 83.2%
if 5.8e-73 < z < 1.2000000000000001e48Initial program 77.2%
remove-double-neg77.2%
distribute-frac-neg277.2%
distribute-frac-neg77.2%
distribute-rgt-neg-in77.2%
associate-/l*99.8%
distribute-frac-neg99.8%
distribute-frac-neg299.8%
remove-double-neg99.8%
div-sub99.8%
*-inverses99.8%
Simplified99.8%
Taylor expanded in z around inf 61.5%
mul-1-neg61.5%
distribute-frac-neg261.5%
Simplified61.5%
if 2.9e110 < z Initial program 94.7%
remove-double-neg94.7%
distribute-frac-neg294.7%
distribute-frac-neg94.7%
distribute-rgt-neg-in94.7%
associate-/l*83.2%
distribute-frac-neg83.2%
distribute-frac-neg283.2%
remove-double-neg83.2%
div-sub83.2%
*-inverses83.2%
Simplified83.2%
Taylor expanded in z around inf 87.7%
associate-*r/87.7%
associate-*r*87.7%
neg-mul-187.7%
*-commutative87.7%
Simplified87.7%
Final simplification79.6%
(FPCore (x y z) :precision binary64 (if (<= z 1.3e+192) (* x (- 1.0 (/ z y))) (* z (/ x (- y)))))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.3e+192) {
tmp = x * (1.0 - (z / y));
} else {
tmp = 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 <= 1.3d+192) then
tmp = x * (1.0d0 - (z / y))
else
tmp = z * (x / -y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 1.3e+192) {
tmp = x * (1.0 - (z / y));
} else {
tmp = z * (x / -y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 1.3e+192: tmp = x * (1.0 - (z / y)) else: tmp = z * (x / -y) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 1.3e+192) tmp = Float64(x * Float64(1.0 - Float64(z / y))); else tmp = Float64(z * Float64(x / Float64(-y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 1.3e+192) tmp = x * (1.0 - (z / y)); else tmp = z * (x / -y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 1.3e+192], N[(x * N[(1.0 - N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(x / (-y)), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.3 \cdot 10^{+192}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{x}{-y}\\
\end{array}
\end{array}
if z < 1.30000000000000002e192Initial program 85.6%
remove-double-neg85.6%
distribute-frac-neg285.6%
distribute-frac-neg85.6%
distribute-rgt-neg-in85.6%
associate-/l*98.6%
distribute-frac-neg98.6%
distribute-frac-neg298.6%
remove-double-neg98.6%
div-sub98.6%
*-inverses98.6%
Simplified98.6%
if 1.30000000000000002e192 < z Initial program 94.4%
remove-double-neg94.4%
distribute-frac-neg294.4%
distribute-frac-neg94.4%
distribute-rgt-neg-in94.4%
associate-/l*75.8%
distribute-frac-neg75.8%
distribute-frac-neg275.8%
remove-double-neg75.8%
div-sub75.8%
*-inverses75.8%
Simplified75.8%
*-inverses75.8%
div-sub75.8%
clear-num75.8%
un-div-inv78.2%
Applied egg-rr78.2%
Taylor expanded in y around 0 88.9%
mul-1-neg88.9%
distribute-neg-frac288.9%
neg-mul-188.9%
*-commutative88.9%
*-commutative88.9%
associate-/l*90.7%
*-commutative90.7%
neg-mul-190.7%
Simplified90.7%
Final simplification97.5%
(FPCore (x y z) :precision binary64 (if (<= z 1.75e+170) (* x (- 1.0 (/ z y))) (* (- y z) (/ x y))))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.75e+170) {
tmp = x * (1.0 - (z / y));
} 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 <= 1.75d+170) then
tmp = x * (1.0d0 - (z / y))
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 <= 1.75e+170) {
tmp = x * (1.0 - (z / y));
} else {
tmp = (y - z) * (x / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 1.75e+170: tmp = x * (1.0 - (z / y)) else: tmp = (y - z) * (x / y) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 1.75e+170) tmp = Float64(x * Float64(1.0 - Float64(z / y))); 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 <= 1.75e+170) tmp = x * (1.0 - (z / y)); else tmp = (y - z) * (x / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 1.75e+170], N[(x * N[(1.0 - N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.75 \cdot 10^{+170}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{x}{y}\\
\end{array}
\end{array}
if z < 1.75000000000000003e170Initial program 85.5%
remove-double-neg85.5%
distribute-frac-neg285.5%
distribute-frac-neg85.5%
distribute-rgt-neg-in85.5%
associate-/l*99.0%
distribute-frac-neg99.0%
distribute-frac-neg299.0%
remove-double-neg99.0%
div-sub99.0%
*-inverses99.0%
Simplified99.0%
if 1.75000000000000003e170 < z Initial program 93.3%
*-commutative93.3%
associate-/l*94.7%
Applied egg-rr94.7%
Final simplification98.3%
(FPCore (x y z) :precision binary64 (if (<= z 1.65e+171) (- x (* x (/ z y))) (* (- y z) (/ x y))))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.65e+171) {
tmp = x - (x * (z / y));
} 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 <= 1.65d+171) then
tmp = x - (x * (z / y))
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 <= 1.65e+171) {
tmp = x - (x * (z / y));
} else {
tmp = (y - z) * (x / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 1.65e+171: tmp = x - (x * (z / y)) else: tmp = (y - z) * (x / y) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 1.65e+171) tmp = Float64(x - Float64(x * Float64(z / y))); 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 <= 1.65e+171) tmp = x - (x * (z / y)); else tmp = (y - z) * (x / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 1.65e+171], N[(x - N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.65 \cdot 10^{+171}:\\
\;\;\;\;x - x \cdot \frac{z}{y}\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{x}{y}\\
\end{array}
\end{array}
if z < 1.64999999999999996e171Initial program 85.5%
remove-double-neg85.5%
distribute-frac-neg285.5%
distribute-frac-neg85.5%
distribute-rgt-neg-in85.5%
associate-/l*99.0%
distribute-frac-neg99.0%
distribute-frac-neg299.0%
remove-double-neg99.0%
div-sub99.0%
*-inverses99.0%
Simplified99.0%
sub-neg99.0%
distribute-rgt-in99.0%
*-un-lft-identity99.0%
distribute-neg-frac299.0%
Applied egg-rr99.0%
associate-*l/95.3%
add-sqr-sqrt48.3%
sqrt-unprod65.3%
sqr-neg65.3%
sqrt-unprod25.8%
add-sqr-sqrt53.5%
associate-*r/52.2%
*-commutative52.2%
cancel-sign-sub52.2%
distribute-lft-neg-out52.2%
distribute-rgt-neg-out52.2%
associate-/r/53.9%
frac-2neg53.9%
Applied egg-rr99.0%
div-inv99.0%
clear-num99.0%
*-commutative99.0%
Applied egg-rr99.0%
if 1.64999999999999996e171 < z Initial program 93.3%
*-commutative93.3%
associate-/l*94.7%
Applied egg-rr94.7%
Final simplification98.3%
(FPCore (x y z) :precision binary64 (if (<= z 2.6e+167) (- x (/ x (/ y z))) (* (- y z) (/ x y))))
double code(double x, double y, double z) {
double tmp;
if (z <= 2.6e+167) {
tmp = x - (x / (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.6d+167) then
tmp = x - (x / (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.6e+167) {
tmp = x - (x / (y / z));
} else {
tmp = (y - z) * (x / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 2.6e+167: tmp = x - (x / (y / z)) else: tmp = (y - z) * (x / y) return tmp
function code(x, y, z) tmp = 0.0 if (z <= 2.6e+167) tmp = Float64(x - Float64(x / 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.6e+167) tmp = x - (x / (y / z)); else tmp = (y - z) * (x / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 2.6e+167], N[(x - N[(x / 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 \leq 2.6 \cdot 10^{+167}:\\
\;\;\;\;x - \frac{x}{\frac{y}{z}}\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{x}{y}\\
\end{array}
\end{array}
if z < 2.6000000000000002e167Initial program 85.4%
remove-double-neg85.4%
distribute-frac-neg285.4%
distribute-frac-neg85.4%
distribute-rgt-neg-in85.4%
associate-/l*99.0%
distribute-frac-neg99.0%
distribute-frac-neg299.0%
remove-double-neg99.0%
div-sub99.0%
*-inverses99.0%
Simplified99.0%
sub-neg99.0%
distribute-rgt-in99.0%
*-un-lft-identity99.0%
distribute-neg-frac299.0%
Applied egg-rr99.0%
associate-*l/95.3%
add-sqr-sqrt48.5%
sqrt-unprod65.6%
sqr-neg65.6%
sqrt-unprod25.9%
add-sqr-sqrt53.8%
associate-*r/52.4%
*-commutative52.4%
cancel-sign-sub52.4%
distribute-lft-neg-out52.4%
distribute-rgt-neg-out52.4%
associate-/r/54.1%
frac-2neg54.1%
Applied egg-rr99.0%
if 2.6000000000000002e167 < z Initial program 93.4%
*-commutative93.4%
associate-/l*94.8%
Applied egg-rr94.8%
Final simplification98.3%
(FPCore (x y z) :precision binary64 (if (<= x 1.4e+71) x (* y (/ x y))))
double code(double x, double y, double z) {
double tmp;
if (x <= 1.4e+71) {
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 <= 1.4d+71) 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 <= 1.4e+71) {
tmp = x;
} else {
tmp = y * (x / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 1.4e+71: tmp = x else: tmp = y * (x / y) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 1.4e+71) 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 <= 1.4e+71) tmp = x; else tmp = y * (x / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 1.4e+71], x, N[(y * N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.4 \cdot 10^{+71}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{y}\\
\end{array}
\end{array}
if x < 1.40000000000000001e71Initial program 88.3%
remove-double-neg88.3%
distribute-frac-neg288.3%
distribute-frac-neg88.3%
distribute-rgt-neg-in88.3%
associate-/l*94.3%
distribute-frac-neg94.3%
distribute-frac-neg294.3%
remove-double-neg94.3%
div-sub94.3%
*-inverses94.3%
Simplified94.3%
Taylor expanded in z around 0 47.5%
if 1.40000000000000001e71 < x Initial program 80.9%
Taylor expanded in y around inf 34.4%
*-commutative34.4%
associate-/l*65.2%
Applied egg-rr65.2%
Final simplification51.3%
(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 86.8%
remove-double-neg86.8%
distribute-frac-neg286.8%
distribute-frac-neg86.8%
distribute-rgt-neg-in86.8%
associate-/l*95.5%
distribute-frac-neg95.5%
distribute-frac-neg295.5%
remove-double-neg95.5%
div-sub95.5%
*-inverses95.5%
Simplified95.5%
Taylor expanded in z around 0 48.0%
Final simplification48.0%
(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 2024039
(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))