
(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 25 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 (/ 1.0 (sin B))) (t_1 (/ (- x) (tan B))))
(if (<= F -2.5e+140)
(fma t_0 -1.0 t_1)
(if (<= F 7.5e+19)
(fma
F
(/ (pow (fma 2.0 x (fma F F 2.0)) -0.5) (sin B))
(/ (/ (- x) (sin B)) (/ 1.0 (cos B))))
(fma t_0 1.0 t_1)))))
double code(double F, double B, double x) {
double t_0 = 1.0 / sin(B);
double t_1 = -x / tan(B);
double tmp;
if (F <= -2.5e+140) {
tmp = fma(t_0, -1.0, t_1);
} else if (F <= 7.5e+19) {
tmp = fma(F, (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) / sin(B)), ((-x / sin(B)) / (1.0 / cos(B))));
} else {
tmp = fma(t_0, 1.0, t_1);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(1.0 / sin(B)) t_1 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (F <= -2.5e+140) tmp = fma(t_0, -1.0, t_1); elseif (F <= 7.5e+19) tmp = fma(F, Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) / sin(B)), Float64(Float64(Float64(-x) / sin(B)) / Float64(1.0 / cos(B)))); else tmp = fma(t_0, 1.0, t_1); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -2.5e+140], N[(t$95$0 * -1.0 + t$95$1), $MachinePrecision], If[LessEqual[F, 7.5e+19], N[(F * N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + N[(N[((-x) / N[Sin[B], $MachinePrecision]), $MachinePrecision] / N[(1.0 / N[Cos[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * 1.0 + t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\sin B}\\
t_1 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -2.5 \cdot 10^{+140}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, -1, t\_1\right)\\
\mathbf{elif}\;F \leq 7.5 \cdot 10^{+19}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B}, \frac{\frac{-x}{\sin B}}{\frac{1}{\cos B}}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, 1, t\_1\right)\\
\end{array}
\end{array}
if F < -2.50000000000000004e140Initial program 76.9%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.0%
Taylor expanded in F around -inf
Applied rewrites56.1%
if -2.50000000000000004e140 < F < 7.5e19Initial program 76.9%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites85.0%
lift-/.f64N/A
lift-neg.f64N/A
distribute-frac-negN/A
mult-flip-revN/A
lift-tan.f64N/A
lift-tan.f64N/A
associate-*r/N/A
distribute-neg-fracN/A
distribute-lft-neg-outN/A
lift-neg.f64N/A
*-rgt-identityN/A
lift-tan.f64N/A
tan-quotN/A
lift-sin.f64N/A
mult-flipN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-cos.f6485.0
Applied rewrites85.0%
if 7.5e19 < F Initial program 76.9%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.0%
Taylor expanded in F around inf
Applied rewrites56.3%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ 1.0 (sin B))) (t_1 (/ (- x) (tan B))))
(if (<= F -5e+148)
(fma t_0 -1.0 t_1)
(if (<= F 100000000.0)
(fma t_0 (* (pow (fma 2.0 x (fma F F 2.0)) -0.5) F) t_1)
(fma t_0 1.0 t_1)))))
double code(double F, double B, double x) {
double t_0 = 1.0 / sin(B);
double t_1 = -x / tan(B);
double tmp;
if (F <= -5e+148) {
tmp = fma(t_0, -1.0, t_1);
} else if (F <= 100000000.0) {
tmp = fma(t_0, (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) * F), t_1);
} else {
tmp = fma(t_0, 1.0, t_1);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(1.0 / sin(B)) t_1 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (F <= -5e+148) tmp = fma(t_0, -1.0, t_1); elseif (F <= 100000000.0) tmp = fma(t_0, Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) * F), t_1); else tmp = fma(t_0, 1.0, t_1); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -5e+148], N[(t$95$0 * -1.0 + t$95$1), $MachinePrecision], If[LessEqual[F, 100000000.0], N[(t$95$0 * N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] + t$95$1), $MachinePrecision], N[(t$95$0 * 1.0 + t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\sin B}\\
t_1 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -5 \cdot 10^{+148}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, -1, t\_1\right)\\
\mathbf{elif}\;F \leq 100000000:\\
\;\;\;\;\mathsf{fma}\left(t\_0, {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot F, t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, 1, t\_1\right)\\
\end{array}
\end{array}
if F < -5.00000000000000024e148Initial program 76.9%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.0%
Taylor expanded in F around -inf
Applied rewrites56.1%
if -5.00000000000000024e148 < F < 1e8Initial program 76.9%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.0%
if 1e8 < F Initial program 76.9%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.0%
Taylor expanded in F around inf
Applied rewrites56.3%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ 1.0 (sin B))) (t_1 (/ (- x) (tan B))))
(if (<= F -27000000.0)
(fma t_0 -1.0 t_1)
(if (<= F 160000000.0)
(- (* (pow (fma 2.0 x (fma F F 2.0)) -0.5) (/ F (sin B))) (/ x (tan B)))
(fma t_0 1.0 t_1)))))
double code(double F, double B, double x) {
double t_0 = 1.0 / sin(B);
double t_1 = -x / tan(B);
double tmp;
if (F <= -27000000.0) {
tmp = fma(t_0, -1.0, t_1);
} else if (F <= 160000000.0) {
tmp = (pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) * (F / sin(B))) - (x / tan(B));
} else {
tmp = fma(t_0, 1.0, t_1);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(1.0 / sin(B)) t_1 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (F <= -27000000.0) tmp = fma(t_0, -1.0, t_1); elseif (F <= 160000000.0) tmp = Float64(Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) * Float64(F / sin(B))) - Float64(x / tan(B))); else tmp = fma(t_0, 1.0, t_1); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -27000000.0], N[(t$95$0 * -1.0 + t$95$1), $MachinePrecision], If[LessEqual[F, 160000000.0], N[(N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * 1.0 + t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\sin B}\\
t_1 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -27000000:\\
\;\;\;\;\mathsf{fma}\left(t\_0, -1, t\_1\right)\\
\mathbf{elif}\;F \leq 160000000:\\
\;\;\;\;{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot \frac{F}{\sin B} - \frac{x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, 1, t\_1\right)\\
\end{array}
\end{array}
if F < -2.7e7Initial program 76.9%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.0%
Taylor expanded in F around -inf
Applied rewrites56.1%
if -2.7e7 < F < 1.6e8Initial program 76.9%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.9
Applied rewrites77.0%
if 1.6e8 < F Initial program 76.9%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.0%
Taylor expanded in F around inf
Applied rewrites56.3%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ 1.0 (sin B))) (t_1 (/ (- x) (tan B))))
(if (<= F -8200.0)
(fma t_0 -1.0 t_1)
(if (<= F 2.45e-14)
(/ (- (/ (* F (pow (+ 2.0 (* 2.0 x)) -0.5)) (cos B)) x) (tan B))
(fma t_0 1.0 t_1)))))
double code(double F, double B, double x) {
double t_0 = 1.0 / sin(B);
double t_1 = -x / tan(B);
double tmp;
if (F <= -8200.0) {
tmp = fma(t_0, -1.0, t_1);
} else if (F <= 2.45e-14) {
tmp = (((F * pow((2.0 + (2.0 * x)), -0.5)) / cos(B)) - x) / tan(B);
} else {
tmp = fma(t_0, 1.0, t_1);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(1.0 / sin(B)) t_1 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (F <= -8200.0) tmp = fma(t_0, -1.0, t_1); elseif (F <= 2.45e-14) tmp = Float64(Float64(Float64(Float64(F * (Float64(2.0 + Float64(2.0 * x)) ^ -0.5)) / cos(B)) - x) / tan(B)); else tmp = fma(t_0, 1.0, t_1); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -8200.0], N[(t$95$0 * -1.0 + t$95$1), $MachinePrecision], If[LessEqual[F, 2.45e-14], N[(N[(N[(N[(F * N[Power[N[(2.0 + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] / N[Cos[B], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / N[Tan[B], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * 1.0 + t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\sin B}\\
t_1 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -8200:\\
\;\;\;\;\mathsf{fma}\left(t\_0, -1, t\_1\right)\\
\mathbf{elif}\;F \leq 2.45 \cdot 10^{-14}:\\
\;\;\;\;\frac{\frac{F \cdot {\left(2 + 2 \cdot x\right)}^{-0.5}}{\cos B} - x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, 1, t\_1\right)\\
\end{array}
\end{array}
if F < -8200Initial program 76.9%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.0%
Taylor expanded in F around -inf
Applied rewrites56.1%
if -8200 < F < 2.44999999999999997e-14Initial program 76.9%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flip-revN/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites77.0%
Taylor expanded in F around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-*.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-cos.f6456.3
Applied rewrites56.3%
if 2.44999999999999997e-14 < F Initial program 76.9%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.0%
Taylor expanded in F around inf
Applied rewrites56.3%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ 1.0 (sin B))) (t_1 (/ (- x) (tan B))))
(if (<= F -8200.0)
(fma t_0 -1.0 t_1)
(if (<= F 2.45e-14)
(- (* (pow (fma x 2.0 2.0) -0.5) (/ F (sin B))) (/ x (tan B)))
(fma t_0 1.0 t_1)))))
double code(double F, double B, double x) {
double t_0 = 1.0 / sin(B);
double t_1 = -x / tan(B);
double tmp;
if (F <= -8200.0) {
tmp = fma(t_0, -1.0, t_1);
} else if (F <= 2.45e-14) {
tmp = (pow(fma(x, 2.0, 2.0), -0.5) * (F / sin(B))) - (x / tan(B));
} else {
tmp = fma(t_0, 1.0, t_1);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(1.0 / sin(B)) t_1 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (F <= -8200.0) tmp = fma(t_0, -1.0, t_1); elseif (F <= 2.45e-14) tmp = Float64(Float64((fma(x, 2.0, 2.0) ^ -0.5) * Float64(F / sin(B))) - Float64(x / tan(B))); else tmp = fma(t_0, 1.0, t_1); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -8200.0], N[(t$95$0 * -1.0 + t$95$1), $MachinePrecision], If[LessEqual[F, 2.45e-14], N[(N[(N[Power[N[(x * 2.0 + 2.0), $MachinePrecision], -0.5], $MachinePrecision] * N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * 1.0 + t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\sin B}\\
t_1 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -8200:\\
\;\;\;\;\mathsf{fma}\left(t\_0, -1, t\_1\right)\\
\mathbf{elif}\;F \leq 2.45 \cdot 10^{-14}:\\
\;\;\;\;{\left(\mathsf{fma}\left(x, 2, 2\right)\right)}^{-0.5} \cdot \frac{F}{\sin B} - \frac{x}{\tan B}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, 1, t\_1\right)\\
\end{array}
\end{array}
if F < -8200Initial program 76.9%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.0%
Taylor expanded in F around -inf
Applied rewrites56.1%
if -8200 < F < 2.44999999999999997e-14Initial program 76.9%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites85.0%
Taylor expanded in F around 0
Applied rewrites56.6%
lift-fma.f64N/A
add-flipN/A
lower--.f64N/A
Applied rewrites55.2%
if 2.44999999999999997e-14 < F Initial program 76.9%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.0%
Taylor expanded in F around inf
Applied rewrites56.3%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ 1.0 (sin B))) (t_1 (/ (- x) (tan B))))
(if (<= F -20000.0)
(fma t_0 -1.0 t_1)
(if (<= F 7.9e-25)
(+
(- (* x (/ 1.0 (tan B))))
(* (/ F B) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0)))))
(fma t_0 1.0 t_1)))))
double code(double F, double B, double x) {
double t_0 = 1.0 / sin(B);
double t_1 = -x / tan(B);
double tmp;
if (F <= -20000.0) {
tmp = fma(t_0, -1.0, t_1);
} else if (F <= 7.9e-25) {
tmp = -(x * (1.0 / tan(B))) + ((F / B) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
} else {
tmp = fma(t_0, 1.0, t_1);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(1.0 / sin(B)) t_1 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (F <= -20000.0) tmp = fma(t_0, -1.0, t_1); elseif (F <= 7.9e-25) tmp = Float64(Float64(-Float64(x * Float64(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))))); else tmp = fma(t_0, 1.0, t_1); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -20000.0], N[(t$95$0 * -1.0 + t$95$1), $MachinePrecision], If[LessEqual[F, 7.9e-25], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $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], N[(t$95$0 * 1.0 + t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\sin B}\\
t_1 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -20000:\\
\;\;\;\;\mathsf{fma}\left(t\_0, -1, t\_1\right)\\
\mathbf{elif}\;F \leq 7.9 \cdot 10^{-25}:\\
\;\;\;\;\left(-x \cdot \frac{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{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, 1, t\_1\right)\\
\end{array}
\end{array}
if F < -2e4Initial program 76.9%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.0%
Taylor expanded in F around -inf
Applied rewrites56.1%
if -2e4 < F < 7.8999999999999997e-25Initial program 76.9%
Taylor expanded in B around 0
lower-/.f6462.9
Applied rewrites62.9%
if 7.8999999999999997e-25 < F Initial program 76.9%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.0%
Taylor expanded in F around inf
Applied rewrites56.3%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (- (/ x B))) (t_1 (/ 1.0 (sin B))) (t_2 (/ (- x) (tan B))))
(if (<= F -3.4e-40)
(fma t_1 -1.0 t_2)
(if (<= F -3.8e-175)
(+ t_0 (/ (* F (pow (+ 2.0 (* 2.0 x)) -0.5)) (sin B)))
(if (<= F 4.2e-117)
t_2
(if (<= F 8200000.0)
(fma F (/ (pow (fma x 2.0 (fma F F 2.0)) -0.5) (sin B)) t_0)
(fma t_1 1.0 t_2)))))))
double code(double F, double B, double x) {
double t_0 = -(x / B);
double t_1 = 1.0 / sin(B);
double t_2 = -x / tan(B);
double tmp;
if (F <= -3.4e-40) {
tmp = fma(t_1, -1.0, t_2);
} else if (F <= -3.8e-175) {
tmp = t_0 + ((F * pow((2.0 + (2.0 * x)), -0.5)) / sin(B));
} else if (F <= 4.2e-117) {
tmp = t_2;
} else if (F <= 8200000.0) {
tmp = fma(F, (pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5) / sin(B)), t_0);
} else {
tmp = fma(t_1, 1.0, t_2);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(-Float64(x / B)) t_1 = Float64(1.0 / sin(B)) t_2 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (F <= -3.4e-40) tmp = fma(t_1, -1.0, t_2); elseif (F <= -3.8e-175) tmp = Float64(t_0 + Float64(Float64(F * (Float64(2.0 + Float64(2.0 * x)) ^ -0.5)) / sin(B))); elseif (F <= 4.2e-117) tmp = t_2; elseif (F <= 8200000.0) tmp = fma(F, Float64((fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5) / sin(B)), t_0); else tmp = fma(t_1, 1.0, t_2); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = (-N[(x / B), $MachinePrecision])}, Block[{t$95$1 = N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -3.4e-40], N[(t$95$1 * -1.0 + t$95$2), $MachinePrecision], If[LessEqual[F, -3.8e-175], N[(t$95$0 + N[(N[(F * N[Power[N[(2.0 + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 4.2e-117], t$95$2, If[LessEqual[F, 8200000.0], N[(F * N[(N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], N[(t$95$1 * 1.0 + t$95$2), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -\frac{x}{B}\\
t_1 := \frac{1}{\sin B}\\
t_2 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -3.4 \cdot 10^{-40}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, -1, t\_2\right)\\
\mathbf{elif}\;F \leq -3.8 \cdot 10^{-175}:\\
\;\;\;\;t\_0 + \frac{F \cdot {\left(2 + 2 \cdot x\right)}^{-0.5}}{\sin B}\\
\mathbf{elif}\;F \leq 4.2 \cdot 10^{-117}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;F \leq 8200000:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B}, t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, 1, t\_2\right)\\
\end{array}
\end{array}
if F < -3.39999999999999984e-40Initial program 76.9%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.0%
Taylor expanded in F around -inf
Applied rewrites56.1%
if -3.39999999999999984e-40 < F < -3.8e-175Initial program 76.9%
Taylor expanded in B around 0
lower-/.f6449.1
Applied rewrites49.1%
Taylor expanded in F around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-*.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-sin.f6436.1
Applied rewrites36.1%
if -3.8e-175 < F < 4.1999999999999998e-117Initial program 76.9%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flip-revN/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites77.0%
Taylor expanded in F around 0
lower-*.f6456.7
Applied rewrites56.7%
lift-*.f64N/A
mul-1-negN/A
lift-neg.f6456.7
Applied rewrites56.7%
if 4.1999999999999998e-117 < F < 8.2e6Initial program 76.9%
Taylor expanded in B around 0
lower-/.f6449.1
Applied rewrites49.1%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
Applied rewrites57.1%
if 8.2e6 < F Initial program 76.9%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.0%
Taylor expanded in F around inf
Applied rewrites56.3%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ 1.0 (sin B))) (t_1 (/ (- x) (tan B))))
(if (<= x -6.7e-43)
(fma t_0 -1.0 t_1)
(if (<= x 3.2e-10)
(fma t_0 (* (pow (fma x 2.0 (fma F F 2.0)) -0.5) F) (- (/ x B)))
t_1))))
double code(double F, double B, double x) {
double t_0 = 1.0 / sin(B);
double t_1 = -x / tan(B);
double tmp;
if (x <= -6.7e-43) {
tmp = fma(t_0, -1.0, t_1);
} else if (x <= 3.2e-10) {
tmp = fma(t_0, (pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5) * F), -(x / B));
} else {
tmp = t_1;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(1.0 / sin(B)) t_1 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (x <= -6.7e-43) tmp = fma(t_0, -1.0, t_1); elseif (x <= 3.2e-10) tmp = fma(t_0, Float64((fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5) * F), Float64(-Float64(x / B))); else tmp = t_1; end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6.7e-43], N[(t$95$0 * -1.0 + t$95$1), $MachinePrecision], If[LessEqual[x, 3.2e-10], N[(t$95$0 * N[(N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] + (-N[(x / B), $MachinePrecision])), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\sin B}\\
t_1 := \frac{-x}{\tan B}\\
\mathbf{if}\;x \leq -6.7 \cdot 10^{-43}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, -1, t\_1\right)\\
\mathbf{elif}\;x \leq 3.2 \cdot 10^{-10}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, {\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot F, -\frac{x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -6.6999999999999998e-43Initial program 76.9%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites85.0%
Taylor expanded in F around -inf
Applied rewrites56.1%
if -6.6999999999999998e-43 < x < 3.19999999999999981e-10Initial program 76.9%
Taylor expanded in B around 0
lower-/.f6449.1
Applied rewrites49.1%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
Applied rewrites57.1%
if 3.19999999999999981e-10 < x Initial program 76.9%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flip-revN/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites77.0%
Taylor expanded in F around 0
lower-*.f6456.7
Applied rewrites56.7%
lift-*.f64N/A
mul-1-negN/A
lift-neg.f6456.7
Applied rewrites56.7%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= x -1.5e-52)
t_0
(if (<= x 3.2e-10)
(fma
(/ 1.0 (sin B))
(* (pow (fma x 2.0 (fma F F 2.0)) -0.5) F)
(- (/ x B)))
t_0))))
double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (x <= -1.5e-52) {
tmp = t_0;
} else if (x <= 3.2e-10) {
tmp = fma((1.0 / sin(B)), (pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5) * F), -(x / B));
} else {
tmp = t_0;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (x <= -1.5e-52) tmp = t_0; elseif (x <= 3.2e-10) tmp = fma(Float64(1.0 / sin(B)), Float64((fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5) * F), Float64(-Float64(x / B))); else tmp = t_0; end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.5e-52], t$95$0, If[LessEqual[x, 3.2e-10], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] + (-N[(x / B), $MachinePrecision])), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\tan B}\\
\mathbf{if}\;x \leq -1.5 \cdot 10^{-52}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 3.2 \cdot 10^{-10}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{\sin B}, {\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot F, -\frac{x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.5e-52 or 3.19999999999999981e-10 < x Initial program 76.9%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flip-revN/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites77.0%
Taylor expanded in F around 0
lower-*.f6456.7
Applied rewrites56.7%
lift-*.f64N/A
mul-1-negN/A
lift-neg.f6456.7
Applied rewrites56.7%
if -1.5e-52 < x < 3.19999999999999981e-10Initial program 76.9%
Taylor expanded in B around 0
lower-/.f6449.1
Applied rewrites49.1%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
Applied rewrites57.1%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= x -1.5e-52)
t_0
(if (<= x 3.2e-10)
(fma F (/ (pow (fma x 2.0 (fma F F 2.0)) -0.5) (sin B)) (- (/ x B)))
t_0))))
double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (x <= -1.5e-52) {
tmp = t_0;
} else if (x <= 3.2e-10) {
tmp = fma(F, (pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5) / sin(B)), -(x / B));
} else {
tmp = t_0;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (x <= -1.5e-52) tmp = t_0; elseif (x <= 3.2e-10) tmp = fma(F, Float64((fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5) / sin(B)), Float64(-Float64(x / B))); else tmp = t_0; end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.5e-52], t$95$0, If[LessEqual[x, 3.2e-10], N[(F * N[(N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + (-N[(x / B), $MachinePrecision])), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\tan B}\\
\mathbf{if}\;x \leq -1.5 \cdot 10^{-52}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 3.2 \cdot 10^{-10}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{\sin B}, -\frac{x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.5e-52 or 3.19999999999999981e-10 < x Initial program 76.9%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flip-revN/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites77.0%
Taylor expanded in F around 0
lower-*.f6456.7
Applied rewrites56.7%
lift-*.f64N/A
mul-1-negN/A
lift-neg.f6456.7
Applied rewrites56.7%
if -1.5e-52 < x < 3.19999999999999981e-10Initial program 76.9%
Taylor expanded in B around 0
lower-/.f6449.1
Applied rewrites49.1%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
Applied rewrites57.1%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ (- x) (tan B))))
(if (<= x -9.5e-53)
t_0
(if (<= x 1.4e-16)
(- (* (/ F (sin B)) (pow (fma x 2.0 (fma F F 2.0)) -0.5)) (/ x B))
t_0))))
double code(double F, double B, double x) {
double t_0 = -x / tan(B);
double tmp;
if (x <= -9.5e-53) {
tmp = t_0;
} else if (x <= 1.4e-16) {
tmp = ((F / sin(B)) * pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5)) - (x / B);
} else {
tmp = t_0;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (x <= -9.5e-53) tmp = t_0; elseif (x <= 1.4e-16) tmp = Float64(Float64(Float64(F / sin(B)) * (fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5)) - Float64(x / B)); else tmp = t_0; end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -9.5e-53], t$95$0, If[LessEqual[x, 1.4e-16], N[(N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x}{\tan B}\\
\mathbf{if}\;x \leq -9.5 \cdot 10^{-53}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{-16}:\\
\;\;\;\;\frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} - \frac{x}{B}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -9.5000000000000008e-53 or 1.4000000000000001e-16 < x Initial program 76.9%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flip-revN/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites77.0%
Taylor expanded in F around 0
lower-*.f6456.7
Applied rewrites56.7%
lift-*.f64N/A
mul-1-negN/A
lift-neg.f6456.7
Applied rewrites56.7%
if -9.5000000000000008e-53 < x < 1.4000000000000001e-16Initial program 76.9%
Taylor expanded in B around 0
lower-/.f6449.1
Applied rewrites49.1%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6449.1
Applied rewrites49.1%
(FPCore (F B x) :precision binary64 (if (<= B 2.6e-7) (/ (- (* F (pow (+ 2.0 (fma 2.0 x (pow F 2.0))) -0.5)) x) B) (/ (- x) (tan B))))
double code(double F, double B, double x) {
double tmp;
if (B <= 2.6e-7) {
tmp = ((F * pow((2.0 + fma(2.0, x, pow(F, 2.0))), -0.5)) - x) / B;
} else {
tmp = -x / tan(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (B <= 2.6e-7) tmp = Float64(Float64(Float64(F * (Float64(2.0 + fma(2.0, x, (F ^ 2.0))) ^ -0.5)) - x) / B); else tmp = Float64(Float64(-x) / tan(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[B, 2.6e-7], N[(N[(N[(F * N[Power[N[(2.0 + N[(2.0 * x + N[Power[F, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 2.6 \cdot 10^{-7}:\\
\;\;\;\;\frac{F \cdot {\left(2 + \mathsf{fma}\left(2, x, {F}^{2}\right)\right)}^{-0.5} - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{\tan B}\\
\end{array}
\end{array}
if B < 2.59999999999999999e-7Initial program 76.9%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites43.7%
if 2.59999999999999999e-7 < B Initial program 76.9%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flip-revN/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites77.0%
Taylor expanded in F around 0
lower-*.f6456.7
Applied rewrites56.7%
lift-*.f64N/A
mul-1-negN/A
lift-neg.f6456.7
Applied rewrites56.7%
(FPCore (F B x) :precision binary64 (if (<= B 2.6e-7) (fma (/ 1.0 B) (* (pow (fma x 2.0 (fma F F 2.0)) -0.5) F) (- (/ x B))) (/ (- x) (tan B))))
double code(double F, double B, double x) {
double tmp;
if (B <= 2.6e-7) {
tmp = fma((1.0 / B), (pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5) * F), -(x / B));
} else {
tmp = -x / tan(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (B <= 2.6e-7) tmp = fma(Float64(1.0 / B), Float64((fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5) * F), Float64(-Float64(x / B))); else tmp = Float64(Float64(-x) / tan(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[B, 2.6e-7], N[(N[(1.0 / B), $MachinePrecision] * N[(N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] + (-N[(x / B), $MachinePrecision])), $MachinePrecision], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 2.6 \cdot 10^{-7}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{B}, {\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot F, -\frac{x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{\tan B}\\
\end{array}
\end{array}
if B < 2.59999999999999999e-7Initial program 76.9%
Taylor expanded in B around 0
lower-/.f6449.1
Applied rewrites49.1%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
Applied rewrites57.1%
Taylor expanded in B around 0
lower-/.f6443.7
Applied rewrites43.7%
if 2.59999999999999999e-7 < B Initial program 76.9%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flip-revN/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites77.0%
Taylor expanded in F around 0
lower-*.f6456.7
Applied rewrites56.7%
lift-*.f64N/A
mul-1-negN/A
lift-neg.f6456.7
Applied rewrites56.7%
(FPCore (F B x) :precision binary64 (if (<= B 2.6e-7) (fma F (/ (pow (fma x 2.0 (fma F F 2.0)) -0.5) B) (- (/ x B))) (/ (- x) (tan B))))
double code(double F, double B, double x) {
double tmp;
if (B <= 2.6e-7) {
tmp = fma(F, (pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5) / B), -(x / B));
} else {
tmp = -x / tan(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (B <= 2.6e-7) tmp = fma(F, Float64((fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5) / B), Float64(-Float64(x / B))); else tmp = Float64(Float64(-x) / tan(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[B, 2.6e-7], N[(F * N[(N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] / B), $MachinePrecision] + (-N[(x / B), $MachinePrecision])), $MachinePrecision], N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 2.6 \cdot 10^{-7}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{B}, -\frac{x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{\tan B}\\
\end{array}
\end{array}
if B < 2.59999999999999999e-7Initial program 76.9%
Taylor expanded in B around 0
lower-/.f6449.1
Applied rewrites49.1%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
Applied rewrites57.1%
Taylor expanded in B around 0
Applied rewrites43.7%
if 2.59999999999999999e-7 < B Initial program 76.9%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flip-revN/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites77.0%
Taylor expanded in F around 0
lower-*.f6456.7
Applied rewrites56.7%
lift-*.f64N/A
mul-1-negN/A
lift-neg.f6456.7
Applied rewrites56.7%
(FPCore (F B x) :precision binary64 (if (<= B 2.6e-7) (fma F (/ (pow (fma x 2.0 (fma F F 2.0)) -0.5) B) (- (/ x B))) (/ -1.0 (sin B))))
double code(double F, double B, double x) {
double tmp;
if (B <= 2.6e-7) {
tmp = fma(F, (pow(fma(x, 2.0, fma(F, F, 2.0)), -0.5) / B), -(x / B));
} else {
tmp = -1.0 / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (B <= 2.6e-7) tmp = fma(F, Float64((fma(x, 2.0, fma(F, F, 2.0)) ^ -0.5) / B), Float64(-Float64(x / B))); else tmp = Float64(-1.0 / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[B, 2.6e-7], N[(F * N[(N[Power[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] / B), $MachinePrecision] + (-N[(x / B), $MachinePrecision])), $MachinePrecision], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 2.6 \cdot 10^{-7}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{{\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}}{B}, -\frac{x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\end{array}
\end{array}
if B < 2.59999999999999999e-7Initial program 76.9%
Taylor expanded in B around 0
lower-/.f6449.1
Applied rewrites49.1%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
Applied rewrites57.1%
Taylor expanded in B around 0
Applied rewrites43.7%
if 2.59999999999999999e-7 < B Initial program 76.9%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.1
Applied rewrites17.1%
(FPCore (F B x)
:precision binary64
(if (<= F -32000.0)
(/ -1.0 (sin B))
(if (<= F 130.0)
(/ (* -1.0 x) (* B (+ 1.0 (* 0.3333333333333333 (pow B 2.0)))))
(/ 1.0 (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -32000.0) {
tmp = -1.0 / sin(B);
} else if (F <= 130.0) {
tmp = (-1.0 * x) / (B * (1.0 + (0.3333333333333333 * pow(B, 2.0))));
} else {
tmp = 1.0 / sin(B);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-32000.0d0)) then
tmp = (-1.0d0) / sin(b)
else if (f <= 130.0d0) then
tmp = ((-1.0d0) * x) / (b * (1.0d0 + (0.3333333333333333d0 * (b ** 2.0d0))))
else
tmp = 1.0d0 / sin(b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -32000.0) {
tmp = -1.0 / Math.sin(B);
} else if (F <= 130.0) {
tmp = (-1.0 * x) / (B * (1.0 + (0.3333333333333333 * Math.pow(B, 2.0))));
} else {
tmp = 1.0 / Math.sin(B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -32000.0: tmp = -1.0 / math.sin(B) elif F <= 130.0: tmp = (-1.0 * x) / (B * (1.0 + (0.3333333333333333 * math.pow(B, 2.0)))) else: tmp = 1.0 / math.sin(B) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -32000.0) tmp = Float64(-1.0 / sin(B)); elseif (F <= 130.0) tmp = Float64(Float64(-1.0 * x) / Float64(B * Float64(1.0 + Float64(0.3333333333333333 * (B ^ 2.0))))); else tmp = Float64(1.0 / sin(B)); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -32000.0) tmp = -1.0 / sin(B); elseif (F <= 130.0) tmp = (-1.0 * x) / (B * (1.0 + (0.3333333333333333 * (B ^ 2.0)))); else tmp = 1.0 / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -32000.0], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 130.0], N[(N[(-1.0 * x), $MachinePrecision] / N[(B * N[(1.0 + N[(0.3333333333333333 * N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -32000:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 130:\\
\;\;\;\;\frac{-1 \cdot x}{B \cdot \left(1 + 0.3333333333333333 \cdot {B}^{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -32000Initial program 76.9%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.1
Applied rewrites17.1%
if -32000 < F < 130Initial program 76.9%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flip-revN/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites77.0%
Taylor expanded in F around 0
lower-*.f6456.7
Applied rewrites56.7%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6429.3
Applied rewrites29.3%
if 130 < F Initial program 76.9%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6416.6
Applied rewrites16.6%
(FPCore (F B x) :precision binary64 (if (<= B 78.0) (/ (* -1.0 x) (* B (+ 1.0 (* 0.3333333333333333 (pow B 2.0))))) (/ -1.0 (sin B))))
double code(double F, double B, double x) {
double tmp;
if (B <= 78.0) {
tmp = (-1.0 * x) / (B * (1.0 + (0.3333333333333333 * pow(B, 2.0))));
} else {
tmp = -1.0 / sin(B);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (b <= 78.0d0) then
tmp = ((-1.0d0) * x) / (b * (1.0d0 + (0.3333333333333333d0 * (b ** 2.0d0))))
else
tmp = (-1.0d0) / sin(b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (B <= 78.0) {
tmp = (-1.0 * x) / (B * (1.0 + (0.3333333333333333 * Math.pow(B, 2.0))));
} else {
tmp = -1.0 / Math.sin(B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if B <= 78.0: tmp = (-1.0 * x) / (B * (1.0 + (0.3333333333333333 * math.pow(B, 2.0)))) else: tmp = -1.0 / math.sin(B) return tmp
function code(F, B, x) tmp = 0.0 if (B <= 78.0) tmp = Float64(Float64(-1.0 * x) / Float64(B * Float64(1.0 + Float64(0.3333333333333333 * (B ^ 2.0))))); else tmp = Float64(-1.0 / sin(B)); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (B <= 78.0) tmp = (-1.0 * x) / (B * (1.0 + (0.3333333333333333 * (B ^ 2.0)))); else tmp = -1.0 / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[B, 78.0], N[(N[(-1.0 * x), $MachinePrecision] / N[(B * N[(1.0 + N[(0.3333333333333333 * N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 78:\\
\;\;\;\;\frac{-1 \cdot x}{B \cdot \left(1 + 0.3333333333333333 \cdot {B}^{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\end{array}
\end{array}
if B < 78Initial program 76.9%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flip-revN/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites77.0%
Taylor expanded in F around 0
lower-*.f6456.7
Applied rewrites56.7%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6429.3
Applied rewrites29.3%
if 78 < B Initial program 76.9%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.1
Applied rewrites17.1%
(FPCore (F B x) :precision binary64 (/ (* -1.0 x) (* B (+ 1.0 (* 0.3333333333333333 (pow B 2.0))))))
double code(double F, double B, double x) {
return (-1.0 * x) / (B * (1.0 + (0.3333333333333333 * pow(B, 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 = ((-1.0d0) * x) / (b * (1.0d0 + (0.3333333333333333d0 * (b ** 2.0d0))))
end function
public static double code(double F, double B, double x) {
return (-1.0 * x) / (B * (1.0 + (0.3333333333333333 * Math.pow(B, 2.0))));
}
def code(F, B, x): return (-1.0 * x) / (B * (1.0 + (0.3333333333333333 * math.pow(B, 2.0))))
function code(F, B, x) return Float64(Float64(-1.0 * x) / Float64(B * Float64(1.0 + Float64(0.3333333333333333 * (B ^ 2.0))))) end
function tmp = code(F, B, x) tmp = (-1.0 * x) / (B * (1.0 + (0.3333333333333333 * (B ^ 2.0)))); end
code[F_, B_, x_] := N[(N[(-1.0 * x), $MachinePrecision] / N[(B * N[(1.0 + N[(0.3333333333333333 * N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{-1 \cdot x}{B \cdot \left(1 + 0.3333333333333333 \cdot {B}^{2}\right)}
\end{array}
Initial program 76.9%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flip-revN/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites77.0%
Taylor expanded in F around 0
lower-*.f6456.7
Applied rewrites56.7%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6429.3
Applied rewrites29.3%
(FPCore (F B x) :precision binary64 (* (/ (+ 1.0 (* -0.3333333333333333 (pow B 2.0))) B) (- x)))
double code(double F, double B, double x) {
return ((1.0 + (-0.3333333333333333 * pow(B, 2.0))) / B) * -x;
}
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 + ((-0.3333333333333333d0) * (b ** 2.0d0))) / b) * -x
end function
public static double code(double F, double B, double x) {
return ((1.0 + (-0.3333333333333333 * Math.pow(B, 2.0))) / B) * -x;
}
def code(F, B, x): return ((1.0 + (-0.3333333333333333 * math.pow(B, 2.0))) / B) * -x
function code(F, B, x) return Float64(Float64(Float64(1.0 + Float64(-0.3333333333333333 * (B ^ 2.0))) / B) * Float64(-x)) end
function tmp = code(F, B, x) tmp = ((1.0 + (-0.3333333333333333 * (B ^ 2.0))) / B) * -x; end
code[F_, B_, x_] := N[(N[(N[(1.0 + N[(-0.3333333333333333 * N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision] * (-x)), $MachinePrecision]
\begin{array}{l}
\\
\frac{1 + -0.3333333333333333 \cdot {B}^{2}}{B} \cdot \left(-x\right)
\end{array}
Initial program 76.9%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flip-revN/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites77.0%
Taylor expanded in F around 0
lower-*.f6456.7
Applied rewrites56.7%
lift-/.f64N/A
mult-flipN/A
lift-tan.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-tan.f64N/A
lower-/.f6456.6
lift-*.f64N/A
mul-1-negN/A
lift-neg.f6456.6
Applied rewrites56.6%
Taylor expanded in B around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6429.2
Applied rewrites29.2%
(FPCore (F B x) :precision binary64 (if (<= x 6e+59) (/ -1.0 (* B (+ 1.0 (* -0.16666666666666666 (pow B 2.0))))) (* (- (* (* (* B B) -0.16666666666666666) B) (* B 1.0)) (/ 1.0 (* B B)))))
double code(double F, double B, double x) {
double tmp;
if (x <= 6e+59) {
tmp = -1.0 / (B * (1.0 + (-0.16666666666666666 * pow(B, 2.0))));
} else {
tmp = ((((B * B) * -0.16666666666666666) * B) - (B * 1.0)) * (1.0 / (B * 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 <= 6d+59) then
tmp = (-1.0d0) / (b * (1.0d0 + ((-0.16666666666666666d0) * (b ** 2.0d0))))
else
tmp = ((((b * b) * (-0.16666666666666666d0)) * b) - (b * 1.0d0)) * (1.0d0 / (b * b))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (x <= 6e+59) {
tmp = -1.0 / (B * (1.0 + (-0.16666666666666666 * Math.pow(B, 2.0))));
} else {
tmp = ((((B * B) * -0.16666666666666666) * B) - (B * 1.0)) * (1.0 / (B * B));
}
return tmp;
}
def code(F, B, x): tmp = 0 if x <= 6e+59: tmp = -1.0 / (B * (1.0 + (-0.16666666666666666 * math.pow(B, 2.0)))) else: tmp = ((((B * B) * -0.16666666666666666) * B) - (B * 1.0)) * (1.0 / (B * B)) return tmp
function code(F, B, x) tmp = 0.0 if (x <= 6e+59) tmp = Float64(-1.0 / Float64(B * Float64(1.0 + Float64(-0.16666666666666666 * (B ^ 2.0))))); else tmp = Float64(Float64(Float64(Float64(Float64(B * B) * -0.16666666666666666) * B) - Float64(B * 1.0)) * Float64(1.0 / Float64(B * B))); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (x <= 6e+59) tmp = -1.0 / (B * (1.0 + (-0.16666666666666666 * (B ^ 2.0)))); else tmp = ((((B * B) * -0.16666666666666666) * B) - (B * 1.0)) * (1.0 / (B * B)); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[x, 6e+59], N[(-1.0 / N[(B * N[(1.0 + N[(-0.16666666666666666 * N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(B * B), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] * B), $MachinePrecision] - N[(B * 1.0), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6 \cdot 10^{+59}:\\
\;\;\;\;\frac{-1}{B \cdot \left(1 + -0.16666666666666666 \cdot {B}^{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(B \cdot B\right) \cdot -0.16666666666666666\right) \cdot B - B \cdot 1\right) \cdot \frac{1}{B \cdot B}\\
\end{array}
\end{array}
if x < 6.0000000000000001e59Initial program 76.9%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.1
Applied rewrites17.1%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6410.4
Applied rewrites10.4%
if 6.0000000000000001e59 < x Initial program 76.9%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.1
Applied rewrites17.1%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-pow.f6410.3
Applied rewrites10.3%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
frac-subN/A
unpow2N/A
lift-pow.f64N/A
mult-flipN/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6411.5
lift-pow.f64N/A
unpow2N/A
lower-*.f6411.5
Applied rewrites11.5%
(FPCore (F B x) :precision binary64 (if (<= x 6e+59) (/ -1.0 B) (* (- (* (* (* B B) -0.16666666666666666) B) (* B 1.0)) (/ 1.0 (* B B)))))
double code(double F, double B, double x) {
double tmp;
if (x <= 6e+59) {
tmp = -1.0 / B;
} else {
tmp = ((((B * B) * -0.16666666666666666) * B) - (B * 1.0)) * (1.0 / (B * 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 <= 6d+59) then
tmp = (-1.0d0) / b
else
tmp = ((((b * b) * (-0.16666666666666666d0)) * b) - (b * 1.0d0)) * (1.0d0 / (b * b))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (x <= 6e+59) {
tmp = -1.0 / B;
} else {
tmp = ((((B * B) * -0.16666666666666666) * B) - (B * 1.0)) * (1.0 / (B * B));
}
return tmp;
}
def code(F, B, x): tmp = 0 if x <= 6e+59: tmp = -1.0 / B else: tmp = ((((B * B) * -0.16666666666666666) * B) - (B * 1.0)) * (1.0 / (B * B)) return tmp
function code(F, B, x) tmp = 0.0 if (x <= 6e+59) tmp = Float64(-1.0 / B); else tmp = Float64(Float64(Float64(Float64(Float64(B * B) * -0.16666666666666666) * B) - Float64(B * 1.0)) * Float64(1.0 / Float64(B * B))); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (x <= 6e+59) tmp = -1.0 / B; else tmp = ((((B * B) * -0.16666666666666666) * B) - (B * 1.0)) * (1.0 / (B * B)); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[x, 6e+59], N[(-1.0 / B), $MachinePrecision], N[(N[(N[(N[(N[(B * B), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] * B), $MachinePrecision] - N[(B * 1.0), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6 \cdot 10^{+59}:\\
\;\;\;\;\frac{-1}{B}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(B \cdot B\right) \cdot -0.16666666666666666\right) \cdot B - B \cdot 1\right) \cdot \frac{1}{B \cdot B}\\
\end{array}
\end{array}
if x < 6.0000000000000001e59Initial program 76.9%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.1
Applied rewrites17.1%
Taylor expanded in B around 0
Applied rewrites10.6%
if 6.0000000000000001e59 < x Initial program 76.9%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.1
Applied rewrites17.1%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-pow.f6410.3
Applied rewrites10.3%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
frac-subN/A
unpow2N/A
lift-pow.f64N/A
mult-flipN/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6411.5
lift-pow.f64N/A
unpow2N/A
lower-*.f6411.5
Applied rewrites11.5%
(FPCore (F B x) :precision binary64 (if (<= x 6e+59) (/ -1.0 B) (/ (fma (* (* B B) -0.16666666666666666) B (* B -1.0)) (* B B))))
double code(double F, double B, double x) {
double tmp;
if (x <= 6e+59) {
tmp = -1.0 / B;
} else {
tmp = fma(((B * B) * -0.16666666666666666), B, (B * -1.0)) / (B * B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (x <= 6e+59) tmp = Float64(-1.0 / B); else tmp = Float64(fma(Float64(Float64(B * B) * -0.16666666666666666), B, Float64(B * -1.0)) / Float64(B * B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[x, 6e+59], N[(-1.0 / B), $MachinePrecision], N[(N[(N[(N[(B * B), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] * B + N[(B * -1.0), $MachinePrecision]), $MachinePrecision] / N[(B * B), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6 \cdot 10^{+59}:\\
\;\;\;\;\frac{-1}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(B \cdot B\right) \cdot -0.16666666666666666, B, B \cdot -1\right)}{B \cdot B}\\
\end{array}
\end{array}
if x < 6.0000000000000001e59Initial program 76.9%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.1
Applied rewrites17.1%
Taylor expanded in B around 0
Applied rewrites10.6%
if 6.0000000000000001e59 < x Initial program 76.9%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.1
Applied rewrites17.1%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-pow.f6410.3
Applied rewrites10.3%
lift-/.f64N/A
lift--.f64N/A
sub-flipN/A
metadata-evalN/A
div-add-revN/A
frac-addN/A
unpow2N/A
lift-pow.f64N/A
lower-/.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f6411.4
lift-pow.f64N/A
unpow2N/A
lower-*.f6411.4
Applied rewrites11.4%
(FPCore (F B x) :precision binary64 (fma -0.16666666666666666 B (/ -1.0 B)))
double code(double F, double B, double x) {
return fma(-0.16666666666666666, B, (-1.0 / B));
}
function code(F, B, x) return fma(-0.16666666666666666, B, Float64(-1.0 / B)) end
code[F_, B_, x_] := N[(-0.16666666666666666 * B + N[(-1.0 / B), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-0.16666666666666666, B, \frac{-1}{B}\right)
\end{array}
Initial program 76.9%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.1
Applied rewrites17.1%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-pow.f6410.3
Applied rewrites10.3%
lift-/.f64N/A
lift--.f64N/A
sub-flipN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
metadata-evalN/A
add-to-fraction-revN/A
frac-2neg-revN/A
metadata-evalN/A
lower-fma.f64N/A
metadata-evalN/A
frac-2neg-revN/A
lower-/.f6410.5
Applied rewrites10.5%
(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 F around -inf
lower-/.f64N/A
lower-sin.f6417.1
Applied rewrites17.1%
Taylor expanded in B around 0
Applied rewrites10.6%
(FPCore (F B x) :precision binary64 (* -0.16666666666666666 B))
double code(double F, double B, double x) {
return -0.16666666666666666 * 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 = (-0.16666666666666666d0) * b
end function
public static double code(double F, double B, double x) {
return -0.16666666666666666 * B;
}
def code(F, B, x): return -0.16666666666666666 * B
function code(F, B, x) return Float64(-0.16666666666666666 * B) end
function tmp = code(F, B, x) tmp = -0.16666666666666666 * B; end
code[F_, B_, x_] := N[(-0.16666666666666666 * B), $MachinePrecision]
\begin{array}{l}
\\
-0.16666666666666666 \cdot B
\end{array}
Initial program 76.9%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6417.1
Applied rewrites17.1%
Taylor expanded in B around 0
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-pow.f6410.3
Applied rewrites10.3%
Taylor expanded in B around inf
lower-*.f643.0
Applied rewrites3.0%
herbie shell --seed 2025156
(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))))))