
(FPCore (F B x) :precision binary64 (+ (- (* x (/ 1.0 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))
double code(double F, double B, double x) {
return -(x * (1.0 / tan(B))) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = -(x * (1.0d0 / tan(b))) + ((f / sin(b)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
end function
public static double code(double F, double B, double x) {
return -(x * (1.0 / Math.tan(B))) + ((F / Math.sin(B)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
def code(F, B, x): return -(x * (1.0 / math.tan(B))) + ((F / math.sin(B)) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)))
function code(F, B, x) return Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))) end
function tmp = code(F, B, x) tmp = -(x * (1.0 / tan(B))) + ((F / sin(B)) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); end
code[F_, B_, x_] := N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], (-N[(1.0 / 2.0), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 23 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (F B x) :precision binary64 (+ (- (* x (/ 1.0 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))
double code(double F, double B, double x) {
return -(x * (1.0 / tan(B))) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = -(x * (1.0d0 / tan(b))) + ((f / sin(b)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
end function
public static double code(double F, double B, double x) {
return -(x * (1.0 / Math.tan(B))) + ((F / Math.sin(B)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
def code(F, B, x): return -(x * (1.0 / math.tan(B))) + ((F / math.sin(B)) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)))
function code(F, B, x) return Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))) end
function tmp = code(F, B, x) tmp = -(x * (1.0 / tan(B))) + ((F / sin(B)) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); end
code[F_, B_, x_] := N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], (-N[(1.0 / 2.0), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\end{array}
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= F -5e+26)
(/ (fma (cos B) x 1.0) (- (sin B)))
(if (<= F 100000000.0)
(fma F (/ (pow (fma 2.0 x (fma F F 2.0)) -0.5) (sin B)) t_0)
(+ t_0 (/ 1.0 (sin B)))))))
double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (F <= -5e+26) {
tmp = fma(cos(B), x, 1.0) / -sin(B);
} else if (F <= 100000000.0) {
tmp = fma(F, (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) / sin(B)), t_0);
} else {
tmp = t_0 + (1.0 / sin(B));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (F <= -5e+26) tmp = Float64(fma(cos(B), x, 1.0) / Float64(-sin(B))); elseif (F <= 100000000.0) tmp = fma(F, Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) / sin(B)), t_0); else tmp = Float64(t_0 + Float64(1.0 / sin(B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -5e+26], N[(N[(N[Cos[B], $MachinePrecision] * x + 1.0), $MachinePrecision] / (-N[Sin[B], $MachinePrecision])), $MachinePrecision], If[LessEqual[F, 100000000.0], N[(F * N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], N[(t$95$0 + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -5 \cdot 10^{+26}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\cos B, x, 1\right)}{-\sin B}\\
\mathbf{elif}\;F \leq 100000000:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B}, t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -5.0000000000000001e26Initial program 57.2%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
lift-neg.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
distribute-neg-frac2N/A
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-cos.f64N/A
lower-neg.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
if -5.0000000000000001e26 < F < 1e8Initial program 99.4%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.4%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.5
Applied rewrites99.5%
Applied rewrites99.6%
if 1e8 < F Initial program 73.4%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites83.6%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6483.7
Applied rewrites83.7%
Taylor expanded in F around inf
+-commutative99.8
+-commutative99.8
pow299.8
associate-+r+99.8
pow299.8
metadata-eval99.8
sqrt-pow199.8
*-commutative99.8
Applied rewrites99.8%
Final simplification99.7%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= F -5e+26)
(/ (fma (cos B) x 1.0) (- (sin B)))
(if (<= F 100000000.0)
(fma F (/ (/ 1.0 (sqrt (fma 2.0 x (fma F F 2.0)))) (sin B)) t_0)
(+ t_0 (/ 1.0 (sin B)))))))
double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (F <= -5e+26) {
tmp = fma(cos(B), x, 1.0) / -sin(B);
} else if (F <= 100000000.0) {
tmp = fma(F, ((1.0 / sqrt(fma(2.0, x, fma(F, F, 2.0)))) / sin(B)), t_0);
} else {
tmp = t_0 + (1.0 / sin(B));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (F <= -5e+26) tmp = Float64(fma(cos(B), x, 1.0) / Float64(-sin(B))); elseif (F <= 100000000.0) tmp = fma(F, Float64(Float64(1.0 / sqrt(fma(2.0, x, fma(F, F, 2.0)))) / sin(B)), t_0); else tmp = Float64(t_0 + Float64(1.0 / sin(B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -5e+26], N[(N[(N[Cos[B], $MachinePrecision] * x + 1.0), $MachinePrecision] / (-N[Sin[B], $MachinePrecision])), $MachinePrecision], If[LessEqual[F, 100000000.0], N[(F * N[(N[(1.0 / N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], N[(t$95$0 + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -5 \cdot 10^{+26}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\cos B, x, 1\right)}{-\sin B}\\
\mathbf{elif}\;F \leq 100000000:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{\frac{1}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}}{\sin B}, t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -5.0000000000000001e26Initial program 57.2%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
lift-neg.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
distribute-neg-frac2N/A
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-cos.f64N/A
lower-neg.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
if -5.0000000000000001e26 < F < 1e8Initial program 99.4%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.4%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.5
Applied rewrites99.5%
Applied rewrites99.6%
lift-pow.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
pow2N/A
associate-+r+N/A
pow2N/A
metadata-evalN/A
sqrt-pow1N/A
unpow-1N/A
+-commutativeN/A
pow2N/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
+-commutativeN/A
associate-+r+N/A
pow2N/A
lower-sqrt.f64N/A
Applied rewrites99.5%
if 1e8 < F Initial program 73.4%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites83.6%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6483.7
Applied rewrites83.7%
Taylor expanded in F around inf
+-commutative99.8
+-commutative99.8
pow299.8
associate-+r+99.8
pow299.8
metadata-eval99.8
sqrt-pow199.8
*-commutative99.8
Applied rewrites99.8%
Final simplification99.6%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= F -3.4e-11)
(/ (fma (cos B) x 1.0) (- (sin B)))
(if (<= F 5e-19)
(fma F (/ (pow (fma 2.0 x (fma F F 2.0)) -0.5) B) t_0)
(+ t_0 (/ 1.0 (sin B)))))))
double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (F <= -3.4e-11) {
tmp = fma(cos(B), x, 1.0) / -sin(B);
} else if (F <= 5e-19) {
tmp = fma(F, (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) / B), t_0);
} else {
tmp = t_0 + (1.0 / sin(B));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (F <= -3.4e-11) tmp = Float64(fma(cos(B), x, 1.0) / Float64(-sin(B))); elseif (F <= 5e-19) tmp = fma(F, Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) / B), t_0); else tmp = Float64(t_0 + Float64(1.0 / sin(B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -3.4e-11], N[(N[(N[Cos[B], $MachinePrecision] * x + 1.0), $MachinePrecision] / (-N[Sin[B], $MachinePrecision])), $MachinePrecision], If[LessEqual[F, 5e-19], N[(F * N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] / B), $MachinePrecision] + t$95$0), $MachinePrecision], N[(t$95$0 + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -3.4 \cdot 10^{-11}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\cos B, x, 1\right)}{-\sin B}\\
\mathbf{elif}\;F \leq 5 \cdot 10^{-19}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{B}, t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -3.3999999999999999e-11Initial program 60.4%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6498.0
Applied rewrites98.0%
lift-neg.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
distribute-neg-frac2N/A
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-cos.f64N/A
lower-neg.f64N/A
lift-sin.f6498.0
Applied rewrites98.0%
if -3.3999999999999999e-11 < F < 5.0000000000000004e-19Initial program 99.3%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.3%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.5
Applied rewrites99.5%
Applied rewrites99.6%
Taylor expanded in B around 0
Applied rewrites77.1%
if 5.0000000000000004e-19 < F Initial program 75.5%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites84.9%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6485.0
Applied rewrites85.0%
Taylor expanded in F around inf
+-commutative96.9
+-commutative96.9
pow296.9
associate-+r+96.9
pow296.9
metadata-eval96.9
sqrt-pow196.9
*-commutative96.9
Applied rewrites96.9%
Final simplification88.3%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ F (sin B))) (t_1 (- (sin B))))
(if (<= F -2.2e-35)
(/ (fma (cos B) x 1.0) t_1)
(if (<= F -5.8e-97)
(* t_0 (/ 1.0 (sqrt (fma F F 2.0))))
(if (<= F 1.2e-147)
(/ (* (cos B) x) t_1)
(if (<= F 5.5e-19)
(* t_0 (sqrt (/ 1.0 (fma F F 2.0))))
(+ (/ (- x) (tan B)) (/ 1.0 (sin B)))))))))
double code(double F, double B, double x) {
double t_0 = F / sin(B);
double t_1 = -sin(B);
double tmp;
if (F <= -2.2e-35) {
tmp = fma(cos(B), x, 1.0) / t_1;
} else if (F <= -5.8e-97) {
tmp = t_0 * (1.0 / sqrt(fma(F, F, 2.0)));
} else if (F <= 1.2e-147) {
tmp = (cos(B) * x) / t_1;
} else if (F <= 5.5e-19) {
tmp = t_0 * sqrt((1.0 / fma(F, F, 2.0)));
} else {
tmp = (-x / tan(B)) + (1.0 / sin(B));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(F / sin(B)) t_1 = Float64(-sin(B)) tmp = 0.0 if (F <= -2.2e-35) tmp = Float64(fma(cos(B), x, 1.0) / t_1); elseif (F <= -5.8e-97) tmp = Float64(t_0 * Float64(1.0 / sqrt(fma(F, F, 2.0)))); elseif (F <= 1.2e-147) tmp = Float64(Float64(cos(B) * x) / t_1); elseif (F <= 5.5e-19) tmp = Float64(t_0 * sqrt(Float64(1.0 / fma(F, F, 2.0)))); else tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(1.0 / sin(B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = (-N[Sin[B], $MachinePrecision])}, If[LessEqual[F, -2.2e-35], N[(N[(N[Cos[B], $MachinePrecision] * x + 1.0), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[F, -5.8e-97], N[(t$95$0 * N[(1.0 / N[Sqrt[N[(F * F + 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.2e-147], N[(N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[F, 5.5e-19], N[(t$95$0 * N[Sqrt[N[(1.0 / N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{F}{\sin B}\\
t_1 := -\sin B\\
\mathbf{if}\;F \leq -2.2 \cdot 10^{-35}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\cos B, x, 1\right)}{t\_1}\\
\mathbf{elif}\;F \leq -5.8 \cdot 10^{-97}:\\
\;\;\;\;t\_0 \cdot \frac{1}{\sqrt{\mathsf{fma}\left(F, F, 2\right)}}\\
\mathbf{elif}\;F \leq 1.2 \cdot 10^{-147}:\\
\;\;\;\;\frac{\cos B \cdot x}{t\_1}\\
\mathbf{elif}\;F \leq 5.5 \cdot 10^{-19}:\\
\;\;\;\;t\_0 \cdot \sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -2.19999999999999994e-35Initial program 62.4%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6495.8
Applied rewrites95.8%
lift-neg.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
distribute-neg-frac2N/A
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-cos.f64N/A
lower-neg.f64N/A
lift-sin.f6495.8
Applied rewrites95.8%
if -2.19999999999999994e-35 < F < -5.7999999999999999e-97Initial program 99.3%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.4%
Taylor expanded in x around 0
+-commutativeN/A
associate-*l/N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lift-sin.f64N/A
lift-/.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f6463.6
Applied rewrites63.6%
lift-pow.f64N/A
lift-fma.f64N/A
lower-sqrt.f64N/A
unpow-1N/A
pow2N/A
+-commutativeN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f6463.7
Applied rewrites63.7%
if -5.7999999999999999e-97 < F < 1.19999999999999999e-147Initial program 99.3%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6475.7
Applied rewrites75.7%
if 1.19999999999999999e-147 < F < 5.4999999999999996e-19Initial program 99.4%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.1%
Taylor expanded in x around 0
+-commutativeN/A
associate-*l/N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lift-sin.f64N/A
lift-/.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f6469.0
Applied rewrites69.0%
lift-pow.f64N/A
lift-fma.f64N/A
unpow-1N/A
pow2N/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f6469.0
Applied rewrites69.0%
if 5.4999999999999996e-19 < F Initial program 75.1%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites84.7%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6484.7
Applied rewrites84.7%
Taylor expanded in F around inf
+-commutative98.4
+-commutative98.4
pow298.4
associate-+r+98.4
pow298.4
metadata-eval98.4
sqrt-pow198.4
*-commutative98.4
Applied rewrites98.4%
Final simplification86.2%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ F (sin B))) (t_1 (* (cos B) x)) (t_2 (- (sin B))))
(if (<= F -2.2e-35)
(/ (fma (cos B) x 1.0) t_2)
(if (<= F -5.8e-97)
(* t_0 (/ 1.0 (sqrt (fma F F 2.0))))
(if (<= F 1.2e-147)
(/ t_1 t_2)
(if (<= F 5.5e-19)
(* t_0 (sqrt (/ 1.0 (fma F F 2.0))))
(/ (- 1.0 t_1) (sin B))))))))
double code(double F, double B, double x) {
double t_0 = F / sin(B);
double t_1 = cos(B) * x;
double t_2 = -sin(B);
double tmp;
if (F <= -2.2e-35) {
tmp = fma(cos(B), x, 1.0) / t_2;
} else if (F <= -5.8e-97) {
tmp = t_0 * (1.0 / sqrt(fma(F, F, 2.0)));
} else if (F <= 1.2e-147) {
tmp = t_1 / t_2;
} else if (F <= 5.5e-19) {
tmp = t_0 * sqrt((1.0 / fma(F, F, 2.0)));
} else {
tmp = (1.0 - t_1) / sin(B);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(F / sin(B)) t_1 = Float64(cos(B) * x) t_2 = Float64(-sin(B)) tmp = 0.0 if (F <= -2.2e-35) tmp = Float64(fma(cos(B), x, 1.0) / t_2); elseif (F <= -5.8e-97) tmp = Float64(t_0 * Float64(1.0 / sqrt(fma(F, F, 2.0)))); elseif (F <= 1.2e-147) tmp = Float64(t_1 / t_2); elseif (F <= 5.5e-19) tmp = Float64(t_0 * sqrt(Float64(1.0 / fma(F, F, 2.0)))); else tmp = Float64(Float64(1.0 - t_1) / sin(B)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]}, Block[{t$95$2 = (-N[Sin[B], $MachinePrecision])}, If[LessEqual[F, -2.2e-35], N[(N[(N[Cos[B], $MachinePrecision] * x + 1.0), $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[F, -5.8e-97], N[(t$95$0 * N[(1.0 / N[Sqrt[N[(F * F + 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.2e-147], N[(t$95$1 / t$95$2), $MachinePrecision], If[LessEqual[F, 5.5e-19], N[(t$95$0 * N[Sqrt[N[(1.0 / N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - t$95$1), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{F}{\sin B}\\
t_1 := \cos B \cdot x\\
t_2 := -\sin B\\
\mathbf{if}\;F \leq -2.2 \cdot 10^{-35}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\cos B, x, 1\right)}{t\_2}\\
\mathbf{elif}\;F \leq -5.8 \cdot 10^{-97}:\\
\;\;\;\;t\_0 \cdot \frac{1}{\sqrt{\mathsf{fma}\left(F, F, 2\right)}}\\
\mathbf{elif}\;F \leq 1.2 \cdot 10^{-147}:\\
\;\;\;\;\frac{t\_1}{t\_2}\\
\mathbf{elif}\;F \leq 5.5 \cdot 10^{-19}:\\
\;\;\;\;t\_0 \cdot \sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - t\_1}{\sin B}\\
\end{array}
\end{array}
if F < -2.19999999999999994e-35Initial program 62.4%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6495.8
Applied rewrites95.8%
lift-neg.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-cos.f64N/A
lift-sin.f64N/A
distribute-neg-frac2N/A
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-cos.f64N/A
lower-neg.f64N/A
lift-sin.f6495.8
Applied rewrites95.8%
if -2.19999999999999994e-35 < F < -5.7999999999999999e-97Initial program 99.3%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.4%
Taylor expanded in x around 0
+-commutativeN/A
associate-*l/N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lift-sin.f64N/A
lift-/.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f6463.6
Applied rewrites63.6%
lift-pow.f64N/A
lift-fma.f64N/A
lower-sqrt.f64N/A
unpow-1N/A
pow2N/A
+-commutativeN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f6463.7
Applied rewrites63.7%
if -5.7999999999999999e-97 < F < 1.19999999999999999e-147Initial program 99.3%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6475.7
Applied rewrites75.7%
if 1.19999999999999999e-147 < F < 5.4999999999999996e-19Initial program 99.4%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.1%
Taylor expanded in x around 0
+-commutativeN/A
associate-*l/N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lift-sin.f64N/A
lift-/.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f6469.0
Applied rewrites69.0%
lift-pow.f64N/A
lift-fma.f64N/A
unpow-1N/A
pow2N/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f6469.0
Applied rewrites69.0%
if 5.4999999999999996e-19 < F Initial program 75.1%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6498.3
Applied rewrites98.3%
Final simplification86.2%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* (cos B) x)))
(if (<= F -15.0)
(/ (- -1.0 x) (sin B))
(if (<= F 1.2e-147)
(/ t_0 (- (sin B)))
(if (<= F 5.5e-19)
(* (/ F (sin B)) (sqrt (/ 1.0 (fma F F 2.0))))
(/ (- 1.0 t_0) (sin B)))))))
double code(double F, double B, double x) {
double t_0 = cos(B) * x;
double tmp;
if (F <= -15.0) {
tmp = (-1.0 - x) / sin(B);
} else if (F <= 1.2e-147) {
tmp = t_0 / -sin(B);
} else if (F <= 5.5e-19) {
tmp = (F / sin(B)) * sqrt((1.0 / fma(F, F, 2.0)));
} else {
tmp = (1.0 - t_0) / sin(B);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(cos(B) * x) tmp = 0.0 if (F <= -15.0) tmp = Float64(Float64(-1.0 - x) / sin(B)); elseif (F <= 1.2e-147) tmp = Float64(t_0 / Float64(-sin(B))); elseif (F <= 5.5e-19) tmp = Float64(Float64(F / sin(B)) * sqrt(Float64(1.0 / fma(F, F, 2.0)))); else tmp = Float64(Float64(1.0 - t_0) / sin(B)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[F, -15.0], N[(N[(-1.0 - x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.2e-147], N[(t$95$0 / (-N[Sin[B], $MachinePrecision])), $MachinePrecision], If[LessEqual[F, 5.5e-19], N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos B \cdot x\\
\mathbf{if}\;F \leq -15:\\
\;\;\;\;\frac{-1 - x}{\sin B}\\
\mathbf{elif}\;F \leq 1.2 \cdot 10^{-147}:\\
\;\;\;\;\frac{t\_0}{-\sin B}\\
\mathbf{elif}\;F \leq 5.5 \cdot 10^{-19}:\\
\;\;\;\;\frac{F}{\sin B} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - t\_0}{\sin B}\\
\end{array}
\end{array}
if F < -15Initial program 58.9%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.1
Applied rewrites99.1%
Taylor expanded in B around 0
Applied rewrites75.8%
if -15 < F < 1.19999999999999999e-147Initial program 99.3%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6467.9
Applied rewrites67.9%
if 1.19999999999999999e-147 < F < 5.4999999999999996e-19Initial program 99.4%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.1%
Taylor expanded in x around 0
+-commutativeN/A
associate-*l/N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lift-sin.f64N/A
lift-/.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f6469.0
Applied rewrites69.0%
lift-pow.f64N/A
lift-fma.f64N/A
unpow-1N/A
pow2N/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f6469.0
Applied rewrites69.0%
if 5.4999999999999996e-19 < F Initial program 75.1%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6498.3
Applied rewrites98.3%
Final simplification77.7%
(FPCore (F B x)
:precision binary64
(if (<= x -1.02e-105)
(/ (* (cos B) x) (- (sin B)))
(if (<= x 1.8e-111)
(* (/ F (sin B)) (/ 1.0 (sqrt (fma F F 2.0))))
(+
(* x (/ -1.0 (tan B)))
(* (/ F (* B (fma -0.16666666666666666 (* B B) 1.0))) (/ -1.0 F))))))
double code(double F, double B, double x) {
double tmp;
if (x <= -1.02e-105) {
tmp = (cos(B) * x) / -sin(B);
} else if (x <= 1.8e-111) {
tmp = (F / sin(B)) * (1.0 / sqrt(fma(F, F, 2.0)));
} else {
tmp = (x * (-1.0 / tan(B))) + ((F / (B * fma(-0.16666666666666666, (B * B), 1.0))) * (-1.0 / F));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (x <= -1.02e-105) tmp = Float64(Float64(cos(B) * x) / Float64(-sin(B))); elseif (x <= 1.8e-111) tmp = Float64(Float64(F / sin(B)) * Float64(1.0 / sqrt(fma(F, F, 2.0)))); else tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(Float64(F / Float64(B * fma(-0.16666666666666666, Float64(B * B), 1.0))) * Float64(-1.0 / F))); end return tmp end
code[F_, B_, x_] := If[LessEqual[x, -1.02e-105], N[(N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision] / (-N[Sin[B], $MachinePrecision])), $MachinePrecision], If[LessEqual[x, 1.8e-111], N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(F * F + 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(F / N[(B * N[(-0.16666666666666666 * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.02 \cdot 10^{-105}:\\
\;\;\;\;\frac{\cos B \cdot x}{-\sin B}\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{-111}:\\
\;\;\;\;\frac{F}{\sin B} \cdot \frac{1}{\sqrt{\mathsf{fma}\left(F, F, 2\right)}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{B \cdot \mathsf{fma}\left(-0.16666666666666666, B \cdot B, 1\right)} \cdot \frac{-1}{F}\\
\end{array}
\end{array}
if x < -1.0200000000000001e-105Initial program 85.2%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6477.8
Applied rewrites77.8%
if -1.0200000000000001e-105 < x < 1.80000000000000005e-111Initial program 74.2%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites79.8%
Taylor expanded in x around 0
+-commutativeN/A
associate-*l/N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lift-sin.f64N/A
lift-/.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f6463.2
Applied rewrites63.2%
lift-pow.f64N/A
lift-fma.f64N/A
lower-sqrt.f64N/A
unpow-1N/A
pow2N/A
+-commutativeN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f6463.2
Applied rewrites63.2%
if 1.80000000000000005e-111 < x Initial program 87.5%
Taylor expanded in F around -inf
lower-/.f6482.0
Applied rewrites82.0%
Taylor expanded in B around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6485.2
Applied rewrites85.2%
Final simplification74.8%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* x (/ -1.0 (tan B)))))
(if (<= x -0.0066)
(+
t_0
(*
(/
F
(*
B
(fma
(* B B)
(- (* 0.008333333333333333 (* B B)) 0.16666666666666666)
1.0)))
(/ (fma (/ (fma 2.0 x 2.0) (* F F)) -0.5 1.0) F)))
(if (<= x 1.8e-111)
(* (/ F (sin B)) (/ 1.0 (sqrt (fma F F 2.0))))
(+
t_0
(* (/ F (* B (fma -0.16666666666666666 (* B B) 1.0))) (/ -1.0 F)))))))
double code(double F, double B, double x) {
double t_0 = x * (-1.0 / tan(B));
double tmp;
if (x <= -0.0066) {
tmp = t_0 + ((F / (B * fma((B * B), ((0.008333333333333333 * (B * B)) - 0.16666666666666666), 1.0))) * (fma((fma(2.0, x, 2.0) / (F * F)), -0.5, 1.0) / F));
} else if (x <= 1.8e-111) {
tmp = (F / sin(B)) * (1.0 / sqrt(fma(F, F, 2.0)));
} else {
tmp = t_0 + ((F / (B * fma(-0.16666666666666666, (B * B), 1.0))) * (-1.0 / F));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(x * Float64(-1.0 / tan(B))) tmp = 0.0 if (x <= -0.0066) tmp = Float64(t_0 + Float64(Float64(F / Float64(B * fma(Float64(B * B), Float64(Float64(0.008333333333333333 * Float64(B * B)) - 0.16666666666666666), 1.0))) * Float64(fma(Float64(fma(2.0, x, 2.0) / Float64(F * F)), -0.5, 1.0) / F))); elseif (x <= 1.8e-111) tmp = Float64(Float64(F / sin(B)) * Float64(1.0 / sqrt(fma(F, F, 2.0)))); else tmp = Float64(t_0 + Float64(Float64(F / Float64(B * fma(-0.16666666666666666, Float64(B * B), 1.0))) * Float64(-1.0 / F))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -0.0066], N[(t$95$0 + N[(N[(F / N[(B * N[(N[(B * B), $MachinePrecision] * N[(N[(0.008333333333333333 * N[(B * B), $MachinePrecision]), $MachinePrecision] - 0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(2.0 * x + 2.0), $MachinePrecision] / N[(F * F), $MachinePrecision]), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.8e-111], N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(F * F + 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(N[(F / N[(B * N[(-0.16666666666666666 * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{-1}{\tan B}\\
\mathbf{if}\;x \leq -0.0066:\\
\;\;\;\;t\_0 + \frac{F}{B \cdot \mathsf{fma}\left(B \cdot B, 0.008333333333333333 \cdot \left(B \cdot B\right) - 0.16666666666666666, 1\right)} \cdot \frac{\mathsf{fma}\left(\frac{\mathsf{fma}\left(2, x, 2\right)}{F \cdot F}, -0.5, 1\right)}{F}\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{-111}:\\
\;\;\;\;\frac{F}{\sin B} \cdot \frac{1}{\sqrt{\mathsf{fma}\left(F, F, 2\right)}}\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{F}{B \cdot \mathsf{fma}\left(-0.16666666666666666, B \cdot B, 1\right)} \cdot \frac{-1}{F}\\
\end{array}
\end{array}
if x < -0.0066Initial program 85.7%
Taylor expanded in F around inf
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites97.8%
Taylor expanded in B around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6497.2
Applied rewrites97.2%
if -0.0066 < x < 1.80000000000000005e-111Initial program 76.3%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites80.8%
Taylor expanded in x around 0
+-commutativeN/A
associate-*l/N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lift-sin.f64N/A
lift-/.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f6456.2
Applied rewrites56.2%
lift-pow.f64N/A
lift-fma.f64N/A
lower-sqrt.f64N/A
unpow-1N/A
pow2N/A
+-commutativeN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f6456.3
Applied rewrites56.3%
if 1.80000000000000005e-111 < x Initial program 87.5%
Taylor expanded in F around -inf
lower-/.f6482.0
Applied rewrites82.0%
Taylor expanded in B around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6485.2
Applied rewrites85.2%
Final simplification71.7%
(FPCore (F B x)
:precision binary64
(let* ((t_0
(+
(* x (/ -1.0 (tan B)))
(* (/ F (* B (fma -0.16666666666666666 (* B B) 1.0))) (/ -1.0 F)))))
(if (<= x -6.8e-103)
t_0
(if (<= x 1.8e-111) (* (/ F (sin B)) (/ 1.0 (sqrt (fma F F 2.0)))) t_0))))
double code(double F, double B, double x) {
double t_0 = (x * (-1.0 / tan(B))) + ((F / (B * fma(-0.16666666666666666, (B * B), 1.0))) * (-1.0 / F));
double tmp;
if (x <= -6.8e-103) {
tmp = t_0;
} else if (x <= 1.8e-111) {
tmp = (F / sin(B)) * (1.0 / sqrt(fma(F, F, 2.0)));
} else {
tmp = t_0;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(Float64(F / Float64(B * fma(-0.16666666666666666, Float64(B * B), 1.0))) * Float64(-1.0 / F))) tmp = 0.0 if (x <= -6.8e-103) tmp = t_0; elseif (x <= 1.8e-111) tmp = Float64(Float64(F / sin(B)) * Float64(1.0 / sqrt(fma(F, F, 2.0)))); else tmp = t_0; end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(F / N[(B * N[(-0.16666666666666666 * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6.8e-103], t$95$0, If[LessEqual[x, 1.8e-111], N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(F * F + 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{-1}{\tan B} + \frac{F}{B \cdot \mathsf{fma}\left(-0.16666666666666666, B \cdot B, 1\right)} \cdot \frac{-1}{F}\\
\mathbf{if}\;x \leq -6.8 \cdot 10^{-103}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{-111}:\\
\;\;\;\;\frac{F}{\sin B} \cdot \frac{1}{\sqrt{\mathsf{fma}\left(F, F, 2\right)}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -6.80000000000000006e-103 or 1.80000000000000005e-111 < x Initial program 86.6%
Taylor expanded in F around -inf
lower-/.f6472.5
Applied rewrites72.5%
Taylor expanded in B around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6477.4
Applied rewrites77.4%
if -6.80000000000000006e-103 < x < 1.80000000000000005e-111Initial program 74.4%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites80.0%
Taylor expanded in x around 0
+-commutativeN/A
associate-*l/N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lift-sin.f64N/A
lift-/.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f6462.6
Applied rewrites62.6%
lift-pow.f64N/A
lift-fma.f64N/A
lower-sqrt.f64N/A
unpow-1N/A
pow2N/A
+-commutativeN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f6462.7
Applied rewrites62.7%
Final simplification71.4%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (+ (* x (/ -1.0 (tan B))) (* (/ F B) (/ -1.0 F)))))
(if (<= x -7.5e-33)
t_0
(if (<= x 5.7e-155)
(* (/ F (sin B)) (/ 1.0 (sqrt (fma F F 2.0))))
(if (<= x 2.6e-7) (/ (- -1.0 x) (sin B)) t_0)))))
double code(double F, double B, double x) {
double t_0 = (x * (-1.0 / tan(B))) + ((F / B) * (-1.0 / F));
double tmp;
if (x <= -7.5e-33) {
tmp = t_0;
} else if (x <= 5.7e-155) {
tmp = (F / sin(B)) * (1.0 / sqrt(fma(F, F, 2.0)));
} else if (x <= 2.6e-7) {
tmp = (-1.0 - x) / sin(B);
} else {
tmp = t_0;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(Float64(F / B) * Float64(-1.0 / F))) tmp = 0.0 if (x <= -7.5e-33) tmp = t_0; elseif (x <= 5.7e-155) tmp = Float64(Float64(F / sin(B)) * Float64(1.0 / sqrt(fma(F, F, 2.0)))); elseif (x <= 2.6e-7) tmp = Float64(Float64(-1.0 - x) / 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[(N[(F / B), $MachinePrecision] * N[(-1.0 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7.5e-33], t$95$0, If[LessEqual[x, 5.7e-155], N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(F * F + 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.6e-7], N[(N[(-1.0 - x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{-1}{\tan B} + \frac{F}{B} \cdot \frac{-1}{F}\\
\mathbf{if}\;x \leq -7.5 \cdot 10^{-33}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 5.7 \cdot 10^{-155}:\\
\;\;\;\;\frac{F}{\sin B} \cdot \frac{1}{\sqrt{\mathsf{fma}\left(F, F, 2\right)}}\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{-7}:\\
\;\;\;\;\frac{-1 - x}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -7.5000000000000001e-33 or 2.59999999999999999e-7 < x Initial program 94.4%
Taylor expanded in F around -inf
lower-/.f6487.3
Applied rewrites87.3%
Taylor expanded in B around 0
Applied rewrites89.6%
if -7.5000000000000001e-33 < x < 5.69999999999999965e-155Initial program 77.7%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites81.2%
Taylor expanded in x around 0
+-commutativeN/A
associate-*l/N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lift-sin.f64N/A
lift-/.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f6461.3
Applied rewrites61.3%
lift-pow.f64N/A
lift-fma.f64N/A
lower-sqrt.f64N/A
unpow-1N/A
pow2N/A
+-commutativeN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f6461.4
Applied rewrites61.4%
if 5.69999999999999965e-155 < x < 2.59999999999999999e-7Initial program 46.0%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6443.0
Applied rewrites43.0%
Taylor expanded in B around 0
Applied rewrites43.0%
Final simplification72.0%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ F (sin B))))
(if (<= F -0.0046)
(/ (- -1.0 x) (sin B))
(if (<= F -8.4e-97)
(* t_0 (/ 1.0 (sqrt (fma F F 2.0))))
(if (<= F 1.45e-151)
(/ (- (* (sqrt 0.5) F) x) B)
(if (<= F 5.5e-19) (* t_0 (sqrt 0.5)) (/ (- 1.0 x) (sin B))))))))
double code(double F, double B, double x) {
double t_0 = F / sin(B);
double tmp;
if (F <= -0.0046) {
tmp = (-1.0 - x) / sin(B);
} else if (F <= -8.4e-97) {
tmp = t_0 * (1.0 / sqrt(fma(F, F, 2.0)));
} else if (F <= 1.45e-151) {
tmp = ((sqrt(0.5) * F) - x) / B;
} else if (F <= 5.5e-19) {
tmp = t_0 * sqrt(0.5);
} else {
tmp = (1.0 - x) / sin(B);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(F / sin(B)) tmp = 0.0 if (F <= -0.0046) tmp = Float64(Float64(-1.0 - x) / sin(B)); elseif (F <= -8.4e-97) tmp = Float64(t_0 * Float64(1.0 / sqrt(fma(F, F, 2.0)))); elseif (F <= 1.45e-151) tmp = Float64(Float64(Float64(sqrt(0.5) * F) - x) / B); elseif (F <= 5.5e-19) tmp = Float64(t_0 * sqrt(0.5)); else tmp = Float64(Float64(1.0 - x) / sin(B)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -0.0046], N[(N[(-1.0 - x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -8.4e-97], N[(t$95$0 * N[(1.0 / N[Sqrt[N[(F * F + 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.45e-151], N[(N[(N[(N[Sqrt[0.5], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 5.5e-19], N[(t$95$0 * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{F}{\sin B}\\
\mathbf{if}\;F \leq -0.0046:\\
\;\;\;\;\frac{-1 - x}{\sin B}\\
\mathbf{elif}\;F \leq -8.4 \cdot 10^{-97}:\\
\;\;\;\;t\_0 \cdot \frac{1}{\sqrt{\mathsf{fma}\left(F, F, 2\right)}}\\
\mathbf{elif}\;F \leq 1.45 \cdot 10^{-151}:\\
\;\;\;\;\frac{\sqrt{0.5} \cdot F - x}{B}\\
\mathbf{elif}\;F \leq 5.5 \cdot 10^{-19}:\\
\;\;\;\;t\_0 \cdot \sqrt{0.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{\sin B}\\
\end{array}
\end{array}
if F < -0.0045999999999999999Initial program 59.9%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.1
Applied rewrites99.1%
Taylor expanded in B around 0
Applied rewrites75.4%
if -0.0045999999999999999 < F < -8.4000000000000005e-97Initial program 99.4%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.5%
Taylor expanded in x around 0
+-commutativeN/A
associate-*l/N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lift-sin.f64N/A
lift-/.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f6457.6
Applied rewrites57.6%
lift-pow.f64N/A
lift-fma.f64N/A
lower-sqrt.f64N/A
unpow-1N/A
pow2N/A
+-commutativeN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f6457.8
Applied rewrites57.8%
if -8.4000000000000005e-97 < F < 1.45000000000000006e-151Initial program 99.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites45.7%
Taylor expanded in F around 0
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
lift-fma.f6445.7
Applied rewrites45.7%
Taylor expanded in x around 0
Applied rewrites45.7%
if 1.45000000000000006e-151 < F < 5.4999999999999996e-19Initial program 99.3%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.1%
Taylor expanded in x around 0
+-commutativeN/A
associate-*l/N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lift-sin.f64N/A
lift-/.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f6466.3
Applied rewrites66.3%
Taylor expanded in F around 0
Applied rewrites66.3%
if 5.4999999999999996e-19 < F Initial program 75.1%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6498.3
Applied rewrites98.3%
Taylor expanded in B around 0
Applied rewrites71.8%
Final simplification63.8%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* (sqrt 0.5) F)))
(if (<= F -0.00034)
(/ (- -1.0 x) (sin B))
(if (<= F -8.4e-97)
(/ t_0 (sin B))
(if (<= F 1.45e-151)
(/ (- t_0 x) B)
(if (<= F 5.5e-19)
(* (/ F (sin B)) (sqrt 0.5))
(/ (- 1.0 x) (sin B))))))))
double code(double F, double B, double x) {
double t_0 = sqrt(0.5) * F;
double tmp;
if (F <= -0.00034) {
tmp = (-1.0 - x) / sin(B);
} else if (F <= -8.4e-97) {
tmp = t_0 / sin(B);
} else if (F <= 1.45e-151) {
tmp = (t_0 - x) / B;
} else if (F <= 5.5e-19) {
tmp = (F / sin(B)) * sqrt(0.5);
} else {
tmp = (1.0 - x) / sin(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) :: t_0
real(8) :: tmp
t_0 = sqrt(0.5d0) * f
if (f <= (-0.00034d0)) then
tmp = ((-1.0d0) - x) / sin(b)
else if (f <= (-8.4d-97)) then
tmp = t_0 / sin(b)
else if (f <= 1.45d-151) then
tmp = (t_0 - x) / b
else if (f <= 5.5d-19) then
tmp = (f / sin(b)) * sqrt(0.5d0)
else
tmp = (1.0d0 - x) / sin(b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = Math.sqrt(0.5) * F;
double tmp;
if (F <= -0.00034) {
tmp = (-1.0 - x) / Math.sin(B);
} else if (F <= -8.4e-97) {
tmp = t_0 / Math.sin(B);
} else if (F <= 1.45e-151) {
tmp = (t_0 - x) / B;
} else if (F <= 5.5e-19) {
tmp = (F / Math.sin(B)) * Math.sqrt(0.5);
} else {
tmp = (1.0 - x) / Math.sin(B);
}
return tmp;
}
def code(F, B, x): t_0 = math.sqrt(0.5) * F tmp = 0 if F <= -0.00034: tmp = (-1.0 - x) / math.sin(B) elif F <= -8.4e-97: tmp = t_0 / math.sin(B) elif F <= 1.45e-151: tmp = (t_0 - x) / B elif F <= 5.5e-19: tmp = (F / math.sin(B)) * math.sqrt(0.5) else: tmp = (1.0 - x) / math.sin(B) return tmp
function code(F, B, x) t_0 = Float64(sqrt(0.5) * F) tmp = 0.0 if (F <= -0.00034) tmp = Float64(Float64(-1.0 - x) / sin(B)); elseif (F <= -8.4e-97) tmp = Float64(t_0 / sin(B)); elseif (F <= 1.45e-151) tmp = Float64(Float64(t_0 - x) / B); elseif (F <= 5.5e-19) tmp = Float64(Float64(F / sin(B)) * sqrt(0.5)); else tmp = Float64(Float64(1.0 - x) / sin(B)); end return tmp end
function tmp_2 = code(F, B, x) t_0 = sqrt(0.5) * F; tmp = 0.0; if (F <= -0.00034) tmp = (-1.0 - x) / sin(B); elseif (F <= -8.4e-97) tmp = t_0 / sin(B); elseif (F <= 1.45e-151) tmp = (t_0 - x) / B; elseif (F <= 5.5e-19) tmp = (F / sin(B)) * sqrt(0.5); else tmp = (1.0 - x) / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[Sqrt[0.5], $MachinePrecision] * F), $MachinePrecision]}, If[LessEqual[F, -0.00034], N[(N[(-1.0 - x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -8.4e-97], N[(t$95$0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.45e-151], N[(N[(t$95$0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 5.5e-19], N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{0.5} \cdot F\\
\mathbf{if}\;F \leq -0.00034:\\
\;\;\;\;\frac{-1 - x}{\sin B}\\
\mathbf{elif}\;F \leq -8.4 \cdot 10^{-97}:\\
\;\;\;\;\frac{t\_0}{\sin B}\\
\mathbf{elif}\;F \leq 1.45 \cdot 10^{-151}:\\
\;\;\;\;\frac{t\_0 - x}{B}\\
\mathbf{elif}\;F \leq 5.5 \cdot 10^{-19}:\\
\;\;\;\;\frac{F}{\sin B} \cdot \sqrt{0.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{\sin B}\\
\end{array}
\end{array}
if F < -3.4e-4Initial program 59.9%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.1
Applied rewrites99.1%
Taylor expanded in B around 0
Applied rewrites75.4%
if -3.4e-4 < F < -8.4000000000000005e-97Initial program 99.4%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.5%
Taylor expanded in x around 0
+-commutativeN/A
associate-*l/N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lift-sin.f64N/A
lift-/.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f6457.6
Applied rewrites57.6%
Taylor expanded in F around 0
metadata-evalN/A
sqrt-unprodN/A
sqrt-unprodN/A
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sqrt.f64N/A
metadata-evalN/A
lift-sin.f6457.7
Applied rewrites57.7%
if -8.4000000000000005e-97 < F < 1.45000000000000006e-151Initial program 99.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites45.7%
Taylor expanded in F around 0
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
lift-fma.f6445.7
Applied rewrites45.7%
Taylor expanded in x around 0
Applied rewrites45.7%
if 1.45000000000000006e-151 < F < 5.4999999999999996e-19Initial program 99.3%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.1%
Taylor expanded in x around 0
+-commutativeN/A
associate-*l/N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lift-sin.f64N/A
lift-/.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f6466.3
Applied rewrites66.3%
Taylor expanded in F around 0
Applied rewrites66.3%
if 5.4999999999999996e-19 < F Initial program 75.1%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6498.3
Applied rewrites98.3%
Taylor expanded in B around 0
Applied rewrites71.8%
Final simplification63.8%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* (sqrt 0.5) F)) (t_1 (/ t_0 (sin B))))
(if (<= F -0.00034)
(/ (- -1.0 x) (sin B))
(if (<= F -8.4e-97)
t_1
(if (<= F 1.45e-151)
(/ (- t_0 x) B)
(if (<= F 5.5e-19) t_1 (/ (- 1.0 x) (sin B))))))))
double code(double F, double B, double x) {
double t_0 = sqrt(0.5) * F;
double t_1 = t_0 / sin(B);
double tmp;
if (F <= -0.00034) {
tmp = (-1.0 - x) / sin(B);
} else if (F <= -8.4e-97) {
tmp = t_1;
} else if (F <= 1.45e-151) {
tmp = (t_0 - x) / B;
} else if (F <= 5.5e-19) {
tmp = t_1;
} else {
tmp = (1.0 - x) / sin(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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt(0.5d0) * f
t_1 = t_0 / sin(b)
if (f <= (-0.00034d0)) then
tmp = ((-1.0d0) - x) / sin(b)
else if (f <= (-8.4d-97)) then
tmp = t_1
else if (f <= 1.45d-151) then
tmp = (t_0 - x) / b
else if (f <= 5.5d-19) then
tmp = t_1
else
tmp = (1.0d0 - x) / sin(b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = Math.sqrt(0.5) * F;
double t_1 = t_0 / Math.sin(B);
double tmp;
if (F <= -0.00034) {
tmp = (-1.0 - x) / Math.sin(B);
} else if (F <= -8.4e-97) {
tmp = t_1;
} else if (F <= 1.45e-151) {
tmp = (t_0 - x) / B;
} else if (F <= 5.5e-19) {
tmp = t_1;
} else {
tmp = (1.0 - x) / Math.sin(B);
}
return tmp;
}
def code(F, B, x): t_0 = math.sqrt(0.5) * F t_1 = t_0 / math.sin(B) tmp = 0 if F <= -0.00034: tmp = (-1.0 - x) / math.sin(B) elif F <= -8.4e-97: tmp = t_1 elif F <= 1.45e-151: tmp = (t_0 - x) / B elif F <= 5.5e-19: tmp = t_1 else: tmp = (1.0 - x) / math.sin(B) return tmp
function code(F, B, x) t_0 = Float64(sqrt(0.5) * F) t_1 = Float64(t_0 / sin(B)) tmp = 0.0 if (F <= -0.00034) tmp = Float64(Float64(-1.0 - x) / sin(B)); elseif (F <= -8.4e-97) tmp = t_1; elseif (F <= 1.45e-151) tmp = Float64(Float64(t_0 - x) / B); elseif (F <= 5.5e-19) tmp = t_1; else tmp = Float64(Float64(1.0 - x) / sin(B)); end return tmp end
function tmp_2 = code(F, B, x) t_0 = sqrt(0.5) * F; t_1 = t_0 / sin(B); tmp = 0.0; if (F <= -0.00034) tmp = (-1.0 - x) / sin(B); elseif (F <= -8.4e-97) tmp = t_1; elseif (F <= 1.45e-151) tmp = (t_0 - x) / B; elseif (F <= 5.5e-19) tmp = t_1; else tmp = (1.0 - x) / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[Sqrt[0.5], $MachinePrecision] * F), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -0.00034], N[(N[(-1.0 - x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -8.4e-97], t$95$1, If[LessEqual[F, 1.45e-151], N[(N[(t$95$0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 5.5e-19], t$95$1, N[(N[(1.0 - x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{0.5} \cdot F\\
t_1 := \frac{t\_0}{\sin B}\\
\mathbf{if}\;F \leq -0.00034:\\
\;\;\;\;\frac{-1 - x}{\sin B}\\
\mathbf{elif}\;F \leq -8.4 \cdot 10^{-97}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;F \leq 1.45 \cdot 10^{-151}:\\
\;\;\;\;\frac{t\_0 - x}{B}\\
\mathbf{elif}\;F \leq 5.5 \cdot 10^{-19}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{\sin B}\\
\end{array}
\end{array}
if F < -3.4e-4Initial program 59.9%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.1
Applied rewrites99.1%
Taylor expanded in B around 0
Applied rewrites75.4%
if -3.4e-4 < F < -8.4000000000000005e-97 or 1.45000000000000006e-151 < F < 5.4999999999999996e-19Initial program 99.3%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.3%
Taylor expanded in x around 0
+-commutativeN/A
associate-*l/N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lift-sin.f64N/A
lift-/.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f6462.1
Applied rewrites62.1%
Taylor expanded in F around 0
metadata-evalN/A
sqrt-unprodN/A
sqrt-unprodN/A
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sqrt.f64N/A
metadata-evalN/A
lift-sin.f6462.0
Applied rewrites62.0%
if -8.4000000000000005e-97 < F < 1.45000000000000006e-151Initial program 99.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites45.7%
Taylor expanded in F around 0
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
lift-fma.f6445.7
Applied rewrites45.7%
Taylor expanded in x around 0
Applied rewrites45.7%
if 5.4999999999999996e-19 < F Initial program 75.1%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6498.3
Applied rewrites98.3%
Taylor expanded in B around 0
Applied rewrites71.8%
Final simplification63.8%
(FPCore (F B x)
:precision binary64
(if (<= F -5.5e+17)
(/ -1.0 (sin B))
(if (<= F 6.5e+23)
(/ (- (* (sqrt (/ 1.0 (fma 2.0 x (fma F F 2.0)))) F) x) B)
(if (<= F 2.55e+79)
(/ 1.0 (sin B))
(/
(- (fma (* B B) (fma 0.5 x (* 0.16666666666666666 (- 1.0 x))) 1.0) x)
B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -5.5e+17) {
tmp = -1.0 / sin(B);
} else if (F <= 6.5e+23) {
tmp = ((sqrt((1.0 / fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B;
} else if (F <= 2.55e+79) {
tmp = 1.0 / sin(B);
} else {
tmp = (fma((B * B), fma(0.5, x, (0.16666666666666666 * (1.0 - x))), 1.0) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -5.5e+17) tmp = Float64(-1.0 / sin(B)); elseif (F <= 6.5e+23) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 / fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B); elseif (F <= 2.55e+79) tmp = Float64(1.0 / sin(B)); else tmp = Float64(Float64(fma(Float64(B * B), fma(0.5, x, Float64(0.16666666666666666 * Float64(1.0 - x))), 1.0) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -5.5e+17], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 6.5e+23], N[(N[(N[(N[Sqrt[N[(1.0 / N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 2.55e+79], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(B * B), $MachinePrecision] * N[(0.5 * x + N[(0.16666666666666666 * N[(1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -5.5 \cdot 10^{+17}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 6.5 \cdot 10^{+23}:\\
\;\;\;\;\frac{\sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} \cdot F - x}{B}\\
\mathbf{elif}\;F \leq 2.55 \cdot 10^{+79}:\\
\;\;\;\;\frac{1}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(0.5, x, 0.16666666666666666 \cdot \left(1 - x\right)\right), 1\right) - x}{B}\\
\end{array}
\end{array}
if F < -5.5e17Initial program 57.7%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in x around 0
lower-/.f64N/A
lift-sin.f6461.0
Applied rewrites61.0%
if -5.5e17 < F < 6.4999999999999996e23Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites43.8%
lift-pow.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
unpow-1N/A
lower-/.f64N/A
pow2N/A
associate-+r+N/A
pow2N/A
lift-fma.f64N/A
lift-fma.f6443.8
Applied rewrites43.8%
if 6.4999999999999996e23 < F < 2.5500000000000001e79Initial program 99.7%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in x around 0
Applied rewrites71.3%
if 2.5500000000000001e79 < F Initial program 63.4%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in B around 0
metadata-evalN/A
lower-/.f64N/A
Applied rewrites63.1%
(FPCore (F B x)
:precision binary64
(if (<= F -3.4e-11)
(/ (- -1.0 x) (sin B))
(if (<= F 5e-19)
(/ (- (* (sqrt (/ 1.0 (fma 2.0 x (fma F F 2.0)))) F) x) B)
(/ (- 1.0 x) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.4e-11) {
tmp = (-1.0 - x) / sin(B);
} else if (F <= 5e-19) {
tmp = ((sqrt((1.0 / fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B;
} else {
tmp = (1.0 - x) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -3.4e-11) tmp = Float64(Float64(-1.0 - x) / sin(B)); elseif (F <= 5e-19) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 / fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B); else tmp = Float64(Float64(1.0 - x) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -3.4e-11], N[(N[(-1.0 - x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 5e-19], N[(N[(N[(N[Sqrt[N[(1.0 / N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.4 \cdot 10^{-11}:\\
\;\;\;\;\frac{-1 - x}{\sin B}\\
\mathbf{elif}\;F \leq 5 \cdot 10^{-19}:\\
\;\;\;\;\frac{\sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{\sin B}\\
\end{array}
\end{array}
if F < -3.3999999999999999e-11Initial program 60.4%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6498.0
Applied rewrites98.0%
Taylor expanded in B around 0
Applied rewrites74.6%
if -3.3999999999999999e-11 < F < 5.0000000000000004e-19Initial program 99.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites43.3%
lift-pow.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
unpow-1N/A
lower-/.f64N/A
pow2N/A
associate-+r+N/A
pow2N/A
lift-fma.f64N/A
lift-fma.f6443.3
Applied rewrites43.3%
if 5.0000000000000004e-19 < F Initial program 75.5%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6496.9
Applied rewrites96.9%
Taylor expanded in B around 0
Applied rewrites70.8%
Final simplification59.6%
(FPCore (F B x)
:precision binary64
(if (<= F -5.5e+17)
(/ -1.0 (sin B))
(if (<= F 5e-19)
(/ (- (* (sqrt (/ 1.0 (fma 2.0 x (fma F F 2.0)))) F) x) B)
(/ (- 1.0 x) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -5.5e+17) {
tmp = -1.0 / sin(B);
} else if (F <= 5e-19) {
tmp = ((sqrt((1.0 / fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B;
} else {
tmp = (1.0 - x) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -5.5e+17) tmp = Float64(-1.0 / sin(B)); elseif (F <= 5e-19) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 / fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B); else tmp = Float64(Float64(1.0 - x) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -5.5e+17], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 5e-19], N[(N[(N[(N[Sqrt[N[(1.0 / N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -5.5 \cdot 10^{+17}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 5 \cdot 10^{-19}:\\
\;\;\;\;\frac{\sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{\sin B}\\
\end{array}
\end{array}
if F < -5.5e17Initial program 57.7%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in x around 0
lower-/.f64N/A
lift-sin.f6461.0
Applied rewrites61.0%
if -5.5e17 < F < 5.0000000000000004e-19Initial program 99.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites43.3%
lift-pow.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
unpow-1N/A
lower-/.f64N/A
pow2N/A
associate-+r+N/A
pow2N/A
lift-fma.f64N/A
lift-fma.f6443.3
Applied rewrites43.3%
if 5.0000000000000004e-19 < F Initial program 75.5%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6496.9
Applied rewrites96.9%
Taylor expanded in B around 0
Applied rewrites70.8%
(FPCore (F B x)
:precision binary64
(if (<= F -5.5e+17)
(/ -1.0 (sin B))
(if (<= F 5.5e-19)
(/ (- (* (sqrt (/ 1.0 (fma 2.0 x (fma F F 2.0)))) F) x) B)
(/
(- (fma (* B B) (fma 0.5 x (* 0.16666666666666666 (- 1.0 x))) 1.0) x)
B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -5.5e+17) {
tmp = -1.0 / sin(B);
} else if (F <= 5.5e-19) {
tmp = ((sqrt((1.0 / fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B;
} else {
tmp = (fma((B * B), fma(0.5, x, (0.16666666666666666 * (1.0 - x))), 1.0) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -5.5e+17) tmp = Float64(-1.0 / sin(B)); elseif (F <= 5.5e-19) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 / fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B); else tmp = Float64(Float64(fma(Float64(B * B), fma(0.5, x, Float64(0.16666666666666666 * Float64(1.0 - x))), 1.0) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -5.5e+17], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 5.5e-19], N[(N[(N[(N[Sqrt[N[(1.0 / N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(N[(B * B), $MachinePrecision] * N[(0.5 * x + N[(0.16666666666666666 * N[(1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -5.5 \cdot 10^{+17}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 5.5 \cdot 10^{-19}:\\
\;\;\;\;\frac{\sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(0.5, x, 0.16666666666666666 \cdot \left(1 - x\right)\right), 1\right) - x}{B}\\
\end{array}
\end{array}
if F < -5.5e17Initial program 57.7%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in x around 0
lower-/.f64N/A
lift-sin.f6461.0
Applied rewrites61.0%
if -5.5e17 < F < 5.4999999999999996e-19Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites43.0%
lift-pow.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
unpow-1N/A
lower-/.f64N/A
pow2N/A
associate-+r+N/A
pow2N/A
lift-fma.f64N/A
lift-fma.f6443.0
Applied rewrites43.0%
if 5.4999999999999996e-19 < F Initial program 75.1%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6498.3
Applied rewrites98.3%
Taylor expanded in B around 0
metadata-evalN/A
lower-/.f64N/A
Applied rewrites54.7%
(FPCore (F B x)
:precision binary64
(if (<= F -3.4e-11)
(/ (- -1.0 x) B)
(if (<= F 5.5e-19)
(/ (- (* (sqrt (/ 1.0 (fma 2.0 x (fma F F 2.0)))) F) x) B)
(/
(- (fma (* B B) (fma 0.5 x (* 0.16666666666666666 (- 1.0 x))) 1.0) x)
B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.4e-11) {
tmp = (-1.0 - x) / B;
} else if (F <= 5.5e-19) {
tmp = ((sqrt((1.0 / fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B;
} else {
tmp = (fma((B * B), fma(0.5, x, (0.16666666666666666 * (1.0 - x))), 1.0) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -3.4e-11) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 5.5e-19) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 / fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B); else tmp = Float64(Float64(fma(Float64(B * B), fma(0.5, x, Float64(0.16666666666666666 * Float64(1.0 - x))), 1.0) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -3.4e-11], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 5.5e-19], N[(N[(N[(N[Sqrt[N[(1.0 / N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(N[(B * B), $MachinePrecision] * N[(0.5 * x + N[(0.16666666666666666 * N[(1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.4 \cdot 10^{-11}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 5.5 \cdot 10^{-19}:\\
\;\;\;\;\frac{\sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(0.5, x, 0.16666666666666666 \cdot \left(1 - x\right)\right), 1\right) - x}{B}\\
\end{array}
\end{array}
if F < -3.3999999999999999e-11Initial program 60.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites27.0%
Taylor expanded in F around -inf
Applied rewrites44.4%
if -3.3999999999999999e-11 < F < 5.4999999999999996e-19Initial program 99.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites43.0%
lift-pow.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
unpow-1N/A
lower-/.f64N/A
pow2N/A
associate-+r+N/A
pow2N/A
lift-fma.f64N/A
lift-fma.f6443.0
Applied rewrites43.0%
if 5.4999999999999996e-19 < F Initial program 75.1%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6498.3
Applied rewrites98.3%
Taylor expanded in B around 0
metadata-evalN/A
lower-/.f64N/A
Applied rewrites54.7%
(FPCore (F B x)
:precision binary64
(if (<= F -6.6e+30)
(/ (- -1.0 x) B)
(if (<= F 5.5e-19)
(/ (- (* (sqrt 0.5) F) x) B)
(/
(- (fma (* B B) (fma 0.5 x (* 0.16666666666666666 (- 1.0 x))) 1.0) x)
B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -6.6e+30) {
tmp = (-1.0 - x) / B;
} else if (F <= 5.5e-19) {
tmp = ((sqrt(0.5) * F) - x) / B;
} else {
tmp = (fma((B * B), fma(0.5, x, (0.16666666666666666 * (1.0 - x))), 1.0) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -6.6e+30) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 5.5e-19) tmp = Float64(Float64(Float64(sqrt(0.5) * F) - x) / B); else tmp = Float64(Float64(fma(Float64(B * B), fma(0.5, x, Float64(0.16666666666666666 * Float64(1.0 - x))), 1.0) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -6.6e+30], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 5.5e-19], N[(N[(N[(N[Sqrt[0.5], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(N[(B * B), $MachinePrecision] * N[(0.5 * x + N[(0.16666666666666666 * N[(1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -6.6 \cdot 10^{+30}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 5.5 \cdot 10^{-19}:\\
\;\;\;\;\frac{\sqrt{0.5} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(0.5, x, 0.16666666666666666 \cdot \left(1 - x\right)\right), 1\right) - x}{B}\\
\end{array}
\end{array}
if F < -6.60000000000000053e30Initial program 55.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites25.7%
Taylor expanded in F around -inf
Applied rewrites45.3%
if -6.60000000000000053e30 < F < 5.4999999999999996e-19Initial program 99.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites42.5%
Taylor expanded in F around 0
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
lift-fma.f6442.6
Applied rewrites42.6%
Taylor expanded in x around 0
Applied rewrites42.5%
if 5.4999999999999996e-19 < F Initial program 75.1%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6498.3
Applied rewrites98.3%
Taylor expanded in B around 0
metadata-evalN/A
lower-/.f64N/A
Applied rewrites54.7%
(FPCore (F B x) :precision binary64 (if (<= F -6.6e+30) (/ (- -1.0 x) B) (if (<= F 9000000000000.0) (/ (- (* (sqrt 0.5) F) x) B) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -6.6e+30) {
tmp = (-1.0 - x) / B;
} else if (F <= 9000000000000.0) {
tmp = ((sqrt(0.5) * F) - 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 <= (-6.6d+30)) then
tmp = ((-1.0d0) - x) / b
else if (f <= 9000000000000.0d0) then
tmp = ((sqrt(0.5d0) * f) - 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 <= -6.6e+30) {
tmp = (-1.0 - x) / B;
} else if (F <= 9000000000000.0) {
tmp = ((Math.sqrt(0.5) * F) - x) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -6.6e+30: tmp = (-1.0 - x) / B elif F <= 9000000000000.0: tmp = ((math.sqrt(0.5) * F) - x) / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -6.6e+30) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 9000000000000.0) tmp = Float64(Float64(Float64(sqrt(0.5) * F) - 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 <= -6.6e+30) tmp = (-1.0 - x) / B; elseif (F <= 9000000000000.0) tmp = ((sqrt(0.5) * F) - x) / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -6.6e+30], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 9000000000000.0], N[(N[(N[(N[Sqrt[0.5], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -6.6 \cdot 10^{+30}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 9000000000000:\\
\;\;\;\;\frac{\sqrt{0.5} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -6.60000000000000053e30Initial program 55.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites25.7%
Taylor expanded in F around -inf
Applied rewrites45.3%
if -6.60000000000000053e30 < F < 9e12Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites42.9%
Taylor expanded in F around 0
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
lift-fma.f6443.0
Applied rewrites43.0%
Taylor expanded in x around 0
Applied rewrites42.9%
if 9e12 < F Initial program 72.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites41.7%
Taylor expanded in F around inf
Applied rewrites53.9%
(FPCore (F B x) :precision binary64 (if (<= F -1.95e-13) (/ (- -1.0 x) B) (if (<= F 2e-65) (/ (- x) B) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.95e-13) {
tmp = (-1.0 - x) / B;
} else if (F <= 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 <= (-1.95d-13)) then
tmp = ((-1.0d0) - x) / b
else if (f <= 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 <= -1.95e-13) {
tmp = (-1.0 - x) / B;
} else if (F <= 2e-65) {
tmp = -x / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -1.95e-13: tmp = (-1.0 - x) / B elif F <= 2e-65: tmp = -x / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -1.95e-13) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 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 <= -1.95e-13) tmp = (-1.0 - x) / B; elseif (F <= 2e-65) tmp = -x / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -1.95e-13], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 2e-65], N[((-x) / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.95 \cdot 10^{-13}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 2 \cdot 10^{-65}:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -1.95000000000000002e-13Initial program 60.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites27.0%
Taylor expanded in F around -inf
Applied rewrites44.4%
if -1.95000000000000002e-13 < F < 1.99999999999999985e-65Initial program 99.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites43.1%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6430.4
Applied rewrites30.4%
if 1.99999999999999985e-65 < F Initial program 78.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites42.6%
Taylor expanded in F around inf
Applied rewrites47.0%
(FPCore (F B x) :precision binary64 (if (<= F -1.95e-13) (/ (- -1.0 x) B) (/ (- x) B)))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.95e-13) {
tmp = (-1.0 - x) / B;
} else {
tmp = -x / B;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-1.95d-13)) then
tmp = ((-1.0d0) - x) / b
else
tmp = -x / b
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -1.95e-13) {
tmp = (-1.0 - x) / B;
} else {
tmp = -x / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -1.95e-13: tmp = (-1.0 - x) / B else: tmp = -x / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -1.95e-13) tmp = Float64(Float64(-1.0 - x) / B); else tmp = Float64(Float64(-x) / B); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -1.95e-13) tmp = (-1.0 - x) / B; else tmp = -x / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -1.95e-13], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], N[((-x) / B), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.95 \cdot 10^{-13}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{B}\\
\end{array}
\end{array}
if F < -1.95000000000000002e-13Initial program 60.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites27.0%
Taylor expanded in F around -inf
Applied rewrites44.4%
if -1.95000000000000002e-13 < F Initial program 90.9%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites42.9%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6429.4
Applied rewrites29.4%
(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 81.6%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites38.0%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6425.0
Applied rewrites25.0%
herbie shell --seed 2025050
(FPCore (F B x)
:name "VandenBroeck and Keller, Equation (23)"
:precision binary64
:pre (TRUE)
(+ (- (* x (/ 1.0 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))