
(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}
Herbie found 24 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (F B x) :precision binary64 (+ (- (* x (/ 1.0 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))
double code(double F, double B, double x) {
return -(x * (1.0 / tan(B))) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = -(x * (1.0d0 / tan(b))) + ((f / sin(b)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
end function
public static double code(double F, double B, double x) {
return -(x * (1.0 / Math.tan(B))) + ((F / Math.sin(B)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
def code(F, B, x): return -(x * (1.0 / math.tan(B))) + ((F / math.sin(B)) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)))
function code(F, B, x) return Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))) end
function tmp = code(F, B, x) tmp = -(x * (1.0 / tan(B))) + ((F / sin(B)) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); end
code[F_, B_, x_] := N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], (-N[(1.0 / 2.0), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\end{array}
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* (cos B) x)))
(if (<= F -1e+14)
(- (/ (+ 1.0 t_0) (sin B)))
(if (<= F 100000000.0)
(+
(/ (- x) (tan B))
(* (/ F (sin B)) (pow (fma 2.0 x (fma F F 2.0)) -0.5)))
(/ (- 1.0 t_0) (sin B))))))
double code(double F, double B, double x) {
double t_0 = cos(B) * x;
double tmp;
if (F <= -1e+14) {
tmp = -((1.0 + t_0) / sin(B));
} else if (F <= 100000000.0) {
tmp = (-x / tan(B)) + ((F / sin(B)) * pow(fma(2.0, x, fma(F, F, 2.0)), -0.5));
} 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 <= -1e+14) tmp = Float64(-Float64(Float64(1.0 + t_0) / sin(B))); elseif (F <= 100000000.0) tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(Float64(F / sin(B)) * (fma(2.0, x, fma(F, F, 2.0)) ^ -0.5))); 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, -1e+14], (-N[(N[(1.0 + t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 100000000.0], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $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 -1 \cdot 10^{+14}:\\
\;\;\;\;-\frac{1 + t\_0}{\sin B}\\
\mathbf{elif}\;F \leq 100000000:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - t\_0}{\sin B}\\
\end{array}
\end{array}
if F < -1e14Initial program 57.7%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
if -1e14 < F < 1e8Initial program 99.4%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.4%
Applied rewrites99.6%
if 1e8 < F Initial program 56.0%
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%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (- (* x (/ 1.0 (tan B))))))
(if (<=
(+
t_0
(* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0)))))
5e+300)
(+ t_0 (* (/ F B) (/ 1.0 (sqrt (+ 2.0 (fma 2.0 x (* F F)))))))
(fma -0.5 (/ 2.0 (* (* F F) B)) (/ (- 1.0 x) B)))))
double code(double F, double B, double x) {
double t_0 = -(x * (1.0 / tan(B)));
double tmp;
if ((t_0 + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)))) <= 5e+300) {
tmp = t_0 + ((F / B) * (1.0 / sqrt((2.0 + fma(2.0, x, (F * F))))));
} else {
tmp = fma(-0.5, (2.0 / ((F * F) * B)), ((1.0 - x) / B));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(-Float64(x * Float64(1.0 / tan(B)))) tmp = 0.0 if (Float64(t_0 + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))) <= 5e+300) tmp = Float64(t_0 + Float64(Float64(F / B) * Float64(1.0 / sqrt(Float64(2.0 + fma(2.0, x, Float64(F * F))))))); else tmp = fma(-0.5, Float64(2.0 / Float64(Float64(F * F) * B)), 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[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], 5e+300], N[(t$95$0 + N[(N[(F / B), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(2.0 + N[(2.0 * x + N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(2.0 / N[(N[(F * F), $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -x \cdot \frac{1}{\tan B}\\
\mathbf{if}\;t\_0 + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} \leq 5 \cdot 10^{+300}:\\
\;\;\;\;t\_0 + \frac{F}{B} \cdot \frac{1}{\sqrt{2 + \mathsf{fma}\left(2, x, F \cdot F\right)}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, \frac{2}{\left(F \cdot F\right) \cdot B}, \frac{1 - x}{B}\right)\\
\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)))))) < 5.00000000000000026e300Initial program 87.4%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6451.4
Applied rewrites51.4%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f64N/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
pow2N/A
lower-+.f64N/A
lift-*.f64N/A
lift-fma.f6470.1
Applied rewrites70.1%
if 5.00000000000000026e300 < (+.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 20.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites64.9%
Taylor expanded in F around inf
associate--l+N/A
div-subN/A
lower-fma.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-/.f64N/A
lower--.f6454.1
Applied rewrites54.1%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6476.1
Applied rewrites76.1%
(FPCore (F B x)
:precision binary64
(let* ((t_0
(+
(- (/ x B))
(/ (* F (pow (fma 2.0 x (fma F F 2.0)) -0.5)) (sin B))))
(t_1 (* (cos B) x)))
(if (<= F -1.65e-10)
(- (/ (+ 1.0 t_1) (sin B)))
(if (<= F -4.8e-127)
t_0
(if (<= F 1.75e-158)
(+
(- (/ (* x 1.0) (tan B)))
(* (/ F B) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0)))))
(if (<= F 40000000.0) t_0 (/ (- 1.0 t_1) (sin B))))))))
double code(double F, double B, double x) {
double t_0 = -(x / B) + ((F * pow(fma(2.0, x, fma(F, F, 2.0)), -0.5)) / sin(B));
double t_1 = cos(B) * x;
double tmp;
if (F <= -1.65e-10) {
tmp = -((1.0 + t_1) / sin(B));
} else if (F <= -4.8e-127) {
tmp = t_0;
} else if (F <= 1.75e-158) {
tmp = -((x * 1.0) / tan(B)) + ((F / B) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
} else if (F <= 40000000.0) {
tmp = t_0;
} else {
tmp = (1.0 - t_1) / sin(B);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-Float64(x / B)) + Float64(Float64(F * (fma(2.0, x, fma(F, F, 2.0)) ^ -0.5)) / sin(B))) t_1 = Float64(cos(B) * x) tmp = 0.0 if (F <= -1.65e-10) tmp = Float64(-Float64(Float64(1.0 + t_1) / sin(B))); elseif (F <= -4.8e-127) tmp = t_0; elseif (F <= 1.75e-158) tmp = Float64(Float64(-Float64(Float64(x * 1.0) / tan(B))) + Float64(Float64(F / B) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))); elseif (F <= 40000000.0) tmp = t_0; else tmp = Float64(Float64(1.0 - t_1) / sin(B)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-N[(x / B), $MachinePrecision]) + N[(N[(F * N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[F, -1.65e-10], (-N[(N[(1.0 + t$95$1), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, -4.8e-127], t$95$0, If[LessEqual[F, 1.75e-158], N[((-N[(N[(x * 1.0), $MachinePrecision] / N[Tan[B], $MachinePrecision]), $MachinePrecision]) + N[(N[(F / B), $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], If[LessEqual[F, 40000000.0], t$95$0, N[(N[(1.0 - t$95$1), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(-\frac{x}{B}\right) + \frac{F \cdot {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B}\\
t_1 := \cos B \cdot x\\
\mathbf{if}\;F \leq -1.65 \cdot 10^{-10}:\\
\;\;\;\;-\frac{1 + t\_1}{\sin B}\\
\mathbf{elif}\;F \leq -4.8 \cdot 10^{-127}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;F \leq 1.75 \cdot 10^{-158}:\\
\;\;\;\;\left(-\frac{x \cdot 1}{\tan B}\right) + \frac{F}{B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\\
\mathbf{elif}\;F \leq 40000000:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - t\_1}{\sin B}\\
\end{array}
\end{array}
if F < -1.65e-10Initial program 60.2%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6497.5
Applied rewrites97.5%
if -1.65e-10 < F < -4.79999999999999964e-127 or 1.75000000000000006e-158 < F < 4e7Initial 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 B around 0
associate-*r/N/A
lower-/.f6474.1
Applied rewrites74.1%
if -4.79999999999999964e-127 < F < 1.75000000000000006e-158Initial 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.7
Applied rewrites99.7%
Taylor expanded in B around 0
Applied rewrites89.8%
if 4e7 < F Initial program 56.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.f6499.7
Applied rewrites99.7%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* (cos B) x)))
(if (<= F -55000000000000.0)
(- (/ (+ 1.0 t_0) (sin B)))
(if (<= F 120000000.0)
(+
(- (* x (/ 1.0 (tan B))))
(* (/ F (sin B)) (/ 1.0 (sqrt (+ 2.0 (fma 2.0 x (* F F)))))))
(/ (- 1.0 t_0) (sin B))))))
double code(double F, double B, double x) {
double t_0 = cos(B) * x;
double tmp;
if (F <= -55000000000000.0) {
tmp = -((1.0 + t_0) / sin(B));
} else if (F <= 120000000.0) {
tmp = -(x * (1.0 / tan(B))) + ((F / sin(B)) * (1.0 / sqrt((2.0 + fma(2.0, x, (F * F))))));
} 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 <= -55000000000000.0) tmp = Float64(-Float64(Float64(1.0 + t_0) / sin(B))); elseif (F <= 120000000.0) tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / sin(B)) * Float64(1.0 / sqrt(Float64(2.0 + fma(2.0, x, Float64(F * F))))))); 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, -55000000000000.0], (-N[(N[(1.0 + t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 120000000.0], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(2.0 + N[(2.0 * x + N[(F * F), $MachinePrecision]), $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 -55000000000000:\\
\;\;\;\;-\frac{1 + t\_0}{\sin B}\\
\mathbf{elif}\;F \leq 120000000:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot \frac{1}{\sqrt{2 + \mathsf{fma}\left(2, x, F \cdot F\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - t\_0}{\sin B}\\
\end{array}
\end{array}
if F < -5.5e13Initial program 57.7%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
if -5.5e13 < F < 1.2e8Initial program 99.4%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6436.3
Applied rewrites36.3%
Taylor expanded in B around inf
lower-*.f64N/A
lift-sin.f64N/A
lift-/.f64N/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
pow2N/A
lower-+.f64N/A
lift-*.f64N/A
lift-fma.f6499.4
Applied rewrites99.4%
if 1.2e8 < F Initial program 56.0%
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%
(FPCore (F B x)
:precision binary64
(let* ((t_0
(+
(- (/ x B))
(/ (* F (pow (fma 2.0 x (fma F F 2.0)) -0.5)) (sin B))))
(t_1 (* (cos B) x)))
(if (<= F -1.65e-10)
(- (/ (+ 1.0 t_1) (sin B)))
(if (<= F -4.4e-134)
t_0
(if (<= F 1.7e-158)
(+
(- (* x (/ 1.0 (tan B))))
(* (/ F B) (/ 1.0 (sqrt (+ 2.0 (fma 2.0 x (* F F)))))))
(if (<= F 40000000.0) t_0 (/ (- 1.0 t_1) (sin B))))))))
double code(double F, double B, double x) {
double t_0 = -(x / B) + ((F * pow(fma(2.0, x, fma(F, F, 2.0)), -0.5)) / sin(B));
double t_1 = cos(B) * x;
double tmp;
if (F <= -1.65e-10) {
tmp = -((1.0 + t_1) / sin(B));
} else if (F <= -4.4e-134) {
tmp = t_0;
} else if (F <= 1.7e-158) {
tmp = -(x * (1.0 / tan(B))) + ((F / B) * (1.0 / sqrt((2.0 + fma(2.0, x, (F * F))))));
} else if (F <= 40000000.0) {
tmp = t_0;
} else {
tmp = (1.0 - t_1) / sin(B);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-Float64(x / B)) + Float64(Float64(F * (fma(2.0, x, fma(F, F, 2.0)) ^ -0.5)) / sin(B))) t_1 = Float64(cos(B) * x) tmp = 0.0 if (F <= -1.65e-10) tmp = Float64(-Float64(Float64(1.0 + t_1) / sin(B))); elseif (F <= -4.4e-134) tmp = t_0; elseif (F <= 1.7e-158) tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / B) * Float64(1.0 / sqrt(Float64(2.0 + fma(2.0, x, Float64(F * F))))))); elseif (F <= 40000000.0) tmp = t_0; else tmp = Float64(Float64(1.0 - t_1) / sin(B)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-N[(x / B), $MachinePrecision]) + N[(N[(F * N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[F, -1.65e-10], (-N[(N[(1.0 + t$95$1), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, -4.4e-134], t$95$0, If[LessEqual[F, 1.7e-158], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / B), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(2.0 + N[(2.0 * x + N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 40000000.0], t$95$0, N[(N[(1.0 - t$95$1), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(-\frac{x}{B}\right) + \frac{F \cdot {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B}\\
t_1 := \cos B \cdot x\\
\mathbf{if}\;F \leq -1.65 \cdot 10^{-10}:\\
\;\;\;\;-\frac{1 + t\_1}{\sin B}\\
\mathbf{elif}\;F \leq -4.4 \cdot 10^{-134}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;F \leq 1.7 \cdot 10^{-158}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{B} \cdot \frac{1}{\sqrt{2 + \mathsf{fma}\left(2, x, F \cdot F\right)}}\\
\mathbf{elif}\;F \leq 40000000:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - t\_1}{\sin B}\\
\end{array}
\end{array}
if F < -1.65e-10Initial program 60.2%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6497.5
Applied rewrites97.5%
if -1.65e-10 < F < -4.3999999999999999e-134 or 1.7e-158 < F < 4e7Initial 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 B around 0
associate-*r/N/A
lower-/.f6474.1
Applied rewrites74.1%
if -4.3999999999999999e-134 < F < 1.7e-158Initial program 99.4%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6435.1
Applied rewrites35.1%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f64N/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
pow2N/A
lower-+.f64N/A
lift-*.f64N/A
lift-fma.f6489.8
Applied rewrites89.8%
if 4e7 < F Initial program 56.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.f6499.7
Applied rewrites99.7%
(FPCore (F B x)
:precision binary64
(if (<= F -1e+119)
(+
(/ (- x) (tan B))
(/
-1.0
(*
(fma
(- (* 0.008333333333333333 (* B B)) 0.16666666666666666)
(* B B)
1.0)
B)))
(if (<= F -8.5e+25)
(+ (- (/ x B)) (/ -1.0 (sin B)))
(if (<= F 175.0)
(+
(- (* x (/ 1.0 (tan B))))
(* (/ F B) (/ 1.0 (sqrt (+ 2.0 (fma 2.0 x (* F F)))))))
(/ (- 1.0 (* (cos B) x)) (sin B))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1e+119) {
tmp = (-x / tan(B)) + (-1.0 / (fma(((0.008333333333333333 * (B * B)) - 0.16666666666666666), (B * B), 1.0) * B));
} else if (F <= -8.5e+25) {
tmp = -(x / B) + (-1.0 / sin(B));
} else if (F <= 175.0) {
tmp = -(x * (1.0 / tan(B))) + ((F / B) * (1.0 / sqrt((2.0 + fma(2.0, x, (F * F))))));
} else {
tmp = (1.0 - (cos(B) * x)) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1e+119) tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(-1.0 / Float64(fma(Float64(Float64(0.008333333333333333 * Float64(B * B)) - 0.16666666666666666), Float64(B * B), 1.0) * B))); elseif (F <= -8.5e+25) tmp = Float64(Float64(-Float64(x / B)) + Float64(-1.0 / sin(B))); elseif (F <= 175.0) tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / B) * Float64(1.0 / sqrt(Float64(2.0 + fma(2.0, x, Float64(F * F))))))); else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1e+119], N[(N[((-x) / N[Tan[B], $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], If[LessEqual[F, -8.5e+25], N[((-N[(x / B), $MachinePrecision]) + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 175.0], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / B), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(2.0 + N[(2.0 * x + N[(F * F), $MachinePrecision]), $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^{+119}:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{-1}{\mathsf{fma}\left(0.008333333333333333 \cdot \left(B \cdot B\right) - 0.16666666666666666, B \cdot B, 1\right) \cdot B}\\
\mathbf{elif}\;F \leq -8.5 \cdot 10^{+25}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 175:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{B} \cdot \frac{1}{\sqrt{2 + \mathsf{fma}\left(2, x, F \cdot F\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -9.99999999999999944e118Initial program 42.0%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
distribute-neg-fracN/A
*-rgt-identityN/A
lower-/.f64N/A
lower-neg.f64N/A
lift-tan.f6499.8
Applied rewrites99.8%
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
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6473.8
Applied rewrites73.8%
if -9.99999999999999944e118 < F < -8.5000000000000007e25Initial program 91.0%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6499.6
Applied rewrites99.6%
Taylor expanded in B around 0
associate-*r/N/A
lower-/.f6476.6
Applied rewrites76.6%
if -8.5000000000000007e25 < F < 175Initial program 99.4%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6437.4
Applied rewrites37.4%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f64N/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
pow2N/A
lower-+.f64N/A
lift-*.f64N/A
lift-fma.f6482.3
Applied rewrites82.3%
if 175 < F Initial program 56.6%
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.5
Applied rewrites99.5%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* (cos B) x)))
(if (<= F -1450000000.0)
(- (/ (+ 1.0 t_0) (sin B)))
(if (<= F 175.0)
(+
(- (* x (/ 1.0 (tan B))))
(* (/ F B) (/ 1.0 (sqrt (+ 2.0 (fma 2.0 x (* F F)))))))
(/ (- 1.0 t_0) (sin B))))))
double code(double F, double B, double x) {
double t_0 = cos(B) * x;
double tmp;
if (F <= -1450000000.0) {
tmp = -((1.0 + t_0) / sin(B));
} else if (F <= 175.0) {
tmp = -(x * (1.0 / tan(B))) + ((F / B) * (1.0 / sqrt((2.0 + fma(2.0, x, (F * F))))));
} 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 <= -1450000000.0) tmp = Float64(-Float64(Float64(1.0 + t_0) / sin(B))); elseif (F <= 175.0) tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / B) * Float64(1.0 / sqrt(Float64(2.0 + fma(2.0, x, Float64(F * F))))))); 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, -1450000000.0], (-N[(N[(1.0 + t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 175.0], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / B), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(2.0 + N[(2.0 * x + N[(F * F), $MachinePrecision]), $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 -1450000000:\\
\;\;\;\;-\frac{1 + t\_0}{\sin B}\\
\mathbf{elif}\;F \leq 175:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{B} \cdot \frac{1}{\sqrt{2 + \mathsf{fma}\left(2, x, F \cdot F\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - t\_0}{\sin B}\\
\end{array}
\end{array}
if F < -1.45e9Initial program 58.3%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
if -1.45e9 < F < 175Initial program 99.4%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6435.8
Applied rewrites35.8%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f64N/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
pow2N/A
lower-+.f64N/A
lift-*.f64N/A
lift-fma.f6482.6
Applied rewrites82.6%
if 175 < F Initial program 56.6%
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.5
Applied rewrites99.5%
(FPCore (F B x)
:precision binary64
(if (<= B 2.05e-13)
(/ (- (* (sqrt (/ 1.0 (fma 2.0 x (fma F F 2.0)))) F) x) B)
(+
(/ (- x) (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 <= 2.05e-13) {
tmp = ((sqrt((1.0 / fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B;
} else {
tmp = (-x / 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 <= 2.05e-13) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 / fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B); else tmp = Float64(Float64(Float64(-x) / 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, 2.05e-13], 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[((-x) / N[Tan[B], $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 2.05 \cdot 10^{-13}:\\
\;\;\;\;\frac{\sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{\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.0500000000000001e-13Initial program 74.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites57.7%
lift-pow.f64N/A
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
unpow-1N/A
pow2N/A
associate-+r+N/A
pow2N/A
lower-/.f64N/A
lift-fma.f64N/A
lift-fma.f6457.7
Applied rewrites57.7%
if 2.0500000000000001e-13 < B Initial program 84.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6455.8
Applied rewrites55.8%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
distribute-neg-fracN/A
*-rgt-identityN/A
lower-/.f64N/A
lower-neg.f64N/A
lift-tan.f6455.9
Applied rewrites55.9%
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
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6454.6
Applied rewrites54.6%
(FPCore (F B x)
:precision binary64
(if (<= B 2.05e-13)
(/ (- (* (sqrt (/ 1.0 (fma 2.0 x (fma F F 2.0)))) F) x) B)
(+
(- (* x (/ 1.0 (tan B))))
(/ -1.0 (* B (+ 1.0 (* -0.16666666666666666 (* B B))))))))
double code(double F, double B, double x) {
double tmp;
if (B <= 2.05e-13) {
tmp = ((sqrt((1.0 / fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B;
} else {
tmp = -(x * (1.0 / tan(B))) + (-1.0 / (B * (1.0 + (-0.16666666666666666 * (B * B)))));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (B <= 2.05e-13) tmp = Float64(Float64(Float64(sqrt(Float64(1.0 / fma(2.0, x, fma(F, F, 2.0)))) * F) - x) / B); else tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(-1.0 / Float64(B * Float64(1.0 + Float64(-0.16666666666666666 * Float64(B * B)))))); end return tmp end
code[F_, B_, x_] := If[LessEqual[B, 2.05e-13], 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[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(-1.0 / N[(B * N[(1.0 + N[(-0.16666666666666666 * N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 2.05 \cdot 10^{-13}:\\
\;\;\;\;\frac{\sqrt{\frac{1}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{-1}{B \cdot \left(1 + -0.16666666666666666 \cdot \left(B \cdot B\right)\right)}\\
\end{array}
\end{array}
if B < 2.0500000000000001e-13Initial program 74.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites57.7%
lift-pow.f64N/A
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
unpow-1N/A
pow2N/A
associate-+r+N/A
pow2N/A
lower-/.f64N/A
lift-fma.f64N/A
lift-fma.f6457.7
Applied rewrites57.7%
if 2.0500000000000001e-13 < B Initial program 84.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6455.8
Applied rewrites55.8%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6453.8
Applied rewrites53.8%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ 1.0 (sqrt (+ 2.0 (fma 2.0 x (* F F)))))))
(if (<= B 1.0)
(/
(-
(fma
F
t_0
(*
(* B B)
(fma (* 0.16666666666666666 F) t_0 (* 0.3333333333333333 x))))
x)
B)
(+
(- (* x (/ 1.0 (tan B))))
(/ -1.0 (* B (* (* B B) -0.16666666666666666)))))))
double code(double F, double B, double x) {
double t_0 = 1.0 / sqrt((2.0 + fma(2.0, x, (F * F))));
double tmp;
if (B <= 1.0) {
tmp = (fma(F, t_0, ((B * B) * fma((0.16666666666666666 * F), t_0, (0.3333333333333333 * x)))) - x) / B;
} else {
tmp = -(x * (1.0 / tan(B))) + (-1.0 / (B * ((B * B) * -0.16666666666666666)));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(1.0 / sqrt(Float64(2.0 + fma(2.0, x, Float64(F * F))))) tmp = 0.0 if (B <= 1.0) tmp = Float64(Float64(fma(F, t_0, Float64(Float64(B * B) * fma(Float64(0.16666666666666666 * F), t_0, Float64(0.3333333333333333 * x)))) - x) / B); else tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(-1.0 / Float64(B * Float64(Float64(B * B) * -0.16666666666666666)))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(1.0 / N[Sqrt[N[(2.0 + N[(2.0 * x + N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 1.0], N[(N[(N[(F * t$95$0 + N[(N[(B * B), $MachinePrecision] * N[(N[(0.16666666666666666 * F), $MachinePrecision] * t$95$0 + N[(0.3333333333333333 * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(-1.0 / N[(B * N[(N[(B * B), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\sqrt{2 + \mathsf{fma}\left(2, x, F \cdot F\right)}}\\
\mathbf{if}\;B \leq 1:\\
\;\;\;\;\frac{\mathsf{fma}\left(F, t\_0, \left(B \cdot B\right) \cdot \mathsf{fma}\left(0.16666666666666666 \cdot F, t\_0, 0.3333333333333333 \cdot x\right)\right) - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{-1}{B \cdot \left(\left(B \cdot B\right) \cdot -0.16666666666666666\right)}\\
\end{array}
\end{array}
if B < 1Initial program 74.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites57.7%
Taylor expanded in B around 0
Applied rewrites57.8%
if 1 < B Initial program 84.4%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6455.8
Applied rewrites55.8%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6453.8
Applied rewrites53.8%
Taylor expanded in B around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6453.8
Applied rewrites53.8%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ 1.0 (sqrt (+ 2.0 (fma 2.0 x (* F F)))))))
(if (<= B 0.88)
(/
(-
(fma
F
t_0
(*
(* B B)
(fma (* 0.16666666666666666 F) t_0 (* 0.3333333333333333 x))))
x)
B)
(+ (/ (- x) (tan B)) (/ -1.0 B)))))
double code(double F, double B, double x) {
double t_0 = 1.0 / sqrt((2.0 + fma(2.0, x, (F * F))));
double tmp;
if (B <= 0.88) {
tmp = (fma(F, t_0, ((B * B) * fma((0.16666666666666666 * F), t_0, (0.3333333333333333 * x)))) - x) / B;
} else {
tmp = (-x / tan(B)) + (-1.0 / B);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(1.0 / sqrt(Float64(2.0 + fma(2.0, x, Float64(F * F))))) tmp = 0.0 if (B <= 0.88) tmp = Float64(Float64(fma(F, t_0, Float64(Float64(B * B) * fma(Float64(0.16666666666666666 * F), t_0, Float64(0.3333333333333333 * x)))) - x) / B); else tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(-1.0 / B)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(1.0 / N[Sqrt[N[(2.0 + N[(2.0 * x + N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 0.88], N[(N[(N[(F * t$95$0 + N[(N[(B * B), $MachinePrecision] * N[(N[(0.16666666666666666 * F), $MachinePrecision] * t$95$0 + N[(0.3333333333333333 * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\sqrt{2 + \mathsf{fma}\left(2, x, F \cdot F\right)}}\\
\mathbf{if}\;B \leq 0.88:\\
\;\;\;\;\frac{\mathsf{fma}\left(F, t\_0, \left(B \cdot B\right) \cdot \mathsf{fma}\left(0.16666666666666666 \cdot F, t\_0, 0.3333333333333333 \cdot x\right)\right) - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{-1}{B}\\
\end{array}
\end{array}
if B < 0.880000000000000004Initial program 74.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites57.7%
Taylor expanded in B around 0
Applied rewrites57.8%
if 0.880000000000000004 < B Initial program 84.4%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6455.8
Applied rewrites55.8%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
distribute-neg-fracN/A
*-rgt-identityN/A
lower-/.f64N/A
lower-neg.f64N/A
lift-tan.f6455.9
Applied rewrites55.9%
Taylor expanded in B around 0
Applied rewrites50.7%
(FPCore (F B x)
:precision binary64
(if (<= F -1.7e-10)
(+ (- (/ x B)) (/ -1.0 (sin B)))
(if (<= F 40000000.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.7e-10) {
tmp = -(x / B) + (-1.0 / sin(B));
} else if (F <= 40000000.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.7e-10) tmp = Float64(Float64(-Float64(x / B)) + Float64(-1.0 / sin(B))); elseif (F <= 40000000.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.7e-10], N[((-N[(x / B), $MachinePrecision]) + N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 40000000.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.7 \cdot 10^{-10}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 40000000:\\
\;\;\;\;\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.70000000000000007e-10Initial program 60.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6497.5
Applied rewrites97.5%
Taylor expanded in B around 0
associate-*r/N/A
lower-/.f6473.4
Applied rewrites73.4%
if -1.70000000000000007e-10 < F < 4e7Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites52.2%
lift-pow.f64N/A
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
unpow-1N/A
pow2N/A
associate-+r+N/A
pow2N/A
lower-/.f64N/A
lift-fma.f64N/A
lift-fma.f6452.2
Applied rewrites52.2%
if 4e7 < F Initial program 56.1%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites37.5%
Taylor expanded in F around inf
Applied rewrites50.7%
(FPCore (F B x)
:precision binary64
(if (<= F -3.3e-21)
(+
(-
(*
x
(/
1.0
(*
(fma (fma 0.13333333333333333 (* B B) 0.3333333333333333) (* B B) 1.0)
B))))
(/ -1.0 (* B (+ 1.0 (* -0.16666666666666666 (* B B))))))
(if (<= F 40000000.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 <= -3.3e-21) {
tmp = -(x * (1.0 / (fma(fma(0.13333333333333333, (B * B), 0.3333333333333333), (B * B), 1.0) * B))) + (-1.0 / (B * (1.0 + (-0.16666666666666666 * (B * B)))));
} else if (F <= 40000000.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 <= -3.3e-21) tmp = Float64(Float64(-Float64(x * Float64(1.0 / Float64(fma(fma(0.13333333333333333, Float64(B * B), 0.3333333333333333), Float64(B * B), 1.0) * B)))) + Float64(-1.0 / Float64(B * Float64(1.0 + Float64(-0.16666666666666666 * Float64(B * B)))))); elseif (F <= 40000000.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, -3.3e-21], N[((-N[(x * N[(1.0 / N[(N[(N[(0.13333333333333333 * N[(B * B), $MachinePrecision] + 0.3333333333333333), $MachinePrecision] * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(-1.0 / N[(B * N[(1.0 + N[(-0.16666666666666666 * N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 40000000.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 -3.3 \cdot 10^{-21}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\mathsf{fma}\left(\mathsf{fma}\left(0.13333333333333333, B \cdot B, 0.3333333333333333\right), B \cdot B, 1\right) \cdot B}\right) + \frac{-1}{B \cdot \left(1 + -0.16666666666666666 \cdot \left(B \cdot B\right)\right)}\\
\mathbf{elif}\;F \leq 40000000:\\
\;\;\;\;\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 < -3.30000000000000009e-21Initial program 61.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6496.1
Applied rewrites96.1%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6470.9
Applied rewrites70.9%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6447.5
Applied rewrites47.5%
if -3.30000000000000009e-21 < F < 4e7Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites52.2%
lift-pow.f64N/A
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
unpow-1N/A
pow2N/A
associate-+r+N/A
pow2N/A
lower-/.f64N/A
lift-fma.f64N/A
lift-fma.f6452.2
Applied rewrites52.2%
if 4e7 < F Initial program 56.1%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites37.5%
Taylor expanded in F around inf
Applied rewrites50.7%
(FPCore (F B x)
:precision binary64
(if (<= F -3.3e-21)
(+
(- (* x (/ 1.0 (* (fma 0.3333333333333333 (* B B) 1.0) B))))
(/ -1.0 (* B (+ 1.0 (* -0.16666666666666666 (* B B))))))
(if (<= F 40000000.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 <= -3.3e-21) {
tmp = -(x * (1.0 / (fma(0.3333333333333333, (B * B), 1.0) * B))) + (-1.0 / (B * (1.0 + (-0.16666666666666666 * (B * B)))));
} else if (F <= 40000000.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 <= -3.3e-21) tmp = Float64(Float64(-Float64(x * Float64(1.0 / Float64(fma(0.3333333333333333, Float64(B * B), 1.0) * B)))) + Float64(-1.0 / Float64(B * Float64(1.0 + Float64(-0.16666666666666666 * Float64(B * B)))))); elseif (F <= 40000000.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, -3.3e-21], N[((-N[(x * N[(1.0 / N[(N[(0.3333333333333333 * N[(B * B), $MachinePrecision] + 1.0), $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(-1.0 / N[(B * N[(1.0 + N[(-0.16666666666666666 * N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 40000000.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 -3.3 \cdot 10^{-21}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\mathsf{fma}\left(0.3333333333333333, B \cdot B, 1\right) \cdot B}\right) + \frac{-1}{B \cdot \left(1 + -0.16666666666666666 \cdot \left(B \cdot B\right)\right)}\\
\mathbf{elif}\;F \leq 40000000:\\
\;\;\;\;\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 < -3.30000000000000009e-21Initial program 61.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6496.1
Applied rewrites96.1%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6470.9
Applied rewrites70.9%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6447.5
Applied rewrites47.5%
if -3.30000000000000009e-21 < F < 4e7Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites52.2%
lift-pow.f64N/A
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
unpow-1N/A
pow2N/A
associate-+r+N/A
pow2N/A
lower-/.f64N/A
lift-fma.f64N/A
lift-fma.f6452.2
Applied rewrites52.2%
if 4e7 < F Initial program 56.1%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites37.5%
Taylor expanded in F around inf
Applied rewrites50.7%
(FPCore (F B x)
:precision binary64
(if (<= F -3.3e-21)
(+
(- (* x (/ 1.0 B)))
(/ -1.0 (* B (+ 1.0 (* -0.16666666666666666 (* B B))))))
(if (<= F 40000000.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 <= -3.3e-21) {
tmp = -(x * (1.0 / B)) + (-1.0 / (B * (1.0 + (-0.16666666666666666 * (B * B)))));
} else if (F <= 40000000.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 <= -3.3e-21) tmp = Float64(Float64(-Float64(x * Float64(1.0 / B))) + Float64(-1.0 / Float64(B * Float64(1.0 + Float64(-0.16666666666666666 * Float64(B * B)))))); elseif (F <= 40000000.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, -3.3e-21], N[((-N[(x * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]) + N[(-1.0 / N[(B * N[(1.0 + N[(-0.16666666666666666 * N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 40000000.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 -3.3 \cdot 10^{-21}:\\
\;\;\;\;\left(-x \cdot \frac{1}{B}\right) + \frac{-1}{B \cdot \left(1 + -0.16666666666666666 \cdot \left(B \cdot B\right)\right)}\\
\mathbf{elif}\;F \leq 40000000:\\
\;\;\;\;\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 < -3.30000000000000009e-21Initial program 61.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6496.1
Applied rewrites96.1%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6470.9
Applied rewrites70.9%
Taylor expanded in B around 0
Applied rewrites47.7%
if -3.30000000000000009e-21 < F < 4e7Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites52.2%
lift-pow.f64N/A
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
unpow-1N/A
pow2N/A
associate-+r+N/A
pow2N/A
lower-/.f64N/A
lift-fma.f64N/A
lift-fma.f6452.2
Applied rewrites52.2%
if 4e7 < F Initial program 56.1%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites37.5%
Taylor expanded in F around inf
Applied rewrites50.7%
(FPCore (F B x)
:precision binary64
(if (<= F -3.3e-21)
(+
(- (* x (/ 1.0 B)))
(/ -1.0 (* B (+ 1.0 (* -0.16666666666666666 (* B B))))))
(if (<= F 5.0)
(/ (- (* F (/ 1.0 (sqrt (+ 2.0 (* 2.0 x))))) x) B)
(/ (- (fma (/ (fma 2.0 x 2.0) (* F F)) -0.5 1.0) x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.3e-21) {
tmp = -(x * (1.0 / B)) + (-1.0 / (B * (1.0 + (-0.16666666666666666 * (B * B)))));
} else if (F <= 5.0) {
tmp = ((F * (1.0 / sqrt((2.0 + (2.0 * x))))) - x) / B;
} else {
tmp = (fma((fma(2.0, x, 2.0) / (F * F)), -0.5, 1.0) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -3.3e-21) tmp = Float64(Float64(-Float64(x * Float64(1.0 / B))) + Float64(-1.0 / Float64(B * Float64(1.0 + Float64(-0.16666666666666666 * Float64(B * B)))))); elseif (F <= 5.0) tmp = Float64(Float64(Float64(F * Float64(1.0 / sqrt(Float64(2.0 + Float64(2.0 * x))))) - x) / B); else tmp = Float64(Float64(fma(Float64(fma(2.0, x, 2.0) / Float64(F * F)), -0.5, 1.0) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -3.3e-21], N[((-N[(x * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]) + N[(-1.0 / N[(B * N[(1.0 + N[(-0.16666666666666666 * N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 5.0], N[(N[(N[(F * N[(1.0 / N[Sqrt[N[(2.0 + N[(2.0 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(N[(N[(2.0 * x + 2.0), $MachinePrecision] / N[(F * F), $MachinePrecision]), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.3 \cdot 10^{-21}:\\
\;\;\;\;\left(-x \cdot \frac{1}{B}\right) + \frac{-1}{B \cdot \left(1 + -0.16666666666666666 \cdot \left(B \cdot B\right)\right)}\\
\mathbf{elif}\;F \leq 5:\\
\;\;\;\;\frac{F \cdot \frac{1}{\sqrt{2 + 2 \cdot x}} - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{\mathsf{fma}\left(2, x, 2\right)}{F \cdot F}, -0.5, 1\right) - x}{B}\\
\end{array}
\end{array}
if F < -3.30000000000000009e-21Initial program 61.2%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6496.1
Applied rewrites96.1%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6470.9
Applied rewrites70.9%
Taylor expanded in B around 0
Applied rewrites47.7%
if -3.30000000000000009e-21 < F < 5Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites52.2%
Taylor expanded in B around 0
associate-*r/N/A
metadata-evalN/A
metadata-evalN/A
Applied rewrites52.2%
Taylor expanded in F around 0
lower-*.f6452.1
Applied rewrites52.1%
if 5 < F Initial program 56.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites37.7%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6426.1
Applied rewrites26.1%
Taylor expanded in F around inf
lower--.f64N/A
Applied rewrites50.5%
(FPCore (F B x)
:precision binary64
(if (<= F -1450000000.0)
(/ (- -1.0 x) B)
(if (<= F 5.0)
(/ (- (* F (/ 1.0 (sqrt (+ 2.0 (* 2.0 x))))) x) B)
(/ (- (fma (/ (fma 2.0 x 2.0) (* F F)) -0.5 1.0) x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1450000000.0) {
tmp = (-1.0 - x) / B;
} else if (F <= 5.0) {
tmp = ((F * (1.0 / sqrt((2.0 + (2.0 * x))))) - x) / B;
} else {
tmp = (fma((fma(2.0, x, 2.0) / (F * F)), -0.5, 1.0) - x) / B;
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1450000000.0) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 5.0) tmp = Float64(Float64(Float64(F * Float64(1.0 / sqrt(Float64(2.0 + Float64(2.0 * x))))) - x) / B); else tmp = Float64(Float64(fma(Float64(fma(2.0, x, 2.0) / Float64(F * F)), -0.5, 1.0) - x) / B); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1450000000.0], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 5.0], N[(N[(N[(F * N[(1.0 / N[Sqrt[N[(2.0 + N[(2.0 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(N[(N[(2.0 * x + 2.0), $MachinePrecision] / N[(F * F), $MachinePrecision]), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1450000000:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 5:\\
\;\;\;\;\frac{F \cdot \frac{1}{\sqrt{2 + 2 \cdot x}} - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{\mathsf{fma}\left(2, x, 2\right)}{F \cdot F}, -0.5, 1\right) - x}{B}\\
\end{array}
\end{array}
if F < -1.45e9Initial program 58.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites36.0%
Taylor expanded in F around -inf
Applied rewrites49.1%
if -1.45e9 < F < 5Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites52.1%
Taylor expanded in B around 0
associate-*r/N/A
metadata-evalN/A
metadata-evalN/A
Applied rewrites52.0%
Taylor expanded in F around 0
lower-*.f6451.6
Applied rewrites51.6%
if 5 < F Initial program 56.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites37.7%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6426.1
Applied rewrites26.1%
Taylor expanded in F around inf
lower--.f64N/A
Applied rewrites50.5%
(FPCore (F B x)
:precision binary64
(if (<= F -8.2e-42)
(/ (- -1.0 x) B)
(if (<= F 7.5e-54)
(/ (- x) B)
(if (<= F 7.5e-37)
(* (sqrt 0.5) (/ F B))
(fma -0.5 (/ 2.0 (* (* F F) B)) (/ (- 1.0 x) B))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -8.2e-42) {
tmp = (-1.0 - x) / B;
} else if (F <= 7.5e-54) {
tmp = -x / B;
} else if (F <= 7.5e-37) {
tmp = sqrt(0.5) * (F / B);
} else {
tmp = fma(-0.5, (2.0 / ((F * F) * B)), ((1.0 - x) / B));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -8.2e-42) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 7.5e-54) tmp = Float64(Float64(-x) / B); elseif (F <= 7.5e-37) tmp = Float64(sqrt(0.5) * Float64(F / B)); else tmp = fma(-0.5, Float64(2.0 / Float64(Float64(F * F) * B)), Float64(Float64(1.0 - x) / B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -8.2e-42], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 7.5e-54], N[((-x) / B), $MachinePrecision], If[LessEqual[F, 7.5e-37], N[(N[Sqrt[0.5], $MachinePrecision] * N[(F / B), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(2.0 / N[(N[(F * F), $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -8.2 \cdot 10^{-42}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 7.5 \cdot 10^{-54}:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{elif}\;F \leq 7.5 \cdot 10^{-37}:\\
\;\;\;\;\sqrt{0.5} \cdot \frac{F}{B}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, \frac{2}{\left(F \cdot F\right) \cdot B}, \frac{1 - x}{B}\right)\\
\end{array}
\end{array}
if F < -8.2000000000000003e-42Initial program 63.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites37.7%
Taylor expanded in F around -inf
Applied rewrites46.0%
if -8.2000000000000003e-42 < F < 7.5000000000000005e-54Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites52.3%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6439.1
Applied rewrites39.1%
if 7.5000000000000005e-54 < F < 7.5000000000000004e-37Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites46.9%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6422.1
Applied rewrites22.1%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f64N/A
lower-/.f6427.4
Applied rewrites27.4%
Taylor expanded in F around 0
Applied rewrites27.4%
if 7.5000000000000004e-37 < F Initial program 60.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites39.2%
Taylor expanded in F around inf
associate--l+N/A
div-subN/A
lower-fma.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-/.f64N/A
lower--.f6440.1
Applied rewrites40.1%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6447.7
Applied rewrites47.7%
(FPCore (F B x)
:precision binary64
(if (<= F -8.2e-42)
(/ (- -1.0 x) B)
(if (<= F 7.5e-54)
(/ (- x) B)
(if (<= F 7.5e-37) (* (sqrt 0.5) (/ F B)) (/ (- 1.0 x) B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -8.2e-42) {
tmp = (-1.0 - x) / B;
} else if (F <= 7.5e-54) {
tmp = -x / B;
} else if (F <= 7.5e-37) {
tmp = sqrt(0.5) * (F / 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 <= (-8.2d-42)) then
tmp = ((-1.0d0) - x) / b
else if (f <= 7.5d-54) then
tmp = -x / b
else if (f <= 7.5d-37) then
tmp = sqrt(0.5d0) * (f / 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 <= -8.2e-42) {
tmp = (-1.0 - x) / B;
} else if (F <= 7.5e-54) {
tmp = -x / B;
} else if (F <= 7.5e-37) {
tmp = Math.sqrt(0.5) * (F / B);
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -8.2e-42: tmp = (-1.0 - x) / B elif F <= 7.5e-54: tmp = -x / B elif F <= 7.5e-37: tmp = math.sqrt(0.5) * (F / B) else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -8.2e-42) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 7.5e-54) tmp = Float64(Float64(-x) / B); elseif (F <= 7.5e-37) tmp = Float64(sqrt(0.5) * Float64(F / 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 <= -8.2e-42) tmp = (-1.0 - x) / B; elseif (F <= 7.5e-54) tmp = -x / B; elseif (F <= 7.5e-37) tmp = sqrt(0.5) * (F / B); else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -8.2e-42], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 7.5e-54], N[((-x) / B), $MachinePrecision], If[LessEqual[F, 7.5e-37], N[(N[Sqrt[0.5], $MachinePrecision] * N[(F / B), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -8.2 \cdot 10^{-42}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 7.5 \cdot 10^{-54}:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{elif}\;F \leq 7.5 \cdot 10^{-37}:\\
\;\;\;\;\sqrt{0.5} \cdot \frac{F}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -8.2000000000000003e-42Initial program 63.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites37.7%
Taylor expanded in F around -inf
Applied rewrites46.0%
if -8.2000000000000003e-42 < F < 7.5000000000000005e-54Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites52.3%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6439.1
Applied rewrites39.1%
if 7.5000000000000005e-54 < F < 7.5000000000000004e-37Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites46.9%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6422.1
Applied rewrites22.1%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f64N/A
lower-/.f6427.4
Applied rewrites27.4%
Taylor expanded in F around 0
Applied rewrites27.4%
if 7.5000000000000004e-37 < F Initial program 60.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites39.2%
Taylor expanded in F around inf
Applied rewrites48.1%
(FPCore (F B x)
:precision binary64
(if (<= F -8.2e-42)
(/ (- -1.0 x) B)
(if (<= F 7.5e-54)
(/ (- x) B)
(if (<= F 7.5e-37) (/ (* F (sqrt 0.5)) B) (/ (- 1.0 x) B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -8.2e-42) {
tmp = (-1.0 - x) / B;
} else if (F <= 7.5e-54) {
tmp = -x / B;
} else if (F <= 7.5e-37) {
tmp = (F * sqrt(0.5)) / 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 <= (-8.2d-42)) then
tmp = ((-1.0d0) - x) / b
else if (f <= 7.5d-54) then
tmp = -x / b
else if (f <= 7.5d-37) then
tmp = (f * sqrt(0.5d0)) / 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 <= -8.2e-42) {
tmp = (-1.0 - x) / B;
} else if (F <= 7.5e-54) {
tmp = -x / B;
} else if (F <= 7.5e-37) {
tmp = (F * Math.sqrt(0.5)) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -8.2e-42: tmp = (-1.0 - x) / B elif F <= 7.5e-54: tmp = -x / B elif F <= 7.5e-37: tmp = (F * math.sqrt(0.5)) / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -8.2e-42) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 7.5e-54) tmp = Float64(Float64(-x) / B); elseif (F <= 7.5e-37) tmp = Float64(Float64(F * sqrt(0.5)) / 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 <= -8.2e-42) tmp = (-1.0 - x) / B; elseif (F <= 7.5e-54) tmp = -x / B; elseif (F <= 7.5e-37) tmp = (F * sqrt(0.5)) / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -8.2e-42], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 7.5e-54], N[((-x) / B), $MachinePrecision], If[LessEqual[F, 7.5e-37], N[(N[(F * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -8.2 \cdot 10^{-42}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 7.5 \cdot 10^{-54}:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{elif}\;F \leq 7.5 \cdot 10^{-37}:\\
\;\;\;\;\frac{F \cdot \sqrt{0.5}}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -8.2000000000000003e-42Initial program 63.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites37.7%
Taylor expanded in F around -inf
Applied rewrites46.0%
if -8.2000000000000003e-42 < F < 7.5000000000000005e-54Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites52.3%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6439.1
Applied rewrites39.1%
if 7.5000000000000005e-54 < F < 7.5000000000000004e-37Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites46.9%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6422.1
Applied rewrites22.1%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-fma.f64N/A
lower-/.f6427.4
Applied rewrites27.4%
Taylor expanded in F around 0
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
sqrt-unprodN/A
lower-/.f64N/A
sqrt-unprodN/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lower-sqrt.f64N/A
metadata-eval27.3
Applied rewrites27.3%
if 7.5000000000000004e-37 < F Initial program 60.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites39.2%
Taylor expanded in F around inf
Applied rewrites48.1%
(FPCore (F B x) :precision binary64 (if (<= F -8.2e-42) (/ (- -1.0 x) B) (if (<= F 4.1e-55) (/ (- x) B) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -8.2e-42) {
tmp = (-1.0 - x) / B;
} else if (F <= 4.1e-55) {
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 <= (-8.2d-42)) then
tmp = ((-1.0d0) - x) / b
else if (f <= 4.1d-55) 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 <= -8.2e-42) {
tmp = (-1.0 - x) / B;
} else if (F <= 4.1e-55) {
tmp = -x / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -8.2e-42: tmp = (-1.0 - x) / B elif F <= 4.1e-55: tmp = -x / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -8.2e-42) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 4.1e-55) 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 <= -8.2e-42) tmp = (-1.0 - x) / B; elseif (F <= 4.1e-55) tmp = -x / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -8.2e-42], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 4.1e-55], N[((-x) / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -8.2 \cdot 10^{-42}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 4.1 \cdot 10^{-55}:\\
\;\;\;\;\frac{-x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -8.2000000000000003e-42Initial program 63.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites37.7%
Taylor expanded in F around -inf
Applied rewrites46.0%
if -8.2000000000000003e-42 < F < 4.0999999999999998e-55Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites52.3%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6439.1
Applied rewrites39.1%
if 4.0999999999999998e-55 < F Initial program 62.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites39.6%
Taylor expanded in F around inf
Applied rewrites46.6%
(FPCore (F B x) :precision binary64 (if (<= F -8.2e-42) (/ (- -1.0 x) B) (/ (- x) B)))
double code(double F, double B, double x) {
double tmp;
if (F <= -8.2e-42) {
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 <= (-8.2d-42)) 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 <= -8.2e-42) {
tmp = (-1.0 - x) / B;
} else {
tmp = -x / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -8.2e-42: tmp = (-1.0 - x) / B else: tmp = -x / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -8.2e-42) 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 <= -8.2e-42) tmp = (-1.0 - x) / B; else tmp = -x / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -8.2e-42], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], N[((-x) / B), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -8.2 \cdot 10^{-42}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{B}\\
\end{array}
\end{array}
if F < -8.2000000000000003e-42Initial program 63.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites37.7%
Taylor expanded in F around -inf
Applied rewrites46.0%
if -8.2000000000000003e-42 < F Initial program 82.9%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites46.6%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6433.1
Applied rewrites33.1%
(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 76.9%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites43.9%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6430.4
Applied rewrites30.4%
(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 76.9%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites43.9%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f6430.4
Applied rewrites30.4%
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
lower-/.f6414.5
Applied rewrites14.5%
Taylor expanded in F around -inf
lower-/.f6410.0
Applied rewrites10.0%
herbie shell --seed 2025097
(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))))))