
(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 7 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
(*
x_s
(if (<= (/ (* x_m (+ y z)) z) -5e+35)
(* (+ y z) (/ x_m z))
(fma 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 (((x_m * (y + z)) / z) <= -5e+35) {
tmp = (y + z) * (x_m / z);
} else {
tmp = fma(x_m, (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 (Float64(Float64(x_m * Float64(y + z)) / z) <= -5e+35) tmp = Float64(Float64(y + z) * Float64(x_m / z)); else tmp = fma(x_m, Float64(y / z), x_m); end return Float64(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[N[(N[(x$95$m * N[(y + z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], -5e+35], N[(N[(y + z), $MachinePrecision] * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision], N[(x$95$m * N[(y / z), $MachinePrecision] + x$95$m), $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}\;\frac{x\_m \cdot \left(y + z\right)}{z} \leq -5 \cdot 10^{+35}:\\
\;\;\;\;\left(y + z\right) \cdot \frac{x\_m}{z}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x\_m, \frac{y}{z}, x\_m\right)\\
\end{array}
\end{array}
if (/.f64 (*.f64 x (+.f64 y z)) z) < -5.00000000000000021e35Initial program 79.4%
associate-*l/96.9%
*-commutative96.9%
Simplified96.9%
if -5.00000000000000021e35 < (/.f64 (*.f64 x (+.f64 y z)) z) Initial program 85.2%
remove-double-neg85.2%
distribute-lft-neg-out85.2%
*-commutative85.2%
distribute-lft-neg-in85.2%
associate-/l*81.6%
distribute-neg-in81.6%
unsub-neg81.6%
div-sub79.5%
distribute-frac-neg79.5%
associate-/r/78.7%
distribute-rgt-neg-out78.7%
remove-double-neg78.7%
associate-/r/96.0%
*-inverses96.0%
*-lft-identity96.0%
*-commutative96.0%
fma-neg96.0%
remove-double-neg96.0%
Simplified96.0%
Final simplification96.2%
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 (or (<= t_0 0.0) (not (<= t_0 1e+234))) (* (+ y z) (/ x_m z)) t_0))))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 <= 0.0) || !(t_0 <= 1e+234)) {
tmp = (y + z) * (x_m / z);
} else {
tmp = t_0;
}
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 <= 0.0d0) .or. (.not. (t_0 <= 1d+234))) then
tmp = (y + z) * (x_m / z)
else
tmp = t_0
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 <= 0.0) || !(t_0 <= 1e+234)) {
tmp = (y + z) * (x_m / z);
} else {
tmp = t_0;
}
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 <= 0.0) or not (t_0 <= 1e+234): tmp = (y + z) * (x_m / z) else: tmp = t_0 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 <= 0.0) || !(t_0 <= 1e+234)) tmp = Float64(Float64(y + z) * Float64(x_m / z)); else tmp = t_0; 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 <= 0.0) || ~((t_0 <= 1e+234))) tmp = (y + z) * (x_m / z); else tmp = t_0; 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[Or[LessEqual[t$95$0, 0.0], N[Not[LessEqual[t$95$0, 1e+234]], $MachinePrecision]], N[(N[(y + z), $MachinePrecision] * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision], t$95$0]), $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 0 \lor \neg \left(t\_0 \leq 10^{+234}\right):\\
\;\;\;\;\left(y + z\right) \cdot \frac{x\_m}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if (/.f64 (*.f64 x (+.f64 y z)) z) < 0.0 or 1.00000000000000002e234 < (/.f64 (*.f64 x (+.f64 y z)) z) Initial program 75.6%
associate-*l/89.7%
*-commutative89.7%
Simplified89.7%
if 0.0 < (/.f64 (*.f64 x (+.f64 y z)) z) < 1.00000000000000002e234Initial program 99.5%
Final simplification93.0%
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.9e+214) x_m (if (<= z 1.18e+145) (* (+ 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 <= -3.9e+214) {
tmp = x_m;
} else if (z <= 1.18e+145) {
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 <= (-3.9d+214)) then
tmp = x_m
else if (z <= 1.18d+145) 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 <= -3.9e+214) {
tmp = x_m;
} else if (z <= 1.18e+145) {
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 <= -3.9e+214: tmp = x_m elif z <= 1.18e+145: 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 <= -3.9e+214) tmp = x_m; elseif (z <= 1.18e+145) 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 <= -3.9e+214) tmp = x_m; elseif (z <= 1.18e+145) 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, -3.9e+214], x$95$m, If[LessEqual[z, 1.18e+145], 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 -3.9 \cdot 10^{+214}:\\
\;\;\;\;x\_m\\
\mathbf{elif}\;z \leq 1.18 \cdot 10^{+145}:\\
\;\;\;\;\left(y + z\right) \cdot \frac{x\_m}{z}\\
\mathbf{else}:\\
\;\;\;\;x\_m\\
\end{array}
\end{array}
if z < -3.90000000000000013e214 or 1.17999999999999998e145 < z Initial program 63.6%
associate-*l/55.1%
*-commutative55.1%
Simplified55.1%
Taylor expanded in y around 0 89.7%
if -3.90000000000000013e214 < z < 1.17999999999999998e145Initial program 89.5%
associate-*l/94.8%
*-commutative94.8%
Simplified94.8%
Final simplification93.7%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) (FPCore (x_s x_m y z) :precision binary64 (* x_s (if (or (<= y -6.8e+47) (not (<= y 9.8e-76))) (* 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 ((y <= -6.8e+47) || !(y <= 9.8e-76)) {
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 ((y <= (-6.8d+47)) .or. (.not. (y <= 9.8d-76))) 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 ((y <= -6.8e+47) || !(y <= 9.8e-76)) {
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 (y <= -6.8e+47) or not (y <= 9.8e-76): 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 ((y <= -6.8e+47) || !(y <= 9.8e-76)) 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 ((y <= -6.8e+47) || ~((y <= 9.8e-76))) 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[Or[LessEqual[y, -6.8e+47], N[Not[LessEqual[y, 9.8e-76]], $MachinePrecision]], 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}\;y \leq -6.8 \cdot 10^{+47} \lor \neg \left(y \leq 9.8 \cdot 10^{-76}\right):\\
\;\;\;\;x\_m \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x\_m\\
\end{array}
\end{array}
if y < -6.7999999999999996e47 or 9.79999999999999944e-76 < y Initial program 87.0%
associate-*l/89.2%
*-commutative89.2%
Simplified89.2%
Taylor expanded in y around inf 75.1%
associate-*r/74.3%
Simplified74.3%
if -6.7999999999999996e47 < y < 9.79999999999999944e-76Initial program 79.4%
associate-*l/81.7%
*-commutative81.7%
Simplified81.7%
Taylor expanded in y around 0 81.8%
Final simplification77.5%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) (FPCore (x_s x_m y z) :precision binary64 (* x_s (if (or (<= y -9.2e+35) (not (<= y 5.1e-76))) (* 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 ((y <= -9.2e+35) || !(y <= 5.1e-76)) {
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 ((y <= (-9.2d+35)) .or. (.not. (y <= 5.1d-76))) 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 ((y <= -9.2e+35) || !(y <= 5.1e-76)) {
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 (y <= -9.2e+35) or not (y <= 5.1e-76): 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 ((y <= -9.2e+35) || !(y <= 5.1e-76)) 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 ((y <= -9.2e+35) || ~((y <= 5.1e-76))) 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[Or[LessEqual[y, -9.2e+35], N[Not[LessEqual[y, 5.1e-76]], $MachinePrecision]], 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}\;y \leq -9.2 \cdot 10^{+35} \lor \neg \left(y \leq 5.1 \cdot 10^{-76}\right):\\
\;\;\;\;y \cdot \frac{x\_m}{z}\\
\mathbf{else}:\\
\;\;\;\;x\_m\\
\end{array}
\end{array}
if y < -9.1999999999999993e35 or 5.09999999999999986e-76 < y Initial program 87.2%
associate-*l/88.7%
*-commutative88.7%
Simplified88.7%
Taylor expanded in y around inf 74.8%
*-commutative74.8%
associate-/l*75.7%
Simplified75.7%
clear-num75.6%
associate-/r/75.7%
clear-num75.8%
Applied egg-rr75.8%
if -9.1999999999999993e35 < y < 5.09999999999999986e-76Initial program 79.0%
associate-*l/82.3%
*-commutative82.3%
Simplified82.3%
Taylor expanded in y around 0 82.4%
Final simplification78.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 -3.25e+44)
(* y (/ x_m z))
(if (<= y 1.2e-75) x_m (/ (* x_m y) z)))))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 <= -3.25e+44) {
tmp = y * (x_m / z);
} else if (y <= 1.2e-75) {
tmp = x_m;
} else {
tmp = (x_m * y) / 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) :: tmp
if (y <= (-3.25d+44)) then
tmp = y * (x_m / z)
else if (y <= 1.2d-75) then
tmp = x_m
else
tmp = (x_m * y) / 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 tmp;
if (y <= -3.25e+44) {
tmp = y * (x_m / z);
} else if (y <= 1.2e-75) {
tmp = x_m;
} else {
tmp = (x_m * y) / 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): tmp = 0 if y <= -3.25e+44: tmp = y * (x_m / z) elif y <= 1.2e-75: tmp = x_m else: tmp = (x_m * y) / z 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 <= -3.25e+44) tmp = Float64(y * Float64(x_m / z)); elseif (y <= 1.2e-75) tmp = x_m; else tmp = Float64(Float64(x_m * y) / 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) tmp = 0.0; if (y <= -3.25e+44) tmp = y * (x_m / z); elseif (y <= 1.2e-75) tmp = x_m; else tmp = (x_m * y) / 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_] := N[(x$95$s * If[LessEqual[y, -3.25e+44], N[(y * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.2e-75], x$95$m, N[(N[(x$95$m * y), $MachinePrecision] / z), $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 -3.25 \cdot 10^{+44}:\\
\;\;\;\;y \cdot \frac{x\_m}{z}\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{-75}:\\
\;\;\;\;x\_m\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m \cdot y}{z}\\
\end{array}
\end{array}
if y < -3.25000000000000009e44Initial program 80.1%
associate-*l/87.6%
*-commutative87.6%
Simplified87.6%
Taylor expanded in y around inf 71.4%
*-commutative71.4%
associate-/l*76.3%
Simplified76.3%
clear-num76.2%
associate-/r/76.3%
clear-num76.3%
Applied egg-rr76.3%
if -3.25000000000000009e44 < y < 1.2000000000000001e-75Initial program 79.0%
associate-*l/82.3%
*-commutative82.3%
Simplified82.3%
Taylor expanded in y around 0 82.4%
if 1.2000000000000001e-75 < y Initial program 92.9%
associate-*l/89.5%
*-commutative89.5%
Simplified89.5%
Taylor expanded in y around inf 77.6%
Final simplification79.3%
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 83.7%
associate-*l/86.0%
*-commutative86.0%
Simplified86.0%
Taylor expanded in y around 0 48.3%
Final simplification48.3%
(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 2024027
(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))