
(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]
\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)}
Herbie found 21 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]
\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)}
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ 1.0 (sin B))) (t_1 (/ (- x) (tan B))))
(if (<= F -2e+24)
(fma t_0 -1.0 t_1)
(if (<= F 200000.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 <= -2e+24) {
tmp = fma(t_0, -1.0, t_1);
} else if (F <= 200000.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 <= -2e+24) tmp = fma(t_0, -1.0, t_1); elseif (F <= 200000.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, -2e+24], N[(t$95$0 * -1.0 + t$95$1), $MachinePrecision], If[LessEqual[F, 200000.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}
t_0 := \frac{1}{\sin B}\\
t_1 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -2 \cdot 10^{+24}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, -1, t\_1\right)\\
\mathbf{elif}\;F \leq 200000:\\
\;\;\;\;{\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}
if F < -2e24Initial program 76.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.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 rewrites55.1%
if -2e24 < F < 2e5Initial program 76.7%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.7
Applied rewrites76.9%
if 2e5 < F Initial program 76.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.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.6%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ 1.0 (sin B))) (t_1 (/ (- x) (tan B))))
(if (<= F -0.42)
(fma t_0 -1.0 t_1)
(if (<= F 8e-6)
(- (* (pow (fma 2.0 x 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 <= -0.42) {
tmp = fma(t_0, -1.0, t_1);
} else if (F <= 8e-6) {
tmp = (pow(fma(2.0, x, 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 <= -0.42) tmp = fma(t_0, -1.0, t_1); elseif (F <= 8e-6) tmp = Float64(Float64((fma(2.0, x, 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, -0.42], N[(t$95$0 * -1.0 + t$95$1), $MachinePrecision], If[LessEqual[F, 8e-6], N[(N[(N[Power[N[(2.0 * x + 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}
t_0 := \frac{1}{\sin B}\\
t_1 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -0.42:\\
\;\;\;\;\mathsf{fma}\left(t\_0, -1, t\_1\right)\\
\mathbf{elif}\;F \leq 8 \cdot 10^{-6}:\\
\;\;\;\;{\left(\mathsf{fma}\left(2, x, 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}
if F < -0.419999999999999984Initial program 76.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.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 rewrites55.1%
if -0.419999999999999984 < F < 7.99999999999999964e-6Initial program 76.7%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.7
Applied rewrites76.9%
Taylor expanded in F around 0
Applied rewrites55.3%
if 7.99999999999999964e-6 < F Initial program 76.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.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.6%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ 1.0 (sin B))) (t_1 (/ (- x) (tan B))))
(if (<= F -0.42)
(fma t_0 -1.0 t_1)
(if (<= F 8e-6)
(fma (/ 1.0 (* (sin B) (sqrt (+ 2.0 (* 2.0 x))))) 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 <= -0.42) {
tmp = fma(t_0, -1.0, t_1);
} else if (F <= 8e-6) {
tmp = fma((1.0 / (sin(B) * sqrt((2.0 + (2.0 * x))))), 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 <= -0.42) tmp = fma(t_0, -1.0, t_1); elseif (F <= 8e-6) tmp = fma(Float64(1.0 / Float64(sin(B) * sqrt(Float64(2.0 + Float64(2.0 * x))))), 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, -0.42], N[(t$95$0 * -1.0 + t$95$1), $MachinePrecision], If[LessEqual[F, 8e-6], N[(N[(1.0 / N[(N[Sin[B], $MachinePrecision] * N[Sqrt[N[(2.0 + N[(2.0 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * F + t$95$1), $MachinePrecision], N[(t$95$0 * 1.0 + t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \frac{1}{\sin B}\\
t_1 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -0.42:\\
\;\;\;\;\mathsf{fma}\left(t\_0, -1, t\_1\right)\\
\mathbf{elif}\;F \leq 8 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{\sin B \cdot \sqrt{2 + 2 \cdot x}}, F, t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, 1, t\_1\right)\\
\end{array}
if F < -0.419999999999999984Initial program 76.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.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 rewrites55.1%
if -0.419999999999999984 < F < 7.99999999999999964e-6Initial program 76.7%
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
add-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.0%
Applied rewrites85.0%
Taylor expanded in F around 0
lower-sqrt.f64N/A
lower-+.f64N/A
lower-*.f6456.6
Applied rewrites56.6%
if 7.99999999999999964e-6 < F Initial program 76.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.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.6%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (pow (fma 2.0 x (fma F F 2.0)) -0.5))
(t_1 (/ 1.0 (sin B)))
(t_2 (/ (- x) (tan B))))
(if (<= F -5.2e+22)
(fma t_1 -1.0 t_2)
(if (<= F 3.4e-155)
(- (* t_0 (/ F B)) (/ x (tan B)))
(if (<= F 8e-6)
(/ (fma t_0 F (* -1.0 x)) (sin B))
(fma t_1 1.0 t_2))))))double code(double F, double B, double x) {
double t_0 = pow(fma(2.0, x, fma(F, F, 2.0)), -0.5);
double t_1 = 1.0 / sin(B);
double t_2 = -x / tan(B);
double tmp;
if (F <= -5.2e+22) {
tmp = fma(t_1, -1.0, t_2);
} else if (F <= 3.4e-155) {
tmp = (t_0 * (F / B)) - (x / tan(B));
} else if (F <= 8e-6) {
tmp = fma(t_0, F, (-1.0 * x)) / sin(B);
} else {
tmp = fma(t_1, 1.0, t_2);
}
return tmp;
}
function code(F, B, x) t_0 = fma(2.0, x, fma(F, F, 2.0)) ^ -0.5 t_1 = Float64(1.0 / sin(B)) t_2 = Float64(Float64(-x) / tan(B)) tmp = 0.0 if (F <= -5.2e+22) tmp = fma(t_1, -1.0, t_2); elseif (F <= 3.4e-155) tmp = Float64(Float64(t_0 * Float64(F / B)) - Float64(x / tan(B))); elseif (F <= 8e-6) tmp = Float64(fma(t_0, F, Float64(-1.0 * x)) / sin(B)); else tmp = fma(t_1, 1.0, t_2); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $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, -5.2e+22], N[(t$95$1 * -1.0 + t$95$2), $MachinePrecision], If[LessEqual[F, 3.4e-155], N[(N[(t$95$0 * N[(F / B), $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 8e-6], N[(N[(t$95$0 * F + N[(-1.0 * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * 1.0 + t$95$2), $MachinePrecision]]]]]]]
\begin{array}{l}
t_0 := {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}\\
t_1 := \frac{1}{\sin B}\\
t_2 := \frac{-x}{\tan B}\\
\mathbf{if}\;F \leq -5.2 \cdot 10^{+22}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, -1, t\_2\right)\\
\mathbf{elif}\;F \leq 3.4 \cdot 10^{-155}:\\
\;\;\;\;t\_0 \cdot \frac{F}{B} - \frac{x}{\tan B}\\
\mathbf{elif}\;F \leq 8 \cdot 10^{-6}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t\_0, F, -1 \cdot x\right)}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, 1, t\_2\right)\\
\end{array}
if F < -5.2e22Initial program 76.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.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 rewrites55.1%
if -5.2e22 < F < 3.4e-155Initial program 76.7%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.7
Applied rewrites76.9%
Taylor expanded in B around 0
Applied rewrites62.5%
if 3.4e-155 < F < 7.99999999999999964e-6Initial program 76.7%
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
add-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.0%
Taylor expanded in B around 0
lower-*.f6460.3
Applied rewrites60.3%
if 7.99999999999999964e-6 < F Initial program 76.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.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.6%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (pow (fma 2.0 x (fma F F 2.0)) -0.5)))
(if (<= F -5.2e+22)
(fma (/ 1.0 (sin B)) -1.0 (/ (- x) (tan B)))
(if (<= F 3.4e-155)
(- (* t_0 (/ F B)) (/ x (tan B)))
(if (<= F 2.7e+146)
(/ (fma t_0 F (* -1.0 x)) (sin B))
(fma
F
(/ (fma -0.5 (/ (+ 2.0 (* 2.0 x)) (pow F 3.0)) (/ 1.0 F)) (sin B))
(- (/ x B))))))))double code(double F, double B, double x) {
double t_0 = pow(fma(2.0, x, fma(F, F, 2.0)), -0.5);
double tmp;
if (F <= -5.2e+22) {
tmp = fma((1.0 / sin(B)), -1.0, (-x / tan(B)));
} else if (F <= 3.4e-155) {
tmp = (t_0 * (F / B)) - (x / tan(B));
} else if (F <= 2.7e+146) {
tmp = fma(t_0, F, (-1.0 * x)) / sin(B);
} else {
tmp = fma(F, (fma(-0.5, ((2.0 + (2.0 * x)) / pow(F, 3.0)), (1.0 / F)) / sin(B)), -(x / B));
}
return tmp;
}
function code(F, B, x) t_0 = fma(2.0, x, fma(F, F, 2.0)) ^ -0.5 tmp = 0.0 if (F <= -5.2e+22) tmp = fma(Float64(1.0 / sin(B)), -1.0, Float64(Float64(-x) / tan(B))); elseif (F <= 3.4e-155) tmp = Float64(Float64(t_0 * Float64(F / B)) - Float64(x / tan(B))); elseif (F <= 2.7e+146) tmp = Float64(fma(t_0, F, Float64(-1.0 * x)) / sin(B)); else tmp = fma(F, Float64(fma(-0.5, Float64(Float64(2.0 + Float64(2.0 * x)) / (F ^ 3.0)), Float64(1.0 / F)) / sin(B)), Float64(-Float64(x / B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]}, If[LessEqual[F, -5.2e+22], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] * -1.0 + N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 3.4e-155], N[(N[(t$95$0 * N[(F / B), $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 2.7e+146], N[(N[(t$95$0 * F + N[(-1.0 * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(F * N[(N[(-0.5 * N[(N[(2.0 + N[(2.0 * x), $MachinePrecision]), $MachinePrecision] / N[Power[F, 3.0], $MachinePrecision]), $MachinePrecision] + N[(1.0 / F), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + (-N[(x / B), $MachinePrecision])), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}\\
\mathbf{if}\;F \leq -5.2 \cdot 10^{+22}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{\sin B}, -1, \frac{-x}{\tan B}\right)\\
\mathbf{elif}\;F \leq 3.4 \cdot 10^{-155}:\\
\;\;\;\;t\_0 \cdot \frac{F}{B} - \frac{x}{\tan B}\\
\mathbf{elif}\;F \leq 2.7 \cdot 10^{+146}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t\_0, F, -1 \cdot x\right)}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{\mathsf{fma}\left(-0.5, \frac{2 + 2 \cdot x}{{F}^{3}}, \frac{1}{F}\right)}{\sin B}, -\frac{x}{B}\right)\\
\end{array}
if F < -5.2e22Initial program 76.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.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 rewrites55.1%
if -5.2e22 < F < 3.4e-155Initial program 76.7%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.7
Applied rewrites76.9%
Taylor expanded in B around 0
Applied rewrites62.5%
if 3.4e-155 < F < 2.69999999999999989e146Initial program 76.7%
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
add-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.0%
Taylor expanded in B around 0
lower-*.f6460.3
Applied rewrites60.3%
if 2.69999999999999989e146 < F Initial program 76.7%
Taylor expanded in B around 0
lower-/.f6450.1
Applied rewrites50.1%
lift-+.f64N/A
+-commutativeN/A
Applied rewrites58.3%
Taylor expanded in F around inf
metadata-evalN/A
metadata-evalN/A
lower-fma.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-/.f6433.3
Applied rewrites33.3%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (pow (fma 2.0 x (fma F F 2.0)) -0.5)))
(if (<= F -5.2e+22)
(/ (* (- F) (fma (cos B) x 1.0)) (* (sin B) F))
(if (<= F 3.4e-155)
(- (* t_0 (/ F B)) (/ x (tan B)))
(if (<= F 2.7e+146)
(/ (fma t_0 F (* -1.0 x)) (sin B))
(fma
F
(/ (fma -0.5 (/ (+ 2.0 (* 2.0 x)) (pow F 3.0)) (/ 1.0 F)) (sin B))
(- (/ x B))))))))double code(double F, double B, double x) {
double t_0 = pow(fma(2.0, x, fma(F, F, 2.0)), -0.5);
double tmp;
if (F <= -5.2e+22) {
tmp = (-F * fma(cos(B), x, 1.0)) / (sin(B) * F);
} else if (F <= 3.4e-155) {
tmp = (t_0 * (F / B)) - (x / tan(B));
} else if (F <= 2.7e+146) {
tmp = fma(t_0, F, (-1.0 * x)) / sin(B);
} else {
tmp = fma(F, (fma(-0.5, ((2.0 + (2.0 * x)) / pow(F, 3.0)), (1.0 / F)) / sin(B)), -(x / B));
}
return tmp;
}
function code(F, B, x) t_0 = fma(2.0, x, fma(F, F, 2.0)) ^ -0.5 tmp = 0.0 if (F <= -5.2e+22) tmp = Float64(Float64(Float64(-F) * fma(cos(B), x, 1.0)) / Float64(sin(B) * F)); elseif (F <= 3.4e-155) tmp = Float64(Float64(t_0 * Float64(F / B)) - Float64(x / tan(B))); elseif (F <= 2.7e+146) tmp = Float64(fma(t_0, F, Float64(-1.0 * x)) / sin(B)); else tmp = fma(F, Float64(fma(-0.5, Float64(Float64(2.0 + Float64(2.0 * x)) / (F ^ 3.0)), Float64(1.0 / F)) / sin(B)), Float64(-Float64(x / B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]}, If[LessEqual[F, -5.2e+22], N[(N[((-F) * N[(N[Cos[B], $MachinePrecision] * x + 1.0), $MachinePrecision]), $MachinePrecision] / N[(N[Sin[B], $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 3.4e-155], N[(N[(t$95$0 * N[(F / B), $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 2.7e+146], N[(N[(t$95$0 * F + N[(-1.0 * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(F * N[(N[(-0.5 * N[(N[(2.0 + N[(2.0 * x), $MachinePrecision]), $MachinePrecision] / N[Power[F, 3.0], $MachinePrecision]), $MachinePrecision] + N[(1.0 / F), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + (-N[(x / B), $MachinePrecision])), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}\\
\mathbf{if}\;F \leq -5.2 \cdot 10^{+22}:\\
\;\;\;\;\frac{\left(-F\right) \cdot \mathsf{fma}\left(\cos B, x, 1\right)}{\sin B \cdot F}\\
\mathbf{elif}\;F \leq 3.4 \cdot 10^{-155}:\\
\;\;\;\;t\_0 \cdot \frac{F}{B} - \frac{x}{\tan B}\\
\mathbf{elif}\;F \leq 2.7 \cdot 10^{+146}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t\_0, F, -1 \cdot x\right)}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{\mathsf{fma}\left(-0.5, \frac{2 + 2 \cdot x}{{F}^{3}}, \frac{1}{F}\right)}{\sin B}, -\frac{x}{B}\right)\\
\end{array}
if F < -5.2e22Initial program 76.7%
Taylor expanded in F around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f6449.1
Applied rewrites49.1%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift-+.f64N/A
lift-/.f64N/A
lift-/.f64N/A
div-add-revN/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites45.5%
if -5.2e22 < F < 3.4e-155Initial program 76.7%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.7
Applied rewrites76.9%
Taylor expanded in B around 0
Applied rewrites62.5%
if 3.4e-155 < F < 2.69999999999999989e146Initial program 76.7%
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
add-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.0%
Taylor expanded in B around 0
lower-*.f6460.3
Applied rewrites60.3%
if 2.69999999999999989e146 < F Initial program 76.7%
Taylor expanded in B around 0
lower-/.f6450.1
Applied rewrites50.1%
lift-+.f64N/A
+-commutativeN/A
Applied rewrites58.3%
Taylor expanded in F around inf
metadata-evalN/A
metadata-evalN/A
lower-fma.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-/.f6433.3
Applied rewrites33.3%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (pow (fma 2.0 x (fma F F 2.0)) -0.5)) (t_1 (- (/ x B))))
(if (<= F -1.1e+27)
(fma F (/ (/ -1.0 F) (sin B)) t_1)
(if (<= F 3.4e-155)
(- (* t_0 (/ F B)) (/ x (tan B)))
(if (<= F 2.7e+146)
(/ (fma t_0 F (* -1.0 x)) (sin B))
(fma
F
(/ (fma -0.5 (/ (+ 2.0 (* 2.0 x)) (pow F 3.0)) (/ 1.0 F)) (sin B))
t_1))))))double code(double F, double B, double x) {
double t_0 = pow(fma(2.0, x, fma(F, F, 2.0)), -0.5);
double t_1 = -(x / B);
double tmp;
if (F <= -1.1e+27) {
tmp = fma(F, ((-1.0 / F) / sin(B)), t_1);
} else if (F <= 3.4e-155) {
tmp = (t_0 * (F / B)) - (x / tan(B));
} else if (F <= 2.7e+146) {
tmp = fma(t_0, F, (-1.0 * x)) / sin(B);
} else {
tmp = fma(F, (fma(-0.5, ((2.0 + (2.0 * x)) / pow(F, 3.0)), (1.0 / F)) / sin(B)), t_1);
}
return tmp;
}
function code(F, B, x) t_0 = fma(2.0, x, fma(F, F, 2.0)) ^ -0.5 t_1 = Float64(-Float64(x / B)) tmp = 0.0 if (F <= -1.1e+27) tmp = fma(F, Float64(Float64(-1.0 / F) / sin(B)), t_1); elseif (F <= 3.4e-155) tmp = Float64(Float64(t_0 * Float64(F / B)) - Float64(x / tan(B))); elseif (F <= 2.7e+146) tmp = Float64(fma(t_0, F, Float64(-1.0 * x)) / sin(B)); else tmp = fma(F, Float64(fma(-0.5, Float64(Float64(2.0 + Float64(2.0 * x)) / (F ^ 3.0)), Float64(1.0 / F)) / sin(B)), t_1); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]}, Block[{t$95$1 = (-N[(x / B), $MachinePrecision])}, If[LessEqual[F, -1.1e+27], N[(F * N[(N[(-1.0 / F), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], If[LessEqual[F, 3.4e-155], N[(N[(t$95$0 * N[(F / B), $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 2.7e+146], N[(N[(t$95$0 * F + N[(-1.0 * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(F * N[(N[(-0.5 * N[(N[(2.0 + N[(2.0 * x), $MachinePrecision]), $MachinePrecision] / N[Power[F, 3.0], $MachinePrecision]), $MachinePrecision] + N[(1.0 / F), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}\\
t_1 := -\frac{x}{B}\\
\mathbf{if}\;F \leq -1.1 \cdot 10^{+27}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{\frac{-1}{F}}{\sin B}, t\_1\right)\\
\mathbf{elif}\;F \leq 3.4 \cdot 10^{-155}:\\
\;\;\;\;t\_0 \cdot \frac{F}{B} - \frac{x}{\tan B}\\
\mathbf{elif}\;F \leq 2.7 \cdot 10^{+146}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t\_0, F, -1 \cdot x\right)}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{\mathsf{fma}\left(-0.5, \frac{2 + 2 \cdot x}{{F}^{3}}, \frac{1}{F}\right)}{\sin B}, t\_1\right)\\
\end{array}
if F < -1.0999999999999999e27Initial program 76.7%
Taylor expanded in B around 0
lower-/.f6450.1
Applied rewrites50.1%
lift-+.f64N/A
+-commutativeN/A
Applied rewrites58.3%
Taylor expanded in F around -inf
lower-/.f6434.4
Applied rewrites34.4%
if -1.0999999999999999e27 < F < 3.4e-155Initial program 76.7%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.7
Applied rewrites76.9%
Taylor expanded in B around 0
Applied rewrites62.5%
if 3.4e-155 < F < 2.69999999999999989e146Initial program 76.7%
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
add-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.0%
Taylor expanded in B around 0
lower-*.f6460.3
Applied rewrites60.3%
if 2.69999999999999989e146 < F Initial program 76.7%
Taylor expanded in B around 0
lower-/.f6450.1
Applied rewrites50.1%
lift-+.f64N/A
+-commutativeN/A
Applied rewrites58.3%
Taylor expanded in F around inf
metadata-evalN/A
metadata-evalN/A
lower-fma.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-/.f6433.3
Applied rewrites33.3%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (pow (fma 2.0 x (fma F F 2.0)) -0.5)) (t_1 (- (/ x B))))
(if (<= F -1.1e+27)
(fma F (/ (/ -1.0 F) (sin B)) t_1)
(if (<= F 3.4e-155)
(- (* t_0 (/ F B)) (/ x (tan B)))
(if (<= F 1.8e+146)
(/ (fma t_0 F (* -1.0 x)) (sin B))
(+ t_1 (/ 1.0 (sin B))))))))double code(double F, double B, double x) {
double t_0 = pow(fma(2.0, x, fma(F, F, 2.0)), -0.5);
double t_1 = -(x / B);
double tmp;
if (F <= -1.1e+27) {
tmp = fma(F, ((-1.0 / F) / sin(B)), t_1);
} else if (F <= 3.4e-155) {
tmp = (t_0 * (F / B)) - (x / tan(B));
} else if (F <= 1.8e+146) {
tmp = fma(t_0, F, (-1.0 * x)) / sin(B);
} else {
tmp = t_1 + (1.0 / sin(B));
}
return tmp;
}
function code(F, B, x) t_0 = fma(2.0, x, fma(F, F, 2.0)) ^ -0.5 t_1 = Float64(-Float64(x / B)) tmp = 0.0 if (F <= -1.1e+27) tmp = fma(F, Float64(Float64(-1.0 / F) / sin(B)), t_1); elseif (F <= 3.4e-155) tmp = Float64(Float64(t_0 * Float64(F / B)) - Float64(x / tan(B))); elseif (F <= 1.8e+146) tmp = Float64(fma(t_0, F, Float64(-1.0 * x)) / sin(B)); else tmp = Float64(t_1 + Float64(1.0 / sin(B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]}, Block[{t$95$1 = (-N[(x / B), $MachinePrecision])}, If[LessEqual[F, -1.1e+27], N[(F * N[(N[(-1.0 / F), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], If[LessEqual[F, 3.4e-155], N[(N[(t$95$0 * N[(F / B), $MachinePrecision]), $MachinePrecision] - N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.8e+146], N[(N[(t$95$0 * F + N[(-1.0 * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}\\
t_1 := -\frac{x}{B}\\
\mathbf{if}\;F \leq -1.1 \cdot 10^{+27}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{\frac{-1}{F}}{\sin B}, t\_1\right)\\
\mathbf{elif}\;F \leq 3.4 \cdot 10^{-155}:\\
\;\;\;\;t\_0 \cdot \frac{F}{B} - \frac{x}{\tan B}\\
\mathbf{elif}\;F \leq 1.8 \cdot 10^{+146}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t\_0, F, -1 \cdot x\right)}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \frac{1}{\sin B}\\
\end{array}
if F < -1.0999999999999999e27Initial program 76.7%
Taylor expanded in B around 0
lower-/.f6450.1
Applied rewrites50.1%
lift-+.f64N/A
+-commutativeN/A
Applied rewrites58.3%
Taylor expanded in F around -inf
lower-/.f6434.4
Applied rewrites34.4%
if -1.0999999999999999e27 < F < 3.4e-155Initial program 76.7%
lift-+.f64N/A
+-commutativeN/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f6476.7
Applied rewrites76.9%
Taylor expanded in B around 0
Applied rewrites62.5%
if 3.4e-155 < F < 1.7999999999999999e146Initial program 76.7%
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
add-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.0%
Taylor expanded in B around 0
lower-*.f6460.3
Applied rewrites60.3%
if 1.7999999999999999e146 < F Initial program 76.7%
Taylor expanded in B around 0
lower-/.f6450.1
Applied rewrites50.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-+.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lower-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-fma.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites58.3%
Taylor expanded in F around inf
lower-sin.f6437.1
Applied rewrites37.1%
(FPCore (F B x)
:precision binary64
(let* ((t_0
(/ (fma (pow (fma 2.0 x (fma F F 2.0)) -0.5) F (* -1.0 x)) (sin B)))
(t_1 (- (/ x B))))
(if (<= F -1.85e+30)
(fma F (/ (/ -1.0 F) (sin B)) t_1)
(if (<= F -4.5e-126)
t_0
(if (<= F 5.2e-192)
(* -1.0 (/ (* x (cos B)) (sin B)))
(if (<= F 1.8e+146) t_0 (+ t_1 (/ 1.0 (sin B)))))))))double code(double F, double B, double x) {
double t_0 = fma(pow(fma(2.0, x, fma(F, F, 2.0)), -0.5), F, (-1.0 * x)) / sin(B);
double t_1 = -(x / B);
double tmp;
if (F <= -1.85e+30) {
tmp = fma(F, ((-1.0 / F) / sin(B)), t_1);
} else if (F <= -4.5e-126) {
tmp = t_0;
} else if (F <= 5.2e-192) {
tmp = -1.0 * ((x * cos(B)) / sin(B));
} else if (F <= 1.8e+146) {
tmp = t_0;
} else {
tmp = t_1 + (1.0 / sin(B));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(fma((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5), F, Float64(-1.0 * x)) / sin(B)) t_1 = Float64(-Float64(x / B)) tmp = 0.0 if (F <= -1.85e+30) tmp = fma(F, Float64(Float64(-1.0 / F) / sin(B)), t_1); elseif (F <= -4.5e-126) tmp = t_0; elseif (F <= 5.2e-192) tmp = Float64(-1.0 * Float64(Float64(x * cos(B)) / sin(B))); elseif (F <= 1.8e+146) tmp = t_0; else tmp = Float64(t_1 + Float64(1.0 / sin(B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F + N[(-1.0 * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = (-N[(x / B), $MachinePrecision])}, If[LessEqual[F, -1.85e+30], N[(F * N[(N[(-1.0 / F), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], If[LessEqual[F, -4.5e-126], t$95$0, If[LessEqual[F, 5.2e-192], N[(-1.0 * N[(N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.8e+146], t$95$0, N[(t$95$1 + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left({\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}, F, -1 \cdot x\right)}{\sin B}\\
t_1 := -\frac{x}{B}\\
\mathbf{if}\;F \leq -1.85 \cdot 10^{+30}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{\frac{-1}{F}}{\sin B}, t\_1\right)\\
\mathbf{elif}\;F \leq -4.5 \cdot 10^{-126}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;F \leq 5.2 \cdot 10^{-192}:\\
\;\;\;\;-1 \cdot \frac{x \cdot \cos B}{\sin B}\\
\mathbf{elif}\;F \leq 1.8 \cdot 10^{+146}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \frac{1}{\sin B}\\
\end{array}
if F < -1.85000000000000008e30Initial program 76.7%
Taylor expanded in B around 0
lower-/.f6450.1
Applied rewrites50.1%
lift-+.f64N/A
+-commutativeN/A
Applied rewrites58.3%
Taylor expanded in F around -inf
lower-/.f6434.4
Applied rewrites34.4%
if -1.85000000000000008e30 < F < -4.50000000000000025e-126 or 5.2000000000000003e-192 < F < 1.7999999999999999e146Initial program 76.7%
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
add-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.0%
Taylor expanded in B around 0
lower-*.f6460.3
Applied rewrites60.3%
if -4.50000000000000025e-126 < F < 5.2000000000000003e-192Initial program 76.7%
Taylor expanded in F around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-sin.f6455.8
Applied rewrites55.8%
if 1.7999999999999999e146 < F Initial program 76.7%
Taylor expanded in B around 0
lower-/.f6450.1
Applied rewrites50.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-+.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lower-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-fma.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites58.3%
Taylor expanded in F around inf
lower-sin.f6437.1
Applied rewrites37.1%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (- (/ x B))))
(if (<= F -1.85e+30)
(fma F (/ (/ -1.0 F) (sin B)) t_0)
(if (<= F 1.8e+146)
(/ (fma (pow (fma 2.0 x (fma F F 2.0)) -0.5) F (* -1.0 x)) (sin B))
(+ t_0 (/ 1.0 (sin B)))))))double code(double F, double B, double x) {
double t_0 = -(x / B);
double tmp;
if (F <= -1.85e+30) {
tmp = fma(F, ((-1.0 / F) / sin(B)), t_0);
} else if (F <= 1.8e+146) {
tmp = fma(pow(fma(2.0, x, fma(F, F, 2.0)), -0.5), F, (-1.0 * x)) / sin(B);
} else {
tmp = t_0 + (1.0 / sin(B));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(-Float64(x / B)) tmp = 0.0 if (F <= -1.85e+30) tmp = fma(F, Float64(Float64(-1.0 / F) / sin(B)), t_0); elseif (F <= 1.8e+146) tmp = Float64(fma((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5), F, Float64(-1.0 * x)) / sin(B)); else tmp = Float64(t_0 + Float64(1.0 / sin(B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = (-N[(x / B), $MachinePrecision])}, If[LessEqual[F, -1.85e+30], N[(F * N[(N[(-1.0 / F), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], If[LessEqual[F, 1.8e+146], N[(N[(N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] * F + N[(-1.0 * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := -\frac{x}{B}\\
\mathbf{if}\;F \leq -1.85 \cdot 10^{+30}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{\frac{-1}{F}}{\sin B}, t\_0\right)\\
\mathbf{elif}\;F \leq 1.8 \cdot 10^{+146}:\\
\;\;\;\;\frac{\mathsf{fma}\left({\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5}, F, -1 \cdot x\right)}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{1}{\sin B}\\
\end{array}
if F < -1.85000000000000008e30Initial program 76.7%
Taylor expanded in B around 0
lower-/.f6450.1
Applied rewrites50.1%
lift-+.f64N/A
+-commutativeN/A
Applied rewrites58.3%
Taylor expanded in F around -inf
lower-/.f6434.4
Applied rewrites34.4%
if -1.85000000000000008e30 < F < 1.7999999999999999e146Initial program 76.7%
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
add-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.0%
Taylor expanded in B around 0
lower-*.f6460.3
Applied rewrites60.3%
if 1.7999999999999999e146 < F Initial program 76.7%
Taylor expanded in B around 0
lower-/.f6450.1
Applied rewrites50.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-+.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lower-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-fma.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites58.3%
Taylor expanded in F around inf
lower-sin.f6437.1
Applied rewrites37.1%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (- (/ x B))))
(if (<= F -2e+101)
(fma F (/ (/ -1.0 F) (sin B)) t_0)
(if (<= F 200000.0)
(fma (/ 1.0 (* (sin B) (sqrt (fma 2.0 x (fma F F 2.0))))) F t_0)
(+ t_0 (/ 1.0 (sin B)))))))double code(double F, double B, double x) {
double t_0 = -(x / B);
double tmp;
if (F <= -2e+101) {
tmp = fma(F, ((-1.0 / F) / sin(B)), t_0);
} else if (F <= 200000.0) {
tmp = fma((1.0 / (sin(B) * sqrt(fma(2.0, x, fma(F, F, 2.0))))), F, t_0);
} else {
tmp = t_0 + (1.0 / sin(B));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(-Float64(x / B)) tmp = 0.0 if (F <= -2e+101) tmp = fma(F, Float64(Float64(-1.0 / F) / sin(B)), t_0); elseif (F <= 200000.0) tmp = fma(Float64(1.0 / Float64(sin(B) * sqrt(fma(2.0, x, fma(F, F, 2.0))))), F, t_0); else tmp = Float64(t_0 + Float64(1.0 / sin(B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = (-N[(x / B), $MachinePrecision])}, If[LessEqual[F, -2e+101], N[(F * N[(N[(-1.0 / F), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], If[LessEqual[F, 200000.0], N[(N[(1.0 / N[(N[Sin[B], $MachinePrecision] * N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * F + t$95$0), $MachinePrecision], N[(t$95$0 + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := -\frac{x}{B}\\
\mathbf{if}\;F \leq -2 \cdot 10^{+101}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{\frac{-1}{F}}{\sin B}, t\_0\right)\\
\mathbf{elif}\;F \leq 200000:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}}, F, t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{1}{\sin B}\\
\end{array}
if F < -2e101Initial program 76.7%
Taylor expanded in B around 0
lower-/.f6450.1
Applied rewrites50.1%
lift-+.f64N/A
+-commutativeN/A
Applied rewrites58.3%
Taylor expanded in F around -inf
lower-/.f6434.4
Applied rewrites34.4%
if -2e101 < F < 2e5Initial program 76.7%
Taylor expanded in B around 0
lower-/.f6450.1
Applied rewrites50.1%
lift-+.f64N/A
+-commutativeN/A
Applied rewrites58.3%
metadata-evalN/A
lift-sin.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-flipN/A
lift-pow.f64N/A
associate-/r*N/A
*-commutativeN/A
lift-*.f64N/A
lift-sin.f64N/A
lift-/.f6458.3
lower-fma.f64N/A
*-commutativeN/A
Applied rewrites58.3%
if 2e5 < F Initial program 76.7%
Taylor expanded in B around 0
lower-/.f6450.1
Applied rewrites50.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-+.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lower-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-fma.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites58.3%
Taylor expanded in F around inf
lower-sin.f6437.1
Applied rewrites37.1%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (- (/ x B))))
(if (<= F -2e+101)
(fma F (/ (/ -1.0 F) (sin B)) t_0)
(if (<= F 200000.0)
(- (/ F (* (sin B) (sqrt (fma 2.0 x (fma F F 2.0))))) (/ x B))
(+ t_0 (/ 1.0 (sin B)))))))double code(double F, double B, double x) {
double t_0 = -(x / B);
double tmp;
if (F <= -2e+101) {
tmp = fma(F, ((-1.0 / F) / sin(B)), t_0);
} else if (F <= 200000.0) {
tmp = (F / (sin(B) * sqrt(fma(2.0, x, fma(F, F, 2.0))))) - (x / B);
} else {
tmp = t_0 + (1.0 / sin(B));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(-Float64(x / B)) tmp = 0.0 if (F <= -2e+101) tmp = fma(F, Float64(Float64(-1.0 / F) / sin(B)), t_0); elseif (F <= 200000.0) tmp = Float64(Float64(F / Float64(sin(B) * sqrt(fma(2.0, x, fma(F, F, 2.0))))) - Float64(x / B)); else tmp = Float64(t_0 + Float64(1.0 / sin(B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = (-N[(x / B), $MachinePrecision])}, If[LessEqual[F, -2e+101], N[(F * N[(N[(-1.0 / F), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], If[LessEqual[F, 200000.0], N[(N[(F / N[(N[Sin[B], $MachinePrecision] * N[Sqrt[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / B), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := -\frac{x}{B}\\
\mathbf{if}\;F \leq -2 \cdot 10^{+101}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{\frac{-1}{F}}{\sin B}, t\_0\right)\\
\mathbf{elif}\;F \leq 200000:\\
\;\;\;\;\frac{F}{\sin B \cdot \sqrt{\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)}} - \frac{x}{B}\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{1}{\sin B}\\
\end{array}
if F < -2e101Initial program 76.7%
Taylor expanded in B around 0
lower-/.f6450.1
Applied rewrites50.1%
lift-+.f64N/A
+-commutativeN/A
Applied rewrites58.3%
Taylor expanded in F around -inf
lower-/.f6434.4
Applied rewrites34.4%
if -2e101 < F < 2e5Initial program 76.7%
Taylor expanded in B around 0
lower-/.f6450.1
Applied rewrites50.1%
lift-+.f64N/A
+-commutativeN/A
Applied rewrites58.3%
metadata-evalN/A
lift-fma.f64N/A
lift-neg.f64N/A
sub-flip-reverseN/A
lower--.f64N/A
Applied rewrites58.3%
if 2e5 < F Initial program 76.7%
Taylor expanded in B around 0
lower-/.f6450.1
Applied rewrites50.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-+.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lower-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-fma.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites58.3%
Taylor expanded in F around inf
lower-sin.f6437.1
Applied rewrites37.1%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (- (/ x B))))
(if (<= F -5.2e+22)
(fma F (/ (/ -1.0 F) (sin B)) t_0)
(if (<= F 190.0)
(+ t_0 (* (/ F B) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0)))))
(+ t_0 (/ 1.0 (sin B)))))))double code(double F, double B, double x) {
double t_0 = -(x / B);
double tmp;
if (F <= -5.2e+22) {
tmp = fma(F, ((-1.0 / F) / sin(B)), t_0);
} else if (F <= 190.0) {
tmp = t_0 + ((F / B) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
} else {
tmp = t_0 + (1.0 / sin(B));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(-Float64(x / B)) tmp = 0.0 if (F <= -5.2e+22) tmp = fma(F, Float64(Float64(-1.0 / F) / sin(B)), t_0); elseif (F <= 190.0) tmp = Float64(t_0 + Float64(Float64(F / B) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))); else tmp = Float64(t_0 + Float64(1.0 / sin(B))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = (-N[(x / B), $MachinePrecision])}, If[LessEqual[F, -5.2e+22], N[(F * N[(N[(-1.0 / F), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], If[LessEqual[F, 190.0], N[(t$95$0 + 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 + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := -\frac{x}{B}\\
\mathbf{if}\;F \leq -5.2 \cdot 10^{+22}:\\
\;\;\;\;\mathsf{fma}\left(F, \frac{\frac{-1}{F}}{\sin B}, t\_0\right)\\
\mathbf{elif}\;F \leq 190:\\
\;\;\;\;t\_0 + \frac{F}{B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{1}{\sin B}\\
\end{array}
if F < -5.2e22Initial program 76.7%
Taylor expanded in B around 0
lower-/.f6450.1
Applied rewrites50.1%
lift-+.f64N/A
+-commutativeN/A
Applied rewrites58.3%
Taylor expanded in F around -inf
lower-/.f6434.4
Applied rewrites34.4%
if -5.2e22 < F < 190Initial program 76.7%
Taylor expanded in B around 0
lower-/.f6450.1
Applied rewrites50.1%
Taylor expanded in B around 0
Applied rewrites36.4%
if 190 < F Initial program 76.7%
Taylor expanded in B around 0
lower-/.f6450.1
Applied rewrites50.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-+.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lower-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-fma.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites58.3%
Taylor expanded in F around inf
lower-sin.f6437.1
Applied rewrites37.1%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (- (/ x B))))
(if (<= F -4.9e+27)
(/ -1.0 (sin B))
(if (<= F 190.0)
(+ t_0 (* (/ F B) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0)))))
(+ t_0 (/ 1.0 (sin B)))))))double code(double F, double B, double x) {
double t_0 = -(x / B);
double tmp;
if (F <= -4.9e+27) {
tmp = -1.0 / sin(B);
} else if (F <= 190.0) {
tmp = t_0 + ((F / B) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
} else {
tmp = t_0 + (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) :: t_0
real(8) :: tmp
t_0 = -(x / b)
if (f <= (-4.9d+27)) then
tmp = (-1.0d0) / sin(b)
else if (f <= 190.0d0) then
tmp = t_0 + ((f / b) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
else
tmp = t_0 + (1.0d0 / sin(b))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = -(x / B);
double tmp;
if (F <= -4.9e+27) {
tmp = -1.0 / Math.sin(B);
} else if (F <= 190.0) {
tmp = t_0 + ((F / B) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
} else {
tmp = t_0 + (1.0 / Math.sin(B));
}
return tmp;
}
def code(F, B, x): t_0 = -(x / B) tmp = 0 if F <= -4.9e+27: tmp = -1.0 / math.sin(B) elif F <= 190.0: tmp = t_0 + ((F / B) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0))) else: tmp = t_0 + (1.0 / math.sin(B)) return tmp
function code(F, B, x) t_0 = Float64(-Float64(x / B)) tmp = 0.0 if (F <= -4.9e+27) tmp = Float64(-1.0 / sin(B)); elseif (F <= 190.0) tmp = Float64(t_0 + Float64(Float64(F / B) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))); else tmp = Float64(t_0 + Float64(1.0 / sin(B))); end return tmp end
function tmp_2 = code(F, B, x) t_0 = -(x / B); tmp = 0.0; if (F <= -4.9e+27) tmp = -1.0 / sin(B); elseif (F <= 190.0) tmp = t_0 + ((F / B) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); else tmp = t_0 + (1.0 / sin(B)); end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = (-N[(x / B), $MachinePrecision])}, If[LessEqual[F, -4.9e+27], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 190.0], N[(t$95$0 + 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 + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := -\frac{x}{B}\\
\mathbf{if}\;F \leq -4.9 \cdot 10^{+27}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 190:\\
\;\;\;\;t\_0 + \frac{F}{B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{1}{\sin B}\\
\end{array}
if F < -4.90000000000000015e27Initial program 76.7%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6416.6
Applied rewrites16.6%
if -4.90000000000000015e27 < F < 190Initial program 76.7%
Taylor expanded in B around 0
lower-/.f6450.1
Applied rewrites50.1%
Taylor expanded in B around 0
Applied rewrites36.4%
if 190 < F Initial program 76.7%
Taylor expanded in B around 0
lower-/.f6450.1
Applied rewrites50.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-+.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lower-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-fma.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites58.3%
Taylor expanded in F around inf
lower-sin.f6437.1
Applied rewrites37.1%
(FPCore (F B x)
:precision binary64
(if (<= F -4.9e+27)
(/ -1.0 (sin B))
(if (<= F 190.0)
(/ (fma -1.0 x (/ F (sqrt (+ 2.0 (fma 2.0 x (pow F 2.0)))))) B)
(+ (- (/ x B)) (/ 1.0 (sin B))))))double code(double F, double B, double x) {
double tmp;
if (F <= -4.9e+27) {
tmp = -1.0 / sin(B);
} else if (F <= 190.0) {
tmp = fma(-1.0, x, (F / sqrt((2.0 + fma(2.0, x, pow(F, 2.0)))))) / B;
} else {
tmp = -(x / B) + (1.0 / sin(B));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -4.9e+27) tmp = Float64(-1.0 / sin(B)); elseif (F <= 190.0) tmp = Float64(fma(-1.0, x, Float64(F / sqrt(Float64(2.0 + fma(2.0, x, (F ^ 2.0)))))) / B); else tmp = Float64(Float64(-Float64(x / B)) + Float64(1.0 / sin(B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -4.9e+27], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 190.0], N[(N[(-1.0 * x + N[(F / N[Sqrt[N[(2.0 + N[(2.0 * x + N[Power[F, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], N[((-N[(x / B), $MachinePrecision]) + N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;F \leq -4.9 \cdot 10^{+27}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 190:\\
\;\;\;\;\frac{\mathsf{fma}\left(-1, x, \frac{F}{\sqrt{2 + \mathsf{fma}\left(2, x, {F}^{2}\right)}}\right)}{B}\\
\mathbf{else}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{1}{\sin B}\\
\end{array}
if F < -4.90000000000000015e27Initial program 76.7%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6416.6
Applied rewrites16.6%
if -4.90000000000000015e27 < F < 190Initial program 76.7%
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
add-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.0%
Applied rewrites85.0%
Taylor expanded in B around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6444.5
Applied rewrites44.5%
if 190 < F Initial program 76.7%
Taylor expanded in B around 0
lower-/.f6450.1
Applied rewrites50.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-+.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lower-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-fma.f64N/A
lift-neg.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites58.3%
Taylor expanded in F around inf
lower-sin.f6437.1
Applied rewrites37.1%
(FPCore (F B x)
:precision binary64
(if (<= F -4.9e+27)
(/ -1.0 (sin B))
(if (<= F 1.15e+116)
(/ (fma -1.0 x (/ F (sqrt (+ 2.0 (fma 2.0 x (pow F 2.0)))))) B)
(/ 1.0 (sin B)))))double code(double F, double B, double x) {
double tmp;
if (F <= -4.9e+27) {
tmp = -1.0 / sin(B);
} else if (F <= 1.15e+116) {
tmp = fma(-1.0, x, (F / sqrt((2.0 + fma(2.0, x, pow(F, 2.0)))))) / B;
} else {
tmp = 1.0 / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -4.9e+27) tmp = Float64(-1.0 / sin(B)); elseif (F <= 1.15e+116) tmp = Float64(fma(-1.0, x, Float64(F / sqrt(Float64(2.0 + fma(2.0, x, (F ^ 2.0)))))) / B); else tmp = Float64(1.0 / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -4.9e+27], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.15e+116], N[(N[(-1.0 * x + N[(F / N[Sqrt[N[(2.0 + N[(2.0 * x + N[Power[F, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;F \leq -4.9 \cdot 10^{+27}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 1.15 \cdot 10^{+116}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-1, x, \frac{F}{\sqrt{2 + \mathsf{fma}\left(2, x, {F}^{2}\right)}}\right)}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\
\end{array}
if F < -4.90000000000000015e27Initial program 76.7%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6416.6
Applied rewrites16.6%
if -4.90000000000000015e27 < F < 1.14999999999999997e116Initial program 76.7%
lift-+.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
add-to-fractionN/A
lower-/.f64N/A
Applied rewrites85.0%
Applied rewrites85.0%
Taylor expanded in B around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6444.5
Applied rewrites44.5%
if 1.14999999999999997e116 < F Initial program 76.7%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6417.4
Applied rewrites17.4%
(FPCore (F B x)
:precision binary64
(if (<= F -6200000000000.0)
(/ -1.0 (sin B))
(if (<= F 0.092)
(+ (- (/ x B)) (/ (* F (pow (+ 2.0 (* 2.0 x)) -0.5)) B))
(/ 1.0 (sin B)))))double code(double F, double B, double x) {
double tmp;
if (F <= -6200000000000.0) {
tmp = -1.0 / sin(B);
} else if (F <= 0.092) {
tmp = -(x / B) + ((F * pow((2.0 + (2.0 * x)), -0.5)) / B);
} 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 <= (-6200000000000.0d0)) then
tmp = (-1.0d0) / sin(b)
else if (f <= 0.092d0) then
tmp = -(x / b) + ((f * ((2.0d0 + (2.0d0 * x)) ** (-0.5d0))) / b)
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 <= -6200000000000.0) {
tmp = -1.0 / Math.sin(B);
} else if (F <= 0.092) {
tmp = -(x / B) + ((F * Math.pow((2.0 + (2.0 * x)), -0.5)) / B);
} else {
tmp = 1.0 / Math.sin(B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -6200000000000.0: tmp = -1.0 / math.sin(B) elif F <= 0.092: tmp = -(x / B) + ((F * math.pow((2.0 + (2.0 * x)), -0.5)) / B) else: tmp = 1.0 / math.sin(B) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -6200000000000.0) tmp = Float64(-1.0 / sin(B)); elseif (F <= 0.092) tmp = Float64(Float64(-Float64(x / B)) + Float64(Float64(F * (Float64(2.0 + Float64(2.0 * x)) ^ -0.5)) / B)); else tmp = Float64(1.0 / sin(B)); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -6200000000000.0) tmp = -1.0 / sin(B); elseif (F <= 0.092) tmp = -(x / B) + ((F * ((2.0 + (2.0 * x)) ^ -0.5)) / B); else tmp = 1.0 / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -6200000000000.0], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 0.092], N[((-N[(x / B), $MachinePrecision]) + N[(N[(F * N[Power[N[(2.0 + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;F \leq -6200000000000:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 0.092:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{F \cdot {\left(2 + 2 \cdot x\right)}^{-0.5}}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\
\end{array}
if F < -6.2e12Initial program 76.7%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6416.6
Applied rewrites16.6%
if -6.2e12 < F < 0.091999999999999998Initial program 76.7%
Taylor expanded in B around 0
lower-/.f6450.1
Applied rewrites50.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.f6437.0
Applied rewrites37.0%
Taylor expanded in B 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-eval29.9
Applied rewrites29.9%
if 0.091999999999999998 < F Initial program 76.7%
Taylor expanded in F around inf
lower-/.f64N/A
lower-sin.f6417.4
Applied rewrites17.4%
(FPCore (F B x)
:precision binary64
(if (<= F -6200000000000.0)
(/ -1.0 (sin B))
(if (<= F 1.7e+89)
(+ (- (/ x B)) (/ (* F (pow (+ 2.0 (* 2.0 x)) -0.5)) B))
(* -1.0 (/ (* x (+ 1.0 (/ 1.0 x))) B)))))double code(double F, double B, double x) {
double tmp;
if (F <= -6200000000000.0) {
tmp = -1.0 / sin(B);
} else if (F <= 1.7e+89) {
tmp = -(x / B) + ((F * pow((2.0 + (2.0 * x)), -0.5)) / B);
} else {
tmp = -1.0 * ((x * (1.0 + (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 <= (-6200000000000.0d0)) then
tmp = (-1.0d0) / sin(b)
else if (f <= 1.7d+89) then
tmp = -(x / b) + ((f * ((2.0d0 + (2.0d0 * x)) ** (-0.5d0))) / b)
else
tmp = (-1.0d0) * ((x * (1.0d0 + (1.0d0 / x))) / b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -6200000000000.0) {
tmp = -1.0 / Math.sin(B);
} else if (F <= 1.7e+89) {
tmp = -(x / B) + ((F * Math.pow((2.0 + (2.0 * x)), -0.5)) / B);
} else {
tmp = -1.0 * ((x * (1.0 + (1.0 / x))) / B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -6200000000000.0: tmp = -1.0 / math.sin(B) elif F <= 1.7e+89: tmp = -(x / B) + ((F * math.pow((2.0 + (2.0 * x)), -0.5)) / B) else: tmp = -1.0 * ((x * (1.0 + (1.0 / x))) / B) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -6200000000000.0) tmp = Float64(-1.0 / sin(B)); elseif (F <= 1.7e+89) tmp = Float64(Float64(-Float64(x / B)) + Float64(Float64(F * (Float64(2.0 + Float64(2.0 * x)) ^ -0.5)) / B)); else tmp = Float64(-1.0 * Float64(Float64(x * Float64(1.0 + Float64(1.0 / x))) / B)); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -6200000000000.0) tmp = -1.0 / sin(B); elseif (F <= 1.7e+89) tmp = -(x / B) + ((F * ((2.0 + (2.0 * x)) ^ -0.5)) / B); else tmp = -1.0 * ((x * (1.0 + (1.0 / x))) / B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -6200000000000.0], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.7e+89], N[((-N[(x / B), $MachinePrecision]) + N[(N[(F * N[Power[N[(2.0 + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision], N[(-1.0 * N[(N[(x * N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;F \leq -6200000000000:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 1.7 \cdot 10^{+89}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{F \cdot {\left(2 + 2 \cdot x\right)}^{-0.5}}{B}\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{x \cdot \left(1 + \frac{1}{x}\right)}{B}\\
\end{array}
if F < -6.2e12Initial program 76.7%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6416.6
Applied rewrites16.6%
if -6.2e12 < F < 1.7000000000000001e89Initial program 76.7%
Taylor expanded in B around 0
lower-/.f6450.1
Applied rewrites50.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.f6437.0
Applied rewrites37.0%
Taylor expanded in B 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-eval29.9
Applied rewrites29.9%
if 1.7000000000000001e89 < F Initial program 76.7%
Taylor expanded in F around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f6449.1
Applied rewrites49.1%
Taylor expanded in B around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f6428.2
Applied rewrites28.2%
Taylor expanded in x around inf
lower-*.f64N/A
lower-+.f64N/A
lower-/.f6429.4
Applied rewrites29.4%
(FPCore (F B x)
:precision binary64
(if (<= F -0.42)
(- (/ (+ x 1.0) B))
(if (<= F 1.7e+89)
(+ (- (/ x B)) (/ (* F (pow (+ 2.0 (* 2.0 x)) -0.5)) B))
(* -1.0 (/ (* x (+ 1.0 (/ 1.0 x))) B)))))double code(double F, double B, double x) {
double tmp;
if (F <= -0.42) {
tmp = -((x + 1.0) / B);
} else if (F <= 1.7e+89) {
tmp = -(x / B) + ((F * pow((2.0 + (2.0 * x)), -0.5)) / B);
} else {
tmp = -1.0 * ((x * (1.0 + (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 <= (-0.42d0)) then
tmp = -((x + 1.0d0) / b)
else if (f <= 1.7d+89) then
tmp = -(x / b) + ((f * ((2.0d0 + (2.0d0 * x)) ** (-0.5d0))) / b)
else
tmp = (-1.0d0) * ((x * (1.0d0 + (1.0d0 / x))) / b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -0.42) {
tmp = -((x + 1.0) / B);
} else if (F <= 1.7e+89) {
tmp = -(x / B) + ((F * Math.pow((2.0 + (2.0 * x)), -0.5)) / B);
} else {
tmp = -1.0 * ((x * (1.0 + (1.0 / x))) / B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -0.42: tmp = -((x + 1.0) / B) elif F <= 1.7e+89: tmp = -(x / B) + ((F * math.pow((2.0 + (2.0 * x)), -0.5)) / B) else: tmp = -1.0 * ((x * (1.0 + (1.0 / x))) / B) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -0.42) tmp = Float64(-Float64(Float64(x + 1.0) / B)); elseif (F <= 1.7e+89) tmp = Float64(Float64(-Float64(x / B)) + Float64(Float64(F * (Float64(2.0 + Float64(2.0 * x)) ^ -0.5)) / B)); else tmp = Float64(-1.0 * Float64(Float64(x * Float64(1.0 + Float64(1.0 / x))) / B)); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -0.42) tmp = -((x + 1.0) / B); elseif (F <= 1.7e+89) tmp = -(x / B) + ((F * ((2.0 + (2.0 * x)) ^ -0.5)) / B); else tmp = -1.0 * ((x * (1.0 + (1.0 / x))) / B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -0.42], (-N[(N[(x + 1.0), $MachinePrecision] / B), $MachinePrecision]), If[LessEqual[F, 1.7e+89], N[((-N[(x / B), $MachinePrecision]) + N[(N[(F * N[Power[N[(2.0 + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision], N[(-1.0 * N[(N[(x * N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;F \leq -0.42:\\
\;\;\;\;-\frac{x + 1}{B}\\
\mathbf{elif}\;F \leq 1.7 \cdot 10^{+89}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{F \cdot {\left(2 + 2 \cdot x\right)}^{-0.5}}{B}\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{x \cdot \left(1 + \frac{1}{x}\right)}{B}\\
\end{array}
if F < -0.419999999999999984Initial program 76.7%
Taylor expanded in F around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f6449.1
Applied rewrites49.1%
Taylor expanded in B around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f6428.2
Applied rewrites28.2%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6428.2
Applied rewrites29.4%
if -0.419999999999999984 < F < 1.7000000000000001e89Initial program 76.7%
Taylor expanded in B around 0
lower-/.f6450.1
Applied rewrites50.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.f6437.0
Applied rewrites37.0%
Taylor expanded in B 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-eval29.9
Applied rewrites29.9%
if 1.7000000000000001e89 < F Initial program 76.7%
Taylor expanded in F around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f6449.1
Applied rewrites49.1%
Taylor expanded in B around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f6428.2
Applied rewrites28.2%
Taylor expanded in x around inf
lower-*.f64N/A
lower-+.f64N/A
lower-/.f6429.4
Applied rewrites29.4%
(FPCore (F B x) :precision binary64 (- (/ (+ x 1.0) B)))
double code(double F, double B, double x) {
return -((x + 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 = -((x + 1.0d0) / b)
end function
public static double code(double F, double B, double x) {
return -((x + 1.0) / B);
}
def code(F, B, x): return -((x + 1.0) / B)
function code(F, B, x) return Float64(-Float64(Float64(x + 1.0) / B)) end
function tmp = code(F, B, x) tmp = -((x + 1.0) / B); end
code[F_, B_, x_] := (-N[(N[(x + 1.0), $MachinePrecision] / B), $MachinePrecision])
-\frac{x + 1}{B}
Initial program 76.7%
Taylor expanded in F around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sin.f6449.1
Applied rewrites49.1%
Taylor expanded in B around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f6428.2
Applied rewrites28.2%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6428.2
Applied rewrites29.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]
\frac{-1}{B}
Initial program 76.7%
Taylor expanded in F around -inf
lower-/.f64N/A
lower-sin.f6416.6
Applied rewrites16.6%
Taylor expanded in B around 0
Applied rewrites10.2%
herbie shell --seed 2025180
(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))))))