
(FPCore (x y z t) :precision binary64 (* x (- (/ y z) (/ t (- 1.0 z)))))
double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - 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 / (1.0d0 - z)))
end function
public static double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - z)));
}
def code(x, y, z, t): return x * ((y / z) - (t / (1.0 - z)))
function code(x, y, z, t) return Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))) end
function tmp = code(x, y, z, t) tmp = x * ((y / z) - (t / (1.0 - z))); end
code[x_, y_, z_, t_] := N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (* x (- (/ y z) (/ t (- 1.0 z)))))
double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - 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 / (1.0d0 - z)))
end function
public static double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - z)));
}
def code(x, y, z, t): return x * ((y / z) - (t / (1.0 - z)))
function code(x, y, z, t) return Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))) end
function tmp = code(x, y, z, t) tmp = x * ((y / z) - (t / (1.0 - z))); end
code[x_, y_, z_, t_] := N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
\end{array}
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(let* ((t_1 (* x_m (- (/ y z) (/ t (- 1.0 z))))))
(*
x_s
(if (<= t_1 (- INFINITY))
(* (fma (- t) z (* (- 1.0 z) y)) (/ x_m (* (- 1.0 z) z)))
t_1))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = x_m * ((y / z) - (t / (1.0 - z)));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = fma(-t, z, ((1.0 - z) * y)) * (x_m / ((1.0 - z) * z));
} else {
tmp = t_1;
}
return x_s * tmp;
}
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) t_1 = Float64(x_m * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(fma(Float64(-t), z, Float64(Float64(1.0 - z) * y)) * Float64(x_m / Float64(Float64(1.0 - z) * z))); else tmp = t_1; end return Float64(x_s * tmp) end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(x$95$m * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t$95$1, (-Infinity)], N[(N[((-t) * z + N[(N[(1.0 - z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] * N[(x$95$m / N[(N[(1.0 - z), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
\begin{array}{l}
t_1 := x\_m \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(-t, z, \left(1 - z\right) \cdot y\right) \cdot \frac{x\_m}{\left(1 - z\right) \cdot z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if (*.f64 x (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z)))) < -inf.0Initial program 80.6%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-subN/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-outN/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6493.1
Applied rewrites93.1%
if -inf.0 < (*.f64 x (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z)))) Initial program 95.8%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y z t) :precision binary64 (let* ((t_1 (- (/ y z) (/ t (- 1.0 z))))) (* x_s (if (<= t_1 (- INFINITY)) (* y (/ x_m z)) (* x_m t_1)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = (y / z) - (t / (1.0 - z));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = y * (x_m / z);
} else {
tmp = x_m * t_1;
}
return x_s * tmp;
}
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = (y / z) - (t / (1.0 - z));
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = y * (x_m / z);
} else {
tmp = x_m * t_1;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): t_1 = (y / z) - (t / (1.0 - z)) tmp = 0 if t_1 <= -math.inf: tmp = y * (x_m / z) else: tmp = x_m * t_1 return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) t_1 = Float64(Float64(y / z) - Float64(t / Float64(1.0 - z))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(y * Float64(x_m / z)); else tmp = Float64(x_m * t_1); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) t_1 = (y / z) - (t / (1.0 - z)); tmp = 0.0; if (t_1 <= -Inf) tmp = y * (x_m / z); else tmp = x_m * 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]
code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t$95$1, (-Infinity)], N[(y * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision], N[(x$95$m * t$95$1), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
\begin{array}{l}
t_1 := \frac{y}{z} - \frac{t}{1 - z}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;y \cdot \frac{x\_m}{z}\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot t\_1\\
\end{array}
\end{array}
\end{array}
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < -inf.0Initial program 61.2%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6461.2
Applied rewrites61.2%
Applied rewrites100.0%
if -inf.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) Initial program 96.4%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= z -2.05e+282)
(* y (/ x_m z))
(if (or (<= z -1150000000000.0) (not (<= z 6e+17)))
(/ (* (+ t y) x_m) z)
(* x_m (- (/ y z) t))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (z <= -2.05e+282) {
tmp = y * (x_m / z);
} else if ((z <= -1150000000000.0) || !(z <= 6e+17)) {
tmp = ((t + y) * x_m) / z;
} else {
tmp = x_m * ((y / z) - t);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
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 <= (-2.05d+282)) then
tmp = y * (x_m / z)
else if ((z <= (-1150000000000.0d0)) .or. (.not. (z <= 6d+17))) then
tmp = ((t + y) * x_m) / 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);
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (z <= -2.05e+282) {
tmp = y * (x_m / z);
} else if ((z <= -1150000000000.0) || !(z <= 6e+17)) {
tmp = ((t + y) * x_m) / z;
} else {
tmp = x_m * ((y / z) - t);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if z <= -2.05e+282: tmp = y * (x_m / z) elif (z <= -1150000000000.0) or not (z <= 6e+17): tmp = ((t + y) * x_m) / z else: tmp = x_m * ((y / z) - t) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (z <= -2.05e+282) tmp = Float64(y * Float64(x_m / z)); elseif ((z <= -1150000000000.0) || !(z <= 6e+17)) tmp = Float64(Float64(Float64(t + y) * x_m) / 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); function tmp_2 = code(x_s, x_m, y, z, t) tmp = 0.0; if (z <= -2.05e+282) tmp = y * (x_m / z); elseif ((z <= -1150000000000.0) || ~((z <= 6e+17))) tmp = ((t + y) * x_m) / 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]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[z, -2.05e+282], N[(y * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -1150000000000.0], N[Not[LessEqual[z, 6e+17]], $MachinePrecision]], N[(N[(N[(t + y), $MachinePrecision] * x$95$m), $MachinePrecision] / z), $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\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -2.05 \cdot 10^{+282}:\\
\;\;\;\;y \cdot \frac{x\_m}{z}\\
\mathbf{elif}\;z \leq -1150000000000 \lor \neg \left(z \leq 6 \cdot 10^{+17}\right):\\
\;\;\;\;\frac{\left(t + y\right) \cdot x\_m}{z}\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot \left(\frac{y}{z} - t\right)\\
\end{array}
\end{array}
if z < -2.04999999999999997e282Initial program 99.8%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6491.8
Applied rewrites91.8%
Applied rewrites92.0%
if -2.04999999999999997e282 < z < -1.15e12 or 6e17 < z Initial program 94.8%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
lower-+.f6481.9
Applied rewrites81.9%
if -1.15e12 < z < 6e17Initial program 93.0%
Taylor expanded in z around 0
associate-*r*N/A
mul-1-negN/A
fp-cancel-sub-signN/A
div-subN/A
associate-/l*N/A
*-inversesN/A
*-rgt-identityN/A
lower--.f64N/A
lower-/.f6491.3
Applied rewrites91.3%
Final simplification86.7%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(let* ((t_1 (* y (/ x_m z))))
(*
x_s
(if (<= y -2.2e-22)
t_1
(if (<= y 4.8e-44)
(* x_m (/ t (- z 1.0)))
(if (<= y 7e+159) (/ (* (+ t y) x_m) z) t_1))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = y * (x_m / z);
double tmp;
if (y <= -2.2e-22) {
tmp = t_1;
} else if (y <= 4.8e-44) {
tmp = x_m * (t / (z - 1.0));
} else if (y <= 7e+159) {
tmp = ((t + y) * x_m) / z;
} else {
tmp = t_1;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
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 = y * (x_m / z)
if (y <= (-2.2d-22)) then
tmp = t_1
else if (y <= 4.8d-44) then
tmp = x_m * (t / (z - 1.0d0))
else if (y <= 7d+159) then
tmp = ((t + y) * x_m) / z
else
tmp = t_1
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = y * (x_m / z);
double tmp;
if (y <= -2.2e-22) {
tmp = t_1;
} else if (y <= 4.8e-44) {
tmp = x_m * (t / (z - 1.0));
} else if (y <= 7e+159) {
tmp = ((t + y) * x_m) / z;
} else {
tmp = t_1;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): t_1 = y * (x_m / z) tmp = 0 if y <= -2.2e-22: tmp = t_1 elif y <= 4.8e-44: tmp = x_m * (t / (z - 1.0)) elif y <= 7e+159: tmp = ((t + y) * x_m) / z else: tmp = t_1 return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) t_1 = Float64(y * Float64(x_m / z)) tmp = 0.0 if (y <= -2.2e-22) tmp = t_1; elseif (y <= 4.8e-44) tmp = Float64(x_m * Float64(t / Float64(z - 1.0))); elseif (y <= 7e+159) tmp = Float64(Float64(Float64(t + y) * x_m) / z); else tmp = t_1; end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) t_1 = y * (x_m / z); tmp = 0.0; if (y <= -2.2e-22) tmp = t_1; elseif (y <= 4.8e-44) tmp = x_m * (t / (z - 1.0)); elseif (y <= 7e+159) tmp = ((t + y) * x_m) / z; 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]
code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[y, -2.2e-22], t$95$1, If[LessEqual[y, 4.8e-44], N[(x$95$m * N[(t / N[(z - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7e+159], N[(N[(N[(t + y), $MachinePrecision] * x$95$m), $MachinePrecision] / z), $MachinePrecision], t$95$1]]]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
\begin{array}{l}
t_1 := y \cdot \frac{x\_m}{z}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -2.2 \cdot 10^{-22}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 4.8 \cdot 10^{-44}:\\
\;\;\;\;x\_m \cdot \frac{t}{z - 1}\\
\mathbf{elif}\;y \leq 7 \cdot 10^{+159}:\\
\;\;\;\;\frac{\left(t + y\right) \cdot x\_m}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if y < -2.2000000000000001e-22 or 6.9999999999999999e159 < y Initial program 91.9%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6482.4
Applied rewrites82.4%
Applied rewrites87.3%
if -2.2000000000000001e-22 < y < 4.80000000000000017e-44Initial program 95.0%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
mul-1-negN/A
distribute-neg-inN/A
metadata-evalN/A
remove-double-negN/A
lower-+.f6475.5
Applied rewrites75.5%
Taylor expanded in z around 0
Applied rewrites40.9%
Taylor expanded in t around 0
Applied rewrites75.5%
if 4.80000000000000017e-44 < y < 6.9999999999999999e159Initial program 96.9%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
lower-+.f6479.9
Applied rewrites79.9%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(let* ((t_1 (* y (/ x_m z))))
(*
x_s
(if (<= y -2.2e-22)
t_1
(if (<= y 7.4e-47)
(* (/ x_m (- z 1.0)) t)
(if (<= y 7e+159) (/ (* (+ t y) x_m) z) t_1))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = y * (x_m / z);
double tmp;
if (y <= -2.2e-22) {
tmp = t_1;
} else if (y <= 7.4e-47) {
tmp = (x_m / (z - 1.0)) * t;
} else if (y <= 7e+159) {
tmp = ((t + y) * x_m) / z;
} else {
tmp = t_1;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
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 = y * (x_m / z)
if (y <= (-2.2d-22)) then
tmp = t_1
else if (y <= 7.4d-47) then
tmp = (x_m / (z - 1.0d0)) * t
else if (y <= 7d+159) then
tmp = ((t + y) * x_m) / z
else
tmp = t_1
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = y * (x_m / z);
double tmp;
if (y <= -2.2e-22) {
tmp = t_1;
} else if (y <= 7.4e-47) {
tmp = (x_m / (z - 1.0)) * t;
} else if (y <= 7e+159) {
tmp = ((t + y) * x_m) / z;
} else {
tmp = t_1;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): t_1 = y * (x_m / z) tmp = 0 if y <= -2.2e-22: tmp = t_1 elif y <= 7.4e-47: tmp = (x_m / (z - 1.0)) * t elif y <= 7e+159: tmp = ((t + y) * x_m) / z else: tmp = t_1 return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) t_1 = Float64(y * Float64(x_m / z)) tmp = 0.0 if (y <= -2.2e-22) tmp = t_1; elseif (y <= 7.4e-47) tmp = Float64(Float64(x_m / Float64(z - 1.0)) * t); elseif (y <= 7e+159) tmp = Float64(Float64(Float64(t + y) * x_m) / z); else tmp = t_1; end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) t_1 = y * (x_m / z); tmp = 0.0; if (y <= -2.2e-22) tmp = t_1; elseif (y <= 7.4e-47) tmp = (x_m / (z - 1.0)) * t; elseif (y <= 7e+159) tmp = ((t + y) * x_m) / z; 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]
code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[y, -2.2e-22], t$95$1, If[LessEqual[y, 7.4e-47], N[(N[(x$95$m / N[(z - 1.0), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[y, 7e+159], N[(N[(N[(t + y), $MachinePrecision] * x$95$m), $MachinePrecision] / z), $MachinePrecision], t$95$1]]]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
\begin{array}{l}
t_1 := y \cdot \frac{x\_m}{z}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -2.2 \cdot 10^{-22}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 7.4 \cdot 10^{-47}:\\
\;\;\;\;\frac{x\_m}{z - 1} \cdot t\\
\mathbf{elif}\;y \leq 7 \cdot 10^{+159}:\\
\;\;\;\;\frac{\left(t + y\right) \cdot x\_m}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if y < -2.2000000000000001e-22 or 6.9999999999999999e159 < y Initial program 91.9%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6482.4
Applied rewrites82.4%
Applied rewrites87.3%
if -2.2000000000000001e-22 < y < 7.4000000000000001e-47Initial program 95.0%
Taylor expanded in t around inf
distribute-rgt-inN/A
fp-cancel-sign-sub-invN/A
mul-1-negN/A
distribute-rgt-out--N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
mul-1-negN/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites78.4%
Taylor expanded in y around 0
Applied rewrites75.5%
if 7.4000000000000001e-47 < y < 6.9999999999999999e159Initial program 96.9%
Taylor expanded in z around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
lower-+.f6479.9
Applied rewrites79.9%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (or (<= z -0.135) (not (<= z 5.9e+28)))
(* x_m (/ (+ t y) z))
(* (- y (* z t)) (/ x_m z)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if ((z <= -0.135) || !(z <= 5.9e+28)) {
tmp = x_m * ((t + y) / z);
} else {
tmp = (y - (z * t)) * (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, 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 <= (-0.135d0)) .or. (.not. (z <= 5.9d+28))) then
tmp = x_m * ((t + y) / z)
else
tmp = (y - (z * t)) * (x_m / z)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if ((z <= -0.135) || !(z <= 5.9e+28)) {
tmp = x_m * ((t + y) / z);
} else {
tmp = (y - (z * t)) * (x_m / z);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if (z <= -0.135) or not (z <= 5.9e+28): tmp = x_m * ((t + y) / z) else: tmp = (y - (z * t)) * (x_m / z) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if ((z <= -0.135) || !(z <= 5.9e+28)) tmp = Float64(x_m * Float64(Float64(t + y) / z)); else tmp = Float64(Float64(y - Float64(z * t)) * Float64(x_m / z)); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) tmp = 0.0; if ((z <= -0.135) || ~((z <= 5.9e+28))) tmp = x_m * ((t + y) / z); else tmp = (y - (z * t)) * (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_, t_] := N[(x$95$s * If[Or[LessEqual[z, -0.135], N[Not[LessEqual[z, 5.9e+28]], $MachinePrecision]], N[(x$95$m * N[(N[(t + y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(y - N[(z * t), $MachinePrecision]), $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 -0.135 \lor \neg \left(z \leq 5.9 \cdot 10^{+28}\right):\\
\;\;\;\;x\_m \cdot \frac{t + y}{z}\\
\mathbf{else}:\\
\;\;\;\;\left(y - z \cdot t\right) \cdot \frac{x\_m}{z}\\
\end{array}
\end{array}
if z < -0.13500000000000001 or 5.9000000000000002e28 < z Initial program 95.1%
Taylor expanded in z around inf
lower-/.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
lower-+.f6495.1
Applied rewrites95.1%
if -0.13500000000000001 < z < 5.9000000000000002e28Initial program 93.0%
Taylor expanded in z around 0
lower-/.f64N/A
+-commutativeN/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
associate-*r*N/A
mul-1-negN/A
fp-cancel-sub-signN/A
lower--.f64N/A
lower-*.f6491.9
Applied rewrites91.9%
Applied rewrites93.6%
Final simplification94.4%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (or (<= z -1150000000000.0) (not (<= z 1.0)))
(* x_m (/ (+ t y) z))
(* x_m (- (/ y z) t)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if ((z <= -1150000000000.0) || !(z <= 1.0)) {
tmp = x_m * ((t + y) / z);
} else {
tmp = x_m * ((y / z) - t);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
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 <= (-1150000000000.0d0)) .or. (.not. (z <= 1.0d0))) then
tmp = x_m * ((t + y) / 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);
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if ((z <= -1150000000000.0) || !(z <= 1.0)) {
tmp = x_m * ((t + y) / z);
} else {
tmp = x_m * ((y / z) - t);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if (z <= -1150000000000.0) or not (z <= 1.0): tmp = x_m * ((t + y) / z) else: tmp = x_m * ((y / z) - t) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if ((z <= -1150000000000.0) || !(z <= 1.0)) tmp = Float64(x_m * Float64(Float64(t + y) / 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); function tmp_2 = code(x_s, x_m, y, z, t) tmp = 0.0; if ((z <= -1150000000000.0) || ~((z <= 1.0))) tmp = x_m * ((t + y) / 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]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[Or[LessEqual[z, -1150000000000.0], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(x$95$m * N[(N[(t + y), $MachinePrecision] / z), $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\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -1150000000000 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;x\_m \cdot \frac{t + y}{z}\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot \left(\frac{y}{z} - t\right)\\
\end{array}
\end{array}
if z < -1.15e12 or 1 < z Initial program 95.2%
Taylor expanded in z around inf
lower-/.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
lower-+.f6495.2
Applied rewrites95.2%
if -1.15e12 < z < 1Initial program 92.8%
Taylor expanded in z around 0
associate-*r*N/A
mul-1-negN/A
fp-cancel-sub-signN/A
div-subN/A
associate-/l*N/A
*-inversesN/A
*-rgt-identityN/A
lower--.f64N/A
lower-/.f6491.1
Applied rewrites91.1%
Final simplification93.3%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (or (<= y -2.2e-22) (not (<= y 2.4e-6)))
(* y (/ x_m z))
(* (/ x_m (- z 1.0)) t))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if ((y <= -2.2e-22) || !(y <= 2.4e-6)) {
tmp = y * (x_m / z);
} else {
tmp = (x_m / (z - 1.0)) * t;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
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 <= (-2.2d-22)) .or. (.not. (y <= 2.4d-6))) then
tmp = y * (x_m / z)
else
tmp = (x_m / (z - 1.0d0)) * t
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if ((y <= -2.2e-22) || !(y <= 2.4e-6)) {
tmp = y * (x_m / z);
} else {
tmp = (x_m / (z - 1.0)) * t;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if (y <= -2.2e-22) or not (y <= 2.4e-6): tmp = y * (x_m / z) else: tmp = (x_m / (z - 1.0)) * t return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if ((y <= -2.2e-22) || !(y <= 2.4e-6)) tmp = Float64(y * Float64(x_m / z)); else tmp = Float64(Float64(x_m / Float64(z - 1.0)) * t); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) tmp = 0.0; if ((y <= -2.2e-22) || ~((y <= 2.4e-6))) tmp = y * (x_m / z); else tmp = (x_m / (z - 1.0)) * 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]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[Or[LessEqual[y, -2.2e-22], N[Not[LessEqual[y, 2.4e-6]], $MachinePrecision]], N[(y * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / N[(z - 1.0), $MachinePrecision]), $MachinePrecision] * t), $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.2 \cdot 10^{-22} \lor \neg \left(y \leq 2.4 \cdot 10^{-6}\right):\\
\;\;\;\;y \cdot \frac{x\_m}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{z - 1} \cdot t\\
\end{array}
\end{array}
if y < -2.2000000000000001e-22 or 2.3999999999999999e-6 < y Initial program 93.0%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6479.0
Applied rewrites79.0%
Applied rewrites82.8%
if -2.2000000000000001e-22 < y < 2.3999999999999999e-6Initial program 95.1%
Taylor expanded in t around inf
distribute-rgt-inN/A
fp-cancel-sign-sub-invN/A
mul-1-negN/A
distribute-rgt-out--N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
mul-1-negN/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites78.3%
Taylor expanded in y around 0
Applied rewrites75.1%
Final simplification78.9%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (or (<= y -6.8e-26) (not (<= y 3.8e-145)))
(* y (/ x_m z))
(* x_m (/ t z)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if ((y <= -6.8e-26) || !(y <= 3.8e-145)) {
tmp = y * (x_m / z);
} else {
tmp = x_m * (t / 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, 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 <= (-6.8d-26)) .or. (.not. (y <= 3.8d-145))) then
tmp = y * (x_m / z)
else
tmp = x_m * (t / z)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if ((y <= -6.8e-26) || !(y <= 3.8e-145)) {
tmp = y * (x_m / z);
} else {
tmp = x_m * (t / z);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if (y <= -6.8e-26) or not (y <= 3.8e-145): tmp = y * (x_m / z) else: tmp = x_m * (t / z) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if ((y <= -6.8e-26) || !(y <= 3.8e-145)) tmp = Float64(y * Float64(x_m / z)); else tmp = Float64(x_m * Float64(t / z)); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) tmp = 0.0; if ((y <= -6.8e-26) || ~((y <= 3.8e-145))) tmp = y * (x_m / z); else tmp = x_m * (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]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[Or[LessEqual[y, -6.8e-26], N[Not[LessEqual[y, 3.8e-145]], $MachinePrecision]], N[(y * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision], N[(x$95$m * N[(t / 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}\;y \leq -6.8 \cdot 10^{-26} \lor \neg \left(y \leq 3.8 \cdot 10^{-145}\right):\\
\;\;\;\;y \cdot \frac{x\_m}{z}\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot \frac{t}{z}\\
\end{array}
\end{array}
if y < -6.80000000000000026e-26 or 3.8000000000000002e-145 < y Initial program 93.7%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6471.7
Applied rewrites71.7%
Applied rewrites74.1%
if -6.80000000000000026e-26 < y < 3.8000000000000002e-145Initial program 94.6%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
mul-1-negN/A
distribute-neg-inN/A
metadata-evalN/A
remove-double-negN/A
lower-+.f6479.1
Applied rewrites79.1%
Taylor expanded in z around inf
Applied rewrites54.3%
Final simplification66.5%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (or (<= y -6.8e-26) (not (<= y 3.8e-145)))
(* y (/ x_m z))
(* (/ x_m z) t))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if ((y <= -6.8e-26) || !(y <= 3.8e-145)) {
tmp = y * (x_m / z);
} else {
tmp = (x_m / z) * t;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
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 <= (-6.8d-26)) .or. (.not. (y <= 3.8d-145))) then
tmp = y * (x_m / z)
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);
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if ((y <= -6.8e-26) || !(y <= 3.8e-145)) {
tmp = y * (x_m / z);
} else {
tmp = (x_m / z) * t;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if (y <= -6.8e-26) or not (y <= 3.8e-145): tmp = y * (x_m / z) else: tmp = (x_m / z) * t return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if ((y <= -6.8e-26) || !(y <= 3.8e-145)) tmp = Float64(y * Float64(x_m / z)); else tmp = Float64(Float64(x_m / z) * t); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) tmp = 0.0; if ((y <= -6.8e-26) || ~((y <= 3.8e-145))) tmp = y * (x_m / z); 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]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[Or[LessEqual[y, -6.8e-26], N[Not[LessEqual[y, 3.8e-145]], $MachinePrecision]], N[(y * N[(x$95$m / z), $MachinePrecision]), $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\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -6.8 \cdot 10^{-26} \lor \neg \left(y \leq 3.8 \cdot 10^{-145}\right):\\
\;\;\;\;y \cdot \frac{x\_m}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{z} \cdot t\\
\end{array}
\end{array}
if y < -6.80000000000000026e-26 or 3.8000000000000002e-145 < y Initial program 93.7%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6471.7
Applied rewrites71.7%
Applied rewrites74.1%
if -6.80000000000000026e-26 < y < 3.8000000000000002e-145Initial program 94.6%
Taylor expanded in t around inf
distribute-rgt-inN/A
fp-cancel-sign-sub-invN/A
mul-1-negN/A
distribute-rgt-out--N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
mul-1-negN/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites78.1%
Taylor expanded in z around inf
Applied rewrites51.4%
Taylor expanded in y around 0
Applied rewrites54.2%
Final simplification66.5%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y z t) :precision binary64 (* x_s (if (<= t 5e+93) (* y (/ x_m z)) (* x_m (- t)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (t <= 5e+93) {
tmp = y * (x_m / z);
} else {
tmp = x_m * -t;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
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 <= 5d+93) then
tmp = y * (x_m / z)
else
tmp = x_m * -t
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (t <= 5e+93) {
tmp = y * (x_m / z);
} else {
tmp = x_m * -t;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if t <= 5e+93: tmp = y * (x_m / z) else: tmp = x_m * -t return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (t <= 5e+93) tmp = Float64(y * Float64(x_m / z)); else tmp = Float64(x_m * Float64(-t)); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) tmp = 0.0; if (t <= 5e+93) tmp = y * (x_m / z); else tmp = x_m * -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]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[t, 5e+93], N[(y * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision], N[(x$95$m * (-t)), $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}\;t \leq 5 \cdot 10^{+93}:\\
\;\;\;\;y \cdot \frac{x\_m}{z}\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot \left(-t\right)\\
\end{array}
\end{array}
if t < 5.0000000000000001e93Initial program 92.9%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6464.4
Applied rewrites64.4%
Applied rewrites67.0%
if 5.0000000000000001e93 < t Initial program 99.9%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
mul-1-negN/A
distribute-neg-inN/A
metadata-evalN/A
remove-double-negN/A
lower-+.f6482.4
Applied rewrites82.4%
Taylor expanded in z around 0
Applied rewrites46.3%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y z t) :precision binary64 (* x_s (* x_m (- t))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
return x_s * (x_m * -t);
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
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 * -t)
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
return x_s * (x_m * -t);
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): return x_s * (x_m * -t)
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) return Float64(x_s * Float64(x_m * Float64(-t))) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp = code(x_s, x_m, y, z, t) tmp = x_s * (x_m * -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]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * N[(x$95$m * (-t)), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \left(x\_m \cdot \left(-t\right)\right)
\end{array}
Initial program 94.1%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
mul-1-negN/A
distribute-neg-inN/A
metadata-evalN/A
remove-double-negN/A
lower-+.f6448.6
Applied rewrites48.6%
Taylor expanded in z around 0
Applied rewrites25.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z))))))
(t_2 (* x (- (/ y z) (/ t (- 1.0 z))))))
(if (< t_2 -7.623226303312042e-196)
t_1
(if (< t_2 1.4133944927702302e-211)
(+ (/ (* y x) z) (- (/ (* t x) (- 1.0 z))))
t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z))));
double t_2 = x * ((y / z) - (t / (1.0 - z)));
double tmp;
if (t_2 < -7.623226303312042e-196) {
tmp = t_1;
} else if (t_2 < 1.4133944927702302e-211) {
tmp = ((y * x) / z) + -((t * x) / (1.0 - z));
} else {
tmp = 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) :: t_2
real(8) :: tmp
t_1 = x * ((y / z) - (t * (1.0d0 / (1.0d0 - z))))
t_2 = x * ((y / z) - (t / (1.0d0 - z)))
if (t_2 < (-7.623226303312042d-196)) then
tmp = t_1
else if (t_2 < 1.4133944927702302d-211) then
tmp = ((y * x) / z) + -((t * x) / (1.0d0 - z))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z))));
double t_2 = x * ((y / z) - (t / (1.0 - z)));
double tmp;
if (t_2 < -7.623226303312042e-196) {
tmp = t_1;
} else if (t_2 < 1.4133944927702302e-211) {
tmp = ((y * x) / z) + -((t * x) / (1.0 - z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z)))) t_2 = x * ((y / z) - (t / (1.0 - z))) tmp = 0 if t_2 < -7.623226303312042e-196: tmp = t_1 elif t_2 < 1.4133944927702302e-211: tmp = ((y * x) / z) + -((t * x) / (1.0 - z)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(Float64(y / z) - Float64(t * Float64(1.0 / Float64(1.0 - z))))) t_2 = Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))) tmp = 0.0 if (t_2 < -7.623226303312042e-196) tmp = t_1; elseif (t_2 < 1.4133944927702302e-211) tmp = Float64(Float64(Float64(y * x) / z) + Float64(-Float64(Float64(t * x) / Float64(1.0 - z)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z)))); t_2 = x * ((y / z) - (t / (1.0 - z))); tmp = 0.0; if (t_2 < -7.623226303312042e-196) tmp = t_1; elseif (t_2 < 1.4133944927702302e-211) tmp = ((y * x) / z) + -((t * x) / (1.0 - z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(y / z), $MachinePrecision] - N[(t * N[(1.0 / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$2, -7.623226303312042e-196], t$95$1, If[Less[t$95$2, 1.4133944927702302e-211], N[(N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision] + (-N[(N[(t * x), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(\frac{y}{z} - t \cdot \frac{1}{1 - z}\right)\\
t_2 := x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\
\mathbf{if}\;t\_2 < -7.623226303312042 \cdot 10^{-196}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 < 1.4133944927702302 \cdot 10^{-211}:\\
\;\;\;\;\frac{y \cdot x}{z} + \left(-\frac{t \cdot x}{1 - z}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024337
(FPCore (x y z t)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, C"
:precision binary64
:alt
(! :herbie-platform default (if (< (* x (- (/ y z) (/ t (- 1 z)))) -3811613151656021/5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (* x (- (/ y z) (* t (/ 1 (- 1 z))))) (if (< (* x (- (/ y z) (/ t (- 1 z)))) 7066972463851151/50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (/ (* y x) z) (- (/ (* t x) (- 1 z)))) (* x (- (/ y z) (* t (/ 1 (- 1 z))))))))
(* x (- (/ y z) (/ t (- 1.0 z)))))