
(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}
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
:precision binary64
(let* ((t_0 (/ (* x_m (+ y z)) z)))
(*
x_s
(if (<= t_0 1e-56)
(/ x_m (/ z (+ y z)))
(if (<= t_0 2e+287) t_0 (* (+ y z) (/ x_m z)))))))x_m = fabs(x);
x_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double t_0 = (x_m * (y + z)) / z;
double tmp;
if (t_0 <= 1e-56) {
tmp = x_m / (z / (y + z));
} else if (t_0 <= 2e+287) {
tmp = t_0;
} else {
tmp = (y + z) * (x_m / z);
}
return x_s * tmp;
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (x_m * (y + z)) / z
if (t_0 <= 1d-56) then
tmp = x_m / (z / (y + z))
else if (t_0 <= 2d+287) then
tmp = t_0
else
tmp = (y + z) * (x_m / z)
end if
code = x_s * tmp
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
double t_0 = (x_m * (y + z)) / z;
double tmp;
if (t_0 <= 1e-56) {
tmp = x_m / (z / (y + z));
} else if (t_0 <= 2e+287) {
tmp = t_0;
} else {
tmp = (y + z) * (x_m / z);
}
return x_s * tmp;
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): t_0 = (x_m * (y + z)) / z tmp = 0 if t_0 <= 1e-56: tmp = x_m / (z / (y + z)) elif t_0 <= 2e+287: tmp = t_0 else: tmp = (y + z) * (x_m / z) return x_s * tmp
x_m = abs(x) x_s = copysign(1.0, x) function code(x_s, x_m, y, z) t_0 = Float64(Float64(x_m * Float64(y + z)) / z) tmp = 0.0 if (t_0 <= 1e-56) tmp = Float64(x_m / Float64(z / Float64(y + z))); elseif (t_0 <= 2e+287) tmp = t_0; else tmp = Float64(Float64(y + z) * Float64(x_m / z)); end return Float64(x_s * tmp) end
x_m = abs(x); x_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z) t_0 = (x_m * (y + z)) / z; tmp = 0.0; if (t_0 <= 1e-56) tmp = x_m / (z / (y + z)); elseif (t_0 <= 2e+287) tmp = t_0; else tmp = (y + z) * (x_m / z); end tmp_2 = x_s * tmp; end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := Block[{t$95$0 = N[(N[(x$95$m * N[(y + z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t$95$0, 1e-56], N[(x$95$m / N[(z / N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e+287], t$95$0, N[(N[(y + z), $MachinePrecision] * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
\begin{array}{l}
t_0 := \frac{x_m \cdot \left(y + z\right)}{z}\\
x_s \cdot \begin{array}{l}
\mathbf{if}\;t_0 \leq 10^{-56}:\\
\;\;\;\;\frac{x_m}{\frac{z}{y + z}}\\
\mathbf{elif}\;t_0 \leq 2 \cdot 10^{+287}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\left(y + z\right) \cdot \frac{x_m}{z}\\
\end{array}
\end{array}
\end{array}
if (/.f64 (*.f64 x (+.f64 y z)) z) < 1e-56Initial program 89.1%
associate-*l/74.2%
*-commutative74.2%
Simplified74.2%
*-commutative74.2%
associate-/r/97.0%
Applied egg-rr97.0%
if 1e-56 < (/.f64 (*.f64 x (+.f64 y z)) z) < 2.0000000000000002e287Initial program 99.6%
if 2.0000000000000002e287 < (/.f64 (*.f64 x (+.f64 y z)) z) Initial program 55.3%
associate-*l/97.7%
*-commutative97.7%
Simplified97.7%
Final simplification97.6%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) (FPCore (x_s x_m y z) :precision binary64 (* x_s (if (<= z -2.35e+130) x_m (if (<= z 5e+236) (* (+ y z) (/ x_m z)) x_m))))
x_m = fabs(x);
x_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if (z <= -2.35e+130) {
tmp = x_m;
} else if (z <= 5e+236) {
tmp = (y + z) * (x_m / z);
} else {
tmp = x_m;
}
return x_s * tmp;
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-2.35d+130)) then
tmp = x_m
else if (z <= 5d+236) then
tmp = (y + z) * (x_m / z)
else
tmp = x_m
end if
code = x_s * tmp
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if (z <= -2.35e+130) {
tmp = x_m;
} else if (z <= 5e+236) {
tmp = (y + z) * (x_m / z);
} else {
tmp = x_m;
}
return x_s * tmp;
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): tmp = 0 if z <= -2.35e+130: tmp = x_m elif z <= 5e+236: tmp = (y + z) * (x_m / z) else: tmp = x_m return x_s * tmp
x_m = abs(x) x_s = copysign(1.0, x) function code(x_s, x_m, y, z) tmp = 0.0 if (z <= -2.35e+130) tmp = x_m; elseif (z <= 5e+236) tmp = Float64(Float64(y + z) * Float64(x_m / z)); else tmp = x_m; end return Float64(x_s * tmp) end
x_m = abs(x); x_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z) tmp = 0.0; if (z <= -2.35e+130) tmp = x_m; elseif (z <= 5e+236) tmp = (y + z) * (x_m / z); else tmp = x_m; end tmp_2 = x_s * tmp; end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[z, -2.35e+130], x$95$m, If[LessEqual[z, 5e+236], N[(N[(y + z), $MachinePrecision] * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision], x$95$m]]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
x_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -2.35 \cdot 10^{+130}:\\
\;\;\;\;x_m\\
\mathbf{elif}\;z \leq 5 \cdot 10^{+236}:\\
\;\;\;\;\left(y + z\right) \cdot \frac{x_m}{z}\\
\mathbf{else}:\\
\;\;\;\;x_m\\
\end{array}
\end{array}
if z < -2.35000000000000023e130 or 4.9999999999999997e236 < z Initial program 74.6%
associate-*l/57.5%
*-commutative57.5%
Simplified57.5%
Taylor expanded in y around 0 88.3%
if -2.35000000000000023e130 < z < 4.9999999999999997e236Initial program 89.3%
associate-*l/89.1%
*-commutative89.1%
Simplified89.1%
Final simplification88.9%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) (FPCore (x_s x_m y z) :precision binary64 (* x_s (if (<= z -3.1e+120) x_m (if (<= z 2.35e-64) (* x_m (/ y z)) x_m))))
x_m = fabs(x);
x_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if (z <= -3.1e+120) {
tmp = x_m;
} else if (z <= 2.35e-64) {
tmp = x_m * (y / z);
} else {
tmp = x_m;
}
return x_s * tmp;
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-3.1d+120)) then
tmp = x_m
else if (z <= 2.35d-64) then
tmp = x_m * (y / z)
else
tmp = x_m
end if
code = x_s * tmp
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if (z <= -3.1e+120) {
tmp = x_m;
} else if (z <= 2.35e-64) {
tmp = x_m * (y / z);
} else {
tmp = x_m;
}
return x_s * tmp;
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): tmp = 0 if z <= -3.1e+120: tmp = x_m elif z <= 2.35e-64: tmp = x_m * (y / z) else: tmp = x_m return x_s * tmp
x_m = abs(x) x_s = copysign(1.0, x) function code(x_s, x_m, y, z) tmp = 0.0 if (z <= -3.1e+120) tmp = x_m; elseif (z <= 2.35e-64) tmp = Float64(x_m * Float64(y / z)); else tmp = x_m; end return Float64(x_s * tmp) end
x_m = abs(x); x_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z) tmp = 0.0; if (z <= -3.1e+120) tmp = x_m; elseif (z <= 2.35e-64) tmp = x_m * (y / z); else tmp = x_m; end tmp_2 = x_s * tmp; end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[z, -3.1e+120], x$95$m, If[LessEqual[z, 2.35e-64], N[(x$95$m * N[(y / z), $MachinePrecision]), $MachinePrecision], x$95$m]]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
x_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -3.1 \cdot 10^{+120}:\\
\;\;\;\;x_m\\
\mathbf{elif}\;z \leq 2.35 \cdot 10^{-64}:\\
\;\;\;\;x_m \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x_m\\
\end{array}
\end{array}
if z < -3.09999999999999974e120 or 2.3499999999999999e-64 < z Initial program 80.6%
associate-*l/72.2%
*-commutative72.2%
Simplified72.2%
Taylor expanded in y around 0 73.1%
if -3.09999999999999974e120 < z < 2.3499999999999999e-64Initial program 91.0%
associate-*l/91.2%
*-commutative91.2%
Simplified91.2%
Taylor expanded in y around inf 74.2%
associate-*r/69.7%
Simplified69.7%
Final simplification71.3%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) (FPCore (x_s x_m y z) :precision binary64 (* x_s (if (<= z -3.1e+120) x_m (if (<= z 9e-62) (* y (/ x_m z)) x_m))))
x_m = fabs(x);
x_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if (z <= -3.1e+120) {
tmp = x_m;
} else if (z <= 9e-62) {
tmp = y * (x_m / z);
} else {
tmp = x_m;
}
return x_s * tmp;
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-3.1d+120)) then
tmp = x_m
else if (z <= 9d-62) then
tmp = y * (x_m / z)
else
tmp = x_m
end if
code = x_s * tmp
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if (z <= -3.1e+120) {
tmp = x_m;
} else if (z <= 9e-62) {
tmp = y * (x_m / z);
} else {
tmp = x_m;
}
return x_s * tmp;
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): tmp = 0 if z <= -3.1e+120: tmp = x_m elif z <= 9e-62: tmp = y * (x_m / z) else: tmp = x_m return x_s * tmp
x_m = abs(x) x_s = copysign(1.0, x) function code(x_s, x_m, y, z) tmp = 0.0 if (z <= -3.1e+120) tmp = x_m; elseif (z <= 9e-62) tmp = Float64(y * Float64(x_m / z)); else tmp = x_m; end return Float64(x_s * tmp) end
x_m = abs(x); x_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z) tmp = 0.0; if (z <= -3.1e+120) tmp = x_m; elseif (z <= 9e-62) tmp = y * (x_m / z); else tmp = x_m; end tmp_2 = x_s * tmp; end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[z, -3.1e+120], x$95$m, If[LessEqual[z, 9e-62], N[(y * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision], x$95$m]]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
x_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -3.1 \cdot 10^{+120}:\\
\;\;\;\;x_m\\
\mathbf{elif}\;z \leq 9 \cdot 10^{-62}:\\
\;\;\;\;y \cdot \frac{x_m}{z}\\
\mathbf{else}:\\
\;\;\;\;x_m\\
\end{array}
\end{array}
if z < -3.09999999999999974e120 or 9.00000000000000036e-62 < z Initial program 80.6%
associate-*l/72.2%
*-commutative72.2%
Simplified72.2%
Taylor expanded in y around 0 73.1%
if -3.09999999999999974e120 < z < 9.00000000000000036e-62Initial program 91.0%
associate-*l/91.2%
*-commutative91.2%
Simplified91.2%
Taylor expanded in y around inf 74.2%
associate-/l*71.2%
associate-/r/75.9%
Applied egg-rr75.9%
Final simplification74.6%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) (FPCore (x_s x_m y z) :precision binary64 (* x_s (if (<= z -3.1e+120) x_m (if (<= z 6e-62) (/ y (/ z x_m)) x_m))))
x_m = fabs(x);
x_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if (z <= -3.1e+120) {
tmp = x_m;
} else if (z <= 6e-62) {
tmp = y / (z / x_m);
} else {
tmp = x_m;
}
return x_s * tmp;
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-3.1d+120)) then
tmp = x_m
else if (z <= 6d-62) then
tmp = y / (z / x_m)
else
tmp = x_m
end if
code = x_s * tmp
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if (z <= -3.1e+120) {
tmp = x_m;
} else if (z <= 6e-62) {
tmp = y / (z / x_m);
} else {
tmp = x_m;
}
return x_s * tmp;
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): tmp = 0 if z <= -3.1e+120: tmp = x_m elif z <= 6e-62: tmp = y / (z / x_m) else: tmp = x_m return x_s * tmp
x_m = abs(x) x_s = copysign(1.0, x) function code(x_s, x_m, y, z) tmp = 0.0 if (z <= -3.1e+120) tmp = x_m; elseif (z <= 6e-62) tmp = Float64(y / Float64(z / x_m)); else tmp = x_m; end return Float64(x_s * tmp) end
x_m = abs(x); x_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z) tmp = 0.0; if (z <= -3.1e+120) tmp = x_m; elseif (z <= 6e-62) tmp = y / (z / x_m); else tmp = x_m; end tmp_2 = x_s * tmp; end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[z, -3.1e+120], x$95$m, If[LessEqual[z, 6e-62], N[(y / N[(z / x$95$m), $MachinePrecision]), $MachinePrecision], x$95$m]]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
x_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -3.1 \cdot 10^{+120}:\\
\;\;\;\;x_m\\
\mathbf{elif}\;z \leq 6 \cdot 10^{-62}:\\
\;\;\;\;\frac{y}{\frac{z}{x_m}}\\
\mathbf{else}:\\
\;\;\;\;x_m\\
\end{array}
\end{array}
if z < -3.09999999999999974e120 or 6.0000000000000002e-62 < z Initial program 80.6%
associate-*l/72.2%
*-commutative72.2%
Simplified72.2%
Taylor expanded in y around 0 73.1%
if -3.09999999999999974e120 < z < 6.0000000000000002e-62Initial program 91.0%
associate-*l/91.2%
*-commutative91.2%
Simplified91.2%
Taylor expanded in y around inf 74.2%
associate-*r/69.7%
Simplified69.7%
associate-*r/74.2%
*-commutative74.2%
associate-/l*75.9%
Applied egg-rr75.9%
Final simplification74.6%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) (FPCore (x_s x_m y z) :precision binary64 (* x_s (if (<= y 6e+260) (+ x_m (* x_m (/ y z))) (/ y (/ z x_m)))))
x_m = fabs(x);
x_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if (y <= 6e+260) {
tmp = x_m + (x_m * (y / z));
} else {
tmp = y / (z / x_m);
}
return x_s * tmp;
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 6d+260) then
tmp = x_m + (x_m * (y / z))
else
tmp = y / (z / x_m)
end if
code = x_s * tmp
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if (y <= 6e+260) {
tmp = x_m + (x_m * (y / z));
} else {
tmp = y / (z / x_m);
}
return x_s * tmp;
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): tmp = 0 if y <= 6e+260: tmp = x_m + (x_m * (y / z)) else: tmp = y / (z / x_m) return x_s * tmp
x_m = abs(x) x_s = copysign(1.0, x) function code(x_s, x_m, y, z) tmp = 0.0 if (y <= 6e+260) tmp = Float64(x_m + Float64(x_m * Float64(y / z))); else tmp = Float64(y / Float64(z / x_m)); end return Float64(x_s * tmp) end
x_m = abs(x); x_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z) tmp = 0.0; if (y <= 6e+260) tmp = x_m + (x_m * (y / z)); else tmp = y / (z / x_m); end tmp_2 = x_s * tmp; end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[y, 6e+260], N[(x$95$m + N[(x$95$m * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / N[(z / x$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
x_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq 6 \cdot 10^{+260}:\\
\;\;\;\;x_m + x_m \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{z}{x_m}}\\
\end{array}
\end{array}
if y < 5.9999999999999996e260Initial program 86.1%
remove-double-neg86.1%
distribute-lft-neg-out86.1%
*-commutative86.1%
distribute-lft-neg-in86.1%
associate-/l*80.3%
distribute-neg-in80.3%
unsub-neg80.3%
div-sub76.5%
distribute-frac-neg76.5%
associate-/r/75.6%
distribute-rgt-neg-out75.6%
remove-double-neg75.6%
associate-/r/95.6%
*-inverses95.6%
*-lft-identity95.6%
*-commutative95.6%
fma-neg95.6%
remove-double-neg95.6%
Simplified95.6%
fma-udef95.6%
Applied egg-rr95.6%
if 5.9999999999999996e260 < y Initial program 84.1%
associate-*l/99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in y around inf 84.1%
associate-*r/61.9%
Simplified61.9%
associate-*r/84.1%
*-commutative84.1%
associate-/l*99.9%
Applied egg-rr99.9%
Final simplification95.8%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) (FPCore (x_s x_m y z) :precision binary64 (* x_s (if (<= y 1.4e+261) (/ x_m (/ z (+ y z))) (/ y (/ z x_m)))))
x_m = fabs(x);
x_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
double tmp;
if (y <= 1.4e+261) {
tmp = x_m / (z / (y + z));
} else {
tmp = y / (z / x_m);
}
return x_s * tmp;
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 1.4d+261) then
tmp = x_m / (z / (y + z))
else
tmp = y / (z / x_m)
end if
code = x_s * tmp
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
double tmp;
if (y <= 1.4e+261) {
tmp = x_m / (z / (y + z));
} else {
tmp = y / (z / x_m);
}
return x_s * tmp;
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): tmp = 0 if y <= 1.4e+261: tmp = x_m / (z / (y + z)) else: tmp = y / (z / x_m) return x_s * tmp
x_m = abs(x) x_s = copysign(1.0, x) function code(x_s, x_m, y, z) tmp = 0.0 if (y <= 1.4e+261) tmp = Float64(x_m / Float64(z / Float64(y + z))); else tmp = Float64(y / Float64(z / x_m)); end return Float64(x_s * tmp) end
x_m = abs(x); x_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z) tmp = 0.0; if (y <= 1.4e+261) tmp = x_m / (z / (y + z)); else tmp = y / (z / x_m); end tmp_2 = x_s * tmp; end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[y, 1.4e+261], N[(x$95$m / N[(z / N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / N[(z / x$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
x_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq 1.4 \cdot 10^{+261}:\\
\;\;\;\;\frac{x_m}{\frac{z}{y + z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{z}{x_m}}\\
\end{array}
\end{array}
if y < 1.3999999999999999e261Initial program 86.1%
associate-*l/81.3%
*-commutative81.3%
Simplified81.3%
*-commutative81.3%
associate-/r/96.4%
Applied egg-rr96.4%
if 1.3999999999999999e261 < y Initial program 84.1%
associate-*l/99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in y around inf 84.1%
associate-*r/61.9%
Simplified61.9%
associate-*r/84.1%
*-commutative84.1%
associate-/l*99.9%
Applied egg-rr99.9%
Final simplification96.6%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) (FPCore (x_s x_m y z) :precision binary64 (* x_s x_m))
x_m = fabs(x);
x_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
return x_s * x_m;
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x_s * x_m
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
return x_s * x_m;
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): return x_s * x_m
x_m = abs(x) x_s = copysign(1.0, x) function code(x_s, x_m, y, z) return Float64(x_s * x_m) end
x_m = abs(x); x_s = sign(x) * abs(1.0); function tmp = code(x_s, x_m, y, z) tmp = x_s * x_m; end
x_m = N[Abs[x], $MachinePrecision]
x_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * x$95$m), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x_s = \mathsf{copysign}\left(1, x\right)
\\
x_s \cdot x_m
\end{array}
Initial program 86.0%
associate-*l/82.2%
*-commutative82.2%
Simplified82.2%
Taylor expanded in y around 0 45.2%
Final simplification45.2%
(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 2023321
(FPCore (x y z)
:name "Numeric.SpecFunctions:choose from math-functions-0.1.5.2"
:precision binary64
:herbie-target
(/ x (/ z (+ y z)))
(/ (* x (+ y z)) z))