
(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 #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 0.0)
(* (+ y z) (/ x_m z))
(if (<= t_0 1e+290) t_0 (* 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) {
double t_0 = (x_m * (y + z)) / z;
double tmp;
if (t_0 <= 0.0) {
tmp = (y + z) * (x_m / z);
} else if (t_0 <= 1e+290) {
tmp = t_0;
} else {
tmp = x_m * ((y / z) - -1.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) then
tmp = (y + z) * (x_m / z)
else if (t_0 <= 1d+290) then
tmp = t_0
else
tmp = x_m * ((y / z) - (-1.0d0))
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) {
tmp = (y + z) * (x_m / z);
} else if (t_0 <= 1e+290) {
tmp = t_0;
} else {
tmp = x_m * ((y / z) - -1.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: tmp = (y + z) * (x_m / z) elif t_0 <= 1e+290: tmp = t_0 else: tmp = x_m * ((y / z) - -1.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) tmp = Float64(Float64(y + z) * Float64(x_m / z)); elseif (t_0 <= 1e+290) tmp = t_0; else tmp = Float64(x_m * Float64(Float64(y / z) - -1.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) tmp = (y + z) * (x_m / z); elseif (t_0 <= 1e+290) tmp = t_0; else tmp = x_m * ((y / z) - -1.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[LessEqual[t$95$0, 0.0], N[(N[(y + z), $MachinePrecision] * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e+290], t$95$0, 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)
\\
\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:\\
\;\;\;\;\left(y + z\right) \cdot \frac{x\_m}{z}\\
\mathbf{elif}\;t\_0 \leq 10^{+290}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot \left(\frac{y}{z} - -1\right)\\
\end{array}
\end{array}
\end{array}
if (/.f64 (*.f64 x (+.f64 y z)) z) < 0.0Initial program 80.3%
*-commutative80.3%
associate-/l*86.3%
Simplified86.3%
if 0.0 < (/.f64 (*.f64 x (+.f64 y z)) z) < 1.00000000000000006e290Initial program 99.7%
if 1.00000000000000006e290 < (/.f64 (*.f64 x (+.f64 y z)) z) Initial program 57.8%
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%
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 (<= z -2.9e-62) (not (<= z 5.1e-71)))
(* x_m (- (/ y z) -1.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 tmp;
if ((z <= -2.9e-62) || !(z <= 5.1e-71)) {
tmp = x_m * ((y / z) - -1.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) :: tmp
if ((z <= (-2.9d-62)) .or. (.not. (z <= 5.1d-71))) then
tmp = x_m * ((y / z) - (-1.0d0))
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 tmp;
if ((z <= -2.9e-62) || !(z <= 5.1e-71)) {
tmp = x_m * ((y / z) - -1.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): tmp = 0 if (z <= -2.9e-62) or not (z <= 5.1e-71): tmp = x_m * ((y / z) - -1.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) tmp = 0.0 if ((z <= -2.9e-62) || !(z <= 5.1e-71)) tmp = Float64(x_m * Float64(Float64(y / z) - -1.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) tmp = 0.0; if ((z <= -2.9e-62) || ~((z <= 5.1e-71))) tmp = x_m * ((y / z) - -1.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_] := N[(x$95$s * If[Or[LessEqual[z, -2.9e-62], N[Not[LessEqual[z, 5.1e-71]], $MachinePrecision]], N[(x$95$m * N[(N[(y / z), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision], 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)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -2.9 \cdot 10^{-62} \lor \neg \left(z \leq 5.1 \cdot 10^{-71}\right):\\
\;\;\;\;x\_m \cdot \left(\frac{y}{z} - -1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y + z\right) \cdot \frac{x\_m}{z}\\
\end{array}
\end{array}
if z < -2.89999999999999986e-62 or 5.1000000000000003e-71 < z Initial program 79.2%
associate-/l*99.8%
remove-double-neg99.8%
distribute-frac-neg299.8%
neg-sub099.8%
remove-double-neg99.8%
unsub-neg99.8%
div-sub99.8%
*-inverses99.8%
metadata-eval99.8%
associate--r-99.8%
neg-sub099.8%
distribute-frac-neg299.8%
remove-double-neg99.8%
sub-neg99.8%
Simplified99.8%
if -2.89999999999999986e-62 < z < 5.1000000000000003e-71Initial program 88.2%
*-commutative88.2%
associate-/l*93.2%
Simplified93.2%
Final simplification97.3%
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 (<= z -1.6e-267) (not (<= z 1.2e-79)))
(* x_m (- (/ y z) -1.0))
(/ (* 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 ((z <= -1.6e-267) || !(z <= 1.2e-79)) {
tmp = x_m * ((y / z) - -1.0);
} 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 ((z <= (-1.6d-267)) .or. (.not. (z <= 1.2d-79))) then
tmp = x_m * ((y / z) - (-1.0d0))
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 ((z <= -1.6e-267) || !(z <= 1.2e-79)) {
tmp = x_m * ((y / z) - -1.0);
} 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 (z <= -1.6e-267) or not (z <= 1.2e-79): tmp = x_m * ((y / z) - -1.0) 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 ((z <= -1.6e-267) || !(z <= 1.2e-79)) tmp = Float64(x_m * Float64(Float64(y / z) - -1.0)); 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 ((z <= -1.6e-267) || ~((z <= 1.2e-79))) tmp = x_m * ((y / z) - -1.0); 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[Or[LessEqual[z, -1.6e-267], N[Not[LessEqual[z, 1.2e-79]], $MachinePrecision]], N[(x$95$m * N[(N[(y / z), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision], 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}\;z \leq -1.6 \cdot 10^{-267} \lor \neg \left(z \leq 1.2 \cdot 10^{-79}\right):\\
\;\;\;\;x\_m \cdot \left(\frac{y}{z} - -1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m \cdot y}{z}\\
\end{array}
\end{array}
if z < -1.59999999999999993e-267 or 1.20000000000000003e-79 < z Initial program 80.3%
associate-/l*97.5%
remove-double-neg97.5%
distribute-frac-neg297.5%
neg-sub097.5%
remove-double-neg97.5%
unsub-neg97.5%
div-sub97.5%
*-inverses97.5%
metadata-eval97.5%
associate--r-97.5%
neg-sub097.5%
distribute-frac-neg297.5%
remove-double-neg97.5%
sub-neg97.5%
Simplified97.5%
if -1.59999999999999993e-267 < z < 1.20000000000000003e-79Initial program 91.3%
associate-/l*76.2%
remove-double-neg76.2%
distribute-frac-neg276.2%
neg-sub076.2%
remove-double-neg76.2%
unsub-neg76.2%
div-sub76.2%
*-inverses76.2%
metadata-eval76.2%
associate--r-76.2%
neg-sub076.2%
distribute-frac-neg276.2%
remove-double-neg76.2%
sub-neg76.2%
Simplified76.2%
Taylor expanded in y around inf 91.3%
Final simplification96.1%
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 (<= z -7.8e-19) x_m (if (<= z 1.55e+61) (/ 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 <= -7.8e-19) {
tmp = x_m;
} else if (z <= 1.55e+61) {
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 <= (-7.8d-19)) then
tmp = x_m
else if (z <= 1.55d+61) 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 <= -7.8e-19) {
tmp = x_m;
} else if (z <= 1.55e+61) {
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 <= -7.8e-19: tmp = x_m elif z <= 1.55e+61: 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 <= -7.8e-19) tmp = x_m; elseif (z <= 1.55e+61) 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 <= -7.8e-19) tmp = x_m; elseif (z <= 1.55e+61) 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, -7.8e-19], x$95$m, If[LessEqual[z, 1.55e+61], 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 -7.8 \cdot 10^{-19}:\\
\;\;\;\;x\_m\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{+61}:\\
\;\;\;\;\frac{y}{\frac{z}{x\_m}}\\
\mathbf{else}:\\
\;\;\;\;x\_m\\
\end{array}
\end{array}
if z < -7.7999999999999999e-19 or 1.55e61 < z Initial program 74.2%
associate-/l*99.8%
remove-double-neg99.8%
distribute-frac-neg299.8%
neg-sub099.8%
remove-double-neg99.8%
unsub-neg99.8%
div-sub99.8%
*-inverses99.8%
metadata-eval99.8%
associate--r-99.8%
neg-sub099.8%
distribute-frac-neg299.8%
remove-double-neg99.8%
sub-neg99.8%
Simplified99.8%
Taylor expanded in y around 0 74.0%
if -7.7999999999999999e-19 < z < 1.55e61Initial program 90.2%
associate-/l*86.6%
remove-double-neg86.6%
distribute-frac-neg286.6%
neg-sub086.6%
remove-double-neg86.6%
unsub-neg86.6%
div-sub86.6%
*-inverses86.6%
metadata-eval86.6%
associate--r-86.6%
neg-sub086.6%
distribute-frac-neg286.6%
remove-double-neg86.6%
sub-neg86.6%
Simplified86.6%
Taylor expanded in y around inf 70.0%
associate-*r/78.2%
*-commutative78.2%
associate-*r/78.2%
clear-num77.6%
un-div-inv78.8%
Applied egg-rr78.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 (<= z -7.8e-19) x_m (if (<= z 1.65e+65) (* 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 <= -7.8e-19) {
tmp = x_m;
} else if (z <= 1.65e+65) {
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 <= (-7.8d-19)) then
tmp = x_m
else if (z <= 1.65d+65) 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 <= -7.8e-19) {
tmp = x_m;
} else if (z <= 1.65e+65) {
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 <= -7.8e-19: tmp = x_m elif z <= 1.65e+65: 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 <= -7.8e-19) tmp = x_m; elseif (z <= 1.65e+65) 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 <= -7.8e-19) tmp = x_m; elseif (z <= 1.65e+65) 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, -7.8e-19], x$95$m, If[LessEqual[z, 1.65e+65], 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 -7.8 \cdot 10^{-19}:\\
\;\;\;\;x\_m\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{+65}:\\
\;\;\;\;y \cdot \frac{x\_m}{z}\\
\mathbf{else}:\\
\;\;\;\;x\_m\\
\end{array}
\end{array}
if z < -7.7999999999999999e-19 or 1.65000000000000012e65 < z Initial program 74.2%
associate-/l*99.8%
remove-double-neg99.8%
distribute-frac-neg299.8%
neg-sub099.8%
remove-double-neg99.8%
unsub-neg99.8%
div-sub99.8%
*-inverses99.8%
metadata-eval99.8%
associate--r-99.8%
neg-sub099.8%
distribute-frac-neg299.8%
remove-double-neg99.8%
sub-neg99.8%
Simplified99.8%
Taylor expanded in y around 0 74.0%
if -7.7999999999999999e-19 < z < 1.65000000000000012e65Initial program 90.2%
associate-/l*86.6%
remove-double-neg86.6%
distribute-frac-neg286.6%
neg-sub086.6%
remove-double-neg86.6%
unsub-neg86.6%
div-sub86.6%
*-inverses86.6%
metadata-eval86.6%
associate--r-86.6%
neg-sub086.6%
distribute-frac-neg286.6%
remove-double-neg86.6%
sub-neg86.6%
Simplified86.6%
Taylor expanded in y around inf 78.2%
associate-*l/78.2%
*-commutative78.2%
Simplified78.2%
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 (<= z -7e-19) x_m (if (<= z 7.5e+65) (* 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 <= -7e-19) {
tmp = x_m;
} else if (z <= 7.5e+65) {
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 <= (-7d-19)) then
tmp = x_m
else if (z <= 7.5d+65) 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 <= -7e-19) {
tmp = x_m;
} else if (z <= 7.5e+65) {
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 <= -7e-19: tmp = x_m elif z <= 7.5e+65: 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 <= -7e-19) tmp = x_m; elseif (z <= 7.5e+65) 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 <= -7e-19) tmp = x_m; elseif (z <= 7.5e+65) 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, -7e-19], x$95$m, If[LessEqual[z, 7.5e+65], 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 -7 \cdot 10^{-19}:\\
\;\;\;\;x\_m\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{+65}:\\
\;\;\;\;x\_m \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x\_m\\
\end{array}
\end{array}
if z < -7.00000000000000031e-19 or 7.50000000000000006e65 < z Initial program 74.2%
associate-/l*99.8%
remove-double-neg99.8%
distribute-frac-neg299.8%
neg-sub099.8%
remove-double-neg99.8%
unsub-neg99.8%
div-sub99.8%
*-inverses99.8%
metadata-eval99.8%
associate--r-99.8%
neg-sub099.8%
distribute-frac-neg299.8%
remove-double-neg99.8%
sub-neg99.8%
Simplified99.8%
Taylor expanded in y around 0 74.0%
if -7.00000000000000031e-19 < z < 7.50000000000000006e65Initial program 90.2%
associate-/l*86.6%
remove-double-neg86.6%
distribute-frac-neg286.6%
neg-sub086.6%
remove-double-neg86.6%
unsub-neg86.6%
div-sub86.6%
*-inverses86.6%
metadata-eval86.6%
associate--r-86.6%
neg-sub086.6%
distribute-frac-neg286.6%
remove-double-neg86.6%
sub-neg86.6%
Simplified86.6%
Taylor expanded in y around inf 70.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 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 82.7%
associate-/l*92.8%
remove-double-neg92.8%
distribute-frac-neg292.8%
neg-sub092.8%
remove-double-neg92.8%
unsub-neg92.8%
div-sub92.8%
*-inverses92.8%
metadata-eval92.8%
associate--r-92.8%
neg-sub092.8%
distribute-frac-neg292.8%
remove-double-neg92.8%
sub-neg92.8%
Simplified92.8%
Taylor expanded in y around 0 44.5%
(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 2024096
(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))