
(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 19 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
(let* ((t_0 (/ (- x) (tan B))))
(if (<= F -4e+20)
(- (/ -1.0 (sin B)) (/ x (tan B)))
(if (<= F 1e+43)
(fma (- F) (/ -1.0 (* (sin B) (pow (fma 2.0 x (fma F F 2.0)) 0.5))) t_0)
(fma (/ 1.0 (sin B)) 1.0 t_0)))))
double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (F <= -4e+20) {
tmp = (-1.0 / sin(B)) - (x / tan(B));
} else if (F <= 1e+43) {
tmp = fma(-F, (-1.0 / (sin(B) * pow(fma(2.0, x, fma(F, F, 2.0)), 0.5))), t_0);
} else {
tmp = fma((1.0 / sin(B)), 1.0, t_0);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (F <= -4e+20) tmp = Float64(Float64(-1.0 / sin(B)) - Float64(x / tan(B))); elseif (F <= 1e+43) tmp = fma(Float64(-F), Float64(-1.0 / Float64(sin(B) * (fma(2.0, x, fma(F, F, 2.0)) ^ 0.5))), t_0); else tmp = fma(Float64(1.0 / sin(B)), 1.0, t_0); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -4e+20], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1e+43], N[((-F) * N[(-1.0 / N[(N[Sin[B], $MachinePrecision] * N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] * 1.0 + t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -4 \cdot 10^{+20}:\\
\;\;\;\;\frac{-1}{\sin B} - \frac{x}{\tan B}\\
\mathbf{elif}\;F \leq 10^{+43}:\\
\;\;\;\;\mathsf{fma}\left(-F, \frac{-1}{\sin B \cdot {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{0.5}}, t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{\sin B}, 1, t\_0\right)\\
\end{array}
\end{array}
if F < -4e20Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites85.0%
Taylor expanded in F around -inf
Applied rewrites56.5%
lift-fma.f64N/A
add-flipN/A
lower--.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
*-lft-identityN/A
lift-/.f64N/A
distribute-neg-frac2N/A
lift-neg.f64N/A
frac-2negN/A
lower-/.f6456.5
Applied rewrites56.5%
if -4e20 < F < 1.00000000000000001e43Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites84.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-+.f64N/A
metadata-evalN/A
metadata-evalN/A
lift-/.f64N/A
lift-neg.f64N/A
mul-1-negN/A
lower-neg.f6484.9
Applied rewrites84.9%
Applied rewrites84.9%
if 1.00000000000000001e43 < F Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites85.0%
Taylor expanded in F around inf
Applied rewrites56.7%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ x (tan B))))
(if (<= F -5e+26)
(- (/ -1.0 (sin B)) t_0)
(if (<= F 95000000.0)
(- (/ F (* (sin B) (sqrt (fma x 2.0 (fma F F 2.0))))) t_0)
(fma (/ 1.0 (sin B)) 1.0 (/ (- x) (tan B)))))))
double code(double F, double B, double x) {
double t_0 = x / tan(B);
double tmp;
if (F <= -5e+26) {
tmp = (-1.0 / sin(B)) - t_0;
} else if (F <= 95000000.0) {
tmp = (F / (sin(B) * sqrt(fma(x, 2.0, fma(F, F, 2.0))))) - t_0;
} else {
tmp = fma((1.0 / sin(B)), 1.0, (-x / tan(B)));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(x / tan(B)) tmp = 0.0 if (F <= -5e+26) tmp = Float64(Float64(-1.0 / sin(B)) - t_0); elseif (F <= 95000000.0) tmp = Float64(Float64(F / Float64(sin(B) * sqrt(fma(x, 2.0, fma(F, F, 2.0))))) - t_0); else tmp = fma(Float64(1.0 / sin(B)), 1.0, Float64(Float64(-x) / tan(B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -5e+26], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 95000000.0], N[(N[(F / N[(N[Sin[B], $MachinePrecision] * N[Sqrt[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] * 1.0 + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{\tan B}\\
\mathbf{if}\;F \leq -5 \cdot 10^{+26}:\\
\;\;\;\;\frac{-1}{\sin B} - t\_0\\
\mathbf{elif}\;F \leq 95000000:\\
\;\;\;\;\frac{F}{\sin B \cdot \sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}} - t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{\sin B}, 1, \frac{-x}{\tan B}\right)\\
\end{array}
\end{array}
if F < -5.0000000000000001e26Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites85.0%
Taylor expanded in F around -inf
Applied rewrites56.5%
lift-fma.f64N/A
add-flipN/A
lower--.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
*-lft-identityN/A
lift-/.f64N/A
distribute-neg-frac2N/A
lift-neg.f64N/A
frac-2negN/A
lower-/.f6456.5
Applied rewrites56.5%
if -5.0000000000000001e26 < F < 9.5e7Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites84.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-+.f64N/A
metadata-evalN/A
metadata-evalN/A
lift-/.f64N/A
lift-neg.f64N/A
mul-1-negN/A
lower-neg.f6484.9
Applied rewrites84.9%
Applied rewrites84.9%
lift-fma.f64N/A
add-flipN/A
lower--.f64N/A
Applied rewrites85.0%
if 9.5e7 < F Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites85.0%
Taylor expanded in F around inf
Applied rewrites56.7%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ x (tan B))))
(if (<= F -2.7e+20)
(- (/ -1.0 (sin B)) t_0)
(if (<= F 0.000175)
(- (* (pow (fma x 2.0 (fma F F 2.0)) -0.5) (/ F B)) t_0)
(fma (/ 1.0 (sin B)) 1.0 (/ (- x) (tan B)))))))
double code(double F, double B, double x) {
double t_0 = x / tan(B);
double tmp;
if (F <= -2.7e+20) {
tmp = (-1.0 / sin(B)) - t_0;
} else if (F <= 0.000175) {
tmp = (pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5) * (F / B)) - t_0;
} else {
tmp = fma((1.0 / sin(B)), 1.0, (-x / tan(B)));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(x / tan(B)) tmp = 0.0 if (F <= -2.7e+20) tmp = Float64(Float64(-1.0 / sin(B)) - t_0); elseif (F <= 0.000175) tmp = Float64(Float64((fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5) * Float64(F / B)) - t_0); else tmp = fma(Float64(1.0 / sin(B)), 1.0, Float64(Float64(-x) / tan(B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -2.7e+20], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 0.000175], N[(N[(N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * N[(F / B), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] * 1.0 + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{\tan B}\\
\mathbf{if}\;F \leq -2.7 \cdot 10^{+20}:\\
\;\;\;\;\frac{-1}{\sin B} - t\_0\\
\mathbf{elif}\;F \leq 0.000175:\\
\;\;\;\;{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot \frac{F}{B} - t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{\sin B}, 1, \frac{-x}{\tan B}\right)\\
\end{array}
\end{array}
if F < -2.7e20Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites85.0%
Taylor expanded in F around -inf
Applied rewrites56.5%
lift-fma.f64N/A
add-flipN/A
lower--.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
*-lft-identityN/A
lift-/.f64N/A
distribute-neg-frac2N/A
lift-neg.f64N/A
frac-2negN/A
lower-/.f6456.5
Applied rewrites56.5%
if -2.7e20 < F < 1.74999999999999998e-4Initial program 76.6%
Taylor expanded in B around 0
lower-/.f6462.2
Applied rewrites62.2%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
mult-flip-revN/A
distribute-frac-negN/A
lift-neg.f64N/A
lift-/.f64N/A
lower--.f64N/A
Applied rewrites62.3%
if 1.74999999999999998e-4 < F Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites85.0%
Taylor expanded in F around inf
Applied rewrites56.7%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (pow (fma x 2.0 (fma F F 2.0)) -0.5)) (t_1 (/ x (tan B))))
(if (<= F -2.7e+20)
(- (/ -1.0 (sin B)) t_1)
(if (<= F 2e+30)
(- (* t_0 (/ F B)) t_1)
(if (<= F 2.1e+97)
(fma (- F) (/ 1.0 (/ (sin B) (- t_0))) (* -1.0 (/ x B)))
(fma (- F) (/ -1.0 (* B F)) (/ (- x) (tan B))))))))
double code(double F, double B, double x) {
double t_0 = pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5);
double t_1 = x / tan(B);
double tmp;
if (F <= -2.7e+20) {
tmp = (-1.0 / sin(B)) - t_1;
} else if (F <= 2e+30) {
tmp = (t_0 * (F / B)) - t_1;
} else if (F <= 2.1e+97) {
tmp = fma(-F, (1.0 / (sin(B) / -t_0)), (-1.0 * (x / B)));
} else {
tmp = fma(-F, (-1.0 / (B * F)), (-x / tan(B)));
}
return tmp;
}
function code(F, B, x) t_0 = fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5 t_1 = Float64(x / tan(B)) tmp = 0.0 if (F <= -2.7e+20) tmp = Float64(Float64(-1.0 / sin(B)) - t_1); elseif (F <= 2e+30) tmp = Float64(Float64(t_0 * Float64(F / B)) - t_1); elseif (F <= 2.1e+97) tmp = fma(Float64(-F), Float64(1.0 / Float64(sin(B) / Float64(-t_0))), Float64(-1.0 * Float64(x / B))); else tmp = fma(Float64(-F), Float64(-1.0 / Float64(B * F)), Float64(Float64(-x) / tan(B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]}, Block[{t$95$1 = N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -2.7e+20], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[F, 2e+30], N[(N[(t$95$0 * N[(F / B), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[F, 2.1e+97], N[((-F) * N[(1.0 / N[(N[Sin[B], $MachinePrecision] / (-t$95$0)), $MachinePrecision]), $MachinePrecision] + N[(-1.0 * N[(x / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-F) * N[(-1.0 / N[(B * F), $MachinePrecision]), $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}\\
t_1 := \frac{x}{\tan B}\\
\mathbf{if}\;F \leq -2.7 \cdot 10^{+20}:\\
\;\;\;\;\frac{-1}{\sin B} - t\_1\\
\mathbf{elif}\;F \leq 2 \cdot 10^{+30}:\\
\;\;\;\;t\_0 \cdot \frac{F}{B} - t\_1\\
\mathbf{elif}\;F \leq 2.1 \cdot 10^{+97}:\\
\;\;\;\;\mathsf{fma}\left(-F, \frac{1}{\frac{\sin B}{-t\_0}}, -1 \cdot \frac{x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-F, \frac{-1}{B \cdot F}, \frac{-x}{\tan B}\right)\\
\end{array}
\end{array}
if F < -2.7e20Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites85.0%
Taylor expanded in F around -inf
Applied rewrites56.5%
lift-fma.f64N/A
add-flipN/A
lower--.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
*-lft-identityN/A
lift-/.f64N/A
distribute-neg-frac2N/A
lift-neg.f64N/A
frac-2negN/A
lower-/.f6456.5
Applied rewrites56.5%
if -2.7e20 < F < 2e30Initial program 76.6%
Taylor expanded in B around 0
lower-/.f6462.2
Applied rewrites62.2%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
mult-flip-revN/A
distribute-frac-negN/A
lift-neg.f64N/A
lift-/.f64N/A
lower--.f64N/A
Applied rewrites62.3%
if 2e30 < F < 2.10000000000000012e97Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites84.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-+.f64N/A
metadata-evalN/A
metadata-evalN/A
lift-/.f64N/A
lift-neg.f64N/A
mul-1-negN/A
lower-neg.f6484.9
Applied rewrites84.9%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f6458.1
Applied rewrites58.1%
if 2.10000000000000012e97 < F Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites84.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-+.f64N/A
metadata-evalN/A
metadata-evalN/A
lift-/.f64N/A
lift-neg.f64N/A
mul-1-negN/A
lower-neg.f6484.9
Applied rewrites84.9%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f64N/A
metadata-evalN/A
metadata-eval70.5
Applied rewrites70.5%
Taylor expanded in F around inf
lower-/.f64N/A
lower-*.f6450.6
Applied rewrites50.6%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ x (tan B))))
(if (<= F -2.7e+20)
(- (/ -1.0 (sin B)) t_0)
(if (<= F 2e+30)
(- (* (pow (fma x 2.0 (fma F F 2.0)) -0.5) (/ F B)) t_0)
(if (<= F 2.1e+97)
(fma
(- F)
(/ -1.0 (* (sin B) (pow (fma 2.0 x (fma F F 2.0)) 0.5)))
(* -1.0 (/ x B)))
(fma (- F) (/ -1.0 (* B F)) (/ (- x) (tan B))))))))
double code(double F, double B, double x) {
double t_0 = x / tan(B);
double tmp;
if (F <= -2.7e+20) {
tmp = (-1.0 / sin(B)) - t_0;
} else if (F <= 2e+30) {
tmp = (pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5) * (F / B)) - t_0;
} else if (F <= 2.1e+97) {
tmp = fma(-F, (-1.0 / (sin(B) * pow(fma(2.0, x, fma(F, F, 2.0)), 0.5))), (-1.0 * (x / B)));
} else {
tmp = fma(-F, (-1.0 / (B * F)), (-x / tan(B)));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(x / tan(B)) tmp = 0.0 if (F <= -2.7e+20) tmp = Float64(Float64(-1.0 / sin(B)) - t_0); elseif (F <= 2e+30) tmp = Float64(Float64((fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5) * Float64(F / B)) - t_0); elseif (F <= 2.1e+97) tmp = fma(Float64(-F), Float64(-1.0 / Float64(sin(B) * (fma(2.0, x, fma(F, F, 2.0)) ^ 0.5))), Float64(-1.0 * Float64(x / B))); else tmp = fma(Float64(-F), Float64(-1.0 / Float64(B * F)), Float64(Float64(-x) / tan(B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -2.7e+20], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 2e+30], N[(N[(N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * N[(F / B), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 2.1e+97], N[((-F) * N[(-1.0 / N[(N[Sin[B], $MachinePrecision] * N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 * N[(x / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-F) * N[(-1.0 / N[(B * F), $MachinePrecision]), $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{\tan B}\\
\mathbf{if}\;F \leq -2.7 \cdot 10^{+20}:\\
\;\;\;\;\frac{-1}{\sin B} - t\_0\\
\mathbf{elif}\;F \leq 2 \cdot 10^{+30}:\\
\;\;\;\;{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot \frac{F}{B} - t\_0\\
\mathbf{elif}\;F \leq 2.1 \cdot 10^{+97}:\\
\;\;\;\;\mathsf{fma}\left(-F, \frac{-1}{\sin B \cdot {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{0.5}}, -1 \cdot \frac{x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-F, \frac{-1}{B \cdot F}, \frac{-x}{\tan B}\right)\\
\end{array}
\end{array}
if F < -2.7e20Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites85.0%
Taylor expanded in F around -inf
Applied rewrites56.5%
lift-fma.f64N/A
add-flipN/A
lower--.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
*-lft-identityN/A
lift-/.f64N/A
distribute-neg-frac2N/A
lift-neg.f64N/A
frac-2negN/A
lower-/.f6456.5
Applied rewrites56.5%
if -2.7e20 < F < 2e30Initial program 76.6%
Taylor expanded in B around 0
lower-/.f6462.2
Applied rewrites62.2%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
mult-flip-revN/A
distribute-frac-negN/A
lift-neg.f64N/A
lift-/.f64N/A
lower--.f64N/A
Applied rewrites62.3%
if 2e30 < F < 2.10000000000000012e97Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites84.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-+.f64N/A
metadata-evalN/A
metadata-evalN/A
lift-/.f64N/A
lift-neg.f64N/A
mul-1-negN/A
lower-neg.f6484.9
Applied rewrites84.9%
Applied rewrites84.9%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f6458.1
Applied rewrites58.1%
if 2.10000000000000012e97 < F Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites84.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-+.f64N/A
metadata-evalN/A
metadata-evalN/A
lift-/.f64N/A
lift-neg.f64N/A
mul-1-negN/A
lower-neg.f6484.9
Applied rewrites84.9%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f64N/A
metadata-evalN/A
metadata-eval70.5
Applied rewrites70.5%
Taylor expanded in F around inf
lower-/.f64N/A
lower-*.f6450.6
Applied rewrites50.6%
(FPCore (F B x)
:precision binary64
(if (<= x -1.2e-15)
(fma (/ 1.0 B) -1.0 (/ (- x) (tan B)))
(if (<= x 2.55)
(fma
(- F)
(/ -1.0 (* (sin B) (pow (fma 2.0 x (fma F F 2.0)) 0.5)))
(* -1.0 (/ x B)))
(* -1.0 (/ (* x (cos B)) (sin B))))))
double code(double F, double B, double x) {
double tmp;
if (x <= -1.2e-15) {
tmp = fma((1.0 / B), -1.0, (-x / tan(B)));
} else if (x <= 2.55) {
tmp = fma(-F, (-1.0 / (sin(B) * pow(fma(2.0, x, fma(F, F, 2.0)), 0.5))), (-1.0 * (x / B)));
} else {
tmp = -1.0 * ((x * cos(B)) / sin(B));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (x <= -1.2e-15) tmp = fma(Float64(1.0 / B), -1.0, Float64(Float64(-x) / tan(B))); elseif (x <= 2.55) tmp = fma(Float64(-F), Float64(-1.0 / Float64(sin(B) * (fma(2.0, x, fma(F, F, 2.0)) ^ 0.5))), Float64(-1.0 * Float64(x / B))); else tmp = Float64(-1.0 * Float64(Float64(x * cos(B)) / sin(B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[x, -1.2e-15], N[(N[(1.0 / B), $MachinePrecision] * -1.0 + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.55], N[((-F) * N[(-1.0 / N[(N[Sin[B], $MachinePrecision] * N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 * N[(x / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 * N[(N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.2 \cdot 10^{-15}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{B}, -1, \frac{-x}{\tan B}\right)\\
\mathbf{elif}\;x \leq 2.55:\\
\;\;\;\;\mathsf{fma}\left(-F, \frac{-1}{\sin B \cdot {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{0.5}}, -1 \cdot \frac{x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{x \cdot \cos B}{\sin B}\\
\end{array}
\end{array}
if x < -1.19999999999999997e-15Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites85.0%
Taylor expanded in F around -inf
Applied rewrites56.5%
Taylor expanded in B around 0
lower-/.f6454.0
Applied rewrites54.0%
if -1.19999999999999997e-15 < x < 2.5499999999999998Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites84.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-+.f64N/A
metadata-evalN/A
metadata-evalN/A
lift-/.f64N/A
lift-neg.f64N/A
mul-1-negN/A
lower-neg.f6484.9
Applied rewrites84.9%
Applied rewrites84.9%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f6458.1
Applied rewrites58.1%
if 2.5499999999999998 < x Initial program 76.6%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6456.3
Applied rewrites56.3%
(FPCore (F B x)
:precision binary64
(if (<= x -1.2e-15)
(fma (/ 1.0 B) -1.0 (/ (- x) (tan B)))
(if (<= x 2.55)
(fma
(- F)
(* (/ -1.0 (sin B)) (pow (fma 2.0 x (fma F F 2.0)) -0.5))
(* -1.0 (/ x B)))
(* -1.0 (/ (* x (cos B)) (sin B))))))
double code(double F, double B, double x) {
double tmp;
if (x <= -1.2e-15) {
tmp = fma((1.0 / B), -1.0, (-x / tan(B)));
} else if (x <= 2.55) {
tmp = fma(-F, ((-1.0 / sin(B)) * pow(fma(2.0, x, fma(F, F, 2.0)), -0.5)), (-1.0 * (x / B)));
} else {
tmp = -1.0 * ((x * cos(B)) / sin(B));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (x <= -1.2e-15) tmp = fma(Float64(1.0 / B), -1.0, Float64(Float64(-x) / tan(B))); elseif (x <= 2.55) tmp = fma(Float64(-F), Float64(Float64(-1.0 / sin(B)) * (fma(2.0, x, fma(F, F, 2.0)) ^ -0.5)), Float64(-1.0 * Float64(x / B))); else tmp = Float64(-1.0 * Float64(Float64(x * cos(B)) / sin(B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[x, -1.2e-15], N[(N[(1.0 / B), $MachinePrecision] * -1.0 + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.55], N[((-F) * N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] + N[(-1.0 * N[(x / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 * N[(N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.2 \cdot 10^{-15}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{B}, -1, \frac{-x}{\tan B}\right)\\
\mathbf{elif}\;x \leq 2.55:\\
\;\;\;\;\mathsf{fma}\left(-F, \frac{-1}{\sin B} \cdot {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}, -1 \cdot \frac{x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{x \cdot \cos B}{\sin B}\\
\end{array}
\end{array}
if x < -1.19999999999999997e-15Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites85.0%
Taylor expanded in F around -inf
Applied rewrites56.5%
Taylor expanded in B around 0
lower-/.f6454.0
Applied rewrites54.0%
if -1.19999999999999997e-15 < x < 2.5499999999999998Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites84.9%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f6458.1
Applied rewrites58.1%
if 2.5499999999999998 < x Initial program 76.6%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6456.3
Applied rewrites56.3%
(FPCore (F B x)
:precision binary64
(if (<= x -1.2e-15)
(fma (/ 1.0 B) -1.0 (/ (- x) (tan B)))
(if (<= x 2.2)
(fma
(/ 1.0 (sin B))
(* (pow (fma 2.0 x (fma F F 2.0)) -0.5) F)
(* -1.0 (/ x B)))
(* -1.0 (/ (* x (cos B)) (sin B))))))
double code(double F, double B, double x) {
double tmp;
if (x <= -1.2e-15) {
tmp = fma((1.0 / B), -1.0, (-x / tan(B)));
} else if (x <= 2.2) {
tmp = fma((1.0 / sin(B)), (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) * F), (-1.0 * (x / B)));
} else {
tmp = -1.0 * ((x * cos(B)) / sin(B));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (x <= -1.2e-15) tmp = fma(Float64(1.0 / B), -1.0, Float64(Float64(-x) / tan(B))); elseif (x <= 2.2) tmp = fma(Float64(1.0 / sin(B)), Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) * F), Float64(-1.0 * Float64(x / B))); else tmp = Float64(-1.0 * Float64(Float64(x * cos(B)) / sin(B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[x, -1.2e-15], N[(N[(1.0 / B), $MachinePrecision] * -1.0 + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.2], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] + N[(-1.0 * N[(x / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 * N[(N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.2 \cdot 10^{-15}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{B}, -1, \frac{-x}{\tan B}\right)\\
\mathbf{elif}\;x \leq 2.2:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{\sin B}, {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot F, -1 \cdot \frac{x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{x \cdot \cos B}{\sin B}\\
\end{array}
\end{array}
if x < -1.19999999999999997e-15Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites85.0%
Taylor expanded in F around -inf
Applied rewrites56.5%
Taylor expanded in B around 0
lower-/.f6454.0
Applied rewrites54.0%
if -1.19999999999999997e-15 < x < 2.2000000000000002Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites85.0%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f6458.1
Applied rewrites58.1%
if 2.2000000000000002 < x Initial program 76.6%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6456.3
Applied rewrites56.3%
(FPCore (F B x)
:precision binary64
(let* ((t_0
(+
(- (* x (/ 1.0 (tan B))))
(*
(/ F (sin B))
(pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))
(t_1
(- (* (pow (fma x 2.0 (fma F F 2.0)) -0.5) (/ F B)) (/ x (tan B)))))
(if (<= t_0 -50000.0)
t_1
(if (<= t_0 10.0)
(/ F (* (sin B) (sqrt (+ 2.0 (pow F 2.0)))))
(if (<= t_0 5e+225)
t_1
(fma (- F) (/ -1.0 (* B F)) (/ (- x) (tan B))))))))
double code(double F, double B, double x) {
double t_0 = -(x * (1.0 / tan(B))) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
double t_1 = (pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5) * (F / B)) - (x / tan(B));
double tmp;
if (t_0 <= -50000.0) {
tmp = t_1;
} else if (t_0 <= 10.0) {
tmp = F / (sin(B) * sqrt((2.0 + pow(F, 2.0))));
} else if (t_0 <= 5e+225) {
tmp = t_1;
} else {
tmp = fma(-F, (-1.0 / (B * F)), (-x / tan(B)));
}
return tmp;
}
function code(F, B, x) t_0 = 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))))) t_1 = Float64(Float64((fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5) * Float64(F / B)) - Float64(x / tan(B))) tmp = 0.0 if (t_0 <= -50000.0) tmp = t_1; elseif (t_0 <= 10.0) tmp = Float64(F / Float64(sin(B) * sqrt(Float64(2.0 + (F ^ 2.0))))); elseif (t_0 <= 5e+225) tmp = t_1; else tmp = fma(Float64(-F), Float64(-1.0 / Float64(B * F)), Float64(Float64(-x) / tan(B))); 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[(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]}, Block[{t$95$1 = N[(N[(N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * N[(F / B), $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -50000.0], t$95$1, If[LessEqual[t$95$0, 10.0], N[(F / N[(N[Sin[B], $MachinePrecision] * N[Sqrt[N[(2.0 + N[Power[F, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+225], t$95$1, N[((-F) * N[(-1.0 / N[(B * F), $MachinePrecision]), $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \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)}\\
t_1 := {\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot \frac{F}{B} - \frac{x}{\tan B}\\
\mathbf{if}\;t\_0 \leq -50000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 10:\\
\;\;\;\;\frac{F}{\sin B \cdot \sqrt{2 + {F}^{2}}}\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+225}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-F, \frac{-1}{B \cdot F}, \frac{-x}{\tan B}\right)\\
\end{array}
\end{array}
if (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) < -5e4 or 10 < (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) < 4.99999999999999981e225Initial program 76.6%
Taylor expanded in B around 0
lower-/.f6462.2
Applied rewrites62.2%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
mult-flip-revN/A
distribute-frac-negN/A
lift-neg.f64N/A
lift-/.f64N/A
lower--.f64N/A
Applied rewrites62.3%
if -5e4 < (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) < 10Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites84.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-+.f64N/A
metadata-evalN/A
metadata-evalN/A
lift-/.f64N/A
lift-neg.f64N/A
mul-1-negN/A
lower-neg.f6484.9
Applied rewrites84.9%
Applied rewrites84.9%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-pow.f6430.2
Applied rewrites30.2%
if 4.99999999999999981e225 < (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites84.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-+.f64N/A
metadata-evalN/A
metadata-evalN/A
lift-/.f64N/A
lift-neg.f64N/A
mul-1-negN/A
lower-neg.f6484.9
Applied rewrites84.9%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f64N/A
metadata-evalN/A
metadata-eval70.5
Applied rewrites70.5%
Taylor expanded in F around inf
lower-/.f64N/A
lower-*.f6450.6
Applied rewrites50.6%
(FPCore (F B x)
:precision binary64
(let* ((t_0
(+
(- (* x (/ 1.0 (tan B))))
(*
(/ F (sin B))
(pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))
(t_1
(-
(* (/ F B) (/ 1.0 (sqrt (fma x 2.0 (fma F F 2.0)))))
(/ x (tan B)))))
(if (<= t_0 -50000.0)
t_1
(if (<= t_0 10.0)
(/ F (* (sin B) (sqrt (+ 2.0 (pow F 2.0)))))
(if (<= t_0 5e+225)
t_1
(fma (- F) (/ -1.0 (* B F)) (/ (- x) (tan B))))))))
double code(double F, double B, double x) {
double t_0 = -(x * (1.0 / tan(B))) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
double t_1 = ((F / B) * (1.0 / sqrt(fma(x, 2.0, fma(F, F, 2.0))))) - (x / tan(B));
double tmp;
if (t_0 <= -50000.0) {
tmp = t_1;
} else if (t_0 <= 10.0) {
tmp = F / (sin(B) * sqrt((2.0 + pow(F, 2.0))));
} else if (t_0 <= 5e+225) {
tmp = t_1;
} else {
tmp = fma(-F, (-1.0 / (B * F)), (-x / tan(B)));
}
return tmp;
}
function code(F, B, x) t_0 = 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))))) t_1 = Float64(Float64(Float64(F / B) * Float64(1.0 / sqrt(fma(x, 2.0, fma(F, F, 2.0))))) - Float64(x / tan(B))) tmp = 0.0 if (t_0 <= -50000.0) tmp = t_1; elseif (t_0 <= 10.0) tmp = Float64(F / Float64(sin(B) * sqrt(Float64(2.0 + (F ^ 2.0))))); elseif (t_0 <= 5e+225) tmp = t_1; else tmp = fma(Float64(-F), Float64(-1.0 / Float64(B * F)), Float64(Float64(-x) / tan(B))); 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[(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]}, Block[{t$95$1 = N[(N[(N[(F / B), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -50000.0], t$95$1, If[LessEqual[t$95$0, 10.0], N[(F / N[(N[Sin[B], $MachinePrecision] * N[Sqrt[N[(2.0 + N[Power[F, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+225], t$95$1, N[((-F) * N[(-1.0 / N[(B * F), $MachinePrecision]), $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \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)}\\
t_1 := \frac{F}{B} \cdot \frac{1}{\sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}} - \frac{x}{\tan B}\\
\mathbf{if}\;t\_0 \leq -50000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 10:\\
\;\;\;\;\frac{F}{\sin B \cdot \sqrt{2 + {F}^{2}}}\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+225}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-F, \frac{-1}{B \cdot F}, \frac{-x}{\tan B}\right)\\
\end{array}
\end{array}
if (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) < -5e4 or 10 < (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) < 4.99999999999999981e225Initial program 76.6%
Taylor expanded in B around 0
lower-/.f6462.2
Applied rewrites62.2%
lift-+.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lift-/.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
lower-/.f6462.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.2
Applied rewrites62.2%
Applied rewrites62.3%
if -5e4 < (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) < 10Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites84.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-+.f64N/A
metadata-evalN/A
metadata-evalN/A
lift-/.f64N/A
lift-neg.f64N/A
mul-1-negN/A
lower-neg.f6484.9
Applied rewrites84.9%
Applied rewrites84.9%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-pow.f6430.2
Applied rewrites30.2%
if 4.99999999999999981e225 < (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites84.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-+.f64N/A
metadata-evalN/A
metadata-evalN/A
lift-/.f64N/A
lift-neg.f64N/A
mul-1-negN/A
lower-neg.f6484.9
Applied rewrites84.9%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f64N/A
metadata-evalN/A
metadata-eval70.5
Applied rewrites70.5%
Taylor expanded in F around inf
lower-/.f64N/A
lower-*.f6450.6
Applied rewrites50.6%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (fma (/ 1.0 B) -1.0 (/ (- x) (tan B)))))
(if (<= x -4.3e-35)
t_0
(if (<= x 2.05e-84) (/ F (* (sin B) (sqrt (+ 2.0 (pow F 2.0))))) t_0))))
double code(double F, double B, double x) {
double t_0 = fma((1.0 / B), -1.0, (-x / tan(B)));
double tmp;
if (x <= -4.3e-35) {
tmp = t_0;
} else if (x <= 2.05e-84) {
tmp = F / (sin(B) * sqrt((2.0 + pow(F, 2.0))));
} else {
tmp = t_0;
}
return tmp;
}
function code(F, B, x) t_0 = fma(Float64(1.0 / B), -1.0, Float64(Float64(-x) / tan(B))) tmp = 0.0 if (x <= -4.3e-35) tmp = t_0; elseif (x <= 2.05e-84) tmp = Float64(F / Float64(sin(B) * sqrt(Float64(2.0 + (F ^ 2.0))))); else tmp = t_0; end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[(1.0 / B), $MachinePrecision] * -1.0 + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4.3e-35], t$95$0, If[LessEqual[x, 2.05e-84], N[(F / N[(N[Sin[B], $MachinePrecision] * N[Sqrt[N[(2.0 + N[Power[F, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\frac{1}{B}, -1, \frac{-x}{\tan B}\right)\\
\mathbf{if}\;x \leq -4.3 \cdot 10^{-35}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 2.05 \cdot 10^{-84}:\\
\;\;\;\;\frac{F}{\sin B \cdot \sqrt{2 + {F}^{2}}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -4.3000000000000002e-35 or 2.05000000000000003e-84 < x Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites85.0%
Taylor expanded in F around -inf
Applied rewrites56.5%
Taylor expanded in B around 0
lower-/.f6454.0
Applied rewrites54.0%
if -4.3000000000000002e-35 < x < 2.05000000000000003e-84Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites84.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-+.f64N/A
metadata-evalN/A
metadata-evalN/A
lift-/.f64N/A
lift-neg.f64N/A
mul-1-negN/A
lower-neg.f6484.9
Applied rewrites84.9%
Applied rewrites84.9%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-pow.f6430.2
Applied rewrites30.2%
(FPCore (F B x) :precision binary64 (if (<= B 2.65) (/ (fma -1.0 x (/ F (sqrt (+ 2.0 (fma 2.0 x (pow F 2.0)))))) B) (fma (/ 1.0 B) -1.0 (/ (- x) (tan B)))))
double code(double F, double B, double x) {
double tmp;
if (B <= 2.65) {
tmp = fma(-1.0, x, (F / sqrt((2.0 + fma(2.0, x, pow(F, 2.0)))))) / B;
} else {
tmp = fma((1.0 / B), -1.0, (-x / tan(B)));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (B <= 2.65) tmp = Float64(fma(-1.0, x, Float64(F / sqrt(Float64(2.0 + fma(2.0, x, (F ^ 2.0)))))) / B); else tmp = fma(Float64(1.0 / B), -1.0, Float64(Float64(-x) / tan(B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[B, 2.65], N[(N[(-1.0 * x + N[(F / N[Sqrt[N[(2.0 + N[(2.0 * x + N[Power[F, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 / B), $MachinePrecision] * -1.0 + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 2.65:\\
\;\;\;\;\frac{\mathsf{fma}\left(-1, x, \frac{F}{\sqrt{2 + \mathsf{fma}\left(2, x, {F}^{2}\right)}}\right)}{B}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{B}, -1, \frac{-x}{\tan B}\right)\\
\end{array}
\end{array}
if B < 2.64999999999999991Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites84.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-+.f64N/A
metadata-evalN/A
metadata-evalN/A
lift-/.f64N/A
lift-neg.f64N/A
mul-1-negN/A
lower-neg.f6484.9
Applied rewrites84.9%
Applied rewrites84.9%
Taylor expanded in B around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6444.4
Applied rewrites44.4%
if 2.64999999999999991 < B Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites85.0%
Taylor expanded in F around -inf
Applied rewrites56.5%
Taylor expanded in B around 0
lower-/.f6454.0
Applied rewrites54.0%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ 1.0 (sin B))))
(if (<= F -2.7e+20)
(fma t_0 -1.0 (* -1.0 (/ x B)))
(if (<= F 2.2e+31)
(/ (fma -1.0 x (/ F (sqrt (+ 2.0 (fma 2.0 x (pow F 2.0)))))) B)
t_0))))
double code(double F, double B, double x) {
double t_0 = 1.0 / sin(B);
double tmp;
if (F <= -2.7e+20) {
tmp = fma(t_0, -1.0, (-1.0 * (x / B)));
} else if (F <= 2.2e+31) {
tmp = fma(-1.0, x, (F / sqrt((2.0 + fma(2.0, x, pow(F, 2.0)))))) / B;
} else {
tmp = t_0;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(1.0 / sin(B)) tmp = 0.0 if (F <= -2.7e+20) tmp = fma(t_0, -1.0, Float64(-1.0 * Float64(x / B))); elseif (F <= 2.2e+31) tmp = Float64(fma(-1.0, x, Float64(F / sqrt(Float64(2.0 + fma(2.0, x, (F ^ 2.0)))))) / B); else tmp = t_0; end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -2.7e+20], N[(t$95$0 * -1.0 + N[(-1.0 * N[(x / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 2.2e+31], N[(N[(-1.0 * x + N[(F / N[Sqrt[N[(2.0 + N[(2.0 * x + N[Power[F, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\sin B}\\
\mathbf{if}\;F \leq -2.7 \cdot 10^{+20}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, -1, -1 \cdot \frac{x}{B}\right)\\
\mathbf{elif}\;F \leq 2.2 \cdot 10^{+31}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-1, x, \frac{F}{\sqrt{2 + \mathsf{fma}\left(2, x, {F}^{2}\right)}}\right)}{B}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if F < -2.7e20Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites85.0%
Taylor expanded in F around -inf
Applied rewrites56.5%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f6437.0
Applied rewrites37.0%
if -2.7e20 < F < 2.2000000000000001e31Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites84.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-+.f64N/A
metadata-evalN/A
metadata-evalN/A
lift-/.f64N/A
lift-neg.f64N/A
mul-1-negN/A
lower-neg.f6484.9
Applied rewrites84.9%
Applied rewrites84.9%
Taylor expanded in B around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6444.4
Applied rewrites44.4%
if 2.2000000000000001e31 < F Initial program 76.6%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6416.9
Applied rewrites16.9%
(FPCore (F B x) :precision binary64 (if (<= B 0.98) (/ (fma -1.0 x (/ F (sqrt (+ 2.0 (fma 2.0 x (pow F 2.0)))))) B) (/ 1.0 (sin B))))
double code(double F, double B, double x) {
double tmp;
if (B <= 0.98) {
tmp = fma(-1.0, x, (F / sqrt((2.0 + fma(2.0, x, pow(F, 2.0)))))) / B;
} else {
tmp = 1.0 / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (B <= 0.98) tmp = Float64(fma(-1.0, x, Float64(F / sqrt(Float64(2.0 + fma(2.0, x, (F ^ 2.0)))))) / B); else tmp = Float64(1.0 / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[B, 0.98], N[(N[(-1.0 * x + N[(F / N[Sqrt[N[(2.0 + N[(2.0 * x + N[Power[F, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 0.98:\\
\;\;\;\;\frac{\mathsf{fma}\left(-1, x, \frac{F}{\sqrt{2 + \mathsf{fma}\left(2, x, {F}^{2}\right)}}\right)}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\
\end{array}
\end{array}
if B < 0.97999999999999998Initial program 76.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites84.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-+.f64N/A
metadata-evalN/A
metadata-evalN/A
lift-/.f64N/A
lift-neg.f64N/A
mul-1-negN/A
lower-neg.f6484.9
Applied rewrites84.9%
Applied rewrites84.9%
Taylor expanded in B around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6444.4
Applied rewrites44.4%
if 0.97999999999999998 < B Initial program 76.6%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6416.9
Applied rewrites16.9%
(FPCore (F B x)
:precision binary64
(if (<= F -2.95e+20)
(/ -1.0 (sin B))
(if (<= F 3300000000.0)
(fma (/ -1.0 F) (/ F B) (/ (- (* (* (* B B) x) 0.3333333333333333) x) B))
(/ 1.0 (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -2.95e+20) {
tmp = -1.0 / sin(B);
} else if (F <= 3300000000.0) {
tmp = fma((-1.0 / F), (F / B), (((((B * B) * x) * 0.3333333333333333) - x) / B));
} else {
tmp = 1.0 / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -2.95e+20) tmp = Float64(-1.0 / sin(B)); elseif (F <= 3300000000.0) tmp = fma(Float64(-1.0 / F), Float64(F / B), Float64(Float64(Float64(Float64(Float64(B * B) * x) * 0.3333333333333333) - x) / B)); else tmp = Float64(1.0 / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -2.95e+20], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 3300000000.0], N[(N[(-1.0 / F), $MachinePrecision] * N[(F / B), $MachinePrecision] + N[(N[(N[(N[(N[(B * B), $MachinePrecision] * x), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -2.95 \cdot 10^{+20}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 3300000000:\\
\;\;\;\;\mathsf{fma}\left(\frac{-1}{F}, \frac{F}{B}, \frac{\left(\left(B \cdot B\right) \cdot x\right) \cdot 0.3333333333333333 - x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -2.95e20Initial program 76.6%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.2
Applied rewrites17.2%
if -2.95e20 < F < 3.3e9Initial program 76.6%
Taylor expanded in B around 0
lower-/.f6462.2
Applied rewrites62.2%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-pow.f6436.0
Applied rewrites36.0%
Applied rewrites36.0%
Taylor expanded in F around -inf
lower-/.f6422.4
Applied rewrites22.4%
if 3.3e9 < F Initial program 76.6%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6416.9
Applied rewrites16.9%
(FPCore (F B x) :precision binary64 (if (<= F -2.7e+20) (/ -1.0 (sin B)) (fma (/ 1.0 F) (/ F B) (/ (- (* (* (* B B) x) 0.3333333333333333) x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -2.7e+20) {
tmp = -1.0 / sin(B);
} else {
tmp = fma((1.0 / F), (F / B), (((((B * B) * x) * 0.3333333333333333) - x) / B));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -2.7e+20) tmp = Float64(-1.0 / sin(B)); else tmp = fma(Float64(1.0 / F), Float64(F / B), Float64(Float64(Float64(Float64(Float64(B * B) * x) * 0.3333333333333333) - x) / B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -2.7e+20], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / F), $MachinePrecision] * N[(F / B), $MachinePrecision] + N[(N[(N[(N[(N[(B * B), $MachinePrecision] * x), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -2.7 \cdot 10^{+20}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{F}, \frac{F}{B}, \frac{\left(\left(B \cdot B\right) \cdot x\right) \cdot 0.3333333333333333 - x}{B}\right)\\
\end{array}
\end{array}
if F < -2.7e20Initial program 76.6%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.2
Applied rewrites17.2%
if -2.7e20 < F Initial program 76.6%
Taylor expanded in B around 0
lower-/.f6462.2
Applied rewrites62.2%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-pow.f6436.0
Applied rewrites36.0%
Applied rewrites36.0%
Taylor expanded in F around inf
lower-/.f6421.5
Applied rewrites21.5%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- (* (* (* B B) x) 0.3333333333333333) x) B)))
(if (<= F -8.5e-263)
(fma (/ -1.0 F) (/ F B) t_0)
(fma (/ 1.0 F) (/ F B) t_0))))
double code(double F, double B, double x) {
double t_0 = ((((B * B) * x) * 0.3333333333333333) - x) / B;
double tmp;
if (F <= -8.5e-263) {
tmp = fma((-1.0 / F), (F / B), t_0);
} else {
tmp = fma((1.0 / F), (F / B), t_0);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(Float64(Float64(Float64(B * B) * x) * 0.3333333333333333) - x) / B) tmp = 0.0 if (F <= -8.5e-263) tmp = fma(Float64(-1.0 / F), Float64(F / B), t_0); else tmp = fma(Float64(1.0 / F), Float64(F / B), t_0); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[(N[(N[(N[(B * B), $MachinePrecision] * x), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]}, If[LessEqual[F, -8.5e-263], N[(N[(-1.0 / F), $MachinePrecision] * N[(F / B), $MachinePrecision] + t$95$0), $MachinePrecision], N[(N[(1.0 / F), $MachinePrecision] * N[(F / B), $MachinePrecision] + t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\left(\left(B \cdot B\right) \cdot x\right) \cdot 0.3333333333333333 - x}{B}\\
\mathbf{if}\;F \leq -8.5 \cdot 10^{-263}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-1}{F}, \frac{F}{B}, t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{F}, \frac{F}{B}, t\_0\right)\\
\end{array}
\end{array}
if F < -8.49999999999999975e-263Initial program 76.6%
Taylor expanded in B around 0
lower-/.f6462.2
Applied rewrites62.2%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-pow.f6436.0
Applied rewrites36.0%
Applied rewrites36.0%
Taylor expanded in F around -inf
lower-/.f6422.4
Applied rewrites22.4%
if -8.49999999999999975e-263 < F Initial program 76.6%
Taylor expanded in B around 0
lower-/.f6462.2
Applied rewrites62.2%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-pow.f6436.0
Applied rewrites36.0%
Applied rewrites36.0%
Taylor expanded in F around inf
lower-/.f6421.5
Applied rewrites21.5%
(FPCore (F B x) :precision binary64 (fma (/ -1.0 F) (/ F B) (/ (- (* (* (* B B) x) 0.3333333333333333) x) B)))
double code(double F, double B, double x) {
return fma((-1.0 / F), (F / B), (((((B * B) * x) * 0.3333333333333333) - x) / B));
}
function code(F, B, x) return fma(Float64(-1.0 / F), Float64(F / B), Float64(Float64(Float64(Float64(Float64(B * B) * x) * 0.3333333333333333) - x) / B)) end
code[F_, B_, x_] := N[(N[(-1.0 / F), $MachinePrecision] * N[(F / B), $MachinePrecision] + N[(N[(N[(N[(N[(B * B), $MachinePrecision] * x), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{-1}{F}, \frac{F}{B}, \frac{\left(\left(B \cdot B\right) \cdot x\right) \cdot 0.3333333333333333 - x}{B}\right)
\end{array}
Initial program 76.6%
Taylor expanded in B around 0
lower-/.f6462.2
Applied rewrites62.2%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-pow.f6436.0
Applied rewrites36.0%
Applied rewrites36.0%
Taylor expanded in F around -inf
lower-/.f6422.4
Applied rewrites22.4%
(FPCore (F B x) :precision binary64 (/ -1.0 B))
double code(double F, double B, double x) {
return -1.0 / 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 = (-1.0d0) / b
end function
public static double code(double F, double B, double x) {
return -1.0 / B;
}
def code(F, B, x): return -1.0 / B
function code(F, B, x) return Float64(-1.0 / B) end
function tmp = code(F, B, x) tmp = -1.0 / B; end
code[F_, B_, x_] := N[(-1.0 / B), $MachinePrecision]
\begin{array}{l}
\\
\frac{-1}{B}
\end{array}
Initial program 76.6%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.2
Applied rewrites17.2%
Taylor expanded in B around 0
Applied rewrites10.3%
herbie shell --seed 2025154
(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))))))