
(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 15 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 1 x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= x_m 2e-91)
(- (/ (* x_m (+ 1.0 y)) z) x_m)
(- (* (+ 1.0 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 (x_m <= 2e-91) {
tmp = ((x_m * (1.0 + y)) / z) - x_m;
} else {
tmp = ((1.0 + y) * (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 (x_m <= 2d-91) then
tmp = ((x_m * (1.0d0 + y)) / z) - x_m
else
tmp = ((1.0d0 + y) * (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 (x_m <= 2e-91) {
tmp = ((x_m * (1.0 + y)) / z) - x_m;
} else {
tmp = ((1.0 + y) * (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 x_m <= 2e-91: tmp = ((x_m * (1.0 + y)) / z) - x_m else: tmp = ((1.0 + y) * (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 (x_m <= 2e-91) tmp = Float64(Float64(Float64(x_m * Float64(1.0 + y)) / z) - x_m); else tmp = Float64(Float64(Float64(1.0 + y) * 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 (x_m <= 2e-91) tmp = ((x_m * (1.0 + y)) / z) - x_m; else tmp = ((1.0 + y) * (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[LessEqual[x$95$m, 2e-91], N[(N[(N[(x$95$m * N[(1.0 + y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] - x$95$m), $MachinePrecision], N[(N[(N[(1.0 + y), $MachinePrecision] * N[(x$95$m / z), $MachinePrecision]), $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}\;x_m \leq 2 \cdot 10^{-91}:\\
\;\;\;\;\frac{x_m \cdot \left(1 + y\right)}{z} - x_m\\
\mathbf{else}:\\
\;\;\;\;\left(1 + y\right) \cdot \frac{x_m}{z} - x_m\\
\end{array}
\end{array}
if x < 2.00000000000000004e-91Initial program 93.2%
Taylor expanded in z around 0 98.2%
if 2.00000000000000004e-91 < x Initial program 81.3%
Taylor expanded in z around 0 94.5%
+-commutative94.5%
neg-mul-194.5%
unsub-neg94.5%
associate-/l*99.9%
associate-/r/99.9%
Applied egg-rr99.9%
Final simplification98.8%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= y -3.8e+84)
(* x_m (/ y z))
(if (<= y -3.5e+48)
(- x_m)
(if (or (<= y -22000000000000.0) (not (<= y 3.7e+33)))
(* 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 <= -3.8e+84) {
tmp = x_m * (y / z);
} else if (y <= -3.5e+48) {
tmp = -x_m;
} else if ((y <= -22000000000000.0) || !(y <= 3.7e+33)) {
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 <= (-3.8d+84)) then
tmp = x_m * (y / z)
else if (y <= (-3.5d+48)) then
tmp = -x_m
else if ((y <= (-22000000000000.0d0)) .or. (.not. (y <= 3.7d+33))) 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 <= -3.8e+84) {
tmp = x_m * (y / z);
} else if (y <= -3.5e+48) {
tmp = -x_m;
} else if ((y <= -22000000000000.0) || !(y <= 3.7e+33)) {
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 <= -3.8e+84: tmp = x_m * (y / z) elif y <= -3.5e+48: tmp = -x_m elif (y <= -22000000000000.0) or not (y <= 3.7e+33): 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 <= -3.8e+84) tmp = Float64(x_m * Float64(y / z)); elseif (y <= -3.5e+48) tmp = Float64(-x_m); elseif ((y <= -22000000000000.0) || !(y <= 3.7e+33)) 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 <= -3.8e+84) tmp = x_m * (y / z); elseif (y <= -3.5e+48) tmp = -x_m; elseif ((y <= -22000000000000.0) || ~((y <= 3.7e+33))) 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[LessEqual[y, -3.8e+84], N[(x$95$m * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -3.5e+48], (-x$95$m), If[Or[LessEqual[y, -22000000000000.0], N[Not[LessEqual[y, 3.7e+33]], $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 -3.8 \cdot 10^{+84}:\\
\;\;\;\;x_m \cdot \frac{y}{z}\\
\mathbf{elif}\;y \leq -3.5 \cdot 10^{+48}:\\
\;\;\;\;-x_m\\
\mathbf{elif}\;y \leq -22000000000000 \lor \neg \left(y \leq 3.7 \cdot 10^{+33}\right):\\
\;\;\;\;y \cdot \frac{x_m}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x_m}{z} - x_m\\
\end{array}
\end{array}
if y < -3.8000000000000001e84Initial program 88.9%
Taylor expanded in x around 0 88.9%
associate--l+88.9%
+-commutative88.9%
associate-*r/98.1%
+-commutative98.1%
associate--l+98.1%
div-sub98.1%
sub-neg98.1%
*-inverses98.1%
metadata-eval98.1%
Simplified98.1%
Taylor expanded in y around inf 78.9%
if -3.8000000000000001e84 < y < -3.4999999999999997e48Initial program 90.3%
Taylor expanded in z around inf 79.1%
mul-1-neg79.1%
Simplified79.1%
if -3.4999999999999997e48 < y < -2.2e13 or 3.6999999999999999e33 < y Initial program 94.1%
Taylor expanded in y around inf 89.5%
associate-/l*79.2%
associate-/r/86.4%
Simplified86.4%
if -2.2e13 < y < 3.6999999999999999e33Initial program 86.9%
Taylor expanded in z around 0 100.0%
Taylor expanded in y around 0 96.9%
neg-mul-196.9%
+-commutative96.9%
unsub-neg96.9%
Simplified96.9%
Final simplification90.0%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= y -2e+84)
(* x_m (/ y z))
(if (<= y -3.5e+48)
(- x_m)
(if (or (<= y -440000000000.0) (not (<= y 6.3e+32)))
(/ (* 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 <= -2e+84) {
tmp = x_m * (y / z);
} else if (y <= -3.5e+48) {
tmp = -x_m;
} else if ((y <= -440000000000.0) || !(y <= 6.3e+32)) {
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 <= (-2d+84)) then
tmp = x_m * (y / z)
else if (y <= (-3.5d+48)) then
tmp = -x_m
else if ((y <= (-440000000000.0d0)) .or. (.not. (y <= 6.3d+32))) 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 <= -2e+84) {
tmp = x_m * (y / z);
} else if (y <= -3.5e+48) {
tmp = -x_m;
} else if ((y <= -440000000000.0) || !(y <= 6.3e+32)) {
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 <= -2e+84: tmp = x_m * (y / z) elif y <= -3.5e+48: tmp = -x_m elif (y <= -440000000000.0) or not (y <= 6.3e+32): 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 <= -2e+84) tmp = Float64(x_m * Float64(y / z)); elseif (y <= -3.5e+48) tmp = Float64(-x_m); elseif ((y <= -440000000000.0) || !(y <= 6.3e+32)) 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 <= -2e+84) tmp = x_m * (y / z); elseif (y <= -3.5e+48) tmp = -x_m; elseif ((y <= -440000000000.0) || ~((y <= 6.3e+32))) 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[LessEqual[y, -2e+84], N[(x$95$m * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -3.5e+48], (-x$95$m), If[Or[LessEqual[y, -440000000000.0], N[Not[LessEqual[y, 6.3e+32]], $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 \cdot 10^{+84}:\\
\;\;\;\;x_m \cdot \frac{y}{z}\\
\mathbf{elif}\;y \leq -3.5 \cdot 10^{+48}:\\
\;\;\;\;-x_m\\
\mathbf{elif}\;y \leq -440000000000 \lor \neg \left(y \leq 6.3 \cdot 10^{+32}\right):\\
\;\;\;\;\frac{x_m \cdot y}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x_m}{z} - x_m\\
\end{array}
\end{array}
if y < -2.00000000000000012e84Initial program 88.9%
Taylor expanded in x around 0 88.9%
associate--l+88.9%
+-commutative88.9%
associate-*r/98.1%
+-commutative98.1%
associate--l+98.1%
div-sub98.1%
sub-neg98.1%
*-inverses98.1%
metadata-eval98.1%
Simplified98.1%
Taylor expanded in y around inf 78.9%
if -2.00000000000000012e84 < y < -3.4999999999999997e48Initial program 90.3%
Taylor expanded in z around inf 79.1%
mul-1-neg79.1%
Simplified79.1%
if -3.4999999999999997e48 < y < -4.4e11 or 6.3000000000000002e32 < y Initial program 94.1%
Taylor expanded in y around inf 89.5%
if -4.4e11 < y < 6.3000000000000002e32Initial program 86.9%
Taylor expanded in z around 0 100.0%
Taylor expanded in y around 0 96.9%
neg-mul-196.9%
+-commutative96.9%
unsub-neg96.9%
Simplified96.9%
Final simplification90.7%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= z -1.5e+14)
(- x_m)
(if (<= z 2.15e-94) (* x_m (/ y z)) (if (<= z 0.42) (/ 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 <= -1.5e+14) {
tmp = -x_m;
} else if (z <= 2.15e-94) {
tmp = x_m * (y / z);
} else if (z <= 0.42) {
tmp = 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 <= (-1.5d+14)) then
tmp = -x_m
else if (z <= 2.15d-94) then
tmp = x_m * (y / z)
else if (z <= 0.42d0) then
tmp = 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 <= -1.5e+14) {
tmp = -x_m;
} else if (z <= 2.15e-94) {
tmp = x_m * (y / z);
} else if (z <= 0.42) {
tmp = 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 <= -1.5e+14: tmp = -x_m elif z <= 2.15e-94: tmp = x_m * (y / z) elif z <= 0.42: tmp = 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 <= -1.5e+14) tmp = Float64(-x_m); elseif (z <= 2.15e-94) tmp = Float64(x_m * Float64(y / z)); elseif (z <= 0.42) tmp = Float64(x_m / z); else tmp = Float64(-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 <= -1.5e+14) tmp = -x_m; elseif (z <= 2.15e-94) tmp = x_m * (y / z); elseif (z <= 0.42) tmp = 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, -1.5e+14], (-x$95$m), If[LessEqual[z, 2.15e-94], N[(x$95$m * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.42], N[(x$95$m / 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}\;z \leq -1.5 \cdot 10^{+14}:\\
\;\;\;\;-x_m\\
\mathbf{elif}\;z \leq 2.15 \cdot 10^{-94}:\\
\;\;\;\;x_m \cdot \frac{y}{z}\\
\mathbf{elif}\;z \leq 0.42:\\
\;\;\;\;\frac{x_m}{z}\\
\mathbf{else}:\\
\;\;\;\;-x_m\\
\end{array}
\end{array}
if z < -1.5e14 or 0.419999999999999984 < z Initial program 78.5%
Taylor expanded in z around inf 74.0%
mul-1-neg74.0%
Simplified74.0%
if -1.5e14 < z < 2.1499999999999999e-94Initial program 99.9%
Taylor expanded in x around 0 99.9%
associate--l+99.9%
+-commutative99.9%
associate-*r/91.8%
+-commutative91.8%
associate--l+91.8%
div-sub91.8%
sub-neg91.8%
*-inverses91.8%
metadata-eval91.8%
Simplified91.8%
Taylor expanded in y around inf 64.5%
if 2.1499999999999999e-94 < z < 0.419999999999999984Initial program 99.9%
Taylor expanded in z around 0 96.8%
Taylor expanded in y around 0 75.8%
Final simplification70.3%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= z -9.5e+16)
(- x_m)
(if (<= z 2.2e-94) (* y (/ x_m z)) (if (<= z 0.42) (/ 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 <= -9.5e+16) {
tmp = -x_m;
} else if (z <= 2.2e-94) {
tmp = y * (x_m / z);
} else if (z <= 0.42) {
tmp = 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 <= (-9.5d+16)) then
tmp = -x_m
else if (z <= 2.2d-94) then
tmp = y * (x_m / z)
else if (z <= 0.42d0) then
tmp = 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 <= -9.5e+16) {
tmp = -x_m;
} else if (z <= 2.2e-94) {
tmp = y * (x_m / z);
} else if (z <= 0.42) {
tmp = 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 <= -9.5e+16: tmp = -x_m elif z <= 2.2e-94: tmp = y * (x_m / z) elif z <= 0.42: tmp = 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 <= -9.5e+16) tmp = Float64(-x_m); elseif (z <= 2.2e-94) tmp = Float64(y * Float64(x_m / z)); elseif (z <= 0.42) tmp = Float64(x_m / z); else tmp = Float64(-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 <= -9.5e+16) tmp = -x_m; elseif (z <= 2.2e-94) tmp = y * (x_m / z); elseif (z <= 0.42) tmp = 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, -9.5e+16], (-x$95$m), If[LessEqual[z, 2.2e-94], N[(y * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.42], N[(x$95$m / 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}\;z \leq -9.5 \cdot 10^{+16}:\\
\;\;\;\;-x_m\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{-94}:\\
\;\;\;\;y \cdot \frac{x_m}{z}\\
\mathbf{elif}\;z \leq 0.42:\\
\;\;\;\;\frac{x_m}{z}\\
\mathbf{else}:\\
\;\;\;\;-x_m\\
\end{array}
\end{array}
if z < -9.5e16 or 0.419999999999999984 < z Initial program 78.5%
Taylor expanded in z around inf 74.0%
mul-1-neg74.0%
Simplified74.0%
if -9.5e16 < z < 2.20000000000000001e-94Initial program 99.9%
Taylor expanded in y around inf 72.5%
associate-/l*64.5%
associate-/r/76.1%
Simplified76.1%
if 2.20000000000000001e-94 < z < 0.419999999999999984Initial program 99.9%
Taylor expanded in z around 0 96.8%
Taylor expanded in y around 0 75.8%
Final simplification75.0%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (or (<= z -15.5) (not (<= z 0.42)))
(- (* x_m (/ y z)) x_m)
(* (+ 1.0 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 <= -15.5) || !(z <= 0.42)) {
tmp = (x_m * (y / z)) - x_m;
} else {
tmp = (1.0 + 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 <= (-15.5d0)) .or. (.not. (z <= 0.42d0))) then
tmp = (x_m * (y / z)) - x_m
else
tmp = (1.0d0 + 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 <= -15.5) || !(z <= 0.42)) {
tmp = (x_m * (y / z)) - x_m;
} else {
tmp = (1.0 + 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 <= -15.5) or not (z <= 0.42): tmp = (x_m * (y / z)) - x_m else: tmp = (1.0 + 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 <= -15.5) || !(z <= 0.42)) tmp = Float64(Float64(x_m * Float64(y / z)) - x_m); else tmp = Float64(Float64(1.0 + 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 <= -15.5) || ~((z <= 0.42))) tmp = (x_m * (y / z)) - x_m; else tmp = (1.0 + 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, -15.5], N[Not[LessEqual[z, 0.42]], $MachinePrecision]], N[(N[(x$95$m * N[(y / z), $MachinePrecision]), $MachinePrecision] - x$95$m), $MachinePrecision], N[(N[(1.0 + y), $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 -15.5 \lor \neg \left(z \leq 0.42\right):\\
\;\;\;\;x_m \cdot \frac{y}{z} - x_m\\
\mathbf{else}:\\
\;\;\;\;\left(1 + y\right) \cdot \frac{x_m}{z}\\
\end{array}
\end{array}
if z < -15.5 or 0.419999999999999984 < z Initial program 78.8%
Taylor expanded in z around 0 94.2%
+-commutative94.2%
neg-mul-194.2%
unsub-neg94.2%
associate-/l*99.9%
associate-/r/94.6%
Applied egg-rr94.6%
Taylor expanded in y around inf 91.6%
associate-*r/97.4%
Simplified97.4%
if -15.5 < z < 0.419999999999999984Initial program 99.9%
Taylor expanded in z around 0 98.6%
associate-/l*91.9%
associate-/r/98.6%
Applied egg-rr98.6%
Final simplification98.0%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= z -2.15e+14)
(- x_m)
(if (<= z 480.0) (* (+ 1.0 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 (z <= -2.15e+14) {
tmp = -x_m;
} else if (z <= 480.0) {
tmp = (1.0 + 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 (z <= (-2.15d+14)) then
tmp = -x_m
else if (z <= 480.0d0) then
tmp = (1.0d0 + 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 (z <= -2.15e+14) {
tmp = -x_m;
} else if (z <= 480.0) {
tmp = (1.0 + 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 z <= -2.15e+14: tmp = -x_m elif z <= 480.0: tmp = (1.0 + 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 (z <= -2.15e+14) tmp = Float64(-x_m); elseif (z <= 480.0) tmp = Float64(Float64(1.0 + 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 (z <= -2.15e+14) tmp = -x_m; elseif (z <= 480.0) tmp = (1.0 + 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[LessEqual[z, -2.15e+14], (-x$95$m), If[LessEqual[z, 480.0], N[(N[(1.0 + y), $MachinePrecision] * 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}\;z \leq -2.15 \cdot 10^{+14}:\\
\;\;\;\;-x_m\\
\mathbf{elif}\;z \leq 480:\\
\;\;\;\;\left(1 + y\right) \cdot \frac{x_m}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x_m}{z} - x_m\\
\end{array}
\end{array}
if z < -2.15e14Initial program 82.1%
Taylor expanded in z around inf 80.6%
mul-1-neg80.6%
Simplified80.6%
if -2.15e14 < z < 480Initial program 99.9%
Taylor expanded in z around 0 97.9%
associate-/l*91.4%
associate-/r/97.8%
Applied egg-rr97.8%
if 480 < z Initial program 75.3%
Taylor expanded in z around 0 90.9%
Taylor expanded in y around 0 74.9%
neg-mul-174.9%
+-commutative74.9%
unsub-neg74.9%
Simplified74.9%
Final simplification87.8%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= z -15.5)
(- (/ x_m (/ z y)) x_m)
(if (<= z 0.42) (* (+ 1.0 y) (/ 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 (z <= -15.5) {
tmp = (x_m / (z / y)) - x_m;
} else if (z <= 0.42) {
tmp = (1.0 + y) * (x_m / z);
} else {
tmp = (x_m * (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 <= (-15.5d0)) then
tmp = (x_m / (z / y)) - x_m
else if (z <= 0.42d0) then
tmp = (1.0d0 + y) * (x_m / z)
else
tmp = (x_m * (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 <= -15.5) {
tmp = (x_m / (z / y)) - x_m;
} else if (z <= 0.42) {
tmp = (1.0 + y) * (x_m / z);
} else {
tmp = (x_m * (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 <= -15.5: tmp = (x_m / (z / y)) - x_m elif z <= 0.42: tmp = (1.0 + y) * (x_m / z) else: tmp = (x_m * (y / z)) - x_m return x_s * tmp
x_m = abs(x) x_s = copysign(1.0, x) function code(x_s, x_m, y, z) tmp = 0.0 if (z <= -15.5) tmp = Float64(Float64(x_m / Float64(z / y)) - x_m); elseif (z <= 0.42) tmp = Float64(Float64(1.0 + y) * Float64(x_m / z)); else tmp = Float64(Float64(x_m * Float64(y / 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 <= -15.5) tmp = (x_m / (z / y)) - x_m; elseif (z <= 0.42) tmp = (1.0 + y) * (x_m / z); else tmp = (x_m * (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[z, -15.5], N[(N[(x$95$m / N[(z / y), $MachinePrecision]), $MachinePrecision] - x$95$m), $MachinePrecision], If[LessEqual[z, 0.42], N[(N[(1.0 + y), $MachinePrecision] * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m * N[(y / z), $MachinePrecision]), $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}\;z \leq -15.5:\\
\;\;\;\;\frac{x_m}{\frac{z}{y}} - x_m\\
\mathbf{elif}\;z \leq 0.42:\\
\;\;\;\;\left(1 + y\right) \cdot \frac{x_m}{z}\\
\mathbf{else}:\\
\;\;\;\;x_m \cdot \frac{y}{z} - x_m\\
\end{array}
\end{array}
if z < -15.5Initial program 82.7%
Taylor expanded in z around 0 98.2%
+-commutative98.2%
neg-mul-198.2%
unsub-neg98.2%
associate-/l*99.9%
associate-/r/94.8%
Applied egg-rr94.8%
Taylor expanded in y around inf 97.2%
associate-*r/98.9%
Simplified98.9%
clear-num98.9%
div-inv98.9%
Applied egg-rr98.9%
if -15.5 < z < 0.419999999999999984Initial program 99.9%
Taylor expanded in z around 0 98.6%
associate-/l*91.9%
associate-/r/98.6%
Applied egg-rr98.6%
if 0.419999999999999984 < z Initial program 76.0%
Taylor expanded in z around 0 91.1%
+-commutative91.1%
neg-mul-191.1%
unsub-neg91.1%
associate-/l*99.9%
associate-/r/94.3%
Applied egg-rr94.3%
Taylor expanded in y around inf 87.5%
associate-*r/96.4%
Simplified96.4%
Final simplification98.0%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= z -15.5)
(- (/ x_m (/ z y)) x_m)
(if (<= z 0.42) (/ (* x_m (+ 1.0 y)) 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 (z <= -15.5) {
tmp = (x_m / (z / y)) - x_m;
} else if (z <= 0.42) {
tmp = (x_m * (1.0 + y)) / z;
} else {
tmp = (x_m * (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 <= (-15.5d0)) then
tmp = (x_m / (z / y)) - x_m
else if (z <= 0.42d0) then
tmp = (x_m * (1.0d0 + y)) / z
else
tmp = (x_m * (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 <= -15.5) {
tmp = (x_m / (z / y)) - x_m;
} else if (z <= 0.42) {
tmp = (x_m * (1.0 + y)) / z;
} else {
tmp = (x_m * (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 <= -15.5: tmp = (x_m / (z / y)) - x_m elif z <= 0.42: tmp = (x_m * (1.0 + y)) / z else: tmp = (x_m * (y / z)) - x_m return x_s * tmp
x_m = abs(x) x_s = copysign(1.0, x) function code(x_s, x_m, y, z) tmp = 0.0 if (z <= -15.5) tmp = Float64(Float64(x_m / Float64(z / y)) - x_m); elseif (z <= 0.42) tmp = Float64(Float64(x_m * Float64(1.0 + y)) / z); else tmp = Float64(Float64(x_m * Float64(y / 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 <= -15.5) tmp = (x_m / (z / y)) - x_m; elseif (z <= 0.42) tmp = (x_m * (1.0 + y)) / z; else tmp = (x_m * (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[z, -15.5], N[(N[(x$95$m / N[(z / y), $MachinePrecision]), $MachinePrecision] - x$95$m), $MachinePrecision], If[LessEqual[z, 0.42], N[(N[(x$95$m * N[(1.0 + y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(x$95$m * N[(y / z), $MachinePrecision]), $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}\;z \leq -15.5:\\
\;\;\;\;\frac{x_m}{\frac{z}{y}} - x_m\\
\mathbf{elif}\;z \leq 0.42:\\
\;\;\;\;\frac{x_m \cdot \left(1 + y\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;x_m \cdot \frac{y}{z} - x_m\\
\end{array}
\end{array}
if z < -15.5Initial program 82.7%
Taylor expanded in z around 0 98.2%
+-commutative98.2%
neg-mul-198.2%
unsub-neg98.2%
associate-/l*99.9%
associate-/r/94.8%
Applied egg-rr94.8%
Taylor expanded in y around inf 97.2%
associate-*r/98.9%
Simplified98.9%
clear-num98.9%
div-inv98.9%
Applied egg-rr98.9%
if -15.5 < z < 0.419999999999999984Initial program 99.9%
Taylor expanded in z around 0 98.6%
if 0.419999999999999984 < z Initial program 76.0%
Taylor expanded in z around 0 91.1%
+-commutative91.1%
neg-mul-191.1%
unsub-neg91.1%
associate-/l*99.9%
associate-/r/94.3%
Applied egg-rr94.3%
Taylor expanded in y around inf 87.5%
associate-*r/96.4%
Simplified96.4%
Final simplification98.0%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= y 1.65e+20)
(* x_m (+ -1.0 (/ (+ 1.0 y) 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 <= 1.65e+20) {
tmp = x_m * (-1.0 + ((1.0 + y) / z));
} else {
tmp = ((x_m * 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 <= 1.65d+20) then
tmp = x_m * ((-1.0d0) + ((1.0d0 + y) / z))
else
tmp = ((x_m * 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 <= 1.65e+20) {
tmp = x_m * (-1.0 + ((1.0 + y) / z));
} else {
tmp = ((x_m * 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 <= 1.65e+20: tmp = x_m * (-1.0 + ((1.0 + y) / z)) else: tmp = ((x_m * y) / z) - x_m return x_s * tmp
x_m = abs(x) x_s = copysign(1.0, x) function code(x_s, x_m, y, z) tmp = 0.0 if (y <= 1.65e+20) tmp = Float64(x_m * Float64(-1.0 + Float64(Float64(1.0 + y) / z))); else tmp = Float64(Float64(Float64(x_m * y) / 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 <= 1.65e+20) tmp = x_m * (-1.0 + ((1.0 + y) / z)); else tmp = ((x_m * 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, 1.65e+20], N[(x$95$m * N[(-1.0 + N[(N[(1.0 + y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x$95$m * y), $MachinePrecision] / 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 1.65 \cdot 10^{+20}:\\
\;\;\;\;x_m \cdot \left(-1 + \frac{1 + y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x_m \cdot y}{z} - x_m\\
\end{array}
\end{array}
if y < 1.65e20Initial program 87.5%
Taylor expanded in x around 0 87.5%
associate--l+87.5%
+-commutative87.5%
associate-*r/98.9%
+-commutative98.9%
associate--l+98.9%
div-sub98.9%
sub-neg98.9%
*-inverses98.9%
metadata-eval98.9%
Simplified98.9%
if 1.65e20 < y Initial program 95.1%
Taylor expanded in z around 0 96.6%
+-commutative96.6%
neg-mul-196.6%
unsub-neg96.6%
associate-/l*88.7%
associate-/r/95.1%
Applied egg-rr95.1%
Taylor expanded in y around inf 96.6%
Final simplification98.4%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) (FPCore (x_s x_m y z) :precision binary64 (* x_s (if (<= z 8.6e+14) (- (* (+ 1.0 y) (/ x_m z)) x_m) (- (* 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 <= 8.6e+14) {
tmp = ((1.0 + y) * (x_m / z)) - x_m;
} else {
tmp = (x_m * (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 <= 8.6d+14) then
tmp = ((1.0d0 + y) * (x_m / z)) - x_m
else
tmp = (x_m * (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 <= 8.6e+14) {
tmp = ((1.0 + y) * (x_m / z)) - x_m;
} else {
tmp = (x_m * (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 <= 8.6e+14: tmp = ((1.0 + y) * (x_m / z)) - x_m else: tmp = (x_m * (y / z)) - x_m return x_s * tmp
x_m = abs(x) x_s = copysign(1.0, x) function code(x_s, x_m, y, z) tmp = 0.0 if (z <= 8.6e+14) tmp = Float64(Float64(Float64(1.0 + y) * Float64(x_m / z)) - x_m); else tmp = Float64(Float64(x_m * Float64(y / 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 <= 8.6e+14) tmp = ((1.0 + y) * (x_m / z)) - x_m; else tmp = (x_m * (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[z, 8.6e+14], N[(N[(N[(1.0 + y), $MachinePrecision] * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision] - x$95$m), $MachinePrecision], N[(N[(x$95$m * N[(y / z), $MachinePrecision]), $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}\;z \leq 8.6 \cdot 10^{+14}:\\
\;\;\;\;\left(1 + y\right) \cdot \frac{x_m}{z} - x_m\\
\mathbf{else}:\\
\;\;\;\;x_m \cdot \frac{y}{z} - x_m\\
\end{array}
\end{array}
if z < 8.6e14Initial program 94.9%
Taylor expanded in z around 0 99.4%
+-commutative99.4%
neg-mul-199.4%
unsub-neg99.4%
associate-/l*95.4%
associate-/r/98.4%
Applied egg-rr98.4%
if 8.6e14 < z Initial program 72.7%
Taylor expanded in z around 0 89.9%
+-commutative89.9%
neg-mul-189.9%
unsub-neg89.9%
associate-/l*99.9%
associate-/r/93.6%
Applied egg-rr93.6%
Taylor expanded in y around inf 89.9%
associate-*r/100.0%
Simplified100.0%
Final simplification98.8%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= x_m 5e-116)
(/ (* x_m (+ 1.0 (- y z))) z)
(- (* (+ 1.0 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 (x_m <= 5e-116) {
tmp = (x_m * (1.0 + (y - z))) / z;
} else {
tmp = ((1.0 + y) * (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 (x_m <= 5d-116) then
tmp = (x_m * (1.0d0 + (y - z))) / z
else
tmp = ((1.0d0 + y) * (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 (x_m <= 5e-116) {
tmp = (x_m * (1.0 + (y - z))) / z;
} else {
tmp = ((1.0 + y) * (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 x_m <= 5e-116: tmp = (x_m * (1.0 + (y - z))) / z else: tmp = ((1.0 + y) * (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 (x_m <= 5e-116) tmp = Float64(Float64(x_m * Float64(1.0 + Float64(y - z))) / z); else tmp = Float64(Float64(Float64(1.0 + y) * 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 (x_m <= 5e-116) tmp = (x_m * (1.0 + (y - z))) / z; else tmp = ((1.0 + y) * (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[LessEqual[x$95$m, 5e-116], N[(N[(x$95$m * N[(1.0 + N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(N[(1.0 + y), $MachinePrecision] * N[(x$95$m / z), $MachinePrecision]), $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}\;x_m \leq 5 \cdot 10^{-116}:\\
\;\;\;\;\frac{x_m \cdot \left(1 + \left(y - z\right)\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + y\right) \cdot \frac{x_m}{z} - x_m\\
\end{array}
\end{array}
if x < 5.0000000000000003e-116Initial program 93.0%
if 5.0000000000000003e-116 < x Initial program 82.3%
Taylor expanded in z around 0 94.8%
+-commutative94.8%
neg-mul-194.8%
unsub-neg94.8%
associate-/l*98.9%
associate-/r/99.9%
Applied egg-rr99.9%
Final simplification95.5%
x_m = (fabs.f64 x)
x_s = (copysign.f64 1 x)
(FPCore (x_s x_m y z)
:precision binary64
(*
x_s
(if (<= x_m 2e-111)
(/ (+ x_m (* x_m (- y z))) z)
(- (* (+ 1.0 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 (x_m <= 2e-111) {
tmp = (x_m + (x_m * (y - z))) / z;
} else {
tmp = ((1.0 + y) * (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 (x_m <= 2d-111) then
tmp = (x_m + (x_m * (y - z))) / z
else
tmp = ((1.0d0 + y) * (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 (x_m <= 2e-111) {
tmp = (x_m + (x_m * (y - z))) / z;
} else {
tmp = ((1.0 + y) * (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 x_m <= 2e-111: tmp = (x_m + (x_m * (y - z))) / z else: tmp = ((1.0 + y) * (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 (x_m <= 2e-111) tmp = Float64(Float64(x_m + Float64(x_m * Float64(y - z))) / z); else tmp = Float64(Float64(Float64(1.0 + y) * 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 (x_m <= 2e-111) tmp = (x_m + (x_m * (y - z))) / z; else tmp = ((1.0 + y) * (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[LessEqual[x$95$m, 2e-111], N[(N[(x$95$m + N[(x$95$m * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(N[(1.0 + y), $MachinePrecision] * N[(x$95$m / z), $MachinePrecision]), $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}\;x_m \leq 2 \cdot 10^{-111}:\\
\;\;\;\;\frac{x_m + x_m \cdot \left(y - z\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + y\right) \cdot \frac{x_m}{z} - x_m\\
\end{array}
\end{array}
if x < 2.00000000000000018e-111Initial program 93.1%
distribute-lft-in93.1%
*-rgt-identity93.1%
Applied egg-rr93.1%
if 2.00000000000000018e-111 < x Initial program 82.1%
Taylor expanded in z around 0 94.8%
+-commutative94.8%
neg-mul-194.8%
unsub-neg94.8%
associate-/l*98.9%
associate-/r/99.9%
Applied egg-rr99.9%
Final simplification95.5%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) (FPCore (x_s x_m y z) :precision binary64 (* x_s (if (or (<= z -0.31) (not (<= z 0.42))) (- 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 <= -0.31) || !(z <= 0.42)) {
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 <= (-0.31d0)) .or. (.not. (z <= 0.42d0))) 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 <= -0.31) || !(z <= 0.42)) {
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 <= -0.31) or not (z <= 0.42): 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 <= -0.31) || !(z <= 0.42)) 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 <= -0.31) || ~((z <= 0.42))) 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, -0.31], N[Not[LessEqual[z, 0.42]], $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 -0.31 \lor \neg \left(z \leq 0.42\right):\\
\;\;\;\;-x_m\\
\mathbf{else}:\\
\;\;\;\;\frac{x_m}{z}\\
\end{array}
\end{array}
if z < -0.309999999999999998 or 0.419999999999999984 < z Initial program 79.2%
Taylor expanded in z around inf 72.1%
mul-1-neg72.1%
Simplified72.1%
if -0.309999999999999998 < z < 0.419999999999999984Initial program 99.9%
Taylor expanded in z around 0 98.6%
Taylor expanded in y around 0 51.6%
Final simplification62.1%
x_m = (fabs.f64 x) x_s = (copysign.f64 1 x) (FPCore (x_s x_m y z) :precision binary64 (* x_s (- x_m)))
x_m = fabs(x);
x_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
return x_s * -x_m;
}
x_m = abs(x)
x_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x_s * -x_m
end function
x_m = Math.abs(x);
x_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
return x_s * -x_m;
}
x_m = math.fabs(x) x_s = math.copysign(1.0, x) def code(x_s, x_m, y, z): return x_s * -x_m
x_m = abs(x) x_s = copysign(1.0, x) function code(x_s, x_m, y, z) return Float64(x_s * 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 89.3%
Taylor expanded in z around inf 38.4%
mul-1-neg38.4%
Simplified38.4%
Final simplification38.4%
(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 2024021
(FPCore (x y z)
:name "Diagrams.TwoD.Segment.Bernstein:evaluateBernstein from diagrams-lib-1.3.0.3"
:precision binary64
:herbie-target
(if (< x -2.71483106713436e-162) (- (* (+ 1.0 y) (/ x z)) x) (if (< x 3.874108816439546e-197) (* (* x (+ (- y z) 1.0)) (/ 1.0 z)) (- (* (+ 1.0 y) (/ x z)) x)))
(/ (* x (+ (- y z) 1.0)) z))