
(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 24 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 -37000000.0)
(/ (fma (- x) (cos B) -1.0) (sin B))
(if (<= F 1.9e-10)
(fma (pow (fma 2.0 x (fma F F 2.0)) -0.5) (/ F (sin B)) (/ (- x) (tan B)))
(/ (- 1.0 (* x (cos B))) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -37000000.0) {
tmp = fma(-x, cos(B), -1.0) / sin(B);
} else if (F <= 1.9e-10) {
tmp = fma(pow(fma(2.0, x, fma(F, F, 2.0)), -0.5), (F / sin(B)), (-x / tan(B)));
} else {
tmp = (1.0 - (x * cos(B))) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -37000000.0) tmp = Float64(fma(Float64(-x), cos(B), -1.0) / sin(B)); elseif (F <= 1.9e-10) tmp = fma((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5), Float64(F / sin(B)), Float64(Float64(-x) / tan(B))); else tmp = Float64(Float64(1.0 - Float64(x * cos(B))) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -37000000.0], N[(N[((-x) * N[Cos[B], $MachinePrecision] + -1.0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.9e-10], N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -37000000:\\
\;\;\;\;\frac{\mathsf{fma}\left(-x, \cos B, -1\right)}{\sin B}\\
\mathbf{elif}\;F \leq 1.9 \cdot 10^{-10}:\\
\;\;\;\;\mathsf{fma}\left({\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}, \frac{F}{\sin B}, \frac{-x}{\tan B}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x \cdot \cos B}{\sin B}\\
\end{array}
\end{array}
if F < -3.7e7Initial program 53.9%
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.7e7 < F < 1.8999999999999999e-10Initial program 99.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.6
Applied rewrites99.7%
if 1.8999999999999999e-10 < F Initial program 56.6%
Taylor expanded in F around inf
associate-/l*N/A
fp-cancel-sub-sign-invN/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
lower-+.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-cos.f64N/A
lower-sin.f6499.9
Applied rewrites99.9%
Final simplification99.8%
(FPCore (F B x)
:precision binary64
(if (<= F -920000000.0)
(/ (fma (- x) (cos B) -1.0) (sin B))
(if (<= F 1.9e-10)
(fma F (/ (sqrt (pow (fma F F 2.0) -1.0)) (sin B)) (/ (- x) (tan B)))
(/ (- 1.0 (* x (cos B))) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -920000000.0) {
tmp = fma(-x, cos(B), -1.0) / sin(B);
} else if (F <= 1.9e-10) {
tmp = fma(F, (sqrt(pow(fma(F, F, 2.0), -1.0)) / sin(B)), (-x / tan(B)));
} else {
tmp = (1.0 - (x * cos(B))) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -920000000.0) tmp = Float64(fma(Float64(-x), cos(B), -1.0) / sin(B)); elseif (F <= 1.9e-10) tmp = fma(F, Float64(sqrt((fma(F, F, 2.0) ^ -1.0)) / sin(B)), Float64(Float64(-x) / tan(B))); else tmp = Float64(Float64(1.0 - Float64(x * cos(B))) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -920000000.0], N[(N[((-x) * N[Cos[B], $MachinePrecision] + -1.0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.9e-10], N[(F * N[(N[Sqrt[N[Power[N[(F * F + 2.0), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -920000000:\\
\;\;\;\;\frac{\mathsf{fma}\left(-x, \cos B, -1\right)}{\sin B}\\
\mathbf{elif}\;F \leq 1.9 \cdot 10^{-10}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{\sqrt{{\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-1}}}{\sin B}, \frac{-x}{\tan B}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x \cdot \cos B}{\sin B}\\
\end{array}
\end{array}
if F < -9.2e8Initial program 52.6%
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 -9.2e8 < F < 1.8999999999999999e-10Initial 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%
Taylor expanded in x around 0
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f6499.6
Applied rewrites99.6%
if 1.8999999999999999e-10 < F Initial program 56.6%
Taylor expanded in F around inf
associate-/l*N/A
fp-cancel-sub-sign-invN/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
lower-+.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-cos.f64N/A
lower-sin.f6499.9
Applied rewrites99.9%
Final simplification99.8%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (sqrt (pow (fma F F (fma 2.0 x 2.0)) -1.0))))
(if (<= B 0.8)
(/
(-
(fma
t_0
(fma (* 0.16666666666666666 F) (* B B) F)
(*
(fma
(fma (* (- -0.019444444444444445) F) t_0 (* 0.022222222222222223 x))
(* B B)
(* 0.3333333333333333 x))
(* B B)))
x)
B)
(+ (* x (/ -1.0 (tan B))) (pow B -1.0)))))
double code(double F, double B, double x) {
double t_0 = sqrt(pow(fma(F, F, fma(2.0, x, 2.0)), -1.0));
double tmp;
if (B <= 0.8) {
tmp = (fma(t_0, fma((0.16666666666666666 * F), (B * B), F), (fma(fma((-(-0.019444444444444445) * F), t_0, (0.022222222222222223 * x)), (B * B), (0.3333333333333333 * x)) * (B * B))) - x) / B;
} else {
tmp = (x * (-1.0 / tan(B))) + pow(B, -1.0);
}
return tmp;
}
function code(F, B, x) t_0 = sqrt((fma(F, F, fma(2.0, x, 2.0)) ^ -1.0)) tmp = 0.0 if (B <= 0.8) tmp = Float64(Float64(fma(t_0, fma(Float64(0.16666666666666666 * F), Float64(B * B), F), Float64(fma(fma(Float64(Float64(-(-0.019444444444444445)) * F), t_0, Float64(0.022222222222222223 * x)), Float64(B * B), Float64(0.3333333333333333 * x)) * Float64(B * B))) - x) / B); else tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + (B ^ -1.0)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[Sqrt[N[Power[N[(F * F + N[(2.0 * x + 2.0), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[B, 0.8], N[(N[(N[(t$95$0 * N[(N[(0.16666666666666666 * F), $MachinePrecision] * N[(B * B), $MachinePrecision] + F), $MachinePrecision] + N[(N[(N[(N[((--0.019444444444444445) * F), $MachinePrecision] * t$95$0 + N[(0.022222222222222223 * x), $MachinePrecision]), $MachinePrecision] * N[(B * B), $MachinePrecision] + N[(0.3333333333333333 * x), $MachinePrecision]), $MachinePrecision] * N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[B, -1.0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{{\left(\mathsf{fma}\left(F, F, \mathsf{fma}\left(2, x, 2\right)\right)\right)}^{-1}}\\
\mathbf{if}\;B \leq 0.8:\\
\;\;\;\;\frac{\mathsf{fma}\left(t\_0, \mathsf{fma}\left(0.16666666666666666 \cdot F, B \cdot B, F\right), \mathsf{fma}\left(\mathsf{fma}\left(\left(--0.019444444444444445\right) \cdot F, t\_0, 0.022222222222222223 \cdot x\right), B \cdot B, 0.3333333333333333 \cdot x\right) \cdot \left(B \cdot B\right)\right) - x}{B}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + {B}^{-1}\\
\end{array}
\end{array}
if B < 0.80000000000000004Initial program 70.2%
Taylor expanded in B around 0
Applied rewrites65.1%
if 0.80000000000000004 < B Initial program 84.0%
Taylor expanded in B around 0
lower-*.f64N/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.f6457.4
Applied rewrites57.4%
Taylor expanded in F around inf
Applied rewrites54.4%
Final simplification62.5%
(FPCore (F B x)
:precision binary64
(if (<= F -1.75)
(/ (fma (- x) (cos B) -1.0) (sin B))
(if (<= F 1.9e-10)
(fma
F
(/ (sqrt (pow (fma (+ 1.0 x) 2.0 (* F F)) -1.0)) B)
(/ (- x) (tan B)))
(/ (- 1.0 (* x (cos B))) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.75) {
tmp = fma(-x, cos(B), -1.0) / sin(B);
} else if (F <= 1.9e-10) {
tmp = fma(F, (sqrt(pow(fma((1.0 + x), 2.0, (F * F)), -1.0)) / B), (-x / tan(B)));
} else {
tmp = (1.0 - (x * cos(B))) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.75) tmp = Float64(fma(Float64(-x), cos(B), -1.0) / sin(B)); elseif (F <= 1.9e-10) tmp = fma(F, Float64(sqrt((fma(Float64(1.0 + x), 2.0, Float64(F * F)) ^ -1.0)) / B), Float64(Float64(-x) / tan(B))); else tmp = Float64(Float64(1.0 - Float64(x * cos(B))) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.75], N[(N[((-x) * N[Cos[B], $MachinePrecision] + -1.0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.9e-10], N[(F * N[(N[Sqrt[N[Power[N[(N[(1.0 + x), $MachinePrecision] * 2.0 + N[(F * F), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] / B), $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.75:\\
\;\;\;\;\frac{\mathsf{fma}\left(-x, \cos B, -1\right)}{\sin B}\\
\mathbf{elif}\;F \leq 1.9 \cdot 10^{-10}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{\sqrt{{\left(\mathsf{fma}\left(1 + x, 2, F \cdot F\right)\right)}^{-1}}}{B}, \frac{-x}{\tan B}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x \cdot \cos B}{\sin B}\\
\end{array}
\end{array}
if F < -1.75Initial program 55.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.f6498.7
Applied rewrites98.7%
if -1.75 < F < 1.8999999999999999e-10Initial 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%
Taylor expanded in x around 0
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f6499.6
Applied rewrites99.6%
Taylor expanded in B around 0
associate-*l/N/A
*-lft-identityN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
*-commutativeN/A
distribute-rgt1-inN/A
+-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f6488.5
Applied rewrites88.5%
if 1.8999999999999999e-10 < F Initial program 56.6%
Taylor expanded in F around inf
associate-/l*N/A
fp-cancel-sub-sign-invN/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
lower-+.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-cos.f64N/A
lower-sin.f6499.9
Applied rewrites99.9%
Final simplification95.0%
(FPCore (F B x)
:precision binary64
(if (<= F -1.75)
(/ (fma (- x) (cos B) -1.0) (sin B))
(if (<= F 1.46e+32)
(fma
F
(/ (sqrt (pow (fma (+ 1.0 x) 2.0 (* F F)) -1.0)) B)
(/ (- x) (tan B)))
(/ (fma -1.0 x 1.0) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.75) {
tmp = fma(-x, cos(B), -1.0) / sin(B);
} else if (F <= 1.46e+32) {
tmp = fma(F, (sqrt(pow(fma((1.0 + x), 2.0, (F * F)), -1.0)) / B), (-x / tan(B)));
} else {
tmp = fma(-1.0, x, 1.0) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.75) tmp = Float64(fma(Float64(-x), cos(B), -1.0) / sin(B)); elseif (F <= 1.46e+32) tmp = fma(F, Float64(sqrt((fma(Float64(1.0 + x), 2.0, Float64(F * F)) ^ -1.0)) / B), Float64(Float64(-x) / tan(B))); else tmp = Float64(fma(-1.0, x, 1.0) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.75], N[(N[((-x) * N[Cos[B], $MachinePrecision] + -1.0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.46e+32], N[(F * N[(N[Sqrt[N[Power[N[(N[(1.0 + x), $MachinePrecision] * 2.0 + N[(F * F), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] / B), $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 * x + 1.0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.75:\\
\;\;\;\;\frac{\mathsf{fma}\left(-x, \cos B, -1\right)}{\sin B}\\
\mathbf{elif}\;F \leq 1.46 \cdot 10^{+32}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{\sqrt{{\left(\mathsf{fma}\left(1 + x, 2, F \cdot F\right)\right)}^{-1}}}{B}, \frac{-x}{\tan B}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-1, x, 1\right)}{\sin B}\\
\end{array}
\end{array}
if F < -1.75Initial program 55.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.f6498.7
Applied rewrites98.7%
if -1.75 < F < 1.46000000000000005e32Initial 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%
Taylor expanded in x around 0
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f6499.6
Applied rewrites99.6%
Taylor expanded in B around 0
associate-*l/N/A
*-lft-identityN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
*-commutativeN/A
distribute-rgt1-inN/A
+-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f6489.1
Applied rewrites89.1%
if 1.46000000000000005e32 < F Initial program 53.2%
Taylor expanded in F around inf
associate-/l*N/A
fp-cancel-sub-sign-invN/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
lower-+.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-cos.f64N/A
lower-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in B around 0
Applied rewrites87.2%
Final simplification91.3%
(FPCore (F B x)
:precision binary64
(if (<= F -6.3e+87)
(+ (- (/ x B)) (/ -1.0 (sin B)))
(if (<= F 1.46e+32)
(fma
F
(/ (sqrt (pow (fma (+ 1.0 x) 2.0 (* F F)) -1.0)) B)
(/ (- x) (tan B)))
(/ (fma -1.0 x 1.0) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -6.3e+87) {
tmp = -(x / B) + (-1.0 / sin(B));
} else if (F <= 1.46e+32) {
tmp = fma(F, (sqrt(pow(fma((1.0 + x), 2.0, (F * F)), -1.0)) / B), (-x / tan(B)));
} else {
tmp = fma(-1.0, x, 1.0) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -6.3e+87) tmp = Float64(Float64(-Float64(x / B)) + Float64(-1.0 / sin(B))); elseif (F <= 1.46e+32) tmp = fma(F, Float64(sqrt((fma(Float64(1.0 + x), 2.0, Float64(F * F)) ^ -1.0)) / B), Float64(Float64(-x) / tan(B))); else tmp = Float64(fma(-1.0, x, 1.0) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -6.3e+87], N[((-N[(x / B), $MachinePrecision]) + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.46e+32], N[(F * N[(N[Sqrt[N[Power[N[(N[(1.0 + x), $MachinePrecision] * 2.0 + N[(F * F), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] / B), $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 * x + 1.0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -6.3 \cdot 10^{+87}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 1.46 \cdot 10^{+32}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{\sqrt{{\left(\mathsf{fma}\left(1 + x, 2, F \cdot F\right)\right)}^{-1}}}{B}, \frac{-x}{\tan B}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-1, x, 1\right)}{\sin B}\\
\end{array}
\end{array}
if F < -6.3e87Initial program 41.7%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6437.2
Applied rewrites37.2%
Taylor expanded in B around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6419.5
Applied rewrites19.5%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6468.5
Applied rewrites68.5%
Taylor expanded in B around 0
lower-/.f6481.9
Applied rewrites81.9%
if -6.3e87 < F < 1.46000000000000005e32Initial program 98.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites99.6%
Taylor expanded in x around 0
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f6499.6
Applied rewrites99.6%
Taylor expanded in B around 0
associate-*l/N/A
*-lft-identityN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
*-commutativeN/A
distribute-rgt1-inN/A
+-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f6487.0
Applied rewrites87.0%
if 1.46000000000000005e32 < F Initial program 53.2%
Taylor expanded in F around inf
associate-/l*N/A
fp-cancel-sub-sign-invN/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
lower-+.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-cos.f64N/A
lower-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in B around 0
Applied rewrites87.2%
Final simplification86.0%
(FPCore (F B x)
:precision binary64
(if (<= F -2e+18)
(+ (- (/ x B)) (/ -1.0 (sin B)))
(if (<= F 1.46e+32)
(+
(/ (- x) (tan B))
(* (/ F B) (sqrt (pow (fma F F (fma 2.0 x 2.0)) -1.0))))
(/ (fma -1.0 x 1.0) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -2e+18) {
tmp = -(x / B) + (-1.0 / sin(B));
} else if (F <= 1.46e+32) {
tmp = (-x / tan(B)) + ((F / B) * sqrt(pow(fma(F, F, fma(2.0, x, 2.0)), -1.0)));
} else {
tmp = fma(-1.0, x, 1.0) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -2e+18) tmp = Float64(Float64(-Float64(x / B)) + Float64(-1.0 / sin(B))); elseif (F <= 1.46e+32) tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(Float64(F / B) * sqrt((fma(F, F, fma(2.0, x, 2.0)) ^ -1.0)))); else tmp = Float64(fma(-1.0, x, 1.0) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -2e+18], N[((-N[(x / B), $MachinePrecision]) + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.46e+32], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(N[(F / B), $MachinePrecision] * N[Sqrt[N[Power[N[(F * F + N[(2.0 * x + 2.0), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 * x + 1.0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -2 \cdot 10^{+18}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 1.46 \cdot 10^{+32}:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{F}{B} \cdot \sqrt{{\left(\mathsf{fma}\left(F, F, \mathsf{fma}\left(2, x, 2\right)\right)\right)}^{-1}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-1, x, 1\right)}{\sin B}\\
\end{array}
\end{array}
if F < -2e18Initial program 51.2%
Taylor expanded in B around 0
lower-*.f64N/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.9
Applied rewrites41.9%
Taylor expanded in B around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6421.8
Applied rewrites21.8%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6466.2
Applied rewrites66.2%
Taylor expanded in B around 0
lower-/.f6479.2
Applied rewrites79.2%
if -2e18 < F < 1.46000000000000005e32Initial program 99.5%
Taylor expanded in B around 0
lower-*.f64N/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.f6488.7
Applied rewrites88.7%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-rgt-identityN/A
distribute-frac-negN/A
lift-neg.f64N/A
lift-/.f6488.8
Applied rewrites88.8%
if 1.46000000000000005e32 < F Initial program 53.2%
Taylor expanded in F around inf
associate-/l*N/A
fp-cancel-sub-sign-invN/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
lower-+.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-cos.f64N/A
lower-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in B around 0
Applied rewrites87.2%
Final simplification85.8%
(FPCore (F B x)
:precision binary64
(if (<= F -1.75)
(+ (- (/ x B)) (/ -1.0 (sin B)))
(if (<= F 6e+21)
(+ (/ (- x) (tan B)) (* (/ F B) (sqrt (pow (fma 2.0 x 2.0) -1.0))))
(/ (fma -1.0 x 1.0) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.75) {
tmp = -(x / B) + (-1.0 / sin(B));
} else if (F <= 6e+21) {
tmp = (-x / tan(B)) + ((F / B) * sqrt(pow(fma(2.0, x, 2.0), -1.0)));
} else {
tmp = fma(-1.0, x, 1.0) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.75) tmp = Float64(Float64(-Float64(x / B)) + Float64(-1.0 / sin(B))); elseif (F <= 6e+21) tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(Float64(F / B) * sqrt((fma(2.0, x, 2.0) ^ -1.0)))); else tmp = Float64(fma(-1.0, x, 1.0) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.75], N[((-N[(x / B), $MachinePrecision]) + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 6e+21], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(N[(F / B), $MachinePrecision] * N[Sqrt[N[Power[N[(2.0 * x + 2.0), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 * x + 1.0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.75:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 6 \cdot 10^{+21}:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{F}{B} \cdot \sqrt{{\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{-1}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-1, x, 1\right)}{\sin B}\\
\end{array}
\end{array}
if F < -1.75Initial program 55.2%
Taylor expanded in B around 0
lower-*.f64N/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.4
Applied rewrites45.4%
Taylor expanded in B around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6425.5
Applied rewrites25.5%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6466.3
Applied rewrites66.3%
Taylor expanded in B around 0
lower-/.f6478.4
Applied rewrites78.4%
if -1.75 < F < 6e21Initial program 99.5%
Taylor expanded in B around 0
lower-*.f64N/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.f6488.7
Applied rewrites88.7%
Taylor expanded in F around 0
Applied rewrites87.8%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
distribute-neg-fracN/A
*-rgt-identityN/A
lift-neg.f64N/A
lift-/.f6488.0
Applied rewrites88.0%
if 6e21 < F Initial program 55.0%
Taylor expanded in F around inf
associate-/l*N/A
fp-cancel-sub-sign-invN/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
lower-+.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-cos.f64N/A
lower-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in B around 0
Applied rewrites86.7%
Final simplification84.9%
(FPCore (F B x)
:precision binary64
(if (<= F -1.4)
(/ (fma (- x) (cos B) -1.0) (sin B))
(if (<= F 1.9e-10)
(fma F (/ (sqrt 0.5) (sin B)) (/ (- x) (tan B)))
(/ (- 1.0 (* x (cos B))) (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 <= 1.9e-10) {
tmp = fma(F, (sqrt(0.5) / sin(B)), (-x / tan(B)));
} else {
tmp = (1.0 - (x * cos(B))) / 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 <= 1.9e-10) tmp = fma(F, Float64(sqrt(0.5) / sin(B)), Float64(Float64(-x) / tan(B))); else tmp = Float64(Float64(1.0 - Float64(x * cos(B))) / 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, 1.9e-10], N[(F * N[(N[Sqrt[0.5], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision]), $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 1.9 \cdot 10^{-10}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{\sqrt{0.5}}{\sin B}, \frac{-x}{\tan B}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x \cdot \cos B}{\sin B}\\
\end{array}
\end{array}
if F < -1.3999999999999999Initial program 55.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.f6498.7
Applied rewrites98.7%
if -1.3999999999999999 < F < 1.8999999999999999e-10Initial 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%
Taylor expanded in x around 0
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f6499.6
Applied rewrites99.6%
Taylor expanded in F around 0
Applied rewrites99.6%
if 1.8999999999999999e-10 < F Initial program 56.6%
Taylor expanded in F around inf
associate-/l*N/A
fp-cancel-sub-sign-invN/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
lower-+.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-cos.f64N/A
lower-sin.f6499.9
Applied rewrites99.9%
Final simplification99.5%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (+ (* x (/ -1.0 (tan B))) (pow B -1.0))))
(if (<= x -5.8e-11)
t_0
(if (<= x -2.45e-83)
(/ (- (/ F (sqrt (fma x 2.0 (fma F F 2.0)))) x) B)
(if (<= x 8.6e-64)
(* (sqrt (pow (fma F F 2.0) -1.0)) (/ F (sin B)))
t_0)))))
double code(double F, double B, double x) {
double t_0 = (x * (-1.0 / tan(B))) + pow(B, -1.0);
double tmp;
if (x <= -5.8e-11) {
tmp = t_0;
} else if (x <= -2.45e-83) {
tmp = ((F / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) - x) / B;
} else if (x <= 8.6e-64) {
tmp = sqrt(pow(fma(F, F, 2.0), -1.0)) * (F / sin(B));
} else {
tmp = t_0;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(x * Float64(-1.0 / tan(B))) + (B ^ -1.0)) tmp = 0.0 if (x <= -5.8e-11) tmp = t_0; elseif (x <= -2.45e-83) tmp = Float64(Float64(Float64(F / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) - x) / B); elseif (x <= 8.6e-64) tmp = Float64(sqrt((fma(F, F, 2.0) ^ -1.0)) * Float64(F / sin(B))); else tmp = t_0; end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[B, -1.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5.8e-11], t$95$0, If[LessEqual[x, -2.45e-83], N[(N[(N[(F / N[Sqrt[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[x, 8.6e-64], N[(N[Sqrt[N[Power[N[(F * F + 2.0), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{-1}{\tan B} + {B}^{-1}\\
\mathbf{if}\;x \leq -5.8 \cdot 10^{-11}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -2.45 \cdot 10^{-83}:\\
\;\;\;\;\frac{\frac{F}{\sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}} - x}{B}\\
\mathbf{elif}\;x \leq 8.6 \cdot 10^{-64}:\\
\;\;\;\;\sqrt{{\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-1}} \cdot \frac{F}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -5.8e-11 or 8.59999999999999947e-64 < x Initial program 75.2%
Taylor expanded in B around 0
lower-*.f64N/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.f6474.4
Applied rewrites74.4%
Taylor expanded in F around inf
Applied rewrites96.4%
if -5.8e-11 < x < -2.45e-83Initial program 65.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.f6460.4
Applied rewrites60.4%
Applied rewrites60.6%
if -2.45e-83 < x < 8.59999999999999947e-64Initial program 73.3%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-sin.f6456.7
Applied rewrites56.7%
Final simplification75.0%
(FPCore (F B x)
:precision binary64
(if (<= B 0.8)
(/
(-
(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)
(+ (* x (/ -1.0 (tan B))) (pow B -1.0))))
double code(double F, double B, double x) {
double tmp;
if (B <= 0.8) {
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 = (x * (-1.0 / tan(B))) + pow(B, -1.0);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (B <= 0.8) 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(x * Float64(-1.0 / tan(B))) + (B ^ -1.0)); end return tmp end
code[F_, B_, x_] := If[LessEqual[B, 0.8], 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[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[B, -1.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 0.8:\\
\;\;\;\;\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}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + {B}^{-1}\\
\end{array}
\end{array}
if B < 0.80000000000000004Initial program 70.2%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites64.7%
if 0.80000000000000004 < B Initial program 84.0%
Taylor expanded in B around 0
lower-*.f64N/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.f6457.4
Applied rewrites57.4%
Taylor expanded in F around inf
Applied rewrites54.4%
Final simplification62.2%
(FPCore (F B x)
:precision binary64
(if (<= F -6.2e+133)
(/ (- -1.0 x) B)
(if (<= F 1.9e-10)
(/
(-
(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 -1.0 x 1.0) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -6.2e+133) {
tmp = (-1.0 - x) / B;
} else if (F <= 1.9e-10) {
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(-1.0, x, 1.0) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -6.2e+133) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 1.9e-10) 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(fma(-1.0, x, 1.0) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -6.2e+133], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 1.9e-10], 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[(-1.0 * x + 1.0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -6.2 \cdot 10^{+133}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 1.9 \cdot 10^{-10}:\\
\;\;\;\;\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(-1, x, 1\right)}{\sin B}\\
\end{array}
\end{array}
if F < -6.2e133Initial program 31.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.f6436.7
Applied rewrites36.7%
Taylor expanded in F around -inf
Applied rewrites56.6%
if -6.2e133 < F < 1.8999999999999999e-10Initial program 96.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites57.0%
if 1.8999999999999999e-10 < F Initial program 56.6%
Taylor expanded in F around inf
associate-/l*N/A
fp-cancel-sub-sign-invN/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
lower-+.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-cos.f64N/A
lower-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in B around 0
Applied rewrites85.9%
Final simplification66.0%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (fma 0.16666666666666666 (- x) 0.16666666666666666)))
(if (<= F -6.2e+133)
(/ (- -1.0 x) B)
(if (<= F 2.2e+61)
(/
(-
(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.5
x
(fma
(-
(* -0.041666666666666664 x)
(fma
(fma 0.5 x t_0)
-0.16666666666666666
(fma 0.008333333333333333 (- x) 0.008333333333333333)))
(* B B)
t_0))
(* B B)
(- x))
1.0)
B)))))
double code(double F, double B, double x) {
double t_0 = fma(0.16666666666666666, -x, 0.16666666666666666);
double tmp;
if (F <= -6.2e+133) {
tmp = (-1.0 - x) / B;
} else if (F <= 2.2e+61) {
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.5, x, fma(((-0.041666666666666664 * x) - fma(fma(0.5, x, t_0), -0.16666666666666666, fma(0.008333333333333333, -x, 0.008333333333333333))), (B * B), t_0)), (B * B), -x) + 1.0) / B;
}
return tmp;
}
function code(F, B, x) t_0 = fma(0.16666666666666666, Float64(-x), 0.16666666666666666) tmp = 0.0 if (F <= -6.2e+133) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 2.2e+61) 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.5, x, fma(Float64(Float64(-0.041666666666666664 * x) - fma(fma(0.5, x, t_0), -0.16666666666666666, fma(0.008333333333333333, Float64(-x), 0.008333333333333333))), Float64(B * B), t_0)), Float64(B * B), Float64(-x)) + 1.0) / B); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(0.16666666666666666 * (-x) + 0.16666666666666666), $MachinePrecision]}, If[LessEqual[F, -6.2e+133], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 2.2e+61], 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.5 * x + N[(N[(N[(-0.041666666666666664 * x), $MachinePrecision] - N[(N[(0.5 * x + t$95$0), $MachinePrecision] * -0.16666666666666666 + N[(0.008333333333333333 * (-x) + 0.008333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(B * B), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision] * N[(B * B), $MachinePrecision] + (-x)), $MachinePrecision] + 1.0), $MachinePrecision] / B), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(0.16666666666666666, -x, 0.16666666666666666\right)\\
\mathbf{if}\;F \leq -6.2 \cdot 10^{+133}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 2.2 \cdot 10^{+61}:\\
\;\;\;\;\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.5, x, \mathsf{fma}\left(-0.041666666666666664 \cdot x - \mathsf{fma}\left(\mathsf{fma}\left(0.5, x, t\_0\right), -0.16666666666666666, \mathsf{fma}\left(0.008333333333333333, -x, 0.008333333333333333\right)\right), B \cdot B, t\_0\right)\right), B \cdot B, -x\right) + 1}{B}\\
\end{array}
\end{array}
if F < -6.2e133Initial program 31.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.f6436.7
Applied rewrites36.7%
Taylor expanded in F around -inf
Applied rewrites56.6%
if -6.2e133 < F < 2.2e61Initial program 97.0%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites56.6%
if 2.2e61 < F Initial program 49.1%
Taylor expanded in F around inf
associate-/l*N/A
fp-cancel-sub-sign-invN/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
lower-+.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-cos.f64N/A
lower-sin.f6499.8
Applied rewrites99.8%
Taylor expanded in B around 0
Applied rewrites56.9%
Final simplification56.7%
(FPCore (F B x)
:precision binary64
(if (<= F -6.2e+133)
(/ (- -1.0 x) B)
(if (<= F 1.9e-10)
(/
(-
(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.5 x (fma 0.16666666666666666 (- x) 0.16666666666666666))
(* B B)
(- x))
1.0)
B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -6.2e+133) {
tmp = (-1.0 - x) / B;
} else if (F <= 1.9e-10) {
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.5, x, fma(0.16666666666666666, -x, 0.16666666666666666)), (B * B), -x) + 1.0) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -6.2e+133) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 1.9e-10) 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.5, x, fma(0.16666666666666666, Float64(-x), 0.16666666666666666)), Float64(B * B), Float64(-x)) + 1.0) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -6.2e+133], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 1.9e-10], 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.5 * x + N[(0.16666666666666666 * (-x) + 0.16666666666666666), $MachinePrecision]), $MachinePrecision] * N[(B * B), $MachinePrecision] + (-x)), $MachinePrecision] + 1.0), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -6.2 \cdot 10^{+133}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 1.9 \cdot 10^{-10}:\\
\;\;\;\;\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.5, x, \mathsf{fma}\left(0.16666666666666666, -x, 0.16666666666666666\right)\right), B \cdot B, -x\right) + 1}{B}\\
\end{array}
\end{array}
if F < -6.2e133Initial program 31.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.f6436.7
Applied rewrites36.7%
Taylor expanded in F around -inf
Applied rewrites56.6%
if -6.2e133 < F < 1.8999999999999999e-10Initial program 96.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites57.0%
if 1.8999999999999999e-10 < F Initial program 56.6%
Taylor expanded in F around inf
associate-/l*N/A
fp-cancel-sub-sign-invN/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
lower-+.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-cos.f64N/A
lower-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in B around 0
Applied rewrites56.2%
Final simplification56.7%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (sqrt (pow (fma F F 2.0) -1.0))))
(if (<= F -1.15e-45)
(/ (- -1.0 x) B)
(if (<= F -2.2e-167)
(* t_0 (/ F B))
(if (<= F 1.22e-80)
(/ (- x) B)
(if (<= F 1e-13)
(/ (* t_0 F) B)
(/
(+
(fma
(fma 0.5 x (fma 0.16666666666666666 (- x) 0.16666666666666666))
(* B B)
(- x))
1.0)
B)))))))
double code(double F, double B, double x) {
double t_0 = sqrt(pow(fma(F, F, 2.0), -1.0));
double tmp;
if (F <= -1.15e-45) {
tmp = (-1.0 - x) / B;
} else if (F <= -2.2e-167) {
tmp = t_0 * (F / B);
} else if (F <= 1.22e-80) {
tmp = -x / B;
} else if (F <= 1e-13) {
tmp = (t_0 * F) / B;
} else {
tmp = (fma(fma(0.5, x, fma(0.16666666666666666, -x, 0.16666666666666666)), (B * B), -x) + 1.0) / B;
}
return tmp;
}
function code(F, B, x) t_0 = sqrt((fma(F, F, 2.0) ^ -1.0)) tmp = 0.0 if (F <= -1.15e-45) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= -2.2e-167) tmp = Float64(t_0 * Float64(F / B)); elseif (F <= 1.22e-80) tmp = Float64(Float64(-x) / B); elseif (F <= 1e-13) tmp = Float64(Float64(t_0 * F) / B); else tmp = Float64(Float64(fma(fma(0.5, x, fma(0.16666666666666666, Float64(-x), 0.16666666666666666)), Float64(B * B), Float64(-x)) + 1.0) / B); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[Sqrt[N[Power[N[(F * F + 2.0), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[F, -1.15e-45], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, -2.2e-167], N[(t$95$0 * N[(F / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.22e-80], N[((-x) / B), $MachinePrecision], If[LessEqual[F, 1e-13], N[(N[(t$95$0 * F), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(N[(0.5 * x + N[(0.16666666666666666 * (-x) + 0.16666666666666666), $MachinePrecision]), $MachinePrecision] * N[(B * B), $MachinePrecision] + (-x)), $MachinePrecision] + 1.0), $MachinePrecision] / B), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{{\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-1}}\\
\mathbf{if}\;F \leq -1.15 \cdot 10^{-45}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq -2.2 \cdot 10^{-167}:\\
\;\;\;\;t\_0 \cdot \frac{F}{B}\\
\mathbf{elif}\;F \leq 1.22 \cdot 10^{-80}:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{elif}\;F \leq 10^{-13}:\\
\;\;\;\;\frac{t\_0 \cdot F}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(0.5, x, \mathsf{fma}\left(0.16666666666666666, -x, 0.16666666666666666\right)\right), B \cdot B, -x\right) + 1}{B}\\
\end{array}
\end{array}
if F < -1.14999999999999996e-45Initial program 59.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.f6447.2
Applied rewrites47.2%
Taylor expanded in F around -inf
Applied rewrites56.1%
if -1.14999999999999996e-45 < F < -2.2e-167Initial 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.f6476.7
Applied rewrites76.7%
Taylor expanded in x around 0
Applied rewrites58.6%
if -2.2e-167 < F < 1.22e-80Initial program 99.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.f6449.7
Applied rewrites49.7%
Taylor expanded in F around 0
Applied rewrites44.2%
if 1.22e-80 < F < 1e-13Initial program 99.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.f6455.1
Applied rewrites55.1%
Taylor expanded in x around 0
Applied rewrites47.8%
if 1e-13 < F Initial program 57.7%
Taylor expanded in F around inf
associate-/l*N/A
fp-cancel-sub-sign-invN/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
lower-+.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-cos.f64N/A
lower-sin.f6498.8
Applied rewrites98.8%
Taylor expanded in B around 0
Applied rewrites56.2%
Final simplification52.9%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* (sqrt (pow (fma F F 2.0) -1.0)) (/ F B))))
(if (<= F -1.15e-45)
(/ (- -1.0 x) B)
(if (<= F -2.2e-167)
t_0
(if (<= F 1.22e-80)
(/ (- x) B)
(if (<= F 1e-13)
t_0
(/
(+
(fma
(fma 0.5 x (fma 0.16666666666666666 (- x) 0.16666666666666666))
(* B B)
(- x))
1.0)
B)))))))
double code(double F, double B, double x) {
double t_0 = sqrt(pow(fma(F, F, 2.0), -1.0)) * (F / B);
double tmp;
if (F <= -1.15e-45) {
tmp = (-1.0 - x) / B;
} else if (F <= -2.2e-167) {
tmp = t_0;
} else if (F <= 1.22e-80) {
tmp = -x / B;
} else if (F <= 1e-13) {
tmp = t_0;
} else {
tmp = (fma(fma(0.5, x, fma(0.16666666666666666, -x, 0.16666666666666666)), (B * B), -x) + 1.0) / B;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(sqrt((fma(F, F, 2.0) ^ -1.0)) * Float64(F / B)) tmp = 0.0 if (F <= -1.15e-45) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= -2.2e-167) tmp = t_0; elseif (F <= 1.22e-80) tmp = Float64(Float64(-x) / B); elseif (F <= 1e-13) tmp = t_0; else tmp = Float64(Float64(fma(fma(0.5, x, fma(0.16666666666666666, Float64(-x), 0.16666666666666666)), Float64(B * B), Float64(-x)) + 1.0) / B); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[Sqrt[N[Power[N[(F * F + 2.0), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * N[(F / B), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -1.15e-45], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, -2.2e-167], t$95$0, If[LessEqual[F, 1.22e-80], N[((-x) / B), $MachinePrecision], If[LessEqual[F, 1e-13], t$95$0, N[(N[(N[(N[(0.5 * x + N[(0.16666666666666666 * (-x) + 0.16666666666666666), $MachinePrecision]), $MachinePrecision] * N[(B * B), $MachinePrecision] + (-x)), $MachinePrecision] + 1.0), $MachinePrecision] / B), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{{\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-1}} \cdot \frac{F}{B}\\
\mathbf{if}\;F \leq -1.15 \cdot 10^{-45}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq -2.2 \cdot 10^{-167}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;F \leq 1.22 \cdot 10^{-80}:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{elif}\;F \leq 10^{-13}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(0.5, x, \mathsf{fma}\left(0.16666666666666666, -x, 0.16666666666666666\right)\right), B \cdot B, -x\right) + 1}{B}\\
\end{array}
\end{array}
if F < -1.14999999999999996e-45Initial program 59.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.f6447.2
Applied rewrites47.2%
Taylor expanded in F around -inf
Applied rewrites56.1%
if -1.14999999999999996e-45 < F < -2.2e-167 or 1.22e-80 < F < 1e-13Initial program 99.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.f6467.3
Applied rewrites67.3%
Taylor expanded in x around 0
Applied rewrites53.8%
if -2.2e-167 < F < 1.22e-80Initial program 99.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.f6449.7
Applied rewrites49.7%
Taylor expanded in F around 0
Applied rewrites44.2%
if 1e-13 < F Initial program 57.7%
Taylor expanded in F around inf
associate-/l*N/A
fp-cancel-sub-sign-invN/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
lower-+.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-cos.f64N/A
lower-sin.f6498.8
Applied rewrites98.8%
Taylor expanded in B around 0
Applied rewrites56.2%
Final simplification52.9%
(FPCore (F B x)
:precision binary64
(if (<= F -1.75)
(+ (- (/ x B)) (/ -1.0 (sin B)))
(if (<= F 6e+21)
(/ (- (* (sqrt (pow (fma F F (fma 2.0 x 2.0)) -1.0)) F) x) B)
(/ (fma -1.0 x 1.0) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.75) {
tmp = -(x / B) + (-1.0 / sin(B));
} else if (F <= 6e+21) {
tmp = ((sqrt(pow(fma(F, F, fma(2.0, x, 2.0)), -1.0)) * F) - x) / B;
} else {
tmp = fma(-1.0, x, 1.0) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.75) tmp = Float64(Float64(-Float64(x / B)) + Float64(-1.0 / sin(B))); elseif (F <= 6e+21) tmp = Float64(Float64(Float64(sqrt((fma(F, F, fma(2.0, x, 2.0)) ^ -1.0)) * F) - x) / B); else tmp = Float64(fma(-1.0, x, 1.0) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.75], N[((-N[(x / B), $MachinePrecision]) + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 6e+21], N[(N[(N[(N[Sqrt[N[Power[N[(F * F + N[(2.0 * x + 2.0), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(-1.0 * x + 1.0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.75:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 6 \cdot 10^{+21}:\\
\;\;\;\;\frac{\sqrt{{\left(\mathsf{fma}\left(F, F, \mathsf{fma}\left(2, x, 2\right)\right)\right)}^{-1}} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-1, x, 1\right)}{\sin B}\\
\end{array}
\end{array}
if F < -1.75Initial program 55.2%
Taylor expanded in B around 0
lower-*.f64N/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.4
Applied rewrites45.4%
Taylor expanded in B around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6425.5
Applied rewrites25.5%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6466.3
Applied rewrites66.3%
Taylor expanded in B around 0
lower-/.f6478.4
Applied rewrites78.4%
if -1.75 < F < 6e21Initial 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.f6455.7
Applied rewrites55.7%
if 6e21 < F Initial program 55.0%
Taylor expanded in F around inf
associate-/l*N/A
fp-cancel-sub-sign-invN/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
lower-+.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-cos.f64N/A
lower-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in B around 0
Applied rewrites86.7%
Final simplification71.5%
(FPCore (F B x)
:precision binary64
(if (<= F -2e+53)
(/ (- -1.0 x) B)
(if (<= F 9.2e+21)
(/ (- (* (sqrt (pow (fma F F (fma 2.0 x 2.0)) -1.0)) F) x) B)
(/
(+
(fma
(fma 0.5 x (fma 0.16666666666666666 (- x) 0.16666666666666666))
(* B B)
(- x))
1.0)
B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -2e+53) {
tmp = (-1.0 - x) / B;
} else if (F <= 9.2e+21) {
tmp = ((sqrt(pow(fma(F, F, fma(2.0, x, 2.0)), -1.0)) * F) - x) / B;
} else {
tmp = (fma(fma(0.5, x, fma(0.16666666666666666, -x, 0.16666666666666666)), (B * B), -x) + 1.0) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -2e+53) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 9.2e+21) tmp = Float64(Float64(Float64(sqrt((fma(F, F, fma(2.0, x, 2.0)) ^ -1.0)) * F) - x) / B); else tmp = Float64(Float64(fma(fma(0.5, x, fma(0.16666666666666666, Float64(-x), 0.16666666666666666)), Float64(B * B), Float64(-x)) + 1.0) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -2e+53], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 9.2e+21], N[(N[(N[(N[Sqrt[N[Power[N[(F * F + N[(2.0 * x + 2.0), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(N[(0.5 * x + N[(0.16666666666666666 * (-x) + 0.16666666666666666), $MachinePrecision]), $MachinePrecision] * N[(B * B), $MachinePrecision] + (-x)), $MachinePrecision] + 1.0), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -2 \cdot 10^{+53}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 9.2 \cdot 10^{+21}:\\
\;\;\;\;\frac{\sqrt{{\left(\mathsf{fma}\left(F, F, \mathsf{fma}\left(2, x, 2\right)\right)\right)}^{-1}} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(0.5, x, \mathsf{fma}\left(0.16666666666666666, -x, 0.16666666666666666\right)\right), B \cdot B, -x\right) + 1}{B}\\
\end{array}
\end{array}
if F < -2e53Initial program 47.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.f6446.5
Applied rewrites46.5%
Taylor expanded in F around -inf
Applied rewrites60.7%
if -2e53 < F < 9.2e21Initial program 98.1%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6455.2
Applied rewrites55.2%
if 9.2e21 < F Initial program 55.0%
Taylor expanded in F around inf
associate-/l*N/A
fp-cancel-sub-sign-invN/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
lower-+.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-cos.f64N/A
lower-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in B around 0
Applied rewrites55.8%
Final simplification56.7%
(FPCore (F B x)
:precision binary64
(if (<= F -1.4)
(/ (- -1.0 x) B)
(if (<= F 1.9e-10)
(/ (fma (sqrt (pow (fma 2.0 x 2.0) -1.0)) F (- x)) B)
(/
(+
(fma
(fma 0.5 x (fma 0.16666666666666666 (- x) 0.16666666666666666))
(* B B)
(- x))
1.0)
B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.4) {
tmp = (-1.0 - x) / B;
} else if (F <= 1.9e-10) {
tmp = fma(sqrt(pow(fma(2.0, x, 2.0), -1.0)), F, -x) / B;
} else {
tmp = (fma(fma(0.5, x, fma(0.16666666666666666, -x, 0.16666666666666666)), (B * B), -x) + 1.0) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.4) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 1.9e-10) tmp = Float64(fma(sqrt((fma(2.0, x, 2.0) ^ -1.0)), F, Float64(-x)) / B); else tmp = Float64(Float64(fma(fma(0.5, x, fma(0.16666666666666666, Float64(-x), 0.16666666666666666)), Float64(B * B), Float64(-x)) + 1.0) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.4], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 1.9e-10], N[(N[(N[Sqrt[N[Power[N[(2.0 * x + 2.0), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * F + (-x)), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(N[(0.5 * x + N[(0.16666666666666666 * (-x) + 0.16666666666666666), $MachinePrecision]), $MachinePrecision] * N[(B * B), $MachinePrecision] + (-x)), $MachinePrecision] + 1.0), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.4:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 1.9 \cdot 10^{-10}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\sqrt{{\left(\mathsf{fma}\left(2, x, 2\right)\right)}^{-1}}, F, -x\right)}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(0.5, x, \mathsf{fma}\left(0.16666666666666666, -x, 0.16666666666666666\right)\right), B \cdot B, -x\right) + 1}{B}\\
\end{array}
\end{array}
if F < -1.3999999999999999Initial program 55.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.f6447.6
Applied rewrites47.6%
Taylor expanded in F around -inf
Applied rewrites59.0%
if -1.3999999999999999 < F < 1.8999999999999999e-10Initial 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.f6455.3
Applied rewrites55.3%
Taylor expanded in F around 0
Applied rewrites55.3%
if 1.8999999999999999e-10 < F Initial program 56.6%
Taylor expanded in F around inf
associate-/l*N/A
fp-cancel-sub-sign-invN/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
lower-+.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-cos.f64N/A
lower-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in B around 0
Applied rewrites56.2%
Final simplification56.6%
(FPCore (F B x)
:precision binary64
(if (<= F -5.2e+184)
(/ (- -1.0 x) B)
(if (<= F 9.2e+21)
(/ (- (/ F (sqrt (fma x 2.0 (fma F F 2.0)))) x) B)
(/
(+
(fma
(fma 0.5 x (fma 0.16666666666666666 (- x) 0.16666666666666666))
(* B B)
(- x))
1.0)
B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -5.2e+184) {
tmp = (-1.0 - x) / B;
} else if (F <= 9.2e+21) {
tmp = ((F / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) - x) / B;
} else {
tmp = (fma(fma(0.5, x, fma(0.16666666666666666, -x, 0.16666666666666666)), (B * B), -x) + 1.0) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -5.2e+184) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 9.2e+21) tmp = Float64(Float64(Float64(F / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) - x) / B); else tmp = Float64(Float64(fma(fma(0.5, x, fma(0.16666666666666666, Float64(-x), 0.16666666666666666)), Float64(B * B), Float64(-x)) + 1.0) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -5.2e+184], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 9.2e+21], 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.5 * x + N[(0.16666666666666666 * (-x) + 0.16666666666666666), $MachinePrecision]), $MachinePrecision] * N[(B * B), $MachinePrecision] + (-x)), $MachinePrecision] + 1.0), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -5.2 \cdot 10^{+184}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 9.2 \cdot 10^{+21}:\\
\;\;\;\;\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.5, x, \mathsf{fma}\left(0.16666666666666666, -x, 0.16666666666666666\right)\right), B \cdot B, -x\right) + 1}{B}\\
\end{array}
\end{array}
if F < -5.19999999999999986e184Initial program 30.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.f6426.1
Applied rewrites26.1%
Taylor expanded in F around -inf
Applied rewrites52.2%
if -5.19999999999999986e184 < F < 9.2e21Initial program 92.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.f6458.1
Applied rewrites58.1%
Applied rewrites58.1%
if 9.2e21 < F Initial program 55.0%
Taylor expanded in F around inf
associate-/l*N/A
fp-cancel-sub-sign-invN/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
lower-+.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-cos.f64N/A
lower-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in B around 0
Applied rewrites55.8%
Final simplification56.7%
(FPCore (F B x)
:precision binary64
(if (<= F -3.4e-167)
(/ (- -1.0 x) B)
(if (<= F 4.2e-65)
(/ (- x) B)
(/
(+
(fma
(fma 0.5 x (fma 0.16666666666666666 (- x) 0.16666666666666666))
(* B B)
(- x))
1.0)
B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.4e-167) {
tmp = (-1.0 - x) / B;
} else if (F <= 4.2e-65) {
tmp = -x / B;
} else {
tmp = (fma(fma(0.5, x, fma(0.16666666666666666, -x, 0.16666666666666666)), (B * B), -x) + 1.0) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -3.4e-167) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 4.2e-65) tmp = Float64(Float64(-x) / B); else tmp = Float64(Float64(fma(fma(0.5, x, fma(0.16666666666666666, Float64(-x), 0.16666666666666666)), Float64(B * B), Float64(-x)) + 1.0) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -3.4e-167], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 4.2e-65], N[((-x) / B), $MachinePrecision], N[(N[(N[(N[(0.5 * x + N[(0.16666666666666666 * (-x) + 0.16666666666666666), $MachinePrecision]), $MachinePrecision] * N[(B * B), $MachinePrecision] + (-x)), $MachinePrecision] + 1.0), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.4 \cdot 10^{-167}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 4.2 \cdot 10^{-65}:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(0.5, x, \mathsf{fma}\left(0.16666666666666666, -x, 0.16666666666666666\right)\right), B \cdot B, -x\right) + 1}{B}\\
\end{array}
\end{array}
if F < -3.3999999999999997e-167Initial program 66.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.f6452.3
Applied rewrites52.3%
Taylor expanded in F around -inf
Applied rewrites50.1%
if -3.3999999999999997e-167 < F < 4.20000000000000006e-65Initial program 99.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.f6450.5
Applied rewrites50.5%
Taylor expanded in F around 0
Applied rewrites43.8%
if 4.20000000000000006e-65 < F Initial program 62.2%
Taylor expanded in F around inf
associate-/l*N/A
fp-cancel-sub-sign-invN/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
lower-+.f64N/A
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-cos.f64N/A
lower-sin.f6492.8
Applied rewrites92.8%
Taylor expanded in B around 0
Applied rewrites50.6%
(FPCore (F B x) :precision binary64 (if (<= F -3.4e-167) (/ (- -1.0 x) B) (if (<= F 4.2e-65) (/ (- x) B) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.4e-167) {
tmp = (-1.0 - x) / B;
} else if (F <= 4.2e-65) {
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.4d-167)) then
tmp = ((-1.0d0) - x) / b
else if (f <= 4.2d-65) 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.4e-167) {
tmp = (-1.0 - x) / B;
} else if (F <= 4.2e-65) {
tmp = -x / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -3.4e-167: tmp = (-1.0 - x) / B elif F <= 4.2e-65: tmp = -x / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -3.4e-167) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 4.2e-65) 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.4e-167) tmp = (-1.0 - x) / B; elseif (F <= 4.2e-65) tmp = -x / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -3.4e-167], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 4.2e-65], N[((-x) / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.4 \cdot 10^{-167}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 4.2 \cdot 10^{-65}:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -3.3999999999999997e-167Initial program 66.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.f6452.3
Applied rewrites52.3%
Taylor expanded in F around -inf
Applied rewrites50.1%
if -3.3999999999999997e-167 < F < 4.20000000000000006e-65Initial program 99.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.f6450.5
Applied rewrites50.5%
Taylor expanded in F around 0
Applied rewrites43.8%
if 4.20000000000000006e-65 < F Initial program 62.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.f6447.0
Applied rewrites47.0%
Taylor expanded in F around inf
Applied rewrites49.9%
(FPCore (F B x) :precision binary64 (if (<= F -3.4e-167) (/ (- -1.0 x) B) (/ (- x) B)))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.4e-167) {
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.4d-167)) 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.4e-167) {
tmp = (-1.0 - x) / B;
} else {
tmp = -x / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -3.4e-167: tmp = (-1.0 - x) / B else: tmp = -x / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -3.4e-167) 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.4e-167) tmp = (-1.0 - x) / B; else tmp = -x / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -3.4e-167], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], N[((-x) / B), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.4 \cdot 10^{-167}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{B}\\
\end{array}
\end{array}
if F < -3.3999999999999997e-167Initial program 66.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.f6452.3
Applied rewrites52.3%
Taylor expanded in F around -inf
Applied rewrites50.1%
if -3.3999999999999997e-167 < F Initial program 77.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.f6448.5
Applied rewrites48.5%
Taylor expanded in F around 0
Applied rewrites36.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 73.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.f6449.9
Applied rewrites49.9%
Taylor expanded in F around 0
Applied rewrites32.8%
herbie shell --seed 2024346
(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))))))