
(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 20 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (F B x) :precision binary64 (+ (- (* x (/ 1.0 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))
double code(double F, double B, double x) {
return -(x * (1.0 / tan(B))) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = -(x * (1.0d0 / tan(b))) + ((f / sin(b)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
end function
public static double code(double F, double B, double x) {
return -(x * (1.0 / Math.tan(B))) + ((F / Math.sin(B)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
def code(F, B, x): return -(x * (1.0 / math.tan(B))) + ((F / math.sin(B)) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)))
function code(F, B, x) return Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))) end
function tmp = code(F, B, x) tmp = -(x * (1.0 / tan(B))) + ((F / sin(B)) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); end
code[F_, B_, x_] := N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], (-N[(1.0 / 2.0), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\end{array}
(FPCore (F B x)
:precision binary64
(if (<= F -1e+154)
(/ (- (fma (cos B) x 1.0)) (sin B))
(if (<= F 5e+129)
(- (/ (/ F (sqrt (fma x 2.0 (fma F F 2.0)))) (sin B)) (/ x (tan B)))
(+ (* x (/ -1.0 (tan B))) (/ 1.0 (sin B))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1e+154) {
tmp = -fma(cos(B), x, 1.0) / sin(B);
} else if (F <= 5e+129) {
tmp = ((F / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) / sin(B)) - (x / tan(B));
} else {
tmp = (x * (-1.0 / tan(B))) + (1.0 / sin(B));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1e+154) tmp = Float64(Float64(-fma(cos(B), x, 1.0)) / sin(B)); elseif (F <= 5e+129) tmp = Float64(Float64(Float64(F / sqrt(fma(x, 2.0, fma(F, F, 2.0)))) / sin(B)) - Float64(x / tan(B))); else tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(1.0 / sin(B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1e+154], N[((-N[(N[Cos[B], $MachinePrecision] * x + 1.0), $MachinePrecision]) / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 5e+129], N[(N[(N[(F / N[Sqrt[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1 \cdot 10^{+154}:\\
\;\;\;\;\frac{-\mathsf{fma}\left(\cos B, x, 1\right)}{\sin B}\\
\mathbf{elif}\;F \leq 5 \cdot 10^{+129}:\\
\;\;\;\;\frac{\frac{F}{\sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}}{\sin B} - \frac{x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -1.00000000000000004e154Initial program 32.0%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
+-commutativeN/A
div-add-revN/A
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-sin.f6499.8
Applied rewrites99.8%
if -1.00000000000000004e154 < F < 5.0000000000000003e129Initial program 96.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites99.5%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow1N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lower-sqrt.f6499.6
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6499.6
Applied rewrites99.6%
Applied rewrites99.6%
Applied rewrites99.7%
if 5.0000000000000003e129 < F Initial program 42.9%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6499.8
Applied rewrites99.8%
Final simplification99.7%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* x (/ -1.0 (tan B))))
(t_1 (sqrt (/ 1.0 (+ (fma 2.0 x (* F F)) 2.0))))
(t_2 (/ F (sin B)))
(t_3 (+ t_0 (* t_2 (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (/ -1.0 2.0))))))
(if (<= t_3 -5e+14)
(+ t_0 (/ (- (* -0.16666666666666666 (* B B)) 1.0) B))
(if (<= t_3 5.0)
(* (sqrt (/ 1.0 (fma F F 2.0))) t_2)
(if (<= t_3 1e+110)
(/
(fma
t_1
F
(-
(*
(fma (* 0.16666666666666666 F) t_1 (* 0.3333333333333333 x))
(* B B))
x))
B)
(- (/ (fma (* B B) 0.16666666666666666 1.0) B) (/ x (tan B))))))))
double code(double F, double B, double x) {
double t_0 = x * (-1.0 / tan(B));
double t_1 = sqrt((1.0 / (fma(2.0, x, (F * F)) + 2.0)));
double t_2 = F / sin(B);
double t_3 = t_0 + (t_2 * pow((((F * F) + 2.0) + (2.0 * x)), (-1.0 / 2.0)));
double tmp;
if (t_3 <= -5e+14) {
tmp = t_0 + (((-0.16666666666666666 * (B * B)) - 1.0) / B);
} else if (t_3 <= 5.0) {
tmp = sqrt((1.0 / fma(F, F, 2.0))) * t_2;
} else if (t_3 <= 1e+110) {
tmp = fma(t_1, F, ((fma((0.16666666666666666 * F), t_1, (0.3333333333333333 * x)) * (B * B)) - x)) / B;
} else {
tmp = (fma((B * B), 0.16666666666666666, 1.0) / B) - (x / tan(B));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(x * Float64(-1.0 / tan(B))) t_1 = sqrt(Float64(1.0 / Float64(fma(2.0, x, Float64(F * F)) + 2.0))) t_2 = Float64(F / sin(B)) t_3 = Float64(t_0 + Float64(t_2 * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-1.0 / 2.0)))) tmp = 0.0 if (t_3 <= -5e+14) tmp = Float64(t_0 + Float64(Float64(Float64(-0.16666666666666666 * Float64(B * B)) - 1.0) / B)); elseif (t_3 <= 5.0) tmp = Float64(sqrt(Float64(1.0 / fma(F, F, 2.0))) * t_2); elseif (t_3 <= 1e+110) tmp = Float64(fma(t_1, F, Float64(Float64(fma(Float64(0.16666666666666666 * F), t_1, Float64(0.3333333333333333 * x)) * Float64(B * B)) - x)) / B); else tmp = Float64(Float64(fma(Float64(B * B), 0.16666666666666666, 1.0) / B) - Float64(x / tan(B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(1.0 / N[(N[(2.0 * x + N[(F * F), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$0 + N[(t$95$2 * 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]}, If[LessEqual[t$95$3, -5e+14], N[(t$95$0 + N[(N[(N[(-0.16666666666666666 * N[(B * B), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 5.0], N[(N[Sqrt[N[(1.0 / N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[t$95$3, 1e+110], N[(N[(t$95$1 * F + N[(N[(N[(N[(0.16666666666666666 * F), $MachinePrecision] * t$95$1 + N[(0.3333333333333333 * x), $MachinePrecision]), $MachinePrecision] * N[(B * B), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(N[(B * B), $MachinePrecision] * 0.16666666666666666 + 1.0), $MachinePrecision] / B), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{-1}{\tan B}\\
t_1 := \sqrt{\frac{1}{\mathsf{fma}\left(2, x, F \cdot F\right) + 2}}\\
t_2 := \frac{F}{\sin B}\\
t_3 := t\_0 + t\_2 \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(\frac{-1}{2}\right)}\\
\mathbf{if}\;t\_3 \leq -5 \cdot 10^{+14}:\\
\;\;\;\;t\_0 + \frac{-0.16666666666666666 \cdot \left(B \cdot B\right) - 1}{B}\\
\mathbf{elif}\;t\_3 \leq 5:\\
\;\;\;\;\sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}} \cdot t\_2\\
\mathbf{elif}\;t\_3 \leq 10^{+110}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t\_1, F, \mathsf{fma}\left(0.16666666666666666 \cdot F, t\_1, 0.3333333333333333 \cdot x\right) \cdot \left(B \cdot B\right) - x\right)}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(B \cdot B, 0.16666666666666666, 1\right)}{B} - \frac{x}{\tan B}\\
\end{array}
\end{array}
if (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) < -5e14Initial program 93.8%
Taylor expanded in B around 0
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
lower-/.f64N/A
Applied rewrites62.0%
Taylor expanded in F around -inf
Applied rewrites48.4%
if -5e14 < (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) < 5Initial program 76.2%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-sin.f6443.1
Applied rewrites43.1%
if 5 < (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) < 1e110Initial program 96.7%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites46.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites46.7%
if 1e110 < (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) Initial program 54.9%
Taylor expanded in B around 0
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
lower-/.f64N/A
Applied rewrites70.6%
Taylor expanded in F around inf
Applied rewrites69.4%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
fp-cancel-sub-signN/A
Applied rewrites69.5%
Final simplification51.1%
(FPCore (F B x)
:precision binary64
(if (<= F -5e+144)
(/ (- (fma (cos B) x 1.0)) (sin B))
(if (<= F 1150.0)
(- (/ F (* (sin B) (sqrt (fma 2.0 x (fma F F 2.0))))) (/ x (tan B)))
(+ (* x (/ -1.0 (tan B))) (/ 1.0 (sin B))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -5e+144) {
tmp = -fma(cos(B), x, 1.0) / sin(B);
} else if (F <= 1150.0) {
tmp = (F / (sin(B) * sqrt(fma(2.0, x, fma(F, F, 2.0))))) - (x / tan(B));
} else {
tmp = (x * (-1.0 / tan(B))) + (1.0 / sin(B));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -5e+144) tmp = Float64(Float64(-fma(cos(B), x, 1.0)) / sin(B)); elseif (F <= 1150.0) tmp = Float64(Float64(F / Float64(sin(B) * sqrt(fma(2.0, x, fma(F, F, 2.0))))) - Float64(x / tan(B))); else tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(1.0 / sin(B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -5e+144], N[((-N[(N[Cos[B], $MachinePrecision] * x + 1.0), $MachinePrecision]) / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1150.0], N[(N[(F / N[(N[Sin[B], $MachinePrecision] * N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -5 \cdot 10^{+144}:\\
\;\;\;\;\frac{-\mathsf{fma}\left(\cos B, x, 1\right)}{\sin B}\\
\mathbf{elif}\;F \leq 1150:\\
\;\;\;\;\frac{F}{\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} - \frac{x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -4.9999999999999999e144Initial program 32.0%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
+-commutativeN/A
div-add-revN/A
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-sin.f6499.8
Applied rewrites99.8%
if -4.9999999999999999e144 < F < 1150Initial program 97.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites99.5%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow1N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lower-sqrt.f6499.6
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6499.6
Applied rewrites99.6%
Applied rewrites99.6%
if 1150 < F Initial program 58.9%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6499.8
Applied rewrites99.8%
Final simplification99.7%
(FPCore (F B x)
:precision binary64
(if (<= F -1.5)
(/ (- (fma (cos B) x 1.0)) (sin B))
(if (<= F 1.75)
(- (/ F (* (sin B) (sqrt (fma 2.0 x 2.0)))) (/ x (tan B)))
(+ (* x (/ -1.0 (tan B))) (/ 1.0 (sin B))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.5) {
tmp = -fma(cos(B), x, 1.0) / sin(B);
} else if (F <= 1.75) {
tmp = (F / (sin(B) * sqrt(fma(2.0, x, 2.0)))) - (x / tan(B));
} else {
tmp = (x * (-1.0 / tan(B))) + (1.0 / sin(B));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.5) tmp = Float64(Float64(-fma(cos(B), x, 1.0)) / sin(B)); elseif (F <= 1.75) tmp = Float64(Float64(F / Float64(sin(B) * sqrt(fma(2.0, x, 2.0)))) - Float64(x / tan(B))); else tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(1.0 / sin(B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.5], N[((-N[(N[Cos[B], $MachinePrecision] * x + 1.0), $MachinePrecision]) / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.75], N[(N[(F / N[(N[Sin[B], $MachinePrecision] * N[Sqrt[N[(2.0 * x + 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.5:\\
\;\;\;\;\frac{-\mathsf{fma}\left(\cos B, x, 1\right)}{\sin B}\\
\mathbf{elif}\;F \leq 1.75:\\
\;\;\;\;\frac{F}{\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, 2\right)}} - \frac{x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -1.5Initial program 62.8%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
+-commutativeN/A
div-add-revN/A
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-sin.f6499.8
Applied rewrites99.8%
if -1.5 < F < 1.75Initial program 99.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites99.5%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow1N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lower-sqrt.f6499.6
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6499.6
Applied rewrites99.6%
Applied rewrites99.6%
Taylor expanded in F around 0
Applied rewrites98.4%
if 1.75 < F Initial program 58.9%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6499.8
Applied rewrites99.8%
Final simplification99.2%
(FPCore (F B x)
:precision binary64
(if (<= F -1.05e-30)
(/ (- (fma (cos B) x 1.0)) (sin B))
(if (<= F 14.6)
(- (/ F (* (sqrt (+ (fma 2.0 x (* F F)) 2.0)) B)) (/ x (tan B)))
(+ (* x (/ -1.0 (tan B))) (/ 1.0 (sin B))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.05e-30) {
tmp = -fma(cos(B), x, 1.0) / sin(B);
} else if (F <= 14.6) {
tmp = (F / (sqrt((fma(2.0, x, (F * F)) + 2.0)) * B)) - (x / tan(B));
} else {
tmp = (x * (-1.0 / tan(B))) + (1.0 / sin(B));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.05e-30) tmp = Float64(Float64(-fma(cos(B), x, 1.0)) / sin(B)); elseif (F <= 14.6) tmp = Float64(Float64(F / Float64(sqrt(Float64(fma(2.0, x, Float64(F * F)) + 2.0)) * B)) - Float64(x / tan(B))); else tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(1.0 / sin(B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.05e-30], N[((-N[(N[Cos[B], $MachinePrecision] * x + 1.0), $MachinePrecision]) / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 14.6], N[(N[(F / N[(N[Sqrt[N[(N[(2.0 * x + N[(F * F), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]], $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.05 \cdot 10^{-30}:\\
\;\;\;\;\frac{-\mathsf{fma}\left(\cos B, x, 1\right)}{\sin B}\\
\mathbf{elif}\;F \leq 14.6:\\
\;\;\;\;\frac{F}{\sqrt{\mathsf{fma}\left(2, x, F \cdot F\right) + 2} \cdot B} - \frac{x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -1.0500000000000001e-30Initial program 66.0%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
+-commutativeN/A
div-add-revN/A
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-sin.f6496.5
Applied rewrites96.5%
if -1.0500000000000001e-30 < F < 14.5999999999999996Initial program 99.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites99.5%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow1N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lower-sqrt.f6499.6
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6499.6
Applied rewrites99.6%
Applied rewrites99.6%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6480.8
Applied rewrites80.8%
if 14.5999999999999996 < F Initial program 58.9%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6499.8
Applied rewrites99.8%
Final simplification90.7%
(FPCore (F B x)
:precision binary64
(if (<= F -1.05e-30)
(/ (- (fma (cos B) x 1.0)) (sin B))
(if (<= F 14.6)
(- (/ F (* (sqrt (+ (fma 2.0 x (* F F)) 2.0)) B)) (/ x (tan B)))
(/ (fma -1.0 (* (cos B) x) 1.0) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.05e-30) {
tmp = -fma(cos(B), x, 1.0) / sin(B);
} else if (F <= 14.6) {
tmp = (F / (sqrt((fma(2.0, x, (F * F)) + 2.0)) * B)) - (x / tan(B));
} else {
tmp = fma(-1.0, (cos(B) * x), 1.0) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.05e-30) tmp = Float64(Float64(-fma(cos(B), x, 1.0)) / sin(B)); elseif (F <= 14.6) tmp = Float64(Float64(F / Float64(sqrt(Float64(fma(2.0, x, Float64(F * F)) + 2.0)) * B)) - Float64(x / tan(B))); else tmp = Float64(fma(-1.0, Float64(cos(B) * x), 1.0) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.05e-30], N[((-N[(N[Cos[B], $MachinePrecision] * x + 1.0), $MachinePrecision]) / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 14.6], N[(N[(F / N[(N[Sqrt[N[(N[(2.0 * x + N[(F * F), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]], $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 * N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.05 \cdot 10^{-30}:\\
\;\;\;\;\frac{-\mathsf{fma}\left(\cos B, x, 1\right)}{\sin B}\\
\mathbf{elif}\;F \leq 14.6:\\
\;\;\;\;\frac{F}{\sqrt{\mathsf{fma}\left(2, x, F \cdot F\right) + 2} \cdot B} - \frac{x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-1, \cos B \cdot x, 1\right)}{\sin B}\\
\end{array}
\end{array}
if F < -1.0500000000000001e-30Initial program 66.0%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
+-commutativeN/A
div-add-revN/A
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-sin.f6496.5
Applied rewrites96.5%
if -1.0500000000000001e-30 < F < 14.5999999999999996Initial program 99.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites99.5%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow1N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lower-sqrt.f6499.6
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6499.6
Applied rewrites99.6%
Applied rewrites99.6%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6480.8
Applied rewrites80.8%
if 14.5999999999999996 < F Initial program 58.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites72.4%
Taylor expanded in F around inf
associate-*r/N/A
div-add-revN/A
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6499.7
Applied rewrites99.7%
Final simplification90.7%
(FPCore (F B x) :precision binary64 (if (<= F -1.05e-30) (/ (- (fma (cos B) x 1.0)) (sin B)) (- (/ F (* (sqrt (+ (fma 2.0 x (* F F)) 2.0)) B)) (/ x (tan B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.05e-30) {
tmp = -fma(cos(B), x, 1.0) / sin(B);
} else {
tmp = (F / (sqrt((fma(2.0, x, (F * F)) + 2.0)) * B)) - (x / tan(B));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.05e-30) tmp = Float64(Float64(-fma(cos(B), x, 1.0)) / sin(B)); else tmp = Float64(Float64(F / Float64(sqrt(Float64(fma(2.0, x, Float64(F * F)) + 2.0)) * B)) - Float64(x / tan(B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.05e-30], N[((-N[(N[Cos[B], $MachinePrecision] * x + 1.0), $MachinePrecision]) / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(N[(F / N[(N[Sqrt[N[(N[(2.0 * x + N[(F * F), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]], $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.05 \cdot 10^{-30}:\\
\;\;\;\;\frac{-\mathsf{fma}\left(\cos B, x, 1\right)}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{F}{\sqrt{\mathsf{fma}\left(2, x, F \cdot F\right) + 2} \cdot B} - \frac{x}{\tan B}\\
\end{array}
\end{array}
if F < -1.0500000000000001e-30Initial program 66.0%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
+-commutativeN/A
div-add-revN/A
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-sin.f6496.5
Applied rewrites96.5%
if -1.0500000000000001e-30 < F Initial program 83.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites89.1%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow1N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lower-sqrt.f6489.2
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6489.2
Applied rewrites89.2%
Applied rewrites89.2%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6475.4
Applied rewrites75.4%
Final simplification82.0%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (+ (fma 2.0 x (* F F)) 2.0)))
(if (<= x -1.65e-182)
(fma F (* (sqrt (/ 1.0 t_0)) (/ 1.0 B)) (/ (- x) (tan B)))
(if (<= x 2.6e-128)
(- (/ F (* (sin B) (sqrt (fma 2.0 x (fma F F 2.0))))) (/ x B))
(- (/ F (* (sqrt t_0) B)) (/ x (tan B)))))))
double code(double F, double B, double x) {
double t_0 = fma(2.0, x, (F * F)) + 2.0;
double tmp;
if (x <= -1.65e-182) {
tmp = fma(F, (sqrt((1.0 / t_0)) * (1.0 / B)), (-x / tan(B)));
} else if (x <= 2.6e-128) {
tmp = (F / (sin(B) * sqrt(fma(2.0, x, fma(F, F, 2.0))))) - (x / B);
} else {
tmp = (F / (sqrt(t_0) * B)) - (x / tan(B));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(fma(2.0, x, Float64(F * F)) + 2.0) tmp = 0.0 if (x <= -1.65e-182) tmp = fma(F, Float64(sqrt(Float64(1.0 / t_0)) * Float64(1.0 / B)), Float64(Float64(-x) / tan(B))); elseif (x <= 2.6e-128) tmp = Float64(Float64(F / Float64(sin(B) * sqrt(fma(2.0, x, fma(F, F, 2.0))))) - Float64(x / B)); else tmp = Float64(Float64(F / Float64(sqrt(t_0) * B)) - Float64(x / tan(B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[(2.0 * x + N[(F * F), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]}, If[LessEqual[x, -1.65e-182], N[(F * N[(N[Sqrt[N[(1.0 / t$95$0), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision] + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.6e-128], N[(N[(F / N[(N[Sin[B], $MachinePrecision] * N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], N[(N[(F / N[(N[Sqrt[t$95$0], $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(2, x, F \cdot F\right) + 2\\
\mathbf{if}\;x \leq -1.65 \cdot 10^{-182}:\\
\;\;\;\;\mathsf{fma}\left(F, \sqrt{\frac{1}{t\_0}} \cdot \frac{1}{B}, \frac{-x}{\tan B}\right)\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{-128}:\\
\;\;\;\;\frac{F}{\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} - \frac{x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{F}{\sqrt{t\_0} \cdot B} - \frac{x}{\tan B}\\
\end{array}
\end{array}
if x < -1.64999999999999998e-182Initial program 79.1%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites91.8%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f6482.6
Applied rewrites82.6%
if -1.64999999999999998e-182 < x < 2.59999999999999981e-128Initial program 70.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites73.3%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow1N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lower-sqrt.f6473.3
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6473.3
Applied rewrites73.3%
Applied rewrites73.5%
Taylor expanded in B around 0
lower-/.f6467.0
Applied rewrites67.0%
if 2.59999999999999981e-128 < x Initial program 83.1%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites89.1%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow1N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lower-sqrt.f6489.1
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6489.1
Applied rewrites89.1%
Applied rewrites89.2%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6485.8
Applied rewrites85.8%
(FPCore (F B x) :precision binary64 (if (or (<= x -1.65e-182) (not (<= x 2.6e-128))) (- (/ F (* (sqrt (+ (fma 2.0 x (* F F)) 2.0)) B)) (/ x (tan B))) (- (/ F (* (sin B) (sqrt (fma 2.0 x (fma F F 2.0))))) (/ x B))))
double code(double F, double B, double x) {
double tmp;
if ((x <= -1.65e-182) || !(x <= 2.6e-128)) {
tmp = (F / (sqrt((fma(2.0, x, (F * F)) + 2.0)) * B)) - (x / tan(B));
} else {
tmp = (F / (sin(B) * sqrt(fma(2.0, x, fma(F, F, 2.0))))) - (x / B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if ((x <= -1.65e-182) || !(x <= 2.6e-128)) tmp = Float64(Float64(F / Float64(sqrt(Float64(fma(2.0, x, Float64(F * F)) + 2.0)) * B)) - Float64(x / tan(B))); else tmp = Float64(Float64(F / Float64(sin(B) * sqrt(fma(2.0, x, fma(F, F, 2.0))))) - Float64(x / B)); end return tmp end
code[F_, B_, x_] := If[Or[LessEqual[x, -1.65e-182], N[Not[LessEqual[x, 2.6e-128]], $MachinePrecision]], N[(N[(F / N[(N[Sqrt[N[(N[(2.0 * x + N[(F * F), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]], $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(F / N[(N[Sin[B], $MachinePrecision] * N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.65 \cdot 10^{-182} \lor \neg \left(x \leq 2.6 \cdot 10^{-128}\right):\\
\;\;\;\;\frac{F}{\sqrt{\mathsf{fma}\left(2, x, F \cdot F\right) + 2} \cdot B} - \frac{x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\frac{F}{\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} - \frac{x}{B}\\
\end{array}
\end{array}
if x < -1.64999999999999998e-182 or 2.59999999999999981e-128 < x Initial program 81.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites90.2%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow1N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lower-sqrt.f6490.2
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6490.2
Applied rewrites90.2%
Applied rewrites90.2%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6484.5
Applied rewrites84.5%
if -1.64999999999999998e-182 < x < 2.59999999999999981e-128Initial program 70.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites73.3%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow1N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lower-sqrt.f6473.3
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6473.3
Applied rewrites73.3%
Applied rewrites73.5%
Taylor expanded in B around 0
lower-/.f6467.0
Applied rewrites67.0%
Final simplification79.2%
(FPCore (F B x) :precision binary64 (if (or (<= x -560.0) (not (<= x 5200000000.0))) (+ (* x (/ -1.0 (tan B))) (* (/ F B) (/ 1.0 F))) (- (/ F (* (sin B) (sqrt (fma 2.0 x (fma F F 2.0))))) (/ x B))))
double code(double F, double B, double x) {
double tmp;
if ((x <= -560.0) || !(x <= 5200000000.0)) {
tmp = (x * (-1.0 / tan(B))) + ((F / B) * (1.0 / F));
} else {
tmp = (F / (sin(B) * sqrt(fma(2.0, x, fma(F, F, 2.0))))) - (x / B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if ((x <= -560.0) || !(x <= 5200000000.0)) tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(Float64(F / B) * Float64(1.0 / F))); else tmp = Float64(Float64(F / Float64(sin(B) * sqrt(fma(2.0, x, fma(F, F, 2.0))))) - Float64(x / B)); end return tmp end
code[F_, B_, x_] := If[Or[LessEqual[x, -560.0], N[Not[LessEqual[x, 5200000000.0]], $MachinePrecision]], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(F / B), $MachinePrecision] * N[(1.0 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(F / N[(N[Sin[B], $MachinePrecision] * N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -560 \lor \neg \left(x \leq 5200000000\right):\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{B} \cdot \frac{1}{F}\\
\mathbf{else}:\\
\;\;\;\;\frac{F}{\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} - \frac{x}{B}\\
\end{array}
\end{array}
if x < -560 or 5.2e9 < x Initial program 86.6%
Taylor expanded in F around inf
lower-/.f6492.4
Applied rewrites92.4%
Taylor expanded in B around 0
lower-/.f6492.6
Applied rewrites92.6%
if -560 < x < 5.2e9Initial program 72.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites75.6%
lift-pow.f64N/A
metadata-evalN/A
sqrt-pow1N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-fma.f64N/A
lift-fma.f64N/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lower-sqrt.f6475.6
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6475.6
Applied rewrites75.6%
Applied rewrites75.7%
Taylor expanded in B around 0
lower-/.f6458.8
Applied rewrites58.8%
Final simplification72.0%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (sqrt (/ 1.0 (fma F F (fma 2.0 x 2.0))))))
(if (<= B 440.0)
(/
(-
(fma
t_0
(fma (* (* B B) F) 0.16666666666666666 F)
(*
(fma
(fma (* (- F) -0.019444444444444445) t_0 (* x 0.022222222222222223))
(* B B)
(* 0.3333333333333333 x))
(* B B)))
x)
B)
(+ (* x (/ -1.0 (tan B))) (* (/ F B) (/ 1.0 F))))))
double code(double F, double B, double x) {
double t_0 = sqrt((1.0 / fma(F, F, fma(2.0, x, 2.0))));
double tmp;
if (B <= 440.0) {
tmp = (fma(t_0, fma(((B * B) * F), 0.16666666666666666, F), (fma(fma((-F * -0.019444444444444445), t_0, (x * 0.022222222222222223)), (B * B), (0.3333333333333333 * x)) * (B * B))) - x) / B;
} else {
tmp = (x * (-1.0 / tan(B))) + ((F / B) * (1.0 / F));
}
return tmp;
}
function code(F, B, x) t_0 = sqrt(Float64(1.0 / fma(F, F, fma(2.0, x, 2.0)))) tmp = 0.0 if (B <= 440.0) tmp = Float64(Float64(fma(t_0, fma(Float64(Float64(B * B) * F), 0.16666666666666666, F), Float64(fma(fma(Float64(Float64(-F) * -0.019444444444444445), t_0, Float64(x * 0.022222222222222223)), Float64(B * B), Float64(0.3333333333333333 * x)) * Float64(B * B))) - x) / B); else tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(Float64(F / B) * Float64(1.0 / F))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[Sqrt[N[(1.0 / N[(F * F + N[(2.0 * x + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[B, 440.0], N[(N[(N[(t$95$0 * N[(N[(N[(B * B), $MachinePrecision] * F), $MachinePrecision] * 0.16666666666666666 + F), $MachinePrecision] + N[(N[(N[(N[((-F) * -0.019444444444444445), $MachinePrecision] * t$95$0 + N[(x * 0.022222222222222223), $MachinePrecision]), $MachinePrecision] * N[(B * B), $MachinePrecision] + N[(0.3333333333333333 * x), $MachinePrecision]), $MachinePrecision] * N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(F / B), $MachinePrecision] * N[(1.0 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{\mathsf{fma}\left(F, F, \mathsf{fma}\left(2, x, 2\right)\right)}}\\
\mathbf{if}\;B \leq 440:\\
\;\;\;\;\frac{\mathsf{fma}\left(t\_0, \mathsf{fma}\left(\left(B \cdot B\right) \cdot F, 0.16666666666666666, F\right), \mathsf{fma}\left(\mathsf{fma}\left(\left(-F\right) \cdot -0.019444444444444445, t\_0, x \cdot 0.022222222222222223\right), B \cdot B, 0.3333333333333333 \cdot x\right) \cdot \left(B \cdot B\right)\right) - x}{B}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{B} \cdot \frac{1}{F}\\
\end{array}
\end{array}
if B < 440Initial program 74.7%
Taylor expanded in B around 0
Applied rewrites55.4%
if 440 < B Initial program 87.3%
Taylor expanded in F around inf
lower-/.f6448.8
Applied rewrites48.8%
Taylor expanded in B around 0
lower-/.f6452.8
Applied rewrites52.8%
Final simplification54.7%
(FPCore (F B x)
:precision binary64
(if (<= B 0.16)
(+
(*
(- x)
(/
(fma
(- (* -0.022222222222222223 (* B B)) 0.3333333333333333)
(* B B)
1.0)
B))
(/
(*
(sqrt (/ 1.0 (fma F F (fma 2.0 x 2.0))))
(fma (* (* B B) F) 0.16666666666666666 F))
B))
(* (sqrt (/ 1.0 (fma F F 2.0))) (/ F (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (B <= 0.16) {
tmp = (-x * (fma(((-0.022222222222222223 * (B * B)) - 0.3333333333333333), (B * B), 1.0) / B)) + ((sqrt((1.0 / fma(F, F, fma(2.0, x, 2.0)))) * fma(((B * B) * F), 0.16666666666666666, F)) / B);
} else {
tmp = sqrt((1.0 / fma(F, F, 2.0))) * (F / sin(B));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (B <= 0.16) tmp = Float64(Float64(Float64(-x) * Float64(fma(Float64(Float64(-0.022222222222222223 * Float64(B * B)) - 0.3333333333333333), Float64(B * B), 1.0) / B)) + Float64(Float64(sqrt(Float64(1.0 / fma(F, F, fma(2.0, x, 2.0)))) * fma(Float64(Float64(B * B) * F), 0.16666666666666666, F)) / B)); else tmp = Float64(sqrt(Float64(1.0 / fma(F, F, 2.0))) * Float64(F / sin(B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[B, 0.16], N[(N[((-x) * N[(N[(N[(N[(-0.022222222222222223 * N[(B * B), $MachinePrecision]), $MachinePrecision] - 0.3333333333333333), $MachinePrecision] * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[N[(1.0 / N[(F * F + N[(2.0 * x + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(B * B), $MachinePrecision] * F), $MachinePrecision] * 0.16666666666666666 + F), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(1.0 / N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 0.16:\\
\;\;\;\;\left(-x\right) \cdot \frac{\mathsf{fma}\left(-0.022222222222222223 \cdot \left(B \cdot B\right) - 0.3333333333333333, B \cdot B, 1\right)}{B} + \frac{\sqrt{\frac{1}{\mathsf{fma}\left(F, F, \mathsf{fma}\left(2, x, 2\right)\right)}} \cdot \mathsf{fma}\left(\left(B \cdot B\right) \cdot F, 0.16666666666666666, F\right)}{B}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{1}{\mathsf{fma}\left(F, F, 2\right)}} \cdot \frac{F}{\sin B}\\
\end{array}
\end{array}
if B < 0.160000000000000003Initial program 74.6%
Taylor expanded in B around 0
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
lower-/.f64N/A
Applied rewrites59.4%
Taylor expanded in B around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6455.5
Applied rewrites55.5%
if 0.160000000000000003 < B Initial program 87.5%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-sin.f6430.2
Applied rewrites30.2%
Final simplification48.4%
(FPCore (F B x)
:precision binary64
(if (<= F -7.1e-28)
(/ (- -1.0 x) B)
(if (<= F 2.8e+35)
(/ (- (* (sqrt (/ 1.0 (fma F F (fma 2.0 x 2.0)))) F) x) B)
(- (/ (fma (* B B) 0.16666666666666666 1.0) B) (/ x (tan B))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -7.1e-28) {
tmp = (-1.0 - x) / B;
} else if (F <= 2.8e+35) {
tmp = ((sqrt((1.0 / fma(F, F, fma(2.0, x, 2.0)))) * F) - x) / B;
} else {
tmp = (fma((B * B), 0.16666666666666666, 1.0) / B) - (x / tan(B));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -7.1e-28) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 2.8e+35) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 / fma(F, F, fma(2.0, x, 2.0)))) * F) - x) / B); else tmp = Float64(Float64(fma(Float64(B * B), 0.16666666666666666, 1.0) / B) - Float64(x / tan(B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -7.1e-28], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 2.8e+35], N[(N[(N[(N[Sqrt[N[(1.0 / N[(F * F + N[(2.0 * x + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(N[(B * B), $MachinePrecision] * 0.16666666666666666 + 1.0), $MachinePrecision] / B), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -7.1 \cdot 10^{-28}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 2.8 \cdot 10^{+35}:\\
\;\;\;\;\frac{\sqrt{\frac{1}{\mathsf{fma}\left(F, F, \mathsf{fma}\left(2, x, 2\right)\right)}} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(B \cdot B, 0.16666666666666666, 1\right)}{B} - \frac{x}{\tan B}\\
\end{array}
\end{array}
if F < -7.09999999999999981e-28Initial program 65.6%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites41.5%
Taylor expanded in F around -inf
Applied rewrites55.7%
if -7.09999999999999981e-28 < F < 2.79999999999999999e35Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites42.9%
if 2.79999999999999999e35 < F Initial program 56.2%
Taylor expanded in B around 0
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
lower-/.f64N/A
Applied rewrites42.0%
Taylor expanded in F around inf
Applied rewrites59.8%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
fp-cancel-sub-signN/A
Applied rewrites59.9%
Final simplification51.1%
(FPCore (F B x)
:precision binary64
(if (<= F -7.1e-28)
(/ (- -1.0 x) B)
(if (<= F 1150.0)
(/ (- (* (sqrt (/ 1.0 (fma F F (fma 2.0 x 2.0)))) F) x) B)
(/ (- (fma (/ -0.5 F) (/ (fma 2.0 x 2.0) F) 1.0) x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -7.1e-28) {
tmp = (-1.0 - x) / B;
} else if (F <= 1150.0) {
tmp = ((sqrt((1.0 / fma(F, F, fma(2.0, x, 2.0)))) * F) - x) / B;
} else {
tmp = (fma((-0.5 / F), (fma(2.0, x, 2.0) / F), 1.0) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -7.1e-28) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 1150.0) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 / fma(F, F, fma(2.0, x, 2.0)))) * F) - x) / B); else tmp = Float64(Float64(fma(Float64(-0.5 / F), Float64(fma(2.0, x, 2.0) / F), 1.0) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -7.1e-28], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 1150.0], N[(N[(N[(N[Sqrt[N[(1.0 / N[(F * F + N[(2.0 * x + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(N[(-0.5 / F), $MachinePrecision] * N[(N[(2.0 * x + 2.0), $MachinePrecision] / F), $MachinePrecision] + 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -7.1 \cdot 10^{-28}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 1150:\\
\;\;\;\;\frac{\sqrt{\frac{1}{\mathsf{fma}\left(F, F, \mathsf{fma}\left(2, x, 2\right)\right)}} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{-0.5}{F}, \frac{\mathsf{fma}\left(2, x, 2\right)}{F}, 1\right) - x}{B}\\
\end{array}
\end{array}
if F < -7.09999999999999981e-28Initial program 65.6%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites41.5%
Taylor expanded in F around -inf
Applied rewrites55.7%
if -7.09999999999999981e-28 < F < 1150Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites43.5%
if 1150 < F Initial program 58.9%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites37.7%
Taylor expanded in F around inf
Applied rewrites49.6%
Final simplification48.9%
(FPCore (F B x)
:precision binary64
(if (<= F -7.1e-28)
(/ (- -1.0 x) B)
(if (<= F 11.2)
(/ (- (* (sqrt (/ 1.0 (fma 2.0 x 2.0))) F) x) B)
(/ (- (fma (/ -0.5 F) (/ (fma 2.0 x 2.0) F) 1.0) x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -7.1e-28) {
tmp = (-1.0 - x) / B;
} else if (F <= 11.2) {
tmp = ((sqrt((1.0 / fma(2.0, x, 2.0))) * F) - x) / B;
} else {
tmp = (fma((-0.5 / F), (fma(2.0, x, 2.0) / F), 1.0) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -7.1e-28) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 11.2) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 / fma(2.0, x, 2.0))) * F) - x) / B); else tmp = Float64(Float64(fma(Float64(-0.5 / F), Float64(fma(2.0, x, 2.0) / F), 1.0) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -7.1e-28], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 11.2], N[(N[(N[(N[Sqrt[N[(1.0 / N[(2.0 * x + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(N[(-0.5 / F), $MachinePrecision] * N[(N[(2.0 * x + 2.0), $MachinePrecision] / F), $MachinePrecision] + 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -7.1 \cdot 10^{-28}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 11.2:\\
\;\;\;\;\frac{\sqrt{\frac{1}{\mathsf{fma}\left(2, x, 2\right)}} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{-0.5}{F}, \frac{\mathsf{fma}\left(2, x, 2\right)}{F}, 1\right) - x}{B}\\
\end{array}
\end{array}
if F < -7.09999999999999981e-28Initial program 65.6%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites41.5%
Taylor expanded in F around -inf
Applied rewrites55.7%
if -7.09999999999999981e-28 < F < 11.199999999999999Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites43.5%
Taylor expanded in F around 0
Applied rewrites42.2%
if 11.199999999999999 < F Initial program 58.9%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites37.7%
Taylor expanded in F around inf
Applied rewrites49.6%
Final simplification48.4%
(FPCore (F B x)
:precision binary64
(if (<= F -7.1e-28)
(/ (- -1.0 x) B)
(if (<= F 350000000000.0)
(/ (- (* (sqrt (/ 1.0 (fma 2.0 x 2.0))) F) x) B)
(/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -7.1e-28) {
tmp = (-1.0 - x) / B;
} else if (F <= 350000000000.0) {
tmp = ((sqrt((1.0 / fma(2.0, x, 2.0))) * F) - x) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -7.1e-28) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 350000000000.0) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 / fma(2.0, x, 2.0))) * F) - x) / B); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -7.1e-28], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 350000000000.0], N[(N[(N[(N[Sqrt[N[(1.0 / N[(2.0 * x + 2.0), $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 -7.1 \cdot 10^{-28}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 350000000000:\\
\;\;\;\;\frac{\sqrt{\frac{1}{\mathsf{fma}\left(2, x, 2\right)}} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -7.09999999999999981e-28Initial program 65.6%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites41.5%
Taylor expanded in F around -inf
Applied rewrites55.7%
if -7.09999999999999981e-28 < F < 3.5e11Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites42.7%
Taylor expanded in F around 0
Applied rewrites41.5%
if 3.5e11 < F Initial program 57.6%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites38.8%
Taylor expanded in F around inf
Applied rewrites51.0%
Final simplification48.4%
(FPCore (F B x) :precision binary64 (if (<= F -7.1e-28) (/ (- -1.0 x) B) (if (<= F 1.35) (/ (- (/ F (sqrt (fma x 2.0 2.0))) x) B) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -7.1e-28) {
tmp = (-1.0 - x) / B;
} else if (F <= 1.35) {
tmp = ((F / sqrt(fma(x, 2.0, 2.0))) - x) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -7.1e-28) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 1.35) tmp = Float64(Float64(Float64(F / sqrt(fma(x, 2.0, 2.0))) - x) / B); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -7.1e-28], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 1.35], N[(N[(N[(F / N[Sqrt[N[(x * 2.0 + 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -7.1 \cdot 10^{-28}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 1.35:\\
\;\;\;\;\frac{\frac{F}{\sqrt{\mathsf{fma}\left(x, 2, 2\right)}} - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -7.09999999999999981e-28Initial program 65.6%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites41.5%
Taylor expanded in F around -inf
Applied rewrites55.7%
if -7.09999999999999981e-28 < F < 1.3500000000000001Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites43.5%
Applied rewrites43.5%
Taylor expanded in F around 0
Applied rewrites42.2%
Applied rewrites42.2%
if 1.3500000000000001 < F Initial program 58.9%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites37.7%
Taylor expanded in F around inf
Applied rewrites49.6%
Final simplification48.4%
(FPCore (F B x) :precision binary64 (if (<= F -4.8e-65) (/ (- -1.0 x) B) (if (<= F 2.7e-33) (/ (- x) B) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -4.8e-65) {
tmp = (-1.0 - x) / B;
} else if (F <= 2.7e-33) {
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.8d-65)) then
tmp = ((-1.0d0) - x) / b
else if (f <= 2.7d-33) 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.8e-65) {
tmp = (-1.0 - x) / B;
} else if (F <= 2.7e-33) {
tmp = -x / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -4.8e-65: tmp = (-1.0 - x) / B elif F <= 2.7e-33: tmp = -x / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -4.8e-65) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 2.7e-33) 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.8e-65) tmp = (-1.0 - x) / B; elseif (F <= 2.7e-33) tmp = -x / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -4.8e-65], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 2.7e-33], N[((-x) / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -4.8 \cdot 10^{-65}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 2.7 \cdot 10^{-33}:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -4.8000000000000003e-65Initial program 67.6%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites41.6%
Taylor expanded in F around -inf
Applied rewrites54.0%
if -4.8000000000000003e-65 < F < 2.7000000000000001e-33Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites42.2%
Taylor expanded in F around 0
Applied rewrites33.4%
if 2.7000000000000001e-33 < F Initial program 63.7%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites40.0%
Taylor expanded in F around inf
Applied rewrites47.2%
Final simplification44.3%
(FPCore (F B x) :precision binary64 (if (<= F -4.8e-65) (/ (- -1.0 x) B) (/ (- x) B)))
double code(double F, double B, double x) {
double tmp;
if (F <= -4.8e-65) {
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 <= (-4.8d-65)) 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 <= -4.8e-65) {
tmp = (-1.0 - x) / B;
} else {
tmp = -x / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -4.8e-65: tmp = (-1.0 - x) / B else: tmp = -x / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -4.8e-65) 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 <= -4.8e-65) tmp = (-1.0 - x) / B; else tmp = -x / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -4.8e-65], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], N[((-x) / B), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -4.8 \cdot 10^{-65}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{B}\\
\end{array}
\end{array}
if F < -4.8000000000000003e-65Initial program 67.6%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites41.6%
Taylor expanded in F around -inf
Applied rewrites54.0%
if -4.8000000000000003e-65 < F Initial program 83.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites41.2%
Taylor expanded in F around 0
Applied rewrites27.9%
Final simplification36.5%
(FPCore (F B x) :precision binary64 (/ (- x) B))
double code(double F, double B, double x) {
return -x / B;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = -x / b
end function
public static double code(double F, double B, double x) {
return -x / B;
}
def code(F, B, x): return -x / B
function code(F, B, x) return Float64(Float64(-x) / B) end
function tmp = code(F, B, x) tmp = -x / B; end
code[F_, B_, x_] := N[((-x) / B), $MachinePrecision]
\begin{array}{l}
\\
\frac{-x}{B}
\end{array}
Initial program 78.2%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites41.3%
Taylor expanded in F around 0
Applied rewrites27.3%
Final simplification27.3%
herbie shell --seed 2025017
(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))))))