
(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 8 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 (<= y 6e+140) (fma x (/ y z) x) (/ (+ y z) (/ z x))))
double code(double x, double y, double z) {
double tmp;
if (y <= 6e+140) {
tmp = fma(x, (y / z), x);
} else {
tmp = (y + z) / (z / x);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= 6e+140) tmp = fma(x, Float64(y / z), x); else tmp = Float64(Float64(y + z) / Float64(z / x)); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, 6e+140], N[(x * N[(y / z), $MachinePrecision] + x), $MachinePrecision], N[(N[(y + z), $MachinePrecision] / N[(z / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6 \cdot 10^{+140}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{y}{z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y + z}{\frac{z}{x}}\\
\end{array}
\end{array}
if y < 5.99999999999999993e140Initial program 84.8%
associate-*l/83.2%
remove-double-neg83.2%
unsub-neg83.2%
distribute-rgt-out--80.4%
associate-*r/76.8%
*-commutative76.8%
associate-*r/80.5%
associate-*r/84.5%
distribute-lft-neg-out84.5%
distribute-frac-neg84.5%
distribute-frac-neg284.5%
fma-neg84.5%
distribute-frac-neg84.5%
distribute-lft-neg-out84.5%
*-commutative84.5%
associate-/l*97.4%
*-inverses97.4%
*-rgt-identity97.4%
Simplified97.4%
if 5.99999999999999993e140 < y Initial program 77.7%
*-commutative77.7%
associate-/l*99.7%
Simplified99.7%
clear-num99.6%
un-div-inv99.8%
Applied egg-rr99.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ y (/ z x))))
(if (<= z -6e+22)
x
(if (<= z -1.65e-59)
t_0
(if (<= z -4.7e-65)
x
(if (<= z 2.25e+27)
t_0
(if (<= z 1.06e+129)
x
(if (<= z 2.8e+143)
(* x (/ y z))
(if (<= z 1.8e+171) x (if (<= z 2.95e+183) t_0 x))))))))))
double code(double x, double y, double z) {
double t_0 = y / (z / x);
double tmp;
if (z <= -6e+22) {
tmp = x;
} else if (z <= -1.65e-59) {
tmp = t_0;
} else if (z <= -4.7e-65) {
tmp = x;
} else if (z <= 2.25e+27) {
tmp = t_0;
} else if (z <= 1.06e+129) {
tmp = x;
} else if (z <= 2.8e+143) {
tmp = x * (y / z);
} else if (z <= 1.8e+171) {
tmp = x;
} else if (z <= 2.95e+183) {
tmp = t_0;
} 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 / (z / x)
if (z <= (-6d+22)) then
tmp = x
else if (z <= (-1.65d-59)) then
tmp = t_0
else if (z <= (-4.7d-65)) then
tmp = x
else if (z <= 2.25d+27) then
tmp = t_0
else if (z <= 1.06d+129) then
tmp = x
else if (z <= 2.8d+143) then
tmp = x * (y / z)
else if (z <= 1.8d+171) then
tmp = x
else if (z <= 2.95d+183) then
tmp = t_0
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y / (z / x);
double tmp;
if (z <= -6e+22) {
tmp = x;
} else if (z <= -1.65e-59) {
tmp = t_0;
} else if (z <= -4.7e-65) {
tmp = x;
} else if (z <= 2.25e+27) {
tmp = t_0;
} else if (z <= 1.06e+129) {
tmp = x;
} else if (z <= 2.8e+143) {
tmp = x * (y / z);
} else if (z <= 1.8e+171) {
tmp = x;
} else if (z <= 2.95e+183) {
tmp = t_0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): t_0 = y / (z / x) tmp = 0 if z <= -6e+22: tmp = x elif z <= -1.65e-59: tmp = t_0 elif z <= -4.7e-65: tmp = x elif z <= 2.25e+27: tmp = t_0 elif z <= 1.06e+129: tmp = x elif z <= 2.8e+143: tmp = x * (y / z) elif z <= 1.8e+171: tmp = x elif z <= 2.95e+183: tmp = t_0 else: tmp = x return tmp
function code(x, y, z) t_0 = Float64(y / Float64(z / x)) tmp = 0.0 if (z <= -6e+22) tmp = x; elseif (z <= -1.65e-59) tmp = t_0; elseif (z <= -4.7e-65) tmp = x; elseif (z <= 2.25e+27) tmp = t_0; elseif (z <= 1.06e+129) tmp = x; elseif (z <= 2.8e+143) tmp = Float64(x * Float64(y / z)); elseif (z <= 1.8e+171) tmp = x; elseif (z <= 2.95e+183) tmp = t_0; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) t_0 = y / (z / x); tmp = 0.0; if (z <= -6e+22) tmp = x; elseif (z <= -1.65e-59) tmp = t_0; elseif (z <= -4.7e-65) tmp = x; elseif (z <= 2.25e+27) tmp = t_0; elseif (z <= 1.06e+129) tmp = x; elseif (z <= 2.8e+143) tmp = x * (y / z); elseif (z <= 1.8e+171) tmp = x; elseif (z <= 2.95e+183) tmp = t_0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6e+22], x, If[LessEqual[z, -1.65e-59], t$95$0, If[LessEqual[z, -4.7e-65], x, If[LessEqual[z, 2.25e+27], t$95$0, If[LessEqual[z, 1.06e+129], x, If[LessEqual[z, 2.8e+143], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.8e+171], x, If[LessEqual[z, 2.95e+183], t$95$0, x]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y}{\frac{z}{x}}\\
\mathbf{if}\;z \leq -6 \cdot 10^{+22}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq -1.65 \cdot 10^{-59}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -4.7 \cdot 10^{-65}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.25 \cdot 10^{+27}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.06 \cdot 10^{+129}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{+143}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{+171}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.95 \cdot 10^{+183}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -6e22 or -1.64999999999999991e-59 < z < -4.7000000000000001e-65 or 2.25e27 < z < 1.06e129 or 2.79999999999999998e143 < z < 1.80000000000000009e171 or 2.94999999999999978e183 < z Initial program 74.7%
associate-/l*99.9%
remove-double-neg99.9%
distribute-frac-neg299.9%
neg-sub099.9%
remove-double-neg99.9%
unsub-neg99.9%
div-sub99.9%
*-inverses99.9%
metadata-eval99.9%
associate--r-99.9%
neg-sub099.9%
distribute-frac-neg299.9%
remove-double-neg99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in y around 0 81.0%
if -6e22 < z < -1.64999999999999991e-59 or -4.7000000000000001e-65 < z < 2.25e27 or 1.80000000000000009e171 < z < 2.94999999999999978e183Initial program 92.2%
associate-/l*92.0%
remove-double-neg92.0%
distribute-frac-neg292.0%
neg-sub092.0%
remove-double-neg92.0%
unsub-neg92.0%
div-sub92.0%
*-inverses92.0%
metadata-eval92.0%
associate--r-92.0%
neg-sub092.0%
distribute-frac-neg292.0%
remove-double-neg92.0%
sub-neg92.0%
Simplified92.0%
Taylor expanded in y around inf 73.4%
associate-*r/70.4%
Simplified70.4%
associate-*r/73.4%
*-commutative73.4%
associate-*r/75.7%
clear-num75.6%
un-div-inv75.8%
Applied egg-rr75.8%
if 1.06e129 < z < 2.79999999999999998e143Initial program 84.3%
associate-/l*100.0%
remove-double-neg100.0%
distribute-frac-neg2100.0%
neg-sub0100.0%
remove-double-neg100.0%
unsub-neg100.0%
div-sub100.0%
*-inverses100.0%
metadata-eval100.0%
associate--r-100.0%
neg-sub0100.0%
distribute-frac-neg2100.0%
remove-double-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in y around inf 67.9%
associate-*r/83.6%
Simplified83.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (/ x z))))
(if (<= z -5.9e+22)
x
(if (<= z -3.8e-60)
t_0
(if (<= z -7.8e-65)
x
(if (<= z 2.15e+27)
t_0
(if (<= z 1.06e+129) x (if (<= z 1.65e+140) (* x (/ y z)) x))))))))
double code(double x, double y, double z) {
double t_0 = y * (x / z);
double tmp;
if (z <= -5.9e+22) {
tmp = x;
} else if (z <= -3.8e-60) {
tmp = t_0;
} else if (z <= -7.8e-65) {
tmp = x;
} else if (z <= 2.15e+27) {
tmp = t_0;
} else if (z <= 1.06e+129) {
tmp = x;
} else if (z <= 1.65e+140) {
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) :: t_0
real(8) :: tmp
t_0 = y * (x / z)
if (z <= (-5.9d+22)) then
tmp = x
else if (z <= (-3.8d-60)) then
tmp = t_0
else if (z <= (-7.8d-65)) then
tmp = x
else if (z <= 2.15d+27) then
tmp = t_0
else if (z <= 1.06d+129) then
tmp = x
else if (z <= 1.65d+140) 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 t_0 = y * (x / z);
double tmp;
if (z <= -5.9e+22) {
tmp = x;
} else if (z <= -3.8e-60) {
tmp = t_0;
} else if (z <= -7.8e-65) {
tmp = x;
} else if (z <= 2.15e+27) {
tmp = t_0;
} else if (z <= 1.06e+129) {
tmp = x;
} else if (z <= 1.65e+140) {
tmp = x * (y / z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): t_0 = y * (x / z) tmp = 0 if z <= -5.9e+22: tmp = x elif z <= -3.8e-60: tmp = t_0 elif z <= -7.8e-65: tmp = x elif z <= 2.15e+27: tmp = t_0 elif z <= 1.06e+129: tmp = x elif z <= 1.65e+140: tmp = x * (y / z) else: tmp = x return tmp
function code(x, y, z) t_0 = Float64(y * Float64(x / z)) tmp = 0.0 if (z <= -5.9e+22) tmp = x; elseif (z <= -3.8e-60) tmp = t_0; elseif (z <= -7.8e-65) tmp = x; elseif (z <= 2.15e+27) tmp = t_0; elseif (z <= 1.06e+129) tmp = x; elseif (z <= 1.65e+140) tmp = Float64(x * Float64(y / z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * (x / z); tmp = 0.0; if (z <= -5.9e+22) tmp = x; elseif (z <= -3.8e-60) tmp = t_0; elseif (z <= -7.8e-65) tmp = x; elseif (z <= 2.15e+27) tmp = t_0; elseif (z <= 1.06e+129) tmp = x; elseif (z <= 1.65e+140) tmp = x * (y / 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, -5.9e+22], x, If[LessEqual[z, -3.8e-60], t$95$0, If[LessEqual[z, -7.8e-65], x, If[LessEqual[z, 2.15e+27], t$95$0, If[LessEqual[z, 1.06e+129], x, If[LessEqual[z, 1.65e+140], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], x]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \frac{x}{z}\\
\mathbf{if}\;z \leq -5.9 \cdot 10^{+22}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq -3.8 \cdot 10^{-60}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -7.8 \cdot 10^{-65}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.15 \cdot 10^{+27}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.06 \cdot 10^{+129}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{+140}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -5.9000000000000002e22 or -3.79999999999999994e-60 < z < -7.8000000000000007e-65 or 2.15000000000000004e27 < z < 1.06e129 or 1.6500000000000001e140 < z Initial program 73.6%
associate-/l*99.9%
remove-double-neg99.9%
distribute-frac-neg299.9%
neg-sub099.9%
remove-double-neg99.9%
unsub-neg99.9%
div-sub99.9%
*-inverses99.9%
metadata-eval99.9%
associate--r-99.9%
neg-sub099.9%
distribute-frac-neg299.9%
remove-double-neg99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in y around 0 77.8%
if -5.9000000000000002e22 < z < -3.79999999999999994e-60 or -7.8000000000000007e-65 < z < 2.15000000000000004e27Initial program 94.0%
associate-/l*91.6%
remove-double-neg91.6%
distribute-frac-neg291.6%
neg-sub091.6%
remove-double-neg91.6%
unsub-neg91.6%
div-sub91.6%
*-inverses91.6%
metadata-eval91.6%
associate--r-91.6%
neg-sub091.6%
distribute-frac-neg291.6%
remove-double-neg91.6%
sub-neg91.6%
Simplified91.6%
Taylor expanded in y around inf 76.4%
associate-*l/76.5%
*-commutative76.5%
Simplified76.5%
if 1.06e129 < z < 1.6500000000000001e140Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
distribute-frac-neg2100.0%
neg-sub0100.0%
remove-double-neg100.0%
unsub-neg100.0%
div-sub100.0%
*-inverses100.0%
metadata-eval100.0%
associate--r-100.0%
neg-sub0100.0%
distribute-frac-neg2100.0%
remove-double-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in y around inf 75.3%
associate-*r/75.3%
Simplified75.3%
(FPCore (x y z)
:precision binary64
(if (<= z -5.5e+22)
x
(if (or (<= z 1.95e+27) (and (not (<= z 1.06e+129)) (<= z 6.6e+164)))
(* x (/ y z))
x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -5.5e+22) {
tmp = x;
} else if ((z <= 1.95e+27) || (!(z <= 1.06e+129) && (z <= 6.6e+164))) {
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 <= (-5.5d+22)) then
tmp = x
else if ((z <= 1.95d+27) .or. (.not. (z <= 1.06d+129)) .and. (z <= 6.6d+164)) 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 <= -5.5e+22) {
tmp = x;
} else if ((z <= 1.95e+27) || (!(z <= 1.06e+129) && (z <= 6.6e+164))) {
tmp = x * (y / z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -5.5e+22: tmp = x elif (z <= 1.95e+27) or (not (z <= 1.06e+129) and (z <= 6.6e+164)): tmp = x * (y / z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -5.5e+22) tmp = x; elseif ((z <= 1.95e+27) || (!(z <= 1.06e+129) && (z <= 6.6e+164))) tmp = Float64(x * Float64(y / z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -5.5e+22) tmp = x; elseif ((z <= 1.95e+27) || (~((z <= 1.06e+129)) && (z <= 6.6e+164))) tmp = x * (y / z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -5.5e+22], x, If[Or[LessEqual[z, 1.95e+27], And[N[Not[LessEqual[z, 1.06e+129]], $MachinePrecision], LessEqual[z, 6.6e+164]]], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{+22}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.95 \cdot 10^{+27} \lor \neg \left(z \leq 1.06 \cdot 10^{+129}\right) \land z \leq 6.6 \cdot 10^{+164}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -5.50000000000000021e22 or 1.9499999999999999e27 < z < 1.06e129 or 6.59999999999999991e164 < z Initial program 72.1%
associate-/l*99.9%
remove-double-neg99.9%
distribute-frac-neg299.9%
neg-sub099.9%
remove-double-neg99.9%
unsub-neg99.9%
div-sub99.9%
*-inverses99.9%
metadata-eval99.9%
associate--r-99.9%
neg-sub099.9%
distribute-frac-neg299.9%
remove-double-neg99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in y around 0 80.3%
if -5.50000000000000021e22 < z < 1.9499999999999999e27 or 1.06e129 < z < 6.59999999999999991e164Initial program 93.9%
associate-/l*92.4%
remove-double-neg92.4%
distribute-frac-neg292.4%
neg-sub092.4%
remove-double-neg92.4%
unsub-neg92.4%
div-sub92.4%
*-inverses92.4%
metadata-eval92.4%
associate--r-92.4%
neg-sub092.4%
distribute-frac-neg292.4%
remove-double-neg92.4%
sub-neg92.4%
Simplified92.4%
Taylor expanded in y around inf 73.5%
associate-*r/69.4%
Simplified69.4%
Final simplification74.4%
(FPCore (x y z) :precision binary64 (if (<= y 1.52e+144) (* x (- (/ y z) -1.0)) (/ (+ y z) (/ z x))))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.52e+144) {
tmp = x * ((y / z) - -1.0);
} else {
tmp = (y + z) / (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.52d+144) then
tmp = x * ((y / z) - (-1.0d0))
else
tmp = (y + z) / (z / x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 1.52e+144) {
tmp = x * ((y / z) - -1.0);
} else {
tmp = (y + z) / (z / x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 1.52e+144: tmp = x * ((y / z) - -1.0) else: tmp = (y + z) / (z / x) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 1.52e+144) tmp = Float64(x * Float64(Float64(y / z) - -1.0)); else tmp = Float64(Float64(y + z) / Float64(z / x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 1.52e+144) tmp = x * ((y / z) - -1.0); else tmp = (y + z) / (z / x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 1.52e+144], N[(x * N[(N[(y / z), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(y + z), $MachinePrecision] / N[(z / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.52 \cdot 10^{+144}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - -1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y + z}{\frac{z}{x}}\\
\end{array}
\end{array}
if y < 1.52e144Initial program 84.8%
associate-/l*97.4%
remove-double-neg97.4%
distribute-frac-neg297.4%
neg-sub097.4%
remove-double-neg97.4%
unsub-neg97.4%
div-sub97.4%
*-inverses97.4%
metadata-eval97.4%
associate--r-97.4%
neg-sub097.4%
distribute-frac-neg297.4%
remove-double-neg97.4%
sub-neg97.4%
Simplified97.4%
if 1.52e144 < y Initial program 77.7%
*-commutative77.7%
associate-/l*99.7%
Simplified99.7%
clear-num99.6%
un-div-inv99.8%
Applied egg-rr99.8%
(FPCore (x y z) :precision binary64 (if (<= y 3.9e+143) (* x (- (/ y z) -1.0)) (* (+ y z) (/ x z))))
double code(double x, double y, double z) {
double tmp;
if (y <= 3.9e+143) {
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 (y <= 3.9d+143) 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 (y <= 3.9e+143) {
tmp = x * ((y / z) - -1.0);
} else {
tmp = (y + z) * (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 3.9e+143: tmp = x * ((y / z) - -1.0) else: tmp = (y + z) * (x / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 3.9e+143) 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 (y <= 3.9e+143) tmp = x * ((y / z) - -1.0); else tmp = (y + z) * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 3.9e+143], 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}\;y \leq 3.9 \cdot 10^{+143}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - -1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y + z\right) \cdot \frac{x}{z}\\
\end{array}
\end{array}
if y < 3.8999999999999998e143Initial program 84.8%
associate-/l*97.4%
remove-double-neg97.4%
distribute-frac-neg297.4%
neg-sub097.4%
remove-double-neg97.4%
unsub-neg97.4%
div-sub97.4%
*-inverses97.4%
metadata-eval97.4%
associate--r-97.4%
neg-sub097.4%
distribute-frac-neg297.4%
remove-double-neg97.4%
sub-neg97.4%
Simplified97.4%
if 3.8999999999999998e143 < y Initial program 77.7%
*-commutative77.7%
associate-/l*99.7%
Simplified99.7%
(FPCore (x y z) :precision binary64 (if (<= y 3.7e+166) (* x (- (/ y z) -1.0)) (* y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if (y <= 3.7e+166) {
tmp = x * ((y / z) - -1.0);
} else {
tmp = y * (x / z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 3.7d+166) then
tmp = x * ((y / z) - (-1.0d0))
else
tmp = y * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 3.7e+166) {
tmp = x * ((y / z) - -1.0);
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 3.7e+166: tmp = x * ((y / z) - -1.0) else: tmp = y * (x / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 3.7e+166) tmp = Float64(x * Float64(Float64(y / z) - -1.0)); else tmp = Float64(y * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 3.7e+166) tmp = x * ((y / z) - -1.0); else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 3.7e+166], N[(x * N[(N[(y / z), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.7 \cdot 10^{+166}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - -1\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if y < 3.70000000000000022e166Initial program 84.4%
associate-/l*97.4%
remove-double-neg97.4%
distribute-frac-neg297.4%
neg-sub097.4%
remove-double-neg97.4%
unsub-neg97.4%
div-sub97.4%
*-inverses97.4%
metadata-eval97.4%
associate--r-97.4%
neg-sub097.4%
distribute-frac-neg297.4%
remove-double-neg97.4%
sub-neg97.4%
Simplified97.4%
if 3.70000000000000022e166 < y Initial program 79.9%
associate-/l*79.6%
remove-double-neg79.6%
distribute-frac-neg279.6%
neg-sub079.6%
remove-double-neg79.6%
unsub-neg79.6%
div-sub79.6%
*-inverses79.6%
metadata-eval79.6%
associate--r-79.6%
neg-sub079.6%
distribute-frac-neg279.6%
remove-double-neg79.6%
sub-neg79.6%
Simplified79.6%
Taylor expanded in y around inf 79.9%
associate-*l/99.7%
*-commutative99.7%
Simplified99.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 84.0%
associate-/l*95.8%
remove-double-neg95.8%
distribute-frac-neg295.8%
neg-sub095.8%
remove-double-neg95.8%
unsub-neg95.8%
div-sub95.8%
*-inverses95.8%
metadata-eval95.8%
associate--r-95.8%
neg-sub095.8%
distribute-frac-neg295.8%
remove-double-neg95.8%
sub-neg95.8%
Simplified95.8%
Taylor expanded in y around 0 49.7%
(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 2024105
(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))