
(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 17 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 (* F (sin B))))
(if (<= F -7.1e+127)
(/ -1.0 (sin B))
(if (<= F 3200000000000.0)
(fma
(/ F (sin B))
(pow (fma 2.0 x (fma F F 2.0)) (- 0.5))
(- (/ x (tan B))))
(* F (fma -1.0 (/ (* x (cos B)) t_0) (/ 1.0 t_0)))))))
double code(double F, double B, double x) {
double t_0 = F * sin(B);
double tmp;
if (F <= -7.1e+127) {
tmp = -1.0 / sin(B);
} else if (F <= 3200000000000.0) {
tmp = fma((F / sin(B)), pow(fma(2.0, x, fma(F, F, 2.0)), -0.5), -(x / tan(B)));
} else {
tmp = F * fma(-1.0, ((x * cos(B)) / t_0), (1.0 / t_0));
}
return tmp;
}
function code(F, B, x) t_0 = Float64(F * sin(B)) tmp = 0.0 if (F <= -7.1e+127) tmp = Float64(-1.0 / sin(B)); elseif (F <= 3200000000000.0) tmp = fma(Float64(F / sin(B)), (fma(2.0, x, fma(F, F, 2.0)) ^ Float64(-0.5)), Float64(-Float64(x / tan(B)))); else tmp = Float64(F * fma(-1.0, Float64(Float64(x * cos(B)) / t_0), Float64(1.0 / t_0))); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(F * N[Sin[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -7.1e+127], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 3200000000000.0], N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], (-0.5)], $MachinePrecision] + (-N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision])), $MachinePrecision], N[(F * N[(-1.0 * N[(N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision] + N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := F \cdot \sin B\\
\mathbf{if}\;F \leq -7.1 \cdot 10^{+127}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 3200000000000:\\
\;\;\;\;\mathsf{fma}\left(\frac{F}{\sin B}, {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{\left(-0.5\right)}, -\frac{x}{\tan B}\right)\\
\mathbf{else}:\\
\;\;\;\;F \cdot \mathsf{fma}\left(-1, \frac{x \cdot \cos B}{t\_0}, \frac{1}{t\_0}\right)\\
\end{array}
\end{array}
if F < -7.0999999999999996e127Initial program 76.5%
Taylor expanded in F around -inf
Applied rewrites16.9%
if -7.0999999999999996e127 < F < 3.2e12Initial program 76.5%
Applied rewrites76.6%
if 3.2e12 < F Initial program 76.5%
Taylor expanded in F around inf
Applied rewrites46.8%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (- (/ x (tan B)))) (t_1 (/ F (sin B))))
(if (<= F -7.1e+127)
(/ -1.0 (sin B))
(if (<= F 1e+137)
(fma t_1 (pow (fma 2.0 x (fma F F 2.0)) (- 0.5)) t_0)
(fma t_1 (/ 1.0 F) t_0)))))
double code(double F, double B, double x) {
double t_0 = -(x / tan(B));
double t_1 = F / sin(B);
double tmp;
if (F <= -7.1e+127) {
tmp = -1.0 / sin(B);
} else if (F <= 1e+137) {
tmp = fma(t_1, pow(fma(2.0, x, fma(F, F, 2.0)), -0.5), t_0);
} else {
tmp = fma(t_1, (1.0 / F), t_0);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(-Float64(x / tan(B))) t_1 = Float64(F / sin(B)) tmp = 0.0 if (F <= -7.1e+127) tmp = Float64(-1.0 / sin(B)); elseif (F <= 1e+137) tmp = fma(t_1, (fma(2.0, x, fma(F, F, 2.0)) ^ Float64(-0.5)), t_0); else tmp = fma(t_1, Float64(1.0 / F), t_0); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = (-N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision])}, Block[{t$95$1 = N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -7.1e+127], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1e+137], N[(t$95$1 * N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], (-0.5)], $MachinePrecision] + t$95$0), $MachinePrecision], N[(t$95$1 * N[(1.0 / F), $MachinePrecision] + t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -\frac{x}{\tan B}\\
t_1 := \frac{F}{\sin B}\\
\mathbf{if}\;F \leq -7.1 \cdot 10^{+127}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 10^{+137}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{\left(-0.5\right)}, t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, \frac{1}{F}, t\_0\right)\\
\end{array}
\end{array}
if F < -7.0999999999999996e127Initial program 76.5%
Taylor expanded in F around -inf
Applied rewrites16.9%
if -7.0999999999999996e127 < F < 1e137Initial program 76.5%
Applied rewrites76.6%
if 1e137 < F Initial program 76.5%
Applied rewrites76.6%
Taylor expanded in F around inf
Applied rewrites47.6%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (- (/ x (tan B)))) (t_1 (/ F (sin B))))
(if (<= F -1.12e+125)
(/ -1.0 (sin B))
(if (<= F -5.8e-7)
(fma
t_1
(pow (fma 2.0 x (fma F F 2.0)) (- 0.5))
(- (/ x (* B (+ 1.0 (* 0.3333333333333333 (pow B 2.0)))))))
(if (<= F 1.85)
(fma t_1 (pow (+ 2.0 (* 2.0 x)) -0.5) t_0)
(fma t_1 (/ 1.0 F) t_0))))))
double code(double F, double B, double x) {
double t_0 = -(x / tan(B));
double t_1 = F / sin(B);
double tmp;
if (F <= -1.12e+125) {
tmp = -1.0 / sin(B);
} else if (F <= -5.8e-7) {
tmp = fma(t_1, pow(fma(2.0, x, fma(F, F, 2.0)), -0.5), -(x / (B * (1.0 + (0.3333333333333333 * pow(B, 2.0))))));
} else if (F <= 1.85) {
tmp = fma(t_1, pow((2.0 + (2.0 * x)), -0.5), t_0);
} else {
tmp = fma(t_1, (1.0 / F), t_0);
}
return tmp;
}
function code(F, B, x) t_0 = Float64(-Float64(x / tan(B))) t_1 = Float64(F / sin(B)) tmp = 0.0 if (F <= -1.12e+125) tmp = Float64(-1.0 / sin(B)); elseif (F <= -5.8e-7) tmp = fma(t_1, (fma(2.0, x, fma(F, F, 2.0)) ^ Float64(-0.5)), Float64(-Float64(x / Float64(B * Float64(1.0 + Float64(0.3333333333333333 * (B ^ 2.0))))))); elseif (F <= 1.85) tmp = fma(t_1, (Float64(2.0 + Float64(2.0 * x)) ^ -0.5), t_0); else tmp = fma(t_1, Float64(1.0 / F), t_0); end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = (-N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision])}, Block[{t$95$1 = N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -1.12e+125], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -5.8e-7], N[(t$95$1 * N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], (-0.5)], $MachinePrecision] + (-N[(x / N[(B * N[(1.0 + N[(0.3333333333333333 * N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], If[LessEqual[F, 1.85], N[(t$95$1 * N[Power[N[(2.0 + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision] + t$95$0), $MachinePrecision], N[(t$95$1 * N[(1.0 / F), $MachinePrecision] + t$95$0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -\frac{x}{\tan B}\\
t_1 := \frac{F}{\sin B}\\
\mathbf{if}\;F \leq -1.12 \cdot 10^{+125}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq -5.8 \cdot 10^{-7}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{\left(-0.5\right)}, -\frac{x}{B \cdot \left(1 + 0.3333333333333333 \cdot {B}^{2}\right)}\right)\\
\mathbf{elif}\;F \leq 1.85:\\
\;\;\;\;\mathsf{fma}\left(t\_1, {\left(2 + 2 \cdot x\right)}^{-0.5}, t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, \frac{1}{F}, t\_0\right)\\
\end{array}
\end{array}
if F < -1.12e125Initial program 76.5%
Taylor expanded in F around -inf
Applied rewrites16.9%
if -1.12e125 < F < -5.7999999999999995e-7Initial program 76.5%
Applied rewrites76.6%
Taylor expanded in B around inf
Applied rewrites76.6%
Taylor expanded in B around 0
Applied rewrites49.6%
if -5.7999999999999995e-7 < F < 1.8500000000000001Initial program 76.5%
Applied rewrites76.6%
Taylor expanded in F around 0
Applied rewrites55.7%
if 1.8500000000000001 < F Initial program 76.5%
Applied rewrites76.6%
Taylor expanded in F around inf
Applied rewrites47.6%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* -1.0 (/ (* x (cos B)) (sin B)))))
(if (<= x -4400.0)
t_0
(if (<= x 2.1e-47)
(+
(- (/ x B))
(*
(* F (/ 1.0 (sin B)))
(pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0)))))
t_0))))
double code(double F, double B, double x) {
double t_0 = -1.0 * ((x * cos(B)) / sin(B));
double tmp;
if (x <= -4400.0) {
tmp = t_0;
} else if (x <= 2.1e-47) {
tmp = -(x / B) + ((F * (1.0 / sin(B))) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
} 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 = (-1.0d0) * ((x * cos(b)) / sin(b))
if (x <= (-4400.0d0)) then
tmp = t_0
else if (x <= 2.1d-47) then
tmp = -(x / b) + ((f * (1.0d0 / sin(b))) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = -1.0 * ((x * Math.cos(B)) / Math.sin(B));
double tmp;
if (x <= -4400.0) {
tmp = t_0;
} else if (x <= 2.1e-47) {
tmp = -(x / B) + ((F * (1.0 / Math.sin(B))) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
} else {
tmp = t_0;
}
return tmp;
}
def code(F, B, x): t_0 = -1.0 * ((x * math.cos(B)) / math.sin(B)) tmp = 0 if x <= -4400.0: tmp = t_0 elif x <= 2.1e-47: tmp = -(x / B) + ((F * (1.0 / math.sin(B))) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0))) else: tmp = t_0 return tmp
function code(F, B, x) t_0 = Float64(-1.0 * Float64(Float64(x * cos(B)) / sin(B))) tmp = 0.0 if (x <= -4400.0) tmp = t_0; elseif (x <= 2.1e-47) tmp = Float64(Float64(-Float64(x / B)) + Float64(Float64(F * Float64(1.0 / sin(B))) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))); else tmp = t_0; end return tmp end
function tmp_2 = code(F, B, x) t_0 = -1.0 * ((x * cos(B)) / sin(B)); tmp = 0.0; if (x <= -4400.0) tmp = t_0; elseif (x <= 2.1e-47) tmp = -(x / B) + ((F * (1.0 / sin(B))) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); else tmp = t_0; end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = N[(-1.0 * N[(N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4400.0], t$95$0, If[LessEqual[x, 2.1e-47], N[((-N[(x / B), $MachinePrecision]) + N[(N[(F * N[(1.0 / N[Sin[B], $MachinePrecision]), $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], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -1 \cdot \frac{x \cdot \cos B}{\sin B}\\
\mathbf{if}\;x \leq -4400:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 2.1 \cdot 10^{-47}:\\
\;\;\;\;\left(-\frac{x}{B}\right) + \left(F \cdot \frac{1}{\sin B}\right) \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -4400 or 2.1000000000000001e-47 < x Initial program 76.5%
Taylor expanded in F around 0
Applied rewrites56.3%
if -4400 < x < 2.1000000000000001e-47Initial program 76.5%
Applied rewrites76.5%
Taylor expanded in B around 0
Applied rewrites49.5%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* -1.0 (/ (* x (cos B)) (sin B)))))
(if (<= x -4400.0)
t_0
(if (<= x 2.1e-47)
(fma (/ F (sin B)) (pow (fma 2.0 x (fma F F 2.0)) (- 0.5)) (- (/ x B)))
t_0))))
double code(double F, double B, double x) {
double t_0 = -1.0 * ((x * cos(B)) / sin(B));
double tmp;
if (x <= -4400.0) {
tmp = t_0;
} else if (x <= 2.1e-47) {
tmp = fma((F / sin(B)), pow(fma(2.0, x, fma(F, F, 2.0)), -0.5), -(x / B));
} else {
tmp = t_0;
}
return tmp;
}
function code(F, B, x) t_0 = Float64(-1.0 * Float64(Float64(x * cos(B)) / sin(B))) tmp = 0.0 if (x <= -4400.0) tmp = t_0; elseif (x <= 2.1e-47) tmp = fma(Float64(F / sin(B)), (fma(2.0, x, fma(F, F, 2.0)) ^ Float64(-0.5)), Float64(-Float64(x / B))); else tmp = t_0; end return tmp end
code[F_, B_, x_] := Block[{t$95$0 = N[(-1.0 * N[(N[(x * N[Cos[B], $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4400.0], t$95$0, If[LessEqual[x, 2.1e-47], N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], (-0.5)], $MachinePrecision] + (-N[(x / B), $MachinePrecision])), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -1 \cdot \frac{x \cdot \cos B}{\sin B}\\
\mathbf{if}\;x \leq -4400:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 2.1 \cdot 10^{-47}:\\
\;\;\;\;\mathsf{fma}\left(\frac{F}{\sin B}, {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{\left(-0.5\right)}, -\frac{x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -4400 or 2.1000000000000001e-47 < x Initial program 76.5%
Taylor expanded in F around 0
Applied rewrites56.3%
if -4400 < x < 2.1000000000000001e-47Initial program 76.5%
Applied rewrites76.6%
Taylor expanded in B around 0
Applied rewrites49.5%
(FPCore (F B x)
:precision binary64
(if (<= F -1.3e+126)
(/ -1.0 (sin B))
(if (<= F 4.2e+141)
(fma (/ F (sin B)) (pow (fma 2.0 x (fma F F 2.0)) (- 0.5)) (- (/ x B)))
(/ 1.0 (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -1.3e+126) {
tmp = -1.0 / sin(B);
} else if (F <= 4.2e+141) {
tmp = fma((F / sin(B)), pow(fma(2.0, x, fma(F, F, 2.0)), -0.5), -(x / B));
} else {
tmp = 1.0 / sin(B);
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -1.3e+126) tmp = Float64(-1.0 / sin(B)); elseif (F <= 4.2e+141) tmp = fma(Float64(F / sin(B)), (fma(2.0, x, fma(F, F, 2.0)) ^ Float64(-0.5)), Float64(-Float64(x / B))); else tmp = Float64(1.0 / sin(B)); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -1.3e+126], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 4.2e+141], N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(2.0 * x + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision], (-0.5)], $MachinePrecision] + (-N[(x / B), $MachinePrecision])), $MachinePrecision], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1.3 \cdot 10^{+126}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 4.2 \cdot 10^{+141}:\\
\;\;\;\;\mathsf{fma}\left(\frac{F}{\sin B}, {\left(\mathsf{fma}\left(2, x, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{\left(-0.5\right)}, -\frac{x}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -1.3e126Initial program 76.5%
Taylor expanded in F around -inf
Applied rewrites16.9%
if -1.3e126 < F < 4.1999999999999997e141Initial program 76.5%
Applied rewrites76.6%
Taylor expanded in B around 0
Applied rewrites49.5%
if 4.1999999999999997e141 < F Initial program 76.5%
Taylor expanded in F around inf
Applied rewrites16.9%
(FPCore (F B x)
:precision binary64
(if (<= F -9.5e+120)
(/ -1.0 (sin B))
(if (<= F 1.45e+52)
(/ (- (* F (pow (+ 2.0 (fma 2.0 x (pow F 2.0))) -0.5)) x) B)
(fma (/ F (sin B)) (/ 1.0 F) (- (/ x B))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -9.5e+120) {
tmp = -1.0 / sin(B);
} else if (F <= 1.45e+52) {
tmp = ((F * pow((2.0 + fma(2.0, x, pow(F, 2.0))), -0.5)) - x) / B;
} else {
tmp = fma((F / sin(B)), (1.0 / F), -(x / B));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -9.5e+120) tmp = Float64(-1.0 / sin(B)); elseif (F <= 1.45e+52) tmp = Float64(Float64(Float64(F * (Float64(2.0 + fma(2.0, x, (F ^ 2.0))) ^ -0.5)) - x) / B); else tmp = fma(Float64(F / sin(B)), Float64(1.0 / F), Float64(-Float64(x / B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -9.5e+120], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1.45e+52], N[(N[(N[(F * N[Power[N[(2.0 + N[(2.0 * x + N[Power[F, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[(1.0 / F), $MachinePrecision] + (-N[(x / B), $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -9.5 \cdot 10^{+120}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 1.45 \cdot 10^{+52}:\\
\;\;\;\;\frac{F \cdot {\left(2 + \mathsf{fma}\left(2, x, {F}^{2}\right)\right)}^{-0.5} - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{F}{\sin B}, \frac{1}{F}, -\frac{x}{B}\right)\\
\end{array}
\end{array}
if F < -9.5e120Initial program 76.5%
Taylor expanded in F around -inf
Applied rewrites16.9%
if -9.5e120 < F < 1.45e52Initial program 76.5%
Taylor expanded in B around 0
Applied rewrites44.5%
if 1.45e52 < F Initial program 76.5%
Applied rewrites76.6%
Taylor expanded in F around inf
Applied rewrites47.6%
Taylor expanded in B around 0
Applied rewrites28.7%
(FPCore (F B x)
:precision binary64
(if (<= F -540000.0)
(/ -1.0 (sin B))
(if (<= F 4.5e-10)
(+
(- (* x (/ 1.0 B)))
(* (/ F B) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0)))))
(fma (/ F (sin B)) (/ 1.0 F) (- (/ x B))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -540000.0) {
tmp = -1.0 / sin(B);
} else if (F <= 4.5e-10) {
tmp = -(x * (1.0 / B)) + ((F / B) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
} else {
tmp = fma((F / sin(B)), (1.0 / F), -(x / B));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -540000.0) tmp = Float64(-1.0 / sin(B)); elseif (F <= 4.5e-10) tmp = Float64(Float64(-Float64(x * Float64(1.0 / B))) + Float64(Float64(F / B) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))); else tmp = fma(Float64(F / sin(B)), Float64(1.0 / F), Float64(-Float64(x / B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -540000.0], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 4.5e-10], N[((-N[(x * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / B), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], (-N[(1.0 / 2.0), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[(1.0 / F), $MachinePrecision] + (-N[(x / B), $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -540000:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 4.5 \cdot 10^{-10}:\\
\;\;\;\;\left(-x \cdot \frac{1}{B}\right) + \frac{F}{B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{F}{\sin B}, \frac{1}{F}, -\frac{x}{B}\right)\\
\end{array}
\end{array}
if F < -5.4e5Initial program 76.5%
Taylor expanded in F around -inf
Applied rewrites16.9%
if -5.4e5 < F < 4.5e-10Initial program 76.5%
Taylor expanded in B around 0
Applied rewrites62.5%
Taylor expanded in B around 0
Applied rewrites36.2%
if 4.5e-10 < F Initial program 76.5%
Applied rewrites76.6%
Taylor expanded in F around inf
Applied rewrites47.6%
Taylor expanded in B around 0
Applied rewrites28.7%
(FPCore (F B x)
:precision binary64
(if (<= F -3.2e-9)
(/ -1.0 (sin B))
(if (<= F 9.8e-82)
(* -1.0 (/ x (sin B)))
(fma (/ F (sin B)) (/ 1.0 F) (- (/ x B))))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.2e-9) {
tmp = -1.0 / sin(B);
} else if (F <= 9.8e-82) {
tmp = -1.0 * (x / sin(B));
} else {
tmp = fma((F / sin(B)), (1.0 / F), -(x / B));
}
return tmp;
}
function code(F, B, x) tmp = 0.0 if (F <= -3.2e-9) tmp = Float64(-1.0 / sin(B)); elseif (F <= 9.8e-82) tmp = Float64(-1.0 * Float64(x / sin(B))); else tmp = fma(Float64(F / sin(B)), Float64(1.0 / F), Float64(-Float64(x / B))); end return tmp end
code[F_, B_, x_] := If[LessEqual[F, -3.2e-9], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 9.8e-82], N[(-1.0 * N[(x / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[(1.0 / F), $MachinePrecision] + (-N[(x / B), $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.2 \cdot 10^{-9}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 9.8 \cdot 10^{-82}:\\
\;\;\;\;-1 \cdot \frac{x}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{F}{\sin B}, \frac{1}{F}, -\frac{x}{B}\right)\\
\end{array}
\end{array}
if F < -3.20000000000000012e-9Initial program 76.5%
Taylor expanded in F around -inf
Applied rewrites16.9%
if -3.20000000000000012e-9 < F < 9.8000000000000006e-82Initial program 76.5%
Taylor expanded in F around 0
Applied rewrites56.3%
Taylor expanded in B around 0
Applied rewrites32.2%
if 9.8000000000000006e-82 < F Initial program 76.5%
Applied rewrites76.6%
Taylor expanded in F around inf
Applied rewrites47.6%
Taylor expanded in B around 0
Applied rewrites28.7%
(FPCore (F B x) :precision binary64 (if (<= F -3.2e-9) (/ -1.0 (sin B)) (if (<= F 3.7e-7) (* -1.0 (/ x (sin B))) (/ 1.0 (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.2e-9) {
tmp = -1.0 / sin(B);
} else if (F <= 3.7e-7) {
tmp = -1.0 * (x / sin(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 <= (-3.2d-9)) then
tmp = (-1.0d0) / sin(b)
else if (f <= 3.7d-7) then
tmp = (-1.0d0) * (x / sin(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 <= -3.2e-9) {
tmp = -1.0 / Math.sin(B);
} else if (F <= 3.7e-7) {
tmp = -1.0 * (x / Math.sin(B));
} else {
tmp = 1.0 / Math.sin(B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -3.2e-9: tmp = -1.0 / math.sin(B) elif F <= 3.7e-7: tmp = -1.0 * (x / math.sin(B)) else: tmp = 1.0 / math.sin(B) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -3.2e-9) tmp = Float64(-1.0 / sin(B)); elseif (F <= 3.7e-7) tmp = Float64(-1.0 * Float64(x / sin(B))); else tmp = Float64(1.0 / sin(B)); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -3.2e-9) tmp = -1.0 / sin(B); elseif (F <= 3.7e-7) tmp = -1.0 * (x / sin(B)); else tmp = 1.0 / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -3.2e-9], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 3.7e-7], N[(-1.0 * N[(x / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.2 \cdot 10^{-9}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 3.7 \cdot 10^{-7}:\\
\;\;\;\;-1 \cdot \frac{x}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -3.20000000000000012e-9Initial program 76.5%
Taylor expanded in F around -inf
Applied rewrites16.9%
if -3.20000000000000012e-9 < F < 3.70000000000000004e-7Initial program 76.5%
Taylor expanded in F around 0
Applied rewrites56.3%
Taylor expanded in B around 0
Applied rewrites32.2%
if 3.70000000000000004e-7 < F Initial program 76.5%
Taylor expanded in F around inf
Applied rewrites16.9%
(FPCore (F B x)
:precision binary64
(if (<= F -5.8e-7)
(/ -1.0 (sin B))
(if (<= F 0.014)
(*
-1.0
(/ (+ x (* (pow B 2.0) (- (* -0.5 x) (* -0.16666666666666666 x)))) B))
(/ 1.0 (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -5.8e-7) {
tmp = -1.0 / sin(B);
} else if (F <= 0.014) {
tmp = -1.0 * ((x + (pow(B, 2.0) * ((-0.5 * x) - (-0.16666666666666666 * 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 <= (-5.8d-7)) then
tmp = (-1.0d0) / sin(b)
else if (f <= 0.014d0) then
tmp = (-1.0d0) * ((x + ((b ** 2.0d0) * (((-0.5d0) * x) - ((-0.16666666666666666d0) * 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 <= -5.8e-7) {
tmp = -1.0 / Math.sin(B);
} else if (F <= 0.014) {
tmp = -1.0 * ((x + (Math.pow(B, 2.0) * ((-0.5 * x) - (-0.16666666666666666 * x)))) / B);
} else {
tmp = 1.0 / Math.sin(B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -5.8e-7: tmp = -1.0 / math.sin(B) elif F <= 0.014: tmp = -1.0 * ((x + (math.pow(B, 2.0) * ((-0.5 * x) - (-0.16666666666666666 * x)))) / B) else: tmp = 1.0 / math.sin(B) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -5.8e-7) tmp = Float64(-1.0 / sin(B)); elseif (F <= 0.014) tmp = Float64(-1.0 * Float64(Float64(x + Float64((B ^ 2.0) * Float64(Float64(-0.5 * x) - Float64(-0.16666666666666666 * 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 <= -5.8e-7) tmp = -1.0 / sin(B); elseif (F <= 0.014) tmp = -1.0 * ((x + ((B ^ 2.0) * ((-0.5 * x) - (-0.16666666666666666 * x)))) / B); else tmp = 1.0 / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -5.8e-7], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 0.014], N[(-1.0 * N[(N[(x + N[(N[Power[B, 2.0], $MachinePrecision] * N[(N[(-0.5 * x), $MachinePrecision] - N[(-0.16666666666666666 * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -5.8 \cdot 10^{-7}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 0.014:\\
\;\;\;\;-1 \cdot \frac{x + {B}^{2} \cdot \left(-0.5 \cdot x - -0.16666666666666666 \cdot x\right)}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -5.7999999999999995e-7Initial program 76.5%
Taylor expanded in F around -inf
Applied rewrites16.9%
if -5.7999999999999995e-7 < F < 0.0140000000000000003Initial program 76.5%
Taylor expanded in F around 0
Applied rewrites56.3%
Taylor expanded in B around 0
Applied rewrites29.9%
if 0.0140000000000000003 < F Initial program 76.5%
Taylor expanded in F around inf
Applied rewrites16.9%
(FPCore (F B x) :precision binary64 (if (<= F -3e-9) (/ -1.0 (sin B)) (if (<= F 3.7e-7) (* -1.0 (/ x B)) (/ 1.0 (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3e-9) {
tmp = -1.0 / sin(B);
} else if (F <= 3.7e-7) {
tmp = -1.0 * (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 <= (-3d-9)) then
tmp = (-1.0d0) / sin(b)
else if (f <= 3.7d-7) then
tmp = (-1.0d0) * (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 <= -3e-9) {
tmp = -1.0 / Math.sin(B);
} else if (F <= 3.7e-7) {
tmp = -1.0 * (x / B);
} else {
tmp = 1.0 / Math.sin(B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -3e-9: tmp = -1.0 / math.sin(B) elif F <= 3.7e-7: tmp = -1.0 * (x / B) else: tmp = 1.0 / math.sin(B) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -3e-9) tmp = Float64(-1.0 / sin(B)); elseif (F <= 3.7e-7) tmp = Float64(-1.0 * Float64(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 <= -3e-9) tmp = -1.0 / sin(B); elseif (F <= 3.7e-7) tmp = -1.0 * (x / B); else tmp = 1.0 / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -3e-9], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 3.7e-7], N[(-1.0 * N[(x / B), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3 \cdot 10^{-9}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{elif}\;F \leq 3.7 \cdot 10^{-7}:\\
\;\;\;\;-1 \cdot \frac{x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\
\end{array}
\end{array}
if F < -2.99999999999999998e-9Initial program 76.5%
Taylor expanded in F around -inf
Applied rewrites16.9%
if -2.99999999999999998e-9 < F < 3.70000000000000004e-7Initial program 76.5%
Taylor expanded in F around 0
Applied rewrites56.3%
Taylor expanded in B around 0
Applied rewrites30.0%
Taylor expanded in B around 0
Applied rewrites30.0%
if 3.70000000000000004e-7 < F Initial program 76.5%
Taylor expanded in F around inf
Applied rewrites16.9%
(FPCore (F B x) :precision binary64 (if (<= F -3e-9) (/ -1.0 (sin B)) (* -1.0 (/ x B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3e-9) {
tmp = -1.0 / sin(B);
} else {
tmp = -1.0 * (x / B);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-3d-9)) then
tmp = (-1.0d0) / sin(b)
else
tmp = (-1.0d0) * (x / b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -3e-9) {
tmp = -1.0 / Math.sin(B);
} else {
tmp = -1.0 * (x / B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -3e-9: tmp = -1.0 / math.sin(B) else: tmp = -1.0 * (x / B) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -3e-9) tmp = Float64(-1.0 / sin(B)); else tmp = Float64(-1.0 * Float64(x / B)); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -3e-9) tmp = -1.0 / sin(B); else tmp = -1.0 * (x / B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -3e-9], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision], N[(-1.0 * N[(x / B), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3 \cdot 10^{-9}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{x}{B}\\
\end{array}
\end{array}
if F < -2.99999999999999998e-9Initial program 76.5%
Taylor expanded in F around -inf
Applied rewrites16.9%
if -2.99999999999999998e-9 < F Initial program 76.5%
Taylor expanded in F around 0
Applied rewrites56.3%
Taylor expanded in B around 0
Applied rewrites30.0%
Taylor expanded in B around 0
Applied rewrites30.0%
(FPCore (F B x) :precision binary64 (if (<= F -3e+14) (/ (- (* -0.16666666666666666 (pow B 2.0)) 1.0) B) (* -1.0 (/ x B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3e+14) {
tmp = ((-0.16666666666666666 * pow(B, 2.0)) - 1.0) / B;
} else {
tmp = -1.0 * (x / B);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-3d+14)) then
tmp = (((-0.16666666666666666d0) * (b ** 2.0d0)) - 1.0d0) / b
else
tmp = (-1.0d0) * (x / b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -3e+14) {
tmp = ((-0.16666666666666666 * Math.pow(B, 2.0)) - 1.0) / B;
} else {
tmp = -1.0 * (x / B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -3e+14: tmp = ((-0.16666666666666666 * math.pow(B, 2.0)) - 1.0) / B else: tmp = -1.0 * (x / B) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -3e+14) tmp = Float64(Float64(Float64(-0.16666666666666666 * (B ^ 2.0)) - 1.0) / B); else tmp = Float64(-1.0 * Float64(x / B)); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -3e+14) tmp = ((-0.16666666666666666 * (B ^ 2.0)) - 1.0) / B; else tmp = -1.0 * (x / B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -3e+14], N[(N[(N[(-0.16666666666666666 * N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision] / B), $MachinePrecision], N[(-1.0 * N[(x / B), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3 \cdot 10^{+14}:\\
\;\;\;\;\frac{-0.16666666666666666 \cdot {B}^{2} - 1}{B}\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{x}{B}\\
\end{array}
\end{array}
if F < -3e14Initial program 76.5%
Taylor expanded in F around -inf
Applied rewrites16.9%
Taylor expanded in B around 0
Applied rewrites9.9%
if -3e14 < F Initial program 76.5%
Taylor expanded in F around 0
Applied rewrites56.3%
Taylor expanded in B around 0
Applied rewrites30.0%
Taylor expanded in B around 0
Applied rewrites30.0%
(FPCore (F B x) :precision binary64 (if (<= F -3e+14) (/ -1.0 B) (* -1.0 (/ x B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3e+14) {
tmp = -1.0 / B;
} else {
tmp = -1.0 * (x / B);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-3d+14)) then
tmp = (-1.0d0) / b
else
tmp = (-1.0d0) * (x / b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -3e+14) {
tmp = -1.0 / B;
} else {
tmp = -1.0 * (x / B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -3e+14: tmp = -1.0 / B else: tmp = -1.0 * (x / B) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -3e+14) tmp = Float64(-1.0 / B); else tmp = Float64(-1.0 * Float64(x / B)); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -3e+14) tmp = -1.0 / B; else tmp = -1.0 * (x / B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -3e+14], N[(-1.0 / B), $MachinePrecision], N[(-1.0 * N[(x / B), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3 \cdot 10^{+14}:\\
\;\;\;\;\frac{-1}{B}\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{x}{B}\\
\end{array}
\end{array}
if F < -3e14Initial program 76.5%
Taylor expanded in F around -inf
Applied rewrites16.9%
Taylor expanded in B around 0
Applied rewrites10.2%
if -3e14 < F Initial program 76.5%
Taylor expanded in F around 0
Applied rewrites56.3%
Taylor expanded in B around 0
Applied rewrites30.0%
Taylor expanded in B around 0
Applied rewrites30.0%
(FPCore (F B x) :precision binary64 (/ -1.0 B))
double code(double F, double B, double x) {
return -1.0 / B;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = (-1.0d0) / b
end function
public static double code(double F, double B, double x) {
return -1.0 / B;
}
def code(F, B, x): return -1.0 / B
function code(F, B, x) return Float64(-1.0 / B) end
function tmp = code(F, B, x) tmp = -1.0 / B; end
code[F_, B_, x_] := N[(-1.0 / B), $MachinePrecision]
\begin{array}{l}
\\
\frac{-1}{B}
\end{array}
Initial program 76.5%
Taylor expanded in F around -inf
Applied rewrites16.9%
Taylor expanded in B around 0
Applied rewrites10.2%
(FPCore (F B x) :precision binary64 (* -0.16666666666666666 B))
double code(double F, double B, double x) {
return -0.16666666666666666 * B;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = (-0.16666666666666666d0) * b
end function
public static double code(double F, double B, double x) {
return -0.16666666666666666 * B;
}
def code(F, B, x): return -0.16666666666666666 * B
function code(F, B, x) return Float64(-0.16666666666666666 * B) end
function tmp = code(F, B, x) tmp = -0.16666666666666666 * B; end
code[F_, B_, x_] := N[(-0.16666666666666666 * B), $MachinePrecision]
\begin{array}{l}
\\
-0.16666666666666666 \cdot B
\end{array}
Initial program 76.5%
Taylor expanded in F around -inf
Applied rewrites16.9%
Taylor expanded in B around 0
Applied rewrites9.9%
Taylor expanded in B around inf
Applied rewrites2.9%
herbie shell --seed 2025160
(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))))))