
(FPCore (F B x) :precision binary64 (+ (- (* x (/ 1.0 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))
double code(double F, double B, double x) {
return -(x * (1.0 / tan(B))) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = -(x * (1.0d0 / tan(b))) + ((f / sin(b)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
end function
public static double code(double F, double B, double x) {
return -(x * (1.0 / Math.tan(B))) + ((F / Math.sin(B)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
def code(F, B, x): return -(x * (1.0 / math.tan(B))) + ((F / math.sin(B)) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)))
function code(F, B, x) return Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))) end
function tmp = code(F, B, x) tmp = -(x * (1.0 / tan(B))) + ((F / sin(B)) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); end
code[F_, B_, x_] := N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], (-N[(1.0 / 2.0), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 23 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (F B x) :precision binary64 (+ (- (* x (/ 1.0 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))
double code(double F, double B, double x) {
return -(x * (1.0 / tan(B))) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = -(x * (1.0d0 / tan(b))) + ((f / sin(b)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
end function
public static double code(double F, double B, double x) {
return -(x * (1.0 / Math.tan(B))) + ((F / Math.sin(B)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
def code(F, B, x): return -(x * (1.0 / math.tan(B))) + ((F / math.sin(B)) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)))
function code(F, B, x) return Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))) end
function tmp = code(F, B, x) tmp = -(x * (1.0 / tan(B))) + ((F / sin(B)) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); end
code[F_, B_, x_] := N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], (-N[(1.0 / 2.0), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\end{array}
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= F -1.25e+67)
(+ t_0 (/ -1.0 (sin B)))
(if (<= F 400000000.0)
(+
t_0
(* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (/ -1.0 2.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.25e+67) {
tmp = t_0 + (-1.0 / sin(B));
} else if (F <= 400000000.0) {
tmp = t_0 + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), (-1.0 / 2.0)));
} 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) :: t_0
real(8) :: tmp
t_0 = -x / tan(b)
if (f <= (-1.25d+67)) then
tmp = t_0 + ((-1.0d0) / sin(b))
else if (f <= 400000000.0d0) then
tmp = t_0 + ((f / sin(b)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** ((-1.0d0) / 2.0d0)))
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 t_0 = -x / Math.tan(B);
double tmp;
if (F <= -1.25e+67) {
tmp = t_0 + (-1.0 / Math.sin(B));
} else if (F <= 400000000.0) {
tmp = t_0 + ((F / Math.sin(B)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), (-1.0 / 2.0)));
} else {
tmp = (1.0 - (Math.cos(B) * x)) / Math.sin(B);
}
return tmp;
}
def code(F, B, x): t_0 = -x / math.tan(B) tmp = 0 if F <= -1.25e+67: tmp = t_0 + (-1.0 / math.sin(B)) elif F <= 400000000.0: tmp = t_0 + ((F / math.sin(B)) * math.pow((((F * F) + 2.0) + (2.0 * x)), (-1.0 / 2.0))) else: tmp = (1.0 - (math.cos(B) * x)) / math.sin(B) return tmp
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (F <= -1.25e+67) tmp = Float64(t_0 + Float64(-1.0 / sin(B))); elseif (F <= 400000000.0) tmp = Float64(t_0 + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-1.0 / 2.0)))); else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
function tmp_2 = code(F, B, x) t_0 = -x / tan(B); tmp = 0.0; if (F <= -1.25e+67) tmp = t_0 + (-1.0 / sin(B)); elseif (F <= 400000000.0) tmp = t_0 + ((F / sin(B)) * ((((F * F) + 2.0) + (2.0 * x)) ^ (-1.0 / 2.0))); else tmp = (1.0 - (cos(B) * x)) / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -1.25e+67], N[(t$95$0 + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 400000000.0], N[(t$95$0 + 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], 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.25 \cdot 10^{+67}:\\
\;\;\;\;t\_0 + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 400000000:\\
\;\;\;\;t\_0 + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(\frac{-1}{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -1.24999999999999994e67Initial program 57.5%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.4
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%
if -1.24999999999999994e67 < F < 4e8Initial program 99.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%
if 4e8 < F Initial program 46.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
(let* ((t_0 (* x (/ -1.0 (tan B))))
(t_1
(+
t_0
(* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (/ -1.0 2.0)))))
(t_2 (fma 2.0 x (fma F F 2.0)))
(t_3 (+ t_0 (* (/ F B) (sqrt (/ 1.0 t_2))))))
(if (<= t_1 -100000000000.0)
t_3
(if (<= t_1 1e-159)
(+ (- (/ x B)) (/ (* F (/ 1.0 (sqrt t_2))) (sin B)))
(if (<= t_1 5e+291) t_3 (/ (- 1.0 x) B))))))
double code(double F, double B, double x) {
double t_0 = x * (-1.0 / tan(B));
double t_1 = t_0 + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), (-1.0 / 2.0)));
double t_2 = fma(2.0, x, fma(F, F, 2.0));
double t_3 = t_0 + ((F / B) * sqrt((1.0 / t_2)));
double tmp;
if (t_1 <= -100000000000.0) {
tmp = t_3;
} else if (t_1 <= 1e-159) {
tmp = -(x / B) + ((F * (1.0 / sqrt(t_2))) / sin(B));
} else if (t_1 <= 5e+291) {
tmp = t_3;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(x * Float64(-1.0 / tan(B))) t_1 = Float64(t_0 + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-1.0 / 2.0)))) t_2 = fma(2.0, x, fma(F, F, 2.0)) t_3 = Float64(t_0 + Float64(Float64(F / B) * sqrt(Float64(1.0 / t_2)))) tmp = 0.0 if (t_1 <= -100000000000.0) tmp = t_3; elseif (t_1 <= 1e-159) tmp = Float64(Float64(-Float64(x / B)) + Float64(Float64(F * Float64(1.0 / sqrt(t_2))) / sin(B))); elseif (t_1 <= 5e+291) tmp = t_3; else tmp = Float64(Float64(1.0 - x) / 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[(t$95$0 + 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]}, Block[{t$95$2 = N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$0 + N[(N[(F / B), $MachinePrecision] * N[Sqrt[N[(1.0 / t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -100000000000.0], t$95$3, If[LessEqual[t$95$1, 1e-159], N[((-N[(x / B), $MachinePrecision]) + N[(N[(F * N[(1.0 / N[Sqrt[t$95$2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+291], t$95$3, N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{-1}{\tan B}\\
t_1 := t\_0 + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(\frac{-1}{2}\right)}\\
t_2 := \mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\\
t_3 := t\_0 + \frac{F}{B} \cdot \sqrt{\frac{1}{t\_2}}\\
\mathbf{if}\;t\_1 \leq -100000000000:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_1 \leq 10^{-159}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{F \cdot \frac{1}{\sqrt{t\_2}}}{\sin B}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+291}:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{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)))))) < -1e11 or 9.99999999999999989e-160 < (+.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)))))) < 5.0000000000000001e291Initial program 91.0%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-fma.f64N/A
pow2N/A
lift-*.f6480.6
Applied rewrites80.6%
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.f6480.6
Applied rewrites80.6%
if -1e11 < (+.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)))))) < 9.99999999999999989e-160Initial program 72.6%
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 rewrites72.7%
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
pow2N/A
+-commutativeN/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
+-commutativeN/A
pow2N/A
lower-sqrt.f64N/A
Applied rewrites72.6%
Taylor expanded in B around 0
lower-/.f6451.2
Applied rewrites51.2%
if 5.0000000000000001e291 < (+.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 16.2%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites59.2%
Taylor expanded in F around inf
lower--.f6484.4
Applied rewrites84.4%
Final simplification75.3%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (fma 2.0 x (fma F F 2.0)))
(t_1
(+
(* x (/ -1.0 (tan B)))
(* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (/ -1.0 2.0)))))
(t_2 (+ (/ (- x) (tan B)) (* (/ F B) (sqrt (/ 1.0 t_0))))))
(if (<= t_1 -100000000000.0)
t_2
(if (<= t_1 1e-159)
(+ (- (/ x B)) (/ (* F (/ 1.0 (sqrt t_0))) (sin B)))
(if (<= t_1 5e+291) t_2 (/ (- 1.0 x) B))))))
double code(double F, double B, double x) {
double t_0 = fma(2.0, x, fma(F, F, 2.0));
double t_1 = (x * (-1.0 / tan(B))) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), (-1.0 / 2.0)));
double t_2 = (-x / tan(B)) + ((F / B) * sqrt((1.0 / t_0)));
double tmp;
if (t_1 <= -100000000000.0) {
tmp = t_2;
} else if (t_1 <= 1e-159) {
tmp = -(x / B) + ((F * (1.0 / sqrt(t_0))) / sin(B));
} else if (t_1 <= 5e+291) {
tmp = t_2;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
function code(F, B, x) t_0 = fma(2.0, x, fma(F, F, 2.0)) t_1 = 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(-1.0 / 2.0)))) t_2 = Float64(Float64(Float64(-x) / tan(B)) + Float64(Float64(F / B) * sqrt(Float64(1.0 / t_0)))) tmp = 0.0 if (t_1 <= -100000000000.0) tmp = t_2; elseif (t_1 <= 1e-159) tmp = Float64(Float64(-Float64(x / B)) + Float64(Float64(F * Float64(1.0 / sqrt(t_0))) / sin(B))); elseif (t_1 <= 5e+291) tmp = t_2; else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = 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]}, Block[{t$95$2 = N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(N[(F / B), $MachinePrecision] * N[Sqrt[N[(1.0 / t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -100000000000.0], t$95$2, If[LessEqual[t$95$1, 1e-159], N[((-N[(x / B), $MachinePrecision]) + N[(N[(F * N[(1.0 / N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+291], t$95$2, N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\\
t_1 := x \cdot \frac{-1}{\tan B} + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(\frac{-1}{2}\right)}\\
t_2 := \frac{-x}{\tan B} + \frac{F}{B} \cdot \sqrt{\frac{1}{t\_0}}\\
\mathbf{if}\;t\_1 \leq -100000000000:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 10^{-159}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{F \cdot \frac{1}{\sqrt{t\_0}}}{\sin B}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+291}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{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)))))) < -1e11 or 9.99999999999999989e-160 < (+.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)))))) < 5.0000000000000001e291Initial program 91.0%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-fma.f64N/A
pow2N/A
lift-*.f6480.6
Applied rewrites80.6%
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.f6480.6
Applied rewrites80.6%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6480.9
Applied rewrites80.9%
if -1e11 < (+.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)))))) < 9.99999999999999989e-160Initial program 72.6%
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 rewrites72.7%
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
pow2N/A
+-commutativeN/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
+-commutativeN/A
pow2N/A
lower-sqrt.f64N/A
Applied rewrites72.6%
Taylor expanded in B around 0
lower-/.f6451.2
Applied rewrites51.2%
if 5.0000000000000001e291 < (+.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 16.2%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites59.2%
Taylor expanded in F around inf
lower--.f6484.4
Applied rewrites84.4%
Final simplification75.4%
(FPCore (F B x)
:precision binary64
(if (<= F -8.5e+23)
(+ (/ (- x) (tan B)) (/ -1.0 (sin B)))
(if (<= F 7200.0)
(+ (* x (/ -1.0 (tan B))) (* F (/ (pow (fma F F 2.0) -0.5) (sin B))))
(/ (- 1.0 (* (cos B) x)) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -8.5e+23) {
tmp = (-x / tan(B)) + (-1.0 / sin(B));
} else if (F <= 7200.0) {
tmp = (x * (-1.0 / tan(B))) + (F * (pow(fma(F, F, 2.0), -0.5) / sin(B)));
} else {
tmp = (1.0 - (cos(B) * x)) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -8.5e+23) tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(-1.0 / sin(B))); elseif (F <= 7200.0) tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(F * Float64((fma(F, F, 2.0) ^ -0.5) / 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, -8.5e+23], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 7200.0], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(F * N[(N[Power[N[(F * F + 2.0), $MachinePrecision], -0.5], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $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 -8.5 \cdot 10^{+23}:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 7200:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + F \cdot \frac{{\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-0.5}}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -8.5000000000000001e23Initial program 58.7%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.4
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.7
Applied rewrites99.7%
if -8.5000000000000001e23 < F < 7200Initial 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%
Taylor expanded in x around 0
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f6499.4
Applied rewrites99.4%
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
Applied rewrites99.4%
if 7200 < F Initial program 48.7%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Final simplification99.6%
(FPCore (F B x)
:precision binary64
(if (<= F -5e+29)
(+ (/ (- x) (tan B)) (/ -1.0 (sin B)))
(if (<= F 2.25e+18)
(+
(* 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 <= -5e+29) {
tmp = (-x / tan(B)) + (-1.0 / sin(B));
} else if (F <= 2.25e+18) {
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 <= -5e+29) tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(-1.0 / sin(B))); elseif (F <= 2.25e+18) 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, -5e+29], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 2.25e+18], 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 -5 \cdot 10^{+29}:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 2.25 \cdot 10^{+18}:\\
\;\;\;\;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 < -5.0000000000000001e29Initial program 58.7%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.4
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.7
Applied rewrites99.7%
if -5.0000000000000001e29 < F < 2.25e18Initial program 98.7%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied 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
pow2N/A
+-commutativeN/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
+-commutativeN/A
pow2N/A
lower-sqrt.f64N/A
Applied rewrites99.3%
if 2.25e18 < F Initial program 46.2%
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.5%
(FPCore (F B x)
:precision binary64
(if (<= F -1.4)
(+ (/ (- x) (tan B)) (/ -1.0 (sin B)))
(if (<= F 1.45)
(+ (* x (/ -1.0 (tan B))) (* F (/ (sqrt 0.5) (sin B))))
(/ (- 1.0 (* (cos B) x)) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.4) {
tmp = (-x / tan(B)) + (-1.0 / sin(B));
} else if (F <= 1.45) {
tmp = (x * (-1.0 / tan(B))) + (F * (sqrt(0.5) / 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 <= (-1.4d0)) then
tmp = (-x / tan(b)) + ((-1.0d0) / sin(b))
else if (f <= 1.45d0) then
tmp = (x * ((-1.0d0) / tan(b))) + (f * (sqrt(0.5d0) / 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 <= -1.4) {
tmp = (-x / Math.tan(B)) + (-1.0 / Math.sin(B));
} else if (F <= 1.45) {
tmp = (x * (-1.0 / Math.tan(B))) + (F * (Math.sqrt(0.5) / 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 <= -1.4: tmp = (-x / math.tan(B)) + (-1.0 / math.sin(B)) elif F <= 1.45: tmp = (x * (-1.0 / math.tan(B))) + (F * (math.sqrt(0.5) / 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 <= -1.4) tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(-1.0 / sin(B))); elseif (F <= 1.45) tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(F * Float64(sqrt(0.5) / 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 <= -1.4) tmp = (-x / tan(B)) + (-1.0 / sin(B)); elseif (F <= 1.45) tmp = (x * (-1.0 / tan(B))) + (F * (sqrt(0.5) / sin(B))); else tmp = (1.0 - (cos(B) * x)) / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -1.4], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.45], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(F * N[(N[Sqrt[0.5], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $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 -1.4:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 1.45:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + F \cdot \frac{\sqrt{0.5}}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -1.3999999999999999Initial program 61.0%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6497.6
Applied rewrites97.6%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6497.8
Applied rewrites97.8%
if -1.3999999999999999 < F < 1.44999999999999996Initial 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%
Taylor expanded in x around 0
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f6499.4
Applied rewrites99.4%
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
Applied rewrites99.4%
Taylor expanded in F around 0
metadata-evalN/A
metadata-evalN/A
sqrt-pow1N/A
lower-sqrt.f64N/A
metadata-eval98.8
Applied rewrites98.8%
if 1.44999999999999996 < F Initial program 49.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.f6498.9
Applied rewrites98.9%
Final simplification98.6%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= F -36.0)
(+ t_0 (/ -1.0 (sin B)))
(if (<= F 0.000145)
(+ t_0 (* (/ F B) (sqrt (/ 1.0 (fma 2.0 x (fma F F 2.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 <= -36.0) {
tmp = t_0 + (-1.0 / sin(B));
} else if (F <= 0.000145) {
tmp = t_0 + ((F / B) * sqrt((1.0 / fma(2.0, x, fma(F, F, 2.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 <= -36.0) tmp = Float64(t_0 + Float64(-1.0 / sin(B))); elseif (F <= 0.000145) tmp = Float64(t_0 + Float64(Float64(F / B) * sqrt(Float64(1.0 / fma(2.0, x, fma(F, F, 2.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, -36.0], N[(t$95$0 + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 0.000145], N[(t$95$0 + N[(N[(F / B), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $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 -36:\\
\;\;\;\;t\_0 + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 0.000145:\\
\;\;\;\;t\_0 + \frac{F}{B} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -36Initial program 60.5%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6498.5
Applied rewrites98.5%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6498.8
Applied rewrites98.8%
if -36 < F < 1.45e-4Initial program 99.4%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-fma.f64N/A
pow2N/A
lift-*.f6482.9
Applied rewrites82.9%
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.f6482.9
Applied rewrites82.9%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6483.1
Applied rewrites83.1%
if 1.45e-4 < F Initial program 50.1%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6498.9
Applied rewrites98.9%
Final simplification92.1%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* (cos B) x)))
(if (<= F -36.0)
(/ (- -1.0 t_0) (sin B))
(if (<= F 0.000145)
(+
(/ (- x) (tan B))
(* (/ F B) (sqrt (/ 1.0 (fma 2.0 x (fma F F 2.0))))))
(/ (- 1.0 t_0) (sin B))))))
double code(double F, double B, double x) {
double t_0 = cos(B) * x;
double tmp;
if (F <= -36.0) {
tmp = (-1.0 - t_0) / sin(B);
} else if (F <= 0.000145) {
tmp = (-x / tan(B)) + ((F / B) * sqrt((1.0 / fma(2.0, x, fma(F, F, 2.0)))));
} else {
tmp = (1.0 - t_0) / sin(B);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(cos(B) * x) tmp = 0.0 if (F <= -36.0) tmp = Float64(Float64(-1.0 - t_0) / sin(B)); elseif (F <= 0.000145) tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(Float64(F / B) * sqrt(Float64(1.0 / fma(2.0, x, fma(F, F, 2.0)))))); else tmp = Float64(Float64(1.0 - t_0) / sin(B)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[F, -36.0], N[(N[(-1.0 - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 0.000145], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(N[(F / B), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos B \cdot x\\
\mathbf{if}\;F \leq -36:\\
\;\;\;\;\frac{-1 - t\_0}{\sin B}\\
\mathbf{elif}\;F \leq 0.000145:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{F}{B} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - t\_0}{\sin B}\\
\end{array}
\end{array}
if F < -36Initial program 60.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.6
Applied rewrites98.6%
if -36 < F < 1.45e-4Initial program 99.4%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-fma.f64N/A
pow2N/A
lift-*.f6482.9
Applied rewrites82.9%
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.f6482.9
Applied rewrites82.9%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6483.1
Applied rewrites83.1%
if 1.45e-4 < F Initial program 50.1%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6498.9
Applied rewrites98.9%
Final simplification92.0%
(FPCore (F B x)
:precision binary64
(if (<= F -1e+79)
(+ (* x (/ -1.0 (tan B))) (/ -1.0 B))
(if (<= F 0.000145)
(+ (/ (- x) (tan B)) (* (/ F B) (sqrt (/ 1.0 (fma 2.0 x (fma F F 2.0))))))
(/ (- 1.0 (* (cos B) x)) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1e+79) {
tmp = (x * (-1.0 / tan(B))) + (-1.0 / B);
} else if (F <= 0.000145) {
tmp = (-x / tan(B)) + ((F / B) * sqrt((1.0 / fma(2.0, x, fma(F, F, 2.0)))));
} else {
tmp = (1.0 - (cos(B) * x)) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1e+79) tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(-1.0 / B)); elseif (F <= 0.000145) tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(Float64(F / B) * sqrt(Float64(1.0 / fma(2.0, x, fma(F, F, 2.0)))))); else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1e+79], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 0.000145], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(N[(F / B), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $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 -1 \cdot 10^{+79}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\
\mathbf{elif}\;F \leq 0.000145:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{F}{B} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -9.99999999999999967e78Initial program 55.5%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.4
Applied rewrites99.4%
Taylor expanded in B around 0
Applied rewrites74.5%
if -9.99999999999999967e78 < F < 1.45e-4Initial program 99.4%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-fma.f64N/A
pow2N/A
lift-*.f6480.5
Applied rewrites80.5%
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.f6480.5
Applied rewrites80.5%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6480.7
Applied rewrites80.7%
if 1.45e-4 < F Initial program 50.1%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6498.9
Applied rewrites98.9%
Final simplification84.5%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* x (/ -1.0 (tan B)))))
(if (<= x -5.5e-69)
(+ t_0 (/ -1.0 (* (fma -0.16666666666666666 (* B B) 1.0) B)))
(if (<= x 85000000000000.0)
(+
(- (/ x B))
(/ (* F (/ 1.0 (sqrt (fma 2.0 x (fma F F 2.0))))) (sin B)))
(+ t_0 (/ -1.0 B))))))
double code(double F, double B, double x) {
double t_0 = x * (-1.0 / tan(B));
double tmp;
if (x <= -5.5e-69) {
tmp = t_0 + (-1.0 / (fma(-0.16666666666666666, (B * B), 1.0) * B));
} else if (x <= 85000000000000.0) {
tmp = -(x / B) + ((F * (1.0 / sqrt(fma(2.0, x, fma(F, F, 2.0))))) / sin(B));
} else {
tmp = t_0 + (-1.0 / B);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(x * Float64(-1.0 / tan(B))) tmp = 0.0 if (x <= -5.5e-69) tmp = Float64(t_0 + Float64(-1.0 / Float64(fma(-0.16666666666666666, Float64(B * B), 1.0) * B))); elseif (x <= 85000000000000.0) tmp = Float64(Float64(-Float64(x / B)) + Float64(Float64(F * Float64(1.0 / sqrt(fma(2.0, x, fma(F, F, 2.0))))) / sin(B))); else tmp = Float64(t_0 + Float64(-1.0 / B)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5.5e-69], N[(t$95$0 + N[(-1.0 / N[(N[(-0.16666666666666666 * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 85000000000000.0], N[((-N[(x / B), $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[(t$95$0 + N[(-1.0 / B), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{-1}{\tan B}\\
\mathbf{if}\;x \leq -5.5 \cdot 10^{-69}:\\
\;\;\;\;t\_0 + \frac{-1}{\mathsf{fma}\left(-0.16666666666666666, B \cdot B, 1\right) \cdot B}\\
\mathbf{elif}\;x \leq 85000000000000:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{F \cdot \frac{1}{\sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{-1}{B}\\
\end{array}
\end{array}
if x < -5.50000000000000006e-69Initial program 73.4%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6472.8
Applied rewrites72.8%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6482.0
Applied rewrites82.0%
if -5.50000000000000006e-69 < x < 8.5e13Initial program 66.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 rewrites73.2%
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
pow2N/A
+-commutativeN/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
+-commutativeN/A
pow2N/A
lower-sqrt.f64N/A
Applied rewrites73.2%
Taylor expanded in B around 0
lower-/.f6461.1
Applied rewrites61.1%
if 8.5e13 < x Initial program 86.9%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.4
Applied rewrites99.4%
Taylor expanded in B around 0
Applied rewrites99.4%
Final simplification76.5%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* x (/ -1.0 (tan B)))))
(if (<= F -0.116)
(+ t_0 (/ -1.0 B))
(if (<= F 14000000.0)
(+ t_0 (* (/ F B) (sqrt (/ 1.0 (fma 2.0 x 2.0)))))
(/ (- 1.0 x) B)))))
double code(double F, double B, double x) {
double t_0 = x * (-1.0 / tan(B));
double tmp;
if (F <= -0.116) {
tmp = t_0 + (-1.0 / B);
} else if (F <= 14000000.0) {
tmp = t_0 + ((F / B) * sqrt((1.0 / fma(2.0, x, 2.0))));
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(x * Float64(-1.0 / tan(B))) tmp = 0.0 if (F <= -0.116) tmp = Float64(t_0 + Float64(-1.0 / B)); elseif (F <= 14000000.0) tmp = Float64(t_0 + Float64(Float64(F / B) * sqrt(Float64(1.0 / fma(2.0, x, 2.0))))); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -0.116], N[(t$95$0 + N[(-1.0 / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 14000000.0], N[(t$95$0 + N[(N[(F / B), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(2.0 * x + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{-1}{\tan B}\\
\mathbf{if}\;F \leq -0.116:\\
\;\;\;\;t\_0 + \frac{-1}{B}\\
\mathbf{elif}\;F \leq 14000000:\\
\;\;\;\;t\_0 + \frac{F}{B} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(2, x, 2\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -0.116000000000000006Initial program 61.5%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6496.5
Applied rewrites96.5%
Taylor expanded in B around 0
Applied rewrites70.2%
if -0.116000000000000006 < F < 1.4e7Initial program 99.3%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-fma.f64N/A
pow2N/A
lift-*.f6483.1
Applied rewrites83.1%
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.f6483.1
Applied rewrites83.1%
Taylor expanded in F around 0
Applied rewrites83.1%
if 1.4e7 < F Initial program 47.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites39.9%
Taylor expanded in F around inf
lower--.f6460.6
Applied rewrites60.6%
Final simplification73.2%
(FPCore (F B x)
:precision binary64
(if (<= B 3e-22)
(- (/ (* (pow (fma 2.0 x (fma F F 2.0)) -0.5) F) B) (/ 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 tmp;
if (B <= 3e-22) {
tmp = ((pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) * F) / B) - (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) tmp = 0.0 if (B <= 3e-22) tmp = Float64(Float64(Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) * F) / B) - Float64(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_] := If[LessEqual[B, 3e-22], N[(N[(N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] / B), $MachinePrecision] - N[(x / B), $MachinePrecision]), $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}
\mathbf{if}\;B \leq 3 \cdot 10^{-22}:\\
\;\;\;\;\frac{{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot F}{B} - \frac{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 < 2.9999999999999999e-22Initial program 70.6%
Applied rewrites70.6%
Taylor expanded in B around 0
distribute-lft-neg-inN/A
inv-powN/A
associate-*r/N/A
*-commutativeN/A
mul-1-negN/A
lower-/.f64N/A
Applied rewrites50.7%
lift-/.f64N/A
lift-fma.f64N/A
lift-pow.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
div-addN/A
lift-neg.f64N/A
mul-1-negN/A
associate-*r/N/A
lower-+.f64N/A
Applied rewrites50.8%
if 2.9999999999999999e-22 < B Initial program 83.8%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6452.6
Applied rewrites52.6%
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-*.f6457.9
Applied rewrites57.9%
Final simplification52.6%
(FPCore (F B x)
:precision binary64
(if (<= B 3e-22)
(- (/ (* (pow (fma 2.0 x (fma F F 2.0)) -0.5) F) B) (/ 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 tmp;
if (B <= 3e-22) {
tmp = ((pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) * F) / B) - (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) tmp = 0.0 if (B <= 3e-22) tmp = Float64(Float64(Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) * F) / B) - Float64(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_] := If[LessEqual[B, 3e-22], N[(N[(N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] / B), $MachinePrecision] - N[(x / B), $MachinePrecision]), $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}
\mathbf{if}\;B \leq 3 \cdot 10^{-22}:\\
\;\;\;\;\frac{{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot F}{B} - \frac{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 < 2.9999999999999999e-22Initial program 70.6%
Applied rewrites70.6%
Taylor expanded in B around 0
distribute-lft-neg-inN/A
inv-powN/A
associate-*r/N/A
*-commutativeN/A
mul-1-negN/A
lower-/.f64N/A
Applied rewrites50.7%
lift-/.f64N/A
lift-fma.f64N/A
lift-pow.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
div-addN/A
lift-neg.f64N/A
mul-1-negN/A
associate-*r/N/A
lower-+.f64N/A
Applied rewrites50.8%
if 2.9999999999999999e-22 < B Initial program 83.8%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6452.6
Applied rewrites52.6%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6457.7
Applied rewrites57.7%
Final simplification52.6%
(FPCore (F B x) :precision binary64 (if (<= B 3e-22) (- (/ (* (pow (fma 2.0 x (fma F F 2.0)) -0.5) F) B) (/ x B)) (+ (* x (/ -1.0 (tan B))) (/ -1.0 B))))
double code(double F, double B, double x) {
double tmp;
if (B <= 3e-22) {
tmp = ((pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) * F) / B) - (x / B);
} else {
tmp = (x * (-1.0 / tan(B))) + (-1.0 / B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (B <= 3e-22) tmp = Float64(Float64(Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) * F) / B) - Float64(x / B)); else tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(-1.0 / B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[B, 3e-22], N[(N[(N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] / B), $MachinePrecision] - N[(x / B), $MachinePrecision]), $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}
\mathbf{if}\;B \leq 3 \cdot 10^{-22}:\\
\;\;\;\;\frac{{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot F}{B} - \frac{x}{B}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\
\end{array}
\end{array}
if B < 2.9999999999999999e-22Initial program 70.6%
Applied rewrites70.6%
Taylor expanded in B around 0
distribute-lft-neg-inN/A
inv-powN/A
associate-*r/N/A
*-commutativeN/A
mul-1-negN/A
lower-/.f64N/A
Applied rewrites50.7%
lift-/.f64N/A
lift-fma.f64N/A
lift-pow.f64N/A
lift-fma.f64N/A
lift-fma.f64N/A
div-addN/A
lift-neg.f64N/A
mul-1-negN/A
associate-*r/N/A
lower-+.f64N/A
Applied rewrites50.8%
if 2.9999999999999999e-22 < B Initial program 83.8%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6452.6
Applied rewrites52.6%
Taylor expanded in B around 0
Applied rewrites52.8%
Final simplification51.3%
(FPCore (F B x) :precision binary64 (if (<= B 3e-22) (/ (fma (pow (fma 2.0 x (fma F F 2.0)) -0.5) F (- x)) B) (+ (* x (/ -1.0 (tan B))) (/ -1.0 B))))
double code(double F, double B, double x) {
double tmp;
if (B <= 3e-22) {
tmp = fma(pow(fma(2.0, x, fma(F, F, 2.0)), -0.5), F, -x) / B;
} else {
tmp = (x * (-1.0 / tan(B))) + (-1.0 / B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (B <= 3e-22) tmp = Float64(fma((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5), F, Float64(-x)) / B); else tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(-1.0 / B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[B, 3e-22], N[(N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F + (-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}
\mathbf{if}\;B \leq 3 \cdot 10^{-22}:\\
\;\;\;\;\frac{\mathsf{fma}\left({\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}, F, -x\right)}{B}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{-1}{B}\\
\end{array}
\end{array}
if B < 2.9999999999999999e-22Initial program 70.6%
Applied rewrites70.6%
Taylor expanded in B around 0
distribute-lft-neg-inN/A
inv-powN/A
associate-*r/N/A
*-commutativeN/A
mul-1-negN/A
lower-/.f64N/A
Applied rewrites50.7%
if 2.9999999999999999e-22 < B Initial program 83.8%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6452.6
Applied rewrites52.6%
Taylor expanded in B around 0
Applied rewrites52.8%
Final simplification51.3%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (- (/ x B))))
(if (<= F -36.0)
(+ t_0 (/ -1.0 (sin B)))
(if (<= F 250000000.0)
(+ t_0 (* (/ F B) (sqrt (/ 1.0 (fma 2.0 x (fma F F 2.0))))))
(/ (- 1.0 x) B)))))
double code(double F, double B, double x) {
double t_0 = -(x / B);
double tmp;
if (F <= -36.0) {
tmp = t_0 + (-1.0 / sin(B));
} else if (F <= 250000000.0) {
tmp = t_0 + ((F / B) * sqrt((1.0 / fma(2.0, x, fma(F, F, 2.0)))));
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(-Float64(x / B)) tmp = 0.0 if (F <= -36.0) tmp = Float64(t_0 + Float64(-1.0 / sin(B))); elseif (F <= 250000000.0) tmp = Float64(t_0 + Float64(Float64(F / B) * sqrt(Float64(1.0 / fma(2.0, x, fma(F, F, 2.0)))))); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = (-N[(x / B), $MachinePrecision])}, If[LessEqual[F, -36.0], N[(t$95$0 + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 250000000.0], N[(t$95$0 + N[(N[(F / B), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -\frac{x}{B}\\
\mathbf{if}\;F \leq -36:\\
\;\;\;\;t\_0 + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 250000000:\\
\;\;\;\;t\_0 + \frac{F}{B} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -36Initial program 60.5%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6498.5
Applied rewrites98.5%
Taylor expanded in B around 0
lower-/.f6464.4
Applied rewrites64.4%
if -36 < F < 2.5e8Initial program 99.4%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-fma.f64N/A
pow2N/A
lift-*.f6482.7
Applied rewrites82.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.f6482.7
Applied rewrites82.7%
Taylor expanded in B around 0
lower-/.f6441.7
Applied rewrites41.7%
if 2.5e8 < F Initial program 46.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites39.1%
Taylor expanded in F around inf
lower--.f6460.1
Applied rewrites60.1%
(FPCore (F B x)
:precision binary64
(if (<= F -1.05e+162)
(/ -1.0 (sin B))
(if (<= F 7200.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.05e+162) {
tmp = -1.0 / sin(B);
} else if (F <= 7200.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.05e+162) tmp = Float64(-1.0 / sin(B)); elseif (F <= 7200.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.05e+162], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 7200.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.05 \cdot 10^{+162}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 7200:\\
\;\;\;\;\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.05e162Initial program 37.9%
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 rewrites55.7%
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.f6446.0
Applied rewrites46.0%
if -1.05e162 < F < 7200Initial program 96.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites41.3%
lift-pow.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
unpow-1N/A
lower-/.f64N/A
pow2N/A
associate-+r+N/A
pow2N/A
lift-fma.f64N/A
lift-fma.f6441.3
Applied rewrites41.3%
if 7200 < F Initial program 48.7%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites38.9%
Taylor expanded in F around inf
lower--.f6459.0
Applied rewrites59.0%
Final simplification47.0%
(FPCore (F B x)
:precision binary64
(if (<= F -2.15e+151)
(+ (* (- x) (/ (fma -0.3333333333333333 (* B B) 1.0) B)) (/ -1.0 B))
(if (<= F 7200.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 <= -2.15e+151) {
tmp = (-x * (fma(-0.3333333333333333, (B * B), 1.0) / B)) + (-1.0 / B);
} else if (F <= 7200.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 <= -2.15e+151) tmp = Float64(Float64(Float64(-x) * Float64(fma(-0.3333333333333333, Float64(B * B), 1.0) / B)) + Float64(-1.0 / B)); elseif (F <= 7200.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, -2.15e+151], N[(N[((-x) * N[(N[(-0.3333333333333333 * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 7200.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 -2.15 \cdot 10^{+151}:\\
\;\;\;\;\left(-x\right) \cdot \frac{\mathsf{fma}\left(-0.3333333333333333, B \cdot B, 1\right)}{B} + \frac{-1}{B}\\
\mathbf{elif}\;F \leq 7200:\\
\;\;\;\;\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 < -2.14999999999999991e151Initial program 47.5%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-fma.f64N/A
pow2N/A
lift-*.f6445.4
Applied rewrites45.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.f6445.4
Applied rewrites45.4%
Taylor expanded in B around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6411.6
Applied rewrites11.6%
Taylor expanded in F around -inf
inv-powN/A
pow2N/A
associate-+r+N/A
pow2N/A
lower-/.f6437.7
Applied rewrites37.7%
if -2.14999999999999991e151 < F < 7200Initial program 96.6%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites42.0%
lift-pow.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
unpow-1N/A
lower-/.f64N/A
pow2N/A
associate-+r+N/A
pow2N/A
lift-fma.f64N/A
lift-fma.f6442.0
Applied rewrites42.0%
if 7200 < F Initial program 48.7%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites38.9%
Taylor expanded in F around inf
lower--.f6459.0
Applied rewrites59.0%
Final simplification46.1%
(FPCore (F B x) :precision binary64 (if (<= F -1.9e-28) (+ (* (- x) (/ (fma -0.3333333333333333 (* B B) 1.0) B)) (/ -1.0 B)) (if (<= F 6.5e-99) (/ (- x) B) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.9e-28) {
tmp = (-x * (fma(-0.3333333333333333, (B * B), 1.0) / B)) + (-1.0 / B);
} else if (F <= 6.5e-99) {
tmp = -x / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.9e-28) tmp = Float64(Float64(Float64(-x) * Float64(fma(-0.3333333333333333, Float64(B * B), 1.0) / B)) + Float64(-1.0 / B)); elseif (F <= 6.5e-99) tmp = Float64(Float64(-x) / B); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.9e-28], N[(N[((-x) * N[(N[(-0.3333333333333333 * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 6.5e-99], N[((-x) / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.9 \cdot 10^{-28}:\\
\;\;\;\;\left(-x\right) \cdot \frac{\mathsf{fma}\left(-0.3333333333333333, B \cdot B, 1\right)}{B} + \frac{-1}{B}\\
\mathbf{elif}\;F \leq 6.5 \cdot 10^{-99}:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -1.90000000000000005e-28Initial program 63.5%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-fma.f64N/A
pow2N/A
lift-*.f6452.1
Applied rewrites52.1%
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.1
Applied rewrites52.1%
Taylor expanded in B around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6418.5
Applied rewrites18.5%
Taylor expanded in F around -inf
inv-powN/A
pow2N/A
associate-+r+N/A
pow2N/A
lower-/.f6436.9
Applied rewrites36.9%
if -1.90000000000000005e-28 < F < 6.50000000000000033e-99Initial program 99.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites41.4%
Taylor expanded in F around 0
mul-1-negN/A
lift-neg.f6431.1
Applied rewrites31.1%
if 6.50000000000000033e-99 < F Initial program 57.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites40.4%
Taylor expanded in F around inf
lower--.f6450.8
Applied rewrites50.8%
Final simplification39.6%
(FPCore (F B x) :precision binary64 (if (<= F -7e-63) (/ (- -1.0 x) B) (if (<= F 6.5e-99) (/ (- x) B) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -7e-63) {
tmp = (-1.0 - x) / B;
} else if (F <= 6.5e-99) {
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 <= (-7d-63)) then
tmp = ((-1.0d0) - x) / b
else if (f <= 6.5d-99) 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 <= -7e-63) {
tmp = (-1.0 - x) / B;
} else if (F <= 6.5e-99) {
tmp = -x / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -7e-63: tmp = (-1.0 - x) / B elif F <= 6.5e-99: tmp = -x / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -7e-63) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 6.5e-99) 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 <= -7e-63) tmp = (-1.0 - x) / B; elseif (F <= 6.5e-99) tmp = -x / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -7e-63], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 6.5e-99], N[((-x) / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -7 \cdot 10^{-63}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 6.5 \cdot 10^{-99}:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -7.00000000000000006e-63Initial program 65.7%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites32.6%
Taylor expanded in F around -inf
distribute-lft-inN/A
metadata-evalN/A
mul-1-negN/A
lower-+.f64N/A
lift-neg.f6434.9
Applied rewrites34.9%
if -7.00000000000000006e-63 < F < 6.50000000000000033e-99Initial program 99.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites41.3%
Taylor expanded in F around 0
mul-1-negN/A
lift-neg.f6432.6
Applied rewrites32.6%
if 6.50000000000000033e-99 < F Initial program 57.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites40.4%
Taylor expanded in F around inf
lower--.f6450.8
Applied rewrites50.8%
Final simplification39.6%
(FPCore (F B x) :precision binary64 (if (or (<= x -3.9e-23) (not (<= x 3.15e-203))) (/ (- x) B) (/ 1.0 B)))
double code(double F, double B, double x) {
double tmp;
if ((x <= -3.9e-23) || !(x <= 3.15e-203)) {
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 ((x <= (-3.9d-23)) .or. (.not. (x <= 3.15d-203))) 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 ((x <= -3.9e-23) || !(x <= 3.15e-203)) {
tmp = -x / B;
} else {
tmp = 1.0 / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if (x <= -3.9e-23) or not (x <= 3.15e-203): tmp = -x / B else: tmp = 1.0 / B return tmp
function code(F, B, x) tmp = 0.0 if ((x <= -3.9e-23) || !(x <= 3.15e-203)) 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 ((x <= -3.9e-23) || ~((x <= 3.15e-203))) tmp = -x / B; else tmp = 1.0 / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[Or[LessEqual[x, -3.9e-23], N[Not[LessEqual[x, 3.15e-203]], $MachinePrecision]], N[((-x) / B), $MachinePrecision], N[(1.0 / B), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.9 \cdot 10^{-23} \lor \neg \left(x \leq 3.15 \cdot 10^{-203}\right):\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{B}\\
\end{array}
\end{array}
if x < -3.9e-23 or 3.14999999999999989e-203 < x Initial program 77.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites39.8%
Taylor expanded in F around 0
mul-1-negN/A
lift-neg.f6434.6
Applied rewrites34.6%
if -3.9e-23 < x < 3.14999999999999989e-203Initial program 68.0%
Applied rewrites68.0%
Taylor expanded in B around 0
distribute-lft-neg-inN/A
inv-powN/A
associate-*r/N/A
*-commutativeN/A
mul-1-negN/A
lower-/.f64N/A
Applied rewrites35.1%
Taylor expanded in F around inf
lower--.f6425.1
Applied rewrites25.1%
Taylor expanded in x around 0
Applied rewrites25.1%
Final simplification31.3%
(FPCore (F B x) :precision binary64 (if (<= F 6.5e-99) (/ (- x) B) (/ (- 1.0 x) B)))
double code(double F, double B, double x) {
double tmp;
if (F <= 6.5e-99) {
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 <= 6.5d-99) 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 <= 6.5e-99) {
tmp = -x / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= 6.5e-99: tmp = -x / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= 6.5e-99) 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 <= 6.5e-99) tmp = -x / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, 6.5e-99], N[((-x) / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq 6.5 \cdot 10^{-99}:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < 6.50000000000000033e-99Initial program 82.9%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites37.0%
Taylor expanded in F around 0
mul-1-negN/A
lift-neg.f6427.9
Applied rewrites27.9%
if 6.50000000000000033e-99 < F Initial program 57.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites40.4%
Taylor expanded in F around inf
lower--.f6450.8
Applied rewrites50.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 74.1%
Applied rewrites74.1%
Taylor expanded in B around 0
distribute-lft-neg-inN/A
inv-powN/A
associate-*r/N/A
*-commutativeN/A
mul-1-negN/A
lower-/.f64N/A
Applied rewrites38.2%
Taylor expanded in F around inf
lower--.f6430.3
Applied rewrites30.3%
Taylor expanded in x around 0
Applied rewrites12.4%
Final simplification12.4%
herbie shell --seed 2025059
(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))))))