
(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 25 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 -3.1e+154)
(fma (cos B) (/ (- x) (sin B)) (/ -1.0 (sin B)))
(if (<= F 3.65e+164)
(- (/ (/ F (sqrt (fma 2.0 x (fma F F 2.0)))) (sin B)) (/ x (tan B)))
(+
(* x (/ -1.0 (tan B)))
(/ (fma -1.0 (/ (+ 1.0 x) (* F F)) 1.0) (sin B))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.1e+154) {
tmp = fma(cos(B), (-x / sin(B)), (-1.0 / sin(B)));
} else if (F <= 3.65e+164) {
tmp = ((F / sqrt(fma(2.0, x, fma(F, F, 2.0)))) / sin(B)) - (x / tan(B));
} else {
tmp = (x * (-1.0 / tan(B))) + (fma(-1.0, ((1.0 + x) / (F * F)), 1.0) / sin(B));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -3.1e+154) tmp = fma(cos(B), Float64(Float64(-x) / sin(B)), Float64(-1.0 / sin(B))); elseif (F <= 3.65e+164) tmp = Float64(Float64(Float64(F / sqrt(fma(2.0, x, fma(F, F, 2.0)))) / sin(B)) - Float64(x / tan(B))); else tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(fma(-1.0, Float64(Float64(1.0 + x) / Float64(F * F)), 1.0) / sin(B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -3.1e+154], N[(N[Cos[B], $MachinePrecision] * N[((-x) / N[Sin[B], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 3.65e+164], N[(N[(N[(F / N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $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[(N[(-1.0 * N[(N[(1.0 + x), $MachinePrecision] / N[(F * F), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.1 \cdot 10^{+154}:\\
\;\;\;\;\mathsf{fma}\left(\cos B, \frac{-x}{\sin B}, \frac{-1}{\sin B}\right)\\
\mathbf{elif}\;F \leq 3.65 \cdot 10^{+164}:\\
\;\;\;\;\frac{\frac{F}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}}{\sin B} - \frac{x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{\mathsf{fma}\left(-1, \frac{1 + x}{F \cdot F}, 1\right)}{\sin B}\\
\end{array}
\end{array}
if F < -3.1000000000000001e154Initial program 32.2%
Taylor expanded in F around -inf
+-commutativeN/A
distribute-lft-inN/A
associate-*r/N/A
associate-*r/N/A
metadata-evalN/A
div-add-revN/A
lower-/.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-cos.f64N/A
lower-sin.f6499.8
Applied rewrites99.8%
Applied rewrites100.0%
if -3.1000000000000001e154 < F < 3.65000000000000024e164Initial program 94.1%
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
+-commutativeN/A
lift-fma.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lower-sqrt.f6499.6
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6499.6
Applied rewrites99.6%
Applied rewrites99.7%
if 3.65000000000000024e164 < F Initial program 30.6%
Taylor expanded in F around inf
+-commutativeN/A
associate-/r*N/A
associate-*r/N/A
div-add-revN/A
lower-/.f64N/A
Applied rewrites99.6%
Final simplification99.7%
(FPCore (F B x)
:precision binary64
(if (<= F -4.1e+43)
(/ (fma (- x) (cos B) -1.0) (sin B))
(if (<= F -7.6e-107)
(- (/ (/ F (sqrt (fma 2.0 x (fma F F 2.0)))) (sin B)) (/ x B))
(if (<= F 19.0)
(fma
F
(* (sqrt (pow (+ (fma 2.0 x (* F F)) 2.0) -1.0)) (pow B -1.0))
(/ (- x) (tan B)))
(/ (fma (- x) (cos B) 1.0) (sin B))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -4.1e+43) {
tmp = fma(-x, cos(B), -1.0) / sin(B);
} else if (F <= -7.6e-107) {
tmp = ((F / sqrt(fma(2.0, x, fma(F, F, 2.0)))) / sin(B)) - (x / B);
} else if (F <= 19.0) {
tmp = fma(F, (sqrt(pow((fma(2.0, x, (F * F)) + 2.0), -1.0)) * pow(B, -1.0)), (-x / tan(B)));
} else {
tmp = fma(-x, cos(B), 1.0) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -4.1e+43) tmp = Float64(fma(Float64(-x), cos(B), -1.0) / sin(B)); elseif (F <= -7.6e-107) tmp = Float64(Float64(Float64(F / sqrt(fma(2.0, x, fma(F, F, 2.0)))) / sin(B)) - Float64(x / B)); elseif (F <= 19.0) tmp = fma(F, Float64(sqrt((Float64(fma(2.0, x, Float64(F * F)) + 2.0) ^ -1.0)) * (B ^ -1.0)), Float64(Float64(-x) / tan(B))); else tmp = Float64(fma(Float64(-x), cos(B), 1.0) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -4.1e+43], N[(N[((-x) * N[Cos[B], $MachinePrecision] + -1.0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -7.6e-107], N[(N[(N[(F / N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 19.0], N[(F * N[(N[Sqrt[N[Power[N[(N[(2.0 * x + N[(F * F), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[B, -1.0], $MachinePrecision]), $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-x) * N[Cos[B], $MachinePrecision] + 1.0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -4.1 \cdot 10^{+43}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-x, \cos B, -1\right)}{\sin B}\\
\mathbf{elif}\;F \leq -7.6 \cdot 10^{-107}:\\
\;\;\;\;\frac{\frac{F}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}}{\sin B} - \frac{x}{B}\\
\mathbf{elif}\;F \leq 19:\\
\;\;\;\;\mathsf{fma}\left(F, \sqrt{{\left(\mathsf{fma}\left(2, x, F \cdot F\right) + 2\right)}^{-1}} \cdot {B}^{-1}, \frac{-x}{\tan B}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-x, \cos B, 1\right)}{\sin B}\\
\end{array}
\end{array}
if F < -4.1e43Initial program 49.5%
Taylor expanded in F around -inf
+-commutativeN/A
distribute-lft-inN/A
associate-*r/N/A
associate-*r/N/A
metadata-evalN/A
div-add-revN/A
lower-/.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-cos.f64N/A
lower-sin.f6499.8
Applied rewrites99.8%
if -4.1e43 < F < -7.6000000000000004e-107Initial 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.4%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow2N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lower-sqrt.f6499.4
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6499.4
Applied rewrites99.4%
Applied rewrites99.6%
Taylor expanded in B around 0
lower-/.f6488.8
Applied rewrites88.8%
if -7.6000000000000004e-107 < F < 19Initial 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%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f6489.1
Applied rewrites89.1%
if 19 < F Initial program 56.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 rewrites71.6%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow2N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lower-sqrt.f6471.7
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6471.7
Applied rewrites71.7%
Taylor expanded in F around inf
associate-*r/N/A
div-add-revN/A
lower-/.f64N/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-cos.f64N/A
lower-sin.f6499.2
Applied rewrites99.2%
Final simplification94.5%
(FPCore (F B x)
:precision binary64
(if (or (<= x -2.05e-73) (not (<= x 1.5e-73)))
(fma
F
(* (sqrt (pow (+ (fma 2.0 x (* F F)) 2.0) -1.0)) (pow B -1.0))
(/ (- x) (tan B)))
(- (/ (/ F (sqrt (fma 2.0 x (fma F F 2.0)))) (sin B)) (/ x B))))
double code(double F, double B, double x) {
double tmp;
if ((x <= -2.05e-73) || !(x <= 1.5e-73)) {
tmp = fma(F, (sqrt(pow((fma(2.0, x, (F * F)) + 2.0), -1.0)) * pow(B, -1.0)), (-x / tan(B)));
} else {
tmp = ((F / sqrt(fma(2.0, x, fma(F, F, 2.0)))) / sin(B)) - (x / B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if ((x <= -2.05e-73) || !(x <= 1.5e-73)) tmp = fma(F, Float64(sqrt((Float64(fma(2.0, x, Float64(F * F)) + 2.0) ^ -1.0)) * (B ^ -1.0)), Float64(Float64(-x) / tan(B))); else tmp = Float64(Float64(Float64(F / sqrt(fma(2.0, x, fma(F, F, 2.0)))) / sin(B)) - Float64(x / B)); end return tmp end
code[F_, B_, x_] := If[Or[LessEqual[x, -2.05e-73], N[Not[LessEqual[x, 1.5e-73]], $MachinePrecision]], N[(F * N[(N[Sqrt[N[Power[N[(N[(2.0 * x + N[(F * F), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[B, -1.0], $MachinePrecision]), $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(F / N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.05 \cdot 10^{-73} \lor \neg \left(x \leq 1.5 \cdot 10^{-73}\right):\\
\;\;\;\;\mathsf{fma}\left(F, \sqrt{{\left(\mathsf{fma}\left(2, x, F \cdot F\right) + 2\right)}^{-1}} \cdot {B}^{-1}, \frac{-x}{\tan B}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{F}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}}{\sin B} - \frac{x}{B}\\
\end{array}
\end{array}
if x < -2.05000000000000008e-73 or 1.5e-73 < x Initial program 79.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites94.4%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f6489.6
Applied rewrites89.6%
if -2.05000000000000008e-73 < x < 1.5e-73Initial program 70.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 rewrites74.6%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow2N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lower-sqrt.f6474.6
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6474.6
Applied rewrites74.6%
Applied rewrites74.8%
Taylor expanded in B around 0
lower-/.f6466.0
Applied rewrites66.0%
Final simplification78.2%
(FPCore (F B x)
:precision binary64
(if (<= F -4.1e+43)
(/ (fma (- x) (cos B) -1.0) (sin B))
(if (<= F -7.6e-107)
(- (/ (/ F (sqrt (fma 2.0 x (fma F F 2.0)))) (sin B)) (/ x B))
(fma
F
(* (sqrt (pow (+ (fma 2.0 x (* F F)) 2.0) -1.0)) (pow B -1.0))
(/ (- x) (tan B))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -4.1e+43) {
tmp = fma(-x, cos(B), -1.0) / sin(B);
} else if (F <= -7.6e-107) {
tmp = ((F / sqrt(fma(2.0, x, fma(F, F, 2.0)))) / sin(B)) - (x / B);
} else {
tmp = fma(F, (sqrt(pow((fma(2.0, x, (F * F)) + 2.0), -1.0)) * pow(B, -1.0)), (-x / tan(B)));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -4.1e+43) tmp = Float64(fma(Float64(-x), cos(B), -1.0) / sin(B)); elseif (F <= -7.6e-107) tmp = Float64(Float64(Float64(F / sqrt(fma(2.0, x, fma(F, F, 2.0)))) / sin(B)) - Float64(x / B)); else tmp = fma(F, Float64(sqrt((Float64(fma(2.0, x, Float64(F * F)) + 2.0) ^ -1.0)) * (B ^ -1.0)), Float64(Float64(-x) / tan(B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -4.1e+43], N[(N[((-x) * N[Cos[B], $MachinePrecision] + -1.0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -7.6e-107], N[(N[(N[(F / N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], N[(F * N[(N[Sqrt[N[Power[N[(N[(2.0 * x + N[(F * F), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[B, -1.0], $MachinePrecision]), $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -4.1 \cdot 10^{+43}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-x, \cos B, -1\right)}{\sin B}\\
\mathbf{elif}\;F \leq -7.6 \cdot 10^{-107}:\\
\;\;\;\;\frac{\frac{F}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}}{\sin B} - \frac{x}{B}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(F, \sqrt{{\left(\mathsf{fma}\left(2, x, F \cdot F\right) + 2\right)}^{-1}} \cdot {B}^{-1}, \frac{-x}{\tan B}\right)\\
\end{array}
\end{array}
if F < -4.1e43Initial program 49.5%
Taylor expanded in F around -inf
+-commutativeN/A
distribute-lft-inN/A
associate-*r/N/A
associate-*r/N/A
metadata-evalN/A
div-add-revN/A
lower-/.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-cos.f64N/A
lower-sin.f6499.8
Applied rewrites99.8%
if -4.1e43 < F < -7.6000000000000004e-107Initial 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.4%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow2N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lower-sqrt.f6499.4
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6499.4
Applied rewrites99.4%
Applied rewrites99.6%
Taylor expanded in B around 0
lower-/.f6488.8
Applied rewrites88.8%
if -7.6000000000000004e-107 < F Initial program 80.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 rewrites87.2%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f6475.9
Applied rewrites75.9%
Final simplification83.3%
(FPCore (F B x)
:precision binary64
(if (<= F -1.7)
(/ (fma (- x) (cos B) -1.0) (sin B))
(if (<= F 0.96)
(/ (fma (sqrt (pow (fma 2.0 x 2.0) -1.0)) F (* (- x) (cos B))) (sin B))
(/ (fma (- x) (cos B) 1.0) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.7) {
tmp = fma(-x, cos(B), -1.0) / sin(B);
} else if (F <= 0.96) {
tmp = fma(sqrt(pow(fma(2.0, x, 2.0), -1.0)), F, (-x * cos(B))) / sin(B);
} else {
tmp = fma(-x, cos(B), 1.0) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.7) tmp = Float64(fma(Float64(-x), cos(B), -1.0) / sin(B)); elseif (F <= 0.96) tmp = Float64(fma(sqrt((fma(2.0, x, 2.0) ^ -1.0)), F, Float64(Float64(-x) * cos(B))) / sin(B)); else tmp = Float64(fma(Float64(-x), cos(B), 1.0) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.7], N[(N[((-x) * N[Cos[B], $MachinePrecision] + -1.0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 0.96], N[(N[(N[Sqrt[N[Power[N[(2.0 * x + 2.0), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * F + N[((-x) * N[Cos[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(N[((-x) * N[Cos[B], $MachinePrecision] + 1.0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.7:\\
\;\;\;\;\frac{\mathsf{fma}\left(-x, \cos B, -1\right)}{\sin B}\\
\mathbf{elif}\;F \leq 0.96:\\
\;\;\;\;\frac{\mathsf{fma}\left(\sqrt{{\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{-1}}, F, \left(-x\right) \cdot \cos B\right)}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-x, \cos B, 1\right)}{\sin B}\\
\end{array}
\end{array}
if F < -1.69999999999999996Initial program 55.8%
Taylor expanded in F around -inf
+-commutativeN/A
distribute-lft-inN/A
associate-*r/N/A
associate-*r/N/A
metadata-evalN/A
div-add-revN/A
lower-/.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-cos.f64N/A
lower-sin.f6499.4
Applied rewrites99.4%
if -1.69999999999999996 < F < 0.95999999999999996Initial program 99.4%
Taylor expanded in F around 0
associate-/l*N/A
fp-cancel-sub-sign-invN/A
associate-*l/N/A
distribute-lft-neg-inN/A
associate-/l*N/A
mul-1-negN/A
associate-*r/N/A
div-add-revN/A
lower-/.f64N/A
Applied rewrites98.5%
if 0.95999999999999996 < F Initial program 57.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 rewrites72.4%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow2N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lower-sqrt.f6472.4
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6472.4
Applied rewrites72.4%
Taylor expanded in F around inf
associate-*r/N/A
div-add-revN/A
lower-/.f64N/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-cos.f64N/A
lower-sin.f6498.3
Applied rewrites98.3%
Final simplification98.7%
(FPCore (F B x)
:precision binary64
(if (<= F -3.1e+154)
(/ (fma (- x) (cos B) -1.0) (sin B))
(if (<= F 3.65e+164)
(- (/ (/ F (sqrt (fma 2.0 x (fma F F 2.0)))) (sin B)) (/ x (tan B)))
(+
(* x (/ -1.0 (tan B)))
(/ (fma -1.0 (/ (+ 1.0 x) (* F F)) 1.0) (sin B))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.1e+154) {
tmp = fma(-x, cos(B), -1.0) / sin(B);
} else if (F <= 3.65e+164) {
tmp = ((F / sqrt(fma(2.0, x, fma(F, F, 2.0)))) / sin(B)) - (x / tan(B));
} else {
tmp = (x * (-1.0 / tan(B))) + (fma(-1.0, ((1.0 + x) / (F * F)), 1.0) / sin(B));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -3.1e+154) tmp = Float64(fma(Float64(-x), cos(B), -1.0) / sin(B)); elseif (F <= 3.65e+164) tmp = Float64(Float64(Float64(F / sqrt(fma(2.0, x, fma(F, F, 2.0)))) / sin(B)) - Float64(x / tan(B))); else tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(fma(-1.0, Float64(Float64(1.0 + x) / Float64(F * F)), 1.0) / sin(B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -3.1e+154], N[(N[((-x) * N[Cos[B], $MachinePrecision] + -1.0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 3.65e+164], N[(N[(N[(F / N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $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[(N[(-1.0 * N[(N[(1.0 + x), $MachinePrecision] / N[(F * F), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.1 \cdot 10^{+154}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-x, \cos B, -1\right)}{\sin B}\\
\mathbf{elif}\;F \leq 3.65 \cdot 10^{+164}:\\
\;\;\;\;\frac{\frac{F}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}}{\sin B} - \frac{x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{\mathsf{fma}\left(-1, \frac{1 + x}{F \cdot F}, 1\right)}{\sin B}\\
\end{array}
\end{array}
if F < -3.1000000000000001e154Initial program 32.2%
Taylor expanded in F around -inf
+-commutativeN/A
distribute-lft-inN/A
associate-*r/N/A
associate-*r/N/A
metadata-evalN/A
div-add-revN/A
lower-/.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-cos.f64N/A
lower-sin.f6499.8
Applied rewrites99.8%
if -3.1000000000000001e154 < F < 3.65000000000000024e164Initial program 94.1%
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
+-commutativeN/A
lift-fma.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lower-sqrt.f6499.6
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6499.6
Applied rewrites99.6%
Applied rewrites99.7%
if 3.65000000000000024e164 < F Initial program 30.6%
Taylor expanded in F around inf
+-commutativeN/A
associate-/r*N/A
associate-*r/N/A
div-add-revN/A
lower-/.f64N/A
Applied rewrites99.6%
Final simplification99.7%
(FPCore (F B x)
:precision binary64
(if (<= F -2e+37)
(/ (fma (- x) (cos B) -1.0) (sin B))
(if (<= F 200000.0)
(- (/ F (* (sqrt (fma x 2.0 (fma F F 2.0))) (sin B))) (/ x (tan B)))
(+
(* x (/ -1.0 (tan B)))
(/ (fma -1.0 (/ (+ 1.0 x) (* F F)) 1.0) (sin B))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -2e+37) {
tmp = fma(-x, cos(B), -1.0) / sin(B);
} else if (F <= 200000.0) {
tmp = (F / (sqrt(fma(x, 2.0, fma(F, F, 2.0))) * sin(B))) - (x / tan(B));
} else {
tmp = (x * (-1.0 / tan(B))) + (fma(-1.0, ((1.0 + x) / (F * F)), 1.0) / sin(B));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -2e+37) tmp = Float64(fma(Float64(-x), cos(B), -1.0) / sin(B)); elseif (F <= 200000.0) tmp = Float64(Float64(F / Float64(sqrt(fma(x, 2.0, fma(F, F, 2.0))) * sin(B))) - Float64(x / tan(B))); else tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(fma(-1.0, Float64(Float64(1.0 + x) / Float64(F * F)), 1.0) / sin(B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -2e+37], N[(N[((-x) * N[Cos[B], $MachinePrecision] + -1.0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 200000.0], N[(N[(F / N[(N[Sqrt[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0 * N[(N[(1.0 + x), $MachinePrecision] / N[(F * F), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -2 \cdot 10^{+37}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-x, \cos B, -1\right)}{\sin B}\\
\mathbf{elif}\;F \leq 200000:\\
\;\;\;\;\frac{F}{\sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)} \cdot \sin B} - \frac{x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{\mathsf{fma}\left(-1, \frac{1 + x}{F \cdot F}, 1\right)}{\sin B}\\
\end{array}
\end{array}
if F < -1.99999999999999991e37Initial program 51.0%
Taylor expanded in F around -inf
+-commutativeN/A
distribute-lft-inN/A
associate-*r/N/A
associate-*r/N/A
metadata-evalN/A
div-add-revN/A
lower-/.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-cos.f64N/A
lower-sin.f6499.8
Applied rewrites99.8%
if -1.99999999999999991e37 < F < 2e5Initial 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.6%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow2N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lower-sqrt.f6499.6
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6499.6
Applied rewrites99.6%
Applied rewrites99.7%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lift-sqrt.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lift-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-fma.f64N/A
lift-fma.f64N/A
lift-sqrt.f6499.7
lift-fma.f64N/A
*-commutativeN/A
lift-fma.f64N/A
lower-fma.f64N/A
lift-fma.f6499.7
Applied rewrites99.7%
if 2e5 < F Initial program 55.9%
Taylor expanded in F around inf
+-commutativeN/A
associate-/r*N/A
associate-*r/N/A
div-add-revN/A
lower-/.f64N/A
Applied rewrites99.6%
Final simplification99.7%
(FPCore (F B x)
:precision binary64
(if (<= F -2e+37)
(/ (fma (- x) (cos B) -1.0) (sin B))
(if (<= F 100000000.0)
(- (/ F (* (sqrt (fma x 2.0 (fma F F 2.0))) (sin B))) (/ x (tan B)))
(/ (fma (- x) (cos B) 1.0) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -2e+37) {
tmp = fma(-x, cos(B), -1.0) / sin(B);
} else if (F <= 100000000.0) {
tmp = (F / (sqrt(fma(x, 2.0, fma(F, F, 2.0))) * sin(B))) - (x / tan(B));
} else {
tmp = fma(-x, cos(B), 1.0) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -2e+37) tmp = Float64(fma(Float64(-x), cos(B), -1.0) / sin(B)); elseif (F <= 100000000.0) tmp = Float64(Float64(F / Float64(sqrt(fma(x, 2.0, fma(F, F, 2.0))) * sin(B))) - Float64(x / tan(B))); else tmp = Float64(fma(Float64(-x), cos(B), 1.0) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -2e+37], N[(N[((-x) * N[Cos[B], $MachinePrecision] + -1.0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 100000000.0], N[(N[(F / N[(N[Sqrt[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-x) * N[Cos[B], $MachinePrecision] + 1.0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -2 \cdot 10^{+37}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-x, \cos B, -1\right)}{\sin B}\\
\mathbf{elif}\;F \leq 100000000:\\
\;\;\;\;\frac{F}{\sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)} \cdot \sin B} - \frac{x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-x, \cos B, 1\right)}{\sin B}\\
\end{array}
\end{array}
if F < -1.99999999999999991e37Initial program 51.0%
Taylor expanded in F around -inf
+-commutativeN/A
distribute-lft-inN/A
associate-*r/N/A
associate-*r/N/A
metadata-evalN/A
div-add-revN/A
lower-/.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-cos.f64N/A
lower-sin.f6499.8
Applied rewrites99.8%
if -1.99999999999999991e37 < F < 1e8Initial 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
+-commutativeN/A
lift-fma.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lower-sqrt.f6499.6
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6499.6
Applied rewrites99.6%
Applied rewrites99.7%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lift-sqrt.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lift-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lift-fma.f64N/A
lift-fma.f64N/A
lift-sqrt.f6499.7
lift-fma.f64N/A
*-commutativeN/A
lift-fma.f64N/A
lower-fma.f64N/A
lift-fma.f6499.7
Applied rewrites99.7%
if 1e8 < F Initial program 55.3%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites70.8%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow2N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lower-sqrt.f6470.8
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6470.8
Applied rewrites70.8%
Taylor expanded in F around inf
associate-*r/N/A
div-add-revN/A
lower-/.f64N/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-cos.f64N/A
lower-sin.f6499.6
Applied rewrites99.6%
(FPCore (F B x)
:precision binary64
(if (<= F -1.4)
(/ (fma (- x) (cos B) -1.0) (sin B))
(if (<= F 0.96)
(+ (* x (/ -1.0 (tan B))) (* (/ F (sin B)) (sqrt 0.5)))
(/ (fma (- x) (cos B) 1.0) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.4) {
tmp = fma(-x, cos(B), -1.0) / sin(B);
} else if (F <= 0.96) {
tmp = (x * (-1.0 / tan(B))) + ((F / sin(B)) * sqrt(0.5));
} else {
tmp = fma(-x, cos(B), 1.0) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.4) tmp = Float64(fma(Float64(-x), cos(B), -1.0) / sin(B)); elseif (F <= 0.96) tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(Float64(F / sin(B)) * sqrt(0.5))); else tmp = Float64(fma(Float64(-x), cos(B), 1.0) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.4], N[(N[((-x) * N[Cos[B], $MachinePrecision] + -1.0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 0.96], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-x) * N[Cos[B], $MachinePrecision] + 1.0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.4:\\
\;\;\;\;\frac{\mathsf{fma}\left(-x, \cos B, -1\right)}{\sin B}\\
\mathbf{elif}\;F \leq 0.96:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{\sin B} \cdot \sqrt{0.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-x, \cos B, 1\right)}{\sin B}\\
\end{array}
\end{array}
if F < -1.3999999999999999Initial program 55.8%
Taylor expanded in F around -inf
+-commutativeN/A
distribute-lft-inN/A
associate-*r/N/A
associate-*r/N/A
metadata-evalN/A
div-add-revN/A
lower-/.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-cos.f64N/A
lower-sin.f6499.4
Applied rewrites99.4%
if -1.3999999999999999 < F < 0.95999999999999996Initial program 99.4%
Taylor expanded in x around 0
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f6499.4
Applied rewrites99.4%
Taylor expanded in F around 0
Applied rewrites98.3%
if 0.95999999999999996 < F Initial program 57.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 rewrites72.4%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow2N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lower-sqrt.f6472.4
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6472.4
Applied rewrites72.4%
Taylor expanded in F around inf
associate-*r/N/A
div-add-revN/A
lower-/.f64N/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-cos.f64N/A
lower-sin.f6498.3
Applied rewrites98.3%
Final simplification98.6%
(FPCore (F B x)
:precision binary64
(if (<= F -0.00115)
(/ (- (- (* (/ 0.5 F) (/ (fma 2.0 x 2.0) F)) 1.0) x) B)
(if (<= F 1e+16)
(/
(fma
(sqrt (pow (+ (fma 2.0 x (* F F)) 2.0) -1.0))
F
(-
(*
(*
(fma
(/ F (sqrt (fma x 2.0 (fma F F 2.0))))
0.16666666666666666
(* 0.3333333333333333 x))
B)
B)
x))
B)
(/
(- (fma (fma 0.3333333333333333 x 0.16666666666666666) (* B B) 1.0) x)
B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -0.00115) {
tmp = ((((0.5 / F) * (fma(2.0, x, 2.0) / F)) - 1.0) - x) / B;
} else if (F <= 1e+16) {
tmp = fma(sqrt(pow((fma(2.0, x, (F * F)) + 2.0), -1.0)), F, (((fma((F / sqrt(fma(x, 2.0, fma(F, F, 2.0)))), 0.16666666666666666, (0.3333333333333333 * x)) * B) * B) - x)) / B;
} else {
tmp = (fma(fma(0.3333333333333333, x, 0.16666666666666666), (B * B), 1.0) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -0.00115) tmp = Float64(Float64(Float64(Float64(Float64(0.5 / F) * Float64(fma(2.0, x, 2.0) / F)) - 1.0) - x) / B); elseif (F <= 1e+16) tmp = Float64(fma(sqrt((Float64(fma(2.0, x, Float64(F * F)) + 2.0) ^ -1.0)), F, Float64(Float64(Float64(fma(Float64(F / sqrt(fma(x, 2.0, fma(F, F, 2.0)))), 0.16666666666666666, Float64(0.3333333333333333 * x)) * B) * B) - x)) / B); else tmp = Float64(Float64(fma(fma(0.3333333333333333, x, 0.16666666666666666), Float64(B * B), 1.0) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -0.00115], N[(N[(N[(N[(N[(0.5 / F), $MachinePrecision] * N[(N[(2.0 * x + 2.0), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 1e+16], N[(N[(N[Sqrt[N[Power[N[(N[(2.0 * x + N[(F * F), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * F + N[(N[(N[(N[(N[(F / N[Sqrt[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.16666666666666666 + N[(0.3333333333333333 * x), $MachinePrecision]), $MachinePrecision] * B), $MachinePrecision] * B), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(N[(0.3333333333333333 * x + 0.16666666666666666), $MachinePrecision] * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -0.00115:\\
\;\;\;\;\frac{\left(\frac{0.5}{F} \cdot \frac{\mathsf{fma}\left(2, x, 2\right)}{F} - 1\right) - x}{B}\\
\mathbf{elif}\;F \leq 10^{+16}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\sqrt{{\left(\mathsf{fma}\left(2, x, F \cdot F\right) + 2\right)}^{-1}}, F, \left(\mathsf{fma}\left(\frac{F}{\sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}, 0.16666666666666666, 0.3333333333333333 \cdot x\right) \cdot B\right) \cdot B - x\right)}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(0.3333333333333333, x, 0.16666666666666666\right), B \cdot B, 1\right) - x}{B}\\
\end{array}
\end{array}
if F < -0.00115Initial program 56.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.f6439.8
Applied rewrites39.8%
Taylor expanded in F around -inf
Applied rewrites50.2%
if -0.00115 < F < 1e16Initial 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.f6450.5
Applied rewrites50.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites50.9%
Applied rewrites51.0%
if 1e16 < F Initial program 54.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.f6438.8
Applied rewrites38.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites39.7%
Taylor expanded in F around inf
Applied rewrites49.9%
Final simplification50.5%
(FPCore (F B x)
:precision binary64
(if (<= F -0.00115)
(/ (- (- (* (/ 0.5 F) (/ (fma 2.0 x 2.0) F)) 1.0) x) B)
(if (<= F 24.5)
(/
(-
(fma
(sqrt (pow (fma F F (fma 2.0 x 2.0)) -1.0))
(fma (* 0.16666666666666666 F) (* B B) F)
(* (* 0.3333333333333333 (* B B)) x))
x)
B)
(/
(- (fma (fma 0.3333333333333333 x 0.16666666666666666) (* B B) 1.0) x)
B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -0.00115) {
tmp = ((((0.5 / F) * (fma(2.0, x, 2.0) / F)) - 1.0) - x) / B;
} else if (F <= 24.5) {
tmp = (fma(sqrt(pow(fma(F, F, fma(2.0, x, 2.0)), -1.0)), fma((0.16666666666666666 * F), (B * B), F), ((0.3333333333333333 * (B * B)) * x)) - x) / B;
} else {
tmp = (fma(fma(0.3333333333333333, x, 0.16666666666666666), (B * B), 1.0) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -0.00115) tmp = Float64(Float64(Float64(Float64(Float64(0.5 / F) * Float64(fma(2.0, x, 2.0) / F)) - 1.0) - x) / B); elseif (F <= 24.5) tmp = Float64(Float64(fma(sqrt((fma(F, F, fma(2.0, x, 2.0)) ^ -1.0)), fma(Float64(0.16666666666666666 * F), Float64(B * B), F), Float64(Float64(0.3333333333333333 * Float64(B * B)) * x)) - x) / B); else tmp = Float64(Float64(fma(fma(0.3333333333333333, x, 0.16666666666666666), Float64(B * B), 1.0) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -0.00115], N[(N[(N[(N[(N[(0.5 / F), $MachinePrecision] * N[(N[(2.0 * x + 2.0), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 24.5], N[(N[(N[(N[Sqrt[N[Power[N[(F * F + N[(2.0 * x + 2.0), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * N[(N[(0.16666666666666666 * F), $MachinePrecision] * N[(B * B), $MachinePrecision] + F), $MachinePrecision] + N[(N[(0.3333333333333333 * N[(B * B), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(N[(0.3333333333333333 * x + 0.16666666666666666), $MachinePrecision] * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -0.00115:\\
\;\;\;\;\frac{\left(\frac{0.5}{F} \cdot \frac{\mathsf{fma}\left(2, x, 2\right)}{F} - 1\right) - x}{B}\\
\mathbf{elif}\;F \leq 24.5:\\
\;\;\;\;\frac{\mathsf{fma}\left(\sqrt{{\left(\mathsf{fma}\left(F, F, \mathsf{fma}\left(2, x, 2\right)\right)\right)}^{-1}}, \mathsf{fma}\left(0.16666666666666666 \cdot F, B \cdot B, F\right), \left(0.3333333333333333 \cdot \left(B \cdot B\right)\right) \cdot x\right) - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(0.3333333333333333, x, 0.16666666666666666\right), B \cdot B, 1\right) - x}{B}\\
\end{array}
\end{array}
if F < -0.00115Initial program 56.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.f6439.8
Applied rewrites39.8%
Taylor expanded in F around -inf
Applied rewrites50.2%
if -0.00115 < F < 24.5Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites51.1%
if 24.5 < F Initial program 56.5%
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.7
Applied rewrites38.7%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites39.5%
Taylor expanded in F around inf
Applied rewrites49.2%
Final simplification50.3%
(FPCore (F B x) :precision binary64 (if (or (<= x -8.6e-14) (not (<= x 2.4e-42))) (/ (- x) (tan B)) (- (/ (/ F (sqrt (fma 2.0 x (fma F F 2.0)))) (sin B)) (/ x B))))
double code(double F, double B, double x) {
double tmp;
if ((x <= -8.6e-14) || !(x <= 2.4e-42)) {
tmp = -x / tan(B);
} else {
tmp = ((F / sqrt(fma(2.0, x, fma(F, F, 2.0)))) / sin(B)) - (x / B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if ((x <= -8.6e-14) || !(x <= 2.4e-42)) tmp = Float64(Float64(-x) / tan(B)); else tmp = Float64(Float64(Float64(F / sqrt(fma(2.0, x, fma(F, F, 2.0)))) / sin(B)) - Float64(x / B)); end return tmp end
code[F_, B_, x_] := If[Or[LessEqual[x, -8.6e-14], N[Not[LessEqual[x, 2.4e-42]], $MachinePrecision]], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision], N[(N[(N[(F / N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.6 \cdot 10^{-14} \lor \neg \left(x \leq 2.4 \cdot 10^{-42}\right):\\
\;\;\;\;\frac{-x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{F}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}}{\sin B} - \frac{x}{B}\\
\end{array}
\end{array}
if x < -8.59999999999999996e-14 or 2.40000000000000003e-42 < x Initial program 81.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites97.7%
Taylor expanded in F around 0
mul-1-negN/A
associate-/l*N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-sin.f6494.2
Applied rewrites94.2%
Applied rewrites94.4%
if -8.59999999999999996e-14 < x < 2.40000000000000003e-42Initial program 70.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 rewrites75.1%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow2N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lower-sqrt.f6475.1
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6475.1
Applied rewrites75.1%
Applied rewrites75.3%
Taylor expanded in B around 0
lower-/.f6464.6
Applied rewrites64.6%
Final simplification77.4%
(FPCore (F B x)
:precision binary64
(if (<= F -3.1e+154)
(/
(- (* (- (* 0.3333333333333333 x) 0.16666666666666666) (* B B)) (+ 1.0 x))
B)
(if (<= F 7.5e+29)
(/ (- (* (sqrt (pow (fma F F 2.0) -1.0)) F) x) B)
(/
(- (fma (fma 0.3333333333333333 x 0.16666666666666666) (* B B) 1.0) x)
B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.1e+154) {
tmp = ((((0.3333333333333333 * x) - 0.16666666666666666) * (B * B)) - (1.0 + x)) / B;
} else if (F <= 7.5e+29) {
tmp = ((sqrt(pow(fma(F, F, 2.0), -1.0)) * F) - x) / B;
} else {
tmp = (fma(fma(0.3333333333333333, x, 0.16666666666666666), (B * B), 1.0) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -3.1e+154) tmp = Float64(Float64(Float64(Float64(Float64(0.3333333333333333 * x) - 0.16666666666666666) * Float64(B * B)) - Float64(1.0 + x)) / B); elseif (F <= 7.5e+29) tmp = Float64(Float64(Float64(sqrt((fma(F, F, 2.0) ^ -1.0)) * F) - x) / B); else tmp = Float64(Float64(fma(fma(0.3333333333333333, x, 0.16666666666666666), Float64(B * B), 1.0) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -3.1e+154], N[(N[(N[(N[(N[(0.3333333333333333 * x), $MachinePrecision] - 0.16666666666666666), $MachinePrecision] * N[(B * B), $MachinePrecision]), $MachinePrecision] - N[(1.0 + x), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 7.5e+29], N[(N[(N[(N[Sqrt[N[Power[N[(F * F + 2.0), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(N[(0.3333333333333333 * x + 0.16666666666666666), $MachinePrecision] * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.1 \cdot 10^{+154}:\\
\;\;\;\;\frac{\left(0.3333333333333333 \cdot x - 0.16666666666666666\right) \cdot \left(B \cdot B\right) - \left(1 + x\right)}{B}\\
\mathbf{elif}\;F \leq 7.5 \cdot 10^{+29}:\\
\;\;\;\;\frac{\sqrt{{\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-1}} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(0.3333333333333333, x, 0.16666666666666666\right), B \cdot B, 1\right) - x}{B}\\
\end{array}
\end{array}
if F < -3.1000000000000001e154Initial program 32.2%
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.f6431.3
Applied rewrites31.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites32.0%
Taylor expanded in F around -inf
Applied rewrites50.5%
if -3.1000000000000001e154 < F < 7.49999999999999945e29Initial program 96.2%
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.f6450.1
Applied rewrites50.1%
Taylor expanded in x around 0
Applied rewrites49.8%
if 7.49999999999999945e29 < F Initial program 54.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.f6439.4
Applied rewrites39.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites40.3%
Taylor expanded in F around inf
Applied rewrites50.6%
Final simplification50.1%
(FPCore (F B x)
:precision binary64
(if (<= F -3.05e-5)
(/ (- -1.0 x) B)
(if (<= F 0.96)
(/ (- (* (sqrt (pow (fma 2.0 x 2.0) -1.0)) F) x) B)
(/
(- (fma (fma 0.3333333333333333 x 0.16666666666666666) (* B B) 1.0) x)
B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.05e-5) {
tmp = (-1.0 - x) / B;
} else if (F <= 0.96) {
tmp = ((sqrt(pow(fma(2.0, x, 2.0), -1.0)) * F) - x) / B;
} else {
tmp = (fma(fma(0.3333333333333333, x, 0.16666666666666666), (B * B), 1.0) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -3.05e-5) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 0.96) tmp = Float64(Float64(Float64(sqrt((fma(2.0, x, 2.0) ^ -1.0)) * F) - x) / B); else tmp = Float64(Float64(fma(fma(0.3333333333333333, x, 0.16666666666666666), Float64(B * B), 1.0) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -3.05e-5], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 0.96], 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[(N[(N[(0.3333333333333333 * x + 0.16666666666666666), $MachinePrecision] * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.05 \cdot 10^{-5}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 0.96:\\
\;\;\;\;\frac{\sqrt{{\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{-1}} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(0.3333333333333333, x, 0.16666666666666666\right), B \cdot B, 1\right) - x}{B}\\
\end{array}
\end{array}
if F < -3.04999999999999994e-5Initial program 57.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.f6439.4
Applied rewrites39.4%
Taylor expanded in F around -inf
Applied rewrites49.6%
if -3.04999999999999994e-5 < F < 0.95999999999999996Initial 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.f6450.4
Applied rewrites50.4%
Taylor expanded in F around 0
Applied rewrites50.1%
if 0.95999999999999996 < F Initial program 57.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.f6440.3
Applied rewrites40.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites41.1%
Taylor expanded in F around inf
Applied rewrites49.6%
Final simplification49.8%
(FPCore (F B x)
:precision binary64
(if (<= F -3e-18)
(/ (- -1.0 x) B)
(if (<= F -4.2e-133)
(/ (* (sqrt (pow (fma F F 2.0) -1.0)) F) B)
(if (<= F 8e-44)
(/ (* (- (* (* B B) 0.3333333333333333) 1.0) x) B)
(/
(- (fma (fma 0.3333333333333333 x 0.16666666666666666) (* B B) 1.0) x)
B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3e-18) {
tmp = (-1.0 - x) / B;
} else if (F <= -4.2e-133) {
tmp = (sqrt(pow(fma(F, F, 2.0), -1.0)) * F) / B;
} else if (F <= 8e-44) {
tmp = ((((B * B) * 0.3333333333333333) - 1.0) * x) / B;
} else {
tmp = (fma(fma(0.3333333333333333, x, 0.16666666666666666), (B * B), 1.0) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -3e-18) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= -4.2e-133) tmp = Float64(Float64(sqrt((fma(F, F, 2.0) ^ -1.0)) * F) / B); elseif (F <= 8e-44) tmp = Float64(Float64(Float64(Float64(Float64(B * B) * 0.3333333333333333) - 1.0) * x) / B); else tmp = Float64(Float64(fma(fma(0.3333333333333333, x, 0.16666666666666666), Float64(B * B), 1.0) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -3e-18], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, -4.2e-133], N[(N[(N[Sqrt[N[Power[N[(F * F + 2.0), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * F), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 8e-44], N[(N[(N[(N[(N[(B * B), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] - 1.0), $MachinePrecision] * x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(N[(0.3333333333333333 * x + 0.16666666666666666), $MachinePrecision] * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3 \cdot 10^{-18}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq -4.2 \cdot 10^{-133}:\\
\;\;\;\;\frac{\sqrt{{\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-1}} \cdot F}{B}\\
\mathbf{elif}\;F \leq 8 \cdot 10^{-44}:\\
\;\;\;\;\frac{\left(\left(B \cdot B\right) \cdot 0.3333333333333333 - 1\right) \cdot x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(0.3333333333333333, x, 0.16666666666666666\right), B \cdot B, 1\right) - x}{B}\\
\end{array}
\end{array}
if F < -2.99999999999999983e-18Initial program 57.6%
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.f6440.2
Applied rewrites40.2%
Taylor expanded in F around -inf
Applied rewrites50.3%
if -2.99999999999999983e-18 < F < -4.2000000000000002e-133Initial 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.f6450.9
Applied rewrites50.9%
Taylor expanded in x around 0
Applied rewrites41.1%
if -4.2000000000000002e-133 < F < 7.99999999999999962e-44Initial program 99.5%
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.f6450.9
Applied rewrites50.9%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites50.9%
Taylor expanded in x around inf
Applied rewrites37.4%
if 7.99999999999999962e-44 < F Initial program 59.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.f6439.6
Applied rewrites39.6%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites40.4%
Taylor expanded in F around inf
Applied rewrites47.4%
Final simplification44.5%
(FPCore (F B x)
:precision binary64
(if (<= F -3e-18)
(/ (- -1.0 x) B)
(if (<= F -4.2e-133)
(* (sqrt (pow (fma F F 2.0) -1.0)) (/ F B))
(if (<= F 8e-44)
(/ (* (- (* (* B B) 0.3333333333333333) 1.0) x) B)
(/
(- (fma (fma 0.3333333333333333 x 0.16666666666666666) (* B B) 1.0) x)
B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3e-18) {
tmp = (-1.0 - x) / B;
} else if (F <= -4.2e-133) {
tmp = sqrt(pow(fma(F, F, 2.0), -1.0)) * (F / B);
} else if (F <= 8e-44) {
tmp = ((((B * B) * 0.3333333333333333) - 1.0) * x) / B;
} else {
tmp = (fma(fma(0.3333333333333333, x, 0.16666666666666666), (B * B), 1.0) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -3e-18) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= -4.2e-133) tmp = Float64(sqrt((fma(F, F, 2.0) ^ -1.0)) * Float64(F / B)); elseif (F <= 8e-44) tmp = Float64(Float64(Float64(Float64(Float64(B * B) * 0.3333333333333333) - 1.0) * x) / B); else tmp = Float64(Float64(fma(fma(0.3333333333333333, x, 0.16666666666666666), Float64(B * B), 1.0) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -3e-18], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, -4.2e-133], N[(N[Sqrt[N[Power[N[(F * F + 2.0), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * N[(F / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 8e-44], N[(N[(N[(N[(N[(B * B), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] - 1.0), $MachinePrecision] * x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(N[(0.3333333333333333 * x + 0.16666666666666666), $MachinePrecision] * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3 \cdot 10^{-18}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq -4.2 \cdot 10^{-133}:\\
\;\;\;\;\sqrt{{\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-1}} \cdot \frac{F}{B}\\
\mathbf{elif}\;F \leq 8 \cdot 10^{-44}:\\
\;\;\;\;\frac{\left(\left(B \cdot B\right) \cdot 0.3333333333333333 - 1\right) \cdot x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(0.3333333333333333, x, 0.16666666666666666\right), B \cdot B, 1\right) - x}{B}\\
\end{array}
\end{array}
if F < -2.99999999999999983e-18Initial program 57.6%
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.f6440.2
Applied rewrites40.2%
Taylor expanded in F around -inf
Applied rewrites50.3%
if -2.99999999999999983e-18 < F < -4.2000000000000002e-133Initial 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.f6450.9
Applied rewrites50.9%
Taylor expanded in x around 0
Applied rewrites41.0%
if -4.2000000000000002e-133 < F < 7.99999999999999962e-44Initial program 99.5%
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.f6450.9
Applied rewrites50.9%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites50.9%
Taylor expanded in x around inf
Applied rewrites37.4%
if 7.99999999999999962e-44 < F Initial program 59.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.f6439.6
Applied rewrites39.6%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites40.4%
Taylor expanded in F around inf
Applied rewrites47.4%
Final simplification44.5%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ F (sqrt (fma x 2.0 (fma F F 2.0))))))
(if (<= B 0.0085)
(/
(-
(fma (* B B) (fma t_0 0.16666666666666666 (* 0.3333333333333333 x)) t_0)
x)
B)
(/ (- x) (tan B)))))
double code(double F, double B, double x) {
double t_0 = F / sqrt(fma(x, 2.0, fma(F, F, 2.0)));
double tmp;
if (B <= 0.0085) {
tmp = (fma((B * B), fma(t_0, 0.16666666666666666, (0.3333333333333333 * x)), t_0) - x) / B;
} else {
tmp = -x / tan(B);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(F / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) tmp = 0.0 if (B <= 0.0085) tmp = Float64(Float64(fma(Float64(B * B), fma(t_0, 0.16666666666666666, Float64(0.3333333333333333 * x)), t_0) - x) / B); else tmp = Float64(Float64(-x) / tan(B)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(F / N[Sqrt[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 0.0085], N[(N[(N[(N[(B * B), $MachinePrecision] * N[(t$95$0 * 0.16666666666666666 + N[(0.3333333333333333 * x), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{F}{\sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}\\
\mathbf{if}\;B \leq 0.0085:\\
\;\;\;\;\frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(t\_0, 0.16666666666666666, 0.3333333333333333 \cdot x\right), t\_0\right) - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{\tan B}\\
\end{array}
\end{array}
if B < 0.0085000000000000006Initial program 72.2%
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.f6461.0
Applied rewrites61.0%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites61.3%
Applied rewrites61.3%
if 0.0085000000000000006 < B Initial program 82.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 rewrites82.8%
Taylor expanded in F around 0
mul-1-negN/A
associate-/l*N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f64N/A
lower-cos.f64N/A
lower-sin.f6455.7
Applied rewrites55.7%
Applied rewrites55.7%
Final simplification59.7%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ F (sqrt (fma x 2.0 (fma F F 2.0))))))
(if (<= F -0.00115)
(/ (- (- (* (/ 0.5 F) (/ (fma 2.0 x 2.0) F)) 1.0) x) B)
(if (<= F 24.5)
(/
(-
(fma
(* B B)
(fma t_0 0.16666666666666666 (* 0.3333333333333333 x))
t_0)
x)
B)
(/
(- (fma (fma 0.3333333333333333 x 0.16666666666666666) (* B B) 1.0) x)
B)))))
double code(double F, double B, double x) {
double t_0 = F / sqrt(fma(x, 2.0, fma(F, F, 2.0)));
double tmp;
if (F <= -0.00115) {
tmp = ((((0.5 / F) * (fma(2.0, x, 2.0) / F)) - 1.0) - x) / B;
} else if (F <= 24.5) {
tmp = (fma((B * B), fma(t_0, 0.16666666666666666, (0.3333333333333333 * x)), t_0) - x) / B;
} else {
tmp = (fma(fma(0.3333333333333333, x, 0.16666666666666666), (B * B), 1.0) - x) / B;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(F / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) tmp = 0.0 if (F <= -0.00115) tmp = Float64(Float64(Float64(Float64(Float64(0.5 / F) * Float64(fma(2.0, x, 2.0) / F)) - 1.0) - x) / B); elseif (F <= 24.5) tmp = Float64(Float64(fma(Float64(B * B), fma(t_0, 0.16666666666666666, Float64(0.3333333333333333 * x)), t_0) - x) / B); else tmp = Float64(Float64(fma(fma(0.3333333333333333, x, 0.16666666666666666), Float64(B * B), 1.0) - x) / B); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(F / N[Sqrt[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -0.00115], N[(N[(N[(N[(N[(0.5 / F), $MachinePrecision] * N[(N[(2.0 * x + 2.0), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 24.5], N[(N[(N[(N[(B * B), $MachinePrecision] * N[(t$95$0 * 0.16666666666666666 + N[(0.3333333333333333 * x), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(N[(0.3333333333333333 * x + 0.16666666666666666), $MachinePrecision] * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{F}{\sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}\\
\mathbf{if}\;F \leq -0.00115:\\
\;\;\;\;\frac{\left(\frac{0.5}{F} \cdot \frac{\mathsf{fma}\left(2, x, 2\right)}{F} - 1\right) - x}{B}\\
\mathbf{elif}\;F \leq 24.5:\\
\;\;\;\;\frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(t\_0, 0.16666666666666666, 0.3333333333333333 \cdot x\right), t\_0\right) - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(0.3333333333333333, x, 0.16666666666666666\right), B \cdot B, 1\right) - x}{B}\\
\end{array}
\end{array}
if F < -0.00115Initial program 56.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.f6439.8
Applied rewrites39.8%
Taylor expanded in F around -inf
Applied rewrites50.2%
if -0.00115 < F < 24.5Initial 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.f6451.0
Applied rewrites51.0%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites51.3%
Applied rewrites51.4%
if 24.5 < F Initial program 56.5%
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.7
Applied rewrites38.7%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites39.5%
Taylor expanded in F around inf
Applied rewrites49.2%
(FPCore (F B x)
:precision binary64
(if (<= F -3.1e+154)
(/
(- (* (- (* 0.3333333333333333 x) 0.16666666666666666) (* B B)) (+ 1.0 x))
B)
(if (<= F 7.5e+29)
(/ (- (/ F (sqrt (fma x 2.0 (fma F F 2.0)))) x) B)
(/
(- (fma (fma 0.3333333333333333 x 0.16666666666666666) (* B B) 1.0) x)
B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.1e+154) {
tmp = ((((0.3333333333333333 * x) - 0.16666666666666666) * (B * B)) - (1.0 + x)) / B;
} else if (F <= 7.5e+29) {
tmp = ((F / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) - x) / B;
} else {
tmp = (fma(fma(0.3333333333333333, x, 0.16666666666666666), (B * B), 1.0) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -3.1e+154) tmp = Float64(Float64(Float64(Float64(Float64(0.3333333333333333 * x) - 0.16666666666666666) * Float64(B * B)) - Float64(1.0 + x)) / B); elseif (F <= 7.5e+29) tmp = Float64(Float64(Float64(F / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) - x) / B); else tmp = Float64(Float64(fma(fma(0.3333333333333333, x, 0.16666666666666666), Float64(B * B), 1.0) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -3.1e+154], N[(N[(N[(N[(N[(0.3333333333333333 * x), $MachinePrecision] - 0.16666666666666666), $MachinePrecision] * N[(B * B), $MachinePrecision]), $MachinePrecision] - N[(1.0 + x), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 7.5e+29], 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[(N[(N[(0.3333333333333333 * x + 0.16666666666666666), $MachinePrecision] * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.1 \cdot 10^{+154}:\\
\;\;\;\;\frac{\left(0.3333333333333333 \cdot x - 0.16666666666666666\right) \cdot \left(B \cdot B\right) - \left(1 + x\right)}{B}\\
\mathbf{elif}\;F \leq 7.5 \cdot 10^{+29}:\\
\;\;\;\;\frac{\frac{F}{\sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}} - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(0.3333333333333333, x, 0.16666666666666666\right), B \cdot B, 1\right) - x}{B}\\
\end{array}
\end{array}
if F < -3.1000000000000001e154Initial program 32.2%
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.f6431.3
Applied rewrites31.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites32.0%
Taylor expanded in F around -inf
Applied rewrites50.5%
if -3.1000000000000001e154 < F < 7.49999999999999945e29Initial program 96.2%
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.f6450.1
Applied rewrites50.1%
Applied rewrites50.1%
Applied rewrites50.1%
if 7.49999999999999945e29 < F Initial program 54.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.f6439.4
Applied rewrites39.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites40.3%
Taylor expanded in F around inf
Applied rewrites50.6%
(FPCore (F B x)
:precision binary64
(if (<= F -3.1e+154)
(/
(- (* (- (* 0.3333333333333333 x) 0.16666666666666666) (* B B)) (+ 1.0 x))
B)
(if (<= F 7.5e+29)
(/ (- (/ F (sqrt (fma F F 2.0))) x) B)
(/
(- (fma (fma 0.3333333333333333 x 0.16666666666666666) (* B B) 1.0) x)
B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.1e+154) {
tmp = ((((0.3333333333333333 * x) - 0.16666666666666666) * (B * B)) - (1.0 + x)) / B;
} else if (F <= 7.5e+29) {
tmp = ((F / sqrt(fma(F, F, 2.0))) - x) / B;
} else {
tmp = (fma(fma(0.3333333333333333, x, 0.16666666666666666), (B * B), 1.0) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -3.1e+154) tmp = Float64(Float64(Float64(Float64(Float64(0.3333333333333333 * x) - 0.16666666666666666) * Float64(B * B)) - Float64(1.0 + x)) / B); elseif (F <= 7.5e+29) tmp = Float64(Float64(Float64(F / sqrt(fma(F, F, 2.0))) - x) / B); else tmp = Float64(Float64(fma(fma(0.3333333333333333, x, 0.16666666666666666), Float64(B * B), 1.0) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -3.1e+154], N[(N[(N[(N[(N[(0.3333333333333333 * x), $MachinePrecision] - 0.16666666666666666), $MachinePrecision] * N[(B * B), $MachinePrecision]), $MachinePrecision] - N[(1.0 + x), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 7.5e+29], N[(N[(N[(F / N[Sqrt[N[(F * F + 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(N[(0.3333333333333333 * x + 0.16666666666666666), $MachinePrecision] * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.1 \cdot 10^{+154}:\\
\;\;\;\;\frac{\left(0.3333333333333333 \cdot x - 0.16666666666666666\right) \cdot \left(B \cdot B\right) - \left(1 + x\right)}{B}\\
\mathbf{elif}\;F \leq 7.5 \cdot 10^{+29}:\\
\;\;\;\;\frac{\frac{F}{\sqrt{\mathsf{fma}\left(F, F, 2\right)}} - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(0.3333333333333333, x, 0.16666666666666666\right), B \cdot B, 1\right) - x}{B}\\
\end{array}
\end{array}
if F < -3.1000000000000001e154Initial program 32.2%
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.f6431.3
Applied rewrites31.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites32.0%
Taylor expanded in F around -inf
Applied rewrites50.5%
if -3.1000000000000001e154 < F < 7.49999999999999945e29Initial program 96.2%
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.f6450.1
Applied rewrites50.1%
Applied rewrites50.1%
Taylor expanded in x around 0
Applied rewrites49.9%
if 7.49999999999999945e29 < F Initial program 54.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.f6439.4
Applied rewrites39.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites40.3%
Taylor expanded in F around inf
Applied rewrites50.6%
Final simplification50.2%
(FPCore (F B x)
:precision binary64
(if (<= F -3.3e-93)
(/ (- -1.0 x) B)
(if (<= F 8e-44)
(/ (* (- (* (* B B) 0.3333333333333333) 1.0) x) B)
(/
(- (fma (fma 0.3333333333333333 x 0.16666666666666666) (* B B) 1.0) x)
B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.3e-93) {
tmp = (-1.0 - x) / B;
} else if (F <= 8e-44) {
tmp = ((((B * B) * 0.3333333333333333) - 1.0) * x) / B;
} else {
tmp = (fma(fma(0.3333333333333333, x, 0.16666666666666666), (B * B), 1.0) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -3.3e-93) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 8e-44) tmp = Float64(Float64(Float64(Float64(Float64(B * B) * 0.3333333333333333) - 1.0) * x) / B); else tmp = Float64(Float64(fma(fma(0.3333333333333333, x, 0.16666666666666666), Float64(B * B), 1.0) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -3.3e-93], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 8e-44], N[(N[(N[(N[(N[(B * B), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] - 1.0), $MachinePrecision] * x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(N[(0.3333333333333333 * x + 0.16666666666666666), $MachinePrecision] * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.3 \cdot 10^{-93}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 8 \cdot 10^{-44}:\\
\;\;\;\;\frac{\left(\left(B \cdot B\right) \cdot 0.3333333333333333 - 1\right) \cdot x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(0.3333333333333333, x, 0.16666666666666666\right), B \cdot B, 1\right) - x}{B}\\
\end{array}
\end{array}
if F < -3.3000000000000001e-93Initial program 65.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.7
Applied rewrites41.7%
Taylor expanded in F around -inf
Applied rewrites42.9%
if -3.3000000000000001e-93 < F < 7.99999999999999962e-44Initial 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.f6451.4
Applied rewrites51.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites51.8%
Taylor expanded in x around inf
Applied rewrites37.1%
if 7.99999999999999962e-44 < F Initial program 59.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.f6439.6
Applied rewrites39.6%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites40.4%
Taylor expanded in F around inf
Applied rewrites47.4%
(FPCore (F B x)
:precision binary64
(if (<= F -3.3e-93)
(/ (- -1.0 x) B)
(if (<= F 1.56e-24)
(/ (* (- (* (* B B) 0.3333333333333333) 1.0) x) B)
(/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.3e-93) {
tmp = (-1.0 - x) / B;
} else if (F <= 1.56e-24) {
tmp = ((((B * B) * 0.3333333333333333) - 1.0) * 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 <= (-3.3d-93)) then
tmp = ((-1.0d0) - x) / b
else if (f <= 1.56d-24) then
tmp = ((((b * b) * 0.3333333333333333d0) - 1.0d0) * 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 <= -3.3e-93) {
tmp = (-1.0 - x) / B;
} else if (F <= 1.56e-24) {
tmp = ((((B * B) * 0.3333333333333333) - 1.0) * x) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -3.3e-93: tmp = (-1.0 - x) / B elif F <= 1.56e-24: tmp = ((((B * B) * 0.3333333333333333) - 1.0) * x) / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -3.3e-93) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 1.56e-24) tmp = Float64(Float64(Float64(Float64(Float64(B * B) * 0.3333333333333333) - 1.0) * 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 <= -3.3e-93) tmp = (-1.0 - x) / B; elseif (F <= 1.56e-24) tmp = ((((B * B) * 0.3333333333333333) - 1.0) * x) / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -3.3e-93], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 1.56e-24], N[(N[(N[(N[(N[(B * B), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] - 1.0), $MachinePrecision] * x), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.3 \cdot 10^{-93}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 1.56 \cdot 10^{-24}:\\
\;\;\;\;\frac{\left(\left(B \cdot B\right) \cdot 0.3333333333333333 - 1\right) \cdot x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -3.3000000000000001e-93Initial program 65.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.7
Applied rewrites41.7%
Taylor expanded in F around -inf
Applied rewrites42.9%
if -3.3000000000000001e-93 < F < 1.56e-24Initial 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.f6449.7
Applied rewrites49.7%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites50.2%
Taylor expanded in x around inf
Applied rewrites35.9%
if 1.56e-24 < F Initial program 58.2%
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 inf
Applied rewrites48.4%
(FPCore (F B x) :precision binary64 (if (<= F -3.3e-93) (/ (- -1.0 x) B) (if (<= F 2.2e-34) (/ (- x) B) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.3e-93) {
tmp = (-1.0 - x) / B;
} else if (F <= 2.2e-34) {
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 <= (-3.3d-93)) then
tmp = ((-1.0d0) - x) / b
else if (f <= 2.2d-34) 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 <= -3.3e-93) {
tmp = (-1.0 - x) / B;
} else if (F <= 2.2e-34) {
tmp = -x / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -3.3e-93: tmp = (-1.0 - x) / B elif F <= 2.2e-34: tmp = -x / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -3.3e-93) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 2.2e-34) 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 <= -3.3e-93) tmp = (-1.0 - x) / B; elseif (F <= 2.2e-34) tmp = -x / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -3.3e-93], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 2.2e-34], N[((-x) / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.3 \cdot 10^{-93}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 2.2 \cdot 10^{-34}:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -3.3000000000000001e-93Initial program 65.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.7
Applied rewrites41.7%
Taylor expanded in F around -inf
Applied rewrites42.9%
if -3.3000000000000001e-93 < F < 2.1999999999999999e-34Initial 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.f6450.8
Applied rewrites50.8%
Taylor expanded in F around 0
Applied rewrites36.2%
if 2.1999999999999999e-34 < F Initial program 59.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.f6440.1
Applied rewrites40.1%
Taylor expanded in F around inf
Applied rewrites47.2%
(FPCore (F B x) :precision binary64 (if (<= F -3.3e-93) (/ (- -1.0 x) B) (/ (- x) B)))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.3e-93) {
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 <= (-3.3d-93)) 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 <= -3.3e-93) {
tmp = (-1.0 - x) / B;
} else {
tmp = -x / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -3.3e-93: tmp = (-1.0 - x) / B else: tmp = -x / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -3.3e-93) 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 <= -3.3e-93) tmp = (-1.0 - x) / B; else tmp = -x / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -3.3e-93], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], N[((-x) / B), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.3 \cdot 10^{-93}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{B}\\
\end{array}
\end{array}
if F < -3.3000000000000001e-93Initial program 65.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.7
Applied rewrites41.7%
Taylor expanded in F around -inf
Applied rewrites42.9%
if -3.3000000000000001e-93 < F Initial program 80.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.f6445.8
Applied rewrites45.8%
Taylor expanded in F around 0
Applied rewrites29.5%
(FPCore (F B x) :precision binary64 (/ (- x) B))
double code(double F, double B, double x) {
return -x / B;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = -x / b
end function
public static double code(double F, double B, double x) {
return -x / B;
}
def code(F, B, x): return -x / B
function code(F, B, x) return Float64(Float64(-x) / B) end
function tmp = code(F, B, x) tmp = -x / B; end
code[F_, B_, x_] := N[((-x) / B), $MachinePrecision]
\begin{array}{l}
\\
\frac{-x}{B}
\end{array}
Initial program 75.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.f6444.4
Applied rewrites44.4%
Taylor expanded in F around 0
Applied rewrites27.0%
herbie shell --seed 2024354
(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))))))