
(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 (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 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 = 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) 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 = 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_] := 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[(y / z), $MachinePrecision] + x$95$m), $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}:\\
\;\;\;\;\mathsf{fma}\left(x\_m, \frac{y}{z}, x\_m\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%
Applied egg-rr86.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/99.9%
remove-double-neg99.9%
unsub-neg99.9%
distribute-rgt-out--83.3%
associate-*r/62.8%
*-commutative62.8%
associate-*r/83.3%
associate-*r/57.4%
distribute-lft-neg-out57.4%
distribute-frac-neg57.4%
distribute-frac-neg257.4%
fma-neg57.4%
distribute-frac-neg57.4%
distribute-lft-neg-out57.4%
*-commutative57.4%
associate-/l*100.0%
*-inverses100.0%
*-rgt-identity100.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
(let* ((t_0 (/ (* x_m (+ y z)) z)))
(*
x_s
(if (or (<= t_0 0.0) (not (<= t_0 1e+305))) (* (+ 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+305)) {
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+305))) 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+305)) {
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+305): 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+305)) 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+305))) 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+305]], $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^{+305}\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 9.9999999999999994e304 < (/.f64 (*.f64 x (+.f64 y z)) z) Initial program 74.9%
*-commutative74.9%
associate-/l*89.5%
Applied egg-rr89.5%
if 0.0 < (/.f64 (*.f64 x (+.f64 y z)) z) < 9.9999999999999994e304Initial program 99.7%
Final simplification92.7%
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.5e+163) (not (<= z 7.5e+146))) x_m (* (+ 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.5e+163) || !(z <= 7.5e+146)) {
tmp = x_m;
} 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.5d+163)) .or. (.not. (z <= 7.5d+146))) then
tmp = x_m
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.5e+163) || !(z <= 7.5e+146)) {
tmp = x_m;
} 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.5e+163) or not (z <= 7.5e+146): tmp = x_m 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.5e+163) || !(z <= 7.5e+146)) tmp = x_m; 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.5e+163) || ~((z <= 7.5e+146))) tmp = x_m; 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.5e+163], N[Not[LessEqual[z, 7.5e+146]], $MachinePrecision]], x$95$m, 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.5 \cdot 10^{+163} \lor \neg \left(z \leq 7.5 \cdot 10^{+146}\right):\\
\;\;\;\;x\_m\\
\mathbf{else}:\\
\;\;\;\;\left(y + z\right) \cdot \frac{x\_m}{z}\\
\end{array}
\end{array}
if z < -2.5e163 or 7.49999999999999983e146 < z Initial program 66.3%
Taylor expanded in y around 0 86.2%
if -2.5e163 < z < 7.49999999999999983e146Initial program 88.1%
*-commutative88.1%
associate-/l*93.6%
Applied egg-rr93.6%
Final simplification91.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 (<= z -5.2e-19) (not (<= z 2.45e+62))) 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 <= -5.2e-19) || !(z <= 2.45e+62)) {
tmp = x_m;
} 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 ((z <= (-5.2d-19)) .or. (.not. (z <= 2.45d+62))) then
tmp = x_m
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 ((z <= -5.2e-19) || !(z <= 2.45e+62)) {
tmp = x_m;
} 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 (z <= -5.2e-19) or not (z <= 2.45e+62): tmp = x_m 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 ((z <= -5.2e-19) || !(z <= 2.45e+62)) tmp = x_m; 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 ((z <= -5.2e-19) || ~((z <= 2.45e+62))) tmp = x_m; 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[Or[LessEqual[z, -5.2e-19], N[Not[LessEqual[z, 2.45e+62]], $MachinePrecision]], x$95$m, 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}\;z \leq -5.2 \cdot 10^{-19} \lor \neg \left(z \leq 2.45 \cdot 10^{+62}\right):\\
\;\;\;\;x\_m\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{z}{x\_m}}\\
\end{array}
\end{array}
if z < -5.20000000000000026e-19 or 2.4499999999999998e62 < z Initial program 74.2%
Taylor expanded in y around 0 74.0%
if -5.20000000000000026e-19 < z < 2.4499999999999998e62Initial program 90.2%
Taylor expanded in y around inf 78.2%
*-commutative78.2%
associate-/l*78.2%
Applied egg-rr78.2%
clear-num77.6%
un-div-inv78.8%
Applied egg-rr78.8%
Final simplification76.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 (or (<= z -7.8e-19) (not (<= z 1.4e+62))) 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 ((z <= -7.8e-19) || !(z <= 1.4e+62)) {
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 ((z <= (-7.8d-19)) .or. (.not. (z <= 1.4d+62))) 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 ((z <= -7.8e-19) || !(z <= 1.4e+62)) {
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 (z <= -7.8e-19) or not (z <= 1.4e+62): 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 ((z <= -7.8e-19) || !(z <= 1.4e+62)) 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 ((z <= -7.8e-19) || ~((z <= 1.4e+62))) 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[Or[LessEqual[z, -7.8e-19], N[Not[LessEqual[z, 1.4e+62]], $MachinePrecision]], 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}\;z \leq -7.8 \cdot 10^{-19} \lor \neg \left(z \leq 1.4 \cdot 10^{+62}\right):\\
\;\;\;\;x\_m\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x\_m}{z}\\
\end{array}
\end{array}
if z < -7.7999999999999999e-19 or 1.40000000000000007e62 < z Initial program 74.2%
Taylor expanded in y around 0 74.0%
if -7.7999999999999999e-19 < z < 1.40000000000000007e62Initial program 90.2%
Taylor expanded in y around inf 78.2%
*-commutative78.2%
associate-/l*78.2%
Applied egg-rr78.2%
Final simplification76.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 (or (<= z -7.8e-19) (not (<= z 1.45e+64))) 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 ((z <= -7.8e-19) || !(z <= 1.45e+64)) {
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 ((z <= (-7.8d-19)) .or. (.not. (z <= 1.45d+64))) 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 ((z <= -7.8e-19) || !(z <= 1.45e+64)) {
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 (z <= -7.8e-19) or not (z <= 1.45e+64): 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 ((z <= -7.8e-19) || !(z <= 1.45e+64)) tmp = x_m; else tmp = Float64(x_m * Float64(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 <= -7.8e-19) || ~((z <= 1.45e+64))) 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[Or[LessEqual[z, -7.8e-19], N[Not[LessEqual[z, 1.45e+64]], $MachinePrecision]], x$95$m, N[(x$95$m * N[(y / 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 -7.8 \cdot 10^{-19} \lor \neg \left(z \leq 1.45 \cdot 10^{+64}\right):\\
\;\;\;\;x\_m\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot \frac{y}{z}\\
\end{array}
\end{array}
if z < -7.7999999999999999e-19 or 1.44999999999999997e64 < z Initial program 74.2%
Taylor expanded in y around 0 74.0%
if -7.7999999999999999e-19 < z < 1.44999999999999997e64Initial program 90.2%
Taylor expanded in y around inf 78.2%
associate-*r/70.0%
Simplified70.0%
Final simplification71.9%
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%
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))