
(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 22 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 -4e+79)
(- (/ (+ 1.0 (* (cos B) x)) (sin B)))
(if (<= F 8e+46)
(+
(- (/ (* x 1.0) (tan B)))
(* (/ F (sin B)) (sqrt (/ 1.0 (fma F F 2.0)))))
(fma F (/ 1.0 (* F (sin B))) (* (- x) (/ 1.0 (tan B)))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -4e+79) {
tmp = -((1.0 + (cos(B) * x)) / sin(B));
} else if (F <= 8e+46) {
tmp = -((x * 1.0) / tan(B)) + ((F / sin(B)) * sqrt((1.0 / fma(F, F, 2.0))));
} else {
tmp = fma(F, (1.0 / (F * sin(B))), (-x * (1.0 / tan(B))));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -4e+79) tmp = Float64(-Float64(Float64(1.0 + Float64(cos(B) * x)) / sin(B))); elseif (F <= 8e+46) tmp = Float64(Float64(-Float64(Float64(x * 1.0) / tan(B))) + Float64(Float64(F / sin(B)) * sqrt(Float64(1.0 / fma(F, F, 2.0))))); else tmp = fma(F, Float64(1.0 / Float64(F * sin(B))), Float64(Float64(-x) * Float64(1.0 / tan(B)))); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -4e+79], (-N[(N[(1.0 + N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 8e+46], N[((-N[(N[(x * 1.0), $MachinePrecision] / N[Tan[B], $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(F * N[(1.0 / N[(F * N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[((-x) * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -4 \cdot 10^{+79}:\\
\;\;\;\;-\frac{1 + \cos B \cdot x}{\sin B}\\
\mathbf{elif}\;F \leq 8 \cdot 10^{+46}:\\
\;\;\;\;\left(-\frac{x \cdot 1}{\tan B}\right) + \frac{F}{\sin B} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{1}{F \cdot \sin B}, \left(-x\right) \cdot \frac{1}{\tan B}\right)\\
\end{array}
\end{array}
if F < -3.99999999999999987e79Initial program 48.3%
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.f6499.7
Applied rewrites99.7%
if -3.99999999999999987e79 < F < 7.9999999999999999e46Initial program 98.8%
Taylor expanded in x around 0
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f6498.8
Applied rewrites98.8%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6498.9
Applied rewrites98.9%
if 7.9999999999999999e46 < F Initial program 53.3%
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 rewrites70.2%
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
lift-sin.f64N/A
lower-+.f64N/A
+-commutativeN/A
associate-/l*N/A
Applied rewrites70.1%
Taylor expanded in F around inf
lower-/.f64N/A
lower-*.f64N/A
lift-sin.f6499.5
Applied rewrites99.5%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ 1.0 (tan B))))
(if (<= F -2.9e+79)
(- (/ (+ 1.0 (* (cos B) x)) (sin B)))
(if (<= F 1e+47)
(+ (- (* x t_0)) (* (/ F (sin B)) (sqrt (/ 1.0 (fma F F 2.0)))))
(fma F (/ 1.0 (* F (sin B))) (* (- x) t_0))))))
double code(double F, double B, double x) {
double t_0 = 1.0 / tan(B);
double tmp;
if (F <= -2.9e+79) {
tmp = -((1.0 + (cos(B) * x)) / sin(B));
} else if (F <= 1e+47) {
tmp = -(x * t_0) + ((F / sin(B)) * sqrt((1.0 / fma(F, F, 2.0))));
} else {
tmp = fma(F, (1.0 / (F * sin(B))), (-x * t_0));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(1.0 / tan(B)) tmp = 0.0 if (F <= -2.9e+79) tmp = Float64(-Float64(Float64(1.0 + Float64(cos(B) * x)) / sin(B))); elseif (F <= 1e+47) tmp = Float64(Float64(-Float64(x * t_0)) + Float64(Float64(F / sin(B)) * sqrt(Float64(1.0 / fma(F, F, 2.0))))); else tmp = fma(F, Float64(1.0 / Float64(F * sin(B))), Float64(Float64(-x) * t_0)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -2.9e+79], (-N[(N[(1.0 + N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 1e+47], N[((-N[(x * t$95$0), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(F * N[(1.0 / N[(F * N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[((-x) * t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\tan B}\\
\mathbf{if}\;F \leq -2.9 \cdot 10^{+79}:\\
\;\;\;\;-\frac{1 + \cos B \cdot x}{\sin B}\\
\mathbf{elif}\;F \leq 10^{+47}:\\
\;\;\;\;\left(-x \cdot t\_0\right) + \frac{F}{\sin B} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{1}{F \cdot \sin B}, \left(-x\right) \cdot t\_0\right)\\
\end{array}
\end{array}
if F < -2.89999999999999992e79Initial program 48.3%
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.f6499.7
Applied rewrites99.7%
if -2.89999999999999992e79 < F < 1e47Initial program 98.8%
Taylor expanded in x around 0
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f6498.8
Applied rewrites98.8%
if 1e47 < F Initial program 53.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 rewrites70.2%
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
lift-sin.f64N/A
lower-+.f64N/A
+-commutativeN/A
associate-/l*N/A
Applied rewrites70.1%
Taylor expanded in F around inf
lower-/.f64N/A
lower-*.f64N/A
lift-sin.f6499.5
Applied rewrites99.5%
(FPCore (F B x)
:precision binary64
(if (<= F -1.4)
(- (/ (+ 1.0 (* (cos B) x)) (sin B)))
(if (<= F 1.45)
(+ (- (/ (* x 1.0) (tan B))) (* (/ F (sin B)) (sqrt 0.5)))
(fma (- x) (/ 1.0 (tan B)) (/ 1.0 (sin B))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.4) {
tmp = -((1.0 + (cos(B) * x)) / sin(B));
} else if (F <= 1.45) {
tmp = -((x * 1.0) / tan(B)) + ((F / sin(B)) * sqrt(0.5));
} else {
tmp = fma(-x, (1.0 / tan(B)), (1.0 / sin(B)));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.4) tmp = Float64(-Float64(Float64(1.0 + Float64(cos(B) * x)) / sin(B))); elseif (F <= 1.45) tmp = Float64(Float64(-Float64(Float64(x * 1.0) / tan(B))) + Float64(Float64(F / sin(B)) * sqrt(0.5))); else tmp = fma(Float64(-x), Float64(1.0 / tan(B)), Float64(1.0 / sin(B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.4], (-N[(N[(1.0 + N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 1.45], N[((-N[(N[(x * 1.0), $MachinePrecision] / N[Tan[B], $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-x) * N[(1.0 / 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.4:\\
\;\;\;\;-\frac{1 + \cos B \cdot x}{\sin B}\\
\mathbf{elif}\;F \leq 1.45:\\
\;\;\;\;\left(-\frac{x \cdot 1}{\tan B}\right) + \frac{F}{\sin B} \cdot \sqrt{0.5}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-x, \frac{1}{\tan B}, \frac{1}{\sin B}\right)\\
\end{array}
\end{array}
if F < -1.3999999999999999Initial program 58.1%
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.f6499.3
Applied rewrites99.3%
if -1.3999999999999999 < F < 1.44999999999999996Initial program 99.5%
Taylor expanded in x around 0
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f6499.5
Applied rewrites99.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%
Taylor expanded in F around 0
Applied rewrites99.1%
if 1.44999999999999996 < F Initial program 59.0%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6499.1
Applied rewrites99.1%
metadata-eval99.1
metadata-eval99.1
lift-+.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
Applied rewrites99.1%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ 1.0 (tan B))))
(if (<= F -1.35)
(- (/ (+ 1.0 (* (cos B) x)) (sin B)))
(if (<= F 1.4)
(+ (- (* x t_0)) (* (/ F (sin B)) (sqrt 0.5)))
(fma (- x) t_0 (/ 1.0 (sin B)))))))
double code(double F, double B, double x) {
double t_0 = 1.0 / tan(B);
double tmp;
if (F <= -1.35) {
tmp = -((1.0 + (cos(B) * x)) / sin(B));
} else if (F <= 1.4) {
tmp = -(x * t_0) + ((F / sin(B)) * sqrt(0.5));
} else {
tmp = fma(-x, t_0, (1.0 / sin(B)));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(1.0 / tan(B)) tmp = 0.0 if (F <= -1.35) tmp = Float64(-Float64(Float64(1.0 + Float64(cos(B) * x)) / sin(B))); elseif (F <= 1.4) tmp = Float64(Float64(-Float64(x * t_0)) + Float64(Float64(F / sin(B)) * sqrt(0.5))); else tmp = fma(Float64(-x), t_0, Float64(1.0 / sin(B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -1.35], (-N[(N[(1.0 + N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 1.4], N[((-N[(x * t$95$0), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-x) * t$95$0 + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\tan B}\\
\mathbf{if}\;F \leq -1.35:\\
\;\;\;\;-\frac{1 + \cos B \cdot x}{\sin B}\\
\mathbf{elif}\;F \leq 1.4:\\
\;\;\;\;\left(-x \cdot t\_0\right) + \frac{F}{\sin B} \cdot \sqrt{0.5}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-x, t\_0, \frac{1}{\sin B}\right)\\
\end{array}
\end{array}
if F < -1.3500000000000001Initial program 58.1%
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.f6499.3
Applied rewrites99.3%
if -1.3500000000000001 < F < 1.3999999999999999Initial program 99.5%
Taylor expanded in x around 0
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f6499.5
Applied rewrites99.5%
Taylor expanded in F around 0
Applied rewrites99.0%
if 1.3999999999999999 < F Initial program 59.0%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6499.1
Applied rewrites99.1%
metadata-eval99.1
metadata-eval99.1
lift-+.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
Applied rewrites99.1%
(FPCore (F B x)
:precision binary64
(if (<= F -5.8e-19)
(- (/ (+ 1.0 (* (cos B) x)) (sin B)))
(if (<= F 7.8e-95)
(+ (- (/ (* x 1.0) (tan B))) (* (/ F B) (sqrt (/ 1.0 (fma F F 2.0)))))
(if (<= F 19000.0)
(fma F (/ (pow (fma 2.0 x (fma F F 2.0)) -0.5) (sin B)) (/ (- x) B))
(fma (- x) (/ 1.0 (tan B)) (/ 1.0 (sin B)))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -5.8e-19) {
tmp = -((1.0 + (cos(B) * x)) / sin(B));
} else if (F <= 7.8e-95) {
tmp = -((x * 1.0) / tan(B)) + ((F / B) * sqrt((1.0 / fma(F, F, 2.0))));
} else if (F <= 19000.0) {
tmp = fma(F, (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) / sin(B)), (-x / B));
} else {
tmp = fma(-x, (1.0 / tan(B)), (1.0 / sin(B)));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -5.8e-19) tmp = Float64(-Float64(Float64(1.0 + Float64(cos(B) * x)) / sin(B))); elseif (F <= 7.8e-95) tmp = Float64(Float64(-Float64(Float64(x * 1.0) / tan(B))) + Float64(Float64(F / B) * sqrt(Float64(1.0 / fma(F, F, 2.0))))); elseif (F <= 19000.0) tmp = fma(F, Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) / sin(B)), Float64(Float64(-x) / B)); else tmp = fma(Float64(-x), Float64(1.0 / tan(B)), Float64(1.0 / sin(B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -5.8e-19], (-N[(N[(1.0 + N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 7.8e-95], N[((-N[(N[(x * 1.0), $MachinePrecision] / N[Tan[B], $MachinePrecision]), $MachinePrecision]) + N[(N[(F / B), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 19000.0], N[(F * N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + N[((-x) / B), $MachinePrecision]), $MachinePrecision], N[((-x) * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -5.8 \cdot 10^{-19}:\\
\;\;\;\;-\frac{1 + \cos B \cdot x}{\sin B}\\
\mathbf{elif}\;F \leq 7.8 \cdot 10^{-95}:\\
\;\;\;\;\left(-\frac{x \cdot 1}{\tan B}\right) + \frac{F}{B} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}}\\
\mathbf{elif}\;F \leq 19000:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B}, \frac{-x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-x, \frac{1}{\tan B}, \frac{1}{\sin B}\right)\\
\end{array}
\end{array}
if F < -5.8e-19Initial program 59.7%
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.f6496.9
Applied rewrites96.9%
if -5.8e-19 < F < 7.8e-95Initial program 99.5%
Taylor expanded in x around 0
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f6499.5
Applied rewrites99.5%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.7
Applied rewrites99.7%
Taylor expanded in B around 0
Applied rewrites86.3%
if 7.8e-95 < F < 19000Initial program 99.4%
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.4%
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
lift-sin.f64N/A
lower-+.f64N/A
+-commutativeN/A
associate-/l*N/A
Applied rewrites99.4%
Taylor expanded in B around 0
distribute-lft-neg-inN/A
mul-1-negN/A
distribute-frac-negN/A
lift-neg.f64N/A
lift-/.f6475.7
Applied rewrites75.7%
if 19000 < F Initial program 58.6%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6499.6
Applied rewrites99.6%
metadata-eval99.6
metadata-eval99.6
lift-+.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
Applied rewrites99.6%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* (cos B) x)))
(if (<= F -5.8e-19)
(- (/ (+ 1.0 t_0) (sin B)))
(if (<= F 7.8e-95)
(+ (- (/ (* x 1.0) (tan B))) (* (/ F B) (sqrt (/ 1.0 (fma F F 2.0)))))
(if (<= F 19000.0)
(fma F (/ (pow (fma 2.0 x (fma F F 2.0)) -0.5) (sin B)) (/ (- x) 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 <= -5.8e-19) {
tmp = -((1.0 + t_0) / sin(B));
} else if (F <= 7.8e-95) {
tmp = -((x * 1.0) / tan(B)) + ((F / B) * sqrt((1.0 / fma(F, F, 2.0))));
} else if (F <= 19000.0) {
tmp = fma(F, (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) / sin(B)), (-x / 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 <= -5.8e-19) tmp = Float64(-Float64(Float64(1.0 + t_0) / sin(B))); elseif (F <= 7.8e-95) tmp = Float64(Float64(-Float64(Float64(x * 1.0) / tan(B))) + Float64(Float64(F / B) * sqrt(Float64(1.0 / fma(F, F, 2.0))))); elseif (F <= 19000.0) tmp = fma(F, Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) / sin(B)), Float64(Float64(-x) / 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, -5.8e-19], (-N[(N[(1.0 + t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 7.8e-95], N[((-N[(N[(x * 1.0), $MachinePrecision] / N[Tan[B], $MachinePrecision]), $MachinePrecision]) + N[(N[(F / B), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 19000.0], N[(F * N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + N[((-x) / B), $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 -5.8 \cdot 10^{-19}:\\
\;\;\;\;-\frac{1 + t\_0}{\sin B}\\
\mathbf{elif}\;F \leq 7.8 \cdot 10^{-95}:\\
\;\;\;\;\left(-\frac{x \cdot 1}{\tan B}\right) + \frac{F}{B} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}}\\
\mathbf{elif}\;F \leq 19000:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B}, \frac{-x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - t\_0}{\sin B}\\
\end{array}
\end{array}
if F < -5.8e-19Initial program 59.7%
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.f6496.9
Applied rewrites96.9%
if -5.8e-19 < F < 7.8e-95Initial program 99.5%
Taylor expanded in x around 0
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f6499.5
Applied rewrites99.5%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.7
Applied rewrites99.7%
Taylor expanded in B around 0
Applied rewrites86.3%
if 7.8e-95 < F < 19000Initial program 99.4%
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.4%
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
lift-sin.f64N/A
lower-+.f64N/A
+-commutativeN/A
associate-/l*N/A
Applied rewrites99.4%
Taylor expanded in B around 0
distribute-lft-neg-inN/A
mul-1-negN/A
distribute-frac-negN/A
lift-neg.f64N/A
lift-/.f6475.7
Applied rewrites75.7%
if 19000 < F Initial program 58.6%
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.f6499.6
Applied rewrites99.6%
(FPCore (F B x)
:precision binary64
(if (<= F -1.05e+104)
(+ (- (/ x B)) (/ -1.0 (sin B)))
(if (<= F 7.8e-95)
(+ (- (/ (* x 1.0) (tan B))) (* (/ F B) (sqrt (/ 1.0 (fma F F 2.0)))))
(if (<= F 19000.0)
(fma F (/ (pow (fma 2.0 x (fma F F 2.0)) -0.5) (sin B)) (/ (- x) B))
(/ (- 1.0 (* (cos B) x)) (sin B))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.05e+104) {
tmp = -(x / B) + (-1.0 / sin(B));
} else if (F <= 7.8e-95) {
tmp = -((x * 1.0) / tan(B)) + ((F / B) * sqrt((1.0 / fma(F, F, 2.0))));
} else if (F <= 19000.0) {
tmp = fma(F, (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) / sin(B)), (-x / B));
} else {
tmp = (1.0 - (cos(B) * x)) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.05e+104) tmp = Float64(Float64(-Float64(x / B)) + Float64(-1.0 / sin(B))); elseif (F <= 7.8e-95) tmp = Float64(Float64(-Float64(Float64(x * 1.0) / tan(B))) + Float64(Float64(F / B) * sqrt(Float64(1.0 / fma(F, F, 2.0))))); elseif (F <= 19000.0) tmp = fma(F, Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) / sin(B)), Float64(Float64(-x) / B)); else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.05e+104], N[((-N[(x / B), $MachinePrecision]) + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 7.8e-95], N[((-N[(N[(x * 1.0), $MachinePrecision] / N[Tan[B], $MachinePrecision]), $MachinePrecision]) + N[(N[(F / B), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 19000.0], N[(F * N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + N[((-x) / B), $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 -1.05 \cdot 10^{+104}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 7.8 \cdot 10^{-95}:\\
\;\;\;\;\left(-\frac{x \cdot 1}{\tan B}\right) + \frac{F}{B} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}}\\
\mathbf{elif}\;F \leq 19000:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B}, \frac{-x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -1.0499999999999999e104Initial program 44.3%
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 rewrites62.6%
Taylor expanded in B around 0
lower-/.f6438.4
Applied rewrites38.4%
Taylor expanded in F around -inf
Applied rewrites74.7%
if -1.0499999999999999e104 < F < 7.8e-95Initial program 98.3%
Taylor expanded in x around 0
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f6498.3
Applied rewrites98.3%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6498.4
Applied rewrites98.4%
Taylor expanded in B around 0
Applied rewrites81.8%
if 7.8e-95 < F < 19000Initial program 99.4%
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.4%
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
lift-sin.f64N/A
lower-+.f64N/A
+-commutativeN/A
associate-/l*N/A
Applied rewrites99.4%
Taylor expanded in B around 0
distribute-lft-neg-inN/A
mul-1-negN/A
distribute-frac-negN/A
lift-neg.f64N/A
lift-/.f6475.7
Applied rewrites75.7%
if 19000 < F Initial program 58.6%
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.f6499.6
Applied rewrites99.6%
(FPCore (F B x)
:precision binary64
(if (<= F -1.05e+104)
(+ (- (/ x B)) (/ -1.0 (sin B)))
(if (<= F 7.8e-95)
(+ (- (/ (* x 1.0) (tan B))) (* (/ F B) (sqrt (/ 1.0 (fma F F 2.0)))))
(if (<= F 8.2e+106)
(fma F (/ (pow (fma 2.0 x (fma F F 2.0)) -0.5) (sin B)) (/ (- x) B))
(+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 B))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.05e+104) {
tmp = -(x / B) + (-1.0 / sin(B));
} else if (F <= 7.8e-95) {
tmp = -((x * 1.0) / tan(B)) + ((F / B) * sqrt((1.0 / fma(F, F, 2.0))));
} else if (F <= 8.2e+106) {
tmp = fma(F, (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) / sin(B)), (-x / B));
} else {
tmp = -(x * (1.0 / tan(B))) + (1.0 / B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.05e+104) tmp = Float64(Float64(-Float64(x / B)) + Float64(-1.0 / sin(B))); elseif (F <= 7.8e-95) tmp = Float64(Float64(-Float64(Float64(x * 1.0) / tan(B))) + Float64(Float64(F / B) * sqrt(Float64(1.0 / fma(F, F, 2.0))))); elseif (F <= 8.2e+106) tmp = fma(F, Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) / sin(B)), Float64(Float64(-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[F, -1.05e+104], N[((-N[(x / B), $MachinePrecision]) + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 7.8e-95], N[((-N[(N[(x * 1.0), $MachinePrecision] / N[Tan[B], $MachinePrecision]), $MachinePrecision]) + N[(N[(F / B), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 8.2e+106], N[(F * N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + N[((-x) / B), $MachinePrecision]), $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}\;F \leq -1.05 \cdot 10^{+104}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 7.8 \cdot 10^{-95}:\\
\;\;\;\;\left(-\frac{x \cdot 1}{\tan B}\right) + \frac{F}{B} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}}\\
\mathbf{elif}\;F \leq 8.2 \cdot 10^{+106}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B}, \frac{-x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{B}\\
\end{array}
\end{array}
if F < -1.0499999999999999e104Initial program 44.3%
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 rewrites62.6%
Taylor expanded in B around 0
lower-/.f6438.4
Applied rewrites38.4%
Taylor expanded in F around -inf
Applied rewrites74.7%
if -1.0499999999999999e104 < F < 7.8e-95Initial program 98.3%
Taylor expanded in x around 0
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f6498.3
Applied rewrites98.3%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6498.4
Applied rewrites98.4%
Taylor expanded in B around 0
Applied rewrites81.8%
if 7.8e-95 < F < 8.2000000000000005e106Initial program 96.0%
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
lift-sin.f64N/A
lower-+.f64N/A
+-commutativeN/A
associate-/l*N/A
Applied rewrites99.4%
Taylor expanded in B around 0
distribute-lft-neg-inN/A
mul-1-negN/A
distribute-frac-negN/A
lift-neg.f64N/A
lift-/.f6476.5
Applied rewrites76.5%
if 8.2000000000000005e106 < F Initial program 44.5%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in B around 0
Applied rewrites73.9%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (- (/ x B))) (t_1 (sqrt (/ 1.0 (fma F F 2.0)))))
(if (<= F -1.05e+104)
(+ t_0 (/ -1.0 (sin B)))
(if (<= F 7.8e-95)
(+ (- (/ (* x 1.0) (tan B))) (* (/ F B) t_1))
(if (<= F 6.7e+106)
(+ t_0 (* (/ F (sin B)) t_1))
(+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 B)))))))
double code(double F, double B, double x) {
double t_0 = -(x / B);
double t_1 = sqrt((1.0 / fma(F, F, 2.0)));
double tmp;
if (F <= -1.05e+104) {
tmp = t_0 + (-1.0 / sin(B));
} else if (F <= 7.8e-95) {
tmp = -((x * 1.0) / tan(B)) + ((F / B) * t_1);
} else if (F <= 6.7e+106) {
tmp = t_0 + ((F / sin(B)) * t_1);
} else {
tmp = -(x * (1.0 / tan(B))) + (1.0 / B);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(-Float64(x / B)) t_1 = sqrt(Float64(1.0 / fma(F, F, 2.0))) tmp = 0.0 if (F <= -1.05e+104) tmp = Float64(t_0 + Float64(-1.0 / sin(B))); elseif (F <= 7.8e-95) tmp = Float64(Float64(-Float64(Float64(x * 1.0) / tan(B))) + Float64(Float64(F / B) * t_1)); elseif (F <= 6.7e+106) tmp = Float64(t_0 + Float64(Float64(F / sin(B)) * t_1)); 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[(x / B), $MachinePrecision])}, Block[{t$95$1 = N[Sqrt[N[(1.0 / N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[F, -1.05e+104], N[(t$95$0 + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 7.8e-95], N[((-N[(N[(x * 1.0), $MachinePrecision] / N[Tan[B], $MachinePrecision]), $MachinePrecision]) + N[(N[(F / B), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 6.7e+106], N[(t$95$0 + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $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{x}{B}\\
t_1 := \sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}}\\
\mathbf{if}\;F \leq -1.05 \cdot 10^{+104}:\\
\;\;\;\;t\_0 + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 7.8 \cdot 10^{-95}:\\
\;\;\;\;\left(-\frac{x \cdot 1}{\tan B}\right) + \frac{F}{B} \cdot t\_1\\
\mathbf{elif}\;F \leq 6.7 \cdot 10^{+106}:\\
\;\;\;\;t\_0 + \frac{F}{\sin B} \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{B}\\
\end{array}
\end{array}
if F < -1.0499999999999999e104Initial program 44.3%
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 rewrites62.6%
Taylor expanded in B around 0
lower-/.f6438.4
Applied rewrites38.4%
Taylor expanded in F around -inf
Applied rewrites74.7%
if -1.0499999999999999e104 < F < 7.8e-95Initial program 98.3%
Taylor expanded in x around 0
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f6498.3
Applied rewrites98.3%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6498.4
Applied rewrites98.4%
Taylor expanded in B around 0
Applied rewrites81.8%
if 7.8e-95 < F < 6.7e106Initial program 96.0%
Taylor expanded in x around 0
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f6495.9
Applied rewrites95.9%
Taylor expanded in B around 0
lower-/.f6473.0
Applied rewrites73.0%
if 6.7e106 < F Initial program 44.5%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in B around 0
Applied rewrites73.9%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (- (* x (/ 1.0 (tan B)))))
(t_1 (- (/ x B)))
(t_2 (sqrt (/ 1.0 (fma F F 2.0)))))
(if (<= F -1.05e+104)
(+ t_1 (/ -1.0 (sin B)))
(if (<= F 7.8e-95)
(+ t_0 (* (/ F B) t_2))
(if (<= F 6.7e+106) (+ t_1 (* (/ F (sin B)) t_2)) (+ t_0 (/ 1.0 B)))))))
double code(double F, double B, double x) {
double t_0 = -(x * (1.0 / tan(B)));
double t_1 = -(x / B);
double t_2 = sqrt((1.0 / fma(F, F, 2.0)));
double tmp;
if (F <= -1.05e+104) {
tmp = t_1 + (-1.0 / sin(B));
} else if (F <= 7.8e-95) {
tmp = t_0 + ((F / B) * t_2);
} else if (F <= 6.7e+106) {
tmp = t_1 + ((F / sin(B)) * t_2);
} else {
tmp = t_0 + (1.0 / B);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(-Float64(x * Float64(1.0 / tan(B)))) t_1 = Float64(-Float64(x / B)) t_2 = sqrt(Float64(1.0 / fma(F, F, 2.0))) tmp = 0.0 if (F <= -1.05e+104) tmp = Float64(t_1 + Float64(-1.0 / sin(B))); elseif (F <= 7.8e-95) tmp = Float64(t_0 + Float64(Float64(F / B) * t_2)); elseif (F <= 6.7e+106) tmp = Float64(t_1 + Float64(Float64(F / sin(B)) * t_2)); else tmp = Float64(t_0 + Float64(1.0 / B)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = (-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision])}, Block[{t$95$1 = (-N[(x / B), $MachinePrecision])}, Block[{t$95$2 = N[Sqrt[N[(1.0 / N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[F, -1.05e+104], N[(t$95$1 + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 7.8e-95], N[(t$95$0 + N[(N[(F / B), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 6.7e+106], N[(t$95$1 + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(1.0 / B), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -x \cdot \frac{1}{\tan B}\\
t_1 := -\frac{x}{B}\\
t_2 := \sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}}\\
\mathbf{if}\;F \leq -1.05 \cdot 10^{+104}:\\
\;\;\;\;t\_1 + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 7.8 \cdot 10^{-95}:\\
\;\;\;\;t\_0 + \frac{F}{B} \cdot t\_2\\
\mathbf{elif}\;F \leq 6.7 \cdot 10^{+106}:\\
\;\;\;\;t\_1 + \frac{F}{\sin B} \cdot t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{1}{B}\\
\end{array}
\end{array}
if F < -1.0499999999999999e104Initial program 44.3%
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 rewrites62.6%
Taylor expanded in B around 0
lower-/.f6438.4
Applied rewrites38.4%
Taylor expanded in F around -inf
Applied rewrites74.7%
if -1.0499999999999999e104 < F < 7.8e-95Initial program 98.3%
Taylor expanded in x around 0
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f6498.3
Applied rewrites98.3%
Taylor expanded in B around 0
Applied rewrites81.6%
if 7.8e-95 < F < 6.7e106Initial program 96.0%
Taylor expanded in x around 0
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f6495.9
Applied rewrites95.9%
Taylor expanded in B around 0
lower-/.f6473.0
Applied rewrites73.0%
if 6.7e106 < F Initial program 44.5%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in B around 0
Applied rewrites73.9%
(FPCore (F B x)
:precision binary64
(let* ((t_0
(+
(/ (- x) (tan B))
(/ 1.0 (* (fma (* B B) -0.16666666666666666 1.0) B)))))
(if (<= x -8.5e-60)
t_0
(if (<= x 4e-89)
(+ (- (/ x B)) (* (/ F (sin B)) (sqrt (/ 1.0 (fma F F 2.0)))))
t_0))))
double code(double F, double B, double x) {
double t_0 = (-x / tan(B)) + (1.0 / (fma((B * B), -0.16666666666666666, 1.0) * B));
double tmp;
if (x <= -8.5e-60) {
tmp = t_0;
} else if (x <= 4e-89) {
tmp = -(x / B) + ((F / sin(B)) * sqrt((1.0 / fma(F, F, 2.0))));
} else {
tmp = t_0;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(Float64(-x) / tan(B)) + Float64(1.0 / Float64(fma(Float64(B * B), -0.16666666666666666, 1.0) * B))) tmp = 0.0 if (x <= -8.5e-60) tmp = t_0; elseif (x <= 4e-89) tmp = Float64(Float64(-Float64(x / B)) + Float64(Float64(F / sin(B)) * sqrt(Float64(1.0 / fma(F, F, 2.0))))); else tmp = t_0; end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(N[(N[(B * B), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -8.5e-60], t$95$0, If[LessEqual[x, 4e-89], N[((-N[(x / B), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\tan B} + \frac{1}{\mathsf{fma}\left(B \cdot B, -0.16666666666666666, 1\right) \cdot B}\\
\mathbf{if}\;x \leq -8.5 \cdot 10^{-60}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 4 \cdot 10^{-89}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{F}{\sin B} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -8.50000000000000044e-60 or 4.00000000000000015e-89 < x Initial program 80.5%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6479.7
Applied rewrites79.7%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6482.0
Applied rewrites82.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.f6482.1
Applied rewrites82.1%
if -8.50000000000000044e-60 < x < 4.00000000000000015e-89Initial program 72.0%
Taylor expanded in x around 0
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f6472.0
Applied rewrites72.0%
Taylor expanded in B around 0
lower-/.f6462.2
Applied rewrites62.2%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 B))))
(if (<= x -1.3e-59)
t_0
(if (<= x 4e-89)
(+ (- (/ x B)) (* (/ F (sin B)) (sqrt (/ 1.0 (fma F F 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.3e-59) {
tmp = t_0;
} else if (x <= 4e-89) {
tmp = -(x / B) + ((F / sin(B)) * sqrt((1.0 / fma(F, F, 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.3e-59) tmp = t_0; elseif (x <= 4e-89) tmp = Float64(Float64(-Float64(x / B)) + Float64(Float64(F / sin(B)) * sqrt(Float64(1.0 / fma(F, F, 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.3e-59], t$95$0, If[LessEqual[x, 4e-89], N[((-N[(x / B), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(F * F + 2.0), $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.3 \cdot 10^{-59}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 4 \cdot 10^{-89}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{F}{\sin B} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.29999999999999999e-59 or 4.00000000000000015e-89 < x Initial program 80.5%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6479.7
Applied rewrites79.7%
Taylor expanded in B around 0
Applied rewrites81.6%
if -1.29999999999999999e-59 < x < 4.00000000000000015e-89Initial program 72.0%
Taylor expanded in x around 0
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f6472.0
Applied rewrites72.0%
Taylor expanded in B around 0
lower-/.f6462.2
Applied rewrites62.2%
(FPCore (F B x)
:precision binary64
(if (<= B 0.000122)
(+
(- (/ x B))
(/
(* F (pow (fma 2.0 x (fma F F 2.0)) -0.5))
(* B (- 1.0 (* 0.16666666666666666 (* B B))))))
(+ (- (* x (/ 1.0 (tan B)))) (/ 1.0 B))))
double code(double F, double B, double x) {
double tmp;
if (B <= 0.000122) {
tmp = -(x / B) + ((F * pow(fma(2.0, x, fma(F, F, 2.0)), -0.5)) / (B * (1.0 - (0.16666666666666666 * (B * B)))));
} else {
tmp = -(x * (1.0 / tan(B))) + (1.0 / B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (B <= 0.000122) tmp = Float64(Float64(-Float64(x / B)) + Float64(Float64(F * (fma(2.0, x, fma(F, F, 2.0)) ^ -0.5)) / Float64(B * Float64(1.0 - Float64(0.16666666666666666 * Float64(B * 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, 0.000122], N[((-N[(x / B), $MachinePrecision]) + N[(N[(F * N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] / N[(B * N[(1.0 - N[(0.16666666666666666 * N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 0.000122:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{F \cdot {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{B \cdot \left(1 - 0.16666666666666666 \cdot \left(B \cdot B\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{B}\\
\end{array}
\end{array}
if B < 1.21999999999999997e-4Initial 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.1%
Taylor expanded in B around 0
lower-/.f6466.8
Applied rewrites66.8%
Taylor expanded in B around 0
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
metadata-evalN/A
lower-*.f64N/A
pow2N/A
lift-*.f6457.8
Applied rewrites57.8%
if 1.21999999999999997e-4 < B Initial program 85.1%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6456.5
Applied rewrites56.5%
Taylor expanded in B around 0
Applied rewrites51.2%
(FPCore (F B x) :precision binary64 (if (<= B 0.000116) (/ (- (* (/ 1.0 (sqrt (fma F F 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 <= 0.000116) {
tmp = (((1.0 / sqrt(fma(F, F, 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 <= 0.000116) tmp = Float64(Float64(Float64(Float64(1.0 / sqrt(fma(F, F, 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, 0.000116], N[(N[(N[(N[(1.0 / N[Sqrt[N[(F * F + 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 0.000116:\\
\;\;\;\;\frac{\frac{1}{\sqrt{\mathsf{fma}\left(F, F, 2\right)}} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{1}{B}\\
\end{array}
\end{array}
if B < 1.16e-4Initial program 73.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites57.8%
Taylor expanded in F around -inf
Applied rewrites39.6%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f6457.7
Applied rewrites57.7%
if 1.16e-4 < B Initial program 85.1%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6456.5
Applied rewrites56.5%
Taylor expanded in B around 0
Applied rewrites51.2%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (- (/ x B))))
(if (<= F -5.8e-19)
(+ t_0 (/ -1.0 (sin B)))
(if (<= F 7e-11)
(fma (/ F B) (sqrt 0.5) (/ (- x) B))
(+ t_0 (/ 1.0 (sin B)))))))
double code(double F, double B, double x) {
double t_0 = -(x / B);
double tmp;
if (F <= -5.8e-19) {
tmp = t_0 + (-1.0 / sin(B));
} else if (F <= 7e-11) {
tmp = fma((F / B), sqrt(0.5), (-x / B));
} else {
tmp = t_0 + (1.0 / sin(B));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(-Float64(x / B)) tmp = 0.0 if (F <= -5.8e-19) tmp = Float64(t_0 + Float64(-1.0 / sin(B))); elseif (F <= 7e-11) tmp = fma(Float64(F / B), sqrt(0.5), Float64(Float64(-x) / B)); else tmp = Float64(t_0 + Float64(1.0 / sin(B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = (-N[(x / B), $MachinePrecision])}, If[LessEqual[F, -5.8e-19], N[(t$95$0 + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 7e-11], N[(N[(F / B), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision] + N[((-x) / B), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -\frac{x}{B}\\
\mathbf{if}\;F \leq -5.8 \cdot 10^{-19}:\\
\;\;\;\;t\_0 + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 7 \cdot 10^{-11}:\\
\;\;\;\;\mathsf{fma}\left(\frac{F}{B}, \sqrt{0.5}, \frac{-x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -5.8e-19Initial program 59.7%
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 rewrites74.2%
Taylor expanded in B around 0
lower-/.f6451.7
Applied rewrites51.7%
Taylor expanded in F around -inf
Applied rewrites74.0%
if -5.8e-19 < F < 7.00000000000000038e-11Initial program 99.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites51.3%
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.f6451.3
Applied rewrites51.3%
Taylor expanded in x around 0
Applied rewrites51.3%
if 7.00000000000000038e-11 < F Initial program 60.1%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6497.8
Applied rewrites97.8%
Taylor expanded in B around 0
lower-/.f6474.1
Applied rewrites74.1%
(FPCore (F B x)
:precision binary64
(if (<= F -5.8e-19)
(/ (- -1.0 x) B)
(if (<= F 7e-11)
(fma (/ F B) (sqrt 0.5) (/ (- x) B))
(+ (- (/ x B)) (/ 1.0 (sin B))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -5.8e-19) {
tmp = (-1.0 - x) / B;
} else if (F <= 7e-11) {
tmp = fma((F / B), sqrt(0.5), (-x / B));
} else {
tmp = -(x / B) + (1.0 / sin(B));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -5.8e-19) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 7e-11) tmp = fma(Float64(F / B), sqrt(0.5), Float64(Float64(-x) / B)); else tmp = Float64(Float64(-Float64(x / B)) + Float64(1.0 / sin(B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -5.8e-19], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 7e-11], N[(N[(F / B), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision] + N[((-x) / B), $MachinePrecision]), $MachinePrecision], N[((-N[(x / B), $MachinePrecision]) + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -5.8 \cdot 10^{-19}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 7 \cdot 10^{-11}:\\
\;\;\;\;\mathsf{fma}\left(\frac{F}{B}, \sqrt{0.5}, \frac{-x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -5.8e-19Initial program 59.7%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites38.6%
Taylor expanded in F around -inf
Applied rewrites50.5%
if -5.8e-19 < F < 7.00000000000000038e-11Initial program 99.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites51.3%
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.f6451.3
Applied rewrites51.3%
Taylor expanded in x around 0
Applied rewrites51.3%
if 7.00000000000000038e-11 < F Initial program 60.1%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6497.8
Applied rewrites97.8%
Taylor expanded in B around 0
lower-/.f6474.1
Applied rewrites74.1%
(FPCore (F B x)
:precision binary64
(if (<= F -5.8e-19)
(/ (- -1.0 x) B)
(if (<= F 7e-11)
(fma (/ F B) (sqrt 0.5) (/ (- x) B))
(/ (- (- 1.0 (/ 1.0 (* F F))) x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -5.8e-19) {
tmp = (-1.0 - x) / B;
} else if (F <= 7e-11) {
tmp = fma((F / B), sqrt(0.5), (-x / B));
} else {
tmp = ((1.0 - (1.0 / (F * F))) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -5.8e-19) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 7e-11) tmp = fma(Float64(F / B), sqrt(0.5), Float64(Float64(-x) / B)); else tmp = Float64(Float64(Float64(1.0 - Float64(1.0 / Float64(F * F))) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -5.8e-19], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 7e-11], N[(N[(F / B), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision] + N[((-x) / B), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - N[(1.0 / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -5.8 \cdot 10^{-19}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 7 \cdot 10^{-11}:\\
\;\;\;\;\mathsf{fma}\left(\frac{F}{B}, \sqrt{0.5}, \frac{-x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 - \frac{1}{F \cdot F}\right) - x}{B}\\
\end{array}
\end{array}
if F < -5.8e-19Initial program 59.7%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites38.6%
Taylor expanded in F around -inf
Applied rewrites50.5%
if -5.8e-19 < F < 7.00000000000000038e-11Initial program 99.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites51.3%
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.f6451.3
Applied rewrites51.3%
Taylor expanded in x around 0
Applied rewrites51.3%
if 7.00000000000000038e-11 < F Initial program 60.1%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites38.0%
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 rewrites48.6%
Taylor expanded in x around 0
lower--.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6448.8
Applied rewrites48.8%
(FPCore (F B x) :precision binary64 (if (<= F -5.8e-19) (/ (- -1.0 x) B) (if (<= F 1.4) (fma (/ F B) (sqrt 0.5) (/ (- x) B)) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -5.8e-19) {
tmp = (-1.0 - x) / B;
} else if (F <= 1.4) {
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 <= -5.8e-19) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 1.4) 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, -5.8e-19], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 1.4], 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 -5.8 \cdot 10^{-19}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 1.4:\\
\;\;\;\;\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 < -5.8e-19Initial program 59.7%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites38.6%
Taylor expanded in F around -inf
Applied rewrites50.5%
if -5.8e-19 < F < 1.3999999999999999Initial program 99.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites51.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
lower-fma.f64N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6451.0
Applied rewrites51.0%
Taylor expanded in x around 0
Applied rewrites51.0%
if 1.3999999999999999 < F Initial program 59.0%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites38.0%
Taylor expanded in F around inf
Applied rewrites49.6%
(FPCore (F B x)
:precision binary64
(if (<= F -5.8e-19)
(/ (- -1.0 x) B)
(if (<= F -3e-172)
(/ (* F (sqrt 0.5)) B)
(if (<= F 4.8e-68) (/ (- x) B) (/ (- 1.0 x) B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -5.8e-19) {
tmp = (-1.0 - x) / B;
} else if (F <= -3e-172) {
tmp = (F * sqrt(0.5)) / B;
} else if (F <= 4.8e-68) {
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 <= (-5.8d-19)) then
tmp = ((-1.0d0) - x) / b
else if (f <= (-3d-172)) then
tmp = (f * sqrt(0.5d0)) / b
else if (f <= 4.8d-68) 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 <= -5.8e-19) {
tmp = (-1.0 - x) / B;
} else if (F <= -3e-172) {
tmp = (F * Math.sqrt(0.5)) / B;
} else if (F <= 4.8e-68) {
tmp = -x / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -5.8e-19: tmp = (-1.0 - x) / B elif F <= -3e-172: tmp = (F * math.sqrt(0.5)) / B elif F <= 4.8e-68: tmp = -x / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -5.8e-19) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= -3e-172) tmp = Float64(Float64(F * sqrt(0.5)) / B); elseif (F <= 4.8e-68) 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 <= -5.8e-19) tmp = (-1.0 - x) / B; elseif (F <= -3e-172) tmp = (F * sqrt(0.5)) / B; elseif (F <= 4.8e-68) tmp = -x / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -5.8e-19], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, -3e-172], N[(N[(F * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 4.8e-68], N[((-x) / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -5.8 \cdot 10^{-19}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq -3 \cdot 10^{-172}:\\
\;\;\;\;\frac{F \cdot \sqrt{0.5}}{B}\\
\mathbf{elif}\;F \leq 4.8 \cdot 10^{-68}:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -5.8e-19Initial program 59.7%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites38.6%
Taylor expanded in F around -inf
Applied rewrites50.5%
if -5.8e-19 < F < -2.99999999999999984e-172Initial program 99.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites52.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
lower-fma.f64N/A
associate-*r/N/A
mul-1-negN/A
lower-/.f64N/A
lower-neg.f6452.0
Applied rewrites52.0%
Taylor expanded in x around 0
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
sqrt-unprodN/A
lower-/.f64N/A
sqrt-unprodN/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lower-sqrt.f64N/A
metadata-eval24.8
Applied rewrites24.8%
if -2.99999999999999984e-172 < F < 4.79999999999999982e-68Initial program 99.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites50.7%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6440.7
Applied rewrites40.7%
if 4.79999999999999982e-68 < F Initial program 65.9%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites40.2%
Taylor expanded in F around inf
Applied rewrites45.1%
(FPCore (F B x) :precision binary64 (if (<= F -5.6e-111) (/ (- -1.0 x) B) (if (<= F 4.8e-68) (/ (- x) B) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -5.6e-111) {
tmp = (-1.0 - x) / B;
} else if (F <= 4.8e-68) {
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 <= (-5.6d-111)) then
tmp = ((-1.0d0) - x) / b
else if (f <= 4.8d-68) 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 <= -5.6e-111) {
tmp = (-1.0 - x) / B;
} else if (F <= 4.8e-68) {
tmp = -x / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -5.6e-111: tmp = (-1.0 - x) / B elif F <= 4.8e-68: tmp = -x / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -5.6e-111) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 4.8e-68) 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 <= -5.6e-111) tmp = (-1.0 - x) / B; elseif (F <= 4.8e-68) tmp = -x / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -5.6e-111], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 4.8e-68], N[((-x) / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -5.6 \cdot 10^{-111}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 4.8 \cdot 10^{-68}:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -5.5999999999999999e-111Initial program 66.7%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites41.0%
Taylor expanded in F around -inf
Applied rewrites45.7%
if -5.5999999999999999e-111 < F < 4.79999999999999982e-68Initial 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.f6439.6
Applied rewrites39.6%
if 4.79999999999999982e-68 < F Initial program 65.9%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites40.2%
Taylor expanded in F around inf
Applied rewrites45.1%
(FPCore (F B x) :precision binary64 (if (<= F -5.6e-111) (/ (- -1.0 x) B) (/ (- x) B)))
double code(double F, double B, double x) {
double tmp;
if (F <= -5.6e-111) {
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 <= (-5.6d-111)) 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 <= -5.6e-111) {
tmp = (-1.0 - x) / B;
} else {
tmp = -x / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -5.6e-111: tmp = (-1.0 - x) / B else: tmp = -x / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -5.6e-111) 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 <= -5.6e-111) tmp = (-1.0 - x) / B; else tmp = -x / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -5.6e-111], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], N[((-x) / B), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -5.6 \cdot 10^{-111}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{B}\\
\end{array}
\end{array}
if F < -5.5999999999999999e-111Initial program 66.7%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites41.0%
Taylor expanded in F around -inf
Applied rewrites45.7%
if -5.5999999999999999e-111 < F Initial program 82.4%
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.1
Applied rewrites32.1%
(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.7%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites43.8%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6429.6
Applied rewrites29.6%
herbie shell --seed 2025111
(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))))))