
(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 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (F B x) :precision binary64 (+ (- (* x (/ 1.0 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))
double code(double F, double B, double x) {
return -(x * (1.0 / tan(B))) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = -(x * (1.0d0 / tan(b))) + ((f / sin(b)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
end function
public static double code(double F, double B, double x) {
return -(x * (1.0 / Math.tan(B))) + ((F / Math.sin(B)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
def code(F, B, x): return -(x * (1.0 / math.tan(B))) + ((F / math.sin(B)) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)))
function code(F, B, x) return Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))) end
function tmp = code(F, B, x) tmp = -(x * (1.0 / tan(B))) + ((F / sin(B)) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); end
code[F_, B_, x_] := N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], (-N[(1.0 / 2.0), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\end{array}
(FPCore (F B x)
:precision binary64
(let* ((t_0 (- (/ x (tan B)))))
(if (<= F -2e+37)
(- (/ (+ 1.0 (* x (cos B))) (sin B)))
(if (<= F 9.5e+87)
(*
(+ 1.0 (/ (* (pow (fma 2.0 x (fma F F 2.0)) -0.5) (/ F (sin B))) t_0))
t_0)
(/ (- (* (/ 1.0 F) F) (* (cos B) x)) (sin B))))))
double code(double F, double B, double x) {
double t_0 = -(x / tan(B));
double tmp;
if (F <= -2e+37) {
tmp = -((1.0 + (x * cos(B))) / sin(B));
} else if (F <= 9.5e+87) {
tmp = (1.0 + ((pow(fma(2.0, x, fma(F, F, 2.0)), -0.5) * (F / sin(B))) / t_0)) * t_0;
} else {
tmp = (((1.0 / F) * F) - (cos(B) * x)) / sin(B);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(-Float64(x / tan(B))) tmp = 0.0 if (F <= -2e+37) tmp = Float64(-Float64(Float64(1.0 + Float64(x * cos(B))) / sin(B))); elseif (F <= 9.5e+87) tmp = Float64(Float64(1.0 + Float64(Float64((fma(2.0, x, fma(F, F, 2.0)) ^ -0.5) * Float64(F / sin(B))) / t_0)) * t_0); else tmp = Float64(Float64(Float64(Float64(1.0 / F) * F) - Float64(cos(B) * x)) / sin(B)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = (-N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision])}, If[LessEqual[F, -2e+37], (-N[(N[(1.0 + N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 9.5e+87], N[(N[(1.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] / t$95$0), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[(N[(N[(1.0 / F), $MachinePrecision] * F), $MachinePrecision] - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -\frac{x}{\tan B}\\
\mathbf{if}\;F \leq -2 \cdot 10^{+37}:\\
\;\;\;\;-\frac{1 + x \cdot \cos B}{\sin B}\\
\mathbf{elif}\;F \leq 9.5 \cdot 10^{+87}:\\
\;\;\;\;\left(1 + \frac{{\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} \cdot \frac{F}{\sin B}}{t\_0}\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{F} \cdot F - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -1.99999999999999991e37Initial program 75.6%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sin.f6450.4
Applied rewrites50.4%
Taylor expanded in F around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lift-cos.f64N/A
lift-sin.f6456.2
Applied rewrites56.2%
if -1.99999999999999991e37 < F < 9.4999999999999992e87Initial program 75.6%
Applied rewrites75.1%
if 9.4999999999999992e87 < F Initial program 75.6%
Taylor expanded in B around inf
metadata-evalN/A
metadata-evalN/A
sub-divN/A
lower-/.f64N/A
Applied rewrites84.7%
Taylor expanded in F around inf
lower-/.f6456.0
Applied rewrites56.0%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* (cos B) x)))
(if (<= F -2e+154)
(- (/ (+ 1.0 (* x (cos B))) (sin B)))
(if (<= F 96000000.0)
(/ (- (* (pow (+ (fma F F (+ x x)) 2.0) -0.5) F) t_0) (sin B))
(/ (- (* (/ 1.0 F) F) t_0) (sin B))))))
double code(double F, double B, double x) {
double t_0 = cos(B) * x;
double tmp;
if (F <= -2e+154) {
tmp = -((1.0 + (x * cos(B))) / sin(B));
} else if (F <= 96000000.0) {
tmp = ((pow((fma(F, F, (x + x)) + 2.0), -0.5) * F) - t_0) / sin(B);
} else {
tmp = (((1.0 / F) * F) - t_0) / sin(B);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(cos(B) * x) tmp = 0.0 if (F <= -2e+154) tmp = Float64(-Float64(Float64(1.0 + Float64(x * cos(B))) / sin(B))); elseif (F <= 96000000.0) tmp = Float64(Float64(Float64((Float64(fma(F, F, Float64(x + x)) + 2.0) ^ -0.5) * F) - t_0) / sin(B)); else tmp = Float64(Float64(Float64(Float64(1.0 / F) * F) - t_0) / sin(B)); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[F, -2e+154], (-N[(N[(1.0 + N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 96000000.0], N[(N[(N[(N[Power[N[(N[(F * F + N[(x + x), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(1.0 / F), $MachinePrecision] * F), $MachinePrecision] - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos B \cdot x\\
\mathbf{if}\;F \leq -2 \cdot 10^{+154}:\\
\;\;\;\;-\frac{1 + x \cdot \cos B}{\sin B}\\
\mathbf{elif}\;F \leq 96000000:\\
\;\;\;\;\frac{{\left(\mathsf{fma}\left(F, F, x + x\right) + 2\right)}^{-0.5} \cdot F - t\_0}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{F} \cdot F - t\_0}{\sin B}\\
\end{array}
\end{array}
if F < -2.00000000000000007e154Initial program 75.6%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sin.f6450.4
Applied rewrites50.4%
Taylor expanded in F around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lift-cos.f64N/A
lift-sin.f6456.2
Applied rewrites56.2%
if -2.00000000000000007e154 < F < 9.6e7Initial program 75.6%
Taylor expanded in B around inf
metadata-evalN/A
metadata-evalN/A
sub-divN/A
lower-/.f64N/A
Applied rewrites84.7%
if 9.6e7 < F Initial program 75.6%
Taylor expanded in B around inf
metadata-evalN/A
metadata-evalN/A
sub-divN/A
lower-/.f64N/A
Applied rewrites84.7%
Taylor expanded in F around inf
lower-/.f6456.0
Applied rewrites56.0%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* (cos B) x)))
(if (<= F -1.42)
(- (/ (+ 1.0 (* x (cos B))) (sin B)))
(if (<= F 1.4)
(/ (- (* (pow 2.0 -0.5) F) t_0) (sin B))
(/ (- (* (/ 1.0 F) F) t_0) (sin B))))))
double code(double F, double B, double x) {
double t_0 = cos(B) * x;
double tmp;
if (F <= -1.42) {
tmp = -((1.0 + (x * cos(B))) / sin(B));
} else if (F <= 1.4) {
tmp = ((pow(2.0, -0.5) * F) - t_0) / sin(B);
} else {
tmp = (((1.0 / F) * F) - t_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 = cos(b) * x
if (f <= (-1.42d0)) then
tmp = -((1.0d0 + (x * cos(b))) / sin(b))
else if (f <= 1.4d0) then
tmp = (((2.0d0 ** (-0.5d0)) * f) - t_0) / sin(b)
else
tmp = (((1.0d0 / f) * f) - t_0) / sin(b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = Math.cos(B) * x;
double tmp;
if (F <= -1.42) {
tmp = -((1.0 + (x * Math.cos(B))) / Math.sin(B));
} else if (F <= 1.4) {
tmp = ((Math.pow(2.0, -0.5) * F) - t_0) / Math.sin(B);
} else {
tmp = (((1.0 / F) * F) - t_0) / Math.sin(B);
}
return tmp;
}
def code(F, B, x): t_0 = math.cos(B) * x tmp = 0 if F <= -1.42: tmp = -((1.0 + (x * math.cos(B))) / math.sin(B)) elif F <= 1.4: tmp = ((math.pow(2.0, -0.5) * F) - t_0) / math.sin(B) else: tmp = (((1.0 / F) * F) - t_0) / math.sin(B) return tmp
function code(F, B, x) t_0 = Float64(cos(B) * x) tmp = 0.0 if (F <= -1.42) tmp = Float64(-Float64(Float64(1.0 + Float64(x * cos(B))) / sin(B))); elseif (F <= 1.4) tmp = Float64(Float64(Float64((2.0 ^ -0.5) * F) - t_0) / sin(B)); else tmp = Float64(Float64(Float64(Float64(1.0 / F) * F) - t_0) / sin(B)); end return tmp end
function tmp_2 = code(F, B, x) t_0 = cos(B) * x; tmp = 0.0; if (F <= -1.42) tmp = -((1.0 + (x * cos(B))) / sin(B)); elseif (F <= 1.4) tmp = (((2.0 ^ -0.5) * F) - t_0) / sin(B); else tmp = (((1.0 / F) * F) - t_0) / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[F, -1.42], (-N[(N[(1.0 + N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 1.4], N[(N[(N[(N[Power[2.0, -0.5], $MachinePrecision] * F), $MachinePrecision] - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(1.0 / F), $MachinePrecision] * F), $MachinePrecision] - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos B \cdot x\\
\mathbf{if}\;F \leq -1.42:\\
\;\;\;\;-\frac{1 + x \cdot \cos B}{\sin B}\\
\mathbf{elif}\;F \leq 1.4:\\
\;\;\;\;\frac{{2}^{-0.5} \cdot F - t\_0}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{F} \cdot F - t\_0}{\sin B}\\
\end{array}
\end{array}
if F < -1.4199999999999999Initial program 75.6%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sin.f6450.4
Applied rewrites50.4%
Taylor expanded in F around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lift-cos.f64N/A
lift-sin.f6456.2
Applied rewrites56.2%
if -1.4199999999999999 < F < 1.3999999999999999Initial program 75.6%
Taylor expanded in F around 0
metadata-evalN/A
metadata-evalN/A
sub-divN/A
lower-/.f64N/A
Applied rewrites55.2%
Taylor expanded in x around 0
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
metadata-evalN/A
metadata-eval57.4
Applied rewrites57.4%
if 1.3999999999999999 < F Initial program 75.6%
Taylor expanded in B around inf
metadata-evalN/A
metadata-evalN/A
sub-divN/A
lower-/.f64N/A
Applied rewrites84.7%
Taylor expanded in F around inf
lower-/.f6456.0
Applied rewrites56.0%
(FPCore (F B x)
:precision binary64
(if (<= F -140.0)
(- (/ (+ 1.0 (* x (cos B))) (sin B)))
(if (<= F -2.4e-98)
(+ (- (/ x B)) (* (/ F (sin B)) (pow (fma F F 2.0) -0.5)))
(if (<= F 1750.0)
(+
(- (* x (/ 1.0 (tan B))))
(/ (* (pow (+ (fma F F (+ x x)) 2.0) -0.5) F) B))
(/ (- (* (/ 1.0 F) F) (* (cos B) x)) (sin B))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -140.0) {
tmp = -((1.0 + (x * cos(B))) / sin(B));
} else if (F <= -2.4e-98) {
tmp = -(x / B) + ((F / sin(B)) * pow(fma(F, F, 2.0), -0.5));
} else if (F <= 1750.0) {
tmp = -(x * (1.0 / tan(B))) + ((pow((fma(F, F, (x + x)) + 2.0), -0.5) * F) / B);
} else {
tmp = (((1.0 / F) * F) - (cos(B) * x)) / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -140.0) tmp = Float64(-Float64(Float64(1.0 + Float64(x * cos(B))) / sin(B))); elseif (F <= -2.4e-98) tmp = Float64(Float64(-Float64(x / B)) + Float64(Float64(F / sin(B)) * (fma(F, F, 2.0) ^ -0.5))); elseif (F <= 1750.0) tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64((Float64(fma(F, F, Float64(x + x)) + 2.0) ^ -0.5) * F) / B)); else tmp = Float64(Float64(Float64(Float64(1.0 / F) * F) - Float64(cos(B) * x)) / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -140.0], (-N[(N[(1.0 + N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, -2.4e-98], N[((-N[(x / B), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(F * F + 2.0), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1750.0], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(N[Power[N[(N[(F * F + N[(x + x), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(1.0 / F), $MachinePrecision] * F), $MachinePrecision] - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -140:\\
\;\;\;\;-\frac{1 + x \cdot \cos B}{\sin B}\\
\mathbf{elif}\;F \leq -2.4 \cdot 10^{-98}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-0.5}\\
\mathbf{elif}\;F \leq 1750:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{{\left(\mathsf{fma}\left(F, F, x + x\right) + 2\right)}^{-0.5} \cdot F}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{F} \cdot F - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -140Initial program 75.6%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sin.f6450.4
Applied rewrites50.4%
Taylor expanded in F around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lift-cos.f64N/A
lift-sin.f6456.2
Applied rewrites56.2%
if -140 < F < -2.40000000000000005e-98Initial program 75.6%
Taylor expanded in x around 0
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f64N/A
metadata-evalN/A
metadata-eval75.6
Applied rewrites75.6%
Taylor expanded in B around 0
lower-/.f6449.3
Applied rewrites49.3%
if -2.40000000000000005e-98 < F < 1750Initial program 75.6%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites70.3%
if 1750 < F Initial program 75.6%
Taylor expanded in B around inf
metadata-evalN/A
metadata-evalN/A
sub-divN/A
lower-/.f64N/A
Applied rewrites84.7%
Taylor expanded in F around inf
lower-/.f6456.0
Applied rewrites56.0%
(FPCore (F B x)
:precision binary64
(if (<= F -140.0)
(- (/ (+ 1.0 (* x (cos B))) (sin B)))
(if (<= F -2.4e-98)
(+ (- (/ x B)) (* (/ F (sin B)) (pow (fma F F 2.0) -0.5)))
(if (<= F 1.1e+233)
(+
(- (* x (/ 1.0 (tan B))))
(/ (* (pow (+ (fma F F (+ x x)) 2.0) -0.5) F) B))
(/ 1.0 (sin B))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -140.0) {
tmp = -((1.0 + (x * cos(B))) / sin(B));
} else if (F <= -2.4e-98) {
tmp = -(x / B) + ((F / sin(B)) * pow(fma(F, F, 2.0), -0.5));
} else if (F <= 1.1e+233) {
tmp = -(x * (1.0 / tan(B))) + ((pow((fma(F, F, (x + x)) + 2.0), -0.5) * F) / B);
} else {
tmp = 1.0 / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -140.0) tmp = Float64(-Float64(Float64(1.0 + Float64(x * cos(B))) / sin(B))); elseif (F <= -2.4e-98) tmp = Float64(Float64(-Float64(x / B)) + Float64(Float64(F / sin(B)) * (fma(F, F, 2.0) ^ -0.5))); elseif (F <= 1.1e+233) tmp = Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64((Float64(fma(F, F, Float64(x + x)) + 2.0) ^ -0.5) * F) / B)); else tmp = Float64(1.0 / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -140.0], (-N[(N[(1.0 + N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, -2.4e-98], N[((-N[(x / B), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(F * F + 2.0), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.1e+233], N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(N[Power[N[(N[(F * F + N[(x + x), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -140:\\
\;\;\;\;-\frac{1 + x \cdot \cos B}{\sin B}\\
\mathbf{elif}\;F \leq -2.4 \cdot 10^{-98}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-0.5}\\
\mathbf{elif}\;F \leq 1.1 \cdot 10^{+233}:\\
\;\;\;\;\left(-x \cdot \frac{1}{\tan B}\right) + \frac{{\left(\mathsf{fma}\left(F, F, x + x\right) + 2\right)}^{-0.5} \cdot F}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -140Initial program 75.6%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sin.f6450.4
Applied rewrites50.4%
Taylor expanded in F around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lift-cos.f64N/A
lift-sin.f6456.2
Applied rewrites56.2%
if -140 < F < -2.40000000000000005e-98Initial program 75.6%
Taylor expanded in x around 0
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f64N/A
metadata-evalN/A
metadata-eval75.6
Applied rewrites75.6%
Taylor expanded in B around 0
lower-/.f6449.3
Applied rewrites49.3%
if -2.40000000000000005e-98 < F < 1.09999999999999999e233Initial program 75.6%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites70.3%
if 1.09999999999999999e233 < F Initial program 75.6%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6417.0
Applied rewrites17.0%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (+ (- (/ x B)) (* (/ F (sin B)) (pow (fma F F 2.0) -0.5))))
(t_1 (* x (cos B))))
(if (<= F -140.0)
(- (/ (+ 1.0 t_1) (sin B)))
(if (<= F -6e-187)
t_0
(if (<= F 6.2e-175)
(- (/ x (tan B)))
(if (<= F 2.25e+95)
t_0
(/ (* F (fma -1.0 (/ t_1 F) (/ 1.0 F))) B)))))))
double code(double F, double B, double x) {
double t_0 = -(x / B) + ((F / sin(B)) * pow(fma(F, F, 2.0), -0.5));
double t_1 = x * cos(B);
double tmp;
if (F <= -140.0) {
tmp = -((1.0 + t_1) / sin(B));
} else if (F <= -6e-187) {
tmp = t_0;
} else if (F <= 6.2e-175) {
tmp = -(x / tan(B));
} else if (F <= 2.25e+95) {
tmp = t_0;
} else {
tmp = (F * fma(-1.0, (t_1 / F), (1.0 / F))) / B;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(Float64(-Float64(x / B)) + Float64(Float64(F / sin(B)) * (fma(F, F, 2.0) ^ -0.5))) t_1 = Float64(x * cos(B)) tmp = 0.0 if (F <= -140.0) tmp = Float64(-Float64(Float64(1.0 + t_1) / sin(B))); elseif (F <= -6e-187) tmp = t_0; elseif (F <= 6.2e-175) tmp = Float64(-Float64(x / tan(B))); elseif (F <= 2.25e+95) tmp = t_0; else tmp = Float64(Float64(F * fma(-1.0, Float64(t_1 / F), Float64(1.0 / F))) / B); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[((-N[(x / B), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(F * F + 2.0), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -140.0], (-N[(N[(1.0 + t$95$1), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, -6e-187], t$95$0, If[LessEqual[F, 6.2e-175], (-N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]), If[LessEqual[F, 2.25e+95], t$95$0, N[(N[(F * N[(-1.0 * N[(t$95$1 / F), $MachinePrecision] + N[(1.0 / F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(-\frac{x}{B}\right) + \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-0.5}\\
t_1 := x \cdot \cos B\\
\mathbf{if}\;F \leq -140:\\
\;\;\;\;-\frac{1 + t\_1}{\sin B}\\
\mathbf{elif}\;F \leq -6 \cdot 10^{-187}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;F \leq 6.2 \cdot 10^{-175}:\\
\;\;\;\;-\frac{x}{\tan B}\\
\mathbf{elif}\;F \leq 2.25 \cdot 10^{+95}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{F \cdot \mathsf{fma}\left(-1, \frac{t\_1}{F}, \frac{1}{F}\right)}{B}\\
\end{array}
\end{array}
if F < -140Initial program 75.6%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sin.f6450.4
Applied rewrites50.4%
Taylor expanded in F around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lift-cos.f64N/A
lift-sin.f6456.2
Applied rewrites56.2%
if -140 < F < -6.00000000000000008e-187 or 6.19999999999999997e-175 < F < 2.25000000000000008e95Initial program 75.6%
Taylor expanded in x around 0
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f64N/A
metadata-evalN/A
metadata-eval75.6
Applied rewrites75.6%
Taylor expanded in B around 0
lower-/.f6449.3
Applied rewrites49.3%
if -6.00000000000000008e-187 < F < 6.19999999999999997e-175Initial program 75.6%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f64N/A
associate-/l*N/A
div-flipN/A
quot-tanN/A
mult-flip-revN/A
lower-/.f64N/A
lift-tan.f6455.3
Applied rewrites55.3%
if 2.25000000000000008e95 < F Initial program 75.6%
Taylor expanded in B around inf
metadata-evalN/A
metadata-evalN/A
sub-divN/A
lower-/.f64N/A
Applied rewrites84.7%
Taylor expanded in F around inf
Applied rewrites17.0%
Taylor expanded in B around 0
Applied rewrites10.3%
Taylor expanded in F around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift-cos.f64N/A
lower-/.f6429.7
Applied rewrites29.7%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (- (/ x (tan B)))))
(if (<= x -4e-84)
t_0
(if (<= x 4e-67)
(+ (- (/ x B)) (* (/ F (sin B)) (pow (fma F F 2.0) -0.5)))
t_0))))
double code(double F, double B, double x) {
double t_0 = -(x / tan(B));
double tmp;
if (x <= -4e-84) {
tmp = t_0;
} else if (x <= 4e-67) {
tmp = -(x / B) + ((F / sin(B)) * pow(fma(F, F, 2.0), -0.5));
} else {
tmp = t_0;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(-Float64(x / tan(B))) tmp = 0.0 if (x <= -4e-84) tmp = t_0; elseif (x <= 4e-67) tmp = Float64(Float64(-Float64(x / B)) + Float64(Float64(F / sin(B)) * (fma(F, F, 2.0) ^ -0.5))); 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, -4e-84], t$95$0, If[LessEqual[x, 4e-67], N[((-N[(x / B), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(F * F + 2.0), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -\frac{x}{\tan B}\\
\mathbf{if}\;x \leq -4 \cdot 10^{-84}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 4 \cdot 10^{-67}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -4.0000000000000001e-84 or 3.99999999999999977e-67 < x Initial program 75.6%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f64N/A
associate-/l*N/A
div-flipN/A
quot-tanN/A
mult-flip-revN/A
lower-/.f64N/A
lift-tan.f6455.3
Applied rewrites55.3%
if -4.0000000000000001e-84 < x < 3.99999999999999977e-67Initial program 75.6%
Taylor expanded in x around 0
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f64N/A
metadata-evalN/A
metadata-eval75.6
Applied rewrites75.6%
Taylor expanded in B around 0
lower-/.f6449.3
Applied rewrites49.3%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (- (/ x (tan B)))))
(if (<= x -3.2e-84)
t_0
(if (<= x 1.35e-89)
(/ 1.0 (/ (sin B) (* F (pow (+ 2.0 (* F F)) -0.5))))
t_0))))
double code(double F, double B, double x) {
double t_0 = -(x / tan(B));
double tmp;
if (x <= -3.2e-84) {
tmp = t_0;
} else if (x <= 1.35e-89) {
tmp = 1.0 / (sin(B) / (F * pow((2.0 + (F * F)), -0.5)));
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = -(x / tan(b))
if (x <= (-3.2d-84)) then
tmp = t_0
else if (x <= 1.35d-89) then
tmp = 1.0d0 / (sin(b) / (f * ((2.0d0 + (f * f)) ** (-0.5d0))))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = -(x / Math.tan(B));
double tmp;
if (x <= -3.2e-84) {
tmp = t_0;
} else if (x <= 1.35e-89) {
tmp = 1.0 / (Math.sin(B) / (F * Math.pow((2.0 + (F * F)), -0.5)));
} else {
tmp = t_0;
}
return tmp;
}
def code(F, B, x): t_0 = -(x / math.tan(B)) tmp = 0 if x <= -3.2e-84: tmp = t_0 elif x <= 1.35e-89: tmp = 1.0 / (math.sin(B) / (F * math.pow((2.0 + (F * F)), -0.5))) else: tmp = t_0 return tmp
function code(F, B, x) t_0 = Float64(-Float64(x / tan(B))) tmp = 0.0 if (x <= -3.2e-84) tmp = t_0; elseif (x <= 1.35e-89) tmp = Float64(1.0 / Float64(sin(B) / Float64(F * (Float64(2.0 + Float64(F * F)) ^ -0.5)))); else tmp = t_0; end return tmp end
function tmp_2 = code(F, B, x) t_0 = -(x / tan(B)); tmp = 0.0; if (x <= -3.2e-84) tmp = t_0; elseif (x <= 1.35e-89) tmp = 1.0 / (sin(B) / (F * ((2.0 + (F * F)) ^ -0.5))); else tmp = t_0; end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = (-N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision])}, If[LessEqual[x, -3.2e-84], t$95$0, If[LessEqual[x, 1.35e-89], N[(1.0 / N[(N[Sin[B], $MachinePrecision] / N[(F * N[Power[N[(2.0 + N[(F * F), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -\frac{x}{\tan B}\\
\mathbf{if}\;x \leq -3.2 \cdot 10^{-84}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{-89}:\\
\;\;\;\;\frac{1}{\frac{\sin B}{F \cdot {\left(2 + F \cdot F\right)}^{-0.5}}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -3.1999999999999999e-84 or 1.34999999999999994e-89 < x Initial program 75.6%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f64N/A
associate-/l*N/A
div-flipN/A
quot-tanN/A
mult-flip-revN/A
lower-/.f64N/A
lift-tan.f6455.3
Applied rewrites55.3%
if -3.1999999999999999e-84 < x < 1.34999999999999994e-89Initial program 75.6%
Taylor expanded in B around inf
metadata-evalN/A
metadata-evalN/A
sub-divN/A
lower-/.f64N/A
Applied rewrites84.7%
Applied rewrites84.6%
Taylor expanded in x around 0
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
pow2N/A
lower-*.f64N/A
metadata-evalN/A
metadata-eval30.8
Applied rewrites30.8%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (- (/ x (tan B)))))
(if (<= x -3.2e-84)
t_0
(if (<= x 1.35e-89) (/ (* (pow (fma F F 2.0) -0.5) F) (sin B)) t_0))))
double code(double F, double B, double x) {
double t_0 = -(x / tan(B));
double tmp;
if (x <= -3.2e-84) {
tmp = t_0;
} else if (x <= 1.35e-89) {
tmp = (pow(fma(F, F, 2.0), -0.5) * F) / sin(B);
} else {
tmp = t_0;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(-Float64(x / tan(B))) tmp = 0.0 if (x <= -3.2e-84) tmp = t_0; elseif (x <= 1.35e-89) tmp = Float64(Float64((fma(F, F, 2.0) ^ -0.5) * F) / sin(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, -3.2e-84], t$95$0, If[LessEqual[x, 1.35e-89], N[(N[(N[Power[N[(F * F + 2.0), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -\frac{x}{\tan B}\\
\mathbf{if}\;x \leq -3.2 \cdot 10^{-84}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{-89}:\\
\;\;\;\;\frac{{\left(\mathsf{fma}\left(F, F, 2\right)\right)}^{-0.5} \cdot F}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -3.1999999999999999e-84 or 1.34999999999999994e-89 < x Initial program 75.6%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f64N/A
associate-/l*N/A
div-flipN/A
quot-tanN/A
mult-flip-revN/A
lower-/.f64N/A
lift-tan.f6455.3
Applied rewrites55.3%
if -3.1999999999999999e-84 < x < 1.34999999999999994e-89Initial program 75.6%
Taylor expanded in x around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f64N/A
metadata-evalN/A
metadata-evalN/A
lift-sin.f6430.8
Applied rewrites30.8%
(FPCore (F B x) :precision binary64 (if (<= B 4.3e-11) (/ (- (* (pow (+ (fma F F (+ x x)) 2.0) -0.5) F) x) B) (- (/ x (tan B)))))
double code(double F, double B, double x) {
double tmp;
if (B <= 4.3e-11) {
tmp = ((pow((fma(F, F, (x + x)) + 2.0), -0.5) * F) - x) / B;
} else {
tmp = -(x / tan(B));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (B <= 4.3e-11) tmp = Float64(Float64(Float64((Float64(fma(F, F, Float64(x + x)) + 2.0) ^ -0.5) * F) - x) / B); else tmp = Float64(-Float64(x / tan(B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[B, 4.3e-11], N[(N[(N[(N[Power[N[(N[(F * F + N[(x + x), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], (-N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision])]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 4.3 \cdot 10^{-11}:\\
\;\;\;\;\frac{{\left(\mathsf{fma}\left(F, F, x + x\right) + 2\right)}^{-0.5} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;-\frac{x}{\tan B}\\
\end{array}
\end{array}
if B < 4.30000000000000001e-11Initial program 75.6%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites44.9%
if 4.30000000000000001e-11 < B Initial program 75.6%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f64N/A
associate-/l*N/A
div-flipN/A
quot-tanN/A
mult-flip-revN/A
lower-/.f64N/A
lift-tan.f6455.3
Applied rewrites55.3%
(FPCore (F B x)
:precision binary64
(if (<= F -3.9e+154)
(/
(-
(*
(* B B)
(- (* -0.16666666666666666 x) (+ 0.16666666666666666 (* -0.5 x))))
(+ 1.0 x))
B)
(if (<= F 550000.0)
(/ (- (* (pow (+ (fma F F (+ x x)) 2.0) -0.5) F) x) B)
(/ 1.0 (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.9e+154) {
tmp = (((B * B) * ((-0.16666666666666666 * x) - (0.16666666666666666 + (-0.5 * x)))) - (1.0 + x)) / B;
} else if (F <= 550000.0) {
tmp = ((pow((fma(F, F, (x + x)) + 2.0), -0.5) * F) - x) / B;
} else {
tmp = 1.0 / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -3.9e+154) tmp = Float64(Float64(Float64(Float64(B * B) * Float64(Float64(-0.16666666666666666 * x) - Float64(0.16666666666666666 + Float64(-0.5 * x)))) - Float64(1.0 + x)) / B); elseif (F <= 550000.0) tmp = Float64(Float64(Float64((Float64(fma(F, F, Float64(x + x)) + 2.0) ^ -0.5) * F) - x) / B); else tmp = Float64(1.0 / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -3.9e+154], N[(N[(N[(N[(B * B), $MachinePrecision] * N[(N[(-0.16666666666666666 * x), $MachinePrecision] - N[(0.16666666666666666 + N[(-0.5 * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(1.0 + x), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 550000.0], N[(N[(N[(N[Power[N[(N[(F * F + N[(x + x), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision], -0.5], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.9 \cdot 10^{+154}:\\
\;\;\;\;\frac{\left(B \cdot B\right) \cdot \left(-0.16666666666666666 \cdot x - \left(0.16666666666666666 + -0.5 \cdot x\right)\right) - \left(1 + x\right)}{B}\\
\mathbf{elif}\;F \leq 550000:\\
\;\;\;\;\frac{{\left(\mathsf{fma}\left(F, F, x + x\right) + 2\right)}^{-0.5} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -3.9000000000000003e154Initial program 75.6%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sin.f6450.4
Applied rewrites50.4%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites30.0%
if -3.9000000000000003e154 < F < 5.5e5Initial program 75.6%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites44.9%
if 5.5e5 < F Initial program 75.6%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6417.0
Applied rewrites17.0%
(FPCore (F B x)
:precision binary64
(if (<= F -22000000000.0)
(/
(-
(*
(* B B)
(- (* -0.16666666666666666 x) (+ 0.16666666666666666 (* -0.5 x))))
(+ 1.0 x))
B)
(if (<= F 35.0)
(/ (- (* F (pow (+ 2.0 (* 2.0 x)) -0.5)) x) B)
(/ 1.0 (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -22000000000.0) {
tmp = (((B * B) * ((-0.16666666666666666 * x) - (0.16666666666666666 + (-0.5 * x)))) - (1.0 + x)) / B;
} else if (F <= 35.0) {
tmp = ((F * pow((2.0 + (2.0 * x)), -0.5)) - x) / 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 <= (-22000000000.0d0)) then
tmp = (((b * b) * (((-0.16666666666666666d0) * x) - (0.16666666666666666d0 + ((-0.5d0) * x)))) - (1.0d0 + x)) / b
else if (f <= 35.0d0) then
tmp = ((f * ((2.0d0 + (2.0d0 * x)) ** (-0.5d0))) - x) / 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 <= -22000000000.0) {
tmp = (((B * B) * ((-0.16666666666666666 * x) - (0.16666666666666666 + (-0.5 * x)))) - (1.0 + x)) / B;
} else if (F <= 35.0) {
tmp = ((F * Math.pow((2.0 + (2.0 * x)), -0.5)) - x) / B;
} else {
tmp = 1.0 / Math.sin(B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -22000000000.0: tmp = (((B * B) * ((-0.16666666666666666 * x) - (0.16666666666666666 + (-0.5 * x)))) - (1.0 + x)) / B elif F <= 35.0: tmp = ((F * math.pow((2.0 + (2.0 * x)), -0.5)) - x) / B else: tmp = 1.0 / math.sin(B) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -22000000000.0) tmp = Float64(Float64(Float64(Float64(B * B) * Float64(Float64(-0.16666666666666666 * x) - Float64(0.16666666666666666 + Float64(-0.5 * x)))) - Float64(1.0 + x)) / B); elseif (F <= 35.0) tmp = Float64(Float64(Float64(F * (Float64(2.0 + Float64(2.0 * x)) ^ -0.5)) - x) / B); else tmp = Float64(1.0 / sin(B)); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -22000000000.0) tmp = (((B * B) * ((-0.16666666666666666 * x) - (0.16666666666666666 + (-0.5 * x)))) - (1.0 + x)) / B; elseif (F <= 35.0) tmp = ((F * ((2.0 + (2.0 * x)) ^ -0.5)) - x) / B; else tmp = 1.0 / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -22000000000.0], N[(N[(N[(N[(B * B), $MachinePrecision] * N[(N[(-0.16666666666666666 * x), $MachinePrecision] - N[(0.16666666666666666 + N[(-0.5 * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(1.0 + x), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 35.0], N[(N[(N[(F * N[Power[N[(2.0 + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -22000000000:\\
\;\;\;\;\frac{\left(B \cdot B\right) \cdot \left(-0.16666666666666666 \cdot x - \left(0.16666666666666666 + -0.5 \cdot x\right)\right) - \left(1 + x\right)}{B}\\
\mathbf{elif}\;F \leq 35:\\
\;\;\;\;\frac{F \cdot {\left(2 + 2 \cdot x\right)}^{-0.5} - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -2.2e10Initial program 75.6%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sin.f6450.4
Applied rewrites50.4%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites30.0%
if -2.2e10 < F < 35Initial program 75.6%
Taylor expanded in F around 0
metadata-evalN/A
metadata-evalN/A
sub-divN/A
lower-/.f64N/A
Applied rewrites55.2%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lift-*.f64N/A
metadata-evalN/A
metadata-eval29.6
Applied rewrites29.6%
if 35 < F Initial program 75.6%
Taylor expanded in F around inf
lower-/.f64N/A
lift-sin.f6417.0
Applied rewrites17.0%
(FPCore (F B x)
:precision binary64
(if (<= F -22000000000.0)
(/
(-
(*
(* B B)
(- (* -0.16666666666666666 x) (+ 0.16666666666666666 (* -0.5 x))))
(+ 1.0 x))
B)
(if (<= F 1.15e+120)
(/ (- (* F (pow (+ 2.0 (* 2.0 x)) -0.5)) x) B)
(/ 1.0 (* B (+ 1.0 (* -0.16666666666666666 (* B B))))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -22000000000.0) {
tmp = (((B * B) * ((-0.16666666666666666 * x) - (0.16666666666666666 + (-0.5 * x)))) - (1.0 + x)) / B;
} else if (F <= 1.15e+120) {
tmp = ((F * pow((2.0 + (2.0 * x)), -0.5)) - x) / B;
} else {
tmp = 1.0 / (B * (1.0 + (-0.16666666666666666 * (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 (f <= (-22000000000.0d0)) then
tmp = (((b * b) * (((-0.16666666666666666d0) * x) - (0.16666666666666666d0 + ((-0.5d0) * x)))) - (1.0d0 + x)) / b
else if (f <= 1.15d+120) then
tmp = ((f * ((2.0d0 + (2.0d0 * x)) ** (-0.5d0))) - x) / b
else
tmp = 1.0d0 / (b * (1.0d0 + ((-0.16666666666666666d0) * (b * b))))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -22000000000.0) {
tmp = (((B * B) * ((-0.16666666666666666 * x) - (0.16666666666666666 + (-0.5 * x)))) - (1.0 + x)) / B;
} else if (F <= 1.15e+120) {
tmp = ((F * Math.pow((2.0 + (2.0 * x)), -0.5)) - x) / B;
} else {
tmp = 1.0 / (B * (1.0 + (-0.16666666666666666 * (B * B))));
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -22000000000.0: tmp = (((B * B) * ((-0.16666666666666666 * x) - (0.16666666666666666 + (-0.5 * x)))) - (1.0 + x)) / B elif F <= 1.15e+120: tmp = ((F * math.pow((2.0 + (2.0 * x)), -0.5)) - x) / B else: tmp = 1.0 / (B * (1.0 + (-0.16666666666666666 * (B * B)))) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -22000000000.0) tmp = Float64(Float64(Float64(Float64(B * B) * Float64(Float64(-0.16666666666666666 * x) - Float64(0.16666666666666666 + Float64(-0.5 * x)))) - Float64(1.0 + x)) / B); elseif (F <= 1.15e+120) tmp = Float64(Float64(Float64(F * (Float64(2.0 + Float64(2.0 * x)) ^ -0.5)) - x) / B); else tmp = Float64(1.0 / Float64(B * Float64(1.0 + Float64(-0.16666666666666666 * Float64(B * B))))); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -22000000000.0) tmp = (((B * B) * ((-0.16666666666666666 * x) - (0.16666666666666666 + (-0.5 * x)))) - (1.0 + x)) / B; elseif (F <= 1.15e+120) tmp = ((F * ((2.0 + (2.0 * x)) ^ -0.5)) - x) / B; else tmp = 1.0 / (B * (1.0 + (-0.16666666666666666 * (B * B)))); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -22000000000.0], N[(N[(N[(N[(B * B), $MachinePrecision] * N[(N[(-0.16666666666666666 * x), $MachinePrecision] - N[(0.16666666666666666 + N[(-0.5 * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(1.0 + x), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 1.15e+120], N[(N[(N[(F * N[Power[N[(2.0 + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(1.0 / N[(B * N[(1.0 + N[(-0.16666666666666666 * N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -22000000000:\\
\;\;\;\;\frac{\left(B \cdot B\right) \cdot \left(-0.16666666666666666 \cdot x - \left(0.16666666666666666 + -0.5 \cdot x\right)\right) - \left(1 + x\right)}{B}\\
\mathbf{elif}\;F \leq 1.15 \cdot 10^{+120}:\\
\;\;\;\;\frac{F \cdot {\left(2 + 2 \cdot x\right)}^{-0.5} - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{B \cdot \left(1 + -0.16666666666666666 \cdot \left(B \cdot B\right)\right)}\\
\end{array}
\end{array}
if F < -2.2e10Initial program 75.6%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sin.f6450.4
Applied rewrites50.4%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites30.0%
if -2.2e10 < F < 1.14999999999999996e120Initial program 75.6%
Taylor expanded in F around 0
metadata-evalN/A
metadata-evalN/A
sub-divN/A
lower-/.f64N/A
Applied rewrites55.2%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lift-*.f64N/A
metadata-evalN/A
metadata-eval29.6
Applied rewrites29.6%
if 1.14999999999999996e120 < F Initial program 75.6%
Taylor expanded in B around inf
metadata-evalN/A
metadata-evalN/A
sub-divN/A
lower-/.f64N/A
Applied rewrites84.7%
Taylor expanded in F around inf
Applied rewrites17.0%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6410.2
Applied rewrites10.2%
(FPCore (F B x)
:precision binary64
(if (<= x -3.2e-95)
(/
(-
(*
(* B B)
(- (* -0.16666666666666666 x) (+ 0.16666666666666666 (* -0.5 x))))
(+ 1.0 x))
B)
(if (<= x 1.5e-111)
(/ (* F (pow (+ 2.0 (* F F)) -0.5)) B)
(- (/ (+ 1.0 x) B)))))
double code(double F, double B, double x) {
double tmp;
if (x <= -3.2e-95) {
tmp = (((B * B) * ((-0.16666666666666666 * x) - (0.16666666666666666 + (-0.5 * x)))) - (1.0 + x)) / B;
} else if (x <= 1.5e-111) {
tmp = (F * pow((2.0 + (F * F)), -0.5)) / B;
} else {
tmp = -((1.0 + x) / B);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-3.2d-95)) then
tmp = (((b * b) * (((-0.16666666666666666d0) * x) - (0.16666666666666666d0 + ((-0.5d0) * x)))) - (1.0d0 + x)) / b
else if (x <= 1.5d-111) then
tmp = (f * ((2.0d0 + (f * f)) ** (-0.5d0))) / b
else
tmp = -((1.0d0 + x) / b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (x <= -3.2e-95) {
tmp = (((B * B) * ((-0.16666666666666666 * x) - (0.16666666666666666 + (-0.5 * x)))) - (1.0 + x)) / B;
} else if (x <= 1.5e-111) {
tmp = (F * Math.pow((2.0 + (F * F)), -0.5)) / B;
} else {
tmp = -((1.0 + x) / B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if x <= -3.2e-95: tmp = (((B * B) * ((-0.16666666666666666 * x) - (0.16666666666666666 + (-0.5 * x)))) - (1.0 + x)) / B elif x <= 1.5e-111: tmp = (F * math.pow((2.0 + (F * F)), -0.5)) / B else: tmp = -((1.0 + x) / B) return tmp
function code(F, B, x) tmp = 0.0 if (x <= -3.2e-95) tmp = Float64(Float64(Float64(Float64(B * B) * Float64(Float64(-0.16666666666666666 * x) - Float64(0.16666666666666666 + Float64(-0.5 * x)))) - Float64(1.0 + x)) / B); elseif (x <= 1.5e-111) tmp = Float64(Float64(F * (Float64(2.0 + Float64(F * F)) ^ -0.5)) / B); else tmp = Float64(-Float64(Float64(1.0 + x) / B)); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (x <= -3.2e-95) tmp = (((B * B) * ((-0.16666666666666666 * x) - (0.16666666666666666 + (-0.5 * x)))) - (1.0 + x)) / B; elseif (x <= 1.5e-111) tmp = (F * ((2.0 + (F * F)) ^ -0.5)) / B; else tmp = -((1.0 + x) / B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[x, -3.2e-95], N[(N[(N[(N[(B * B), $MachinePrecision] * N[(N[(-0.16666666666666666 * x), $MachinePrecision] - N[(0.16666666666666666 + N[(-0.5 * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(1.0 + x), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[x, 1.5e-111], N[(N[(F * N[Power[N[(2.0 + N[(F * F), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], (-N[(N[(1.0 + x), $MachinePrecision] / B), $MachinePrecision])]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.2 \cdot 10^{-95}:\\
\;\;\;\;\frac{\left(B \cdot B\right) \cdot \left(-0.16666666666666666 \cdot x - \left(0.16666666666666666 + -0.5 \cdot x\right)\right) - \left(1 + x\right)}{B}\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{-111}:\\
\;\;\;\;\frac{F \cdot {\left(2 + F \cdot F\right)}^{-0.5}}{B}\\
\mathbf{else}:\\
\;\;\;\;-\frac{1 + x}{B}\\
\end{array}
\end{array}
if x < -3.1999999999999997e-95Initial program 75.6%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sin.f6450.4
Applied rewrites50.4%
Taylor expanded in B around 0
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
Applied rewrites30.0%
if -3.1999999999999997e-95 < x < 1.50000000000000004e-111Initial program 75.6%
Taylor expanded in B around inf
metadata-evalN/A
metadata-evalN/A
sub-divN/A
lower-/.f64N/A
Applied rewrites84.7%
Taylor expanded in F around inf
Applied rewrites17.0%
Taylor expanded in B around 0
Applied rewrites10.3%
Taylor expanded in x around 0
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
pow2N/A
lower-*.f64N/A
metadata-evalN/A
metadata-eval17.2
Applied rewrites17.2%
if 1.50000000000000004e-111 < x Initial program 75.6%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sin.f6450.4
Applied rewrites50.4%
Taylor expanded in B around 0
lower-/.f64N/A
lower-+.f6430.3
Applied rewrites30.3%
(FPCore (F B x) :precision binary64 (if (<= F 2.5e+115) (- (/ (+ 1.0 x) B)) (/ 1.0 (* B (+ 1.0 (* -0.16666666666666666 (* B B)))))))
double code(double F, double B, double x) {
double tmp;
if (F <= 2.5e+115) {
tmp = -((1.0 + x) / B);
} else {
tmp = 1.0 / (B * (1.0 + (-0.16666666666666666 * (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 (f <= 2.5d+115) then
tmp = -((1.0d0 + x) / b)
else
tmp = 1.0d0 / (b * (1.0d0 + ((-0.16666666666666666d0) * (b * b))))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= 2.5e+115) {
tmp = -((1.0 + x) / B);
} else {
tmp = 1.0 / (B * (1.0 + (-0.16666666666666666 * (B * B))));
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= 2.5e+115: tmp = -((1.0 + x) / B) else: tmp = 1.0 / (B * (1.0 + (-0.16666666666666666 * (B * B)))) return tmp
function code(F, B, x) tmp = 0.0 if (F <= 2.5e+115) tmp = Float64(-Float64(Float64(1.0 + x) / B)); else tmp = Float64(1.0 / Float64(B * Float64(1.0 + Float64(-0.16666666666666666 * Float64(B * B))))); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= 2.5e+115) tmp = -((1.0 + x) / B); else tmp = 1.0 / (B * (1.0 + (-0.16666666666666666 * (B * B)))); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, 2.5e+115], (-N[(N[(1.0 + x), $MachinePrecision] / B), $MachinePrecision]), N[(1.0 / N[(B * N[(1.0 + N[(-0.16666666666666666 * N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq 2.5 \cdot 10^{+115}:\\
\;\;\;\;-\frac{1 + x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{B \cdot \left(1 + -0.16666666666666666 \cdot \left(B \cdot B\right)\right)}\\
\end{array}
\end{array}
if F < 2.50000000000000004e115Initial program 75.6%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sin.f6450.4
Applied rewrites50.4%
Taylor expanded in B around 0
lower-/.f64N/A
lower-+.f6430.3
Applied rewrites30.3%
if 2.50000000000000004e115 < F Initial program 75.6%
Taylor expanded in B around inf
metadata-evalN/A
metadata-evalN/A
sub-divN/A
lower-/.f64N/A
Applied rewrites84.7%
Taylor expanded in F around inf
Applied rewrites17.0%
Taylor expanded in B around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6410.2
Applied rewrites10.2%
(FPCore (F B x) :precision binary64 (if (<= F 2.5e+115) (- (/ (+ 1.0 x) B)) (/ 1.0 B)))
double code(double F, double B, double x) {
double tmp;
if (F <= 2.5e+115) {
tmp = -((1.0 + x) / B);
} else {
tmp = 1.0 / B;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= 2.5d+115) then
tmp = -((1.0d0 + x) / b)
else
tmp = 1.0d0 / b
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= 2.5e+115) {
tmp = -((1.0 + x) / B);
} else {
tmp = 1.0 / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= 2.5e+115: tmp = -((1.0 + x) / B) else: tmp = 1.0 / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= 2.5e+115) tmp = Float64(-Float64(Float64(1.0 + x) / B)); else tmp = Float64(1.0 / B); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= 2.5e+115) tmp = -((1.0 + x) / B); else tmp = 1.0 / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, 2.5e+115], (-N[(N[(1.0 + x), $MachinePrecision] / B), $MachinePrecision]), N[(1.0 / B), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq 2.5 \cdot 10^{+115}:\\
\;\;\;\;-\frac{1 + x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{B}\\
\end{array}
\end{array}
if F < 2.50000000000000004e115Initial program 75.6%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sin.f6450.4
Applied rewrites50.4%
Taylor expanded in B around 0
lower-/.f64N/A
lower-+.f6430.3
Applied rewrites30.3%
if 2.50000000000000004e115 < F Initial program 75.6%
Taylor expanded in B around inf
metadata-evalN/A
metadata-evalN/A
sub-divN/A
lower-/.f64N/A
Applied rewrites84.7%
Taylor expanded in F around inf
Applied rewrites17.0%
Taylor expanded in B around 0
Applied rewrites10.3%
(FPCore (F B x) :precision binary64 (if (<= F 9.5e-138) (/ -1.0 B) (/ 1.0 B)))
double code(double F, double B, double x) {
double tmp;
if (F <= 9.5e-138) {
tmp = -1.0 / B;
} else {
tmp = 1.0 / B;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= 9.5d-138) then
tmp = (-1.0d0) / b
else
tmp = 1.0d0 / b
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= 9.5e-138) {
tmp = -1.0 / B;
} else {
tmp = 1.0 / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= 9.5e-138: tmp = -1.0 / B else: tmp = 1.0 / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= 9.5e-138) tmp = Float64(-1.0 / B); else tmp = Float64(1.0 / B); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= 9.5e-138) tmp = -1.0 / B; else tmp = 1.0 / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, 9.5e-138], N[(-1.0 / B), $MachinePrecision], N[(1.0 / B), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq 9.5 \cdot 10^{-138}:\\
\;\;\;\;\frac{-1}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{B}\\
\end{array}
\end{array}
if F < 9.49999999999999997e-138Initial program 75.6%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6417.5
Applied rewrites17.5%
Taylor expanded in B around 0
lower-/.f6410.5
Applied rewrites10.5%
if 9.49999999999999997e-138 < F Initial program 75.6%
Taylor expanded in B around inf
metadata-evalN/A
metadata-evalN/A
sub-divN/A
lower-/.f64N/A
Applied rewrites84.7%
Taylor expanded in F around inf
Applied rewrites17.0%
Taylor expanded in B around 0
Applied rewrites10.3%
(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 75.6%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6417.5
Applied rewrites17.5%
Taylor expanded in B around 0
lower-/.f6410.5
Applied rewrites10.5%
herbie shell --seed 2025140
(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))))))