
(FPCore (x y z) :precision binary64 (/ (* x (+ y z)) z))
double code(double x, double y, double z) {
return (x * (y + z)) / 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)) / z
end function
public static double code(double x, double y, double z) {
return (x * (y + z)) / z;
}
def code(x, y, z): return (x * (y + z)) / z
function code(x, y, z) return Float64(Float64(x * Float64(y + z)) / z) end
function tmp = code(x, y, z) tmp = (x * (y + z)) / z; end
code[x_, y_, z_] := N[(N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(y + z\right)}{z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (* x (+ y z)) z))
double code(double x, double y, double z) {
return (x * (y + z)) / 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)) / z
end function
public static double code(double x, double y, double z) {
return (x * (y + z)) / z;
}
def code(x, y, z): return (x * (y + z)) / z
function code(x, y, z) return Float64(Float64(x * Float64(y + z)) / z) end
function tmp = code(x, y, z) tmp = (x * (y + z)) / z; end
code[x_, y_, z_] := N[(N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(y + z\right)}{z}
\end{array}
(FPCore (x y z) :precision binary64 (if (<= z -5.4e-182) (+ x (* x (/ y z))) (if (<= z 2.05e-38) (* (+ y z) (/ x z)) (* x (- (/ y z) -1.0)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -5.4e-182) {
tmp = x + (x * (y / z));
} else if (z <= 2.05e-38) {
tmp = (y + z) * (x / z);
} else {
tmp = x * ((y / z) - -1.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) :: tmp
if (z <= (-5.4d-182)) then
tmp = x + (x * (y / z))
else if (z <= 2.05d-38) then
tmp = (y + z) * (x / z)
else
tmp = x * ((y / z) - (-1.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -5.4e-182) {
tmp = x + (x * (y / z));
} else if (z <= 2.05e-38) {
tmp = (y + z) * (x / z);
} else {
tmp = x * ((y / z) - -1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -5.4e-182: tmp = x + (x * (y / z)) elif z <= 2.05e-38: tmp = (y + z) * (x / z) else: tmp = x * ((y / z) - -1.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -5.4e-182) tmp = Float64(x + Float64(x * Float64(y / z))); elseif (z <= 2.05e-38) tmp = Float64(Float64(y + z) * Float64(x / z)); else tmp = Float64(x * Float64(Float64(y / z) - -1.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -5.4e-182) tmp = x + (x * (y / z)); elseif (z <= 2.05e-38) tmp = (y + z) * (x / z); else tmp = x * ((y / z) - -1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -5.4e-182], N[(x + N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.05e-38], N[(N[(y + z), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y / z), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.4 \cdot 10^{-182}:\\
\;\;\;\;x + x \cdot \frac{y}{z}\\
\mathbf{elif}\;z \leq 2.05 \cdot 10^{-38}:\\
\;\;\;\;\left(y + z\right) \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - -1\right)\\
\end{array}
\end{array}
if z < -5.39999999999999999e-182Initial program 85.1%
associate-/l*99.1%
remove-double-neg99.1%
unsub-neg99.1%
div-sub99.1%
remove-double-neg99.1%
distribute-frac-neg299.1%
*-inverses99.1%
metadata-eval99.1%
Simplified99.1%
sub-neg99.1%
metadata-eval99.1%
distribute-rgt-in99.1%
*-commutative99.1%
*-un-lft-identity99.1%
Applied egg-rr99.1%
if -5.39999999999999999e-182 < z < 2.0499999999999999e-38Initial program 94.3%
*-commutative94.3%
associate-/l*94.6%
Simplified94.6%
if 2.0499999999999999e-38 < z Initial program 81.5%
associate-/l*99.9%
remove-double-neg99.9%
unsub-neg99.9%
div-sub99.9%
remove-double-neg99.9%
distribute-frac-neg299.9%
*-inverses99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification98.0%
(FPCore (x y z) :precision binary64 (if (<= y 6.6e+59) (fma x (/ y z) x) (/ (* x (+ y z)) z)))
double code(double x, double y, double z) {
double tmp;
if (y <= 6.6e+59) {
tmp = fma(x, (y / z), x);
} else {
tmp = (x * (y + z)) / z;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= 6.6e+59) tmp = fma(x, Float64(y / z), x); else tmp = Float64(Float64(x * Float64(y + z)) / z); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, 6.6e+59], N[(x * N[(y / z), $MachinePrecision] + x), $MachinePrecision], N[(N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6.6 \cdot 10^{+59}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{y}{z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\
\end{array}
\end{array}
if y < 6.5999999999999999e59Initial program 84.8%
associate-*l/84.4%
distribute-lft-in82.2%
remove-double-neg82.2%
distribute-lft-neg-out82.2%
distribute-frac-neg82.2%
distribute-rgt-neg-out82.2%
distribute-frac-neg82.2%
distribute-lft-neg-out82.2%
distribute-rgt-neg-out82.2%
remove-double-neg82.2%
associate-*l/80.3%
associate-*r/82.0%
fma-undefine82.0%
remove-double-neg82.0%
distribute-rgt-neg-out82.0%
distribute-lft-neg-out82.0%
distribute-frac-neg282.0%
associate-*l/84.0%
associate-/l*98.0%
*-inverses98.0%
*-rgt-identity98.0%
Simplified98.0%
if 6.5999999999999999e59 < y Initial program 93.2%
Final simplification96.9%
(FPCore (x y z)
:precision binary64
(if (or (<= y -1.8e-13)
(and (not (<= y 2.5e-141))
(or (<= y 2.65e-105) (not (<= y 4.6e+51)))))
(* x (/ y z))
x))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.8e-13) || (!(y <= 2.5e-141) && ((y <= 2.65e-105) || !(y <= 4.6e+51)))) {
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 ((y <= (-1.8d-13)) .or. (.not. (y <= 2.5d-141)) .and. (y <= 2.65d-105) .or. (.not. (y <= 4.6d+51))) 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 ((y <= -1.8e-13) || (!(y <= 2.5e-141) && ((y <= 2.65e-105) || !(y <= 4.6e+51)))) {
tmp = x * (y / z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.8e-13) or (not (y <= 2.5e-141) and ((y <= 2.65e-105) or not (y <= 4.6e+51))): tmp = x * (y / z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.8e-13) || (!(y <= 2.5e-141) && ((y <= 2.65e-105) || !(y <= 4.6e+51)))) tmp = Float64(x * Float64(y / z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.8e-13) || (~((y <= 2.5e-141)) && ((y <= 2.65e-105) || ~((y <= 4.6e+51))))) tmp = x * (y / z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.8e-13], And[N[Not[LessEqual[y, 2.5e-141]], $MachinePrecision], Or[LessEqual[y, 2.65e-105], N[Not[LessEqual[y, 4.6e+51]], $MachinePrecision]]]], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.8 \cdot 10^{-13} \lor \neg \left(y \leq 2.5 \cdot 10^{-141}\right) \land \left(y \leq 2.65 \cdot 10^{-105} \lor \neg \left(y \leq 4.6 \cdot 10^{+51}\right)\right):\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.7999999999999999e-13 or 2.5e-141 < y < 2.6500000000000001e-105 or 4.6000000000000001e51 < y Initial program 92.8%
associate-/l*90.4%
remove-double-neg90.4%
unsub-neg90.4%
div-sub90.4%
remove-double-neg90.4%
distribute-frac-neg290.4%
*-inverses90.4%
metadata-eval90.4%
Simplified90.4%
Taylor expanded in y around inf 78.6%
associate-*r/72.0%
Simplified72.0%
if -1.7999999999999999e-13 < y < 2.5e-141 or 2.6500000000000001e-105 < y < 4.6000000000000001e51Initial program 79.3%
associate-/l*99.9%
remove-double-neg99.9%
unsub-neg99.9%
div-sub99.9%
remove-double-neg99.9%
distribute-frac-neg299.9%
*-inverses99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 84.1%
Final simplification77.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (/ x z))))
(if (<= y -1.9e-13)
t_0
(if (<= y 2.5e-141)
x
(if (<= y 2.65e-105) (* x (/ y z)) (if (<= y 7e+52) x t_0))))))
double code(double x, double y, double z) {
double t_0 = y * (x / z);
double tmp;
if (y <= -1.9e-13) {
tmp = t_0;
} else if (y <= 2.5e-141) {
tmp = x;
} else if (y <= 2.65e-105) {
tmp = x * (y / z);
} else if (y <= 7e+52) {
tmp = 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 = y * (x / z)
if (y <= (-1.9d-13)) then
tmp = t_0
else if (y <= 2.5d-141) then
tmp = x
else if (y <= 2.65d-105) then
tmp = x * (y / z)
else if (y <= 7d+52) then
tmp = x
else
tmp = t_0
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 (y <= -1.9e-13) {
tmp = t_0;
} else if (y <= 2.5e-141) {
tmp = x;
} else if (y <= 2.65e-105) {
tmp = x * (y / z);
} else if (y <= 7e+52) {
tmp = x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = y * (x / z) tmp = 0 if y <= -1.9e-13: tmp = t_0 elif y <= 2.5e-141: tmp = x elif y <= 2.65e-105: tmp = x * (y / z) elif y <= 7e+52: tmp = x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(y * Float64(x / z)) tmp = 0.0 if (y <= -1.9e-13) tmp = t_0; elseif (y <= 2.5e-141) tmp = x; elseif (y <= 2.65e-105) tmp = Float64(x * Float64(y / z)); elseif (y <= 7e+52) tmp = x; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * (x / z); tmp = 0.0; if (y <= -1.9e-13) tmp = t_0; elseif (y <= 2.5e-141) tmp = x; elseif (y <= 2.65e-105) tmp = x * (y / z); elseif (y <= 7e+52) tmp = x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.9e-13], t$95$0, If[LessEqual[y, 2.5e-141], x, If[LessEqual[y, 2.65e-105], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7e+52], x, t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \frac{x}{z}\\
\mathbf{if}\;y \leq -1.9 \cdot 10^{-13}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{-141}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 2.65 \cdot 10^{-105}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{elif}\;y \leq 7 \cdot 10^{+52}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1.9e-13 or 7e52 < y Initial program 92.7%
associate-/l*89.9%
remove-double-neg89.9%
unsub-neg89.9%
div-sub89.9%
remove-double-neg89.9%
distribute-frac-neg289.9%
*-inverses89.9%
metadata-eval89.9%
Simplified89.9%
Taylor expanded in y around inf 78.9%
*-commutative78.9%
associate-/l*77.0%
Applied egg-rr77.0%
if -1.9e-13 < y < 2.5e-141 or 2.6500000000000001e-105 < y < 7e52Initial program 79.3%
associate-/l*99.9%
remove-double-neg99.9%
unsub-neg99.9%
div-sub99.9%
remove-double-neg99.9%
distribute-frac-neg299.9%
*-inverses99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 84.1%
if 2.5e-141 < y < 2.6500000000000001e-105Initial program 94.7%
associate-/l*99.3%
remove-double-neg99.3%
unsub-neg99.3%
div-sub99.3%
remove-double-neg99.3%
distribute-frac-neg299.3%
*-inverses99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in y around inf 73.3%
associate-*r/78.1%
Simplified78.1%
Final simplification80.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (/ x z))))
(if (<= y -5e-12)
t_0
(if (<= y 2.5e-141)
x
(if (<= y 2.65e-105) (/ x (/ z y)) (if (<= y 2.3e+52) x t_0))))))
double code(double x, double y, double z) {
double t_0 = y * (x / z);
double tmp;
if (y <= -5e-12) {
tmp = t_0;
} else if (y <= 2.5e-141) {
tmp = x;
} else if (y <= 2.65e-105) {
tmp = x / (z / y);
} else if (y <= 2.3e+52) {
tmp = 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 = y * (x / z)
if (y <= (-5d-12)) then
tmp = t_0
else if (y <= 2.5d-141) then
tmp = x
else if (y <= 2.65d-105) then
tmp = x / (z / y)
else if (y <= 2.3d+52) then
tmp = x
else
tmp = t_0
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 (y <= -5e-12) {
tmp = t_0;
} else if (y <= 2.5e-141) {
tmp = x;
} else if (y <= 2.65e-105) {
tmp = x / (z / y);
} else if (y <= 2.3e+52) {
tmp = x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = y * (x / z) tmp = 0 if y <= -5e-12: tmp = t_0 elif y <= 2.5e-141: tmp = x elif y <= 2.65e-105: tmp = x / (z / y) elif y <= 2.3e+52: tmp = x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(y * Float64(x / z)) tmp = 0.0 if (y <= -5e-12) tmp = t_0; elseif (y <= 2.5e-141) tmp = x; elseif (y <= 2.65e-105) tmp = Float64(x / Float64(z / y)); elseif (y <= 2.3e+52) tmp = x; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * (x / z); tmp = 0.0; if (y <= -5e-12) tmp = t_0; elseif (y <= 2.5e-141) tmp = x; elseif (y <= 2.65e-105) tmp = x / (z / y); elseif (y <= 2.3e+52) tmp = x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5e-12], t$95$0, If[LessEqual[y, 2.5e-141], x, If[LessEqual[y, 2.65e-105], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.3e+52], x, t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \frac{x}{z}\\
\mathbf{if}\;y \leq -5 \cdot 10^{-12}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{-141}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 2.65 \cdot 10^{-105}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\mathbf{elif}\;y \leq 2.3 \cdot 10^{+52}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -4.9999999999999997e-12 or 2.3e52 < y Initial program 92.7%
associate-/l*89.9%
remove-double-neg89.9%
unsub-neg89.9%
div-sub89.9%
remove-double-neg89.9%
distribute-frac-neg289.9%
*-inverses89.9%
metadata-eval89.9%
Simplified89.9%
Taylor expanded in y around inf 78.9%
*-commutative78.9%
associate-/l*77.0%
Applied egg-rr77.0%
if -4.9999999999999997e-12 < y < 2.5e-141 or 2.6500000000000001e-105 < y < 2.3e52Initial program 79.3%
associate-/l*99.9%
remove-double-neg99.9%
unsub-neg99.9%
div-sub99.9%
remove-double-neg99.9%
distribute-frac-neg299.9%
*-inverses99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 84.1%
if 2.5e-141 < y < 2.6500000000000001e-105Initial program 94.7%
associate-/l*99.3%
remove-double-neg99.3%
unsub-neg99.3%
div-sub99.3%
remove-double-neg99.3%
distribute-frac-neg299.3%
*-inverses99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in y around inf 73.3%
associate-*r/78.1%
Simplified78.1%
clear-num78.6%
un-div-inv78.6%
Applied egg-rr78.6%
Final simplification80.3%
(FPCore (x y z)
:precision binary64
(if (<= y -1.4e-15)
(* y (/ x z))
(if (<= y 2.5e-141)
x
(if (<= y 2.65e-105) (/ x (/ z y)) (if (<= y 3.3e+50) x (/ y (/ z x)))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.4e-15) {
tmp = y * (x / z);
} else if (y <= 2.5e-141) {
tmp = x;
} else if (y <= 2.65e-105) {
tmp = x / (z / y);
} else if (y <= 3.3e+50) {
tmp = x;
} else {
tmp = y / (z / x);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-1.4d-15)) then
tmp = y * (x / z)
else if (y <= 2.5d-141) then
tmp = x
else if (y <= 2.65d-105) then
tmp = x / (z / y)
else if (y <= 3.3d+50) then
tmp = x
else
tmp = y / (z / x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.4e-15) {
tmp = y * (x / z);
} else if (y <= 2.5e-141) {
tmp = x;
} else if (y <= 2.65e-105) {
tmp = x / (z / y);
} else if (y <= 3.3e+50) {
tmp = x;
} else {
tmp = y / (z / x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.4e-15: tmp = y * (x / z) elif y <= 2.5e-141: tmp = x elif y <= 2.65e-105: tmp = x / (z / y) elif y <= 3.3e+50: tmp = x else: tmp = y / (z / x) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.4e-15) tmp = Float64(y * Float64(x / z)); elseif (y <= 2.5e-141) tmp = x; elseif (y <= 2.65e-105) tmp = Float64(x / Float64(z / y)); elseif (y <= 3.3e+50) tmp = x; else tmp = Float64(y / Float64(z / x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.4e-15) tmp = y * (x / z); elseif (y <= 2.5e-141) tmp = x; elseif (y <= 2.65e-105) tmp = x / (z / y); elseif (y <= 3.3e+50) tmp = x; else tmp = y / (z / x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.4e-15], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.5e-141], x, If[LessEqual[y, 2.65e-105], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.3e+50], x, N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.4 \cdot 10^{-15}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{-141}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 2.65 \cdot 10^{-105}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\mathbf{elif}\;y \leq 3.3 \cdot 10^{+50}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\
\end{array}
\end{array}
if y < -1.40000000000000007e-15Initial program 92.4%
associate-/l*94.8%
remove-double-neg94.8%
unsub-neg94.8%
div-sub94.8%
remove-double-neg94.8%
distribute-frac-neg294.8%
*-inverses94.8%
metadata-eval94.8%
Simplified94.8%
Taylor expanded in y around inf 79.0%
*-commutative79.0%
associate-/l*77.2%
Applied egg-rr77.2%
if -1.40000000000000007e-15 < y < 2.5e-141 or 2.6500000000000001e-105 < y < 3.3e50Initial program 79.3%
associate-/l*99.9%
remove-double-neg99.9%
unsub-neg99.9%
div-sub99.9%
remove-double-neg99.9%
distribute-frac-neg299.9%
*-inverses99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 84.1%
if 2.5e-141 < y < 2.6500000000000001e-105Initial program 94.7%
associate-/l*99.3%
remove-double-neg99.3%
unsub-neg99.3%
div-sub99.3%
remove-double-neg99.3%
distribute-frac-neg299.3%
*-inverses99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in y around inf 73.3%
associate-*r/78.1%
Simplified78.1%
clear-num78.6%
un-div-inv78.6%
Applied egg-rr78.6%
if 3.3e50 < y Initial program 93.2%
associate-/l*83.5%
remove-double-neg83.5%
unsub-neg83.5%
div-sub83.5%
remove-double-neg83.5%
distribute-frac-neg283.5%
*-inverses83.5%
metadata-eval83.5%
Simplified83.5%
Taylor expanded in y around inf 78.8%
*-commutative78.8%
associate-/l*76.9%
Applied egg-rr76.9%
clear-num76.9%
un-div-inv77.0%
Applied egg-rr77.0%
Final simplification80.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (* y x) z)))
(if (<= y -9.8e-14)
t_0
(if (<= y 2.5e-141)
x
(if (<= y 2.65e-105) (/ x (/ z y)) (if (<= y 1.35e+54) x t_0))))))
double code(double x, double y, double z) {
double t_0 = (y * x) / z;
double tmp;
if (y <= -9.8e-14) {
tmp = t_0;
} else if (y <= 2.5e-141) {
tmp = x;
} else if (y <= 2.65e-105) {
tmp = x / (z / y);
} else if (y <= 1.35e+54) {
tmp = 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 = (y * x) / z
if (y <= (-9.8d-14)) then
tmp = t_0
else if (y <= 2.5d-141) then
tmp = x
else if (y <= 2.65d-105) then
tmp = x / (z / y)
else if (y <= 1.35d+54) then
tmp = x
else
tmp = t_0
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 (y <= -9.8e-14) {
tmp = t_0;
} else if (y <= 2.5e-141) {
tmp = x;
} else if (y <= 2.65e-105) {
tmp = x / (z / y);
} else if (y <= 1.35e+54) {
tmp = x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (y * x) / z tmp = 0 if y <= -9.8e-14: tmp = t_0 elif y <= 2.5e-141: tmp = x elif y <= 2.65e-105: tmp = x / (z / y) elif y <= 1.35e+54: tmp = x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(y * x) / z) tmp = 0.0 if (y <= -9.8e-14) tmp = t_0; elseif (y <= 2.5e-141) tmp = x; elseif (y <= 2.65e-105) tmp = Float64(x / Float64(z / y)); elseif (y <= 1.35e+54) tmp = x; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (y * x) / z; tmp = 0.0; if (y <= -9.8e-14) tmp = t_0; elseif (y <= 2.5e-141) tmp = x; elseif (y <= 2.65e-105) tmp = x / (z / y); elseif (y <= 1.35e+54) tmp = x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[y, -9.8e-14], t$95$0, If[LessEqual[y, 2.5e-141], x, If[LessEqual[y, 2.65e-105], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.35e+54], x, t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y \cdot x}{z}\\
\mathbf{if}\;y \leq -9.8 \cdot 10^{-14}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{-141}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 2.65 \cdot 10^{-105}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+54}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -9.79999999999999989e-14 or 1.35000000000000005e54 < y Initial program 92.7%
associate-/l*89.9%
remove-double-neg89.9%
unsub-neg89.9%
div-sub89.9%
remove-double-neg89.9%
distribute-frac-neg289.9%
*-inverses89.9%
metadata-eval89.9%
Simplified89.9%
Taylor expanded in y around inf 78.9%
if -9.79999999999999989e-14 < y < 2.5e-141 or 2.6500000000000001e-105 < y < 1.35000000000000005e54Initial program 79.3%
associate-/l*99.9%
remove-double-neg99.9%
unsub-neg99.9%
div-sub99.9%
remove-double-neg99.9%
distribute-frac-neg299.9%
*-inverses99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 84.1%
if 2.5e-141 < y < 2.6500000000000001e-105Initial program 94.7%
associate-/l*99.3%
remove-double-neg99.3%
unsub-neg99.3%
div-sub99.3%
remove-double-neg99.3%
distribute-frac-neg299.3%
*-inverses99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in y around inf 73.3%
associate-*r/78.1%
Simplified78.1%
clear-num78.6%
un-div-inv78.6%
Applied egg-rr78.6%
Final simplification81.3%
(FPCore (x y z) :precision binary64 (if (or (<= z -5.2e-182) (not (<= z 2e-38))) (* x (- (/ y z) -1.0)) (* (+ y z) (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -5.2e-182) || !(z <= 2e-38)) {
tmp = x * ((y / z) - -1.0);
} else {
tmp = (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 <= (-5.2d-182)) .or. (.not. (z <= 2d-38))) then
tmp = x * ((y / z) - (-1.0d0))
else
tmp = (y + z) * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -5.2e-182) || !(z <= 2e-38)) {
tmp = x * ((y / z) - -1.0);
} else {
tmp = (y + z) * (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -5.2e-182) or not (z <= 2e-38): tmp = x * ((y / z) - -1.0) else: tmp = (y + z) * (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -5.2e-182) || !(z <= 2e-38)) tmp = Float64(x * Float64(Float64(y / z) - -1.0)); else tmp = Float64(Float64(y + z) * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -5.2e-182) || ~((z <= 2e-38))) tmp = x * ((y / z) - -1.0); else tmp = (y + z) * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -5.2e-182], N[Not[LessEqual[z, 2e-38]], $MachinePrecision]], N[(x * N[(N[(y / z), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(y + z), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{-182} \lor \neg \left(z \leq 2 \cdot 10^{-38}\right):\\
\;\;\;\;x \cdot \left(\frac{y}{z} - -1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y + z\right) \cdot \frac{x}{z}\\
\end{array}
\end{array}
if z < -5.20000000000000011e-182 or 1.9999999999999999e-38 < z Initial program 83.6%
associate-/l*99.4%
remove-double-neg99.4%
unsub-neg99.4%
div-sub99.4%
remove-double-neg99.4%
distribute-frac-neg299.4%
*-inverses99.4%
metadata-eval99.4%
Simplified99.4%
if -5.20000000000000011e-182 < z < 1.9999999999999999e-38Initial program 94.3%
*-commutative94.3%
associate-/l*94.6%
Simplified94.6%
Final simplification98.0%
(FPCore (x y z) :precision binary64 (if (<= y 6.6e+59) (+ x (* x (/ y z))) (/ (* x (+ y z)) z)))
double code(double x, double y, double z) {
double tmp;
if (y <= 6.6e+59) {
tmp = x + (x * (y / z));
} else {
tmp = (x * (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 (y <= 6.6d+59) then
tmp = x + (x * (y / z))
else
tmp = (x * (y + z)) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 6.6e+59) {
tmp = x + (x * (y / z));
} else {
tmp = (x * (y + z)) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 6.6e+59: tmp = x + (x * (y / z)) else: tmp = (x * (y + z)) / z return tmp
function code(x, y, z) tmp = 0.0 if (y <= 6.6e+59) tmp = Float64(x + Float64(x * Float64(y / z))); else tmp = Float64(Float64(x * Float64(y + z)) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 6.6e+59) tmp = x + (x * (y / z)); else tmp = (x * (y + z)) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 6.6e+59], N[(x + N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6.6 \cdot 10^{+59}:\\
\;\;\;\;x + x \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\
\end{array}
\end{array}
if y < 6.5999999999999999e59Initial program 84.8%
associate-/l*98.0%
remove-double-neg98.0%
unsub-neg98.0%
div-sub98.0%
remove-double-neg98.0%
distribute-frac-neg298.0%
*-inverses98.0%
metadata-eval98.0%
Simplified98.0%
sub-neg98.0%
metadata-eval98.0%
distribute-rgt-in98.0%
*-commutative98.0%
*-un-lft-identity98.0%
Applied egg-rr98.0%
if 6.5999999999999999e59 < y Initial program 93.2%
Final simplification96.9%
(FPCore (x y z) :precision binary64 (* x (- (/ y z) -1.0)))
double code(double x, double y, double z) {
return x * ((y / z) - -1.0);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x * ((y / z) - (-1.0d0))
end function
public static double code(double x, double y, double z) {
return x * ((y / z) - -1.0);
}
def code(x, y, z): return x * ((y / z) - -1.0)
function code(x, y, z) return Float64(x * Float64(Float64(y / z) - -1.0)) end
function tmp = code(x, y, z) tmp = x * ((y / z) - -1.0); end
code[x_, y_, z_] := N[(x * N[(N[(y / z), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\frac{y}{z} - -1\right)
\end{array}
Initial program 86.6%
associate-/l*94.7%
remove-double-neg94.7%
unsub-neg94.7%
div-sub94.7%
remove-double-neg94.7%
distribute-frac-neg294.7%
*-inverses94.7%
metadata-eval94.7%
Simplified94.7%
Final simplification94.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 86.6%
associate-/l*94.7%
remove-double-neg94.7%
unsub-neg94.7%
div-sub94.7%
remove-double-neg94.7%
distribute-frac-neg294.7%
*-inverses94.7%
metadata-eval94.7%
Simplified94.7%
Taylor expanded in y around 0 49.0%
Final simplification49.0%
(FPCore (x y z) :precision binary64 (/ x (/ z (+ y z))))
double code(double x, double y, double z) {
return x / (z / (y + 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 / (z / (y + z))
end function
public static double code(double x, double y, double z) {
return x / (z / (y + z));
}
def code(x, y, z): return x / (z / (y + z))
function code(x, y, z) return Float64(x / Float64(z / Float64(y + z))) end
function tmp = code(x, y, z) tmp = x / (z / (y + z)); end
code[x_, y_, z_] := N[(x / N[(z / N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{\frac{z}{y + z}}
\end{array}
herbie shell --seed 2024130
(FPCore (x y z)
:name "Numeric.SpecFunctions:choose from math-functions-0.1.5.2"
:precision binary64
:alt
(/ x (/ z (+ y z)))
(/ (* x (+ y z)) z))