
(FPCore (F B x) :precision binary64 (+ (- (* x (/ 1.0 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))
double code(double F, double B, double x) {
return -(x * (1.0 / tan(B))) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = -(x * (1.0d0 / tan(b))) + ((f / sin(b)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
end function
public static double code(double F, double B, double x) {
return -(x * (1.0 / Math.tan(B))) + ((F / Math.sin(B)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
def code(F, B, x): return -(x * (1.0 / math.tan(B))) + ((F / math.sin(B)) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)))
function code(F, B, x) return Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))) end
function tmp = code(F, B, x) tmp = -(x * (1.0 / tan(B))) + ((F / sin(B)) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); end
code[F_, B_, x_] := N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], (-N[(1.0 / 2.0), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\end{array}
Herbie found 27 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (F B x) :precision binary64 (+ (- (* x (/ 1.0 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))
double code(double F, double B, double x) {
return -(x * (1.0 / tan(B))) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = -(x * (1.0d0 / tan(b))) + ((f / sin(b)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
end function
public static double code(double F, double B, double x) {
return -(x * (1.0 / Math.tan(B))) + ((F / Math.sin(B)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
def code(F, B, x): return -(x * (1.0 / math.tan(B))) + ((F / math.sin(B)) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)))
function code(F, B, x) return Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))) end
function tmp = code(F, B, x) tmp = -(x * (1.0 / tan(B))) + ((F / sin(B)) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); end
code[F_, B_, x_] := N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], (-N[(1.0 / 2.0), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\end{array}
(FPCore (F B x)
:precision binary64
(if (<= F -1.95e-7)
(+ (- (* x (/ 1.0 (tan B)))) (/ -1.0 (sin B)))
(if (<= F 1.75)
(-
(* (sqrt (/ 1.0 (fma 2.0 x 2.0))) (/ F (sin B)))
(* (cos B) (/ x (sin B))))
(+ (/ (- x) (tan B)) (/ 1.0 (sin B))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.95e-7) {
tmp = -(x * (1.0 / tan(B))) + (-1.0 / sin(B));
} else if (F <= 1.75) {
tmp = (sqrt((1.0 / fma(2.0, x, 2.0))) * (F / sin(B))) - (cos(B) * (x / sin(B)));
} else {
tmp = (-x / tan(B)) + (1.0 / sin(B));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.95e-7) tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(-1.0 / sin(B))); elseif (F <= 1.75) tmp = Float64(Float64(sqrt(Float64(1.0 / fma(2.0, x, 2.0))) * Float64(F / sin(B))) - Float64(cos(B) * Float64(x / sin(B)))); else tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(1.0 / sin(B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.95e-7], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.75], N[(N[(N[Sqrt[N[(1.0 / N[(2.0 * x + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Cos[B], $MachinePrecision] * N[(x / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.95 \cdot 10^{-7}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 1.75:\\
\;\;\;\;\sqrt{\frac{1}{\mathsf{fma}\left(2, x, 2\right)}} \cdot \frac{F}{\sin B} - \cos B \cdot \frac{x}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -1.95000000000000012e-7Initial program 60.4%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6497.9
Applied rewrites97.9%
if -1.95000000000000012e-7 < F < 1.75Initial program 99.5%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-neg.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.5%
Taylor expanded in F around 0
associate-*r/N/A
+-commutativeN/A
associate-*l/N/A
Applied rewrites99.0%
if 1.75 < F Initial program 58.9%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6499.0
Applied rewrites99.0%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
distribute-neg-fracN/A
*-rgt-identityN/A
lower-/.f64N/A
lower-neg.f64N/A
lift-tan.f6499.0
Applied rewrites99.0%
(FPCore (F B x)
:precision binary64
(if (<= F -4.55e-26)
(+ (- (* x (/ 1.0 (tan B)))) (/ -1.0 (sin B)))
(if (<= F 3.9e-7)
(+
(- (/ (* x 1.0) (tan B)))
(* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0)))))
(+ (/ (- x) (tan B)) (/ 1.0 (sin B))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -4.55e-26) {
tmp = -(x * (1.0 / tan(B))) + (-1.0 / sin(B));
} else if (F <= 3.9e-7) {
tmp = -((x * 1.0) / tan(B)) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
} else {
tmp = (-x / tan(B)) + (1.0 / sin(B));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-4.55d-26)) then
tmp = -(x * (1.0d0 / tan(b))) + ((-1.0d0) / sin(b))
else if (f <= 3.9d-7) then
tmp = -((x * 1.0d0) / tan(b)) + ((f / sin(b)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
else
tmp = (-x / tan(b)) + (1.0d0 / sin(b))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -4.55e-26) {
tmp = -(x * (1.0 / Math.tan(B))) + (-1.0 / Math.sin(B));
} else if (F <= 3.9e-7) {
tmp = -((x * 1.0) / Math.tan(B)) + ((F / Math.sin(B)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
} else {
tmp = (-x / Math.tan(B)) + (1.0 / Math.sin(B));
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -4.55e-26: tmp = -(x * (1.0 / math.tan(B))) + (-1.0 / math.sin(B)) elif F <= 3.9e-7: tmp = -((x * 1.0) / math.tan(B)) + ((F / math.sin(B)) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0))) else: tmp = (-x / math.tan(B)) + (1.0 / math.sin(B)) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -4.55e-26) tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(-1.0 / sin(B))); elseif (F <= 3.9e-7) tmp = Float64(Float64(-Float64(Float64(x * 1.0) / tan(B))) + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))); else tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(1.0 / sin(B))); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -4.55e-26) tmp = -(x * (1.0 / tan(B))) + (-1.0 / sin(B)); elseif (F <= 3.9e-7) tmp = -((x * 1.0) / tan(B)) + ((F / sin(B)) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); else tmp = (-x / tan(B)) + (1.0 / sin(B)); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -4.55e-26], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 3.9e-7], N[((-N[(N[(x * 1.0), $MachinePrecision] / N[Tan[B], $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], (-N[(1.0 / 2.0), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -4.55 \cdot 10^{-26}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 3.9 \cdot 10^{-7}:\\
\;\;\;\;\left(-\frac{x \cdot 1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -4.5499999999999997e-26Initial program 62.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6495.5
Applied rewrites95.5%
if -4.5499999999999997e-26 < F < 3.90000000000000025e-7Initial program 99.5%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.6
Applied rewrites99.6%
if 3.90000000000000025e-7 < F Initial program 59.5%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6497.9
Applied rewrites97.9%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
distribute-neg-fracN/A
*-rgt-identityN/A
lower-/.f64N/A
lower-neg.f64N/A
lift-tan.f6497.9
Applied rewrites97.9%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= F -4.55e-26)
(+ (- (* x (/ 1.0 (tan B)))) (/ -1.0 (sin B)))
(if (<= F 3.9e-7)
(fma (sqrt (/ 1.0 (fma x 2.0 2.0))) (/ F (sin B)) t_0)
(+ t_0 (/ 1.0 (sin B)))))))
double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (F <= -4.55e-26) {
tmp = -(x * (1.0 / tan(B))) + (-1.0 / sin(B));
} else if (F <= 3.9e-7) {
tmp = fma(sqrt((1.0 / fma(x, 2.0, 2.0))), (F / sin(B)), t_0);
} else {
tmp = t_0 + (1.0 / sin(B));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (F <= -4.55e-26) tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(-1.0 / sin(B))); elseif (F <= 3.9e-7) tmp = fma(sqrt(Float64(1.0 / fma(x, 2.0, 2.0))), Float64(F / sin(B)), t_0); else tmp = Float64(t_0 + Float64(1.0 / sin(B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -4.55e-26], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 3.9e-7], N[(N[Sqrt[N[(1.0 / N[(x * 2.0 + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], N[(t$95$0 + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -4.55 \cdot 10^{-26}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 3.9 \cdot 10^{-7}:\\
\;\;\;\;\mathsf{fma}\left(\sqrt{\frac{1}{\mathsf{fma}\left(x, 2, 2\right)}}, \frac{F}{\sin B}, t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -4.5499999999999997e-26Initial program 62.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6495.5
Applied rewrites95.5%
if -4.5499999999999997e-26 < F < 3.90000000000000025e-7Initial program 99.5%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-neg.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.5%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
lift-sin.f64N/A
associate-*l/N/A
lower-+.f64N/A
+-commutativeN/A
Applied rewrites99.6%
Taylor expanded in F around 0
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6499.6
Applied rewrites99.6%
if 3.90000000000000025e-7 < F Initial program 59.5%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6497.9
Applied rewrites97.9%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
distribute-neg-fracN/A
*-rgt-identityN/A
lower-/.f64N/A
lower-neg.f64N/A
lift-tan.f6497.9
Applied rewrites97.9%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (- (* x (/ 1.0 (tan B))))))
(if (<= F -2200.0)
(+ t_0 (/ -1.0 (sin B)))
(if (<= F 3.9e-7)
(+ t_0 (* (/ F (sin B)) (sqrt 0.5)))
(+ (/ (- x) (tan B)) (/ 1.0 (sin B)))))))
double code(double F, double B, double x) {
double t_0 = -(x * (1.0 / tan(B)));
double tmp;
if (F <= -2200.0) {
tmp = t_0 + (-1.0 / sin(B));
} else if (F <= 3.9e-7) {
tmp = t_0 + ((F / sin(B)) * sqrt(0.5));
} else {
tmp = (-x / tan(B)) + (1.0 / sin(B));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = -(x * (1.0d0 / tan(b)))
if (f <= (-2200.0d0)) then
tmp = t_0 + ((-1.0d0) / sin(b))
else if (f <= 3.9d-7) then
tmp = t_0 + ((f / sin(b)) * sqrt(0.5d0))
else
tmp = (-x / tan(b)) + (1.0d0 / sin(b))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = -(x * (1.0 / Math.tan(B)));
double tmp;
if (F <= -2200.0) {
tmp = t_0 + (-1.0 / Math.sin(B));
} else if (F <= 3.9e-7) {
tmp = t_0 + ((F / Math.sin(B)) * Math.sqrt(0.5));
} else {
tmp = (-x / Math.tan(B)) + (1.0 / Math.sin(B));
}
return tmp;
}
def code(F, B, x): t_0 = -(x * (1.0 / math.tan(B))) tmp = 0 if F <= -2200.0: tmp = t_0 + (-1.0 / math.sin(B)) elif F <= 3.9e-7: tmp = t_0 + ((F / math.sin(B)) * math.sqrt(0.5)) else: tmp = (-x / math.tan(B)) + (1.0 / math.sin(B)) return tmp
function code(F, B, x) t_0 = Float64(-Float64(x * Float64(1.0 / tan(B)))) tmp = 0.0 if (F <= -2200.0) tmp = Float64(t_0 + Float64(-1.0 / sin(B))); elseif (F <= 3.9e-7) tmp = Float64(t_0 + Float64(Float64(F / sin(B)) * sqrt(0.5))); else tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(1.0 / sin(B))); end return tmp end
function tmp_2 = code(F, B, x) t_0 = -(x * (1.0 / tan(B))); tmp = 0.0; if (F <= -2200.0) tmp = t_0 + (-1.0 / sin(B)); elseif (F <= 3.9e-7) tmp = t_0 + ((F / sin(B)) * sqrt(0.5)); else tmp = (-x / tan(B)) + (1.0 / sin(B)); end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = (-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision])}, If[LessEqual[F, -2200.0], N[(t$95$0 + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 3.9e-7], N[(t$95$0 + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -x \cdot \frac{1}{\tan B}\\
\mathbf{if}\;F \leq -2200:\\
\;\;\;\;t\_0 + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 3.9 \cdot 10^{-7}:\\
\;\;\;\;t\_0 + \frac{F}{\sin B} \cdot \sqrt{0.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -2200Initial program 59.3%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.5
Applied rewrites99.5%
if -2200 < F < 3.90000000000000025e-7Initial program 99.5%
Taylor expanded in x around 0
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f6499.4
Applied rewrites99.4%
Taylor expanded in F around 0
Applied rewrites98.6%
if 3.90000000000000025e-7 < F Initial program 59.5%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6497.9
Applied rewrites97.9%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
distribute-neg-fracN/A
*-rgt-identityN/A
lower-/.f64N/A
lower-neg.f64N/A
lift-tan.f6497.9
Applied rewrites97.9%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= F -4.55e-26)
(+ (- (* x (/ 1.0 (tan B)))) (/ -1.0 (sin B)))
(if (<= F 3.9e-7)
(fma (pow (fma 2.0 x (fma F F 2.0)) -0.5) (/ F B) t_0)
(+ t_0 (/ 1.0 (sin B)))))))
double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (F <= -4.55e-26) {
tmp = -(x * (1.0 / tan(B))) + (-1.0 / sin(B));
} else if (F <= 3.9e-7) {
tmp = fma(pow(fma(2.0, x, fma(F, F, 2.0)), -0.5), (F / B), t_0);
} else {
tmp = t_0 + (1.0 / sin(B));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (F <= -4.55e-26) tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(-1.0 / sin(B))); elseif (F <= 3.9e-7) tmp = fma((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5), Float64(F / B), t_0); else tmp = Float64(t_0 + Float64(1.0 / sin(B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -4.55e-26], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 3.9e-7], N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * N[(F / B), $MachinePrecision] + t$95$0), $MachinePrecision], N[(t$95$0 + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -4.55 \cdot 10^{-26}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 3.9 \cdot 10^{-7}:\\
\;\;\;\;\mathsf{fma}\left({\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}, \frac{F}{B}, t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -4.5499999999999997e-26Initial program 62.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6495.5
Applied rewrites95.5%
if -4.5499999999999997e-26 < F < 3.90000000000000025e-7Initial program 99.5%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-neg.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.5%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
lift-sin.f64N/A
associate-*l/N/A
lower-+.f64N/A
+-commutativeN/A
Applied rewrites99.6%
Taylor expanded in B around 0
Applied rewrites83.6%
if 3.90000000000000025e-7 < F Initial program 59.5%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6497.9
Applied rewrites97.9%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
distribute-neg-fracN/A
*-rgt-identityN/A
lower-/.f64N/A
lower-neg.f64N/A
lift-tan.f6497.9
Applied rewrites97.9%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= F -4.55e-26)
(- (/ (+ 1.0 (* (cos B) x)) (sin B)))
(if (<= F 3.9e-7)
(fma (pow (fma 2.0 x (fma F F 2.0)) -0.5) (/ F B) t_0)
(+ t_0 (/ 1.0 (sin B)))))))
double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (F <= -4.55e-26) {
tmp = -((1.0 + (cos(B) * x)) / sin(B));
} else if (F <= 3.9e-7) {
tmp = fma(pow(fma(2.0, x, fma(F, F, 2.0)), -0.5), (F / B), t_0);
} else {
tmp = t_0 + (1.0 / sin(B));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (F <= -4.55e-26) tmp = Float64(-Float64(Float64(1.0 + Float64(cos(B) * x)) / sin(B))); elseif (F <= 3.9e-7) tmp = fma((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5), Float64(F / B), t_0); else tmp = Float64(t_0 + Float64(1.0 / sin(B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -4.55e-26], (-N[(N[(1.0 + N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 3.9e-7], N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * N[(F / B), $MachinePrecision] + t$95$0), $MachinePrecision], N[(t$95$0 + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -4.55 \cdot 10^{-26}:\\
\;\;\;\;-\frac{1 + \cos B \cdot x}{\sin B}\\
\mathbf{elif}\;F \leq 3.9 \cdot 10^{-7}:\\
\;\;\;\;\mathsf{fma}\left({\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}, \frac{F}{B}, t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -4.5499999999999997e-26Initial program 62.2%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6495.5
Applied rewrites95.5%
if -4.5499999999999997e-26 < F < 3.90000000000000025e-7Initial program 99.5%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-neg.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.5%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
lift-sin.f64N/A
associate-*l/N/A
lower-+.f64N/A
+-commutativeN/A
Applied rewrites99.6%
Taylor expanded in B around 0
Applied rewrites83.6%
if 3.90000000000000025e-7 < F Initial program 59.5%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6497.9
Applied rewrites97.9%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
distribute-neg-fracN/A
*-rgt-identityN/A
lower-/.f64N/A
lower-neg.f64N/A
lift-tan.f6497.9
Applied rewrites97.9%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* (cos B) x)))
(if (<= F -4.55e-26)
(- (/ (+ 1.0 t_0) (sin B)))
(if (<= F 3.9e-7)
(fma (pow (fma 2.0 x (fma F F 2.0)) -0.5) (/ F B) (/ (- x) (tan B)))
(/ (- 1.0 t_0) (sin B))))))
double code(double F, double B, double x) {
double t_0 = cos(B) * x;
double tmp;
if (F <= -4.55e-26) {
tmp = -((1.0 + t_0) / sin(B));
} else if (F <= 3.9e-7) {
tmp = fma(pow(fma(2.0, x, fma(F, F, 2.0)), -0.5), (F / B), (-x / tan(B)));
} else {
tmp = (1.0 - t_0) / sin(B);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(cos(B) * x) tmp = 0.0 if (F <= -4.55e-26) tmp = Float64(-Float64(Float64(1.0 + t_0) / sin(B))); elseif (F <= 3.9e-7) tmp = fma((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5), Float64(F / B), Float64(Float64(-x) / tan(B))); else tmp = Float64(Float64(1.0 - t_0) / sin(B)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[F, -4.55e-26], (-N[(N[(1.0 + t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 3.9e-7], N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * N[(F / B), $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos B \cdot x\\
\mathbf{if}\;F \leq -4.55 \cdot 10^{-26}:\\
\;\;\;\;-\frac{1 + t\_0}{\sin B}\\
\mathbf{elif}\;F \leq 3.9 \cdot 10^{-7}:\\
\;\;\;\;\mathsf{fma}\left({\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}, \frac{F}{B}, \frac{-x}{\tan B}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - t\_0}{\sin B}\\
\end{array}
\end{array}
if F < -4.5499999999999997e-26Initial program 62.2%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6495.5
Applied rewrites95.5%
if -4.5499999999999997e-26 < F < 3.90000000000000025e-7Initial program 99.5%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-neg.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.5%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
lift-sin.f64N/A
associate-*l/N/A
lower-+.f64N/A
+-commutativeN/A
Applied rewrites99.6%
Taylor expanded in B around 0
Applied rewrites83.6%
if 3.90000000000000025e-7 < F Initial program 59.5%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6497.9
Applied rewrites97.9%
(FPCore (F B x)
:precision binary64
(if (<= F -9e+64)
(+ (- (/ x B)) (/ -1.0 (sin B)))
(if (<= F 3.9e-7)
(fma (pow (fma 2.0 x (fma F F 2.0)) -0.5) (/ F B) (/ (- x) (tan B)))
(/ (- 1.0 (* (cos B) x)) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -9e+64) {
tmp = -(x / B) + (-1.0 / sin(B));
} else if (F <= 3.9e-7) {
tmp = fma(pow(fma(2.0, x, fma(F, F, 2.0)), -0.5), (F / B), (-x / tan(B)));
} else {
tmp = (1.0 - (cos(B) * x)) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -9e+64) tmp = Float64(Float64(-Float64(x / B)) + Float64(-1.0 / sin(B))); elseif (F <= 3.9e-7) tmp = fma((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5), Float64(F / B), Float64(Float64(-x) / tan(B))); else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -9e+64], N[((-N[(x / B), $MachinePrecision]) + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 3.9e-7], N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * N[(F / B), $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -9 \cdot 10^{+64}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 3.9 \cdot 10^{-7}:\\
\;\;\;\;\mathsf{fma}\left({\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}, \frac{F}{B}, \frac{-x}{\tan B}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -8.99999999999999946e64Initial program 51.7%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6446.9
Applied rewrites46.9%
Taylor expanded in B around 0
associate-*r/N/A
lower-/.f6424.0
Applied rewrites24.0%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6475.6
Applied rewrites75.6%
if -8.99999999999999946e64 < F < 3.90000000000000025e-7Initial program 99.2%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-neg.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.5%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
lift-sin.f64N/A
associate-*l/N/A
lower-+.f64N/A
+-commutativeN/A
Applied rewrites99.3%
Taylor expanded in B around 0
Applied rewrites81.5%
if 3.90000000000000025e-7 < F Initial program 59.5%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6497.9
Applied rewrites97.9%
(FPCore (F B x)
:precision binary64
(if (<= F -9e+64)
(+ (- (/ x B)) (/ -1.0 (sin B)))
(if (<= F 3.9e-7)
(+
(- (* x (/ 1.0 (tan B))))
(* (/ F B) (sqrt (/ 1.0 (+ (fma F F (+ x x)) 2.0)))))
(/ (- 1.0 (* (cos B) x)) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -9e+64) {
tmp = -(x / B) + (-1.0 / sin(B));
} else if (F <= 3.9e-7) {
tmp = -(x * (1.0 / tan(B))) + ((F / B) * sqrt((1.0 / (fma(F, F, (x + x)) + 2.0))));
} else {
tmp = (1.0 - (cos(B) * x)) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -9e+64) tmp = Float64(Float64(-Float64(x / B)) + Float64(-1.0 / sin(B))); elseif (F <= 3.9e-7) tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / B) * sqrt(Float64(1.0 / Float64(fma(F, F, Float64(x + x)) + 2.0))))); else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -9e+64], N[((-N[(x / B), $MachinePrecision]) + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 3.9e-7], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / B), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(N[(F * F + N[(x + x), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -9 \cdot 10^{+64}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 3.9 \cdot 10^{-7}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{B} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(F, F, x + x\right) + 2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -8.99999999999999946e64Initial program 51.7%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6446.9
Applied rewrites46.9%
Taylor expanded in B around 0
associate-*r/N/A
lower-/.f6424.0
Applied rewrites24.0%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6475.6
Applied rewrites75.6%
if -8.99999999999999946e64 < F < 3.90000000000000025e-7Initial program 99.2%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f64N/A
count-2-revN/A
lower-+.f6481.4
Applied rewrites81.4%
if 3.90000000000000025e-7 < F Initial program 59.5%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6497.9
Applied rewrites97.9%
(FPCore (F B x)
:precision binary64
(if (<= F -9e+64)
(+ (- (/ x B)) (/ -1.0 (sin B)))
(if (<= F 9.5e+135)
(+
(- (* x (/ 1.0 (tan B))))
(* (/ F B) (sqrt (/ 1.0 (+ (fma F F (+ x x)) 2.0)))))
(/ (- 1.0 x) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -9e+64) {
tmp = -(x / B) + (-1.0 / sin(B));
} else if (F <= 9.5e+135) {
tmp = -(x * (1.0 / tan(B))) + ((F / B) * sqrt((1.0 / (fma(F, F, (x + x)) + 2.0))));
} else {
tmp = (1.0 - x) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -9e+64) tmp = Float64(Float64(-Float64(x / B)) + Float64(-1.0 / sin(B))); elseif (F <= 9.5e+135) tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / B) * sqrt(Float64(1.0 / Float64(fma(F, F, Float64(x + x)) + 2.0))))); else tmp = Float64(Float64(1.0 - x) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -9e+64], N[((-N[(x / B), $MachinePrecision]) + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 9.5e+135], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / B), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(N[(F * F + N[(x + x), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -9 \cdot 10^{+64}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 9.5 \cdot 10^{+135}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{B} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(F, F, x + x\right) + 2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{\sin B}\\
\end{array}
\end{array}
if F < -8.99999999999999946e64Initial program 51.7%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6446.9
Applied rewrites46.9%
Taylor expanded in B around 0
associate-*r/N/A
lower-/.f6424.0
Applied rewrites24.0%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6475.6
Applied rewrites75.6%
if -8.99999999999999946e64 < F < 9.50000000000000036e135Initial program 97.3%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f64N/A
count-2-revN/A
lower-+.f6477.5
Applied rewrites77.5%
if 9.50000000000000036e135 < F Initial program 37.8%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-neg.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites57.7%
Taylor expanded in F around inf
associate-*r/N/A
+-commutativeN/A
associate-*l/N/A
Applied rewrites99.7%
Taylor expanded in B around 0
Applied rewrites77.1%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 B))))
(if (<= x -1.2e-79)
t_0
(if (<= x 3.4e-18)
(+
(- (/ x B))
(* (/ F (sin B)) (/ 1.0 (sqrt (fma F F (fma x 2.0 2.0))))))
t_0))))
double code(double F, double B, double x) {
double t_0 = -(x * (1.0 / tan(B))) + (1.0 / B);
double tmp;
if (x <= -1.2e-79) {
tmp = t_0;
} else if (x <= 3.4e-18) {
tmp = -(x / B) + ((F / sin(B)) * (1.0 / sqrt(fma(F, F, fma(x, 2.0, 2.0)))));
} else {
tmp = t_0;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(1.0 / B)) tmp = 0.0 if (x <= -1.2e-79) tmp = t_0; elseif (x <= 3.4e-18) tmp = Float64(Float64(-Float64(x / B)) + Float64(Float64(F / sin(B)) * Float64(1.0 / sqrt(fma(F, F, fma(x, 2.0, 2.0)))))); else tmp = t_0; end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(1.0 / B), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.2e-79], t$95$0, If[LessEqual[x, 3.4e-18], N[((-N[(x / B), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(F * F + N[(x * 2.0 + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{B}\\
\mathbf{if}\;x \leq -1.2 \cdot 10^{-79}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 3.4 \cdot 10^{-18}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{F}{\sin B} \cdot \frac{1}{\sqrt{\mathsf{fma}\left(F, F, \mathsf{fma}\left(x, 2, 2\right)\right)}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.20000000000000003e-79 or 3.40000000000000001e-18 < x Initial program 81.5%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6485.0
Applied rewrites85.0%
Taylor expanded in B around 0
Applied rewrites86.3%
if -1.20000000000000003e-79 < x < 3.40000000000000001e-18Initial program 71.5%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6426.9
Applied rewrites26.9%
Taylor expanded in B around 0
associate-*r/N/A
lower-/.f6426.9
Applied rewrites26.9%
Taylor expanded in B around inf
lower-*.f64N/A
lift-sin.f64N/A
lift-/.f64N/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
+-commutativeN/A
associate-+r+N/A
pow2N/A
lower-sqrt.f64N/A
+-commutativeN/A
pow2N/A
associate-+l+N/A
pow2N/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6461.4
Applied rewrites61.4%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (sqrt (/ 1.0 (+ (fma F F (+ x x)) 2.0)))))
(if (<= B 0.013)
(/
(-
(fma
(fma (* 0.16666666666666666 F) t_0 (* 0.3333333333333333 x))
(* B B)
(* t_0 F))
x)
B)
(+
(- (* x (/ 1.0 (tan B))))
(/ 1.0 (* (fma -0.16666666666666666 (* B B) 1.0) B))))))
double code(double F, double B, double x) {
double t_0 = sqrt((1.0 / (fma(F, F, (x + x)) + 2.0)));
double tmp;
if (B <= 0.013) {
tmp = (fma(fma((0.16666666666666666 * F), t_0, (0.3333333333333333 * x)), (B * B), (t_0 * F)) - x) / B;
} else {
tmp = -(x * (1.0 / tan(B))) + (1.0 / (fma(-0.16666666666666666, (B * B), 1.0) * B));
}
return tmp;
}
function code(F, B, x) t_0 = sqrt(Float64(1.0 / Float64(fma(F, F, Float64(x + x)) + 2.0))) tmp = 0.0 if (B <= 0.013) tmp = Float64(Float64(fma(fma(Float64(0.16666666666666666 * F), t_0, Float64(0.3333333333333333 * x)), Float64(B * B), Float64(t_0 * F)) - x) / B); else tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(1.0 / Float64(fma(-0.16666666666666666, Float64(B * B), 1.0) * B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[Sqrt[N[(1.0 / N[(N[(F * F + N[(x + x), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[B, 0.013], N[(N[(N[(N[(N[(0.16666666666666666 * F), $MachinePrecision] * t$95$0 + N[(0.3333333333333333 * x), $MachinePrecision]), $MachinePrecision] * N[(B * B), $MachinePrecision] + N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(1.0 / N[(N[(-0.16666666666666666 * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{\mathsf{fma}\left(F, F, x + x\right) + 2}}\\
\mathbf{if}\;B \leq 0.013:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666 \cdot F, t\_0, 0.3333333333333333 \cdot x\right), B \cdot B, t\_0 \cdot F\right) - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{\mathsf{fma}\left(-0.16666666666666666, B \cdot B, 1\right) \cdot B}\\
\end{array}
\end{array}
if B < 0.0129999999999999994Initial program 73.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites57.8%
if 0.0129999999999999994 < B Initial program 84.6%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6457.5
Applied rewrites57.5%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6453.8
Applied rewrites53.8%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (sqrt (/ 1.0 (+ (fma F F (+ x x)) 2.0)))))
(if (<= B 0.018)
(/
(-
(fma
(fma (* 0.16666666666666666 F) t_0 (* 0.3333333333333333 x))
(* B B)
(* t_0 F))
x)
B)
(+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 B)))))
double code(double F, double B, double x) {
double t_0 = sqrt((1.0 / (fma(F, F, (x + x)) + 2.0)));
double tmp;
if (B <= 0.018) {
tmp = (fma(fma((0.16666666666666666 * F), t_0, (0.3333333333333333 * x)), (B * B), (t_0 * F)) - x) / B;
} else {
tmp = -(x * (1.0 / tan(B))) + (1.0 / B);
}
return tmp;
}
function code(F, B, x) t_0 = sqrt(Float64(1.0 / Float64(fma(F, F, Float64(x + x)) + 2.0))) tmp = 0.0 if (B <= 0.018) tmp = Float64(Float64(fma(fma(Float64(0.16666666666666666 * F), t_0, Float64(0.3333333333333333 * x)), Float64(B * B), Float64(t_0 * F)) - x) / B); else tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(1.0 / B)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[Sqrt[N[(1.0 / N[(N[(F * F + N[(x + x), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[B, 0.018], N[(N[(N[(N[(N[(0.16666666666666666 * F), $MachinePrecision] * t$95$0 + N[(0.3333333333333333 * x), $MachinePrecision]), $MachinePrecision] * N[(B * B), $MachinePrecision] + N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(1.0 / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{\mathsf{fma}\left(F, F, x + x\right) + 2}}\\
\mathbf{if}\;B \leq 0.018:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666 \cdot F, t\_0, 0.3333333333333333 \cdot x\right), B \cdot B, t\_0 \cdot F\right) - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{B}\\
\end{array}
\end{array}
if B < 0.0179999999999999986Initial program 73.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites57.8%
if 0.0179999999999999986 < B Initial program 84.6%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6457.5
Applied rewrites57.5%
Taylor expanded in B around 0
Applied rewrites51.0%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ 1.0 (sqrt (fma 2.0 x (fma F F 2.0))))))
(if (<= B 0.018)
(/
(-
(fma
(fma (* 0.16666666666666666 F) t_0 (* 0.3333333333333333 x))
(* B B)
(* t_0 F))
x)
B)
(+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 B)))))
double code(double F, double B, double x) {
double t_0 = 1.0 / sqrt(fma(2.0, x, fma(F, F, 2.0)));
double tmp;
if (B <= 0.018) {
tmp = (fma(fma((0.16666666666666666 * F), t_0, (0.3333333333333333 * x)), (B * B), (t_0 * F)) - x) / B;
} else {
tmp = -(x * (1.0 / tan(B))) + (1.0 / B);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(1.0 / sqrt(fma(2.0, x, fma(F, F, 2.0)))) tmp = 0.0 if (B <= 0.018) tmp = Float64(Float64(fma(fma(Float64(0.16666666666666666 * F), t_0, Float64(0.3333333333333333 * x)), Float64(B * B), Float64(t_0 * F)) - x) / B); else tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(1.0 / B)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(1.0 / N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 0.018], N[(N[(N[(N[(N[(0.16666666666666666 * F), $MachinePrecision] * t$95$0 + N[(0.3333333333333333 * x), $MachinePrecision]), $MachinePrecision] * N[(B * B), $MachinePrecision] + N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(1.0 / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}\\
\mathbf{if}\;B \leq 0.018:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666 \cdot F, t\_0, 0.3333333333333333 \cdot x\right), B \cdot B, t\_0 \cdot F\right) - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{B}\\
\end{array}
\end{array}
if B < 0.0179999999999999986Initial program 73.8%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-neg.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites85.2%
Taylor expanded in B around 0
Applied rewrites57.8%
if 0.0179999999999999986 < B Initial program 84.6%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6457.5
Applied rewrites57.5%
Taylor expanded in B around 0
Applied rewrites51.0%
(FPCore (F B x) :precision binary64 (if (<= B 1.55e-5) (/ (- (* (sqrt (/ 1.0 (+ (fma F F (+ x x)) 2.0))) F) x) B) (+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 B))))
double code(double F, double B, double x) {
double tmp;
if (B <= 1.55e-5) {
tmp = ((sqrt((1.0 / (fma(F, F, (x + x)) + 2.0))) * F) - x) / B;
} else {
tmp = -(x * (1.0 / tan(B))) + (1.0 / B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (B <= 1.55e-5) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 / Float64(fma(F, F, Float64(x + x)) + 2.0))) * F) - x) / B); else tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(1.0 / B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[B, 1.55e-5], N[(N[(N[(N[Sqrt[N[(1.0 / N[(N[(F * F + N[(x + x), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(1.0 / B), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 1.55 \cdot 10^{-5}:\\
\;\;\;\;\frac{\sqrt{\frac{1}{\mathsf{fma}\left(F, F, x + x\right) + 2}} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{B}\\
\end{array}
\end{array}
if B < 1.55000000000000007e-5Initial program 73.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites57.7%
if 1.55000000000000007e-5 < B Initial program 84.7%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6457.6
Applied rewrites57.6%
Taylor expanded in B around 0
Applied rewrites51.1%
(FPCore (F B x)
:precision binary64
(if (<= F -2200.0)
(+ (- (/ x B)) (/ -1.0 (sin B)))
(if (<= F 3.8e-7)
(fma (/ F B) (- (sqrt 0.5) (* 0.25 (/ x (sqrt 0.5)))) (/ (- x) B))
(/ (- 1.0 x) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -2200.0) {
tmp = -(x / B) + (-1.0 / sin(B));
} else if (F <= 3.8e-7) {
tmp = fma((F / B), (sqrt(0.5) - (0.25 * (x / sqrt(0.5)))), (-x / B));
} else {
tmp = (1.0 - x) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -2200.0) tmp = Float64(Float64(-Float64(x / B)) + Float64(-1.0 / sin(B))); elseif (F <= 3.8e-7) tmp = fma(Float64(F / B), Float64(sqrt(0.5) - Float64(0.25 * Float64(x / sqrt(0.5)))), Float64(Float64(-x) / B)); else tmp = Float64(Float64(1.0 - x) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -2200.0], N[((-N[(x / B), $MachinePrecision]) + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 3.8e-7], N[(N[(F / B), $MachinePrecision] * N[(N[Sqrt[0.5], $MachinePrecision] - N[(0.25 * N[(x / N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[((-x) / B), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -2200:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 3.8 \cdot 10^{-7}:\\
\;\;\;\;\mathsf{fma}\left(\frac{F}{B}, \sqrt{0.5} - 0.25 \cdot \frac{x}{\sqrt{0.5}}, \frac{-x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{\sin B}\\
\end{array}
\end{array}
if F < -2200Initial program 59.3%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6446.1
Applied rewrites46.1%
Taylor expanded in B around 0
associate-*r/N/A
lower-/.f6423.8
Applied rewrites23.8%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6476.1
Applied rewrites76.1%
if -2200 < F < 3.80000000000000015e-7Initial program 99.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites50.9%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6435.1
Applied rewrites35.1%
Taylor expanded in F around 0
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lift-neg.f6450.5
Applied rewrites50.5%
Taylor expanded in x around 0
metadata-evalN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
lower-sqrt.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
metadata-eval50.2
Applied rewrites50.2%
if 3.80000000000000015e-7 < F Initial program 59.5%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-neg.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites75.2%
Taylor expanded in F around inf
associate-*r/N/A
+-commutativeN/A
associate-*l/N/A
Applied rewrites97.9%
Taylor expanded in B around 0
Applied rewrites76.4%
(FPCore (F B x)
:precision binary64
(if (<= F -1.95e-7)
(/ (- (- (* (/ (fma 2.0 x 2.0) (* F F)) 0.5) 1.0) x) B)
(if (<= F 3.9e-7)
(fma (/ F B) (sqrt (/ 1.0 (fma 2.0 x 2.0))) (/ (- x) B))
(/ (- 1.0 x) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.95e-7) {
tmp = ((((fma(2.0, x, 2.0) / (F * F)) * 0.5) - 1.0) - x) / B;
} else if (F <= 3.9e-7) {
tmp = fma((F / B), sqrt((1.0 / fma(2.0, x, 2.0))), (-x / B));
} else {
tmp = (1.0 - x) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.95e-7) tmp = Float64(Float64(Float64(Float64(Float64(fma(2.0, x, 2.0) / Float64(F * F)) * 0.5) - 1.0) - x) / B); elseif (F <= 3.9e-7) tmp = fma(Float64(F / B), sqrt(Float64(1.0 / fma(2.0, x, 2.0))), Float64(Float64(-x) / B)); else tmp = Float64(Float64(1.0 - x) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.95e-7], N[(N[(N[(N[(N[(N[(2.0 * x + 2.0), $MachinePrecision] / N[(F * F), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision] - 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 3.9e-7], N[(N[(F / B), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(2.0 * x + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[((-x) / B), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.95 \cdot 10^{-7}:\\
\;\;\;\;\frac{\left(\frac{\mathsf{fma}\left(2, x, 2\right)}{F \cdot F} \cdot 0.5 - 1\right) - x}{B}\\
\mathbf{elif}\;F \leq 3.9 \cdot 10^{-7}:\\
\;\;\;\;\mathsf{fma}\left(\frac{F}{B}, \sqrt{\frac{1}{\mathsf{fma}\left(2, x, 2\right)}}, \frac{-x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{\sin B}\\
\end{array}
\end{array}
if F < -1.95000000000000012e-7Initial program 60.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites38.5%
Taylor expanded in F around -inf
metadata-evalN/A
lower--.f64N/A
Applied rewrites50.0%
if -1.95000000000000012e-7 < F < 3.90000000000000025e-7Initial program 99.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites50.8%
Taylor expanded in F around 0
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6450.8
Applied rewrites50.8%
if 3.90000000000000025e-7 < F Initial program 59.5%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-neg.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites75.2%
Taylor expanded in F around inf
associate-*r/N/A
+-commutativeN/A
associate-*l/N/A
Applied rewrites97.9%
Taylor expanded in B around 0
Applied rewrites76.4%
(FPCore (F B x)
:precision binary64
(if (<= F -1.95e-7)
(/ (- (- (* (/ (fma 2.0 x 2.0) (* F F)) 0.5) 1.0) x) B)
(if (<= F 1.55e+98)
(/ (- (* (sqrt (/ 1.0 (+ (fma F F (+ x x)) 2.0))) F) x) B)
(if (<= F 2.1e+227)
(/ 1.0 (sin B))
(+ (- (/ x B)) (/ (fma 0.16666666666666666 (* B B) 1.0) B))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.95e-7) {
tmp = ((((fma(2.0, x, 2.0) / (F * F)) * 0.5) - 1.0) - x) / B;
} else if (F <= 1.55e+98) {
tmp = ((sqrt((1.0 / (fma(F, F, (x + x)) + 2.0))) * F) - x) / B;
} else if (F <= 2.1e+227) {
tmp = 1.0 / sin(B);
} else {
tmp = -(x / B) + (fma(0.16666666666666666, (B * B), 1.0) / B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.95e-7) tmp = Float64(Float64(Float64(Float64(Float64(fma(2.0, x, 2.0) / Float64(F * F)) * 0.5) - 1.0) - x) / B); elseif (F <= 1.55e+98) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 / Float64(fma(F, F, Float64(x + x)) + 2.0))) * F) - x) / B); elseif (F <= 2.1e+227) tmp = Float64(1.0 / sin(B)); else tmp = Float64(Float64(-Float64(x / B)) + Float64(fma(0.16666666666666666, Float64(B * B), 1.0) / B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.95e-7], N[(N[(N[(N[(N[(N[(2.0 * x + 2.0), $MachinePrecision] / N[(F * F), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision] - 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 1.55e+98], N[(N[(N[(N[Sqrt[N[(1.0 / N[(N[(F * F + N[(x + x), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 2.1e+227], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[((-N[(x / B), $MachinePrecision]) + N[(N[(0.16666666666666666 * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.95 \cdot 10^{-7}:\\
\;\;\;\;\frac{\left(\frac{\mathsf{fma}\left(2, x, 2\right)}{F \cdot F} \cdot 0.5 - 1\right) - x}{B}\\
\mathbf{elif}\;F \leq 1.55 \cdot 10^{+98}:\\
\;\;\;\;\frac{\sqrt{\frac{1}{\mathsf{fma}\left(F, F, x + x\right) + 2}} \cdot F - x}{B}\\
\mathbf{elif}\;F \leq 2.1 \cdot 10^{+227}:\\
\;\;\;\;\frac{1}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{\mathsf{fma}\left(0.16666666666666666, B \cdot B, 1\right)}{B}\\
\end{array}
\end{array}
if F < -1.95000000000000012e-7Initial program 60.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites38.5%
Taylor expanded in F around -inf
metadata-evalN/A
lower--.f64N/A
Applied rewrites50.0%
if -1.95000000000000012e-7 < F < 1.5500000000000001e98Initial program 98.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites50.8%
if 1.5500000000000001e98 < F < 2.10000000000000019e227Initial program 56.1%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-neg.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites73.5%
Taylor expanded in F around inf
associate-*r/N/A
+-commutativeN/A
associate-*l/N/A
Applied rewrites99.7%
Taylor expanded in x around 0
Applied rewrites48.5%
if 2.10000000000000019e227 < F Initial program 27.9%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in B around 0
associate-*r/N/A
lower-/.f6476.3
Applied rewrites76.3%
Taylor expanded in B around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6453.2
Applied rewrites53.2%
(FPCore (F B x)
:precision binary64
(if (<= F -1.95e-7)
(/ (- (- (* (/ (fma 2.0 x 2.0) (* F F)) 0.5) 1.0) x) B)
(if (<= F 5.1e+163)
(/ (- (* (sqrt (/ 1.0 (+ (fma F F (+ x x)) 2.0))) F) x) B)
(+ (- (/ x B)) (/ (fma 0.16666666666666666 (* B B) 1.0) B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.95e-7) {
tmp = ((((fma(2.0, x, 2.0) / (F * F)) * 0.5) - 1.0) - x) / B;
} else if (F <= 5.1e+163) {
tmp = ((sqrt((1.0 / (fma(F, F, (x + x)) + 2.0))) * F) - x) / B;
} else {
tmp = -(x / B) + (fma(0.16666666666666666, (B * B), 1.0) / B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.95e-7) tmp = Float64(Float64(Float64(Float64(Float64(fma(2.0, x, 2.0) / Float64(F * F)) * 0.5) - 1.0) - x) / B); elseif (F <= 5.1e+163) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 / Float64(fma(F, F, Float64(x + x)) + 2.0))) * F) - x) / B); else tmp = Float64(Float64(-Float64(x / B)) + Float64(fma(0.16666666666666666, Float64(B * B), 1.0) / B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.95e-7], N[(N[(N[(N[(N[(N[(2.0 * x + 2.0), $MachinePrecision] / N[(F * F), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision] - 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 5.1e+163], N[(N[(N[(N[Sqrt[N[(1.0 / N[(N[(F * F + N[(x + x), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[((-N[(x / B), $MachinePrecision]) + N[(N[(0.16666666666666666 * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.95 \cdot 10^{-7}:\\
\;\;\;\;\frac{\left(\frac{\mathsf{fma}\left(2, x, 2\right)}{F \cdot F} \cdot 0.5 - 1\right) - x}{B}\\
\mathbf{elif}\;F \leq 5.1 \cdot 10^{+163}:\\
\;\;\;\;\frac{\sqrt{\frac{1}{\mathsf{fma}\left(F, F, x + x\right) + 2}} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{\mathsf{fma}\left(0.16666666666666666, B \cdot B, 1\right)}{B}\\
\end{array}
\end{array}
if F < -1.95000000000000012e-7Initial program 60.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites38.5%
Taylor expanded in F around -inf
metadata-evalN/A
lower--.f64N/A
Applied rewrites50.0%
if -1.95000000000000012e-7 < F < 5.1000000000000002e163Initial program 95.6%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites50.6%
if 5.1000000000000002e163 < F Initial program 32.9%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in B around 0
associate-*r/N/A
lower-/.f6474.3
Applied rewrites74.3%
Taylor expanded in B around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6451.4
Applied rewrites51.4%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (fma 2.0 x 2.0) (* F F))))
(if (<= F -1.95e-7)
(/ (- (- (* t_0 0.5) 1.0) x) B)
(if (<= F 5.5e-7)
(fma (/ F B) (sqrt (/ 1.0 (fma 2.0 x 2.0))) (/ (- x) B))
(/ (- (fma t_0 -0.5 1.0) x) B)))))
double code(double F, double B, double x) {
double t_0 = fma(2.0, x, 2.0) / (F * F);
double tmp;
if (F <= -1.95e-7) {
tmp = (((t_0 * 0.5) - 1.0) - x) / B;
} else if (F <= 5.5e-7) {
tmp = fma((F / B), sqrt((1.0 / fma(2.0, x, 2.0))), (-x / B));
} else {
tmp = (fma(t_0, -0.5, 1.0) - x) / B;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(fma(2.0, x, 2.0) / Float64(F * F)) tmp = 0.0 if (F <= -1.95e-7) tmp = Float64(Float64(Float64(Float64(t_0 * 0.5) - 1.0) - x) / B); elseif (F <= 5.5e-7) tmp = fma(Float64(F / B), sqrt(Float64(1.0 / fma(2.0, x, 2.0))), Float64(Float64(-x) / B)); else tmp = Float64(Float64(fma(t_0, -0.5, 1.0) - x) / B); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[(2.0 * x + 2.0), $MachinePrecision] / N[(F * F), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -1.95e-7], N[(N[(N[(N[(t$95$0 * 0.5), $MachinePrecision] - 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 5.5e-7], N[(N[(F / B), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(2.0 * x + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[((-x) / B), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t$95$0 * -0.5 + 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(2, x, 2\right)}{F \cdot F}\\
\mathbf{if}\;F \leq -1.95 \cdot 10^{-7}:\\
\;\;\;\;\frac{\left(t\_0 \cdot 0.5 - 1\right) - x}{B}\\
\mathbf{elif}\;F \leq 5.5 \cdot 10^{-7}:\\
\;\;\;\;\mathsf{fma}\left(\frac{F}{B}, \sqrt{\frac{1}{\mathsf{fma}\left(2, x, 2\right)}}, \frac{-x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t\_0, -0.5, 1\right) - x}{B}\\
\end{array}
\end{array}
if F < -1.95000000000000012e-7Initial program 60.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites38.5%
Taylor expanded in F around -inf
metadata-evalN/A
lower--.f64N/A
Applied rewrites50.0%
if -1.95000000000000012e-7 < F < 5.5000000000000003e-7Initial program 99.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites50.8%
Taylor expanded in F around 0
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6450.8
Applied rewrites50.8%
if 5.5000000000000003e-7 < F Initial program 59.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites39.5%
Taylor expanded in F around inf
+-commutativeN/A
*-commutativeN/A
div-addN/A
metadata-evalN/A
associate-*r/N/A
associate-*r/N/A
+-commutativeN/A
lower-fma.f64N/A
Applied rewrites50.8%
(FPCore (F B x)
:precision binary64
(if (<= F -2200.0)
(/ (- -1.0 x) B)
(if (<= F 5.5e-7)
(fma (/ F B) (sqrt 0.5) (/ (- x) B))
(/ (- (fma (/ (fma 2.0 x 2.0) (* F F)) -0.5 1.0) x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -2200.0) {
tmp = (-1.0 - x) / B;
} else if (F <= 5.5e-7) {
tmp = fma((F / B), sqrt(0.5), (-x / B));
} else {
tmp = (fma((fma(2.0, x, 2.0) / (F * F)), -0.5, 1.0) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -2200.0) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 5.5e-7) tmp = fma(Float64(F / B), sqrt(0.5), Float64(Float64(-x) / B)); else tmp = Float64(Float64(fma(Float64(fma(2.0, x, 2.0) / Float64(F * F)), -0.5, 1.0) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -2200.0], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 5.5e-7], N[(N[(F / B), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision] + N[((-x) / B), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(2.0 * x + 2.0), $MachinePrecision] / N[(F * F), $MachinePrecision]), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -2200:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 5.5 \cdot 10^{-7}:\\
\;\;\;\;\mathsf{fma}\left(\frac{F}{B}, \sqrt{0.5}, \frac{-x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{\mathsf{fma}\left(2, x, 2\right)}{F \cdot F}, -0.5, 1\right) - x}{B}\\
\end{array}
\end{array}
if F < -2200Initial program 59.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites38.1%
Taylor expanded in F around -inf
Applied rewrites51.1%
if -2200 < F < 5.5000000000000003e-7Initial program 99.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites50.9%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6435.1
Applied rewrites35.1%
Taylor expanded in F around 0
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lift-neg.f6450.5
Applied rewrites50.5%
Taylor expanded in x around 0
Applied rewrites50.5%
if 5.5000000000000003e-7 < F Initial program 59.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites39.5%
Taylor expanded in F around inf
+-commutativeN/A
*-commutativeN/A
div-addN/A
metadata-evalN/A
associate-*r/N/A
associate-*r/N/A
+-commutativeN/A
lower-fma.f64N/A
Applied rewrites50.8%
(FPCore (F B x)
:precision binary64
(if (<= F -2200.0)
(/ (- -1.0 x) B)
(if (<= F 5.5e-7)
(fma (/ F B) (sqrt (/ 1.0 (fma 2.0 x 2.0))) (/ (- x) B))
(/ (- (fma (/ (fma 2.0 x 2.0) (* F F)) -0.5 1.0) x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -2200.0) {
tmp = (-1.0 - x) / B;
} else if (F <= 5.5e-7) {
tmp = fma((F / B), sqrt((1.0 / fma(2.0, x, 2.0))), (-x / B));
} else {
tmp = (fma((fma(2.0, x, 2.0) / (F * F)), -0.5, 1.0) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -2200.0) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 5.5e-7) tmp = fma(Float64(F / B), sqrt(Float64(1.0 / fma(2.0, x, 2.0))), Float64(Float64(-x) / B)); else tmp = Float64(Float64(fma(Float64(fma(2.0, x, 2.0) / Float64(F * F)), -0.5, 1.0) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -2200.0], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 5.5e-7], N[(N[(F / B), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(2.0 * x + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[((-x) / B), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(2.0 * x + 2.0), $MachinePrecision] / N[(F * F), $MachinePrecision]), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -2200:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 5.5 \cdot 10^{-7}:\\
\;\;\;\;\mathsf{fma}\left(\frac{F}{B}, \sqrt{\frac{1}{\mathsf{fma}\left(2, x, 2\right)}}, \frac{-x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{\mathsf{fma}\left(2, x, 2\right)}{F \cdot F}, -0.5, 1\right) - x}{B}\\
\end{array}
\end{array}
if F < -2200Initial program 59.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites38.1%
Taylor expanded in F around -inf
Applied rewrites51.1%
if -2200 < F < 5.5000000000000003e-7Initial program 99.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites50.9%
Taylor expanded in F around 0
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6450.5
Applied rewrites50.5%
if 5.5000000000000003e-7 < F Initial program 59.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites39.5%
Taylor expanded in F around inf
+-commutativeN/A
*-commutativeN/A
div-addN/A
metadata-evalN/A
associate-*r/N/A
associate-*r/N/A
+-commutativeN/A
lower-fma.f64N/A
Applied rewrites50.8%
(FPCore (F B x) :precision binary64 (if (<= F -2200.0) (/ (- -1.0 x) B) (if (<= F 3.9e-7) (fma (/ F B) (sqrt 0.5) (/ (- x) B)) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -2200.0) {
tmp = (-1.0 - x) / B;
} else if (F <= 3.9e-7) {
tmp = fma((F / B), sqrt(0.5), (-x / B));
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -2200.0) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 3.9e-7) tmp = fma(Float64(F / B), sqrt(0.5), Float64(Float64(-x) / B)); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -2200.0], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 3.9e-7], N[(N[(F / B), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision] + N[((-x) / B), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -2200:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 3.9 \cdot 10^{-7}:\\
\;\;\;\;\mathsf{fma}\left(\frac{F}{B}, \sqrt{0.5}, \frac{-x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -2200Initial program 59.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites38.1%
Taylor expanded in F around -inf
Applied rewrites51.1%
if -2200 < F < 3.90000000000000025e-7Initial program 99.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites50.9%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6435.1
Applied rewrites35.1%
Taylor expanded in F around 0
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lift-neg.f6450.5
Applied rewrites50.5%
Taylor expanded in x around 0
Applied rewrites50.5%
if 3.90000000000000025e-7 < F Initial program 59.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites39.5%
Taylor expanded in F around inf
Applied rewrites50.8%
(FPCore (F B x)
:precision binary64
(if (<= F -6e-144)
(/ (- -1.0 x) B)
(if (<= F 9e-74)
(/ (- x) B)
(if (<= F 8.2e-10) (/ (* F (sqrt 0.5)) B) (/ (- 1.0 x) B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -6e-144) {
tmp = (-1.0 - x) / B;
} else if (F <= 9e-74) {
tmp = -x / B;
} else if (F <= 8.2e-10) {
tmp = (F * sqrt(0.5)) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-6d-144)) then
tmp = ((-1.0d0) - x) / b
else if (f <= 9d-74) then
tmp = -x / b
else if (f <= 8.2d-10) then
tmp = (f * sqrt(0.5d0)) / b
else
tmp = (1.0d0 - x) / b
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -6e-144) {
tmp = (-1.0 - x) / B;
} else if (F <= 9e-74) {
tmp = -x / B;
} else if (F <= 8.2e-10) {
tmp = (F * Math.sqrt(0.5)) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -6e-144: tmp = (-1.0 - x) / B elif F <= 9e-74: tmp = -x / B elif F <= 8.2e-10: tmp = (F * math.sqrt(0.5)) / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -6e-144) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 9e-74) tmp = Float64(Float64(-x) / B); elseif (F <= 8.2e-10) tmp = Float64(Float64(F * sqrt(0.5)) / B); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -6e-144) tmp = (-1.0 - x) / B; elseif (F <= 9e-74) tmp = -x / B; elseif (F <= 8.2e-10) tmp = (F * sqrt(0.5)) / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -6e-144], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 9e-74], N[((-x) / B), $MachinePrecision], If[LessEqual[F, 8.2e-10], N[(N[(F * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -6 \cdot 10^{-144}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 9 \cdot 10^{-74}:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{elif}\;F \leq 8.2 \cdot 10^{-10}:\\
\;\;\;\;\frac{F \cdot \sqrt{0.5}}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -5.9999999999999997e-144Initial program 70.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites41.6%
Taylor expanded in F around -inf
Applied rewrites42.9%
if -5.9999999999999997e-144 < F < 8.9999999999999998e-74Initial program 99.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites51.0%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6440.3
Applied rewrites40.3%
if 8.9999999999999998e-74 < F < 8.1999999999999996e-10Initial program 99.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites50.8%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6423.7
Applied rewrites23.7%
Taylor expanded in F around 0
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lift-neg.f6450.8
Applied rewrites50.8%
Taylor expanded in x around 0
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
sqrt-unprodN/A
sqrt-unprodN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
metadata-eval28.5
Applied rewrites28.5%
if 8.1999999999999996e-10 < F Initial program 59.7%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites39.5%
Taylor expanded in F around inf
Applied rewrites50.7%
(FPCore (F B x) :precision binary64 (if (<= F -6e-144) (/ (- -1.0 x) B) (if (<= F 2.2e-81) (/ (- x) B) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -6e-144) {
tmp = (-1.0 - x) / B;
} else if (F <= 2.2e-81) {
tmp = -x / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-6d-144)) then
tmp = ((-1.0d0) - x) / b
else if (f <= 2.2d-81) then
tmp = -x / b
else
tmp = (1.0d0 - x) / b
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -6e-144) {
tmp = (-1.0 - x) / B;
} else if (F <= 2.2e-81) {
tmp = -x / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -6e-144: tmp = (-1.0 - x) / B elif F <= 2.2e-81: tmp = -x / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -6e-144) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 2.2e-81) tmp = Float64(Float64(-x) / B); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -6e-144) tmp = (-1.0 - x) / B; elseif (F <= 2.2e-81) tmp = -x / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -6e-144], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 2.2e-81], N[((-x) / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -6 \cdot 10^{-144}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 2.2 \cdot 10^{-81}:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -5.9999999999999997e-144Initial program 70.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites41.6%
Taylor expanded in F around -inf
Applied rewrites42.9%
if -5.9999999999999997e-144 < F < 2.1999999999999999e-81Initial program 99.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites51.0%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6440.6
Applied rewrites40.6%
if 2.1999999999999999e-81 < F Initial program 65.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites41.1%
Taylor expanded in F around inf
Applied rewrites46.6%
(FPCore (F B x) :precision binary64 (if (<= F -6e-144) (/ (- -1.0 x) B) (/ (- x) B)))
double code(double F, double B, double x) {
double tmp;
if (F <= -6e-144) {
tmp = (-1.0 - x) / B;
} else {
tmp = -x / B;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-6d-144)) then
tmp = ((-1.0d0) - x) / b
else
tmp = -x / b
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -6e-144) {
tmp = (-1.0 - x) / B;
} else {
tmp = -x / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -6e-144: tmp = (-1.0 - x) / B else: tmp = -x / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -6e-144) tmp = Float64(Float64(-1.0 - x) / B); else tmp = Float64(Float64(-x) / B); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -6e-144) tmp = (-1.0 - x) / B; else tmp = -x / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -6e-144], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], N[((-x) / B), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -6 \cdot 10^{-144}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{B}\\
\end{array}
\end{array}
if F < -5.9999999999999997e-144Initial program 70.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites41.6%
Taylor expanded in F around -inf
Applied rewrites42.9%
if -5.9999999999999997e-144 < F Initial program 80.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites45.5%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6432.5
Applied rewrites32.5%
(FPCore (F B x) :precision binary64 (/ (- x) B))
double code(double F, double B, double x) {
return -x / B;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = -x / b
end function
public static double code(double F, double B, double x) {
return -x / B;
}
def code(F, B, x): return -x / B
function code(F, B, x) return Float64(Float64(-x) / B) end
function tmp = code(F, B, x) tmp = -x / B; end
code[F_, B_, x_] := N[((-x) / B), $MachinePrecision]
\begin{array}{l}
\\
\frac{-x}{B}
\end{array}
Initial program 76.6%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites44.0%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6429.7
Applied rewrites29.7%
herbie shell --seed 2025117
(FPCore (F B x)
:name "VandenBroeck and Keller, Equation (23)"
:precision binary64
(+ (- (* x (/ 1.0 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))