
(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
(*
x_s
(if (<= x_m 5e-121)
(fma (* x_m t) (/ 1.0 (+ z -1.0)) (/ (* x_m y) z))
(* x_m (+ (/ y z) (/ 1.0 (/ (+ 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 (x_m <= 5e-121) {
tmp = fma((x_m * t), (1.0 / (z + -1.0)), ((x_m * y) / z));
} else {
tmp = x_m * ((y / z) + (1.0 / ((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 (x_m <= 5e-121) tmp = fma(Float64(x_m * t), Float64(1.0 / Float64(z + -1.0)), Float64(Float64(x_m * y) / z)); else tmp = Float64(x_m * Float64(Float64(y / z) + Float64(1.0 / Float64(Float64(z + -1.0) / t)))); 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_] := N[(x$95$s * If[LessEqual[x$95$m, 5e-121], N[(N[(x$95$m * t), $MachinePrecision] * N[(1.0 / N[(z + -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x$95$m * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(x$95$m * N[(N[(y / z), $MachinePrecision] + N[(1.0 / N[(N[(z + -1.0), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $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}\;x\_m \leq 5 \cdot 10^{-121}:\\
\;\;\;\;\mathsf{fma}\left(x\_m \cdot t, \frac{1}{z + -1}, \frac{x\_m \cdot y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot \left(\frac{y}{z} + \frac{1}{\frac{z + -1}{t}}\right)\\
\end{array}
\end{array}
if x < 4.99999999999999989e-121Initial program 91.8%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6491.8
Applied rewrites91.8%
lift-*.f64N/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
lift-/.f64N/A
lift-/.f64N/A
clear-numN/A
distribute-frac-negN/A
lift--.f64N/A
sub-negN/A
metadata-evalN/A
distribute-neg-inN/A
lift-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
frac-2negN/A
div-invN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
Applied rewrites93.5%
if 4.99999999999999989e-121 < x Initial program 97.7%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6497.7
Applied rewrites97.7%
Final simplification95.0%
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 (+ z -1.0))))) (* x_s (if (<= t_1 (- INFINITY)) (/ (* x_m y) 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 / (z + -1.0));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (x_m * y) / 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 / (z + -1.0));
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = (x_m * y) / 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 / (z + -1.0)) tmp = 0 if t_1 <= -math.inf: tmp = (x_m * y) / 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(z + -1.0))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(x_m * y) / 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 / (z + -1.0)); tmp = 0.0; if (t_1 <= -Inf) tmp = (x_m * y) / 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[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t$95$1, (-Infinity)], N[(N[(x$95$m * y), $MachinePrecision] / z), $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}{z + -1}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\frac{x\_m \cdot y}{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 56.8%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f6499.9
Applied rewrites99.9%
if -inf.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) Initial program 96.2%
Final simplification96.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 (<= x_m 5e-121)
(fma (* x_m t) (/ 1.0 (+ z -1.0)) (/ (* x_m y) z))
(* x_m (+ (/ y z) (/ t (+ z -1.0)))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (x_m <= 5e-121) {
tmp = fma((x_m * t), (1.0 / (z + -1.0)), ((x_m * y) / z));
} else {
tmp = x_m * ((y / z) + (t / (z + -1.0)));
}
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 (x_m <= 5e-121) tmp = fma(Float64(x_m * t), Float64(1.0 / Float64(z + -1.0)), Float64(Float64(x_m * y) / z)); else tmp = Float64(x_m * Float64(Float64(y / z) + Float64(t / Float64(z + -1.0)))); 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_] := N[(x$95$s * If[LessEqual[x$95$m, 5e-121], N[(N[(x$95$m * t), $MachinePrecision] * N[(1.0 / N[(z + -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x$95$m * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(x$95$m * N[(N[(y / z), $MachinePrecision] + N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $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}\;x\_m \leq 5 \cdot 10^{-121}:\\
\;\;\;\;\mathsf{fma}\left(x\_m \cdot t, \frac{1}{z + -1}, \frac{x\_m \cdot y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot \left(\frac{y}{z} + \frac{t}{z + -1}\right)\\
\end{array}
\end{array}
if x < 4.99999999999999989e-121Initial program 91.8%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6491.8
Applied rewrites91.8%
lift-*.f64N/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
lift-/.f64N/A
lift-/.f64N/A
clear-numN/A
distribute-frac-negN/A
lift--.f64N/A
sub-negN/A
metadata-evalN/A
distribute-neg-inN/A
lift-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
frac-2negN/A
div-invN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
Applied rewrites93.5%
if 4.99999999999999989e-121 < x Initial program 97.7%
Final simplification95.0%
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 -0.75)
(* (/ x_m z) (+ t y))
(if (<= z 1.0) (* x_m (- (/ y z) (fma z t t))) (/ (* x_m (+ t y)) z)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (z <= -0.75) {
tmp = (x_m / z) * (t + y);
} else if (z <= 1.0) {
tmp = x_m * ((y / z) - fma(z, t, t));
} else {
tmp = (x_m * (t + y)) / 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.75) tmp = Float64(Float64(x_m / z) * Float64(t + y)); elseif (z <= 1.0) tmp = Float64(x_m * Float64(Float64(y / z) - fma(z, t, t))); else tmp = Float64(Float64(x_m * Float64(t + y)) / z); 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_] := N[(x$95$s * If[LessEqual[z, -0.75], N[(N[(x$95$m / z), $MachinePrecision] * N[(t + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], N[(x$95$m * N[(N[(y / z), $MachinePrecision] - N[(z * t + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m * N[(t + y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -0.75:\\
\;\;\;\;\frac{x\_m}{z} \cdot \left(t + y\right)\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;x\_m \cdot \left(\frac{y}{z} - \mathsf{fma}\left(z, t, t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m \cdot \left(t + y\right)}{z}\\
\end{array}
\end{array}
if z < -0.75Initial program 96.3%
Taylor expanded in z around inf
*-commutativeN/A
remove-double-negN/A
neg-mul-1N/A
distribute-lft-out--N/A
neg-mul-1N/A
mul-1-negN/A
remove-double-negN/A
distribute-lft-neg-inN/A
*-commutativeN/A
mul-1-negN/A
lower-/.f64N/A
Applied rewrites85.2%
Applied rewrites87.9%
if -0.75 < z < 1Initial program 92.4%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6492.3
Applied rewrites92.3%
if 1 < z Initial program 94.9%
Taylor expanded in z around inf
*-commutativeN/A
remove-double-negN/A
neg-mul-1N/A
distribute-lft-out--N/A
neg-mul-1N/A
mul-1-negN/A
remove-double-negN/A
distribute-lft-neg-inN/A
*-commutativeN/A
mul-1-negN/A
lower-/.f64N/A
Applied rewrites89.3%
Final simplification90.6%
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 -0.85)
(* (/ x_m z) (+ t y))
(if (<= z 1.0) (* x_m (+ (/ y z) (- t))) (/ (* x_m (+ t y)) z)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (z <= -0.85) {
tmp = (x_m / z) * (t + y);
} else if (z <= 1.0) {
tmp = x_m * ((y / z) + -t);
} else {
tmp = (x_m * (t + y)) / z;
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, 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.85d0)) then
tmp = (x_m / z) * (t + y)
else if (z <= 1.0d0) then
tmp = x_m * ((y / 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);
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (z <= -0.85) {
tmp = (x_m / z) * (t + y);
} else if (z <= 1.0) {
tmp = x_m * ((y / 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) def code(x_s, x_m, y, z, t): tmp = 0 if z <= -0.85: tmp = (x_m / z) * (t + y) elif z <= 1.0: tmp = x_m * ((y / z) + -t) else: tmp = (x_m * (t + y)) / 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.85) tmp = Float64(Float64(x_m / z) * Float64(t + y)); elseif (z <= 1.0) tmp = Float64(x_m * Float64(Float64(y / z) + Float64(-t))); else tmp = Float64(Float64(x_m * Float64(t + y)) / z); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) tmp = 0.0; if (z <= -0.85) tmp = (x_m / z) * (t + y); elseif (z <= 1.0) tmp = x_m * ((y / 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]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[z, -0.85], N[(N[(x$95$m / z), $MachinePrecision] * N[(t + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], N[(x$95$m * N[(N[(y / z), $MachinePrecision] + (-t)), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m * N[(t + y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -0.85:\\
\;\;\;\;\frac{x\_m}{z} \cdot \left(t + y\right)\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;x\_m \cdot \left(\frac{y}{z} + \left(-t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m \cdot \left(t + y\right)}{z}\\
\end{array}
\end{array}
if z < -0.849999999999999978Initial program 96.3%
Taylor expanded in z around inf
*-commutativeN/A
remove-double-negN/A
neg-mul-1N/A
distribute-lft-out--N/A
neg-mul-1N/A
mul-1-negN/A
remove-double-negN/A
distribute-lft-neg-inN/A
*-commutativeN/A
mul-1-negN/A
lower-/.f64N/A
Applied rewrites85.2%
Applied rewrites87.9%
if -0.849999999999999978 < z < 1Initial program 92.4%
lift--.f64N/A
sub-negN/A
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-/.f64N/A
distribute-neg-frac2N/A
lower-/.f64N/A
lift--.f64N/A
sub-negN/A
distribute-neg-inN/A
metadata-evalN/A
remove-double-negN/A
lower-+.f6492.3
Applied rewrites92.3%
Taylor expanded in z around 0
mul-1-negN/A
lower-neg.f6491.8
Applied rewrites91.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6491.8
lift-fma.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-invN/A
lower-/.f64N/A
Applied rewrites91.8%
if 1 < z Initial program 94.9%
Taylor expanded in z around inf
*-commutativeN/A
remove-double-negN/A
neg-mul-1N/A
distribute-lft-out--N/A
neg-mul-1N/A
mul-1-negN/A
remove-double-negN/A
distribute-lft-neg-inN/A
*-commutativeN/A
mul-1-negN/A
lower-/.f64N/A
Applied rewrites89.3%
Final simplification90.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
(let* ((t_1 (* x_m (/ t (+ z -1.0)))))
(*
x_s
(if (<= t -1.35e+66) t_1 (if (<= t 330000000000.0) (/ (* x_m y) 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 * (t / (z + -1.0));
double tmp;
if (t <= -1.35e+66) {
tmp = t_1;
} else if (t <= 330000000000.0) {
tmp = (x_m * y) / 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 = x_m * (t / (z + (-1.0d0)))
if (t <= (-1.35d+66)) then
tmp = t_1
else if (t <= 330000000000.0d0) then
tmp = (x_m * y) / 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 = x_m * (t / (z + -1.0));
double tmp;
if (t <= -1.35e+66) {
tmp = t_1;
} else if (t <= 330000000000.0) {
tmp = (x_m * y) / 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 = x_m * (t / (z + -1.0)) tmp = 0 if t <= -1.35e+66: tmp = t_1 elif t <= 330000000000.0: tmp = (x_m * y) / 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(t / Float64(z + -1.0))) tmp = 0.0 if (t <= -1.35e+66) tmp = t_1; elseif (t <= 330000000000.0) tmp = Float64(Float64(x_m * y) / 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 = x_m * (t / (z + -1.0)); tmp = 0.0; if (t <= -1.35e+66) tmp = t_1; elseif (t <= 330000000000.0) tmp = (x_m * y) / 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[(x$95$m * N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t, -1.35e+66], t$95$1, If[LessEqual[t, 330000000000.0], N[(N[(x$95$m * y), $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 := x\_m \cdot \frac{t}{z + -1}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq -1.35 \cdot 10^{+66}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 330000000000:\\
\;\;\;\;\frac{x\_m \cdot y}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if t < -1.35e66 or 3.3e11 < t Initial program 95.4%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
sub-negN/A
mul-1-negN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
metadata-evalN/A
lower-+.f6476.0
Applied rewrites76.0%
if -1.35e66 < t < 3.3e11Initial program 92.8%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f6487.9
Applied rewrites87.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 (* (/ x_m z) (+ t y))))
(*
x_s
(if (<= y -8.8e-162)
t_1
(if (<= y 4.7e-246) (/ (* x_m t) (+ z -1.0)) 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 / z) * (t + y);
double tmp;
if (y <= -8.8e-162) {
tmp = t_1;
} else if (y <= 4.7e-246) {
tmp = (x_m * t) / (z + -1.0);
} 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 = (x_m / z) * (t + y)
if (y <= (-8.8d-162)) then
tmp = t_1
else if (y <= 4.7d-246) then
tmp = (x_m * t) / (z + (-1.0d0))
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 = (x_m / z) * (t + y);
double tmp;
if (y <= -8.8e-162) {
tmp = t_1;
} else if (y <= 4.7e-246) {
tmp = (x_m * t) / (z + -1.0);
} 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 = (x_m / z) * (t + y) tmp = 0 if y <= -8.8e-162: tmp = t_1 elif y <= 4.7e-246: tmp = (x_m * t) / (z + -1.0) 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(Float64(x_m / z) * Float64(t + y)) tmp = 0.0 if (y <= -8.8e-162) tmp = t_1; elseif (y <= 4.7e-246) tmp = Float64(Float64(x_m * t) / Float64(z + -1.0)); 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 = (x_m / z) * (t + y); tmp = 0.0; if (y <= -8.8e-162) tmp = t_1; elseif (y <= 4.7e-246) tmp = (x_m * t) / (z + -1.0); 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[(N[(x$95$m / z), $MachinePrecision] * N[(t + y), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[y, -8.8e-162], t$95$1, If[LessEqual[y, 4.7e-246], N[(N[(x$95$m * t), $MachinePrecision] / N[(z + -1.0), $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 := \frac{x\_m}{z} \cdot \left(t + y\right)\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -8.8 \cdot 10^{-162}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 4.7 \cdot 10^{-246}:\\
\;\;\;\;\frac{x\_m \cdot t}{z + -1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if y < -8.7999999999999997e-162 or 4.69999999999999955e-246 < y Initial program 93.4%
Taylor expanded in z around inf
*-commutativeN/A
remove-double-negN/A
neg-mul-1N/A
distribute-lft-out--N/A
neg-mul-1N/A
mul-1-negN/A
remove-double-negN/A
distribute-lft-neg-inN/A
*-commutativeN/A
mul-1-negN/A
lower-/.f64N/A
Applied rewrites79.2%
Applied rewrites80.8%
if -8.7999999999999997e-162 < y < 4.69999999999999955e-246Initial program 95.9%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6495.9
Applied rewrites95.9%
lift-*.f64N/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
lift-/.f64N/A
lift-/.f64N/A
clear-numN/A
distribute-frac-negN/A
lift--.f64N/A
sub-negN/A
metadata-evalN/A
distribute-neg-inN/A
lift-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
frac-2negN/A
div-invN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
Applied rewrites95.9%
Taylor expanded in t around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-+.f6483.9
Applied rewrites83.9%
Final simplification81.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
(let* ((t_1 (* t (/ x_m (+ z -1.0)))))
(*
x_s
(if (<= t -2.5e+85) t_1 (if (<= t 350000000000.0) (/ (* x_m y) 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 = t * (x_m / (z + -1.0));
double tmp;
if (t <= -2.5e+85) {
tmp = t_1;
} else if (t <= 350000000000.0) {
tmp = (x_m * y) / 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 = t * (x_m / (z + (-1.0d0)))
if (t <= (-2.5d+85)) then
tmp = t_1
else if (t <= 350000000000.0d0) then
tmp = (x_m * y) / 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 = t * (x_m / (z + -1.0));
double tmp;
if (t <= -2.5e+85) {
tmp = t_1;
} else if (t <= 350000000000.0) {
tmp = (x_m * y) / 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 = t * (x_m / (z + -1.0)) tmp = 0 if t <= -2.5e+85: tmp = t_1 elif t <= 350000000000.0: tmp = (x_m * y) / 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(t * Float64(x_m / Float64(z + -1.0))) tmp = 0.0 if (t <= -2.5e+85) tmp = t_1; elseif (t <= 350000000000.0) tmp = Float64(Float64(x_m * y) / 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 = t * (x_m / (z + -1.0)); tmp = 0.0; if (t <= -2.5e+85) tmp = t_1; elseif (t <= 350000000000.0) tmp = (x_m * y) / 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[(t * N[(x$95$m / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t, -2.5e+85], t$95$1, If[LessEqual[t, 350000000000.0], N[(N[(x$95$m * y), $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 := t \cdot \frac{x\_m}{z + -1}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq -2.5 \cdot 10^{+85}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 350000000000:\\
\;\;\;\;\frac{x\_m \cdot y}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if t < -2.5e85 or 3.5e11 < t Initial program 95.2%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f6431.2
Applied rewrites31.2%
Taylor expanded in y around 0
mul-1-negN/A
sub-negN/A
metadata-evalN/A
distribute-neg-inN/A
+-commutativeN/A
metadata-evalN/A
sub-negN/A
distribute-neg-frac2N/A
remove-double-negN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
sub-negN/A
metadata-evalN/A
lower-+.f6471.6
Applied rewrites71.6%
if -2.5e85 < t < 3.5e11Initial program 92.9%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f6487.1
Applied rewrites87.1%
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 (/ t z)))) (* x_s (if (<= t -1.45e+67) t_1 (if (<= t 6.5e+109) (/ (* x_m y) 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 * (t / z);
double tmp;
if (t <= -1.45e+67) {
tmp = t_1;
} else if (t <= 6.5e+109) {
tmp = (x_m * y) / 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 = x_m * (t / z)
if (t <= (-1.45d+67)) then
tmp = t_1
else if (t <= 6.5d+109) then
tmp = (x_m * y) / 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 = x_m * (t / z);
double tmp;
if (t <= -1.45e+67) {
tmp = t_1;
} else if (t <= 6.5e+109) {
tmp = (x_m * y) / 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 = x_m * (t / z) tmp = 0 if t <= -1.45e+67: tmp = t_1 elif t <= 6.5e+109: tmp = (x_m * y) / 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(t / z)) tmp = 0.0 if (t <= -1.45e+67) tmp = t_1; elseif (t <= 6.5e+109) tmp = Float64(Float64(x_m * y) / 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 = x_m * (t / z); tmp = 0.0; if (t <= -1.45e+67) tmp = t_1; elseif (t <= 6.5e+109) tmp = (x_m * y) / 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[(x$95$m * N[(t / z), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[t, -1.45e+67], t$95$1, If[LessEqual[t, 6.5e+109], N[(N[(x$95$m * y), $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 := x\_m \cdot \frac{t}{z}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq -1.45 \cdot 10^{+67}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 6.5 \cdot 10^{+109}:\\
\;\;\;\;\frac{x\_m \cdot y}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if t < -1.45000000000000012e67 or 6.5e109 < t Initial program 95.4%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
sub-negN/A
mul-1-negN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
metadata-evalN/A
lower-+.f6476.9
Applied rewrites76.9%
Taylor expanded in z around inf
Applied rewrites50.4%
if -1.45000000000000012e67 < t < 6.5e109Initial program 93.1%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f6482.2
Applied rewrites82.2%
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 (<= y -8.5e-178)
(/ (* x_m y) z)
(if (<= y 4.7e-246) (* x_m (- t)) (* y (/ x_m z))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (y <= -8.5e-178) {
tmp = (x_m * y) / z;
} else if (y <= 4.7e-246) {
tmp = x_m * -t;
} else {
tmp = y * (x_m / z);
}
return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z, 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 <= (-8.5d-178)) then
tmp = (x_m * y) / z
else if (y <= 4.7d-246) then
tmp = x_m * -t
else
tmp = y * (x_m / z)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (y <= -8.5e-178) {
tmp = (x_m * y) / z;
} else if (y <= 4.7e-246) {
tmp = x_m * -t;
} else {
tmp = y * (x_m / z);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if y <= -8.5e-178: tmp = (x_m * y) / z elif y <= 4.7e-246: tmp = x_m * -t else: tmp = y * (x_m / z) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (y <= -8.5e-178) tmp = Float64(Float64(x_m * y) / z); elseif (y <= 4.7e-246) tmp = Float64(x_m * Float64(-t)); else tmp = Float64(y * Float64(x_m / z)); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) tmp = 0.0; if (y <= -8.5e-178) tmp = (x_m * y) / z; elseif (y <= 4.7e-246) tmp = x_m * -t; else tmp = y * (x_m / z); end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[y, -8.5e-178], N[(N[(x$95$m * y), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[y, 4.7e-246], N[(x$95$m * (-t)), $MachinePrecision], N[(y * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -8.5 \cdot 10^{-178}:\\
\;\;\;\;\frac{x\_m \cdot y}{z}\\
\mathbf{elif}\;y \leq 4.7 \cdot 10^{-246}:\\
\;\;\;\;x\_m \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x\_m}{z}\\
\end{array}
\end{array}
if y < -8.5000000000000001e-178Initial program 94.2%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f6474.4
Applied rewrites74.4%
if -8.5000000000000001e-178 < y < 4.69999999999999955e-246Initial program 95.8%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
sub-negN/A
mul-1-negN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
metadata-evalN/A
lower-+.f6485.0
Applied rewrites85.0%
Taylor expanded in z around 0
Applied rewrites59.5%
if 4.69999999999999955e-246 < y Initial program 92.7%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f6472.8
Applied rewrites72.8%
Applied rewrites73.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 -8.8e-178) t_1 (if (<= y 4.7e-246) (* x_m (- t)) 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 <= -8.8e-178) {
tmp = t_1;
} else if (y <= 4.7e-246) {
tmp = x_m * -t;
} 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 <= (-8.8d-178)) then
tmp = t_1
else if (y <= 4.7d-246) then
tmp = x_m * -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);
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 <= -8.8e-178) {
tmp = t_1;
} else if (y <= 4.7e-246) {
tmp = x_m * -t;
} 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 <= -8.8e-178: tmp = t_1 elif y <= 4.7e-246: tmp = x_m * -t 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 <= -8.8e-178) tmp = t_1; elseif (y <= 4.7e-246) tmp = Float64(x_m * Float64(-t)); 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 <= -8.8e-178) tmp = t_1; elseif (y <= 4.7e-246) tmp = x_m * -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]
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, -8.8e-178], t$95$1, If[LessEqual[y, 4.7e-246], N[(x$95$m * (-t)), $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 -8.8 \cdot 10^{-178}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 4.7 \cdot 10^{-246}:\\
\;\;\;\;x\_m \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if y < -8.8000000000000005e-178 or 4.69999999999999955e-246 < y Initial program 93.4%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f6473.5
Applied rewrites73.5%
Applied rewrites73.2%
if -8.8000000000000005e-178 < y < 4.69999999999999955e-246Initial program 95.8%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
sub-negN/A
mul-1-negN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
metadata-evalN/A
lower-+.f6485.0
Applied rewrites85.0%
Taylor expanded in z around 0
Applied rewrites59.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 (* 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 93.9%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
sub-negN/A
mul-1-negN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
metadata-evalN/A
lower-+.f6443.6
Applied rewrites43.6%
Taylor expanded in z around 0
Applied rewrites23.4%
(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 2024221
(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)))))