
(FPCore (x y z t) :precision binary64 (/ x (* (- y z) (- t z))))
double code(double x, double y, double z, double t) {
return x / ((y - z) * (t - z));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x / ((y - z) * (t - z))
end function
public static double code(double x, double y, double z, double t) {
return x / ((y - z) * (t - z));
}
def code(x, y, z, t): return x / ((y - z) * (t - z))
function code(x, y, z, t) return Float64(x / Float64(Float64(y - z) * Float64(t - z))) end
function tmp = code(x, y, z, t) tmp = x / ((y - z) * (t - z)); end
code[x_, y_, z_, t_] := N[(x / N[(N[(y - z), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ x (* (- y z) (- t z))))
double code(double x, double y, double z, double t) {
return x / ((y - z) * (t - z));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x / ((y - z) * (t - z))
end function
public static double code(double x, double y, double z, double t) {
return x / ((y - z) * (t - z));
}
def code(x, y, z, t): return x / ((y - z) * (t - z))
function code(x, y, z, t) return Float64(x / Float64(Float64(y - z) * Float64(t - z))) end
function tmp = code(x, y, z, t) tmp = x / ((y - z) * (t - z)); end
code[x_, y_, z_, t_] := N[(x / N[(N[(y - z), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}
\end{array}
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x_s x_m y z t) :precision binary64 (let* ((t_1 (/ x_m (* (- y z) (- t z))))) (* x_s (if (<= t_1 -2e-299) t_1 (/ (/ x_m (- t z)) (- y z))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = x_m / ((y - z) * (t - z));
double tmp;
if (t_1 <= -2e-299) {
tmp = t_1;
} else {
tmp = (x_m / (t - z)) / (y - z);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x_m / ((y - z) * (t - z))
if (t_1 <= (-2d-299)) then
tmp = t_1
else
tmp = (x_m / (t - z)) / (y - z)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = x_m / ((y - z) * (t - z));
double tmp;
if (t_1 <= -2e-299) {
tmp = t_1;
} else {
tmp = (x_m / (t - z)) / (y - z);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z, t] = sort([x_m, y, z, t]) def code(x_s, x_m, y, z, t): t_1 = x_m / ((y - z) * (t - z)) tmp = 0 if t_1 <= -2e-299: tmp = t_1 else: tmp = (x_m / (t - z)) / (y - z) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z, t = sort([x_m, y, z, t]) function code(x_s, x_m, y, z, t) t_1 = Float64(x_m / Float64(Float64(y - z) * Float64(t - z))) tmp = 0.0 if (t_1 <= -2e-299) tmp = t_1; else tmp = Float64(Float64(x_m / Float64(t - z)) / Float64(y - z)); end return Float64(x_s * tmp) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp_2 = code(x_s, x_m, y, z, t)
t_1 = x_m / ((y - z) * (t - z));
tmp = 0.0;
if (t_1 <= -2e-299)
tmp = t_1;
else
tmp = (x_m / (t - z)) / (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]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(x$95$m / N[(N[(y - z), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t$95$1, -2e-299], t$95$1, N[(N[(x$95$m / N[(t - z), $MachinePrecision]), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
\begin{array}{l}
t_1 := \frac{x\_m}{\left(y - z\right) \cdot \left(t - z\right)}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-299}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x\_m}{t - z}}{y - z}\\
\end{array}
\end{array}
\end{array}
if (/.f64 x (*.f64 (-.f64 y z) (-.f64 t z))) < -1.99999999999999998e-299Initial program 96.9%
if -1.99999999999999998e-299 < (/.f64 x (*.f64 (-.f64 y z) (-.f64 t z))) Initial program 89.6%
associate-/l/97.1%
Simplified97.1%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z t)
:precision binary64
(let* ((t_1 (/ (/ x_m (- t z)) y)))
(*
x_s
(if (<= y -2.25e+204)
t_1
(if (<= y -2e-16)
(/ x_m (* y (- t z)))
(if (<= y -5.6e-81)
t_1
(if (<= y 6e-135) (/ (/ x_m z) (- z t)) (/ (/ x_m t) (- y z)))))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = (x_m / (t - z)) / y;
double tmp;
if (y <= -2.25e+204) {
tmp = t_1;
} else if (y <= -2e-16) {
tmp = x_m / (y * (t - z));
} else if (y <= -5.6e-81) {
tmp = t_1;
} else if (y <= 6e-135) {
tmp = (x_m / z) / (z - t);
} else {
tmp = (x_m / t) / (y - z);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (x_m / (t - z)) / y
if (y <= (-2.25d+204)) then
tmp = t_1
else if (y <= (-2d-16)) then
tmp = x_m / (y * (t - z))
else if (y <= (-5.6d-81)) then
tmp = t_1
else if (y <= 6d-135) then
tmp = (x_m / z) / (z - t)
else
tmp = (x_m / t) / (y - z)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = (x_m / (t - z)) / y;
double tmp;
if (y <= -2.25e+204) {
tmp = t_1;
} else if (y <= -2e-16) {
tmp = x_m / (y * (t - z));
} else if (y <= -5.6e-81) {
tmp = t_1;
} else if (y <= 6e-135) {
tmp = (x_m / z) / (z - t);
} else {
tmp = (x_m / t) / (y - z);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z, t] = sort([x_m, y, z, t]) def code(x_s, x_m, y, z, t): t_1 = (x_m / (t - z)) / y tmp = 0 if y <= -2.25e+204: tmp = t_1 elif y <= -2e-16: tmp = x_m / (y * (t - z)) elif y <= -5.6e-81: tmp = t_1 elif y <= 6e-135: tmp = (x_m / z) / (z - t) else: tmp = (x_m / t) / (y - z) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z, t = sort([x_m, y, z, t]) function code(x_s, x_m, y, z, t) t_1 = Float64(Float64(x_m / Float64(t - z)) / y) tmp = 0.0 if (y <= -2.25e+204) tmp = t_1; elseif (y <= -2e-16) tmp = Float64(x_m / Float64(y * Float64(t - z))); elseif (y <= -5.6e-81) tmp = t_1; elseif (y <= 6e-135) tmp = Float64(Float64(x_m / z) / Float64(z - t)); else tmp = Float64(Float64(x_m / t) / Float64(y - z)); end return Float64(x_s * tmp) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp_2 = code(x_s, x_m, y, z, t)
t_1 = (x_m / (t - z)) / y;
tmp = 0.0;
if (y <= -2.25e+204)
tmp = t_1;
elseif (y <= -2e-16)
tmp = x_m / (y * (t - z));
elseif (y <= -5.6e-81)
tmp = t_1;
elseif (y <= 6e-135)
tmp = (x_m / z) / (z - t);
else
tmp = (x_m / t) / (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]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x$95$m / N[(t - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]}, N[(x$95$s * If[LessEqual[y, -2.25e+204], t$95$1, If[LessEqual[y, -2e-16], N[(x$95$m / N[(y * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -5.6e-81], t$95$1, If[LessEqual[y, 6e-135], N[(N[(x$95$m / z), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / t), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]]]]]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
\begin{array}{l}
t_1 := \frac{\frac{x\_m}{t - z}}{y}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -2.25 \cdot 10^{+204}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -2 \cdot 10^{-16}:\\
\;\;\;\;\frac{x\_m}{y \cdot \left(t - z\right)}\\
\mathbf{elif}\;y \leq -5.6 \cdot 10^{-81}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 6 \cdot 10^{-135}:\\
\;\;\;\;\frac{\frac{x\_m}{z}}{z - t}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x\_m}{t}}{y - z}\\
\end{array}
\end{array}
\end{array}
if y < -2.25000000000000001e204 or -2e-16 < y < -5.5999999999999998e-81Initial program 92.4%
associate-/l/99.9%
clear-num99.8%
inv-pow99.8%
div-inv99.8%
clear-num99.9%
Applied egg-rr99.9%
unpow-199.9%
Applied egg-rr99.9%
Taylor expanded in y around inf 81.0%
*-lft-identity81.0%
times-frac88.6%
associate-*l/88.6%
*-lft-identity88.6%
Simplified88.6%
if -2.25000000000000001e204 < y < -2e-16Initial program 88.3%
Taylor expanded in y around inf 82.4%
*-commutative82.4%
Simplified82.4%
if -5.5999999999999998e-81 < y < 6.00000000000000024e-135Initial program 93.7%
Taylor expanded in x around 0 93.7%
associate-/l/96.8%
Simplified96.8%
Taylor expanded in y around 0 87.4%
associate-*r/87.4%
neg-mul-187.4%
Simplified87.4%
if 6.00000000000000024e-135 < y Initial program 91.0%
associate-/l/98.4%
Simplified98.4%
Taylor expanded in t around inf 70.6%
Final simplification80.9%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z t)
:precision binary64
(let* ((t_1 (/ (/ x_m (- t z)) y)))
(*
x_s
(if (<= y -1.55e+203)
t_1
(if (<= y -6.9e-18)
(/ x_m (* y (- t z)))
(if (<= y -1.7e-86)
t_1
(if (<= y 8.6e-137)
(/ x_m (* z (- z t)))
(/ (/ x_m t) (- y z)))))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = (x_m / (t - z)) / y;
double tmp;
if (y <= -1.55e+203) {
tmp = t_1;
} else if (y <= -6.9e-18) {
tmp = x_m / (y * (t - z));
} else if (y <= -1.7e-86) {
tmp = t_1;
} else if (y <= 8.6e-137) {
tmp = x_m / (z * (z - t));
} else {
tmp = (x_m / t) / (y - z);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (x_m / (t - z)) / y
if (y <= (-1.55d+203)) then
tmp = t_1
else if (y <= (-6.9d-18)) then
tmp = x_m / (y * (t - z))
else if (y <= (-1.7d-86)) then
tmp = t_1
else if (y <= 8.6d-137) then
tmp = x_m / (z * (z - t))
else
tmp = (x_m / t) / (y - z)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = (x_m / (t - z)) / y;
double tmp;
if (y <= -1.55e+203) {
tmp = t_1;
} else if (y <= -6.9e-18) {
tmp = x_m / (y * (t - z));
} else if (y <= -1.7e-86) {
tmp = t_1;
} else if (y <= 8.6e-137) {
tmp = x_m / (z * (z - t));
} else {
tmp = (x_m / t) / (y - z);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z, t] = sort([x_m, y, z, t]) def code(x_s, x_m, y, z, t): t_1 = (x_m / (t - z)) / y tmp = 0 if y <= -1.55e+203: tmp = t_1 elif y <= -6.9e-18: tmp = x_m / (y * (t - z)) elif y <= -1.7e-86: tmp = t_1 elif y <= 8.6e-137: tmp = x_m / (z * (z - t)) else: tmp = (x_m / t) / (y - z) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z, t = sort([x_m, y, z, t]) function code(x_s, x_m, y, z, t) t_1 = Float64(Float64(x_m / Float64(t - z)) / y) tmp = 0.0 if (y <= -1.55e+203) tmp = t_1; elseif (y <= -6.9e-18) tmp = Float64(x_m / Float64(y * Float64(t - z))); elseif (y <= -1.7e-86) tmp = t_1; elseif (y <= 8.6e-137) tmp = Float64(x_m / Float64(z * Float64(z - t))); else tmp = Float64(Float64(x_m / t) / Float64(y - z)); end return Float64(x_s * tmp) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp_2 = code(x_s, x_m, y, z, t)
t_1 = (x_m / (t - z)) / y;
tmp = 0.0;
if (y <= -1.55e+203)
tmp = t_1;
elseif (y <= -6.9e-18)
tmp = x_m / (y * (t - z));
elseif (y <= -1.7e-86)
tmp = t_1;
elseif (y <= 8.6e-137)
tmp = x_m / (z * (z - t));
else
tmp = (x_m / t) / (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]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x$95$m / N[(t - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]}, N[(x$95$s * If[LessEqual[y, -1.55e+203], t$95$1, If[LessEqual[y, -6.9e-18], N[(x$95$m / N[(y * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1.7e-86], t$95$1, If[LessEqual[y, 8.6e-137], N[(x$95$m / N[(z * N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / t), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]]]]]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
\begin{array}{l}
t_1 := \frac{\frac{x\_m}{t - z}}{y}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -1.55 \cdot 10^{+203}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -6.9 \cdot 10^{-18}:\\
\;\;\;\;\frac{x\_m}{y \cdot \left(t - z\right)}\\
\mathbf{elif}\;y \leq -1.7 \cdot 10^{-86}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 8.6 \cdot 10^{-137}:\\
\;\;\;\;\frac{x\_m}{z \cdot \left(z - t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x\_m}{t}}{y - z}\\
\end{array}
\end{array}
\end{array}
if y < -1.55e203 or -6.9000000000000003e-18 < y < -1.7e-86Initial program 92.4%
associate-/l/99.9%
clear-num99.8%
inv-pow99.8%
div-inv99.8%
clear-num99.9%
Applied egg-rr99.9%
unpow-199.9%
Applied egg-rr99.9%
Taylor expanded in y around inf 81.0%
*-lft-identity81.0%
times-frac88.6%
associate-*l/88.6%
*-lft-identity88.6%
Simplified88.6%
if -1.55e203 < y < -6.9000000000000003e-18Initial program 88.3%
Taylor expanded in y around inf 82.4%
*-commutative82.4%
Simplified82.4%
if -1.7e-86 < y < 8.59999999999999959e-137Initial program 93.6%
Taylor expanded in y around 0 86.3%
associate-*r/86.3%
neg-mul-186.3%
Simplified86.3%
if 8.59999999999999959e-137 < y Initial program 91.1%
associate-/l/98.4%
Simplified98.4%
Taylor expanded in t around inf 71.0%
Final simplification80.5%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z t)
:precision binary64
(let* ((t_1 (/ 1.0 (* t (/ y x_m)))))
(*
x_s
(if (<= y -2.6e+123)
t_1
(if (<= y -1.9e+57)
(/ x_m (* z (- y)))
(if (<= y -1.55e-86)
(/ (/ x_m t) y)
(if (<= y 1.05e-141) (/ (/ x_m z) (- t)) t_1)))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = 1.0 / (t * (y / x_m));
double tmp;
if (y <= -2.6e+123) {
tmp = t_1;
} else if (y <= -1.9e+57) {
tmp = x_m / (z * -y);
} else if (y <= -1.55e-86) {
tmp = (x_m / t) / y;
} else if (y <= 1.05e-141) {
tmp = (x_m / z) / -t;
} else {
tmp = t_1;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = 1.0d0 / (t * (y / x_m))
if (y <= (-2.6d+123)) then
tmp = t_1
else if (y <= (-1.9d+57)) then
tmp = x_m / (z * -y)
else if (y <= (-1.55d-86)) then
tmp = (x_m / t) / y
else if (y <= 1.05d-141) then
tmp = (x_m / z) / -t
else
tmp = t_1
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = 1.0 / (t * (y / x_m));
double tmp;
if (y <= -2.6e+123) {
tmp = t_1;
} else if (y <= -1.9e+57) {
tmp = x_m / (z * -y);
} else if (y <= -1.55e-86) {
tmp = (x_m / t) / y;
} else if (y <= 1.05e-141) {
tmp = (x_m / z) / -t;
} else {
tmp = t_1;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z, t] = sort([x_m, y, z, t]) def code(x_s, x_m, y, z, t): t_1 = 1.0 / (t * (y / x_m)) tmp = 0 if y <= -2.6e+123: tmp = t_1 elif y <= -1.9e+57: tmp = x_m / (z * -y) elif y <= -1.55e-86: tmp = (x_m / t) / y elif y <= 1.05e-141: tmp = (x_m / z) / -t else: tmp = t_1 return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z, t = sort([x_m, y, z, t]) function code(x_s, x_m, y, z, t) t_1 = Float64(1.0 / Float64(t * Float64(y / x_m))) tmp = 0.0 if (y <= -2.6e+123) tmp = t_1; elseif (y <= -1.9e+57) tmp = Float64(x_m / Float64(z * Float64(-y))); elseif (y <= -1.55e-86) tmp = Float64(Float64(x_m / t) / y); elseif (y <= 1.05e-141) tmp = Float64(Float64(x_m / z) / Float64(-t)); else tmp = t_1; end return Float64(x_s * tmp) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp_2 = code(x_s, x_m, y, z, t)
t_1 = 1.0 / (t * (y / x_m));
tmp = 0.0;
if (y <= -2.6e+123)
tmp = t_1;
elseif (y <= -1.9e+57)
tmp = x_m / (z * -y);
elseif (y <= -1.55e-86)
tmp = (x_m / t) / y;
elseif (y <= 1.05e-141)
tmp = (x_m / z) / -t;
else
tmp = t_1;
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]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(1.0 / N[(t * N[(y / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[y, -2.6e+123], t$95$1, If[LessEqual[y, -1.9e+57], N[(x$95$m / N[(z * (-y)), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1.55e-86], N[(N[(x$95$m / t), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[y, 1.05e-141], N[(N[(x$95$m / z), $MachinePrecision] / (-t)), $MachinePrecision], t$95$1]]]]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
\begin{array}{l}
t_1 := \frac{1}{t \cdot \frac{y}{x\_m}}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -2.6 \cdot 10^{+123}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -1.9 \cdot 10^{+57}:\\
\;\;\;\;\frac{x\_m}{z \cdot \left(-y\right)}\\
\mathbf{elif}\;y \leq -1.55 \cdot 10^{-86}:\\
\;\;\;\;\frac{\frac{x\_m}{t}}{y}\\
\mathbf{elif}\;y \leq 1.05 \cdot 10^{-141}:\\
\;\;\;\;\frac{\frac{x\_m}{z}}{-t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if y < -2.59999999999999985e123 or 1.05e-141 < y Initial program 89.7%
Taylor expanded in z around 0 58.8%
clear-num58.8%
inv-pow58.8%
*-commutative58.8%
associate-/l*65.2%
Applied egg-rr65.2%
unpow-165.2%
associate-*r/58.8%
*-commutative58.8%
associate-/l*69.1%
Simplified69.1%
if -2.59999999999999985e123 < y < -1.8999999999999999e57Initial program 94.5%
Taylor expanded in y around inf 94.5%
*-commutative94.5%
Simplified94.5%
Taylor expanded in t around 0 53.6%
mul-1-neg53.6%
distribute-neg-frac253.6%
distribute-rgt-neg-out53.6%
Simplified53.6%
if -1.8999999999999999e57 < y < -1.54999999999999994e-86Initial program 91.3%
associate-/l/99.7%
clear-num99.4%
inv-pow99.4%
div-inv99.5%
clear-num99.6%
Applied egg-rr99.6%
*-commutative99.6%
associate-/r/95.0%
inv-pow95.0%
associate-/r/95.2%
*-commutative95.2%
clear-num94.9%
associate-*l/95.4%
*-un-lft-identity95.4%
Applied egg-rr95.4%
clear-num95.1%
associate-/r/95.1%
Applied egg-rr95.1%
Taylor expanded in z around 0 55.0%
associate-/r*54.9%
Simplified54.9%
if -1.54999999999999994e-86 < y < 1.05e-141Initial program 93.6%
associate-/l/93.8%
Simplified93.8%
Taylor expanded in t around inf 51.5%
Taylor expanded in y around 0 50.3%
associate-*r/50.3%
neg-mul-150.3%
*-commutative50.3%
Simplified50.3%
Taylor expanded in x around 0 50.3%
mul-1-neg50.3%
associate-/l/54.9%
distribute-neg-frac254.9%
Simplified54.9%
Final simplification61.6%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z t)
:precision binary64
(let* ((t_1 (/ (/ x_m t) y)))
(*
x_s
(if (<= t -5.5e-65)
t_1
(if (<= t 2.1e-109)
(/ x_m (* z (- y)))
(if (<= t 2.15e+94)
(/ x_m (* y t))
(if (<= t 1.2e+170) (/ x_m (* z t)) t_1)))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = (x_m / t) / y;
double tmp;
if (t <= -5.5e-65) {
tmp = t_1;
} else if (t <= 2.1e-109) {
tmp = x_m / (z * -y);
} else if (t <= 2.15e+94) {
tmp = x_m / (y * t);
} else if (t <= 1.2e+170) {
tmp = x_m / (z * t);
} else {
tmp = t_1;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (x_m / t) / y
if (t <= (-5.5d-65)) then
tmp = t_1
else if (t <= 2.1d-109) then
tmp = x_m / (z * -y)
else if (t <= 2.15d+94) then
tmp = x_m / (y * t)
else if (t <= 1.2d+170) then
tmp = x_m / (z * t)
else
tmp = t_1
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = (x_m / t) / y;
double tmp;
if (t <= -5.5e-65) {
tmp = t_1;
} else if (t <= 2.1e-109) {
tmp = x_m / (z * -y);
} else if (t <= 2.15e+94) {
tmp = x_m / (y * t);
} else if (t <= 1.2e+170) {
tmp = x_m / (z * t);
} else {
tmp = t_1;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z, t] = sort([x_m, y, z, t]) def code(x_s, x_m, y, z, t): t_1 = (x_m / t) / y tmp = 0 if t <= -5.5e-65: tmp = t_1 elif t <= 2.1e-109: tmp = x_m / (z * -y) elif t <= 2.15e+94: tmp = x_m / (y * t) elif t <= 1.2e+170: tmp = x_m / (z * t) else: tmp = t_1 return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z, t = sort([x_m, y, z, t]) function code(x_s, x_m, y, z, t) t_1 = Float64(Float64(x_m / t) / y) tmp = 0.0 if (t <= -5.5e-65) tmp = t_1; elseif (t <= 2.1e-109) tmp = Float64(x_m / Float64(z * Float64(-y))); elseif (t <= 2.15e+94) tmp = Float64(x_m / Float64(y * t)); elseif (t <= 1.2e+170) tmp = Float64(x_m / Float64(z * t)); else tmp = t_1; end return Float64(x_s * tmp) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp_2 = code(x_s, x_m, y, z, t)
t_1 = (x_m / t) / y;
tmp = 0.0;
if (t <= -5.5e-65)
tmp = t_1;
elseif (t <= 2.1e-109)
tmp = x_m / (z * -y);
elseif (t <= 2.15e+94)
tmp = x_m / (y * t);
elseif (t <= 1.2e+170)
tmp = x_m / (z * t);
else
tmp = t_1;
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]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x$95$m / t), $MachinePrecision] / y), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t, -5.5e-65], t$95$1, If[LessEqual[t, 2.1e-109], N[(x$95$m / N[(z * (-y)), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.15e+94], N[(x$95$m / N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.2e+170], N[(x$95$m / N[(z * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
\begin{array}{l}
t_1 := \frac{\frac{x\_m}{t}}{y}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq -5.5 \cdot 10^{-65}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.1 \cdot 10^{-109}:\\
\;\;\;\;\frac{x\_m}{z \cdot \left(-y\right)}\\
\mathbf{elif}\;t \leq 2.15 \cdot 10^{+94}:\\
\;\;\;\;\frac{x\_m}{y \cdot t}\\
\mathbf{elif}\;t \leq 1.2 \cdot 10^{+170}:\\
\;\;\;\;\frac{x\_m}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if t < -5.4999999999999999e-65 or 1.2e170 < t Initial program 90.6%
associate-/l/95.0%
clear-num94.8%
inv-pow94.8%
div-inv94.7%
clear-num94.8%
Applied egg-rr94.8%
*-commutative94.8%
associate-/r/95.4%
inv-pow95.4%
associate-/r/95.8%
*-commutative95.8%
clear-num95.7%
associate-*l/95.9%
*-un-lft-identity95.9%
Applied egg-rr95.9%
clear-num95.8%
associate-/r/95.7%
Applied egg-rr95.7%
Taylor expanded in z around 0 53.1%
associate-/r*64.1%
Simplified64.1%
if -5.4999999999999999e-65 < t < 2.09999999999999996e-109Initial program 92.4%
Taylor expanded in y around inf 54.1%
*-commutative54.1%
Simplified54.1%
Taylor expanded in t around 0 41.1%
mul-1-neg41.1%
distribute-neg-frac241.1%
distribute-rgt-neg-out41.1%
Simplified41.1%
if 2.09999999999999996e-109 < t < 2.15e94Initial program 94.5%
Taylor expanded in z around 0 54.3%
if 2.15e94 < t < 1.2e170Initial program 3.9%
associate-/l/100.0%
Simplified100.0%
Taylor expanded in t around inf 6.6%
Taylor expanded in y around 0 6.6%
associate-*r/6.6%
neg-mul-16.6%
*-commutative6.6%
Simplified6.6%
add-sqr-sqrt6.6%
sqrt-unprod2.6%
sqr-neg2.6%
sqrt-unprod0.0%
add-sqr-sqrt2.0%
*-un-lft-identity2.0%
associate-/r*2.0%
Applied egg-rr2.0%
*-lft-identity2.0%
associate-/l/2.0%
*-commutative2.0%
Simplified2.0%
Final simplification54.7%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= y -4.35e+46)
(/ x_m (* z (- y)))
(if (or (<= y -1.6e-86) (not (<= y 4.1e-141)))
(/ (/ x_m t) y)
(/ (/ x_m z) (- t))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (y <= -4.35e+46) {
tmp = x_m / (z * -y);
} else if ((y <= -1.6e-86) || !(y <= 4.1e-141)) {
tmp = (x_m / t) / y;
} else {
tmp = (x_m / z) / -t;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-4.35d+46)) then
tmp = x_m / (z * -y)
else if ((y <= (-1.6d-86)) .or. (.not. (y <= 4.1d-141))) then
tmp = (x_m / t) / y
else
tmp = (x_m / z) / -t
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (y <= -4.35e+46) {
tmp = x_m / (z * -y);
} else if ((y <= -1.6e-86) || !(y <= 4.1e-141)) {
tmp = (x_m / t) / y;
} else {
tmp = (x_m / z) / -t;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z, t] = sort([x_m, y, z, t]) def code(x_s, x_m, y, z, t): tmp = 0 if y <= -4.35e+46: tmp = x_m / (z * -y) elif (y <= -1.6e-86) or not (y <= 4.1e-141): tmp = (x_m / t) / y else: tmp = (x_m / z) / -t return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z, t = sort([x_m, y, z, t]) function code(x_s, x_m, y, z, t) tmp = 0.0 if (y <= -4.35e+46) tmp = Float64(x_m / Float64(z * Float64(-y))); elseif ((y <= -1.6e-86) || !(y <= 4.1e-141)) tmp = Float64(Float64(x_m / t) / y); else tmp = Float64(Float64(x_m / z) / Float64(-t)); end return Float64(x_s * tmp) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp_2 = code(x_s, x_m, y, z, t)
tmp = 0.0;
if (y <= -4.35e+46)
tmp = x_m / (z * -y);
elseif ((y <= -1.6e-86) || ~((y <= 4.1e-141)))
tmp = (x_m / t) / y;
else
tmp = (x_m / z) / -t;
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]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[y, -4.35e+46], N[(x$95$m / N[(z * (-y)), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, -1.6e-86], N[Not[LessEqual[y, 4.1e-141]], $MachinePrecision]], N[(N[(x$95$m / t), $MachinePrecision] / y), $MachinePrecision], N[(N[(x$95$m / z), $MachinePrecision] / (-t)), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -4.35 \cdot 10^{+46}:\\
\;\;\;\;\frac{x\_m}{z \cdot \left(-y\right)}\\
\mathbf{elif}\;y \leq -1.6 \cdot 10^{-86} \lor \neg \left(y \leq 4.1 \cdot 10^{-141}\right):\\
\;\;\;\;\frac{\frac{x\_m}{t}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x\_m}{z}}{-t}\\
\end{array}
\end{array}
if y < -4.34999999999999981e46Initial program 87.7%
Taylor expanded in y around inf 87.6%
*-commutative87.6%
Simplified87.6%
Taylor expanded in t around 0 54.2%
mul-1-neg54.2%
distribute-neg-frac254.2%
distribute-rgt-neg-out54.2%
Simplified54.2%
if -4.34999999999999981e46 < y < -1.60000000000000003e-86 or 4.10000000000000002e-141 < y Initial program 91.8%
associate-/l/98.6%
clear-num98.1%
inv-pow98.1%
div-inv98.0%
clear-num98.2%
Applied egg-rr98.2%
*-commutative98.2%
associate-/r/95.7%
inv-pow95.7%
associate-/r/96.3%
*-commutative96.3%
clear-num96.0%
associate-*l/96.2%
*-un-lft-identity96.2%
Applied egg-rr96.2%
clear-num96.0%
associate-/r/96.0%
Applied egg-rr96.0%
Taylor expanded in z around 0 57.4%
associate-/r*62.4%
Simplified62.4%
if -1.60000000000000003e-86 < y < 4.10000000000000002e-141Initial program 93.6%
associate-/l/93.8%
Simplified93.8%
Taylor expanded in t around inf 51.5%
Taylor expanded in y around 0 50.3%
associate-*r/50.3%
neg-mul-150.3%
*-commutative50.3%
Simplified50.3%
Taylor expanded in x around 0 50.3%
mul-1-neg50.3%
associate-/l/54.9%
distribute-neg-frac254.9%
Simplified54.9%
Final simplification57.9%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= y -7.8e+46)
(/ x_m (* z (- y)))
(if (or (<= y -6e-85) (not (<= y 2.75e-139)))
(/ (/ x_m t) y)
(/ x_m (- (* z t)))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (y <= -7.8e+46) {
tmp = x_m / (z * -y);
} else if ((y <= -6e-85) || !(y <= 2.75e-139)) {
tmp = (x_m / t) / y;
} else {
tmp = x_m / -(z * t);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-7.8d+46)) then
tmp = x_m / (z * -y)
else if ((y <= (-6d-85)) .or. (.not. (y <= 2.75d-139))) then
tmp = (x_m / t) / y
else
tmp = x_m / -(z * t)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (y <= -7.8e+46) {
tmp = x_m / (z * -y);
} else if ((y <= -6e-85) || !(y <= 2.75e-139)) {
tmp = (x_m / t) / y;
} else {
tmp = x_m / -(z * t);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z, t] = sort([x_m, y, z, t]) def code(x_s, x_m, y, z, t): tmp = 0 if y <= -7.8e+46: tmp = x_m / (z * -y) elif (y <= -6e-85) or not (y <= 2.75e-139): tmp = (x_m / t) / y else: tmp = x_m / -(z * t) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z, t = sort([x_m, y, z, t]) function code(x_s, x_m, y, z, t) tmp = 0.0 if (y <= -7.8e+46) tmp = Float64(x_m / Float64(z * Float64(-y))); elseif ((y <= -6e-85) || !(y <= 2.75e-139)) tmp = Float64(Float64(x_m / t) / y); else tmp = Float64(x_m / Float64(-Float64(z * t))); end return Float64(x_s * tmp) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp_2 = code(x_s, x_m, y, z, t)
tmp = 0.0;
if (y <= -7.8e+46)
tmp = x_m / (z * -y);
elseif ((y <= -6e-85) || ~((y <= 2.75e-139)))
tmp = (x_m / t) / y;
else
tmp = x_m / -(z * t);
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]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[y, -7.8e+46], N[(x$95$m / N[(z * (-y)), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, -6e-85], N[Not[LessEqual[y, 2.75e-139]], $MachinePrecision]], N[(N[(x$95$m / t), $MachinePrecision] / y), $MachinePrecision], N[(x$95$m / (-N[(z * t), $MachinePrecision])), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -7.8 \cdot 10^{+46}:\\
\;\;\;\;\frac{x\_m}{z \cdot \left(-y\right)}\\
\mathbf{elif}\;y \leq -6 \cdot 10^{-85} \lor \neg \left(y \leq 2.75 \cdot 10^{-139}\right):\\
\;\;\;\;\frac{\frac{x\_m}{t}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{-z \cdot t}\\
\end{array}
\end{array}
if y < -7.7999999999999999e46Initial program 87.7%
Taylor expanded in y around inf 87.6%
*-commutative87.6%
Simplified87.6%
Taylor expanded in t around 0 54.2%
mul-1-neg54.2%
distribute-neg-frac254.2%
distribute-rgt-neg-out54.2%
Simplified54.2%
if -7.7999999999999999e46 < y < -6.00000000000000044e-85 or 2.7499999999999998e-139 < y Initial program 91.8%
associate-/l/98.6%
clear-num98.1%
inv-pow98.1%
div-inv98.0%
clear-num98.2%
Applied egg-rr98.2%
*-commutative98.2%
associate-/r/95.7%
inv-pow95.7%
associate-/r/96.3%
*-commutative96.3%
clear-num96.0%
associate-*l/96.2%
*-un-lft-identity96.2%
Applied egg-rr96.2%
clear-num96.0%
associate-/r/96.0%
Applied egg-rr96.0%
Taylor expanded in z around 0 57.4%
associate-/r*62.4%
Simplified62.4%
if -6.00000000000000044e-85 < y < 2.7499999999999998e-139Initial program 93.6%
associate-/l/93.8%
Simplified93.8%
Taylor expanded in t around inf 51.5%
Taylor expanded in y around 0 50.3%
associate-*r/50.3%
neg-mul-150.3%
*-commutative50.3%
Simplified50.3%
Final simplification56.2%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= y -3.1e-81)
(* x_m (/ (/ -1.0 (- z t)) y))
(if (<= y 2.06e-135) (/ (/ x_m z) (- z t)) (/ (/ x_m t) (- y z))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (y <= -3.1e-81) {
tmp = x_m * ((-1.0 / (z - t)) / y);
} else if (y <= 2.06e-135) {
tmp = (x_m / z) / (z - t);
} else {
tmp = (x_m / t) / (y - z);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-3.1d-81)) then
tmp = x_m * (((-1.0d0) / (z - t)) / y)
else if (y <= 2.06d-135) then
tmp = (x_m / z) / (z - t)
else
tmp = (x_m / t) / (y - z)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (y <= -3.1e-81) {
tmp = x_m * ((-1.0 / (z - t)) / y);
} else if (y <= 2.06e-135) {
tmp = (x_m / z) / (z - t);
} else {
tmp = (x_m / t) / (y - z);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z, t] = sort([x_m, y, z, t]) def code(x_s, x_m, y, z, t): tmp = 0 if y <= -3.1e-81: tmp = x_m * ((-1.0 / (z - t)) / y) elif y <= 2.06e-135: tmp = (x_m / z) / (z - t) else: tmp = (x_m / t) / (y - z) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z, t = sort([x_m, y, z, t]) function code(x_s, x_m, y, z, t) tmp = 0.0 if (y <= -3.1e-81) tmp = Float64(x_m * Float64(Float64(-1.0 / Float64(z - t)) / y)); elseif (y <= 2.06e-135) tmp = Float64(Float64(x_m / z) / Float64(z - t)); else tmp = Float64(Float64(x_m / t) / Float64(y - z)); end return Float64(x_s * tmp) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp_2 = code(x_s, x_m, y, z, t)
tmp = 0.0;
if (y <= -3.1e-81)
tmp = x_m * ((-1.0 / (z - t)) / y);
elseif (y <= 2.06e-135)
tmp = (x_m / z) / (z - t);
else
tmp = (x_m / t) / (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]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[y, -3.1e-81], N[(x$95$m * N[(N[(-1.0 / N[(z - t), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.06e-135], N[(N[(x$95$m / z), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / t), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -3.1 \cdot 10^{-81}:\\
\;\;\;\;x\_m \cdot \frac{\frac{-1}{z - t}}{y}\\
\mathbf{elif}\;y \leq 2.06 \cdot 10^{-135}:\\
\;\;\;\;\frac{\frac{x\_m}{z}}{z - t}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x\_m}{t}}{y - z}\\
\end{array}
\end{array}
if y < -3.09999999999999988e-81Initial program 89.7%
associate-/l/96.0%
clear-num95.8%
inv-pow95.8%
div-inv95.8%
clear-num95.9%
Applied egg-rr95.9%
unpow-195.9%
Applied egg-rr95.9%
Taylor expanded in y around inf 82.0%
*-lft-identity82.0%
times-frac81.3%
associate-*l/81.3%
*-lft-identity81.3%
Simplified81.3%
div-inv81.2%
associate-/l*83.6%
Applied egg-rr83.6%
if -3.09999999999999988e-81 < y < 2.0599999999999999e-135Initial program 93.6%
Taylor expanded in x around 0 93.6%
associate-/l/96.7%
Simplified96.7%
Taylor expanded in y around 0 88.4%
associate-*r/88.4%
neg-mul-188.4%
Simplified88.4%
if 2.0599999999999999e-135 < y Initial program 91.1%
associate-/l/98.4%
Simplified98.4%
Taylor expanded in t around inf 71.0%
Final simplification81.0%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= t -1750.0)
(/ 1.0 (* t (/ y x_m)))
(if (<= t 3.8e-113) (/ (/ (- x_m) z) y) (/ x_m (* (- y z) t))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (t <= -1750.0) {
tmp = 1.0 / (t * (y / x_m));
} else if (t <= 3.8e-113) {
tmp = (-x_m / z) / y;
} else {
tmp = x_m / ((y - z) * t);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-1750.0d0)) then
tmp = 1.0d0 / (t * (y / x_m))
else if (t <= 3.8d-113) then
tmp = (-x_m / z) / y
else
tmp = x_m / ((y - z) * t)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (t <= -1750.0) {
tmp = 1.0 / (t * (y / x_m));
} else if (t <= 3.8e-113) {
tmp = (-x_m / z) / y;
} else {
tmp = x_m / ((y - z) * t);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z, t] = sort([x_m, y, z, t]) def code(x_s, x_m, y, z, t): tmp = 0 if t <= -1750.0: tmp = 1.0 / (t * (y / x_m)) elif t <= 3.8e-113: tmp = (-x_m / z) / y else: tmp = x_m / ((y - z) * t) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z, t = sort([x_m, y, z, t]) function code(x_s, x_m, y, z, t) tmp = 0.0 if (t <= -1750.0) tmp = Float64(1.0 / Float64(t * Float64(y / x_m))); elseif (t <= 3.8e-113) tmp = Float64(Float64(Float64(-x_m) / z) / y); else tmp = Float64(x_m / Float64(Float64(y - z) * t)); end return Float64(x_s * tmp) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp_2 = code(x_s, x_m, y, z, t)
tmp = 0.0;
if (t <= -1750.0)
tmp = 1.0 / (t * (y / x_m));
elseif (t <= 3.8e-113)
tmp = (-x_m / z) / y;
else
tmp = x_m / ((y - z) * t);
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]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[t, -1750.0], N[(1.0 / N[(t * N[(y / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.8e-113], N[(N[((-x$95$m) / z), $MachinePrecision] / y), $MachinePrecision], N[(x$95$m / N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq -1750:\\
\;\;\;\;\frac{1}{t \cdot \frac{y}{x\_m}}\\
\mathbf{elif}\;t \leq 3.8 \cdot 10^{-113}:\\
\;\;\;\;\frac{\frac{-x\_m}{z}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{\left(y - z\right) \cdot t}\\
\end{array}
\end{array}
if t < -1750Initial program 93.3%
Taylor expanded in z around 0 51.6%
clear-num51.5%
inv-pow51.5%
*-commutative51.5%
associate-/l*65.3%
Applied egg-rr65.3%
unpow-165.3%
associate-*r/51.5%
*-commutative51.5%
associate-/l*55.3%
Simplified55.3%
if -1750 < t < 3.79999999999999983e-113Initial program 93.3%
associate-/l/97.7%
clear-num97.2%
inv-pow97.2%
div-inv97.2%
clear-num97.4%
Applied egg-rr97.4%
unpow-197.4%
Applied egg-rr97.4%
Taylor expanded in y around inf 58.0%
*-lft-identity58.0%
times-frac61.8%
associate-*l/61.8%
*-lft-identity61.8%
Simplified61.8%
Taylor expanded in t around 0 43.7%
associate-*r/43.7%
neg-mul-143.7%
Simplified43.7%
if 3.79999999999999983e-113 < t Initial program 88.7%
Taylor expanded in t around inf 75.4%
Final simplification58.4%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= y -4.8e-82)
(* (/ 1.0 t) (/ x_m y))
(if (<= y 4.65e-141) (/ (/ (- x_m) z) t) (/ (/ x_m t) y)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (y <= -4.8e-82) {
tmp = (1.0 / t) * (x_m / y);
} else if (y <= 4.65e-141) {
tmp = (-x_m / z) / t;
} else {
tmp = (x_m / t) / y;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-4.8d-82)) then
tmp = (1.0d0 / t) * (x_m / y)
else if (y <= 4.65d-141) then
tmp = (-x_m / z) / t
else
tmp = (x_m / t) / y
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (y <= -4.8e-82) {
tmp = (1.0 / t) * (x_m / y);
} else if (y <= 4.65e-141) {
tmp = (-x_m / z) / t;
} else {
tmp = (x_m / t) / y;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z, t] = sort([x_m, y, z, t]) def code(x_s, x_m, y, z, t): tmp = 0 if y <= -4.8e-82: tmp = (1.0 / t) * (x_m / y) elif y <= 4.65e-141: tmp = (-x_m / z) / t else: tmp = (x_m / t) / y return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z, t = sort([x_m, y, z, t]) function code(x_s, x_m, y, z, t) tmp = 0.0 if (y <= -4.8e-82) tmp = Float64(Float64(1.0 / t) * Float64(x_m / y)); elseif (y <= 4.65e-141) tmp = Float64(Float64(Float64(-x_m) / z) / t); else tmp = Float64(Float64(x_m / t) / y); end return Float64(x_s * tmp) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp_2 = code(x_s, x_m, y, z, t)
tmp = 0.0;
if (y <= -4.8e-82)
tmp = (1.0 / t) * (x_m / y);
elseif (y <= 4.65e-141)
tmp = (-x_m / z) / t;
else
tmp = (x_m / t) / y;
end
tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[y, -4.8e-82], N[(N[(1.0 / t), $MachinePrecision] * N[(x$95$m / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.65e-141], N[(N[((-x$95$m) / z), $MachinePrecision] / t), $MachinePrecision], N[(N[(x$95$m / t), $MachinePrecision] / y), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -4.8 \cdot 10^{-82}:\\
\;\;\;\;\frac{1}{t} \cdot \frac{x\_m}{y}\\
\mathbf{elif}\;y \leq 4.65 \cdot 10^{-141}:\\
\;\;\;\;\frac{\frac{-x\_m}{z}}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x\_m}{t}}{y}\\
\end{array}
\end{array}
if y < -4.80000000000000017e-82Initial program 89.7%
Taylor expanded in z around 0 58.6%
*-un-lft-identity58.6%
times-frac65.4%
Applied egg-rr65.4%
if -4.80000000000000017e-82 < y < 4.6500000000000001e-141Initial program 93.6%
associate-/l/93.8%
Simplified93.8%
Taylor expanded in t around inf 51.5%
Taylor expanded in y around 0 50.3%
associate-*r/50.3%
neg-mul-150.3%
*-commutative50.3%
Simplified50.3%
Taylor expanded in x around 0 50.3%
mul-1-neg50.3%
associate-/l/54.9%
distribute-neg-frac254.9%
Simplified54.9%
if 4.6500000000000001e-141 < y Initial program 91.1%
associate-/l/98.4%
clear-num97.8%
inv-pow97.8%
div-inv97.7%
clear-num97.9%
Applied egg-rr97.9%
*-commutative97.9%
associate-/r/96.0%
inv-pow96.0%
associate-/r/96.6%
*-commutative96.6%
clear-num96.3%
associate-*l/96.4%
*-un-lft-identity96.4%
Applied egg-rr96.4%
clear-num96.3%
associate-/r/96.3%
Applied egg-rr96.3%
Taylor expanded in z around 0 57.7%
associate-/r*64.0%
Simplified64.0%
Final simplification61.1%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (or (<= z -1.8e+65) (not (<= z 1.4e+67)))
(/ x_m (* z t))
(/ x_m (* y t)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if ((z <= -1.8e+65) || !(z <= 1.4e+67)) {
tmp = x_m / (z * t);
} else {
tmp = x_m / (y * t);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1.8d+65)) .or. (.not. (z <= 1.4d+67))) then
tmp = x_m / (z * t)
else
tmp = x_m / (y * t)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if ((z <= -1.8e+65) || !(z <= 1.4e+67)) {
tmp = x_m / (z * t);
} else {
tmp = x_m / (y * t);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z, t] = sort([x_m, y, z, t]) def code(x_s, x_m, y, z, t): tmp = 0 if (z <= -1.8e+65) or not (z <= 1.4e+67): tmp = x_m / (z * t) else: tmp = x_m / (y * t) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z, t = sort([x_m, y, z, t]) function code(x_s, x_m, y, z, t) tmp = 0.0 if ((z <= -1.8e+65) || !(z <= 1.4e+67)) tmp = Float64(x_m / Float64(z * t)); else tmp = Float64(x_m / Float64(y * t)); end return Float64(x_s * tmp) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp_2 = code(x_s, x_m, y, z, t)
tmp = 0.0;
if ((z <= -1.8e+65) || ~((z <= 1.4e+67)))
tmp = x_m / (z * t);
else
tmp = x_m / (y * t);
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]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[Or[LessEqual[z, -1.8e+65], N[Not[LessEqual[z, 1.4e+67]], $MachinePrecision]], N[(x$95$m / N[(z * t), $MachinePrecision]), $MachinePrecision], N[(x$95$m / N[(y * t), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{+65} \lor \neg \left(z \leq 1.4 \cdot 10^{+67}\right):\\
\;\;\;\;\frac{x\_m}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{y \cdot t}\\
\end{array}
\end{array}
if z < -1.79999999999999989e65 or 1.3999999999999999e67 < z Initial program 86.0%
associate-/l/99.8%
Simplified99.8%
Taylor expanded in t around inf 45.1%
Taylor expanded in y around 0 42.1%
associate-*r/42.1%
neg-mul-142.1%
*-commutative42.1%
Simplified42.1%
add-sqr-sqrt25.0%
sqrt-unprod46.2%
sqr-neg46.2%
sqrt-unprod17.1%
add-sqr-sqrt41.0%
*-un-lft-identity41.0%
associate-/r*51.2%
Applied egg-rr51.2%
*-lft-identity51.2%
associate-/l/41.0%
*-commutative41.0%
Simplified41.0%
if -1.79999999999999989e65 < z < 1.3999999999999999e67Initial program 94.3%
Taylor expanded in z around 0 52.9%
Final simplification49.0%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x_s x_m y z t) :precision binary64 (* x_s (if (<= z -8.5e+149) (/ (/ x_m z) (- z t)) (/ x_m (* (- y z) (- t z))))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (z <= -8.5e+149) {
tmp = (x_m / z) / (z - t);
} else {
tmp = x_m / ((y - z) * (t - z));
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-8.5d+149)) then
tmp = (x_m / z) / (z - t)
else
tmp = x_m / ((y - z) * (t - z))
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (z <= -8.5e+149) {
tmp = (x_m / z) / (z - t);
} else {
tmp = x_m / ((y - z) * (t - z));
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z, t] = sort([x_m, y, z, t]) def code(x_s, x_m, y, z, t): tmp = 0 if z <= -8.5e+149: tmp = (x_m / z) / (z - t) else: tmp = x_m / ((y - z) * (t - z)) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z, t = sort([x_m, y, z, t]) function code(x_s, x_m, y, z, t) tmp = 0.0 if (z <= -8.5e+149) tmp = Float64(Float64(x_m / z) / Float64(z - t)); else tmp = Float64(x_m / Float64(Float64(y - z) * Float64(t - z))); end return Float64(x_s * tmp) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp_2 = code(x_s, x_m, y, z, t)
tmp = 0.0;
if (z <= -8.5e+149)
tmp = (x_m / z) / (z - t);
else
tmp = x_m / ((y - z) * (t - 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]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[z, -8.5e+149], N[(N[(x$95$m / z), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision], N[(x$95$m / N[(N[(y - z), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -8.5 \cdot 10^{+149}:\\
\;\;\;\;\frac{\frac{x\_m}{z}}{z - t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{\left(y - z\right) \cdot \left(t - z\right)}\\
\end{array}
\end{array}
if z < -8.49999999999999956e149Initial program 79.3%
Taylor expanded in x around 0 79.3%
associate-/l/100.0%
Simplified100.0%
Taylor expanded in y around 0 99.6%
associate-*r/99.6%
neg-mul-199.6%
Simplified99.6%
if -8.49999999999999956e149 < z Initial program 92.9%
Final simplification93.5%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x_s x_m y z t) :precision binary64 (* x_s (if (<= t 2.45e+27) (/ (/ x_m (- t z)) y) (/ (/ x_m t) (- y z)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (t <= 2.45e+27) {
tmp = (x_m / (t - z)) / y;
} else {
tmp = (x_m / t) / (y - z);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= 2.45d+27) then
tmp = (x_m / (t - z)) / y
else
tmp = (x_m / t) / (y - z)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (t <= 2.45e+27) {
tmp = (x_m / (t - z)) / y;
} else {
tmp = (x_m / t) / (y - z);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z, t] = sort([x_m, y, z, t]) def code(x_s, x_m, y, z, t): tmp = 0 if t <= 2.45e+27: tmp = (x_m / (t - z)) / y else: tmp = (x_m / t) / (y - z) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z, t = sort([x_m, y, z, t]) function code(x_s, x_m, y, z, t) tmp = 0.0 if (t <= 2.45e+27) tmp = Float64(Float64(x_m / Float64(t - z)) / y); else tmp = Float64(Float64(x_m / t) / Float64(y - z)); end return Float64(x_s * tmp) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp_2 = code(x_s, x_m, y, z, t)
tmp = 0.0;
if (t <= 2.45e+27)
tmp = (x_m / (t - z)) / y;
else
tmp = (x_m / t) / (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]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[t, 2.45e+27], N[(N[(x$95$m / N[(t - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(N[(x$95$m / t), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq 2.45 \cdot 10^{+27}:\\
\;\;\;\;\frac{\frac{x\_m}{t - z}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x\_m}{t}}{y - z}\\
\end{array}
\end{array}
if t < 2.45000000000000007e27Initial program 92.9%
associate-/l/95.3%
clear-num95.0%
inv-pow95.0%
div-inv94.9%
clear-num95.1%
Applied egg-rr95.1%
unpow-195.1%
Applied egg-rr95.1%
Taylor expanded in y around inf 58.7%
*-lft-identity58.7%
times-frac63.3%
associate-*l/63.3%
*-lft-identity63.3%
Simplified63.3%
if 2.45000000000000007e27 < t Initial program 87.5%
associate-/l/98.3%
Simplified98.3%
Taylor expanded in t around inf 92.7%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x_s x_m y z t) :precision binary64 (* x_s (if (<= y -1.16e-17) (/ x_m (* y (- t z))) (/ (/ x_m t) (- y z)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (y <= -1.16e-17) {
tmp = x_m / (y * (t - z));
} else {
tmp = (x_m / t) / (y - z);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-1.16d-17)) then
tmp = x_m / (y * (t - z))
else
tmp = (x_m / t) / (y - z)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (y <= -1.16e-17) {
tmp = x_m / (y * (t - z));
} else {
tmp = (x_m / t) / (y - z);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z, t] = sort([x_m, y, z, t]) def code(x_s, x_m, y, z, t): tmp = 0 if y <= -1.16e-17: tmp = x_m / (y * (t - z)) else: tmp = (x_m / t) / (y - z) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z, t = sort([x_m, y, z, t]) function code(x_s, x_m, y, z, t) tmp = 0.0 if (y <= -1.16e-17) tmp = Float64(x_m / Float64(y * Float64(t - z))); else tmp = Float64(Float64(x_m / t) / Float64(y - z)); end return Float64(x_s * tmp) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp_2 = code(x_s, x_m, y, z, t)
tmp = 0.0;
if (y <= -1.16e-17)
tmp = x_m / (y * (t - z));
else
tmp = (x_m / t) / (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]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[y, -1.16e-17], N[(x$95$m / N[(y * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / t), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -1.16 \cdot 10^{-17}:\\
\;\;\;\;\frac{x\_m}{y \cdot \left(t - z\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x\_m}{t}}{y - z}\\
\end{array}
\end{array}
if y < -1.16e-17Initial program 88.4%
Taylor expanded in y around inf 84.1%
*-commutative84.1%
Simplified84.1%
if -1.16e-17 < y Initial program 92.7%
associate-/l/96.2%
Simplified96.2%
Taylor expanded in t around inf 61.0%
Final simplification67.0%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x_s x_m y z t) :precision binary64 (* x_s (if (<= y -3.5e-10) (/ x_m (* y (- t z))) (/ x_m (* (- y z) t)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (y <= -3.5e-10) {
tmp = x_m / (y * (t - z));
} else {
tmp = x_m / ((y - z) * t);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-3.5d-10)) then
tmp = x_m / (y * (t - z))
else
tmp = x_m / ((y - z) * t)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (y <= -3.5e-10) {
tmp = x_m / (y * (t - z));
} else {
tmp = x_m / ((y - z) * t);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z, t] = sort([x_m, y, z, t]) def code(x_s, x_m, y, z, t): tmp = 0 if y <= -3.5e-10: tmp = x_m / (y * (t - z)) else: tmp = x_m / ((y - z) * t) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z, t = sort([x_m, y, z, t]) function code(x_s, x_m, y, z, t) tmp = 0.0 if (y <= -3.5e-10) tmp = Float64(x_m / Float64(y * Float64(t - z))); else tmp = Float64(x_m / Float64(Float64(y - z) * t)); end return Float64(x_s * tmp) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp_2 = code(x_s, x_m, y, z, t)
tmp = 0.0;
if (y <= -3.5e-10)
tmp = x_m / (y * (t - z));
else
tmp = x_m / ((y - z) * t);
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]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[y, -3.5e-10], N[(x$95$m / N[(y * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$95$m / N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -3.5 \cdot 10^{-10}:\\
\;\;\;\;\frac{x\_m}{y \cdot \left(t - z\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{\left(y - z\right) \cdot t}\\
\end{array}
\end{array}
if y < -3.4999999999999998e-10Initial program 88.1%
Taylor expanded in y around inf 85.1%
*-commutative85.1%
Simplified85.1%
if -3.4999999999999998e-10 < y Initial program 92.8%
Taylor expanded in t around inf 60.7%
Final simplification66.8%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x_s x_m y z t) :precision binary64 (* x_s (if (<= z -1.3e+118) (/ x_m (* z t)) (/ (/ x_m t) y))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (z <= -1.3e+118) {
tmp = x_m / (z * t);
} else {
tmp = (x_m / t) / y;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-1.3d+118)) then
tmp = x_m / (z * t)
else
tmp = (x_m / t) / y
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (z <= -1.3e+118) {
tmp = x_m / (z * t);
} else {
tmp = (x_m / t) / y;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z, t] = sort([x_m, y, z, t]) def code(x_s, x_m, y, z, t): tmp = 0 if z <= -1.3e+118: tmp = x_m / (z * t) else: tmp = (x_m / t) / y return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z, t = sort([x_m, y, z, t]) function code(x_s, x_m, y, z, t) tmp = 0.0 if (z <= -1.3e+118) tmp = Float64(x_m / Float64(z * t)); else tmp = Float64(Float64(x_m / t) / y); end return Float64(x_s * tmp) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp_2 = code(x_s, x_m, y, z, t)
tmp = 0.0;
if (z <= -1.3e+118)
tmp = x_m / (z * t);
else
tmp = (x_m / t) / y;
end
tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[z, -1.3e+118], N[(x$95$m / N[(z * t), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / t), $MachinePrecision] / y), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{+118}:\\
\;\;\;\;\frac{x\_m}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x\_m}{t}}{y}\\
\end{array}
\end{array}
if z < -1.30000000000000008e118Initial program 84.9%
associate-/l/99.9%
Simplified99.9%
Taylor expanded in t around inf 33.0%
Taylor expanded in y around 0 33.0%
associate-*r/33.0%
neg-mul-133.0%
*-commutative33.0%
Simplified33.0%
add-sqr-sqrt22.4%
sqrt-unprod35.1%
sqr-neg35.1%
sqrt-unprod10.5%
add-sqr-sqrt32.8%
*-un-lft-identity32.8%
associate-/r*41.5%
Applied egg-rr41.5%
*-lft-identity41.5%
associate-/l/32.8%
*-commutative32.8%
Simplified32.8%
if -1.30000000000000008e118 < z Initial program 92.6%
associate-/l/95.4%
clear-num95.2%
inv-pow95.2%
div-inv95.1%
clear-num95.3%
Applied egg-rr95.3%
*-commutative95.3%
associate-/r/95.7%
inv-pow95.7%
associate-/r/95.9%
*-commutative95.9%
clear-num95.8%
associate-*l/95.9%
*-un-lft-identity95.9%
Applied egg-rr95.9%
clear-num95.8%
associate-/r/95.7%
Applied egg-rr95.7%
Taylor expanded in z around 0 46.2%
associate-/r*51.6%
Simplified51.6%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function. (FPCore (x_s x_m y z t) :precision binary64 (* x_s (/ x_m (* y t))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
assert(x_m < y && y < z && z < t);
double code(double x_s, double x_m, double y, double z, double t) {
return x_s * (x_m / (y * t));
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x_s, x_m, y, z, t)
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x_s * (x_m / (y * t))
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
assert x_m < y && y < z && z < t;
public static double code(double x_s, double x_m, double y, double z, double t) {
return x_s * (x_m / (y * t));
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) [x_m, y, z, t] = sort([x_m, y, z, t]) def code(x_s, x_m, y, z, t): return x_s * (x_m / (y * t))
x\_m = abs(x) x\_s = copysign(1.0, x) x_m, y, z, t = sort([x_m, y, z, t]) function code(x_s, x_m, y, z, t) return Float64(x_s * Float64(x_m / Float64(y * t))) end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
x_m, y, z, t = num2cell(sort([x_m, y, z, t])){:}
function tmp = code(x_s, x_m, y, z, t)
tmp = x_s * (x_m / (y * t));
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]
NOTE: x_m, y, z, and t should be sorted in increasing order before calling this function.
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * N[(x$95$m / N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
[x_m, y, z, t] = \mathsf{sort}([x_m, y, z, t])\\
\\
x\_s \cdot \frac{x\_m}{y \cdot t}
\end{array}
Initial program 91.6%
Taylor expanded in z around 0 42.5%
Final simplification42.5%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (- y z) (- t z)))) (if (< (/ x t_1) 0.0) (/ (/ x (- y z)) (- t z)) (* x (/ 1.0 t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (y - z) * (t - z);
double tmp;
if ((x / t_1) < 0.0) {
tmp = (x / (y - z)) / (t - z);
} else {
tmp = x * (1.0 / t_1);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (y - z) * (t - z)
if ((x / t_1) < 0.0d0) then
tmp = (x / (y - z)) / (t - z)
else
tmp = x * (1.0d0 / t_1)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (y - z) * (t - z);
double tmp;
if ((x / t_1) < 0.0) {
tmp = (x / (y - z)) / (t - z);
} else {
tmp = x * (1.0 / t_1);
}
return tmp;
}
def code(x, y, z, t): t_1 = (y - z) * (t - z) tmp = 0 if (x / t_1) < 0.0: tmp = (x / (y - z)) / (t - z) else: tmp = x * (1.0 / t_1) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y - z) * Float64(t - z)) tmp = 0.0 if (Float64(x / t_1) < 0.0) tmp = Float64(Float64(x / Float64(y - z)) / Float64(t - z)); else tmp = Float64(x * Float64(1.0 / t_1)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y - z) * (t - z); tmp = 0.0; if ((x / t_1) < 0.0) tmp = (x / (y - z)) / (t - z); else tmp = x * (1.0 / t_1); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]}, If[Less[N[(x / t$95$1), $MachinePrecision], 0.0], N[(N[(x / N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 / t$95$1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - z\right) \cdot \left(t - z\right)\\
\mathbf{if}\;\frac{x}{t\_1} < 0:\\
\;\;\;\;\frac{\frac{x}{y - z}}{t - z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{1}{t\_1}\\
\end{array}
\end{array}
herbie shell --seed 2024086
(FPCore (x y z t)
:name "Data.Random.Distribution.Triangular:triangularCDF from random-fu-0.2.6.2, B"
:precision binary64
:alt
(if (< (/ x (* (- y z) (- t z))) 0.0) (/ (/ x (- y z)) (- t z)) (* x (/ 1.0 (* (- y z) (- t z)))))
(/ x (* (- y z) (- t z))))