
(FPCore (x y z) :precision binary64 (/ (* x (+ (- y z) 1.0)) z))
double code(double x, double y, double z) {
return (x * ((y - z) + 1.0)) / 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) + 1.0d0)) / z
end function
public static double code(double x, double y, double z) {
return (x * ((y - z) + 1.0)) / z;
}
def code(x, y, z): return (x * ((y - z) + 1.0)) / z
function code(x, y, z) return Float64(Float64(x * Float64(Float64(y - z) + 1.0)) / z) end
function tmp = code(x, y, z) tmp = (x * ((y - z) + 1.0)) / z; end
code[x_, y_, z_] := N[(N[(x * N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (* x (+ (- y z) 1.0)) z))
double code(double x, double y, double z) {
return (x * ((y - z) + 1.0)) / 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) + 1.0d0)) / z
end function
public static double code(double x, double y, double z) {
return (x * ((y - z) + 1.0)) / z;
}
def code(x, y, z): return (x * ((y - z) + 1.0)) / z
function code(x, y, z) return Float64(Float64(x * Float64(Float64(y - z) + 1.0)) / z) end
function tmp = code(x, y, z) tmp = (x * ((y - z) + 1.0)) / z; end
code[x_, y_, z_] := N[(N[(x * N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(\left(y - z\right) + 1\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 (+ (- y z) 1.0))) (* x_s (if (<= x_m 3e+22) (/ (* x_m t_0) z) (* x_m (/ t_0 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 = (y - z) + 1.0;
double tmp;
if (x_m <= 3e+22) {
tmp = (x_m * t_0) / z;
} else {
tmp = x_m * (t_0 / 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 = (y - z) + 1.0d0
if (x_m <= 3d+22) then
tmp = (x_m * t_0) / z
else
tmp = x_m * (t_0 / 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 = (y - z) + 1.0;
double tmp;
if (x_m <= 3e+22) {
tmp = (x_m * t_0) / z;
} else {
tmp = x_m * (t_0 / 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 = (y - z) + 1.0 tmp = 0 if x_m <= 3e+22: tmp = (x_m * t_0) / z else: tmp = x_m * (t_0 / 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(y - z) + 1.0) tmp = 0.0 if (x_m <= 3e+22) tmp = Float64(Float64(x_m * t_0) / z); else tmp = Float64(x_m * Float64(t_0 / 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 = (y - z) + 1.0; tmp = 0.0; if (x_m <= 3e+22) tmp = (x_m * t_0) / z; else tmp = x_m * (t_0 / 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[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]}, N[(x$95$s * If[LessEqual[x$95$m, 3e+22], N[(N[(x$95$m * t$95$0), $MachinePrecision] / z), $MachinePrecision], N[(x$95$m * N[(t$95$0 / 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 := \left(y - z\right) + 1\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \leq 3 \cdot 10^{+22}:\\
\;\;\;\;\frac{x\_m \cdot t\_0}{z}\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot \frac{t\_0}{z}\\
\end{array}
\end{array}
\end{array}
if x < 3e22Initial program 95.2%
if 3e22 < x Initial program 76.9%
associate-/l*99.9%
Simplified99.9%
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 (* y (/ x_m z))))
(*
x_s
(if (<= y -2.6)
t_0
(if (<= y 8e-294)
(- x_m)
(if (<= y 1.85e-50) (/ x_m z) (if (<= y 2e+54) (- x_m) 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 = y * (x_m / z);
double tmp;
if (y <= -2.6) {
tmp = t_0;
} else if (y <= 8e-294) {
tmp = -x_m;
} else if (y <= 1.85e-50) {
tmp = x_m / z;
} else if (y <= 2e+54) {
tmp = -x_m;
} 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 = y * (x_m / z)
if (y <= (-2.6d0)) then
tmp = t_0
else if (y <= 8d-294) then
tmp = -x_m
else if (y <= 1.85d-50) then
tmp = x_m / z
else if (y <= 2d+54) then
tmp = -x_m
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 = y * (x_m / z);
double tmp;
if (y <= -2.6) {
tmp = t_0;
} else if (y <= 8e-294) {
tmp = -x_m;
} else if (y <= 1.85e-50) {
tmp = x_m / z;
} else if (y <= 2e+54) {
tmp = -x_m;
} 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 = y * (x_m / z) tmp = 0 if y <= -2.6: tmp = t_0 elif y <= 8e-294: tmp = -x_m elif y <= 1.85e-50: tmp = x_m / z elif y <= 2e+54: tmp = -x_m 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(y * Float64(x_m / z)) tmp = 0.0 if (y <= -2.6) tmp = t_0; elseif (y <= 8e-294) tmp = Float64(-x_m); elseif (y <= 1.85e-50) tmp = Float64(x_m / z); elseif (y <= 2e+54) tmp = Float64(-x_m); 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 = y * (x_m / z); tmp = 0.0; if (y <= -2.6) tmp = t_0; elseif (y <= 8e-294) tmp = -x_m; elseif (y <= 1.85e-50) tmp = x_m / z; elseif (y <= 2e+54) tmp = -x_m; 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[(y * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[y, -2.6], t$95$0, If[LessEqual[y, 8e-294], (-x$95$m), If[LessEqual[y, 1.85e-50], N[(x$95$m / z), $MachinePrecision], If[LessEqual[y, 2e+54], (-x$95$m), 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 := y \cdot \frac{x\_m}{z}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -2.6:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 8 \cdot 10^{-294}:\\
\;\;\;\;-x\_m\\
\mathbf{elif}\;y \leq 1.85 \cdot 10^{-50}:\\
\;\;\;\;\frac{x\_m}{z}\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+54}:\\
\;\;\;\;-x\_m\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if y < -2.60000000000000009 or 2.0000000000000002e54 < y Initial program 92.6%
associate-/l*89.6%
Simplified89.6%
Taylor expanded in y around inf 77.8%
*-commutative77.8%
associate-/l*76.1%
Applied egg-rr76.1%
if -2.60000000000000009 < y < 8.00000000000000013e-294 or 1.85e-50 < y < 2.0000000000000002e54Initial program 86.9%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in z around inf 62.1%
neg-mul-162.1%
Simplified62.1%
if 8.00000000000000013e-294 < y < 1.85e-50Initial program 94.7%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in z around 0 63.3%
associate-/l*63.1%
Simplified63.1%
Taylor expanded in y around 0 63.3%
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))))
(*
x_s
(if (<= y -2.6)
t_0
(if (<= y 1.9e-292)
(- x_m)
(if (<= y 2.1e-54) (/ x_m z) (if (<= y 1.45e+51) (- x_m) 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);
double tmp;
if (y <= -2.6) {
tmp = t_0;
} else if (y <= 1.9e-292) {
tmp = -x_m;
} else if (y <= 2.1e-54) {
tmp = x_m / z;
} else if (y <= 1.45e+51) {
tmp = -x_m;
} 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)
if (y <= (-2.6d0)) then
tmp = t_0
else if (y <= 1.9d-292) then
tmp = -x_m
else if (y <= 2.1d-54) then
tmp = x_m / z
else if (y <= 1.45d+51) then
tmp = -x_m
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);
double tmp;
if (y <= -2.6) {
tmp = t_0;
} else if (y <= 1.9e-292) {
tmp = -x_m;
} else if (y <= 2.1e-54) {
tmp = x_m / z;
} else if (y <= 1.45e+51) {
tmp = -x_m;
} 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) tmp = 0 if y <= -2.6: tmp = t_0 elif y <= 1.9e-292: tmp = -x_m elif y <= 2.1e-54: tmp = x_m / z elif y <= 1.45e+51: tmp = -x_m 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(x_m * Float64(y / z)) tmp = 0.0 if (y <= -2.6) tmp = t_0; elseif (y <= 1.9e-292) tmp = Float64(-x_m); elseif (y <= 2.1e-54) tmp = Float64(x_m / z); elseif (y <= 1.45e+51) tmp = Float64(-x_m); 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); tmp = 0.0; if (y <= -2.6) tmp = t_0; elseif (y <= 1.9e-292) tmp = -x_m; elseif (y <= 2.1e-54) tmp = x_m / z; elseif (y <= 1.45e+51) tmp = -x_m; 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[(x$95$m * N[(y / z), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[y, -2.6], t$95$0, If[LessEqual[y, 1.9e-292], (-x$95$m), If[LessEqual[y, 2.1e-54], N[(x$95$m / z), $MachinePrecision], If[LessEqual[y, 1.45e+51], (-x$95$m), 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 := x\_m \cdot \frac{y}{z}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -2.6:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{-292}:\\
\;\;\;\;-x\_m\\
\mathbf{elif}\;y \leq 2.1 \cdot 10^{-54}:\\
\;\;\;\;\frac{x\_m}{z}\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{+51}:\\
\;\;\;\;-x\_m\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if y < -2.60000000000000009 or 1.4499999999999999e51 < y Initial program 92.6%
associate-/l*89.6%
Simplified89.6%
Taylor expanded in y around inf 77.8%
associate-/l*70.4%
Simplified70.4%
if -2.60000000000000009 < y < 1.9000000000000001e-292 or 2.1e-54 < y < 1.4499999999999999e51Initial program 86.9%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in z around inf 62.1%
neg-mul-162.1%
Simplified62.1%
if 1.9000000000000001e-292 < y < 2.1e-54Initial program 94.7%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in z around 0 63.3%
associate-/l*63.1%
Simplified63.1%
Taylor expanded in y around 0 63.3%
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 (+ (- y z) 1.0)))
(*
x_s
(if (or (<= z -1.8e+75) (not (<= z 1e-37)))
(* x_m (/ t_0 z))
(* t_0 (/ 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 = (y - z) + 1.0;
double tmp;
if ((z <= -1.8e+75) || !(z <= 1e-37)) {
tmp = x_m * (t_0 / z);
} else {
tmp = t_0 * (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 = (y - z) + 1.0d0
if ((z <= (-1.8d+75)) .or. (.not. (z <= 1d-37))) then
tmp = x_m * (t_0 / z)
else
tmp = t_0 * (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 = (y - z) + 1.0;
double tmp;
if ((z <= -1.8e+75) || !(z <= 1e-37)) {
tmp = x_m * (t_0 / z);
} else {
tmp = t_0 * (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 = (y - z) + 1.0 tmp = 0 if (z <= -1.8e+75) or not (z <= 1e-37): tmp = x_m * (t_0 / z) else: tmp = t_0 * (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(y - z) + 1.0) tmp = 0.0 if ((z <= -1.8e+75) || !(z <= 1e-37)) tmp = Float64(x_m * Float64(t_0 / z)); else tmp = Float64(t_0 * 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 = (y - z) + 1.0; tmp = 0.0; if ((z <= -1.8e+75) || ~((z <= 1e-37))) tmp = x_m * (t_0 / z); else tmp = t_0 * (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[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]}, N[(x$95$s * If[Or[LessEqual[z, -1.8e+75], N[Not[LessEqual[z, 1e-37]], $MachinePrecision]], N[(x$95$m * N[(t$95$0 / z), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * 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 := \left(y - z\right) + 1\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{+75} \lor \neg \left(z \leq 10^{-37}\right):\\
\;\;\;\;x\_m \cdot \frac{t\_0}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \frac{x\_m}{z}\\
\end{array}
\end{array}
\end{array}
if z < -1.8e75 or 1.00000000000000007e-37 < z Initial program 81.3%
associate-/l*99.9%
Simplified99.9%
if -1.8e75 < z < 1.00000000000000007e-37Initial program 99.9%
associate-/l*89.8%
Simplified89.8%
Taylor expanded in x around 0 99.9%
associate--l+99.9%
+-commutative99.9%
associate-*l/99.8%
+-commutative99.8%
Simplified99.8%
Final simplification99.8%
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 (+ (- y z) 1.0)))
(*
x_s
(if (<= z -2e-15)
(/ x_m (/ z t_0))
(if (<= z 1.2e-37) (* t_0 (/ x_m z)) (* x_m (/ t_0 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 = (y - z) + 1.0;
double tmp;
if (z <= -2e-15) {
tmp = x_m / (z / t_0);
} else if (z <= 1.2e-37) {
tmp = t_0 * (x_m / z);
} else {
tmp = x_m * (t_0 / 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 = (y - z) + 1.0d0
if (z <= (-2d-15)) then
tmp = x_m / (z / t_0)
else if (z <= 1.2d-37) then
tmp = t_0 * (x_m / z)
else
tmp = x_m * (t_0 / 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 = (y - z) + 1.0;
double tmp;
if (z <= -2e-15) {
tmp = x_m / (z / t_0);
} else if (z <= 1.2e-37) {
tmp = t_0 * (x_m / z);
} else {
tmp = x_m * (t_0 / 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 = (y - z) + 1.0 tmp = 0 if z <= -2e-15: tmp = x_m / (z / t_0) elif z <= 1.2e-37: tmp = t_0 * (x_m / z) else: tmp = x_m * (t_0 / 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(y - z) + 1.0) tmp = 0.0 if (z <= -2e-15) tmp = Float64(x_m / Float64(z / t_0)); elseif (z <= 1.2e-37) tmp = Float64(t_0 * Float64(x_m / z)); else tmp = Float64(x_m * Float64(t_0 / 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 = (y - z) + 1.0; tmp = 0.0; if (z <= -2e-15) tmp = x_m / (z / t_0); elseif (z <= 1.2e-37) tmp = t_0 * (x_m / z); else tmp = x_m * (t_0 / 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[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]}, N[(x$95$s * If[LessEqual[z, -2e-15], N[(x$95$m / N[(z / t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.2e-37], N[(t$95$0 * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision], N[(x$95$m * N[(t$95$0 / 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 := \left(y - z\right) + 1\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -2 \cdot 10^{-15}:\\
\;\;\;\;\frac{x\_m}{\frac{z}{t\_0}}\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{-37}:\\
\;\;\;\;t\_0 \cdot \frac{x\_m}{z}\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot \frac{t\_0}{z}\\
\end{array}
\end{array}
\end{array}
if z < -2.0000000000000002e-15Initial program 87.2%
associate-/l*99.9%
Simplified99.9%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
if -2.0000000000000002e-15 < z < 1.19999999999999995e-37Initial program 99.9%
associate-/l*87.5%
Simplified87.5%
Taylor expanded in x around 0 99.9%
associate--l+99.9%
+-commutative99.9%
associate-*l/99.8%
+-commutative99.8%
Simplified99.8%
if 1.19999999999999995e-37 < z Initial program 81.5%
associate-/l*99.9%
Simplified99.9%
Final simplification99.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 (if (or (<= y -2.6) (not (<= y 3e+58))) (/ (* x_m 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 ((y <= -2.6) || !(y <= 3e+58)) {
tmp = (x_m * y) / z;
} else {
tmp = (x_m / 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 <= (-2.6d0)) .or. (.not. (y <= 3d+58))) then
tmp = (x_m * y) / z
else
tmp = (x_m / 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 <= -2.6) || !(y <= 3e+58)) {
tmp = (x_m * y) / z;
} else {
tmp = (x_m / 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 <= -2.6) or not (y <= 3e+58): tmp = (x_m * y) / z else: tmp = (x_m / 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 <= -2.6) || !(y <= 3e+58)) tmp = Float64(Float64(x_m * y) / z); else tmp = Float64(Float64(x_m / 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 <= -2.6) || ~((y <= 3e+58))) tmp = (x_m * y) / z; else tmp = (x_m / 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[y, -2.6], N[Not[LessEqual[y, 3e+58]], $MachinePrecision]], N[(N[(x$95$m * y), $MachinePrecision] / z), $MachinePrecision], N[(N[(x$95$m / 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}\;y \leq -2.6 \lor \neg \left(y \leq 3 \cdot 10^{+58}\right):\\
\;\;\;\;\frac{x\_m \cdot y}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{z} - x\_m\\
\end{array}
\end{array}
if y < -2.60000000000000009 or 3.0000000000000002e58 < y Initial program 92.6%
associate-/l*89.6%
Simplified89.6%
Taylor expanded in y around inf 77.8%
if -2.60000000000000009 < y < 3.0000000000000002e58Initial program 89.1%
associate-/l*99.8%
Simplified99.8%
clear-num99.8%
un-div-inv100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 96.8%
Taylor expanded in x around 0 85.9%
associate-/l*96.6%
div-sub96.6%
*-rgt-identity96.6%
associate-*r/96.5%
rgt-mult-inverse96.6%
sub-neg96.6%
metadata-eval96.6%
distribute-lft-in96.6%
associate-/l*96.8%
*-rgt-identity96.8%
*-commutative96.8%
neg-mul-196.8%
unsub-neg96.8%
Simplified96.8%
Final simplification87.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 (<= y -2.4) (not (<= y 4e+52))) (* y (/ x_m 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 ((y <= -2.4) || !(y <= 4e+52)) {
tmp = y * (x_m / z);
} else {
tmp = (x_m / 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 <= (-2.4d0)) .or. (.not. (y <= 4d+52))) then
tmp = y * (x_m / z)
else
tmp = (x_m / 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 <= -2.4) || !(y <= 4e+52)) {
tmp = y * (x_m / z);
} else {
tmp = (x_m / 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 <= -2.4) or not (y <= 4e+52): tmp = y * (x_m / z) else: tmp = (x_m / 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 <= -2.4) || !(y <= 4e+52)) tmp = Float64(y * Float64(x_m / z)); else tmp = Float64(Float64(x_m / 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 <= -2.4) || ~((y <= 4e+52))) tmp = y * (x_m / z); else tmp = (x_m / 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[y, -2.4], N[Not[LessEqual[y, 4e+52]], $MachinePrecision]], N[(y * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / 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}\;y \leq -2.4 \lor \neg \left(y \leq 4 \cdot 10^{+52}\right):\\
\;\;\;\;y \cdot \frac{x\_m}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{z} - x\_m\\
\end{array}
\end{array}
if y < -2.39999999999999991 or 4e52 < y Initial program 92.6%
associate-/l*89.6%
Simplified89.6%
Taylor expanded in y around inf 77.8%
*-commutative77.8%
associate-/l*76.1%
Applied egg-rr76.1%
if -2.39999999999999991 < y < 4e52Initial program 89.1%
associate-/l*99.8%
Simplified99.8%
clear-num99.8%
un-div-inv100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 96.8%
Taylor expanded in x around 0 85.9%
associate-/l*96.6%
div-sub96.6%
*-rgt-identity96.6%
associate-*r/96.5%
rgt-mult-inverse96.6%
sub-neg96.6%
metadata-eval96.6%
distribute-lft-in96.6%
associate-/l*96.8%
*-rgt-identity96.8%
*-commutative96.8%
neg-mul-196.8%
unsub-neg96.8%
Simplified96.8%
Final simplification86.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 -5.2e-12)
(* x_m (/ (+ y 1.0) z))
(if (<= y 1.3e+51) (- (/ x_m z) 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 <= -5.2e-12) {
tmp = x_m * ((y + 1.0) / z);
} else if (y <= 1.3e+51) {
tmp = (x_m / z) - 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 <= (-5.2d-12)) then
tmp = x_m * ((y + 1.0d0) / z)
else if (y <= 1.3d+51) then
tmp = (x_m / z) - 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 <= -5.2e-12) {
tmp = x_m * ((y + 1.0) / z);
} else if (y <= 1.3e+51) {
tmp = (x_m / z) - 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 <= -5.2e-12: tmp = x_m * ((y + 1.0) / z) elif y <= 1.3e+51: tmp = (x_m / z) - 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 <= -5.2e-12) tmp = Float64(x_m * Float64(Float64(y + 1.0) / z)); elseif (y <= 1.3e+51) tmp = Float64(Float64(x_m / z) - 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 <= -5.2e-12) tmp = x_m * ((y + 1.0) / z); elseif (y <= 1.3e+51) tmp = (x_m / z) - 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, -5.2e-12], N[(x$95$m * N[(N[(y + 1.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.3e+51], N[(N[(x$95$m / z), $MachinePrecision] - x$95$m), $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}\;y \leq -5.2 \cdot 10^{-12}:\\
\;\;\;\;x\_m \cdot \frac{y + 1}{z}\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{+51}:\\
\;\;\;\;\frac{x\_m}{z} - x\_m\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m \cdot y}{z}\\
\end{array}
\end{array}
if y < -5.19999999999999965e-12Initial program 92.4%
associate-/l*94.8%
Simplified94.8%
Taylor expanded in z around 0 79.0%
associate-/l*76.4%
Simplified76.4%
if -5.19999999999999965e-12 < y < 1.3000000000000001e51Initial program 88.7%
associate-/l*99.8%
Simplified99.8%
clear-num99.8%
un-div-inv100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 97.9%
Taylor expanded in x around 0 86.6%
associate-/l*97.7%
div-sub97.7%
*-rgt-identity97.7%
associate-*r/97.6%
rgt-mult-inverse97.7%
sub-neg97.7%
metadata-eval97.7%
distribute-lft-in97.7%
associate-/l*97.9%
*-rgt-identity97.9%
*-commutative97.9%
neg-mul-197.9%
unsub-neg97.9%
Simplified97.9%
if 1.3000000000000001e51 < y Initial program 93.2%
associate-/l*83.5%
Simplified83.5%
Taylor expanded in y around inf 78.8%
Final simplification87.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 -2.6)
(* y (/ x_m z))
(if (<= y 1.7e+51) (- (/ x_m z) 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 <= -2.6) {
tmp = y * (x_m / z);
} else if (y <= 1.7e+51) {
tmp = (x_m / z) - 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 (y <= (-2.6d0)) then
tmp = y * (x_m / z)
else if (y <= 1.7d+51) then
tmp = (x_m / z) - 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 (y <= -2.6) {
tmp = y * (x_m / z);
} else if (y <= 1.7e+51) {
tmp = (x_m / z) - 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 y <= -2.6: tmp = y * (x_m / z) elif y <= 1.7e+51: tmp = (x_m / z) - 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 (y <= -2.6) tmp = Float64(y * Float64(x_m / z)); elseif (y <= 1.7e+51) tmp = Float64(Float64(x_m / z) - 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 (y <= -2.6) tmp = y * (x_m / z); elseif (y <= 1.7e+51) tmp = (x_m / z) - 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[LessEqual[y, -2.6], N[(y * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.7e+51], N[(N[(x$95$m / z), $MachinePrecision] - x$95$m), $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 -2.6:\\
\;\;\;\;y \cdot \frac{x\_m}{z}\\
\mathbf{elif}\;y \leq 1.7 \cdot 10^{+51}:\\
\;\;\;\;\frac{x\_m}{z} - x\_m\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{z}{x\_m}}\\
\end{array}
\end{array}
if y < -2.60000000000000009Initial program 92.0%
associate-/l*94.5%
Simplified94.5%
Taylor expanded in y around inf 77.0%
*-commutative77.0%
associate-/l*75.5%
Applied egg-rr75.5%
if -2.60000000000000009 < y < 1.69999999999999992e51Initial program 89.1%
associate-/l*99.8%
Simplified99.8%
clear-num99.8%
un-div-inv100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 96.8%
Taylor expanded in x around 0 85.9%
associate-/l*96.6%
div-sub96.6%
*-rgt-identity96.6%
associate-*r/96.5%
rgt-mult-inverse96.6%
sub-neg96.6%
metadata-eval96.6%
distribute-lft-in96.6%
associate-/l*96.8%
*-rgt-identity96.8%
*-commutative96.8%
neg-mul-196.8%
unsub-neg96.8%
Simplified96.8%
if 1.69999999999999992e51 < y Initial program 93.2%
associate-/l*83.5%
Simplified83.5%
clear-num83.4%
un-div-inv85.2%
Applied egg-rr85.2%
Taylor expanded in y around inf 67.3%
associate-/r/76.8%
Applied egg-rr76.8%
*-commutative76.8%
clear-num76.8%
un-div-inv76.9%
Applied egg-rr76.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 (if (or (<= z -1.0) (not (<= z 1.22e-23))) (- x_m) (/ 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 <= -1.0) || !(z <= 1.22e-23)) {
tmp = -x_m;
} else {
tmp = 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 <= (-1.0d0)) .or. (.not. (z <= 1.22d-23))) then
tmp = -x_m
else
tmp = 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 <= -1.0) || !(z <= 1.22e-23)) {
tmp = -x_m;
} else {
tmp = 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 <= -1.0) or not (z <= 1.22e-23): tmp = -x_m else: tmp = 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 <= -1.0) || !(z <= 1.22e-23)) tmp = Float64(-x_m); else tmp = 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 <= -1.0) || ~((z <= 1.22e-23))) tmp = -x_m; else tmp = 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, -1.0], N[Not[LessEqual[z, 1.22e-23]], $MachinePrecision]], (-x$95$m), N[(x$95$m / 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 \lor \neg \left(z \leq 1.22 \cdot 10^{-23}\right):\\
\;\;\;\;-x\_m\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{z}\\
\end{array}
\end{array}
if z < -1 or 1.22000000000000007e-23 < z Initial program 83.5%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in z around inf 66.4%
neg-mul-166.4%
Simplified66.4%
if -1 < z < 1.22000000000000007e-23Initial program 99.9%
associate-/l*88.3%
Simplified88.3%
Taylor expanded in z around 0 99.3%
associate-/l*87.7%
Simplified87.7%
Taylor expanded in y around 0 52.8%
Final simplification60.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 (* x_m (/ (+ (- y z) 1.0) 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 * (((y - z) + 1.0) / 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 * (((y - z) + 1.0d0) / 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 * (((y - z) + 1.0) / 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 * (((y - z) + 1.0) / 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(Float64(Float64(y - z) + 1.0) / 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 * (((y - z) + 1.0) / 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[(N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision] / z), $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 \frac{\left(y - z\right) + 1}{z}\right)
\end{array}
Initial program 90.8%
associate-/l*94.7%
Simplified94.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 (- 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 * Float64(-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 \left(-x\_m\right)
\end{array}
Initial program 90.8%
associate-/l*94.7%
Simplified94.7%
Taylor expanded in z around inf 38.3%
neg-mul-138.3%
Simplified38.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 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 90.8%
associate-/l*94.7%
Simplified94.7%
Taylor expanded in z around inf 38.3%
neg-mul-138.3%
Simplified38.3%
neg-sub038.3%
sub-neg38.3%
add-sqr-sqrt17.5%
sqrt-unprod15.7%
sqr-neg15.7%
sqrt-unprod1.4%
add-sqr-sqrt2.9%
Applied egg-rr2.9%
+-lft-identity2.9%
Simplified2.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (* (+ 1.0 y) (/ x z)) x)))
(if (< x -2.71483106713436e-162)
t_0
(if (< x 3.874108816439546e-197)
(* (* x (+ (- y z) 1.0)) (/ 1.0 z))
t_0))))
double code(double x, double y, double z) {
double t_0 = ((1.0 + y) * (x / z)) - x;
double tmp;
if (x < -2.71483106713436e-162) {
tmp = t_0;
} else if (x < 3.874108816439546e-197) {
tmp = (x * ((y - z) + 1.0)) * (1.0 / z);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = ((1.0d0 + y) * (x / z)) - x
if (x < (-2.71483106713436d-162)) then
tmp = t_0
else if (x < 3.874108816439546d-197) then
tmp = (x * ((y - z) + 1.0d0)) * (1.0d0 / z)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = ((1.0 + y) * (x / z)) - x;
double tmp;
if (x < -2.71483106713436e-162) {
tmp = t_0;
} else if (x < 3.874108816439546e-197) {
tmp = (x * ((y - z) + 1.0)) * (1.0 / z);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = ((1.0 + y) * (x / z)) - x tmp = 0 if x < -2.71483106713436e-162: tmp = t_0 elif x < 3.874108816439546e-197: tmp = (x * ((y - z) + 1.0)) * (1.0 / z) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(1.0 + y) * Float64(x / z)) - x) tmp = 0.0 if (x < -2.71483106713436e-162) tmp = t_0; elseif (x < 3.874108816439546e-197) tmp = Float64(Float64(x * Float64(Float64(y - z) + 1.0)) * Float64(1.0 / z)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = ((1.0 + y) * (x / z)) - x; tmp = 0.0; if (x < -2.71483106713436e-162) tmp = t_0; elseif (x < 3.874108816439546e-197) tmp = (x * ((y - z) + 1.0)) * (1.0 / z); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(1.0 + y), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]}, If[Less[x, -2.71483106713436e-162], t$95$0, If[Less[x, 3.874108816439546e-197], N[(N[(x * N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * N[(1.0 / z), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 + y\right) \cdot \frac{x}{z} - x\\
\mathbf{if}\;x < -2.71483106713436 \cdot 10^{-162}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x < 3.874108816439546 \cdot 10^{-197}:\\
\;\;\;\;\left(x \cdot \left(\left(y - z\right) + 1\right)\right) \cdot \frac{1}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
herbie shell --seed 2024130
(FPCore (x y z)
:name "Diagrams.TwoD.Segment.Bernstein:evaluateBernstein from diagrams-lib-1.3.0.3"
:precision binary64
:alt
(! :herbie-platform default (if (< x -67870776678359/25000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (* (+ 1 y) (/ x z)) x) (if (< x 1937054408219773/50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (* (* x (+ (- y z) 1)) (/ 1 z)) (- (* (+ 1 y) (/ x z)) x))))
(/ (* x (+ (- y z) 1.0)) z))