
(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}
Sampling outcomes in binary64 precision:
Herbie found 23 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (F B x) :precision binary64 (+ (- (* x (/ 1.0 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))
double code(double F, double B, double x) {
return -(x * (1.0 / tan(B))) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = -(x * (1.0d0 / tan(b))) + ((f / sin(b)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
end function
public static double code(double F, double B, double x) {
return -(x * (1.0 / Math.tan(B))) + ((F / Math.sin(B)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
def code(F, B, x): return -(x * (1.0 / math.tan(B))) + ((F / math.sin(B)) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)))
function code(F, B, x) return Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))) end
function tmp = code(F, B, x) tmp = -(x * (1.0 / tan(B))) + ((F / sin(B)) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); end
code[F_, B_, x_] := N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], (-N[(1.0 / 2.0), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\end{array}
(FPCore (F B x)
:precision binary64
(if (<= F -1.4e+43)
(/ (- (fma (cos B) x 1.0)) (sin B))
(if (<= F 35000.0)
(fma F (/ (pow (fma 2.0 x (fma F F 2.0)) -0.5) (sin B)) (/ (- x) (tan B)))
(+ (* x (/ -1.0 (tan B))) (pow (sin B) -1.0)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.4e+43) {
tmp = -fma(cos(B), x, 1.0) / sin(B);
} else if (F <= 35000.0) {
tmp = fma(F, (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) / sin(B)), (-x / tan(B)));
} else {
tmp = (x * (-1.0 / tan(B))) + pow(sin(B), -1.0);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.4e+43) tmp = Float64(Float64(-fma(cos(B), x, 1.0)) / sin(B)); elseif (F <= 35000.0) tmp = fma(F, Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) / sin(B)), Float64(Float64(-x) / tan(B))); else tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + (sin(B) ^ -1.0)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.4e+43], N[((-N[(N[Cos[B], $MachinePrecision] * x + 1.0), $MachinePrecision]) / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 35000.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) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[N[Sin[B], $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.4 \cdot 10^{+43}:\\
\;\;\;\;\frac{-\mathsf{fma}\left(\cos B, x, 1\right)}{\sin B}\\
\mathbf{elif}\;F \leq 35000:\\
\;\;\;\;\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}{\tan B}\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + {\sin B}^{-1}\\
\end{array}
\end{array}
if F < -1.40000000000000009e43Initial program 54.9%
Taylor expanded in F around -inf
mul-1-negN/A
div-add-revN/A
distribute-neg-fracN/A
lower-/.f64N/A
lower-neg.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-sin.f6499.8
Applied rewrites99.8%
if -1.40000000000000009e43 < F < 35000Initial program 98.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites99.6%
if 35000 < F Initial program 52.8%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6499.8
Applied rewrites99.8%
Final simplification99.7%
(FPCore (F B x)
:precision binary64
(if (<= F -5e+50)
(/ (- (fma (cos B) x 1.0)) (sin B))
(if (<= F 35000.0)
(fma
F
(pow (* (sin B) (sqrt (fma 2.0 x (fma F F 2.0)))) -1.0)
(/ (- x) (tan B)))
(+ (* x (/ -1.0 (tan B))) (pow (sin B) -1.0)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -5e+50) {
tmp = -fma(cos(B), x, 1.0) / sin(B);
} else if (F <= 35000.0) {
tmp = fma(F, pow((sin(B) * sqrt(fma(2.0, x, fma(F, F, 2.0)))), -1.0), (-x / tan(B)));
} else {
tmp = (x * (-1.0 / tan(B))) + pow(sin(B), -1.0);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -5e+50) tmp = Float64(Float64(-fma(cos(B), x, 1.0)) / sin(B)); elseif (F <= 35000.0) tmp = fma(F, (Float64(sin(B) * sqrt(fma(2.0, x, fma(F, F, 2.0)))) ^ -1.0), Float64(Float64(-x) / tan(B))); else tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + (sin(B) ^ -1.0)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -5e+50], N[((-N[(N[Cos[B], $MachinePrecision] * x + 1.0), $MachinePrecision]) / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 35000.0], N[(F * N[Power[N[(N[Sin[B], $MachinePrecision] * N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[N[Sin[B], $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -5 \cdot 10^{+50}:\\
\;\;\;\;\frac{-\mathsf{fma}\left(\cos B, x, 1\right)}{\sin B}\\
\mathbf{elif}\;F \leq 35000:\\
\;\;\;\;\mathsf{fma}\left(F, {\left(\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}\right)}^{-1}, \frac{-x}{\tan B}\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + {\sin B}^{-1}\\
\end{array}
\end{array}
if F < -5e50Initial program 54.0%
Taylor expanded in F around -inf
mul-1-negN/A
div-add-revN/A
distribute-neg-fracN/A
lower-/.f64N/A
lower-neg.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-sin.f6499.8
Applied rewrites99.8%
if -5e50 < F < 35000Initial program 98.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites99.6%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow2N/A
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+r+N/A
+-commutativeN/A
Applied rewrites99.5%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6499.6
lift-fma.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-fma.f6499.6
Applied rewrites99.6%
if 35000 < F Initial program 52.8%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6499.8
Applied rewrites99.8%
Final simplification99.7%
(FPCore (F B x)
:precision binary64
(if (<= F -0.00043)
(/ (- (fma (cos B) x 1.0)) (sin B))
(if (<= F 1.7)
(fma F (pow (* (sin B) (sqrt (fma 2.0 x 2.0))) -1.0) (/ (- x) (tan B)))
(+ (* x (/ -1.0 (tan B))) (pow (sin B) -1.0)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -0.00043) {
tmp = -fma(cos(B), x, 1.0) / sin(B);
} else if (F <= 1.7) {
tmp = fma(F, pow((sin(B) * sqrt(fma(2.0, x, 2.0))), -1.0), (-x / tan(B)));
} else {
tmp = (x * (-1.0 / tan(B))) + pow(sin(B), -1.0);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -0.00043) tmp = Float64(Float64(-fma(cos(B), x, 1.0)) / sin(B)); elseif (F <= 1.7) tmp = fma(F, (Float64(sin(B) * sqrt(fma(2.0, x, 2.0))) ^ -1.0), Float64(Float64(-x) / tan(B))); else tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + (sin(B) ^ -1.0)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -0.00043], N[((-N[(N[Cos[B], $MachinePrecision] * x + 1.0), $MachinePrecision]) / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.7], N[(F * N[Power[N[(N[Sin[B], $MachinePrecision] * N[Sqrt[N[(2.0 * x + 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[N[Sin[B], $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -0.00043:\\
\;\;\;\;\frac{-\mathsf{fma}\left(\cos B, x, 1\right)}{\sin B}\\
\mathbf{elif}\;F \leq 1.7:\\
\;\;\;\;\mathsf{fma}\left(F, {\left(\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, 2\right)}\right)}^{-1}, \frac{-x}{\tan B}\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + {\sin B}^{-1}\\
\end{array}
\end{array}
if F < -4.29999999999999989e-4Initial program 58.0%
Taylor expanded in F around -inf
mul-1-negN/A
div-add-revN/A
distribute-neg-fracN/A
lower-/.f64N/A
lower-neg.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-sin.f6499.8
Applied rewrites99.8%
if -4.29999999999999989e-4 < F < 1.69999999999999996Initial program 99.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites99.6%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow2N/A
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+r+N/A
+-commutativeN/A
Applied rewrites99.5%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6499.6
lift-fma.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-fma.f6499.6
Applied rewrites99.6%
Taylor expanded in F around 0
Applied rewrites99.6%
if 1.69999999999999996 < F Initial program 53.3%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6499.2
Applied rewrites99.2%
Final simplification99.5%
(FPCore (F B x)
:precision binary64
(if (<= F -3.6e-17)
(/ (- (fma (cos B) x 1.0)) (sin B))
(if (<= F 5.7e-121)
(fma
F
(pow (* (sqrt (+ (fma 2.0 x (* F F)) 2.0)) B) -1.0)
(/ (- x) (tan B)))
(if (<= F 30000.0)
(-
(/ (/ F (sin B)) (sqrt (fma x 2.0 (fma F F 2.0))))
(/ x (* (fma (* B B) 0.3333333333333333 1.0) B)))
(+ (* x (/ -1.0 (tan B))) (pow (sin B) -1.0))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.6e-17) {
tmp = -fma(cos(B), x, 1.0) / sin(B);
} else if (F <= 5.7e-121) {
tmp = fma(F, pow((sqrt((fma(2.0, x, (F * F)) + 2.0)) * B), -1.0), (-x / tan(B)));
} else if (F <= 30000.0) {
tmp = ((F / sin(B)) / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) - (x / (fma((B * B), 0.3333333333333333, 1.0) * B));
} else {
tmp = (x * (-1.0 / tan(B))) + pow(sin(B), -1.0);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -3.6e-17) tmp = Float64(Float64(-fma(cos(B), x, 1.0)) / sin(B)); elseif (F <= 5.7e-121) tmp = fma(F, (Float64(sqrt(Float64(fma(2.0, x, Float64(F * F)) + 2.0)) * B) ^ -1.0), Float64(Float64(-x) / tan(B))); elseif (F <= 30000.0) tmp = Float64(Float64(Float64(F / sin(B)) / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) - Float64(x / Float64(fma(Float64(B * B), 0.3333333333333333, 1.0) * B))); else tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + (sin(B) ^ -1.0)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -3.6e-17], N[((-N[(N[Cos[B], $MachinePrecision] * x + 1.0), $MachinePrecision]) / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 5.7e-121], N[(F * N[Power[N[(N[Sqrt[N[(N[(2.0 * x + N[(F * F), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]], $MachinePrecision] * B), $MachinePrecision], -1.0], $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 30000.0], N[(N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(x / N[(N[(N[(B * B), $MachinePrecision] * 0.3333333333333333 + 1.0), $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[N[Sin[B], $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.6 \cdot 10^{-17}:\\
\;\;\;\;\frac{-\mathsf{fma}\left(\cos B, x, 1\right)}{\sin B}\\
\mathbf{elif}\;F \leq 5.7 \cdot 10^{-121}:\\
\;\;\;\;\mathsf{fma}\left(F, {\left(\sqrt{\mathsf{fma}\left(2, x, F \cdot F\right) + 2} \cdot B\right)}^{-1}, \frac{-x}{\tan B}\right)\\
\mathbf{elif}\;F \leq 30000:\\
\;\;\;\;\frac{\frac{F}{\sin B}}{\sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}} - \frac{x}{\mathsf{fma}\left(B \cdot B, 0.3333333333333333, 1\right) \cdot B}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + {\sin B}^{-1}\\
\end{array}
\end{array}
if F < -3.59999999999999995e-17Initial program 59.5%
Taylor expanded in F around -inf
mul-1-negN/A
div-add-revN/A
distribute-neg-fracN/A
lower-/.f64N/A
lower-neg.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-sin.f6498.2
Applied rewrites98.2%
if -3.59999999999999995e-17 < F < 5.70000000000000014e-121Initial program 99.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites99.7%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow2N/A
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+r+N/A
+-commutativeN/A
Applied rewrites99.7%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6499.7
lift-fma.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-fma.f6499.7
Applied rewrites99.7%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6486.8
Applied rewrites86.8%
if 5.70000000000000014e-121 < F < 3e4Initial program 99.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites99.4%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow2N/A
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+r+N/A
+-commutativeN/A
Applied rewrites99.1%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6484.2
Applied rewrites84.2%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lift-fma.f64N/A
*-commutativeN/A
lift-fma.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f6484.4
lower-fma.f64N/A
lower-+.f64N/A
Applied rewrites84.5%
if 3e4 < F Initial program 52.8%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6499.8
Applied rewrites99.8%
Final simplification93.2%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (* (fma 0.3333333333333333 (* B B) 1.0) B))))
(if (<= F -7.5e+52)
(fma F (/ -1.0 (* (sin B) F)) t_0)
(if (<= F 5.7e-121)
(fma
F
(pow (* (sqrt (+ (fma 2.0 x (* F F)) 2.0)) B) -1.0)
(/ (- x) (tan B)))
(if (<= F 7.2e+48)
(fma F (pow (* (sin B) (sqrt (fma 2.0 x (fma F F 2.0)))) -1.0) t_0)
(fma F (/ (pow F -1.0) (sin B)) t_0))))))
double code(double F, double B, double x) {
double t_0 = -x / (fma(0.3333333333333333, (B * B), 1.0) * B);
double tmp;
if (F <= -7.5e+52) {
tmp = fma(F, (-1.0 / (sin(B) * F)), t_0);
} else if (F <= 5.7e-121) {
tmp = fma(F, pow((sqrt((fma(2.0, x, (F * F)) + 2.0)) * B), -1.0), (-x / tan(B)));
} else if (F <= 7.2e+48) {
tmp = fma(F, pow((sin(B) * sqrt(fma(2.0, x, fma(F, F, 2.0)))), -1.0), t_0);
} else {
tmp = fma(F, (pow(F, -1.0) / sin(B)), t_0);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-x) / Float64(fma(0.3333333333333333, Float64(B * B), 1.0) * B)) tmp = 0.0 if (F <= -7.5e+52) tmp = fma(F, Float64(-1.0 / Float64(sin(B) * F)), t_0); elseif (F <= 5.7e-121) tmp = fma(F, (Float64(sqrt(Float64(fma(2.0, x, Float64(F * F)) + 2.0)) * B) ^ -1.0), Float64(Float64(-x) / tan(B))); elseif (F <= 7.2e+48) tmp = fma(F, (Float64(sin(B) * sqrt(fma(2.0, x, fma(F, F, 2.0)))) ^ -1.0), t_0); else tmp = fma(F, Float64((F ^ -1.0) / sin(B)), t_0); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[(N[(0.3333333333333333 * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -7.5e+52], N[(F * N[(-1.0 / N[(N[Sin[B], $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], If[LessEqual[F, 5.7e-121], N[(F * N[Power[N[(N[Sqrt[N[(N[(2.0 * x + N[(F * F), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]], $MachinePrecision] * B), $MachinePrecision], -1.0], $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 7.2e+48], N[(F * N[Power[N[(N[Sin[B], $MachinePrecision] * N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision] + t$95$0), $MachinePrecision], N[(F * N[(N[Power[F, -1.0], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\mathsf{fma}\left(0.3333333333333333, B \cdot B, 1\right) \cdot B}\\
\mathbf{if}\;F \leq -7.5 \cdot 10^{+52}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{-1}{\sin B \cdot F}, t\_0\right)\\
\mathbf{elif}\;F \leq 5.7 \cdot 10^{-121}:\\
\;\;\;\;\mathsf{fma}\left(F, {\left(\sqrt{\mathsf{fma}\left(2, x, F \cdot F\right) + 2} \cdot B\right)}^{-1}, \frac{-x}{\tan B}\right)\\
\mathbf{elif}\;F \leq 7.2 \cdot 10^{+48}:\\
\;\;\;\;\mathsf{fma}\left(F, {\left(\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}\right)}^{-1}, t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{{F}^{-1}}{\sin B}, t\_0\right)\\
\end{array}
\end{array}
if F < -7.49999999999999995e52Initial program 52.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites65.3%
Taylor expanded in F around -inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6499.6
Applied rewrites99.6%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6479.1
Applied rewrites79.1%
if -7.49999999999999995e52 < F < 5.70000000000000014e-121Initial program 98.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites99.6%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow2N/A
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+r+N/A
+-commutativeN/A
Applied rewrites99.6%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6499.7
lift-fma.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-fma.f6499.7
Applied rewrites99.7%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6486.3
Applied rewrites86.3%
if 5.70000000000000014e-121 < F < 7.19999999999999967e48Initial program 99.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites99.4%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow2N/A
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+r+N/A
+-commutativeN/A
Applied rewrites99.1%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6499.4
lift-fma.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-fma.f6499.4
Applied rewrites99.4%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6482.2
Applied rewrites82.2%
if 7.19999999999999967e48 < F Initial program 48.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites64.3%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow2N/A
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+r+N/A
+-commutativeN/A
Applied rewrites64.3%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6448.9
Applied rewrites48.9%
Taylor expanded in F around inf
lower-/.f6483.2
Applied rewrites83.2%
Final simplification83.4%
(FPCore (F B x)
:precision binary64
(if (<= F -3.6e-17)
(/ (- (fma (cos B) x 1.0)) (sin B))
(if (<= F 5.7e-121)
(fma
F
(pow (* (sqrt (+ (fma 2.0 x (* F F)) 2.0)) B) -1.0)
(/ (- x) (tan B)))
(if (<= F 1.15e+49)
(-
(/ (/ F (sin B)) (sqrt (fma x 2.0 (fma F F 2.0))))
(/ x (* (fma (* B B) 0.3333333333333333 1.0) B)))
(fma
F
(/ (pow F -1.0) (sin B))
(/ (- x) (* (fma 0.3333333333333333 (* B B) 1.0) B)))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.6e-17) {
tmp = -fma(cos(B), x, 1.0) / sin(B);
} else if (F <= 5.7e-121) {
tmp = fma(F, pow((sqrt((fma(2.0, x, (F * F)) + 2.0)) * B), -1.0), (-x / tan(B)));
} else if (F <= 1.15e+49) {
tmp = ((F / sin(B)) / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) - (x / (fma((B * B), 0.3333333333333333, 1.0) * B));
} else {
tmp = fma(F, (pow(F, -1.0) / sin(B)), (-x / (fma(0.3333333333333333, (B * B), 1.0) * B)));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -3.6e-17) tmp = Float64(Float64(-fma(cos(B), x, 1.0)) / sin(B)); elseif (F <= 5.7e-121) tmp = fma(F, (Float64(sqrt(Float64(fma(2.0, x, Float64(F * F)) + 2.0)) * B) ^ -1.0), Float64(Float64(-x) / tan(B))); elseif (F <= 1.15e+49) tmp = Float64(Float64(Float64(F / sin(B)) / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) - Float64(x / Float64(fma(Float64(B * B), 0.3333333333333333, 1.0) * B))); else tmp = fma(F, Float64((F ^ -1.0) / sin(B)), Float64(Float64(-x) / Float64(fma(0.3333333333333333, Float64(B * B), 1.0) * B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -3.6e-17], N[((-N[(N[Cos[B], $MachinePrecision] * x + 1.0), $MachinePrecision]) / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 5.7e-121], N[(F * N[Power[N[(N[Sqrt[N[(N[(2.0 * x + N[(F * F), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]], $MachinePrecision] * B), $MachinePrecision], -1.0], $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.15e+49], N[(N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(x / N[(N[(N[(B * B), $MachinePrecision] * 0.3333333333333333 + 1.0), $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(F * N[(N[Power[F, -1.0], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + N[((-x) / N[(N[(0.3333333333333333 * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.6 \cdot 10^{-17}:\\
\;\;\;\;\frac{-\mathsf{fma}\left(\cos B, x, 1\right)}{\sin B}\\
\mathbf{elif}\;F \leq 5.7 \cdot 10^{-121}:\\
\;\;\;\;\mathsf{fma}\left(F, {\left(\sqrt{\mathsf{fma}\left(2, x, F \cdot F\right) + 2} \cdot B\right)}^{-1}, \frac{-x}{\tan B}\right)\\
\mathbf{elif}\;F \leq 1.15 \cdot 10^{+49}:\\
\;\;\;\;\frac{\frac{F}{\sin B}}{\sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}} - \frac{x}{\mathsf{fma}\left(B \cdot B, 0.3333333333333333, 1\right) \cdot B}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{{F}^{-1}}{\sin B}, \frac{-x}{\mathsf{fma}\left(0.3333333333333333, B \cdot B, 1\right) \cdot B}\right)\\
\end{array}
\end{array}
if F < -3.59999999999999995e-17Initial program 59.5%
Taylor expanded in F around -inf
mul-1-negN/A
div-add-revN/A
distribute-neg-fracN/A
lower-/.f64N/A
lower-neg.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-sin.f6498.2
Applied rewrites98.2%
if -3.59999999999999995e-17 < F < 5.70000000000000014e-121Initial program 99.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites99.7%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow2N/A
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+r+N/A
+-commutativeN/A
Applied rewrites99.7%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6499.7
lift-fma.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-fma.f6499.7
Applied rewrites99.7%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6486.8
Applied rewrites86.8%
if 5.70000000000000014e-121 < F < 1.15000000000000001e49Initial program 99.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites99.4%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow2N/A
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+r+N/A
+-commutativeN/A
Applied rewrites99.1%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6482.1
Applied rewrites82.1%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lift-fma.f64N/A
*-commutativeN/A
lift-fma.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f6482.3
lower-fma.f64N/A
lower-+.f64N/A
Applied rewrites82.4%
if 1.15000000000000001e49 < F Initial program 47.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites63.8%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow2N/A
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+r+N/A
+-commutativeN/A
Applied rewrites63.8%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6448.4
Applied rewrites48.4%
Taylor expanded in F around inf
lower-/.f6483.2
Applied rewrites83.2%
Final simplification87.6%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (* (fma 0.3333333333333333 (* B B) 1.0) B))))
(if (<= F -7.5e+52)
(fma F (/ -1.0 (* (sin B) F)) t_0)
(if (<= F 5.7e-121)
(fma
F
(pow (* (sqrt (+ (fma 2.0 x (* F F)) 2.0)) B) -1.0)
(/ (- x) (tan B)))
(if (<= F 1.15e+49)
(-
(/ (/ F (sin B)) (sqrt (fma x 2.0 (fma F F 2.0))))
(/ x (* (fma (* B B) 0.3333333333333333 1.0) B)))
(fma F (/ (pow F -1.0) (sin B)) t_0))))))
double code(double F, double B, double x) {
double t_0 = -x / (fma(0.3333333333333333, (B * B), 1.0) * B);
double tmp;
if (F <= -7.5e+52) {
tmp = fma(F, (-1.0 / (sin(B) * F)), t_0);
} else if (F <= 5.7e-121) {
tmp = fma(F, pow((sqrt((fma(2.0, x, (F * F)) + 2.0)) * B), -1.0), (-x / tan(B)));
} else if (F <= 1.15e+49) {
tmp = ((F / sin(B)) / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) - (x / (fma((B * B), 0.3333333333333333, 1.0) * B));
} else {
tmp = fma(F, (pow(F, -1.0) / sin(B)), t_0);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-x) / Float64(fma(0.3333333333333333, Float64(B * B), 1.0) * B)) tmp = 0.0 if (F <= -7.5e+52) tmp = fma(F, Float64(-1.0 / Float64(sin(B) * F)), t_0); elseif (F <= 5.7e-121) tmp = fma(F, (Float64(sqrt(Float64(fma(2.0, x, Float64(F * F)) + 2.0)) * B) ^ -1.0), Float64(Float64(-x) / tan(B))); elseif (F <= 1.15e+49) tmp = Float64(Float64(Float64(F / sin(B)) / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) - Float64(x / Float64(fma(Float64(B * B), 0.3333333333333333, 1.0) * B))); else tmp = fma(F, Float64((F ^ -1.0) / sin(B)), t_0); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[(N[(0.3333333333333333 * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -7.5e+52], N[(F * N[(-1.0 / N[(N[Sin[B], $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], If[LessEqual[F, 5.7e-121], N[(F * N[Power[N[(N[Sqrt[N[(N[(2.0 * x + N[(F * F), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]], $MachinePrecision] * B), $MachinePrecision], -1.0], $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.15e+49], N[(N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(x / N[(N[(N[(B * B), $MachinePrecision] * 0.3333333333333333 + 1.0), $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(F * N[(N[Power[F, -1.0], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\mathsf{fma}\left(0.3333333333333333, B \cdot B, 1\right) \cdot B}\\
\mathbf{if}\;F \leq -7.5 \cdot 10^{+52}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{-1}{\sin B \cdot F}, t\_0\right)\\
\mathbf{elif}\;F \leq 5.7 \cdot 10^{-121}:\\
\;\;\;\;\mathsf{fma}\left(F, {\left(\sqrt{\mathsf{fma}\left(2, x, F \cdot F\right) + 2} \cdot B\right)}^{-1}, \frac{-x}{\tan B}\right)\\
\mathbf{elif}\;F \leq 1.15 \cdot 10^{+49}:\\
\;\;\;\;\frac{\frac{F}{\sin B}}{\sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}} - \frac{x}{\mathsf{fma}\left(B \cdot B, 0.3333333333333333, 1\right) \cdot B}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{{F}^{-1}}{\sin B}, t\_0\right)\\
\end{array}
\end{array}
if F < -7.49999999999999995e52Initial program 52.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites65.3%
Taylor expanded in F around -inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6499.6
Applied rewrites99.6%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6479.1
Applied rewrites79.1%
if -7.49999999999999995e52 < F < 5.70000000000000014e-121Initial program 98.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites99.6%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow2N/A
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+r+N/A
+-commutativeN/A
Applied rewrites99.6%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6499.7
lift-fma.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-fma.f6499.7
Applied rewrites99.7%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6486.3
Applied rewrites86.3%
if 5.70000000000000014e-121 < F < 1.15000000000000001e49Initial program 99.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites99.4%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow2N/A
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+r+N/A
+-commutativeN/A
Applied rewrites99.1%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6482.1
Applied rewrites82.1%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lift-fma.f64N/A
*-commutativeN/A
lift-fma.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f6482.3
lower-fma.f64N/A
lower-+.f64N/A
Applied rewrites82.4%
if 1.15000000000000001e49 < F Initial program 47.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites63.8%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow2N/A
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+r+N/A
+-commutativeN/A
Applied rewrites63.8%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6448.4
Applied rewrites48.4%
Taylor expanded in F around inf
lower-/.f6483.2
Applied rewrites83.2%
Final simplification83.4%
(FPCore (F B x)
:precision binary64
(if (<= x -1e-114)
(fma
F
(/ -1.0 (* (* (fma -0.16666666666666666 (* B B) 1.0) B) F))
(/ (- x) (tan B)))
(if (<= x 8.5e-114)
(* (sqrt (pow (fma F F 2.0) -1.0)) (/ F (sin B)))
(if (<= x 1.15e-58)
(fma
F
(/ (pow F -1.0) (sin B))
(/ (- x) (* (fma 0.3333333333333333 (* B B) 1.0) B)))
(+ (* x (/ -1.0 (tan B))) (/ -1.0 B))))))
double code(double F, double B, double x) {
double tmp;
if (x <= -1e-114) {
tmp = fma(F, (-1.0 / ((fma(-0.16666666666666666, (B * B), 1.0) * B) * F)), (-x / tan(B)));
} else if (x <= 8.5e-114) {
tmp = sqrt(pow(fma(F, F, 2.0), -1.0)) * (F / sin(B));
} else if (x <= 1.15e-58) {
tmp = fma(F, (pow(F, -1.0) / sin(B)), (-x / (fma(0.3333333333333333, (B * B), 1.0) * B)));
} else {
tmp = (x * (-1.0 / tan(B))) + (-1.0 / B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (x <= -1e-114) tmp = fma(F, Float64(-1.0 / Float64(Float64(fma(-0.16666666666666666, Float64(B * B), 1.0) * B) * F)), Float64(Float64(-x) / tan(B))); elseif (x <= 8.5e-114) tmp = Float64(sqrt((fma(F, F, 2.0) ^ -1.0)) * Float64(F / sin(B))); elseif (x <= 1.15e-58) tmp = fma(F, Float64((F ^ -1.0) / sin(B)), Float64(Float64(-x) / Float64(fma(0.3333333333333333, Float64(B * B), 1.0) * B))); else tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(-1.0 / B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[x, -1e-114], N[(F * N[(-1.0 / N[(N[(N[(-0.16666666666666666 * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] * B), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 8.5e-114], N[(N[Sqrt[N[Power[N[(F * F + 2.0), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.15e-58], N[(F * N[(N[Power[F, -1.0], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + N[((-x) / N[(N[(0.3333333333333333 * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] * B), $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}\;x \leq -1 \cdot 10^{-114}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{-1}{\left(\mathsf{fma}\left(-0.16666666666666666, B \cdot B, 1\right) \cdot B\right) \cdot F}, \frac{-x}{\tan B}\right)\\
\mathbf{elif}\;x \leq 8.5 \cdot 10^{-114}:\\
\;\;\;\;\sqrt{{\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-1}} \cdot \frac{F}{\sin B}\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{-58}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{{F}^{-1}}{\sin B}, \frac{-x}{\mathsf{fma}\left(0.3333333333333333, B \cdot B, 1\right) \cdot B}\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\
\end{array}
\end{array}
if x < -1.0000000000000001e-114Initial program 74.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites84.1%
Taylor expanded in F around -inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6452.3
Applied rewrites52.3%
Taylor expanded in B around 0
Applied rewrites64.8%
if -1.0000000000000001e-114 < x < 8.5000000000000006e-114Initial program 78.6%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-sin.f6462.3
Applied rewrites62.3%
if 8.5000000000000006e-114 < x < 1.1499999999999999e-58Initial program 26.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites34.2%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow2N/A
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+r+N/A
+-commutativeN/A
Applied rewrites34.2%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6419.0
Applied rewrites19.0%
Taylor expanded in F around inf
lower-/.f6467.2
Applied rewrites67.2%
if 1.1499999999999999e-58 < x Initial program 79.2%
Taylor expanded in B around 0
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
+-commutativeN/A
lower-/.f64N/A
Applied rewrites65.5%
Taylor expanded in F around -inf
Applied rewrites67.0%
Taylor expanded in B around 0
Applied rewrites87.0%
Final simplification71.6%
(FPCore (F B x)
:precision binary64
(if (<= F -3.6e-17)
(/ (- (fma (cos B) x 1.0)) (sin B))
(if (<= F 5.7e-121)
(fma
F
(pow (* (sqrt (+ (fma 2.0 x (* F F)) 2.0)) B) -1.0)
(/ (- x) (tan B)))
(if (<= F 30000.0)
(-
(/ (/ F (sin B)) (sqrt (fma x 2.0 (fma F F 2.0))))
(/ x (* (fma (* B B) 0.3333333333333333 1.0) B)))
(/ (fma -1.0 (* (cos B) x) 1.0) (sin B))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.6e-17) {
tmp = -fma(cos(B), x, 1.0) / sin(B);
} else if (F <= 5.7e-121) {
tmp = fma(F, pow((sqrt((fma(2.0, x, (F * F)) + 2.0)) * B), -1.0), (-x / tan(B)));
} else if (F <= 30000.0) {
tmp = ((F / sin(B)) / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) - (x / (fma((B * B), 0.3333333333333333, 1.0) * B));
} else {
tmp = fma(-1.0, (cos(B) * x), 1.0) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -3.6e-17) tmp = Float64(Float64(-fma(cos(B), x, 1.0)) / sin(B)); elseif (F <= 5.7e-121) tmp = fma(F, (Float64(sqrt(Float64(fma(2.0, x, Float64(F * F)) + 2.0)) * B) ^ -1.0), Float64(Float64(-x) / tan(B))); elseif (F <= 30000.0) tmp = Float64(Float64(Float64(F / sin(B)) / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) - Float64(x / Float64(fma(Float64(B * B), 0.3333333333333333, 1.0) * B))); else tmp = Float64(fma(-1.0, Float64(cos(B) * x), 1.0) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -3.6e-17], N[((-N[(N[Cos[B], $MachinePrecision] * x + 1.0), $MachinePrecision]) / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 5.7e-121], N[(F * N[Power[N[(N[Sqrt[N[(N[(2.0 * x + N[(F * F), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]], $MachinePrecision] * B), $MachinePrecision], -1.0], $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 30000.0], N[(N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(x / N[(N[(N[(B * B), $MachinePrecision] * 0.3333333333333333 + 1.0), $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 * N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.6 \cdot 10^{-17}:\\
\;\;\;\;\frac{-\mathsf{fma}\left(\cos B, x, 1\right)}{\sin B}\\
\mathbf{elif}\;F \leq 5.7 \cdot 10^{-121}:\\
\;\;\;\;\mathsf{fma}\left(F, {\left(\sqrt{\mathsf{fma}\left(2, x, F \cdot F\right) + 2} \cdot B\right)}^{-1}, \frac{-x}{\tan B}\right)\\
\mathbf{elif}\;F \leq 30000:\\
\;\;\;\;\frac{\frac{F}{\sin B}}{\sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}} - \frac{x}{\mathsf{fma}\left(B \cdot B, 0.3333333333333333, 1\right) \cdot B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-1, \cos B \cdot x, 1\right)}{\sin B}\\
\end{array}
\end{array}
if F < -3.59999999999999995e-17Initial program 59.5%
Taylor expanded in F around -inf
mul-1-negN/A
div-add-revN/A
distribute-neg-fracN/A
lower-/.f64N/A
lower-neg.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-sin.f6498.2
Applied rewrites98.2%
if -3.59999999999999995e-17 < F < 5.70000000000000014e-121Initial program 99.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites99.7%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow2N/A
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+r+N/A
+-commutativeN/A
Applied rewrites99.7%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6499.7
lift-fma.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-fma.f6499.7
Applied rewrites99.7%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6486.8
Applied rewrites86.8%
if 5.70000000000000014e-121 < F < 3e4Initial program 99.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites99.4%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow2N/A
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+r+N/A
+-commutativeN/A
Applied rewrites99.1%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6484.2
Applied rewrites84.2%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lift-fma.f64N/A
*-commutativeN/A
lift-fma.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f6484.4
lower-fma.f64N/A
lower-+.f64N/A
Applied rewrites84.5%
if 3e4 < F Initial program 52.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites67.3%
Taylor expanded in F around inf
associate-*r/N/A
div-add-revN/A
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6499.7
Applied rewrites99.7%
Final simplification93.2%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (* (fma 0.3333333333333333 (* B B) 1.0) B))))
(if (<= F -7.5e+52)
(fma F (/ -1.0 (* (sin B) F)) t_0)
(if (<= F 10000000.0)
(fma
F
(pow (* (sqrt (+ (fma 2.0 x (* F F)) 2.0)) B) -1.0)
(/ (- x) (tan B)))
(fma F (/ (pow F -1.0) (sin B)) t_0)))))
double code(double F, double B, double x) {
double t_0 = -x / (fma(0.3333333333333333, (B * B), 1.0) * B);
double tmp;
if (F <= -7.5e+52) {
tmp = fma(F, (-1.0 / (sin(B) * F)), t_0);
} else if (F <= 10000000.0) {
tmp = fma(F, pow((sqrt((fma(2.0, x, (F * F)) + 2.0)) * B), -1.0), (-x / tan(B)));
} else {
tmp = fma(F, (pow(F, -1.0) / sin(B)), t_0);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-x) / Float64(fma(0.3333333333333333, Float64(B * B), 1.0) * B)) tmp = 0.0 if (F <= -7.5e+52) tmp = fma(F, Float64(-1.0 / Float64(sin(B) * F)), t_0); elseif (F <= 10000000.0) tmp = fma(F, (Float64(sqrt(Float64(fma(2.0, x, Float64(F * F)) + 2.0)) * B) ^ -1.0), Float64(Float64(-x) / tan(B))); else tmp = fma(F, Float64((F ^ -1.0) / sin(B)), t_0); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[(N[(0.3333333333333333 * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -7.5e+52], N[(F * N[(-1.0 / N[(N[Sin[B], $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], If[LessEqual[F, 10000000.0], N[(F * N[Power[N[(N[Sqrt[N[(N[(2.0 * x + N[(F * F), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]], $MachinePrecision] * B), $MachinePrecision], -1.0], $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(F * N[(N[Power[F, -1.0], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\mathsf{fma}\left(0.3333333333333333, B \cdot B, 1\right) \cdot B}\\
\mathbf{if}\;F \leq -7.5 \cdot 10^{+52}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{-1}{\sin B \cdot F}, t\_0\right)\\
\mathbf{elif}\;F \leq 10000000:\\
\;\;\;\;\mathsf{fma}\left(F, {\left(\sqrt{\mathsf{fma}\left(2, x, F \cdot F\right) + 2} \cdot B\right)}^{-1}, \frac{-x}{\tan B}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{{F}^{-1}}{\sin B}, t\_0\right)\\
\end{array}
\end{array}
if F < -7.49999999999999995e52Initial program 52.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites65.3%
Taylor expanded in F around -inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6499.6
Applied rewrites99.6%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6479.1
Applied rewrites79.1%
if -7.49999999999999995e52 < F < 1e7Initial program 98.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites99.6%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow2N/A
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+r+N/A
+-commutativeN/A
Applied rewrites99.5%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6499.6
lift-fma.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-fma.f6499.6
Applied rewrites99.6%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6481.9
Applied rewrites81.9%
if 1e7 < F Initial program 52.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites66.9%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow2N/A
lift-fma.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
associate-+r+N/A
+-commutativeN/A
Applied rewrites66.9%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6451.4
Applied rewrites51.4%
Taylor expanded in F around inf
lower-/.f6483.2
Applied rewrites83.2%
Final simplification81.8%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (+ (* x (/ -1.0 (tan B))) (/ -1.0 B))))
(if (<= x -620000000000.0)
t_0
(if (<= x -7.2e-145)
(/ (- (/ F (sqrt (fma x 2.0 (fma F F 2.0)))) x) B)
(if (<= x 3.6e-102)
(* (sqrt (pow (fma F F 2.0) -1.0)) (/ F (sin B)))
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 <= -620000000000.0) {
tmp = t_0;
} else if (x <= -7.2e-145) {
tmp = ((F / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) - x) / B;
} else if (x <= 3.6e-102) {
tmp = sqrt(pow(fma(F, F, 2.0), -1.0)) * (F / sin(B));
} else {
tmp = t_0;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(-1.0 / B)) tmp = 0.0 if (x <= -620000000000.0) tmp = t_0; elseif (x <= -7.2e-145) tmp = Float64(Float64(Float64(F / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) - x) / B); elseif (x <= 3.6e-102) tmp = Float64(sqrt((fma(F, F, 2.0) ^ -1.0)) * Float64(F / sin(B))); 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, -620000000000.0], t$95$0, If[LessEqual[x, -7.2e-145], N[(N[(N[(F / N[Sqrt[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[x, 3.6e-102], N[(N[Sqrt[N[Power[N[(F * F + 2.0), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\
\mathbf{if}\;x \leq -620000000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -7.2 \cdot 10^{-145}:\\
\;\;\;\;\frac{\frac{F}{\sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}} - x}{B}\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{-102}:\\
\;\;\;\;\sqrt{{\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-1}} \cdot \frac{F}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -6.2e11 or 3.6e-102 < x Initial program 77.0%
Taylor expanded in B around 0
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
+-commutativeN/A
lower-/.f64N/A
Applied rewrites55.9%
Taylor expanded in F around -inf
Applied rewrites60.5%
Taylor expanded in B around 0
Applied rewrites85.9%
if -6.2e11 < x < -7.2000000000000001e-145Initial program 70.4%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6441.6
Applied rewrites41.6%
Applied rewrites41.7%
if -7.2000000000000001e-145 < x < 3.6e-102Initial program 75.6%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-sin.f6462.4
Applied rewrites62.4%
Final simplification70.2%
(FPCore (F B x)
:precision binary64
(if (<= x -1e-114)
(fma
F
(/ -1.0 (* (* (fma -0.16666666666666666 (* B B) 1.0) B) F))
(/ (- x) (tan B)))
(if (<= x 3.6e-102)
(* (sqrt (pow (fma F F 2.0) -1.0)) (/ F (sin B)))
(+ (* x (/ -1.0 (tan B))) (/ -1.0 B)))))
double code(double F, double B, double x) {
double tmp;
if (x <= -1e-114) {
tmp = fma(F, (-1.0 / ((fma(-0.16666666666666666, (B * B), 1.0) * B) * F)), (-x / tan(B)));
} else if (x <= 3.6e-102) {
tmp = sqrt(pow(fma(F, F, 2.0), -1.0)) * (F / sin(B));
} else {
tmp = (x * (-1.0 / tan(B))) + (-1.0 / B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (x <= -1e-114) tmp = fma(F, Float64(-1.0 / Float64(Float64(fma(-0.16666666666666666, Float64(B * B), 1.0) * B) * F)), Float64(Float64(-x) / tan(B))); elseif (x <= 3.6e-102) tmp = Float64(sqrt((fma(F, F, 2.0) ^ -1.0)) * Float64(F / sin(B))); else tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(-1.0 / B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[x, -1e-114], N[(F * N[(-1.0 / N[(N[(N[(-0.16666666666666666 * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] * B), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.6e-102], N[(N[Sqrt[N[Power[N[(F * F + 2.0), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * N[(F / N[Sin[B], $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}\;x \leq -1 \cdot 10^{-114}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{-1}{\left(\mathsf{fma}\left(-0.16666666666666666, B \cdot B, 1\right) \cdot B\right) \cdot F}, \frac{-x}{\tan B}\right)\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{-102}:\\
\;\;\;\;\sqrt{{\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-1}} \cdot \frac{F}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\
\end{array}
\end{array}
if x < -1.0000000000000001e-114Initial program 74.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites84.1%
Taylor expanded in F around -inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f6452.3
Applied rewrites52.3%
Taylor expanded in B around 0
Applied rewrites64.8%
if -1.0000000000000001e-114 < x < 3.6e-102Initial program 76.6%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-sin.f6460.9
Applied rewrites60.9%
if 3.6e-102 < x Initial program 74.7%
Taylor expanded in B around 0
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
+-commutativeN/A
lower-/.f64N/A
Applied rewrites60.1%
Taylor expanded in F around -inf
Applied rewrites61.5%
Taylor expanded in B around 0
Applied rewrites82.0%
Final simplification69.8%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* x (/ -1.0 (tan B)))))
(if (<= x -2.9e-72)
(+ t_0 (* (/ F B) (pow F -1.0)))
(if (<= x 3.6e-102)
(* (sqrt (pow (fma F F 2.0) -1.0)) (/ F (sin B)))
(+ t_0 (/ -1.0 B))))))
double code(double F, double B, double x) {
double t_0 = x * (-1.0 / tan(B));
double tmp;
if (x <= -2.9e-72) {
tmp = t_0 + ((F / B) * pow(F, -1.0));
} else if (x <= 3.6e-102) {
tmp = sqrt(pow(fma(F, F, 2.0), -1.0)) * (F / sin(B));
} else {
tmp = t_0 + (-1.0 / B);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(x * Float64(-1.0 / tan(B))) tmp = 0.0 if (x <= -2.9e-72) tmp = Float64(t_0 + Float64(Float64(F / B) * (F ^ -1.0))); elseif (x <= 3.6e-102) tmp = Float64(sqrt((fma(F, F, 2.0) ^ -1.0)) * Float64(F / sin(B))); 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]}, If[LessEqual[x, -2.9e-72], N[(t$95$0 + N[(N[(F / B), $MachinePrecision] * N[Power[F, -1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.6e-102], N[(N[Sqrt[N[Power[N[(F * F + 2.0), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * N[(F / N[Sin[B], $MachinePrecision]), $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}\\
\mathbf{if}\;x \leq -2.9 \cdot 10^{-72}:\\
\;\;\;\;t\_0 + \frac{F}{B} \cdot {F}^{-1}\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{-102}:\\
\;\;\;\;\sqrt{{\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-1}} \cdot \frac{F}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{-1}{B}\\
\end{array}
\end{array}
if x < -2.89999999999999998e-72Initial program 75.7%
Taylor expanded in F around inf
lower-/.f6466.1
Applied rewrites66.1%
Taylor expanded in B around 0
lower-/.f6471.1
Applied rewrites71.1%
if -2.89999999999999998e-72 < x < 3.6e-102Initial program 75.9%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-sin.f6457.9
Applied rewrites57.9%
if 3.6e-102 < x Initial program 74.7%
Taylor expanded in B around 0
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
+-commutativeN/A
lower-/.f64N/A
Applied rewrites60.1%
Taylor expanded in F around -inf
Applied rewrites61.5%
Taylor expanded in B around 0
Applied rewrites82.0%
Final simplification69.6%
(FPCore (F B x)
:precision binary64
(if (<= F -4.85e+86)
(+ (- (/ x B)) (/ (- (* -0.16666666666666666 (* B B)) 1.0) B))
(if (<= F 2800.0)
(/ (- (* (sqrt (pow (fma F F (fma 2.0 x 2.0)) -1.0)) F) x) B)
(/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -4.85e+86) {
tmp = -(x / B) + (((-0.16666666666666666 * (B * B)) - 1.0) / B);
} else if (F <= 2800.0) {
tmp = ((sqrt(pow(fma(F, F, fma(2.0, x, 2.0)), -1.0)) * F) - x) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -4.85e+86) tmp = Float64(Float64(-Float64(x / B)) + Float64(Float64(Float64(-0.16666666666666666 * Float64(B * B)) - 1.0) / B)); elseif (F <= 2800.0) tmp = Float64(Float64(Float64(sqrt((fma(F, F, fma(2.0, x, 2.0)) ^ -1.0)) * F) - x) / B); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -4.85e+86], N[((-N[(x / B), $MachinePrecision]) + N[(N[(N[(-0.16666666666666666 * N[(B * B), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 2800.0], N[(N[(N[(N[Sqrt[N[Power[N[(F * F + N[(2.0 * x + 2.0), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -4.85 \cdot 10^{+86}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{-0.16666666666666666 \cdot \left(B \cdot B\right) - 1}{B}\\
\mathbf{elif}\;F \leq 2800:\\
\;\;\;\;\frac{\sqrt{{\left(\mathsf{fma}\left(F, F, \mathsf{fma}\left(2, x, 2\right)\right)\right)}^{-1}} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -4.85e86Initial program 48.5%
Taylor expanded in B around 0
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
+-commutativeN/A
lower-/.f64N/A
Applied rewrites32.4%
Taylor expanded in F around -inf
Applied rewrites63.0%
Taylor expanded in B around 0
lower-/.f6451.8
Applied rewrites51.8%
if -4.85e86 < F < 2800Initial program 98.0%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6447.4
Applied rewrites47.4%
if 2800 < F Initial program 53.3%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6435.1
Applied rewrites35.1%
Taylor expanded in F around inf
Applied rewrites48.3%
Final simplification48.4%
(FPCore (F B x)
:precision binary64
(if (<= F -1.9e-63)
(+ (- (/ x B)) (/ (- (* -0.16666666666666666 (* B B)) 1.0) B))
(if (<= F 5.4e-114)
(/ (- x) B)
(if (<= F 0.000145)
(/ (* (sqrt (pow (fma F F 2.0) -1.0)) F) B)
(/ (- 1.0 x) B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.9e-63) {
tmp = -(x / B) + (((-0.16666666666666666 * (B * B)) - 1.0) / B);
} else if (F <= 5.4e-114) {
tmp = -x / B;
} else if (F <= 0.000145) {
tmp = (sqrt(pow(fma(F, F, 2.0), -1.0)) * F) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.9e-63) tmp = Float64(Float64(-Float64(x / B)) + Float64(Float64(Float64(-0.16666666666666666 * Float64(B * B)) - 1.0) / B)); elseif (F <= 5.4e-114) tmp = Float64(Float64(-x) / B); elseif (F <= 0.000145) tmp = Float64(Float64(sqrt((fma(F, F, 2.0) ^ -1.0)) * F) / B); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.9e-63], N[((-N[(x / B), $MachinePrecision]) + N[(N[(N[(-0.16666666666666666 * N[(B * B), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 5.4e-114], N[((-x) / B), $MachinePrecision], If[LessEqual[F, 0.000145], N[(N[(N[Sqrt[N[Power[N[(F * F + 2.0), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * F), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.9 \cdot 10^{-63}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{-0.16666666666666666 \cdot \left(B \cdot B\right) - 1}{B}\\
\mathbf{elif}\;F \leq 5.4 \cdot 10^{-114}:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{elif}\;F \leq 0.000145:\\
\;\;\;\;\frac{\sqrt{{\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-1}} \cdot F}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -1.90000000000000009e-63Initial program 63.3%
Taylor expanded in B around 0
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
+-commutativeN/A
lower-/.f64N/A
Applied rewrites43.5%
Taylor expanded in F around -inf
Applied rewrites60.7%
Taylor expanded in B around 0
lower-/.f6448.9
Applied rewrites48.9%
if -1.90000000000000009e-63 < F < 5.3999999999999999e-114Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6442.4
Applied rewrites42.4%
Taylor expanded in F around 0
Applied rewrites38.2%
if 5.3999999999999999e-114 < F < 1.45e-4Initial program 99.1%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6455.2
Applied rewrites55.2%
Taylor expanded in x around 0
Applied rewrites38.6%
if 1.45e-4 < F Initial program 53.9%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6435.9
Applied rewrites35.9%
Taylor expanded in F around inf
Applied rewrites48.3%
Final simplification44.2%
(FPCore (F B x)
:precision binary64
(if (<= F -1.9e-63)
(+ (- (/ x B)) (/ (- (* -0.16666666666666666 (* B B)) 1.0) B))
(if (<= F 5.4e-114)
(/ (- x) B)
(if (<= F 0.000145)
(* (sqrt (pow (fma F F 2.0) -1.0)) (/ F B))
(/ (- 1.0 x) B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.9e-63) {
tmp = -(x / B) + (((-0.16666666666666666 * (B * B)) - 1.0) / B);
} else if (F <= 5.4e-114) {
tmp = -x / B;
} else if (F <= 0.000145) {
tmp = sqrt(pow(fma(F, F, 2.0), -1.0)) * (F / B);
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.9e-63) tmp = Float64(Float64(-Float64(x / B)) + Float64(Float64(Float64(-0.16666666666666666 * Float64(B * B)) - 1.0) / B)); elseif (F <= 5.4e-114) tmp = Float64(Float64(-x) / B); elseif (F <= 0.000145) tmp = Float64(sqrt((fma(F, F, 2.0) ^ -1.0)) * Float64(F / B)); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.9e-63], N[((-N[(x / B), $MachinePrecision]) + N[(N[(N[(-0.16666666666666666 * N[(B * B), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 5.4e-114], N[((-x) / B), $MachinePrecision], If[LessEqual[F, 0.000145], N[(N[Sqrt[N[Power[N[(F * F + 2.0), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * N[(F / B), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.9 \cdot 10^{-63}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{-0.16666666666666666 \cdot \left(B \cdot B\right) - 1}{B}\\
\mathbf{elif}\;F \leq 5.4 \cdot 10^{-114}:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{elif}\;F \leq 0.000145:\\
\;\;\;\;\sqrt{{\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-1}} \cdot \frac{F}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -1.90000000000000009e-63Initial program 63.3%
Taylor expanded in B around 0
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
+-commutativeN/A
lower-/.f64N/A
Applied rewrites43.5%
Taylor expanded in F around -inf
Applied rewrites60.7%
Taylor expanded in B around 0
lower-/.f6448.9
Applied rewrites48.9%
if -1.90000000000000009e-63 < F < 5.3999999999999999e-114Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6442.4
Applied rewrites42.4%
Taylor expanded in F around 0
Applied rewrites38.2%
if 5.3999999999999999e-114 < F < 1.45e-4Initial program 99.1%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6455.2
Applied rewrites55.2%
Taylor expanded in x around 0
Applied rewrites38.5%
if 1.45e-4 < F Initial program 53.9%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6435.9
Applied rewrites35.9%
Taylor expanded in F around inf
Applied rewrites48.3%
Final simplification44.2%
(FPCore (F B x)
:precision binary64
(if (<= F -0.00043)
(+ (- (/ x B)) (/ (- (* -0.16666666666666666 (* B B)) 1.0) B))
(if (<= F 2900.0)
(/ (- (* (sqrt (pow (fma 2.0 x 2.0) -1.0)) F) x) B)
(/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -0.00043) {
tmp = -(x / B) + (((-0.16666666666666666 * (B * B)) - 1.0) / B);
} else if (F <= 2900.0) {
tmp = ((sqrt(pow(fma(2.0, x, 2.0), -1.0)) * F) - x) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -0.00043) tmp = Float64(Float64(-Float64(x / B)) + Float64(Float64(Float64(-0.16666666666666666 * Float64(B * B)) - 1.0) / B)); elseif (F <= 2900.0) tmp = Float64(Float64(Float64(sqrt((fma(2.0, x, 2.0) ^ -1.0)) * F) - x) / B); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -0.00043], N[((-N[(x / B), $MachinePrecision]) + N[(N[(N[(-0.16666666666666666 * N[(B * B), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 2900.0], N[(N[(N[(N[Sqrt[N[Power[N[(2.0 * x + 2.0), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -0.00043:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{-0.16666666666666666 \cdot \left(B \cdot B\right) - 1}{B}\\
\mathbf{elif}\;F \leq 2900:\\
\;\;\;\;\frac{\sqrt{{\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{-1}} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -4.29999999999999989e-4Initial program 58.0%
Taylor expanded in B around 0
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
+-commutativeN/A
lower-/.f64N/A
Applied rewrites40.6%
Taylor expanded in F around -inf
Applied rewrites63.6%
Taylor expanded in B around 0
lower-/.f6451.8
Applied rewrites51.8%
if -4.29999999999999989e-4 < F < 2900Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6446.4
Applied rewrites46.4%
Taylor expanded in F around 0
Applied rewrites46.4%
if 2900 < F Initial program 52.8%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6435.5
Applied rewrites35.5%
Taylor expanded in F around inf
Applied rewrites48.8%
Final simplification48.4%
(FPCore (F B x) :precision binary64 (if (<= B 8e-8) (/ (- (/ F (sqrt (fma x 2.0 (fma F F 2.0)))) x) B) (+ (* x (/ -1.0 (tan B))) (/ -1.0 B))))
double code(double F, double B, double x) {
double tmp;
if (B <= 8e-8) {
tmp = ((F / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) - x) / B;
} else {
tmp = (x * (-1.0 / tan(B))) + (-1.0 / B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (B <= 8e-8) tmp = Float64(Float64(Float64(F / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) - x) / B); else tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(-1.0 / B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[B, 8e-8], N[(N[(N[(F / N[Sqrt[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / B), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 8 \cdot 10^{-8}:\\
\;\;\;\;\frac{\frac{F}{\sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}} - x}{B}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\
\end{array}
\end{array}
if B < 8.0000000000000002e-8Initial program 72.7%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6454.8
Applied rewrites54.8%
Applied rewrites54.9%
if 8.0000000000000002e-8 < B Initial program 82.7%
Taylor expanded in B around 0
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
+-commutativeN/A
lower-/.f64N/A
Applied rewrites9.2%
Taylor expanded in F around -inf
Applied rewrites15.9%
Taylor expanded in B around 0
Applied rewrites47.6%
Final simplification52.9%
(FPCore (F B x) :precision binary64 (if (<= F -1.9e-63) (+ (- (/ x B)) (/ (- (* -0.16666666666666666 (* B B)) 1.0) B)) (if (<= F 0.0014) (/ (- x) B) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.9e-63) {
tmp = -(x / B) + (((-0.16666666666666666 * (B * B)) - 1.0) / B);
} else if (F <= 0.0014) {
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 <= (-1.9d-63)) then
tmp = -(x / b) + ((((-0.16666666666666666d0) * (b * b)) - 1.0d0) / b)
else if (f <= 0.0014d0) 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 <= -1.9e-63) {
tmp = -(x / B) + (((-0.16666666666666666 * (B * B)) - 1.0) / B);
} else if (F <= 0.0014) {
tmp = -x / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -1.9e-63: tmp = -(x / B) + (((-0.16666666666666666 * (B * B)) - 1.0) / B) elif F <= 0.0014: tmp = -x / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -1.9e-63) tmp = Float64(Float64(-Float64(x / B)) + Float64(Float64(Float64(-0.16666666666666666 * Float64(B * B)) - 1.0) / B)); elseif (F <= 0.0014) 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 <= -1.9e-63) tmp = -(x / B) + (((-0.16666666666666666 * (B * B)) - 1.0) / B); elseif (F <= 0.0014) tmp = -x / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -1.9e-63], N[((-N[(x / B), $MachinePrecision]) + N[(N[(N[(-0.16666666666666666 * N[(B * B), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 0.0014], N[((-x) / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.9 \cdot 10^{-63}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{-0.16666666666666666 \cdot \left(B \cdot B\right) - 1}{B}\\
\mathbf{elif}\;F \leq 0.0014:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -1.90000000000000009e-63Initial program 63.3%
Taylor expanded in B around 0
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
+-commutativeN/A
lower-/.f64N/A
Applied rewrites43.5%
Taylor expanded in F around -inf
Applied rewrites60.7%
Taylor expanded in B around 0
lower-/.f6448.9
Applied rewrites48.9%
if -1.90000000000000009e-63 < F < 0.00139999999999999999Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6446.4
Applied rewrites46.4%
Taylor expanded in F around 0
Applied rewrites33.4%
if 0.00139999999999999999 < F Initial program 53.3%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6435.1
Applied rewrites35.1%
Taylor expanded in F around inf
Applied rewrites48.3%
(FPCore (F B x) :precision binary64 (if (<= F -7e-96) (/ (/ (* (+ -1.0 x) (- -1.0 x)) (+ -1.0 x)) B) (if (<= F 0.0014) (/ (- x) B) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -7e-96) {
tmp = (((-1.0 + x) * (-1.0 - x)) / (-1.0 + x)) / B;
} else if (F <= 0.0014) {
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 <= (-7d-96)) then
tmp = ((((-1.0d0) + x) * ((-1.0d0) - x)) / ((-1.0d0) + x)) / b
else if (f <= 0.0014d0) 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 <= -7e-96) {
tmp = (((-1.0 + x) * (-1.0 - x)) / (-1.0 + x)) / B;
} else if (F <= 0.0014) {
tmp = -x / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -7e-96: tmp = (((-1.0 + x) * (-1.0 - x)) / (-1.0 + x)) / B elif F <= 0.0014: tmp = -x / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -7e-96) tmp = Float64(Float64(Float64(Float64(-1.0 + x) * Float64(-1.0 - x)) / Float64(-1.0 + x)) / B); elseif (F <= 0.0014) 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 <= -7e-96) tmp = (((-1.0 + x) * (-1.0 - x)) / (-1.0 + x)) / B; elseif (F <= 0.0014) tmp = -x / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -7e-96], N[(N[(N[(N[(-1.0 + x), $MachinePrecision] * N[(-1.0 - x), $MachinePrecision]), $MachinePrecision] / N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 0.0014], N[((-x) / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -7 \cdot 10^{-96}:\\
\;\;\;\;\frac{\frac{\left(-1 + x\right) \cdot \left(-1 - x\right)}{-1 + x}}{B}\\
\mathbf{elif}\;F \leq 0.0014:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -6.9999999999999998e-96Initial program 64.8%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6438.2
Applied rewrites38.2%
Taylor expanded in F around -inf
Applied rewrites46.9%
Applied rewrites46.9%
if -6.9999999999999998e-96 < F < 0.00139999999999999999Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6447.6
Applied rewrites47.6%
Taylor expanded in F around 0
Applied rewrites34.2%
if 0.00139999999999999999 < F Initial program 53.3%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6435.1
Applied rewrites35.1%
Taylor expanded in F around inf
Applied rewrites48.3%
(FPCore (F B x) :precision binary64 (if (<= F -1.15e-138) (/ (- -1.0 x) B) (if (<= F 0.0014) (/ (- x) B) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.15e-138) {
tmp = (-1.0 - x) / B;
} else if (F <= 0.0014) {
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 <= (-1.15d-138)) then
tmp = ((-1.0d0) - x) / b
else if (f <= 0.0014d0) 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 <= -1.15e-138) {
tmp = (-1.0 - x) / B;
} else if (F <= 0.0014) {
tmp = -x / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -1.15e-138: tmp = (-1.0 - x) / B elif F <= 0.0014: tmp = -x / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -1.15e-138) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 0.0014) 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 <= -1.15e-138) tmp = (-1.0 - x) / B; elseif (F <= 0.0014) tmp = -x / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -1.15e-138], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 0.0014], N[((-x) / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.15 \cdot 10^{-138}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 0.0014:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -1.14999999999999995e-138Initial program 68.1%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6437.6
Applied rewrites37.6%
Taylor expanded in F around -inf
Applied rewrites44.2%
if -1.14999999999999995e-138 < F < 0.00139999999999999999Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6448.7
Applied rewrites48.7%
Taylor expanded in F around 0
Applied rewrites35.3%
if 0.00139999999999999999 < F Initial program 53.3%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6435.1
Applied rewrites35.1%
Taylor expanded in F around inf
Applied rewrites48.3%
(FPCore (F B x) :precision binary64 (if (<= F -1.15e-138) (/ (- -1.0 x) B) (/ (- x) B)))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.15e-138) {
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 <= (-1.15d-138)) 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 <= -1.15e-138) {
tmp = (-1.0 - x) / B;
} else {
tmp = -x / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -1.15e-138: tmp = (-1.0 - x) / B else: tmp = -x / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -1.15e-138) 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 <= -1.15e-138) tmp = (-1.0 - x) / B; else tmp = -x / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -1.15e-138], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], N[((-x) / B), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.15 \cdot 10^{-138}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{B}\\
\end{array}
\end{array}
if F < -1.14999999999999995e-138Initial program 68.1%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6437.6
Applied rewrites37.6%
Taylor expanded in F around -inf
Applied rewrites44.2%
if -1.14999999999999995e-138 < F Initial program 78.4%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6442.5
Applied rewrites42.5%
Taylor expanded in F around 0
Applied rewrites31.0%
(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 75.4%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6441.1
Applied rewrites41.1%
Taylor expanded in F around 0
Applied rewrites28.7%
herbie shell --seed 2024351
(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))))))