
(FPCore (F B x) :precision binary64 (+ (- (* x (/ 1.0 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))
double code(double F, double B, double x) {
return -(x * (1.0 / tan(B))) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = -(x * (1.0d0 / tan(b))) + ((f / sin(b)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
end function
public static double code(double F, double B, double x) {
return -(x * (1.0 / Math.tan(B))) + ((F / Math.sin(B)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
def code(F, B, x): return -(x * (1.0 / math.tan(B))) + ((F / math.sin(B)) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)))
function code(F, B, x) return Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))) end
function tmp = code(F, B, x) tmp = -(x * (1.0 / tan(B))) + ((F / sin(B)) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); end
code[F_, B_, x_] := N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], (-N[(1.0 / 2.0), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 24 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (F B x) :precision binary64 (+ (- (* x (/ 1.0 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))
double code(double F, double B, double x) {
return -(x * (1.0 / tan(B))) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = -(x * (1.0d0 / tan(b))) + ((f / sin(b)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
end function
public static double code(double F, double B, double x) {
return -(x * (1.0 / Math.tan(B))) + ((F / Math.sin(B)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
def code(F, B, x): return -(x * (1.0 / math.tan(B))) + ((F / math.sin(B)) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)))
function code(F, B, x) return Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))) end
function tmp = code(F, B, x) tmp = -(x * (1.0 / tan(B))) + ((F / sin(B)) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); end
code[F_, B_, x_] := N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], (-N[(1.0 / 2.0), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\end{array}
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= F -8.4e+55)
(+ t_0 (/ -1.0 (sin B)))
(if (<= F 5e+16)
(fma F (/ (pow (fma 2.0 x (fma F F 2.0)) -0.5) (sin B)) t_0)
(/ (- 1.0 (* (cos B) x)) (sin B))))))
double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (F <= -8.4e+55) {
tmp = t_0 + (-1.0 / sin(B));
} else if (F <= 5e+16) {
tmp = fma(F, (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) / sin(B)), t_0);
} else {
tmp = (1.0 - (cos(B) * x)) / sin(B);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (F <= -8.4e+55) tmp = Float64(t_0 + Float64(-1.0 / sin(B))); elseif (F <= 5e+16) tmp = fma(F, Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) / sin(B)), t_0); else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -8.4e+55], N[(t$95$0 + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 5e+16], 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[(N[(1.0 - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -8.4 \cdot 10^{+55}:\\
\;\;\;\;t\_0 + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 5 \cdot 10^{+16}:\\
\;\;\;\;\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}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -8.4000000000000002e55Initial program 50.0%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.9
Applied rewrites99.9%
if -8.4000000000000002e55 < F < 5e16Initial program 99.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 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.6
Applied rewrites99.6%
lift-+.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
lift-sin.f64N/A
+-commutativeN/A
associate-/l*N/A
Applied rewrites99.6%
if 5e16 < F Initial program 64.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.f6499.8
Applied rewrites99.8%
Final simplification99.7%
(FPCore (F B x)
:precision binary64
(if (<= F -2e+21)
(+ (/ (- x) (tan B)) (/ -1.0 (sin B)))
(if (<= F 50000000.0)
(+
(* x (/ -1.0 (tan B)))
(/ (* F (/ 1.0 (sqrt (fma 2.0 x (fma F F 2.0))))) (sin B)))
(/ (- 1.0 (* (cos B) x)) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -2e+21) {
tmp = (-x / tan(B)) + (-1.0 / sin(B));
} else if (F <= 50000000.0) {
tmp = (x * (-1.0 / tan(B))) + ((F * (1.0 / sqrt(fma(2.0, x, fma(F, F, 2.0))))) / sin(B));
} else {
tmp = (1.0 - (cos(B) * x)) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -2e+21) tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(-1.0 / sin(B))); elseif (F <= 50000000.0) tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(Float64(F * Float64(1.0 / sqrt(fma(2.0, x, fma(F, F, 2.0))))) / sin(B))); else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -2e+21], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 50000000.0], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(F * N[(1.0 / N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -2 \cdot 10^{+21}:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 50000000:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F \cdot \frac{1}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -2e21Initial program 56.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.9
Applied rewrites99.9%
if -2e21 < F < 5e7Initial program 99.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 rewrites99.4%
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
pow2N/A
+-commutativeN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
+-commutativeN/A
pow2N/A
lower-sqrt.f64N/A
Applied rewrites99.3%
if 5e7 < F Initial program 65.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.8
Applied rewrites99.8%
Final simplification99.6%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= F -2e+21)
(+ t_0 (/ -1.0 (sin B)))
(if (<= F 5e+140)
(+ t_0 (/ (* F (/ 1.0 (sqrt (fma 2.0 x (fma F F 2.0))))) (sin B)))
(/ (- 1.0 (* (cos B) x)) (sin B))))))
double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (F <= -2e+21) {
tmp = t_0 + (-1.0 / sin(B));
} else if (F <= 5e+140) {
tmp = t_0 + ((F * (1.0 / sqrt(fma(2.0, x, fma(F, F, 2.0))))) / sin(B));
} else {
tmp = (1.0 - (cos(B) * x)) / sin(B);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (F <= -2e+21) tmp = Float64(t_0 + Float64(-1.0 / sin(B))); elseif (F <= 5e+140) tmp = Float64(t_0 + Float64(Float64(F * Float64(1.0 / sqrt(fma(2.0, x, fma(F, F, 2.0))))) / sin(B))); else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -2e+21], N[(t$95$0 + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 5e+140], N[(t$95$0 + N[(N[(F * N[(1.0 / N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -2 \cdot 10^{+21}:\\
\;\;\;\;t\_0 + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 5 \cdot 10^{+140}:\\
\;\;\;\;t\_0 + \frac{F \cdot \frac{1}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -2e21Initial program 56.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.9
Applied rewrites99.9%
if -2e21 < F < 5.00000000000000008e140Initial 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.6
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
+-commutativeN/A
Applied rewrites99.5%
if 5.00000000000000008e140 < F Initial program 38.3%
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.9
Applied rewrites99.9%
Final simplification99.7%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= F -2.1e+19)
(+ t_0 (/ -1.0 (sin B)))
(if (<= F 360000.0)
(+ t_0 (/ (* F (pow (fma 2.0 x (fma F F 2.0)) -0.5)) B))
(/ (- 1.0 (* (cos B) x)) (sin B))))))
double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (F <= -2.1e+19) {
tmp = t_0 + (-1.0 / sin(B));
} else if (F <= 360000.0) {
tmp = t_0 + ((F * pow(fma(2.0, x, fma(F, F, 2.0)), -0.5)) / B);
} else {
tmp = (1.0 - (cos(B) * x)) / sin(B);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (F <= -2.1e+19) tmp = Float64(t_0 + Float64(-1.0 / sin(B))); elseif (F <= 360000.0) tmp = Float64(t_0 + Float64(Float64(F * (fma(2.0, x, fma(F, F, 2.0)) ^ -0.5)) / B)); else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -2.1e+19], N[(t$95$0 + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 360000.0], N[(t$95$0 + N[(N[(F * N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -2.1 \cdot 10^{+19}:\\
\;\;\;\;t\_0 + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 360000:\\
\;\;\;\;t\_0 + \frac{F \cdot {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -2.1e19Initial program 56.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.9
Applied rewrites99.9%
if -2.1e19 < F < 3.6e5Initial 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.6
Applied rewrites99.6%
Taylor expanded in B around 0
Applied rewrites87.7%
if 3.6e5 < F Initial program 65.9%
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.6
Applied rewrites99.6%
Final simplification94.1%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= F -1.15e+30)
(+ t_0 (/ -1.0 (sin B)))
(if (<= F 360000.0)
(fma F (/ (pow (fma 2.0 x (fma F F 2.0)) -0.5) B) t_0)
(/ (- 1.0 (* (cos B) x)) (sin B))))))
double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (F <= -1.15e+30) {
tmp = t_0 + (-1.0 / sin(B));
} else if (F <= 360000.0) {
tmp = fma(F, (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) / B), t_0);
} else {
tmp = (1.0 - (cos(B) * x)) / sin(B);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (F <= -1.15e+30) tmp = Float64(t_0 + Float64(-1.0 / sin(B))); elseif (F <= 360000.0) tmp = fma(F, Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) / B), t_0); else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -1.15e+30], N[(t$95$0 + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 360000.0], 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[(N[(1.0 - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -1.15 \cdot 10^{+30}:\\
\;\;\;\;t\_0 + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 360000:\\
\;\;\;\;\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}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -1.15e30Initial program 53.3%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.9
Applied rewrites99.9%
if -1.15e30 < F < 3.6e5Initial 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.6
Applied rewrites99.6%
lift-+.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
lift-sin.f64N/A
+-commutativeN/A
associate-/l*N/A
Applied rewrites99.6%
Taylor expanded in B around 0
Applied rewrites88.1%
if 3.6e5 < F Initial program 65.9%
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.6
Applied rewrites99.6%
Final simplification94.1%
(FPCore (F B x)
:precision binary64
(if (<= F -2.2e-14)
(+ (/ (- x) (tan B)) (/ -1.0 (sin B)))
(if (<= F 3.8e-51)
(/ (* (cos B) (- x)) (sin B))
(/ (- 1.0 (* (cos B) x)) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -2.2e-14) {
tmp = (-x / tan(B)) + (-1.0 / sin(B));
} else if (F <= 3.8e-51) {
tmp = (cos(B) * -x) / sin(B);
} else {
tmp = (1.0 - (cos(B) * 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) :: tmp
if (f <= (-2.2d-14)) then
tmp = (-x / tan(b)) + ((-1.0d0) / sin(b))
else if (f <= 3.8d-51) then
tmp = (cos(b) * -x) / sin(b)
else
tmp = (1.0d0 - (cos(b) * x)) / sin(b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -2.2e-14) {
tmp = (-x / Math.tan(B)) + (-1.0 / Math.sin(B));
} else if (F <= 3.8e-51) {
tmp = (Math.cos(B) * -x) / Math.sin(B);
} else {
tmp = (1.0 - (Math.cos(B) * x)) / Math.sin(B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -2.2e-14: tmp = (-x / math.tan(B)) + (-1.0 / math.sin(B)) elif F <= 3.8e-51: tmp = (math.cos(B) * -x) / math.sin(B) else: tmp = (1.0 - (math.cos(B) * x)) / math.sin(B) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -2.2e-14) tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(-1.0 / sin(B))); elseif (F <= 3.8e-51) tmp = Float64(Float64(cos(B) * Float64(-x)) / sin(B)); else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -2.2e-14) tmp = (-x / tan(B)) + (-1.0 / sin(B)); elseif (F <= 3.8e-51) tmp = (cos(B) * -x) / sin(B); else tmp = (1.0 - (cos(B) * x)) / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -2.2e-14], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 3.8e-51], N[(N[(N[Cos[B], $MachinePrecision] * (-x)), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -2.2 \cdot 10^{-14}:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 3.8 \cdot 10^{-51}:\\
\;\;\;\;\frac{\cos B \cdot \left(-x\right)}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -2.2000000000000001e-14Initial program 57.5%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6498.4
Applied rewrites98.4%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6498.5
Applied rewrites98.5%
if -2.2000000000000001e-14 < F < 3.80000000000000003e-51Initial program 99.4%
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.f6474.9
Applied rewrites74.9%
if 3.80000000000000003e-51 < F Initial program 70.3%
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.f6494.0
Applied rewrites94.0%
Final simplification87.3%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* (cos B) x)))
(if (<= F -2.2e-14)
(/ (- -1.0 t_0) (sin B))
(if (<= F 3.8e-51)
(/ (* (cos B) (- x)) (sin B))
(/ (- 1.0 t_0) (sin B))))))
double code(double F, double B, double x) {
double t_0 = cos(B) * x;
double tmp;
if (F <= -2.2e-14) {
tmp = (-1.0 - t_0) / sin(B);
} else if (F <= 3.8e-51) {
tmp = (cos(B) * -x) / sin(B);
} else {
tmp = (1.0 - t_0) / 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 = cos(b) * x
if (f <= (-2.2d-14)) then
tmp = ((-1.0d0) - t_0) / sin(b)
else if (f <= 3.8d-51) then
tmp = (cos(b) * -x) / sin(b)
else
tmp = (1.0d0 - t_0) / sin(b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = Math.cos(B) * x;
double tmp;
if (F <= -2.2e-14) {
tmp = (-1.0 - t_0) / Math.sin(B);
} else if (F <= 3.8e-51) {
tmp = (Math.cos(B) * -x) / Math.sin(B);
} else {
tmp = (1.0 - t_0) / Math.sin(B);
}
return tmp;
}
def code(F, B, x): t_0 = math.cos(B) * x tmp = 0 if F <= -2.2e-14: tmp = (-1.0 - t_0) / math.sin(B) elif F <= 3.8e-51: tmp = (math.cos(B) * -x) / math.sin(B) else: tmp = (1.0 - t_0) / math.sin(B) return tmp
function code(F, B, x) t_0 = Float64(cos(B) * x) tmp = 0.0 if (F <= -2.2e-14) tmp = Float64(Float64(-1.0 - t_0) / sin(B)); elseif (F <= 3.8e-51) tmp = Float64(Float64(cos(B) * Float64(-x)) / sin(B)); else tmp = Float64(Float64(1.0 - t_0) / sin(B)); end return tmp end
function tmp_2 = code(F, B, x) t_0 = cos(B) * x; tmp = 0.0; if (F <= -2.2e-14) tmp = (-1.0 - t_0) / sin(B); elseif (F <= 3.8e-51) tmp = (cos(B) * -x) / sin(B); else tmp = (1.0 - t_0) / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[F, -2.2e-14], N[(N[(-1.0 - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 3.8e-51], N[(N[(N[Cos[B], $MachinePrecision] * (-x)), $MachinePrecision] / N[Sin[B], $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 -2.2 \cdot 10^{-14}:\\
\;\;\;\;\frac{-1 - t\_0}{\sin B}\\
\mathbf{elif}\;F \leq 3.8 \cdot 10^{-51}:\\
\;\;\;\;\frac{\cos B \cdot \left(-x\right)}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - t\_0}{\sin B}\\
\end{array}
\end{array}
if F < -2.2000000000000001e-14Initial program 57.5%
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.5
Applied rewrites98.5%
if -2.2000000000000001e-14 < F < 3.80000000000000003e-51Initial program 99.4%
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.f6474.9
Applied rewrites74.9%
if 3.80000000000000003e-51 < F Initial program 70.3%
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.f6494.0
Applied rewrites94.0%
Final simplification87.2%
(FPCore (F B x)
:precision binary64
(if (<= F -4.3e-7)
(+ (- (/ x B)) (/ -1.0 (sin B)))
(if (<= F 3.8e-51)
(/ (* (cos B) (- x)) (sin B))
(/ (- 1.0 (* (cos B) x)) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -4.3e-7) {
tmp = -(x / B) + (-1.0 / sin(B));
} else if (F <= 3.8e-51) {
tmp = (cos(B) * -x) / sin(B);
} else {
tmp = (1.0 - (cos(B) * 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) :: tmp
if (f <= (-4.3d-7)) then
tmp = -(x / b) + ((-1.0d0) / sin(b))
else if (f <= 3.8d-51) then
tmp = (cos(b) * -x) / sin(b)
else
tmp = (1.0d0 - (cos(b) * x)) / sin(b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -4.3e-7) {
tmp = -(x / B) + (-1.0 / Math.sin(B));
} else if (F <= 3.8e-51) {
tmp = (Math.cos(B) * -x) / Math.sin(B);
} else {
tmp = (1.0 - (Math.cos(B) * x)) / Math.sin(B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -4.3e-7: tmp = -(x / B) + (-1.0 / math.sin(B)) elif F <= 3.8e-51: tmp = (math.cos(B) * -x) / math.sin(B) else: tmp = (1.0 - (math.cos(B) * x)) / math.sin(B) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -4.3e-7) tmp = Float64(Float64(-Float64(x / B)) + Float64(-1.0 / sin(B))); elseif (F <= 3.8e-51) tmp = Float64(Float64(cos(B) * Float64(-x)) / sin(B)); else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -4.3e-7) tmp = -(x / B) + (-1.0 / sin(B)); elseif (F <= 3.8e-51) tmp = (cos(B) * -x) / sin(B); else tmp = (1.0 - (cos(B) * x)) / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -4.3e-7], N[((-N[(x / B), $MachinePrecision]) + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 3.8e-51], N[(N[(N[Cos[B], $MachinePrecision] * (-x)), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -4.3 \cdot 10^{-7}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 3.8 \cdot 10^{-51}:\\
\;\;\;\;\frac{\cos B \cdot \left(-x\right)}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -4.3000000000000001e-7Initial program 57.5%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6498.4
Applied rewrites98.4%
Taylor expanded in B around 0
lower-/.f6484.8
Applied rewrites84.8%
if -4.3000000000000001e-7 < F < 3.80000000000000003e-51Initial program 99.4%
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.f6474.9
Applied rewrites74.9%
if 3.80000000000000003e-51 < F Initial program 70.3%
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.f6494.0
Applied rewrites94.0%
Final simplification83.7%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (- (/ x B))))
(if (<= F -4.3e-7)
(+ t_0 (/ -1.0 (sin B)))
(if (<= F 126.0)
(/ (* (cos B) (- x)) (sin B))
(+
t_0
(/ (* F (/ (fma (/ (/ (fma 2.0 x 2.0) F) F) -0.5 1.0) F)) (sin B)))))))
double code(double F, double B, double x) {
double t_0 = -(x / B);
double tmp;
if (F <= -4.3e-7) {
tmp = t_0 + (-1.0 / sin(B));
} else if (F <= 126.0) {
tmp = (cos(B) * -x) / sin(B);
} else {
tmp = t_0 + ((F * (fma(((fma(2.0, x, 2.0) / F) / F), -0.5, 1.0) / F)) / sin(B));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(-Float64(x / B)) tmp = 0.0 if (F <= -4.3e-7) tmp = Float64(t_0 + Float64(-1.0 / sin(B))); elseif (F <= 126.0) tmp = Float64(Float64(cos(B) * Float64(-x)) / sin(B)); else tmp = Float64(t_0 + Float64(Float64(F * Float64(fma(Float64(Float64(fma(2.0, x, 2.0) / F) / F), -0.5, 1.0) / F)) / sin(B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = (-N[(x / B), $MachinePrecision])}, If[LessEqual[F, -4.3e-7], N[(t$95$0 + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 126.0], N[(N[(N[Cos[B], $MachinePrecision] * (-x)), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(N[(F * N[(N[(N[(N[(N[(2.0 * x + 2.0), $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -\frac{x}{B}\\
\mathbf{if}\;F \leq -4.3 \cdot 10^{-7}:\\
\;\;\;\;t\_0 + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 126:\\
\;\;\;\;\frac{\cos B \cdot \left(-x\right)}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{F \cdot \frac{\mathsf{fma}\left(\frac{\frac{\mathsf{fma}\left(2, x, 2\right)}{F}}{F}, -0.5, 1\right)}{F}}{\sin B}\\
\end{array}
\end{array}
if F < -4.3000000000000001e-7Initial program 57.5%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6498.4
Applied rewrites98.4%
Taylor expanded in B around 0
lower-/.f6484.8
Applied rewrites84.8%
if -4.3000000000000001e-7 < F < 126Initial program 99.4%
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.f6473.0
Applied rewrites73.0%
if 126 < F Initial program 66.4%
Taylor expanded in F around inf
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites85.8%
Taylor expanded in B around 0
lower-/.f6467.2
Applied rewrites67.2%
metadata-eval67.2
metadata-eval67.2
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites81.1%
Final simplification78.4%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (- (/ x B))) (t_1 (/ 1.0 (sqrt (fma 2.0 x (fma F F 2.0))))))
(if (<= F -1.15e+30)
(+ t_0 (/ -1.0 (sin B)))
(if (<= F 5500.0)
(fma
F
(/ (fma (* 0.16666666666666666 (* B B)) t_1 t_1) B)
(/ (- x) (tan B)))
(+
t_0
(/ (* F (/ (fma (/ (/ (fma 2.0 x 2.0) F) F) -0.5 1.0) F)) (sin B)))))))
double code(double F, double B, double x) {
double t_0 = -(x / B);
double t_1 = 1.0 / sqrt(fma(2.0, x, fma(F, F, 2.0)));
double tmp;
if (F <= -1.15e+30) {
tmp = t_0 + (-1.0 / sin(B));
} else if (F <= 5500.0) {
tmp = fma(F, (fma((0.16666666666666666 * (B * B)), t_1, t_1) / B), (-x / tan(B)));
} else {
tmp = t_0 + ((F * (fma(((fma(2.0, x, 2.0) / F) / F), -0.5, 1.0) / F)) / sin(B));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(-Float64(x / B)) t_1 = Float64(1.0 / sqrt(fma(2.0, x, fma(F, F, 2.0)))) tmp = 0.0 if (F <= -1.15e+30) tmp = Float64(t_0 + Float64(-1.0 / sin(B))); elseif (F <= 5500.0) tmp = fma(F, Float64(fma(Float64(0.16666666666666666 * Float64(B * B)), t_1, t_1) / B), Float64(Float64(-x) / tan(B))); else tmp = Float64(t_0 + Float64(Float64(F * Float64(fma(Float64(Float64(fma(2.0, x, 2.0) / F) / F), -0.5, 1.0) / F)) / sin(B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = (-N[(x / B), $MachinePrecision])}, Block[{t$95$1 = N[(1.0 / N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -1.15e+30], N[(t$95$0 + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 5500.0], N[(F * N[(N[(N[(0.16666666666666666 * N[(B * B), $MachinePrecision]), $MachinePrecision] * t$95$1 + t$95$1), $MachinePrecision] / B), $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(N[(F * N[(N[(N[(N[(N[(2.0 * x + 2.0), $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -\frac{x}{B}\\
t_1 := \frac{1}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}\\
\mathbf{if}\;F \leq -1.15 \cdot 10^{+30}:\\
\;\;\;\;t\_0 + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 5500:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{\mathsf{fma}\left(0.16666666666666666 \cdot \left(B \cdot B\right), t\_1, t\_1\right)}{B}, \frac{-x}{\tan B}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{F \cdot \frac{\mathsf{fma}\left(\frac{\frac{\mathsf{fma}\left(2, x, 2\right)}{F}}{F}, -0.5, 1\right)}{F}}{\sin B}\\
\end{array}
\end{array}
if F < -1.15e30Initial program 53.3%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
Taylor expanded in B around 0
lower-/.f6484.8
Applied rewrites84.8%
if -1.15e30 < F < 5500Initial 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.6
Applied rewrites99.6%
lift-+.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
lift-sin.f64N/A
+-commutativeN/A
associate-/l*N/A
Applied rewrites99.6%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites62.1%
if 5500 < F Initial program 66.4%
Taylor expanded in F around inf
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites85.8%
Taylor expanded in B around 0
lower-/.f6467.2
Applied rewrites67.2%
metadata-eval67.2
metadata-eval67.2
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites81.1%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ 1.0 (sqrt (fma 2.0 x (fma F F 2.0))))))
(if (<= B 3.6e-6)
(/
(-
(fma
(* B B)
(fma (* 0.16666666666666666 F) t_0 (* 0.3333333333333333 x))
(* F t_0))
x)
B)
(+
(* x (/ -1.0 (tan B)))
(/
-1.0
(*
(fma
(-
(* (fma -0.0001984126984126984 (* B B) 0.008333333333333333) (* B B))
0.16666666666666666)
(* B B)
1.0)
B))))))
double code(double F, double B, double x) {
double t_0 = 1.0 / sqrt(fma(2.0, x, fma(F, F, 2.0)));
double tmp;
if (B <= 3.6e-6) {
tmp = (fma((B * B), fma((0.16666666666666666 * F), t_0, (0.3333333333333333 * x)), (F * t_0)) - x) / B;
} else {
tmp = (x * (-1.0 / tan(B))) + (-1.0 / (fma(((fma(-0.0001984126984126984, (B * B), 0.008333333333333333) * (B * B)) - 0.16666666666666666), (B * B), 1.0) * B));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(1.0 / sqrt(fma(2.0, x, fma(F, F, 2.0)))) tmp = 0.0 if (B <= 3.6e-6) tmp = Float64(Float64(fma(Float64(B * B), fma(Float64(0.16666666666666666 * F), t_0, Float64(0.3333333333333333 * x)), Float64(F * t_0)) - x) / B); else tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(-1.0 / Float64(fma(Float64(Float64(fma(-0.0001984126984126984, Float64(B * B), 0.008333333333333333) * Float64(B * B)) - 0.16666666666666666), Float64(B * B), 1.0) * B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(1.0 / N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 3.6e-6], N[(N[(N[(N[(B * B), $MachinePrecision] * N[(N[(0.16666666666666666 * F), $MachinePrecision] * t$95$0 + N[(0.3333333333333333 * x), $MachinePrecision]), $MachinePrecision] + N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[(N[(N[(N[(N[(-0.0001984126984126984 * N[(B * B), $MachinePrecision] + 0.008333333333333333), $MachinePrecision] * N[(B * B), $MachinePrecision]), $MachinePrecision] - 0.16666666666666666), $MachinePrecision] * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}\\
\mathbf{if}\;B \leq 3.6 \cdot 10^{-6}:\\
\;\;\;\;\frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(0.16666666666666666 \cdot F, t\_0, 0.3333333333333333 \cdot x\right), F \cdot t\_0\right) - x}{B}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{\mathsf{fma}\left(\mathsf{fma}\left(-0.0001984126984126984, B \cdot B, 0.008333333333333333\right) \cdot \left(B \cdot B\right) - 0.16666666666666666, B \cdot B, 1\right) \cdot B}\\
\end{array}
\end{array}
if B < 3.59999999999999984e-6Initial program 77.9%
Applied rewrites77.9%
Taylor expanded in B around 0
distribute-lft-neg-inN/A
inv-powN/A
associate-*r/N/A
*-commutativeN/A
+-commutativeN/A
mul-1-negN/A
lower-/.f64N/A
Applied rewrites59.8%
Taylor expanded in F around inf
lower--.f6438.6
Applied rewrites38.6%
Taylor expanded in B around 0
Applied rewrites59.9%
if 3.59999999999999984e-6 < B Initial program 82.1%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6440.7
Applied rewrites40.7%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites51.7%
Final simplification57.6%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ 1.0 (sqrt (fma 2.0 x (fma F F 2.0))))))
(if (<= B 3.6e-6)
(/
(-
(fma
(* B B)
(fma (* 0.16666666666666666 F) t_0 (* 0.3333333333333333 x))
(* F t_0))
x)
B)
(+
(* x (/ -1.0 (tan B)))
(/
-1.0
(*
(fma
(- (* 0.008333333333333333 (* B B)) 0.16666666666666666)
(* B B)
1.0)
B))))))
double code(double F, double B, double x) {
double t_0 = 1.0 / sqrt(fma(2.0, x, fma(F, F, 2.0)));
double tmp;
if (B <= 3.6e-6) {
tmp = (fma((B * B), fma((0.16666666666666666 * F), t_0, (0.3333333333333333 * x)), (F * t_0)) - x) / B;
} else {
tmp = (x * (-1.0 / tan(B))) + (-1.0 / (fma(((0.008333333333333333 * (B * B)) - 0.16666666666666666), (B * B), 1.0) * B));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(1.0 / sqrt(fma(2.0, x, fma(F, F, 2.0)))) tmp = 0.0 if (B <= 3.6e-6) tmp = Float64(Float64(fma(Float64(B * B), fma(Float64(0.16666666666666666 * F), t_0, Float64(0.3333333333333333 * x)), Float64(F * t_0)) - x) / B); else tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(-1.0 / Float64(fma(Float64(Float64(0.008333333333333333 * Float64(B * B)) - 0.16666666666666666), Float64(B * B), 1.0) * B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(1.0 / N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 3.6e-6], N[(N[(N[(N[(B * B), $MachinePrecision] * N[(N[(0.16666666666666666 * F), $MachinePrecision] * t$95$0 + N[(0.3333333333333333 * x), $MachinePrecision]), $MachinePrecision] + N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[(N[(N[(N[(0.008333333333333333 * N[(B * B), $MachinePrecision]), $MachinePrecision] - 0.16666666666666666), $MachinePrecision] * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}\\
\mathbf{if}\;B \leq 3.6 \cdot 10^{-6}:\\
\;\;\;\;\frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(0.16666666666666666 \cdot F, t\_0, 0.3333333333333333 \cdot x\right), F \cdot t\_0\right) - x}{B}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{\mathsf{fma}\left(0.008333333333333333 \cdot \left(B \cdot B\right) - 0.16666666666666666, B \cdot B, 1\right) \cdot B}\\
\end{array}
\end{array}
if B < 3.59999999999999984e-6Initial program 77.9%
Applied rewrites77.9%
Taylor expanded in B around 0
distribute-lft-neg-inN/A
inv-powN/A
associate-*r/N/A
*-commutativeN/A
+-commutativeN/A
mul-1-negN/A
lower-/.f64N/A
Applied rewrites59.8%
Taylor expanded in F around inf
lower--.f6438.6
Applied rewrites38.6%
Taylor expanded in B around 0
Applied rewrites59.9%
if 3.59999999999999984e-6 < B Initial program 82.1%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6440.7
Applied rewrites40.7%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6451.8
Applied rewrites51.8%
Final simplification57.7%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ 1.0 (sqrt (fma 2.0 x (fma F F 2.0))))))
(if (<= B 3.6e-6)
(/
(-
(fma
(* B B)
(fma (* 0.16666666666666666 F) t_0 (* 0.3333333333333333 x))
(* F t_0))
x)
B)
(+
(* x (/ -1.0 (tan B)))
(/ -1.0 (* (fma -0.16666666666666666 (* B B) 1.0) B))))))
double code(double F, double B, double x) {
double t_0 = 1.0 / sqrt(fma(2.0, x, fma(F, F, 2.0)));
double tmp;
if (B <= 3.6e-6) {
tmp = (fma((B * B), fma((0.16666666666666666 * F), t_0, (0.3333333333333333 * x)), (F * t_0)) - x) / B;
} else {
tmp = (x * (-1.0 / tan(B))) + (-1.0 / (fma(-0.16666666666666666, (B * B), 1.0) * B));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(1.0 / sqrt(fma(2.0, x, fma(F, F, 2.0)))) tmp = 0.0 if (B <= 3.6e-6) tmp = Float64(Float64(fma(Float64(B * B), fma(Float64(0.16666666666666666 * F), t_0, Float64(0.3333333333333333 * x)), Float64(F * t_0)) - x) / B); else tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(-1.0 / Float64(fma(-0.16666666666666666, Float64(B * B), 1.0) * B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(1.0 / N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 3.6e-6], N[(N[(N[(N[(B * B), $MachinePrecision] * N[(N[(0.16666666666666666 * F), $MachinePrecision] * t$95$0 + N[(0.3333333333333333 * x), $MachinePrecision]), $MachinePrecision] + N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[(N[(-0.16666666666666666 * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}\\
\mathbf{if}\;B \leq 3.6 \cdot 10^{-6}:\\
\;\;\;\;\frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(0.16666666666666666 \cdot F, t\_0, 0.3333333333333333 \cdot x\right), F \cdot t\_0\right) - x}{B}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{\mathsf{fma}\left(-0.16666666666666666, B \cdot B, 1\right) \cdot B}\\
\end{array}
\end{array}
if B < 3.59999999999999984e-6Initial program 77.9%
Applied rewrites77.9%
Taylor expanded in B around 0
distribute-lft-neg-inN/A
inv-powN/A
associate-*r/N/A
*-commutativeN/A
+-commutativeN/A
mul-1-negN/A
lower-/.f64N/A
Applied rewrites59.8%
Taylor expanded in F around inf
lower--.f6438.6
Applied rewrites38.6%
Taylor expanded in B around 0
Applied rewrites59.9%
if 3.59999999999999984e-6 < B Initial program 82.1%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6440.7
Applied rewrites40.7%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6451.7
Applied rewrites51.7%
Final simplification57.6%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ 1.0 (sqrt (fma 2.0 x (fma F F 2.0))))))
(if (<= F -2.15e+266)
(/ (- -1.0 x) B)
(if (<= F -1.45e+176)
(* (/ -1.0 F) (/ F (sin B)))
(if (<= F 1.36e+76)
(/
(-
(fma
(* B B)
(fma (* 0.16666666666666666 F) t_0 (* 0.3333333333333333 x))
(* F t_0))
x)
B)
(/ (- 1.0 x) B))))))
double code(double F, double B, double x) {
double t_0 = 1.0 / sqrt(fma(2.0, x, fma(F, F, 2.0)));
double tmp;
if (F <= -2.15e+266) {
tmp = (-1.0 - x) / B;
} else if (F <= -1.45e+176) {
tmp = (-1.0 / F) * (F / sin(B));
} else if (F <= 1.36e+76) {
tmp = (fma((B * B), fma((0.16666666666666666 * F), t_0, (0.3333333333333333 * x)), (F * t_0)) - x) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(1.0 / sqrt(fma(2.0, x, fma(F, F, 2.0)))) tmp = 0.0 if (F <= -2.15e+266) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= -1.45e+176) tmp = Float64(Float64(-1.0 / F) * Float64(F / sin(B))); elseif (F <= 1.36e+76) tmp = Float64(Float64(fma(Float64(B * B), fma(Float64(0.16666666666666666 * F), t_0, Float64(0.3333333333333333 * x)), Float64(F * t_0)) - x) / B); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(1.0 / N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -2.15e+266], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, -1.45e+176], N[(N[(-1.0 / F), $MachinePrecision] * N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.36e+76], N[(N[(N[(N[(B * B), $MachinePrecision] * N[(N[(0.16666666666666666 * F), $MachinePrecision] * t$95$0 + N[(0.3333333333333333 * x), $MachinePrecision]), $MachinePrecision] + N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}\\
\mathbf{if}\;F \leq -2.15 \cdot 10^{+266}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq -1.45 \cdot 10^{+176}:\\
\;\;\;\;\frac{-1}{F} \cdot \frac{F}{\sin B}\\
\mathbf{elif}\;F \leq 1.36 \cdot 10^{+76}:\\
\;\;\;\;\frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(0.16666666666666666 \cdot F, t\_0, 0.3333333333333333 \cdot x\right), F \cdot t\_0\right) - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -2.1500000000000001e266Initial program 16.7%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites35.1%
Taylor expanded in F around -inf
distribute-lft-inN/A
metadata-evalN/A
mul-1-negN/A
lower-+.f64N/A
lift-neg.f6484.3
Applied rewrites84.3%
if -2.1500000000000001e266 < F < -1.4500000000000001e176Initial program 18.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 rewrites38.2%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f64N/A
lift-sin.f64N/A
lift-/.f642.2
Applied rewrites2.2%
Taylor expanded in F around -inf
lower-/.f6476.7
Applied rewrites76.7%
if -1.4500000000000001e176 < F < 1.36000000000000004e76Initial program 95.7%
Applied rewrites95.8%
Taylor expanded in B around 0
distribute-lft-neg-inN/A
inv-powN/A
associate-*r/N/A
*-commutativeN/A
+-commutativeN/A
mul-1-negN/A
lower-/.f64N/A
Applied rewrites53.9%
Taylor expanded in F around inf
lower--.f6426.4
Applied rewrites26.4%
Taylor expanded in B around 0
Applied rewrites53.9%
if 1.36000000000000004e76 < F Initial program 54.9%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites22.8%
Taylor expanded in F around inf
lower--.f6438.6
Applied rewrites38.6%
Final simplification53.1%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ 1.0 (sqrt (fma 2.0 x (fma F F 2.0))))))
(if (<= B 3.6e-6)
(/
(-
(fma
(* B B)
(fma (* 0.16666666666666666 F) t_0 (* 0.3333333333333333 x))
(* F t_0))
x)
B)
(+ (* x (/ -1.0 (tan B))) (/ -1.0 B)))))
double code(double F, double B, double x) {
double t_0 = 1.0 / sqrt(fma(2.0, x, fma(F, F, 2.0)));
double tmp;
if (B <= 3.6e-6) {
tmp = (fma((B * B), fma((0.16666666666666666 * F), t_0, (0.3333333333333333 * x)), (F * t_0)) - x) / B;
} else {
tmp = (x * (-1.0 / tan(B))) + (-1.0 / B);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(1.0 / sqrt(fma(2.0, x, fma(F, F, 2.0)))) tmp = 0.0 if (B <= 3.6e-6) tmp = Float64(Float64(fma(Float64(B * B), fma(Float64(0.16666666666666666 * F), t_0, Float64(0.3333333333333333 * x)), Float64(F * t_0)) - x) / B); else tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(-1.0 / B)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(1.0 / N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 3.6e-6], N[(N[(N[(N[(B * B), $MachinePrecision] * N[(N[(0.16666666666666666 * F), $MachinePrecision] * t$95$0 + N[(0.3333333333333333 * x), $MachinePrecision]), $MachinePrecision] + N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}\\
\mathbf{if}\;B \leq 3.6 \cdot 10^{-6}:\\
\;\;\;\;\frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(0.16666666666666666 \cdot F, t\_0, 0.3333333333333333 \cdot x\right), F \cdot t\_0\right) - x}{B}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\
\end{array}
\end{array}
if B < 3.59999999999999984e-6Initial program 77.9%
Applied rewrites77.9%
Taylor expanded in B around 0
distribute-lft-neg-inN/A
inv-powN/A
associate-*r/N/A
*-commutativeN/A
+-commutativeN/A
mul-1-negN/A
lower-/.f64N/A
Applied rewrites59.8%
Taylor expanded in F around inf
lower--.f6438.6
Applied rewrites38.6%
Taylor expanded in B around 0
Applied rewrites59.9%
if 3.59999999999999984e-6 < B Initial program 82.1%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6440.7
Applied rewrites40.7%
Taylor expanded in B around 0
Applied rewrites46.6%
Final simplification56.2%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ 1.0 (sqrt (fma 2.0 x (fma F F 2.0))))))
(if (<= F -2.1e+19)
(+ (- (/ x B)) (/ -1.0 (sin B)))
(if (<= F 1.36e+76)
(/
(-
(fma
(* B B)
(fma (* 0.16666666666666666 F) t_0 (* 0.3333333333333333 x))
(* F t_0))
x)
B)
(/ (- 1.0 x) B)))))
double code(double F, double B, double x) {
double t_0 = 1.0 / sqrt(fma(2.0, x, fma(F, F, 2.0)));
double tmp;
if (F <= -2.1e+19) {
tmp = -(x / B) + (-1.0 / sin(B));
} else if (F <= 1.36e+76) {
tmp = (fma((B * B), fma((0.16666666666666666 * F), t_0, (0.3333333333333333 * x)), (F * t_0)) - x) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(1.0 / sqrt(fma(2.0, x, fma(F, F, 2.0)))) tmp = 0.0 if (F <= -2.1e+19) tmp = Float64(Float64(-Float64(x / B)) + Float64(-1.0 / sin(B))); elseif (F <= 1.36e+76) tmp = Float64(Float64(fma(Float64(B * B), fma(Float64(0.16666666666666666 * F), t_0, Float64(0.3333333333333333 * x)), Float64(F * t_0)) - x) / B); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(1.0 / N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -2.1e+19], N[((-N[(x / B), $MachinePrecision]) + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.36e+76], N[(N[(N[(N[(B * B), $MachinePrecision] * N[(N[(0.16666666666666666 * F), $MachinePrecision] * t$95$0 + N[(0.3333333333333333 * x), $MachinePrecision]), $MachinePrecision] + N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}\\
\mathbf{if}\;F \leq -2.1 \cdot 10^{+19}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 1.36 \cdot 10^{+76}:\\
\;\;\;\;\frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(0.16666666666666666 \cdot F, t\_0, 0.3333333333333333 \cdot x\right), F \cdot t\_0\right) - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -2.1e19Initial program 56.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
Taylor expanded in B around 0
lower-/.f6485.7
Applied rewrites85.7%
if -2.1e19 < F < 1.36000000000000004e76Initial program 99.5%
Applied rewrites99.5%
Taylor expanded in B around 0
distribute-lft-neg-inN/A
inv-powN/A
associate-*r/N/A
*-commutativeN/A
+-commutativeN/A
mul-1-negN/A
lower-/.f64N/A
Applied rewrites48.9%
Taylor expanded in F around inf
lower--.f6424.2
Applied rewrites24.2%
Taylor expanded in B around 0
Applied rewrites48.9%
if 1.36000000000000004e76 < F Initial program 54.9%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites22.8%
Taylor expanded in F around inf
lower--.f6438.6
Applied rewrites38.6%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ 1.0 (sqrt (fma 2.0 x (fma F F 2.0))))))
(if (<= F -1.45e+176)
(/ -1.0 (sin B))
(if (<= F 1.36e+76)
(/
(-
(fma
(* B B)
(fma (* 0.16666666666666666 F) t_0 (* 0.3333333333333333 x))
(* F t_0))
x)
B)
(/ (- 1.0 x) B)))))
double code(double F, double B, double x) {
double t_0 = 1.0 / sqrt(fma(2.0, x, fma(F, F, 2.0)));
double tmp;
if (F <= -1.45e+176) {
tmp = -1.0 / sin(B);
} else if (F <= 1.36e+76) {
tmp = (fma((B * B), fma((0.16666666666666666 * F), t_0, (0.3333333333333333 * x)), (F * t_0)) - x) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(1.0 / sqrt(fma(2.0, x, fma(F, F, 2.0)))) tmp = 0.0 if (F <= -1.45e+176) tmp = Float64(-1.0 / sin(B)); elseif (F <= 1.36e+76) tmp = Float64(Float64(fma(Float64(B * B), fma(Float64(0.16666666666666666 * F), t_0, Float64(0.3333333333333333 * x)), Float64(F * t_0)) - x) / B); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(1.0 / N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -1.45e+176], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.36e+76], N[(N[(N[(N[(B * B), $MachinePrecision] * N[(N[(0.16666666666666666 * F), $MachinePrecision] * t$95$0 + N[(0.3333333333333333 * x), $MachinePrecision]), $MachinePrecision] + N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}\\
\mathbf{if}\;F \leq -1.45 \cdot 10^{+176}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 1.36 \cdot 10^{+76}:\\
\;\;\;\;\frac{\mathsf{fma}\left(B \cdot B, \mathsf{fma}\left(0.16666666666666666 \cdot F, t\_0, 0.3333333333333333 \cdot x\right), F \cdot t\_0\right) - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -1.4500000000000001e176Initial program 17.8%
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 rewrites41.1%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f64N/A
lift-sin.f64N/A
lift-/.f641.8
Applied rewrites1.8%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6460.2
Applied rewrites60.2%
if -1.4500000000000001e176 < F < 1.36000000000000004e76Initial program 95.7%
Applied rewrites95.8%
Taylor expanded in B around 0
distribute-lft-neg-inN/A
inv-powN/A
associate-*r/N/A
*-commutativeN/A
+-commutativeN/A
mul-1-negN/A
lower-/.f64N/A
Applied rewrites53.9%
Taylor expanded in F around inf
lower--.f6426.4
Applied rewrites26.4%
Taylor expanded in B around 0
Applied rewrites53.9%
if 1.36000000000000004e76 < F Initial program 54.9%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites22.8%
Taylor expanded in F around inf
lower--.f6438.6
Applied rewrites38.6%
Final simplification51.3%
(FPCore (F B x)
:precision binary64
(if (<= F -1.45e+176)
(/ -1.0 (sin B))
(if (<= F 50000000.0)
(/ (- (* (sqrt (/ 1.0 (fma 2.0 x (fma F F 2.0)))) F) x) B)
(/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.45e+176) {
tmp = -1.0 / sin(B);
} else if (F <= 50000000.0) {
tmp = ((sqrt((1.0 / fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.45e+176) tmp = Float64(-1.0 / sin(B)); elseif (F <= 50000000.0) 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) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.45e+176], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 50000000.0], 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] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.45 \cdot 10^{+176}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 50000000:\\
\;\;\;\;\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}{B}\\
\end{array}
\end{array}
if F < -1.4500000000000001e176Initial program 17.8%
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 rewrites41.1%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f64N/A
lift-sin.f64N/A
lift-/.f641.8
Applied rewrites1.8%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6460.2
Applied rewrites60.2%
if -1.4500000000000001e176 < F < 5e7Initial program 95.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites52.7%
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.f6452.7
Applied rewrites52.7%
if 5e7 < F Initial program 65.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites32.7%
Taylor expanded in F around inf
lower--.f6444.8
Applied rewrites44.8%
Final simplification51.3%
(FPCore (F B x)
:precision binary64
(if (<= F -1e+59)
(/ (- -1.0 x) B)
(if (<= F 3200000.0)
(/ (- (* (sqrt (/ 1.0 (fma 2.0 x (fma F F 2.0)))) F) x) B)
(/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1e+59) {
tmp = (-1.0 - x) / B;
} else if (F <= 3200000.0) {
tmp = ((sqrt((1.0 / fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1e+59) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 3200000.0) 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) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1e+59], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 3200000.0], 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] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1 \cdot 10^{+59}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 3200000:\\
\;\;\;\;\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}{B}\\
\end{array}
\end{array}
if F < -9.99999999999999972e58Initial program 50.6%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites50.7%
Taylor expanded in F around -inf
distribute-lft-inN/A
metadata-evalN/A
mul-1-negN/A
lower-+.f64N/A
lift-neg.f6462.9
Applied rewrites62.9%
if -9.99999999999999972e58 < F < 3.2e6Initial program 98.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites48.4%
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.f6448.4
Applied rewrites48.4%
if 3.2e6 < F Initial program 65.9%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites32.3%
Taylor expanded in F around inf
lower--.f6444.3
Applied rewrites44.3%
Final simplification50.4%
(FPCore (F B x)
:precision binary64
(if (<= F -3.5e-66)
(/ (- -1.0 x) B)
(if (<= F 44.0)
(/ (- x) B)
(/ (- (fma (/ (/ (fma 2.0 x 2.0) F) F) -0.5 1.0) x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.5e-66) {
tmp = (-1.0 - x) / B;
} else if (F <= 44.0) {
tmp = -x / B;
} else {
tmp = (fma(((fma(2.0, x, 2.0) / F) / F), -0.5, 1.0) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -3.5e-66) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 44.0) tmp = Float64(Float64(-x) / B); else tmp = Float64(Float64(fma(Float64(Float64(fma(2.0, x, 2.0) / F) / F), -0.5, 1.0) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -3.5e-66], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 44.0], N[((-x) / B), $MachinePrecision], N[(N[(N[(N[(N[(N[(2.0 * x + 2.0), $MachinePrecision] / F), $MachinePrecision] / F), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.5 \cdot 10^{-66}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 44:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{\frac{\mathsf{fma}\left(2, x, 2\right)}{F}}{F}, -0.5, 1\right) - x}{B}\\
\end{array}
\end{array}
if F < -3.5e-66Initial program 60.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites53.7%
Taylor expanded in F around -inf
distribute-lft-inN/A
metadata-evalN/A
mul-1-negN/A
lower-+.f64N/A
lift-neg.f6460.7
Applied rewrites60.7%
if -3.5e-66 < F < 44Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites45.8%
Taylor expanded in F around 0
mul-1-negN/A
lift-neg.f6431.7
Applied rewrites31.7%
if 44 < F Initial program 66.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites33.2%
Taylor expanded in F around inf
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
lift-fma.f6445.0
Applied rewrites45.0%
Final simplification43.6%
(FPCore (F B x) :precision binary64 (if (<= F -3.5e-66) (/ (- -1.0 x) B) (if (<= F 4.2e-54) (/ (- x) B) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.5e-66) {
tmp = (-1.0 - x) / B;
} else if (F <= 4.2e-54) {
tmp = -x / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-3.5d-66)) then
tmp = ((-1.0d0) - x) / b
else if (f <= 4.2d-54) then
tmp = -x / b
else
tmp = (1.0d0 - x) / b
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -3.5e-66) {
tmp = (-1.0 - x) / B;
} else if (F <= 4.2e-54) {
tmp = -x / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -3.5e-66: tmp = (-1.0 - x) / B elif F <= 4.2e-54: tmp = -x / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -3.5e-66) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 4.2e-54) tmp = Float64(Float64(-x) / B); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -3.5e-66) tmp = (-1.0 - x) / B; elseif (F <= 4.2e-54) tmp = -x / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -3.5e-66], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 4.2e-54], N[((-x) / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.5 \cdot 10^{-66}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 4.2 \cdot 10^{-54}:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -3.5e-66Initial program 60.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites53.7%
Taylor expanded in F around -inf
distribute-lft-inN/A
metadata-evalN/A
mul-1-negN/A
lower-+.f64N/A
lift-neg.f6460.7
Applied rewrites60.7%
if -3.5e-66 < F < 4.2e-54Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites46.1%
Taylor expanded in F around 0
mul-1-negN/A
lift-neg.f6432.5
Applied rewrites32.5%
if 4.2e-54 < F Initial program 70.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites34.3%
Taylor expanded in F around inf
lower--.f6442.3
Applied rewrites42.3%
Final simplification43.5%
(FPCore (F B x) :precision binary64 (if (<= F 4.2e-54) (/ (- x) B) (/ (- 1.0 x) B)))
double code(double F, double B, double x) {
double tmp;
if (F <= 4.2e-54) {
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 <= 4.2d-54) 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 <= 4.2e-54) {
tmp = -x / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= 4.2e-54: tmp = -x / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= 4.2e-54) 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 <= 4.2e-54) tmp = -x / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, 4.2e-54], N[((-x) / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq 4.2 \cdot 10^{-54}:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < 4.2e-54Initial program 83.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites49.2%
Taylor expanded in F around 0
mul-1-negN/A
lift-neg.f6432.1
Applied rewrites32.1%
if 4.2e-54 < F Initial program 70.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites34.3%
Taylor expanded in F around inf
lower--.f6442.3
Applied rewrites42.3%
(FPCore (F B x) :precision binary64 (if (<= F 7000.0) (/ (- x) B) (/ 1.0 B)))
double code(double F, double B, double x) {
double tmp;
if (F <= 7000.0) {
tmp = -x / B;
} else {
tmp = 1.0 / 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 <= 7000.0d0) then
tmp = -x / b
else
tmp = 1.0d0 / b
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= 7000.0) {
tmp = -x / B;
} else {
tmp = 1.0 / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= 7000.0: tmp = -x / B else: tmp = 1.0 / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= 7000.0) tmp = Float64(Float64(-x) / B); else tmp = Float64(1.0 / B); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= 7000.0) tmp = -x / B; else tmp = 1.0 / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, 7000.0], N[((-x) / B), $MachinePrecision], N[(1.0 / B), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq 7000:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{B}\\
\end{array}
\end{array}
if F < 7e3Initial program 84.2%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites48.9%
Taylor expanded in F around 0
mul-1-negN/A
lift-neg.f6431.6
Applied rewrites31.6%
if 7e3 < F Initial program 66.4%
Applied rewrites66.4%
Taylor expanded in B around 0
distribute-lft-neg-inN/A
inv-powN/A
associate-*r/N/A
*-commutativeN/A
+-commutativeN/A
mul-1-negN/A
lower-/.f64N/A
Applied rewrites33.2%
Taylor expanded in F around inf
lower--.f6444.7
Applied rewrites44.7%
Taylor expanded in x around 0
Applied rewrites28.8%
Final simplification30.8%
(FPCore (F B x) :precision binary64 (/ 1.0 B))
double code(double F, double B, double x) {
return 1.0 / B;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = 1.0d0 / b
end function
public static double code(double F, double B, double x) {
return 1.0 / B;
}
def code(F, B, x): return 1.0 / B
function code(F, B, x) return Float64(1.0 / B) end
function tmp = code(F, B, x) tmp = 1.0 / B; end
code[F_, B_, x_] := N[(1.0 / B), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{B}
\end{array}
Initial program 79.1%
Applied rewrites79.1%
Taylor expanded in B around 0
distribute-lft-neg-inN/A
inv-powN/A
associate-*r/N/A
*-commutativeN/A
+-commutativeN/A
mul-1-negN/A
lower-/.f64N/A
Applied rewrites44.3%
Taylor expanded in F around inf
lower--.f6428.9
Applied rewrites28.9%
Taylor expanded in x around 0
Applied rewrites10.6%
Final simplification10.6%
herbie shell --seed 2025083
(FPCore (F B x)
:name "VandenBroeck and Keller, Equation (23)"
:precision binary64
(+ (- (* x (/ 1.0 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))