
(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 9 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 #s(literal 1 binary64) x) (FPCore (x_s x_m y z) :precision binary64 (let* ((t_0 (/ (* x_m (+ y z)) z))) (* x_s (if (<= t_0 -2e-56) t_0 (+ x_m (/ x_m (/ z y)))))))
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 <= -2e-56) {
tmp = t_0;
} else {
tmp = x_m + (x_m / (z / y));
}
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 <= (-2d-56)) then
tmp = t_0
else
tmp = x_m + (x_m / (z / y))
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 <= -2e-56) {
tmp = t_0;
} else {
tmp = x_m + (x_m / (z / y));
}
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 <= -2e-56: tmp = t_0 else: tmp = x_m + (x_m / (z / y)) 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 <= -2e-56) tmp = t_0; else tmp = Float64(x_m + Float64(x_m / Float64(z / y))); 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 <= -2e-56) tmp = t_0; else tmp = x_m + (x_m / (z / y)); 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, -2e-56], t$95$0, N[(x$95$m + N[(x$95$m / N[(z / y), $MachinePrecision]), $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 -2 \cdot 10^{-56}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;x\_m + \frac{x\_m}{\frac{z}{y}}\\
\end{array}
\end{array}
\end{array}
if (/.f64 (*.f64 x (+.f64 y z)) z) < -2.0000000000000001e-56Initial program 88.3%
if -2.0000000000000001e-56 < (/.f64 (*.f64 x (+.f64 y z)) z) Initial program 84.7%
associate-/l*96.7%
remove-double-neg96.7%
distribute-frac-neg296.7%
neg-sub096.7%
remove-double-neg96.7%
unsub-neg96.7%
div-sub96.7%
*-inverses96.7%
metadata-eval96.7%
associate--r-96.7%
neg-sub096.7%
distribute-frac-neg296.7%
remove-double-neg96.7%
sub-neg96.7%
Simplified96.7%
sub-neg96.7%
metadata-eval96.7%
distribute-rgt-in96.7%
*-un-lft-identity96.7%
Applied egg-rr96.7%
clear-num96.7%
associate-*l/96.7%
*-un-lft-identity96.7%
Applied egg-rr96.7%
Final simplification94.0%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y z) :precision binary64 (* x_s (if (or (<= y -1.48e-133) (not (<= y 2e+83))) (/ (* 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 <= -1.48e-133) || !(y <= 2e+83)) {
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 <= (-1.48d-133)) .or. (.not. (y <= 2d+83))) 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 <= -1.48e-133) || !(y <= 2e+83)) {
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 <= -1.48e-133) or not (y <= 2e+83): 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 <= -1.48e-133) || !(y <= 2e+83)) tmp = Float64(Float64(x_m * 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 <= -1.48e-133) || ~((y <= 2e+83))) 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, -1.48e-133], N[Not[LessEqual[y, 2e+83]], $MachinePrecision]], N[(N[(x$95$m * y), $MachinePrecision] / z), $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 -1.48 \cdot 10^{-133} \lor \neg \left(y \leq 2 \cdot 10^{+83}\right):\\
\;\;\;\;\frac{x\_m \cdot y}{z}\\
\mathbf{else}:\\
\;\;\;\;x\_m\\
\end{array}
\end{array}
if y < -1.48e-133 or 2.00000000000000006e83 < y Initial program 88.3%
Taylor expanded in y around inf 74.2%
*-commutative74.2%
Simplified74.2%
if -1.48e-133 < y < 2.00000000000000006e83Initial program 83.2%
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.5%
Final simplification75.8%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y z) :precision binary64 (* x_s (if (or (<= y -1.48e-133) (not (<= y 5.6e+82))) (* 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 <= -1.48e-133) || !(y <= 5.6e+82)) {
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 <= (-1.48d-133)) .or. (.not. (y <= 5.6d+82))) 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 <= -1.48e-133) || !(y <= 5.6e+82)) {
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 <= -1.48e-133) or not (y <= 5.6e+82): 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 <= -1.48e-133) || !(y <= 5.6e+82)) 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 <= -1.48e-133) || ~((y <= 5.6e+82))) 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, -1.48e-133], N[Not[LessEqual[y, 5.6e+82]], $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 -1.48 \cdot 10^{-133} \lor \neg \left(y \leq 5.6 \cdot 10^{+82}\right):\\
\;\;\;\;x\_m \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x\_m\\
\end{array}
\end{array}
if y < -1.48e-133 or 5.6000000000000001e82 < y Initial program 88.3%
associate-/l*91.4%
remove-double-neg91.4%
distribute-frac-neg291.4%
neg-sub091.4%
remove-double-neg91.4%
unsub-neg91.4%
div-sub91.4%
*-inverses91.4%
metadata-eval91.4%
associate--r-91.4%
neg-sub091.4%
distribute-frac-neg291.4%
remove-double-neg91.4%
sub-neg91.4%
Simplified91.4%
Taylor expanded in y around inf 69.8%
if -1.48e-133 < y < 5.6000000000000001e82Initial program 83.2%
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.5%
Final simplification73.5%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= y -1.48e-133)
(/ x_m (/ z y))
(if (<= y 5.4e+81) x_m (* y (/ 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 tmp;
if (y <= -1.48e-133) {
tmp = x_m / (z / y);
} else if (y <= 5.4e+81) {
tmp = x_m;
} else {
tmp = y * (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) :: tmp
if (y <= (-1.48d-133)) then
tmp = x_m / (z / y)
else if (y <= 5.4d+81) then
tmp = x_m
else
tmp = y * (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 tmp;
if (y <= -1.48e-133) {
tmp = x_m / (z / y);
} else if (y <= 5.4e+81) {
tmp = x_m;
} else {
tmp = y * (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): tmp = 0 if y <= -1.48e-133: tmp = x_m / (z / y) elif y <= 5.4e+81: tmp = x_m else: tmp = y * (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) tmp = 0.0 if (y <= -1.48e-133) tmp = Float64(x_m / Float64(z / y)); elseif (y <= 5.4e+81) tmp = x_m; else tmp = Float64(y * 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) tmp = 0.0; if (y <= -1.48e-133) tmp = x_m / (z / y); elseif (y <= 5.4e+81) tmp = x_m; else tmp = y * (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_] := N[(x$95$s * If[LessEqual[y, -1.48e-133], N[(x$95$m / N[(z / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.4e+81], x$95$m, N[(y * N[(x$95$m / z), $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.48 \cdot 10^{-133}:\\
\;\;\;\;\frac{x\_m}{\frac{z}{y}}\\
\mathbf{elif}\;y \leq 5.4 \cdot 10^{+81}:\\
\;\;\;\;x\_m\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x\_m}{z}\\
\end{array}
\end{array}
if y < -1.48e-133Initial program 85.0%
associate-/l*94.6%
remove-double-neg94.6%
distribute-frac-neg294.6%
neg-sub094.6%
remove-double-neg94.6%
unsub-neg94.6%
div-sub94.6%
*-inverses94.6%
metadata-eval94.6%
associate--r-94.6%
neg-sub094.6%
distribute-frac-neg294.6%
remove-double-neg94.6%
sub-neg94.6%
Simplified94.6%
Taylor expanded in y around inf 68.1%
clear-num68.1%
div-inv68.4%
Applied egg-rr68.4%
if -1.48e-133 < y < 5.3999999999999999e81Initial program 83.2%
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.5%
if 5.3999999999999999e81 < y Initial program 95.4%
associate-/l*84.8%
remove-double-neg84.8%
distribute-frac-neg284.8%
neg-sub084.8%
remove-double-neg84.8%
unsub-neg84.8%
div-sub84.8%
*-inverses84.8%
metadata-eval84.8%
associate--r-84.8%
neg-sub084.8%
distribute-frac-neg284.8%
remove-double-neg84.8%
sub-neg84.8%
Simplified84.8%
Taylor expanded in y around inf 86.1%
associate-*l/80.4%
*-commutative80.4%
Simplified80.4%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= y -1.48e-133)
(* x_m (/ y z))
(if (<= y 6.5e+81) x_m (* y (/ 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 tmp;
if (y <= -1.48e-133) {
tmp = x_m * (y / z);
} else if (y <= 6.5e+81) {
tmp = x_m;
} else {
tmp = y * (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) :: tmp
if (y <= (-1.48d-133)) then
tmp = x_m * (y / z)
else if (y <= 6.5d+81) then
tmp = x_m
else
tmp = y * (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 tmp;
if (y <= -1.48e-133) {
tmp = x_m * (y / z);
} else if (y <= 6.5e+81) {
tmp = x_m;
} else {
tmp = y * (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): tmp = 0 if y <= -1.48e-133: tmp = x_m * (y / z) elif y <= 6.5e+81: tmp = x_m else: tmp = y * (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) tmp = 0.0 if (y <= -1.48e-133) tmp = Float64(x_m * Float64(y / z)); elseif (y <= 6.5e+81) tmp = x_m; else tmp = Float64(y * 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) tmp = 0.0; if (y <= -1.48e-133) tmp = x_m * (y / z); elseif (y <= 6.5e+81) tmp = x_m; else tmp = y * (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_] := N[(x$95$s * If[LessEqual[y, -1.48e-133], N[(x$95$m * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.5e+81], x$95$m, N[(y * N[(x$95$m / z), $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.48 \cdot 10^{-133}:\\
\;\;\;\;x\_m \cdot \frac{y}{z}\\
\mathbf{elif}\;y \leq 6.5 \cdot 10^{+81}:\\
\;\;\;\;x\_m\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x\_m}{z}\\
\end{array}
\end{array}
if y < -1.48e-133Initial program 85.0%
associate-/l*94.6%
remove-double-neg94.6%
distribute-frac-neg294.6%
neg-sub094.6%
remove-double-neg94.6%
unsub-neg94.6%
div-sub94.6%
*-inverses94.6%
metadata-eval94.6%
associate--r-94.6%
neg-sub094.6%
distribute-frac-neg294.6%
remove-double-neg94.6%
sub-neg94.6%
Simplified94.6%
Taylor expanded in y around inf 68.1%
if -1.48e-133 < y < 6.4999999999999996e81Initial program 83.2%
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.5%
if 6.4999999999999996e81 < y Initial program 95.4%
associate-/l*84.8%
remove-double-neg84.8%
distribute-frac-neg284.8%
neg-sub084.8%
remove-double-neg84.8%
unsub-neg84.8%
div-sub84.8%
*-inverses84.8%
metadata-eval84.8%
associate--r-84.8%
neg-sub084.8%
distribute-frac-neg284.8%
remove-double-neg84.8%
sub-neg84.8%
Simplified84.8%
Taylor expanded in y around inf 86.1%
associate-*l/80.4%
*-commutative80.4%
Simplified80.4%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y z) :precision binary64 (* x_s (+ x_m (/ x_m (/ z y)))))
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 / (z / y)));
}
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 + (x_m / (z / y)))
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 / (z / y)));
}
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 / (z / y)))
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z) return Float64(x_s * Float64(x_m + Float64(x_m / Float64(z / y)))) 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 + (x_m / (z / y))); 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 * N[(x$95$m + N[(x$95$m / N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \left(x\_m + \frac{x\_m}{\frac{z}{y}}\right)
\end{array}
Initial program 85.9%
associate-/l*95.5%
remove-double-neg95.5%
distribute-frac-neg295.5%
neg-sub095.5%
remove-double-neg95.5%
unsub-neg95.5%
div-sub95.5%
*-inverses95.5%
metadata-eval95.5%
associate--r-95.5%
neg-sub095.5%
distribute-frac-neg295.5%
remove-double-neg95.5%
sub-neg95.5%
Simplified95.5%
sub-neg95.5%
metadata-eval95.5%
distribute-rgt-in95.5%
*-un-lft-identity95.5%
Applied egg-rr95.5%
clear-num95.4%
associate-*l/95.6%
*-un-lft-identity95.6%
Applied egg-rr95.6%
Final simplification95.6%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y z) :precision binary64 (* x_s (+ 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) {
return x_s * (x_m + (x_m * (y / z)));
}
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 + (x_m * (y / z)))
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 * (y / z)));
}
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 * (y / z)))
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z) return Float64(x_s * Float64(x_m + Float64(x_m * Float64(y / z)))) 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 + (x_m * (y / z))); 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 * N[(x$95$m + N[(x$95$m * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \left(x\_m + x\_m \cdot \frac{y}{z}\right)
\end{array}
Initial program 85.9%
associate-/l*95.5%
remove-double-neg95.5%
distribute-frac-neg295.5%
neg-sub095.5%
remove-double-neg95.5%
unsub-neg95.5%
div-sub95.5%
*-inverses95.5%
metadata-eval95.5%
associate--r-95.5%
neg-sub095.5%
distribute-frac-neg295.5%
remove-double-neg95.5%
sub-neg95.5%
Simplified95.5%
sub-neg95.5%
metadata-eval95.5%
distribute-rgt-in95.5%
*-un-lft-identity95.5%
Applied egg-rr95.5%
Final simplification95.5%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y z) :precision binary64 (* x_s (* x_m (- (/ y z) -1.0))))
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 * ((y / z) - -1.0));
}
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 * ((y / z) - (-1.0d0)))
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 * ((y / z) - -1.0));
}
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 * ((y / z) - -1.0))
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z) return Float64(x_s * Float64(x_m * Float64(Float64(y / z) - -1.0))) 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 * ((y / z) - -1.0)); 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 * N[(x$95$m * N[(N[(y / z), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \left(x\_m \cdot \left(\frac{y}{z} - -1\right)\right)
\end{array}
Initial program 85.9%
associate-/l*95.5%
remove-double-neg95.5%
distribute-frac-neg295.5%
neg-sub095.5%
remove-double-neg95.5%
unsub-neg95.5%
div-sub95.5%
*-inverses95.5%
metadata-eval95.5%
associate--r-95.5%
neg-sub095.5%
distribute-frac-neg295.5%
remove-double-neg95.5%
sub-neg95.5%
Simplified95.5%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) 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 85.9%
associate-/l*95.5%
remove-double-neg95.5%
distribute-frac-neg295.5%
neg-sub095.5%
remove-double-neg95.5%
unsub-neg95.5%
div-sub95.5%
*-inverses95.5%
metadata-eval95.5%
associate--r-95.5%
neg-sub095.5%
distribute-frac-neg295.5%
remove-double-neg95.5%
sub-neg95.5%
Simplified95.5%
Taylor expanded in y around 0 49.8%
(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 2024141
(FPCore (x y z)
:name "Numeric.SpecFunctions:choose from math-functions-0.1.5.2"
:precision binary64
:alt
(! :herbie-platform default (/ x (/ z (+ y z))))
(/ (* x (+ y z)) z))