
(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}
Sampling outcomes in binary64 precision:
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 (* (cos B) x)))
(if (<= F -4.1e+37)
(/ (- -1.0 t_0) (sin B))
(if (<= F 3.5e+41)
(+ (/ (- x) (tan B)) (* (/ F (sin B)) (pow (+ (* F F) 2.0) -0.5)))
(/ (- 1.0 t_0) (sin B))))))
double code(double F, double B, double x) {
double t_0 = cos(B) * x;
double tmp;
if (F <= -4.1e+37) {
tmp = (-1.0 - t_0) / sin(B);
} else if (F <= 3.5e+41) {
tmp = (-x / tan(B)) + ((F / sin(B)) * pow(((F * F) + 2.0), -0.5));
} else {
tmp = (1.0 - 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 <= (-4.1d+37)) then
tmp = ((-1.0d0) - t_0) / sin(b)
else if (f <= 3.5d+41) then
tmp = (-x / tan(b)) + ((f / sin(b)) * (((f * f) + 2.0d0) ** (-0.5d0)))
else
tmp = (1.0d0 - 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 <= -4.1e+37) {
tmp = (-1.0 - t_0) / Math.sin(B);
} else if (F <= 3.5e+41) {
tmp = (-x / Math.tan(B)) + ((F / Math.sin(B)) * Math.pow(((F * F) + 2.0), -0.5));
} else {
tmp = (1.0 - t_0) / Math.sin(B);
}
return tmp;
}
def code(F, B, x): t_0 = math.cos(B) * x tmp = 0 if F <= -4.1e+37: tmp = (-1.0 - t_0) / math.sin(B) elif F <= 3.5e+41: tmp = (-x / math.tan(B)) + ((F / math.sin(B)) * math.pow(((F * F) + 2.0), -0.5)) else: tmp = (1.0 - t_0) / math.sin(B) return tmp
function code(F, B, x) t_0 = Float64(cos(B) * x) tmp = 0.0 if (F <= -4.1e+37) tmp = Float64(Float64(-1.0 - t_0) / sin(B)); elseif (F <= 3.5e+41) tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64(Float64(F / sin(B)) * (Float64(Float64(F * F) + 2.0) ^ -0.5))); else tmp = Float64(Float64(1.0 - 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 <= -4.1e+37) tmp = (-1.0 - t_0) / sin(B); elseif (F <= 3.5e+41) tmp = (-x / tan(B)) + ((F / sin(B)) * (((F * F) + 2.0) ^ -0.5)); else tmp = (1.0 - 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, -4.1e+37], N[(N[(-1.0 - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 3.5e+41], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos B \cdot x\\
\mathbf{if}\;F \leq -4.1 \cdot 10^{+37}:\\
\;\;\;\;\frac{-1 - t\_0}{\sin B}\\
\mathbf{elif}\;F \leq 3.5 \cdot 10^{+41}:\\
\;\;\;\;\frac{-x}{\tan B} + \frac{F}{\sin B} \cdot {\left(F \cdot F + 2\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - t\_0}{\sin B}\\
\end{array}
\end{array}
if F < -4.0999999999999998e37Initial program 57.0%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
if -4.0999999999999998e37 < F < 3.4999999999999999e41Initial program 99.4%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.6
Applied rewrites99.6%
Taylor expanded in x around 0
+-commutativeN/A
pow2N/A
unpow-1N/A
sqrt-pow1N/A
pow2N/A
+-commutativeN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-*.f64N/A
lift-+.f64N/A
metadata-evalN/A
metadata-eval99.6
Applied rewrites99.6%
if 3.4999999999999999e41 < F Initial program 46.1%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Final simplification99.7%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (+ (* F F) 2.0))
(t_1 (* x (/ -1.0 (tan B))))
(t_2 (/ (- -1.0 x) B))
(t_3 (/ F (sin B)))
(t_4 (+ t_1 (* t_3 (pow (+ t_0 (* 2.0 x)) (/ -1.0 2.0)))))
(t_5 (+ t_1 (* (/ F B) (/ 1.0 (sqrt (+ (+ (* 2.0 x) 2.0) (* F F))))))))
(if (<= t_4 (- INFINITY))
t_2
(if (<= t_4 5e-48)
t_5
(if (<= t_4 10.0)
(* (sqrt (/ 1.0 t_0)) t_3)
(if (<= t_4 INFINITY) t_5 t_2))))))
double code(double F, double B, double x) {
double t_0 = (F * F) + 2.0;
double t_1 = x * (-1.0 / tan(B));
double t_2 = (-1.0 - x) / B;
double t_3 = F / sin(B);
double t_4 = t_1 + (t_3 * pow((t_0 + (2.0 * x)), (-1.0 / 2.0)));
double t_5 = t_1 + ((F / B) * (1.0 / sqrt((((2.0 * x) + 2.0) + (F * F)))));
double tmp;
if (t_4 <= -((double) INFINITY)) {
tmp = t_2;
} else if (t_4 <= 5e-48) {
tmp = t_5;
} else if (t_4 <= 10.0) {
tmp = sqrt((1.0 / t_0)) * t_3;
} else if (t_4 <= ((double) INFINITY)) {
tmp = t_5;
} else {
tmp = t_2;
}
return tmp;
}
public static double code(double F, double B, double x) {
double t_0 = (F * F) + 2.0;
double t_1 = x * (-1.0 / Math.tan(B));
double t_2 = (-1.0 - x) / B;
double t_3 = F / Math.sin(B);
double t_4 = t_1 + (t_3 * Math.pow((t_0 + (2.0 * x)), (-1.0 / 2.0)));
double t_5 = t_1 + ((F / B) * (1.0 / Math.sqrt((((2.0 * x) + 2.0) + (F * F)))));
double tmp;
if (t_4 <= -Double.POSITIVE_INFINITY) {
tmp = t_2;
} else if (t_4 <= 5e-48) {
tmp = t_5;
} else if (t_4 <= 10.0) {
tmp = Math.sqrt((1.0 / t_0)) * t_3;
} else if (t_4 <= Double.POSITIVE_INFINITY) {
tmp = t_5;
} else {
tmp = t_2;
}
return tmp;
}
def code(F, B, x): t_0 = (F * F) + 2.0 t_1 = x * (-1.0 / math.tan(B)) t_2 = (-1.0 - x) / B t_3 = F / math.sin(B) t_4 = t_1 + (t_3 * math.pow((t_0 + (2.0 * x)), (-1.0 / 2.0))) t_5 = t_1 + ((F / B) * (1.0 / math.sqrt((((2.0 * x) + 2.0) + (F * F))))) tmp = 0 if t_4 <= -math.inf: tmp = t_2 elif t_4 <= 5e-48: tmp = t_5 elif t_4 <= 10.0: tmp = math.sqrt((1.0 / t_0)) * t_3 elif t_4 <= math.inf: tmp = t_5 else: tmp = t_2 return tmp
function code(F, B, x) t_0 = Float64(Float64(F * F) + 2.0) t_1 = Float64(x * Float64(-1.0 / tan(B))) t_2 = Float64(Float64(-1.0 - x) / B) t_3 = Float64(F / sin(B)) t_4 = Float64(t_1 + Float64(t_3 * (Float64(t_0 + Float64(2.0 * x)) ^ Float64(-1.0 / 2.0)))) t_5 = Float64(t_1 + Float64(Float64(F / B) * Float64(1.0 / sqrt(Float64(Float64(Float64(2.0 * x) + 2.0) + Float64(F * F)))))) tmp = 0.0 if (t_4 <= Float64(-Inf)) tmp = t_2; elseif (t_4 <= 5e-48) tmp = t_5; elseif (t_4 <= 10.0) tmp = Float64(sqrt(Float64(1.0 / t_0)) * t_3); elseif (t_4 <= Inf) tmp = t_5; else tmp = t_2; end return tmp end
function tmp_2 = code(F, B, x) t_0 = (F * F) + 2.0; t_1 = x * (-1.0 / tan(B)); t_2 = (-1.0 - x) / B; t_3 = F / sin(B); t_4 = t_1 + (t_3 * ((t_0 + (2.0 * x)) ^ (-1.0 / 2.0))); t_5 = t_1 + ((F / B) * (1.0 / sqrt((((2.0 * x) + 2.0) + (F * F))))); tmp = 0.0; if (t_4 <= -Inf) tmp = t_2; elseif (t_4 <= 5e-48) tmp = t_5; elseif (t_4 <= 10.0) tmp = sqrt((1.0 / t_0)) * t_3; elseif (t_4 <= Inf) tmp = t_5; else tmp = t_2; end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision]}, Block[{t$95$1 = N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision]}, Block[{t$95$3 = N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$1 + N[(t$95$3 * N[Power[N[(t$95$0 + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], N[(-1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(t$95$1 + N[(N[(F / B), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(N[(N[(2.0 * x), $MachinePrecision] + 2.0), $MachinePrecision] + N[(F * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, (-Infinity)], t$95$2, If[LessEqual[t$95$4, 5e-48], t$95$5, If[LessEqual[t$95$4, 10.0], N[(N[Sqrt[N[(1.0 / t$95$0), $MachinePrecision]], $MachinePrecision] * t$95$3), $MachinePrecision], If[LessEqual[t$95$4, Infinity], t$95$5, t$95$2]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := F \cdot F + 2\\
t_1 := x \cdot \frac{-1}{\tan B}\\
t_2 := \frac{-1 - x}{B}\\
t_3 := \frac{F}{\sin B}\\
t_4 := t\_1 + t\_3 \cdot {\left(t\_0 + 2 \cdot x\right)}^{\left(\frac{-1}{2}\right)}\\
t_5 := t\_1 + \frac{F}{B} \cdot \frac{1}{\sqrt{\left(2 \cdot x + 2\right) + F \cdot F}}\\
\mathbf{if}\;t\_4 \leq -\infty:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_4 \leq 5 \cdot 10^{-48}:\\
\;\;\;\;t\_5\\
\mathbf{elif}\;t\_4 \leq 10:\\
\;\;\;\;\sqrt{\frac{1}{t\_0}} \cdot t\_3\\
\mathbf{elif}\;t\_4 \leq \infty:\\
\;\;\;\;t\_5\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) < -inf.0 or +inf.0 < (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) Initial program 22.2%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites69.9%
Taylor expanded in F around -inf
Applied rewrites82.7%
if -inf.0 < (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) < 4.9999999999999999e-48 or 10 < (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) < +inf.0Initial program 86.5%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f64N/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f6472.9
Applied rewrites72.9%
if 4.9999999999999999e-48 < (+.f64 (neg.f64 (*.f64 x (/.f64 #s(literal 1 binary64) (tan.f64 B)))) (*.f64 (/.f64 F (sin.f64 B)) (pow.f64 (+.f64 (+.f64 (*.f64 F F) #s(literal 2 binary64)) (*.f64 #s(literal 2 binary64) x)) (neg.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))))) < 10Initial program 85.1%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-*.f64N/A
lift-+.f64N/A
lift-sin.f64N/A
lift-/.f6475.5
Applied rewrites75.5%
lift-pow.f64N/A
lift-+.f64N/A
lift-*.f64N/A
unpow-1N/A
lower-/.f64N/A
lift-*.f64N/A
lift-+.f6475.5
Applied rewrites75.5%
Final simplification74.6%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* (cos B) x)))
(if (<= F -4.1e+37)
(/ (- -1.0 t_0) (sin B))
(if (<= F 3.5e+41)
(+
(* x (/ -1.0 (tan B)))
(* (/ 1.0 (sqrt (+ (+ (* 2.0 x) 2.0) (* F F)))) (/ F (sin B))))
(/ (- 1.0 t_0) (sin B))))))
double code(double F, double B, double x) {
double t_0 = cos(B) * x;
double tmp;
if (F <= -4.1e+37) {
tmp = (-1.0 - t_0) / sin(B);
} else if (F <= 3.5e+41) {
tmp = (x * (-1.0 / tan(B))) + ((1.0 / sqrt((((2.0 * x) + 2.0) + (F * F)))) * (F / sin(B)));
} else {
tmp = (1.0 - 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 <= (-4.1d+37)) then
tmp = ((-1.0d0) - t_0) / sin(b)
else if (f <= 3.5d+41) then
tmp = (x * ((-1.0d0) / tan(b))) + ((1.0d0 / sqrt((((2.0d0 * x) + 2.0d0) + (f * f)))) * (f / sin(b)))
else
tmp = (1.0d0 - 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 <= -4.1e+37) {
tmp = (-1.0 - t_0) / Math.sin(B);
} else if (F <= 3.5e+41) {
tmp = (x * (-1.0 / Math.tan(B))) + ((1.0 / Math.sqrt((((2.0 * x) + 2.0) + (F * F)))) * (F / Math.sin(B)));
} else {
tmp = (1.0 - t_0) / Math.sin(B);
}
return tmp;
}
def code(F, B, x): t_0 = math.cos(B) * x tmp = 0 if F <= -4.1e+37: tmp = (-1.0 - t_0) / math.sin(B) elif F <= 3.5e+41: tmp = (x * (-1.0 / math.tan(B))) + ((1.0 / math.sqrt((((2.0 * x) + 2.0) + (F * F)))) * (F / math.sin(B))) else: tmp = (1.0 - t_0) / math.sin(B) return tmp
function code(F, B, x) t_0 = Float64(cos(B) * x) tmp = 0.0 if (F <= -4.1e+37) tmp = Float64(Float64(-1.0 - t_0) / sin(B)); elseif (F <= 3.5e+41) tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(Float64(1.0 / sqrt(Float64(Float64(Float64(2.0 * x) + 2.0) + Float64(F * F)))) * Float64(F / sin(B)))); else tmp = Float64(Float64(1.0 - 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 <= -4.1e+37) tmp = (-1.0 - t_0) / sin(B); elseif (F <= 3.5e+41) tmp = (x * (-1.0 / tan(B))) + ((1.0 / sqrt((((2.0 * x) + 2.0) + (F * F)))) * (F / sin(B))); else tmp = (1.0 - 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, -4.1e+37], N[(N[(-1.0 - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 3.5e+41], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / N[Sqrt[N[(N[(N[(2.0 * x), $MachinePrecision] + 2.0), $MachinePrecision] + N[(F * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos B \cdot x\\
\mathbf{if}\;F \leq -4.1 \cdot 10^{+37}:\\
\;\;\;\;\frac{-1 - t\_0}{\sin B}\\
\mathbf{elif}\;F \leq 3.5 \cdot 10^{+41}:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{1}{\sqrt{\left(2 \cdot x + 2\right) + F \cdot F}} \cdot \frac{F}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - t\_0}{\sin B}\\
\end{array}
\end{array}
if F < -4.0999999999999998e37Initial program 57.0%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
if -4.0999999999999998e37 < F < 3.4999999999999999e41Initial program 99.4%
Taylor expanded in B around inf
*-commutativeN/A
lower-*.f64N/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-/.f6499.4
Applied rewrites99.4%
if 3.4999999999999999e41 < F Initial program 46.1%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Final simplification99.6%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* (cos B) x)))
(if (<= F -5.5e-9)
(/ (- -1.0 t_0) (sin B))
(if (<= F 1950.0)
(+
(/ (- x) (tan B))
(* (pow (sqrt (- (+ (* F F) 2.0) (* -2.0 x))) -1.0) (/ F B)))
(/ (- 1.0 t_0) (sin B))))))
double code(double F, double B, double x) {
double t_0 = cos(B) * x;
double tmp;
if (F <= -5.5e-9) {
tmp = (-1.0 - t_0) / sin(B);
} else if (F <= 1950.0) {
tmp = (-x / tan(B)) + (pow(sqrt((((F * F) + 2.0) - (-2.0 * x))), -1.0) * (F / B));
} else {
tmp = (1.0 - 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 <= (-5.5d-9)) then
tmp = ((-1.0d0) - t_0) / sin(b)
else if (f <= 1950.0d0) then
tmp = (-x / tan(b)) + ((sqrt((((f * f) + 2.0d0) - ((-2.0d0) * x))) ** (-1.0d0)) * (f / b))
else
tmp = (1.0d0 - 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 <= -5.5e-9) {
tmp = (-1.0 - t_0) / Math.sin(B);
} else if (F <= 1950.0) {
tmp = (-x / Math.tan(B)) + (Math.pow(Math.sqrt((((F * F) + 2.0) - (-2.0 * x))), -1.0) * (F / B));
} else {
tmp = (1.0 - t_0) / Math.sin(B);
}
return tmp;
}
def code(F, B, x): t_0 = math.cos(B) * x tmp = 0 if F <= -5.5e-9: tmp = (-1.0 - t_0) / math.sin(B) elif F <= 1950.0: tmp = (-x / math.tan(B)) + (math.pow(math.sqrt((((F * F) + 2.0) - (-2.0 * x))), -1.0) * (F / B)) else: tmp = (1.0 - t_0) / math.sin(B) return tmp
function code(F, B, x) t_0 = Float64(cos(B) * x) tmp = 0.0 if (F <= -5.5e-9) tmp = Float64(Float64(-1.0 - t_0) / sin(B)); elseif (F <= 1950.0) tmp = Float64(Float64(Float64(-x) / tan(B)) + Float64((sqrt(Float64(Float64(Float64(F * F) + 2.0) - Float64(-2.0 * x))) ^ -1.0) * Float64(F / B))); else tmp = Float64(Float64(1.0 - 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 <= -5.5e-9) tmp = (-1.0 - t_0) / sin(B); elseif (F <= 1950.0) tmp = (-x / tan(B)) + ((sqrt((((F * F) + 2.0) - (-2.0 * x))) ^ -1.0) * (F / B)); else tmp = (1.0 - 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, -5.5e-9], N[(N[(-1.0 - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1950.0], N[(N[((-x) / N[Tan[B], $MachinePrecision]), $MachinePrecision] + N[(N[Power[N[Sqrt[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] - N[(-2.0 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], -1.0], $MachinePrecision] * N[(F / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos B \cdot x\\
\mathbf{if}\;F \leq -5.5 \cdot 10^{-9}:\\
\;\;\;\;\frac{-1 - t\_0}{\sin B}\\
\mathbf{elif}\;F \leq 1950:\\
\;\;\;\;\frac{-x}{\tan B} + {\left(\sqrt{\left(F \cdot F + 2\right) - -2 \cdot x}\right)}^{-1} \cdot \frac{F}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - t\_0}{\sin B}\\
\end{array}
\end{array}
if F < -5.4999999999999996e-9Initial program 61.0%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6497.5
Applied rewrites97.5%
if -5.4999999999999996e-9 < F < 1950Initial program 99.4%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6499.6
Applied rewrites99.6%
Taylor expanded in B around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites83.4%
if 1950 < F Initial program 52.4%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Final simplification91.8%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* (cos B) x)))
(if (<= F -5.5e-9)
(/ (- -1.0 t_0) (sin B))
(if (<= F 1950.0)
(+
(* x (/ -1.0 (tan B)))
(* (/ F B) (/ 1.0 (sqrt (+ (+ (* 2.0 x) 2.0) (* F F))))))
(/ (- 1.0 t_0) (sin B))))))
double code(double F, double B, double x) {
double t_0 = cos(B) * x;
double tmp;
if (F <= -5.5e-9) {
tmp = (-1.0 - t_0) / sin(B);
} else if (F <= 1950.0) {
tmp = (x * (-1.0 / tan(B))) + ((F / B) * (1.0 / sqrt((((2.0 * x) + 2.0) + (F * F)))));
} else {
tmp = (1.0 - 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 <= (-5.5d-9)) then
tmp = ((-1.0d0) - t_0) / sin(b)
else if (f <= 1950.0d0) then
tmp = (x * ((-1.0d0) / tan(b))) + ((f / b) * (1.0d0 / sqrt((((2.0d0 * x) + 2.0d0) + (f * f)))))
else
tmp = (1.0d0 - 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 <= -5.5e-9) {
tmp = (-1.0 - t_0) / Math.sin(B);
} else if (F <= 1950.0) {
tmp = (x * (-1.0 / Math.tan(B))) + ((F / B) * (1.0 / Math.sqrt((((2.0 * x) + 2.0) + (F * F)))));
} else {
tmp = (1.0 - t_0) / Math.sin(B);
}
return tmp;
}
def code(F, B, x): t_0 = math.cos(B) * x tmp = 0 if F <= -5.5e-9: tmp = (-1.0 - t_0) / math.sin(B) elif F <= 1950.0: tmp = (x * (-1.0 / math.tan(B))) + ((F / B) * (1.0 / math.sqrt((((2.0 * x) + 2.0) + (F * F))))) else: tmp = (1.0 - t_0) / math.sin(B) return tmp
function code(F, B, x) t_0 = Float64(cos(B) * x) tmp = 0.0 if (F <= -5.5e-9) tmp = Float64(Float64(-1.0 - t_0) / sin(B)); elseif (F <= 1950.0) tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(Float64(F / B) * Float64(1.0 / sqrt(Float64(Float64(Float64(2.0 * x) + 2.0) + Float64(F * F)))))); else tmp = Float64(Float64(1.0 - 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 <= -5.5e-9) tmp = (-1.0 - t_0) / sin(B); elseif (F <= 1950.0) tmp = (x * (-1.0 / tan(B))) + ((F / B) * (1.0 / sqrt((((2.0 * x) + 2.0) + (F * F))))); else tmp = (1.0 - 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, -5.5e-9], N[(N[(-1.0 - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 1950.0], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(F / B), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(N[(N[(2.0 * x), $MachinePrecision] + 2.0), $MachinePrecision] + N[(F * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - t$95$0), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos B \cdot x\\
\mathbf{if}\;F \leq -5.5 \cdot 10^{-9}:\\
\;\;\;\;\frac{-1 - t\_0}{\sin B}\\
\mathbf{elif}\;F \leq 1950:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{B} \cdot \frac{1}{\sqrt{\left(2 \cdot x + 2\right) + F \cdot F}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - t\_0}{\sin B}\\
\end{array}
\end{array}
if F < -5.4999999999999996e-9Initial program 61.0%
Taylor expanded in F around -inf
mul-1-negN/A
lower-neg.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6497.5
Applied rewrites97.5%
if -5.4999999999999996e-9 < F < 1950Initial program 99.4%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f64N/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f6483.2
Applied rewrites83.2%
if 1950 < F Initial program 52.4%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Final simplification91.7%
(FPCore (F B x)
:precision binary64
(if (<= F -2.85e+124)
(/ (/ (- (* -1.0 -1.0) (* x x)) (+ -1.0 x)) B)
(if (<= F 1950.0)
(+
(* x (/ -1.0 (tan B)))
(* (/ F B) (/ 1.0 (sqrt (+ (+ (* 2.0 x) 2.0) (* F F))))))
(/ (- 1.0 (* (cos B) x)) (sin B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -2.85e+124) {
tmp = (((-1.0 * -1.0) - (x * x)) / (-1.0 + x)) / B;
} else if (F <= 1950.0) {
tmp = (x * (-1.0 / tan(B))) + ((F / B) * (1.0 / sqrt((((2.0 * x) + 2.0) + (F * F)))));
} else {
tmp = (1.0 - (cos(B) * x)) / 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 <= (-2.85d+124)) then
tmp = ((((-1.0d0) * (-1.0d0)) - (x * x)) / ((-1.0d0) + x)) / b
else if (f <= 1950.0d0) then
tmp = (x * ((-1.0d0) / tan(b))) + ((f / b) * (1.0d0 / sqrt((((2.0d0 * x) + 2.0d0) + (f * f)))))
else
tmp = (1.0d0 - (cos(b) * x)) / sin(b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -2.85e+124) {
tmp = (((-1.0 * -1.0) - (x * x)) / (-1.0 + x)) / B;
} else if (F <= 1950.0) {
tmp = (x * (-1.0 / Math.tan(B))) + ((F / B) * (1.0 / Math.sqrt((((2.0 * x) + 2.0) + (F * F)))));
} else {
tmp = (1.0 - (Math.cos(B) * x)) / Math.sin(B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -2.85e+124: tmp = (((-1.0 * -1.0) - (x * x)) / (-1.0 + x)) / B elif F <= 1950.0: tmp = (x * (-1.0 / math.tan(B))) + ((F / B) * (1.0 / math.sqrt((((2.0 * x) + 2.0) + (F * F))))) else: tmp = (1.0 - (math.cos(B) * x)) / math.sin(B) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -2.85e+124) tmp = Float64(Float64(Float64(Float64(-1.0 * -1.0) - Float64(x * x)) / Float64(-1.0 + x)) / B); elseif (F <= 1950.0) tmp = Float64(Float64(x * Float64(-1.0 / tan(B))) + Float64(Float64(F / B) * Float64(1.0 / sqrt(Float64(Float64(Float64(2.0 * x) + 2.0) + Float64(F * F)))))); else tmp = Float64(Float64(1.0 - Float64(cos(B) * x)) / sin(B)); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -2.85e+124) tmp = (((-1.0 * -1.0) - (x * x)) / (-1.0 + x)) / B; elseif (F <= 1950.0) tmp = (x * (-1.0 / tan(B))) + ((F / B) * (1.0 / sqrt((((2.0 * x) + 2.0) + (F * F))))); else tmp = (1.0 - (cos(B) * x)) / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -2.85e+124], N[(N[(N[(N[(-1.0 * -1.0), $MachinePrecision] - N[(x * x), $MachinePrecision]), $MachinePrecision] / N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 1950.0], N[(N[(x * N[(-1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(F / B), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(N[(N[(2.0 * x), $MachinePrecision] + 2.0), $MachinePrecision] + N[(F * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -2.85 \cdot 10^{+124}:\\
\;\;\;\;\frac{\frac{-1 \cdot -1 - x \cdot x}{-1 + x}}{B}\\
\mathbf{elif}\;F \leq 1950:\\
\;\;\;\;x \cdot \frac{-1}{\tan B} + \frac{F}{B} \cdot \frac{1}{\sqrt{\left(2 \cdot x + 2\right) + F \cdot F}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos B \cdot x}{\sin B}\\
\end{array}
\end{array}
if F < -2.85000000000000011e124Initial program 36.5%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites39.7%
Taylor expanded in F around -inf
Applied rewrites59.4%
lift--.f64N/A
flip--N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-+.f6459.5
Applied rewrites59.5%
if -2.85000000000000011e124 < F < 1950Initial program 98.2%
Taylor expanded in B around 0
lower-*.f64N/A
lower-/.f64N/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
associate-+r+N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f6479.6
Applied rewrites79.6%
if 1950 < F Initial program 52.4%
Taylor expanded in F around inf
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Final simplification81.6%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ 1.0 (sqrt (+ (+ (* 2.0 x) 2.0) (* F F))))))
(if (<= B 15.6)
(/
(-
(+
(*
(- (* (* 0.16666666666666666 F) t_0) (* -0.3333333333333333 x))
(* B B))
(* t_0 F))
x)
B)
(* (sqrt (/ 1.0 (+ (* F F) 2.0))) (/ F (sin B))))))
double code(double F, double B, double x) {
double t_0 = 1.0 / sqrt((((2.0 * x) + 2.0) + (F * F)));
double tmp;
if (B <= 15.6) {
tmp = ((((((0.16666666666666666 * F) * t_0) - (-0.3333333333333333 * x)) * (B * B)) + (t_0 * F)) - x) / B;
} else {
tmp = sqrt((1.0 / ((F * F) + 2.0))) * (F / 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 = 1.0d0 / sqrt((((2.0d0 * x) + 2.0d0) + (f * f)))
if (b <= 15.6d0) then
tmp = ((((((0.16666666666666666d0 * f) * t_0) - ((-0.3333333333333333d0) * x)) * (b * b)) + (t_0 * f)) - x) / b
else
tmp = sqrt((1.0d0 / ((f * f) + 2.0d0))) * (f / sin(b))
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = 1.0 / Math.sqrt((((2.0 * x) + 2.0) + (F * F)));
double tmp;
if (B <= 15.6) {
tmp = ((((((0.16666666666666666 * F) * t_0) - (-0.3333333333333333 * x)) * (B * B)) + (t_0 * F)) - x) / B;
} else {
tmp = Math.sqrt((1.0 / ((F * F) + 2.0))) * (F / Math.sin(B));
}
return tmp;
}
def code(F, B, x): t_0 = 1.0 / math.sqrt((((2.0 * x) + 2.0) + (F * F))) tmp = 0 if B <= 15.6: tmp = ((((((0.16666666666666666 * F) * t_0) - (-0.3333333333333333 * x)) * (B * B)) + (t_0 * F)) - x) / B else: tmp = math.sqrt((1.0 / ((F * F) + 2.0))) * (F / math.sin(B)) return tmp
function code(F, B, x) t_0 = Float64(1.0 / sqrt(Float64(Float64(Float64(2.0 * x) + 2.0) + Float64(F * F)))) tmp = 0.0 if (B <= 15.6) tmp = Float64(Float64(Float64(Float64(Float64(Float64(Float64(0.16666666666666666 * F) * t_0) - Float64(-0.3333333333333333 * x)) * Float64(B * B)) + Float64(t_0 * F)) - x) / B); else tmp = Float64(sqrt(Float64(1.0 / Float64(Float64(F * F) + 2.0))) * Float64(F / sin(B))); end return tmp end
function tmp_2 = code(F, B, x) t_0 = 1.0 / sqrt((((2.0 * x) + 2.0) + (F * F))); tmp = 0.0; if (B <= 15.6) tmp = ((((((0.16666666666666666 * F) * t_0) - (-0.3333333333333333 * x)) * (B * B)) + (t_0 * F)) - x) / B; else tmp = sqrt((1.0 / ((F * F) + 2.0))) * (F / sin(B)); end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = N[(1.0 / N[Sqrt[N[(N[(N[(2.0 * x), $MachinePrecision] + 2.0), $MachinePrecision] + N[(F * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 15.6], N[(N[(N[(N[(N[(N[(N[(0.16666666666666666 * F), $MachinePrecision] * t$95$0), $MachinePrecision] - N[(-0.3333333333333333 * x), $MachinePrecision]), $MachinePrecision] * N[(B * B), $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[Sqrt[N[(1.0 / N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\sqrt{\left(2 \cdot x + 2\right) + F \cdot F}}\\
\mathbf{if}\;B \leq 15.6:\\
\;\;\;\;\frac{\left(\left(\left(0.16666666666666666 \cdot F\right) \cdot t\_0 - -0.3333333333333333 \cdot x\right) \cdot \left(B \cdot B\right) + t\_0 \cdot F\right) - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{1}{F \cdot F + 2}} \cdot \frac{F}{\sin B}\\
\end{array}
\end{array}
if B < 15.5999999999999996Initial program 74.0%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites56.0%
if 15.5999999999999996 < B Initial program 81.3%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-*.f64N/A
lift-+.f64N/A
lift-sin.f64N/A
lift-/.f6426.3
Applied rewrites26.3%
lift-pow.f64N/A
lift-+.f64N/A
lift-*.f64N/A
unpow-1N/A
lower-/.f64N/A
lift-*.f64N/A
lift-+.f6426.3
Applied rewrites26.3%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ 1.0 (sqrt (+ (+ (* 2.0 x) 2.0) (* F F))))))
(if (<= B 2.9e+26)
(/
(-
(+
(*
(- (* (* 0.16666666666666666 F) t_0) (* -0.3333333333333333 x))
(* B B))
(* t_0 F))
x)
B)
(/ 1.0 (sin B)))))
double code(double F, double B, double x) {
double t_0 = 1.0 / sqrt((((2.0 * x) + 2.0) + (F * F)));
double tmp;
if (B <= 2.9e+26) {
tmp = ((((((0.16666666666666666 * F) * t_0) - (-0.3333333333333333 * x)) * (B * B)) + (t_0 * F)) - 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) :: t_0
real(8) :: tmp
t_0 = 1.0d0 / sqrt((((2.0d0 * x) + 2.0d0) + (f * f)))
if (b <= 2.9d+26) then
tmp = ((((((0.16666666666666666d0 * f) * t_0) - ((-0.3333333333333333d0) * x)) * (b * b)) + (t_0 * f)) - 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 t_0 = 1.0 / Math.sqrt((((2.0 * x) + 2.0) + (F * F)));
double tmp;
if (B <= 2.9e+26) {
tmp = ((((((0.16666666666666666 * F) * t_0) - (-0.3333333333333333 * x)) * (B * B)) + (t_0 * F)) - x) / B;
} else {
tmp = 1.0 / Math.sin(B);
}
return tmp;
}
def code(F, B, x): t_0 = 1.0 / math.sqrt((((2.0 * x) + 2.0) + (F * F))) tmp = 0 if B <= 2.9e+26: tmp = ((((((0.16666666666666666 * F) * t_0) - (-0.3333333333333333 * x)) * (B * B)) + (t_0 * F)) - x) / B else: tmp = 1.0 / math.sin(B) return tmp
function code(F, B, x) t_0 = Float64(1.0 / sqrt(Float64(Float64(Float64(2.0 * x) + 2.0) + Float64(F * F)))) tmp = 0.0 if (B <= 2.9e+26) tmp = Float64(Float64(Float64(Float64(Float64(Float64(Float64(0.16666666666666666 * F) * t_0) - Float64(-0.3333333333333333 * x)) * Float64(B * B)) + Float64(t_0 * F)) - x) / B); else tmp = Float64(1.0 / sin(B)); end return tmp end
function tmp_2 = code(F, B, x) t_0 = 1.0 / sqrt((((2.0 * x) + 2.0) + (F * F))); tmp = 0.0; if (B <= 2.9e+26) tmp = ((((((0.16666666666666666 * F) * t_0) - (-0.3333333333333333 * x)) * (B * B)) + (t_0 * F)) - x) / B; else tmp = 1.0 / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = N[(1.0 / N[Sqrt[N[(N[(N[(2.0 * x), $MachinePrecision] + 2.0), $MachinePrecision] + N[(F * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 2.9e+26], N[(N[(N[(N[(N[(N[(N[(0.16666666666666666 * F), $MachinePrecision] * t$95$0), $MachinePrecision] - N[(-0.3333333333333333 * x), $MachinePrecision]), $MachinePrecision] * N[(B * B), $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\sqrt{\left(2 \cdot x + 2\right) + F \cdot F}}\\
\mathbf{if}\;B \leq 2.9 \cdot 10^{+26}:\\
\;\;\;\;\frac{\left(\left(\left(0.16666666666666666 \cdot F\right) \cdot t\_0 - -0.3333333333333333 \cdot x\right) \cdot \left(B \cdot B\right) + t\_0 \cdot F\right) - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\
\end{array}
\end{array}
if B < 2.9e26Initial program 74.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites55.3%
if 2.9e26 < B Initial program 80.3%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-*.f64N/A
lift-+.f64N/A
lift-sin.f64N/A
lift-/.f6424.1
Applied rewrites24.1%
Taylor expanded in F around inf
inv-powN/A
lower-pow.f64N/A
lift-sin.f6419.2
Applied rewrites19.2%
lift-pow.f64N/A
lift-sin.f64N/A
inv-powN/A
lower-/.f64N/A
lift-sin.f6419.2
Applied rewrites19.2%
(FPCore (F B x) :precision binary64 (if (<= B 1.1e+27) (/ (- (/ F (sqrt (- (+ (* F F) 2.0) (* -2.0 x)))) x) B) (/ 1.0 (sin B))))
double code(double F, double B, double x) {
double tmp;
if (B <= 1.1e+27) {
tmp = ((F / sqrt((((F * F) + 2.0) - (-2.0 * x)))) - 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 (b <= 1.1d+27) then
tmp = ((f / sqrt((((f * f) + 2.0d0) - ((-2.0d0) * x)))) - 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 (B <= 1.1e+27) {
tmp = ((F / Math.sqrt((((F * F) + 2.0) - (-2.0 * x)))) - x) / B;
} else {
tmp = 1.0 / Math.sin(B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if B <= 1.1e+27: tmp = ((F / math.sqrt((((F * F) + 2.0) - (-2.0 * x)))) - x) / B else: tmp = 1.0 / math.sin(B) return tmp
function code(F, B, x) tmp = 0.0 if (B <= 1.1e+27) tmp = Float64(Float64(Float64(F / sqrt(Float64(Float64(Float64(F * F) + 2.0) - Float64(-2.0 * x)))) - x) / B); else tmp = Float64(1.0 / sin(B)); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (B <= 1.1e+27) tmp = ((F / sqrt((((F * F) + 2.0) - (-2.0 * x)))) - x) / B; else tmp = 1.0 / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[B, 1.1e+27], N[(N[(N[(F / N[Sqrt[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] - N[(-2.0 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 1.1 \cdot 10^{+27}:\\
\;\;\;\;\frac{\frac{F}{\sqrt{\left(F \cdot F + 2\right) - -2 \cdot x}} - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B}\\
\end{array}
\end{array}
if B < 1.0999999999999999e27Initial program 74.4%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6474.5
Applied rewrites74.5%
Taylor expanded in B around 0
Applied rewrites55.2%
if 1.0999999999999999e27 < B Initial program 80.3%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-*.f64N/A
lift-+.f64N/A
lift-sin.f64N/A
lift-/.f6424.1
Applied rewrites24.1%
Taylor expanded in F around inf
inv-powN/A
lower-pow.f64N/A
lift-sin.f6419.2
Applied rewrites19.2%
lift-pow.f64N/A
lift-sin.f64N/A
inv-powN/A
lower-/.f64N/A
lift-sin.f6419.2
Applied rewrites19.2%
Final simplification47.4%
(FPCore (F B x) :precision binary64 (if (<= B 8.5e-11) (/ (- (/ F (sqrt (- (+ (* F F) 2.0) (* -2.0 x)))) x) B) (/ -1.0 (sin B))))
double code(double F, double B, double x) {
double tmp;
if (B <= 8.5e-11) {
tmp = ((F / sqrt((((F * F) + 2.0) - (-2.0 * x)))) - 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 (b <= 8.5d-11) then
tmp = ((f / sqrt((((f * f) + 2.0d0) - ((-2.0d0) * x)))) - 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 (B <= 8.5e-11) {
tmp = ((F / Math.sqrt((((F * F) + 2.0) - (-2.0 * x)))) - x) / B;
} else {
tmp = -1.0 / Math.sin(B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if B <= 8.5e-11: tmp = ((F / math.sqrt((((F * F) + 2.0) - (-2.0 * x)))) - x) / B else: tmp = -1.0 / math.sin(B) return tmp
function code(F, B, x) tmp = 0.0 if (B <= 8.5e-11) tmp = Float64(Float64(Float64(F / sqrt(Float64(Float64(Float64(F * F) + 2.0) - Float64(-2.0 * x)))) - x) / B); else tmp = Float64(-1.0 / sin(B)); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (B <= 8.5e-11) tmp = ((F / sqrt((((F * F) + 2.0) - (-2.0 * x)))) - x) / B; else tmp = -1.0 / sin(B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[B, 8.5e-11], N[(N[(N[(F / N[Sqrt[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] - N[(-2.0 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;B \leq 8.5 \cdot 10^{-11}:\\
\;\;\;\;\frac{\frac{F}{\sqrt{\left(F \cdot F + 2\right) - -2 \cdot x}} - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{\sin B}\\
\end{array}
\end{array}
if B < 8.50000000000000037e-11Initial program 73.7%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6473.8
Applied rewrites73.8%
Taylor expanded in B around 0
Applied rewrites56.2%
if 8.50000000000000037e-11 < B Initial program 81.9%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
+-commutativeN/A
pow2N/A
lift-*.f64N/A
lift-+.f64N/A
lift-sin.f64N/A
lift-/.f6425.5
Applied rewrites25.5%
Taylor expanded in F around -inf
lower-/.f64N/A
lift-sin.f6413.9
Applied rewrites13.9%
Final simplification46.1%
(FPCore (F B x)
:precision binary64
(if (<= F -5.5e-9)
(/ (- (- (* 0.5 (/ (- 2.0 (* -2.0 x)) (* F F))) 1.0) x) B)
(if (<= F 1.2e+168)
(/ (- (/ F (sqrt (- (+ (* F F) 2.0) (* -2.0 x)))) x) B)
(+ (/ (* -0.5 (+ (* 2.0 x) 2.0)) (* (* F F) B)) (/ (- 1.0 x) B)))))
double code(double F, double B, double x) {
double tmp;
if (F <= -5.5e-9) {
tmp = (((0.5 * ((2.0 - (-2.0 * x)) / (F * F))) - 1.0) - x) / B;
} else if (F <= 1.2e+168) {
tmp = ((F / sqrt((((F * F) + 2.0) - (-2.0 * x)))) - x) / B;
} else {
tmp = ((-0.5 * ((2.0 * x) + 2.0)) / ((F * F) * B)) + ((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 <= (-5.5d-9)) then
tmp = (((0.5d0 * ((2.0d0 - ((-2.0d0) * x)) / (f * f))) - 1.0d0) - x) / b
else if (f <= 1.2d+168) then
tmp = ((f / sqrt((((f * f) + 2.0d0) - ((-2.0d0) * x)))) - x) / b
else
tmp = (((-0.5d0) * ((2.0d0 * x) + 2.0d0)) / ((f * f) * b)) + ((1.0d0 - x) / b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -5.5e-9) {
tmp = (((0.5 * ((2.0 - (-2.0 * x)) / (F * F))) - 1.0) - x) / B;
} else if (F <= 1.2e+168) {
tmp = ((F / Math.sqrt((((F * F) + 2.0) - (-2.0 * x)))) - x) / B;
} else {
tmp = ((-0.5 * ((2.0 * x) + 2.0)) / ((F * F) * B)) + ((1.0 - x) / B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -5.5e-9: tmp = (((0.5 * ((2.0 - (-2.0 * x)) / (F * F))) - 1.0) - x) / B elif F <= 1.2e+168: tmp = ((F / math.sqrt((((F * F) + 2.0) - (-2.0 * x)))) - x) / B else: tmp = ((-0.5 * ((2.0 * x) + 2.0)) / ((F * F) * B)) + ((1.0 - x) / B) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -5.5e-9) tmp = Float64(Float64(Float64(Float64(0.5 * Float64(Float64(2.0 - Float64(-2.0 * x)) / Float64(F * F))) - 1.0) - x) / B); elseif (F <= 1.2e+168) tmp = Float64(Float64(Float64(F / sqrt(Float64(Float64(Float64(F * F) + 2.0) - Float64(-2.0 * x)))) - x) / B); else tmp = Float64(Float64(Float64(-0.5 * Float64(Float64(2.0 * x) + 2.0)) / Float64(Float64(F * F) * B)) + Float64(Float64(1.0 - x) / B)); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -5.5e-9) tmp = (((0.5 * ((2.0 - (-2.0 * x)) / (F * F))) - 1.0) - x) / B; elseif (F <= 1.2e+168) tmp = ((F / sqrt((((F * F) + 2.0) - (-2.0 * x)))) - x) / B; else tmp = ((-0.5 * ((2.0 * x) + 2.0)) / ((F * F) * B)) + ((1.0 - x) / B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -5.5e-9], N[(N[(N[(N[(0.5 * N[(N[(2.0 - N[(-2.0 * x), $MachinePrecision]), $MachinePrecision] / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 1.2e+168], N[(N[(N[(F / N[Sqrt[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] - N[(-2.0 * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(-0.5 * N[(N[(2.0 * x), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] / N[(N[(F * F), $MachinePrecision] * B), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -5.5 \cdot 10^{-9}:\\
\;\;\;\;\frac{\left(0.5 \cdot \frac{2 - -2 \cdot x}{F \cdot F} - 1\right) - x}{B}\\
\mathbf{elif}\;F \leq 1.2 \cdot 10^{+168}:\\
\;\;\;\;\frac{\frac{F}{\sqrt{\left(F \cdot F + 2\right) - -2 \cdot x}} - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5 \cdot \left(2 \cdot x + 2\right)}{\left(F \cdot F\right) \cdot B} + \frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -5.4999999999999996e-9Initial program 61.0%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites42.5%
Taylor expanded in F around -inf
metadata-evalN/A
lower--.f64N/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
lower--.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f6454.1
Applied rewrites54.1%
if -5.4999999999999996e-9 < F < 1.20000000000000005e168Initial program 95.4%
lift-*.f64N/A
lift-/.f64N/A
lift-tan.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-tan.f6495.6
Applied rewrites95.6%
Taylor expanded in B around 0
Applied rewrites50.1%
if 1.20000000000000005e168 < F Initial program 28.6%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites22.5%
Taylor expanded in F around -inf
Applied rewrites22.5%
Taylor expanded in F around inf
metadata-evalN/A
metadata-evalN/A
associate--l+N/A
div-subN/A
lower-+.f64N/A
Applied rewrites40.0%
Final simplification49.8%
(FPCore (F B x)
:precision binary64
(if (<= F -5.5e-9)
(/ (- (- (* 0.5 (/ (- 2.0 (* -2.0 x)) (* F F))) 1.0) x) B)
(if (<= F 500.0)
(/ (- (* (/ 1.0 (sqrt (+ 2.0 (* F F)))) F) x) B)
(/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -5.5e-9) {
tmp = (((0.5 * ((2.0 - (-2.0 * x)) / (F * F))) - 1.0) - x) / B;
} else if (F <= 500.0) {
tmp = (((1.0 / sqrt((2.0 + (F * F)))) * F) - x) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-5.5d-9)) then
tmp = (((0.5d0 * ((2.0d0 - ((-2.0d0) * x)) / (f * f))) - 1.0d0) - x) / b
else if (f <= 500.0d0) then
tmp = (((1.0d0 / sqrt((2.0d0 + (f * f)))) * f) - x) / b
else
tmp = (1.0d0 - x) / b
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -5.5e-9) {
tmp = (((0.5 * ((2.0 - (-2.0 * x)) / (F * F))) - 1.0) - x) / B;
} else if (F <= 500.0) {
tmp = (((1.0 / Math.sqrt((2.0 + (F * F)))) * F) - x) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -5.5e-9: tmp = (((0.5 * ((2.0 - (-2.0 * x)) / (F * F))) - 1.0) - x) / B elif F <= 500.0: tmp = (((1.0 / math.sqrt((2.0 + (F * F)))) * F) - x) / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -5.5e-9) tmp = Float64(Float64(Float64(Float64(0.5 * Float64(Float64(2.0 - Float64(-2.0 * x)) / Float64(F * F))) - 1.0) - x) / B); elseif (F <= 500.0) tmp = Float64(Float64(Float64(Float64(1.0 / sqrt(Float64(2.0 + Float64(F * F)))) * F) - x) / B); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -5.5e-9) tmp = (((0.5 * ((2.0 - (-2.0 * x)) / (F * F))) - 1.0) - x) / B; elseif (F <= 500.0) tmp = (((1.0 / sqrt((2.0 + (F * F)))) * F) - x) / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -5.5e-9], N[(N[(N[(N[(0.5 * N[(N[(2.0 - N[(-2.0 * x), $MachinePrecision]), $MachinePrecision] / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 500.0], N[(N[(N[(N[(1.0 / N[Sqrt[N[(2.0 + N[(F * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -5.5 \cdot 10^{-9}:\\
\;\;\;\;\frac{\left(0.5 \cdot \frac{2 - -2 \cdot x}{F \cdot F} - 1\right) - x}{B}\\
\mathbf{elif}\;F \leq 500:\\
\;\;\;\;\frac{\frac{1}{\sqrt{2 + F \cdot F}} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -5.4999999999999996e-9Initial program 61.0%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites42.5%
Taylor expanded in F around -inf
metadata-evalN/A
lower--.f64N/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
lower--.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f6454.1
Applied rewrites54.1%
if -5.4999999999999996e-9 < F < 500Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites51.6%
Taylor expanded in x around 0
Applied rewrites51.6%
if 500 < F Initial program 52.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites32.5%
Taylor expanded in F around inf
Applied rewrites42.0%
(FPCore (F B x)
:precision binary64
(let* ((t_0 (* 0.5 (/ (- 2.0 (* -2.0 x)) (* F F)))))
(if (<= F -5.5e-9)
(/ (- (- t_0 1.0) x) B)
(if (<= F 0.057) (/ (- (* (sqrt 0.5) F) x) B) (/ (- (- 1.0 t_0) x) B)))))
double code(double F, double B, double x) {
double t_0 = 0.5 * ((2.0 - (-2.0 * x)) / (F * F));
double tmp;
if (F <= -5.5e-9) {
tmp = ((t_0 - 1.0) - x) / B;
} else if (F <= 0.057) {
tmp = ((sqrt(0.5) * F) - x) / B;
} else {
tmp = ((1.0 - t_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) :: t_0
real(8) :: tmp
t_0 = 0.5d0 * ((2.0d0 - ((-2.0d0) * x)) / (f * f))
if (f <= (-5.5d-9)) then
tmp = ((t_0 - 1.0d0) - x) / b
else if (f <= 0.057d0) then
tmp = ((sqrt(0.5d0) * f) - x) / b
else
tmp = ((1.0d0 - t_0) - x) / b
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double t_0 = 0.5 * ((2.0 - (-2.0 * x)) / (F * F));
double tmp;
if (F <= -5.5e-9) {
tmp = ((t_0 - 1.0) - x) / B;
} else if (F <= 0.057) {
tmp = ((Math.sqrt(0.5) * F) - x) / B;
} else {
tmp = ((1.0 - t_0) - x) / B;
}
return tmp;
}
def code(F, B, x): t_0 = 0.5 * ((2.0 - (-2.0 * x)) / (F * F)) tmp = 0 if F <= -5.5e-9: tmp = ((t_0 - 1.0) - x) / B elif F <= 0.057: tmp = ((math.sqrt(0.5) * F) - x) / B else: tmp = ((1.0 - t_0) - x) / B return tmp
function code(F, B, x) t_0 = Float64(0.5 * Float64(Float64(2.0 - Float64(-2.0 * x)) / Float64(F * F))) tmp = 0.0 if (F <= -5.5e-9) tmp = Float64(Float64(Float64(t_0 - 1.0) - x) / B); elseif (F <= 0.057) tmp = Float64(Float64(Float64(sqrt(0.5) * F) - x) / B); else tmp = Float64(Float64(Float64(1.0 - t_0) - x) / B); end return tmp end
function tmp_2 = code(F, B, x) t_0 = 0.5 * ((2.0 - (-2.0 * x)) / (F * F)); tmp = 0.0; if (F <= -5.5e-9) tmp = ((t_0 - 1.0) - x) / B; elseif (F <= 0.057) tmp = ((sqrt(0.5) * F) - x) / B; else tmp = ((1.0 - t_0) - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := Block[{t$95$0 = N[(0.5 * N[(N[(2.0 - N[(-2.0 * x), $MachinePrecision]), $MachinePrecision] / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -5.5e-9], N[(N[(N[(t$95$0 - 1.0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 0.057], N[(N[(N[(N[Sqrt[0.5], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(1.0 - t$95$0), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \frac{2 - -2 \cdot x}{F \cdot F}\\
\mathbf{if}\;F \leq -5.5 \cdot 10^{-9}:\\
\;\;\;\;\frac{\left(t\_0 - 1\right) - x}{B}\\
\mathbf{elif}\;F \leq 0.057:\\
\;\;\;\;\frac{\sqrt{0.5} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 - t\_0\right) - x}{B}\\
\end{array}
\end{array}
if F < -5.4999999999999996e-9Initial program 61.0%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites42.5%
Taylor expanded in F around -inf
metadata-evalN/A
lower--.f64N/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
lower--.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f6454.1
Applied rewrites54.1%
if -5.4999999999999996e-9 < F < 0.0570000000000000021Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites50.7%
Taylor expanded in F around 0
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
lower--.f64N/A
lift-*.f6450.8
Applied rewrites50.8%
Taylor expanded in x around 0
Applied rewrites50.8%
if 0.0570000000000000021 < F Initial program 53.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites34.4%
Taylor expanded in F around inf
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f64N/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
lower--.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f6443.2
Applied rewrites43.2%
(FPCore (F B x)
:precision binary64
(if (<= F -6.2e+23)
(/ (- -1.0 x) B)
(if (<= F 0.057)
(/ (- (* (sqrt 0.5) F) x) B)
(/ (- (- 1.0 (* 0.5 (/ (- 2.0 (* -2.0 x)) (* F F)))) x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -6.2e+23) {
tmp = (-1.0 - x) / B;
} else if (F <= 0.057) {
tmp = ((sqrt(0.5) * F) - x) / B;
} else {
tmp = ((1.0 - (0.5 * ((2.0 - (-2.0 * x)) / (F * F)))) - 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 <= (-6.2d+23)) then
tmp = ((-1.0d0) - x) / b
else if (f <= 0.057d0) then
tmp = ((sqrt(0.5d0) * f) - x) / b
else
tmp = ((1.0d0 - (0.5d0 * ((2.0d0 - ((-2.0d0) * x)) / (f * f)))) - x) / b
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -6.2e+23) {
tmp = (-1.0 - x) / B;
} else if (F <= 0.057) {
tmp = ((Math.sqrt(0.5) * F) - x) / B;
} else {
tmp = ((1.0 - (0.5 * ((2.0 - (-2.0 * x)) / (F * F)))) - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -6.2e+23: tmp = (-1.0 - x) / B elif F <= 0.057: tmp = ((math.sqrt(0.5) * F) - x) / B else: tmp = ((1.0 - (0.5 * ((2.0 - (-2.0 * x)) / (F * F)))) - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -6.2e+23) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 0.057) tmp = Float64(Float64(Float64(sqrt(0.5) * F) - x) / B); else tmp = Float64(Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(2.0 - Float64(-2.0 * x)) / Float64(F * F)))) - x) / B); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -6.2e+23) tmp = (-1.0 - x) / B; elseif (F <= 0.057) tmp = ((sqrt(0.5) * F) - x) / B; else tmp = ((1.0 - (0.5 * ((2.0 - (-2.0 * x)) / (F * F)))) - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -6.2e+23], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 0.057], N[(N[(N[(N[Sqrt[0.5], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(N[(1.0 - N[(0.5 * N[(N[(2.0 - N[(-2.0 * x), $MachinePrecision]), $MachinePrecision] / N[(F * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -6.2 \cdot 10^{+23}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 0.057:\\
\;\;\;\;\frac{\sqrt{0.5} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 - 0.5 \cdot \frac{2 - -2 \cdot x}{F \cdot F}\right) - x}{B}\\
\end{array}
\end{array}
if F < -6.19999999999999941e23Initial program 58.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites44.0%
Taylor expanded in F around -inf
Applied rewrites56.1%
if -6.19999999999999941e23 < F < 0.0570000000000000021Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites49.5%
Taylor expanded in F around 0
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
lower--.f64N/A
lift-*.f6449.5
Applied rewrites49.5%
Taylor expanded in x around 0
Applied rewrites49.5%
if 0.0570000000000000021 < F Initial program 53.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites34.4%
Taylor expanded in F around inf
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f64N/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
lower--.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f6443.2
Applied rewrites43.2%
(FPCore (F B x) :precision binary64 (if (<= F -6.2e+23) (/ (- -1.0 x) B) (if (<= F 3.8e-8) (/ (- (* (sqrt 0.5) F) x) B) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -6.2e+23) {
tmp = (-1.0 - x) / B;
} else if (F <= 3.8e-8) {
tmp = ((sqrt(0.5) * F) - x) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-6.2d+23)) then
tmp = ((-1.0d0) - x) / b
else if (f <= 3.8d-8) then
tmp = ((sqrt(0.5d0) * f) - x) / b
else
tmp = (1.0d0 - x) / b
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -6.2e+23) {
tmp = (-1.0 - x) / B;
} else if (F <= 3.8e-8) {
tmp = ((Math.sqrt(0.5) * F) - x) / B;
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -6.2e+23: tmp = (-1.0 - x) / B elif F <= 3.8e-8: tmp = ((math.sqrt(0.5) * F) - x) / B else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -6.2e+23) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 3.8e-8) tmp = Float64(Float64(Float64(sqrt(0.5) * F) - x) / B); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -6.2e+23) tmp = (-1.0 - x) / B; elseif (F <= 3.8e-8) tmp = ((sqrt(0.5) * F) - x) / B; else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -6.2e+23], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 3.8e-8], N[(N[(N[(N[Sqrt[0.5], $MachinePrecision] * F), $MachinePrecision] - x), $MachinePrecision] / B), $MachinePrecision], N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -6.2 \cdot 10^{+23}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 3.8 \cdot 10^{-8}:\\
\;\;\;\;\frac{\sqrt{0.5} \cdot F - x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -6.19999999999999941e23Initial program 58.3%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites44.0%
Taylor expanded in F around -inf
Applied rewrites56.1%
if -6.19999999999999941e23 < F < 3.80000000000000028e-8Initial program 99.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites49.1%
Taylor expanded in F around 0
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
lower--.f64N/A
lift-*.f6449.1
Applied rewrites49.1%
Taylor expanded in x around 0
Applied rewrites49.1%
if 3.80000000000000028e-8 < F Initial program 54.4%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites35.3%
Taylor expanded in F around inf
Applied rewrites43.7%
(FPCore (F B x) :precision binary64 (if (<= F -3.6e-97) (/ (- -1.0 x) B) (if (<= F 1.55e-226) (- (/ x B)) (/ (- 1.0 x) B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.6e-97) {
tmp = (-1.0 - x) / B;
} else if (F <= 1.55e-226) {
tmp = -(x / B);
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-3.6d-97)) then
tmp = ((-1.0d0) - x) / b
else if (f <= 1.55d-226) then
tmp = -(x / b)
else
tmp = (1.0d0 - x) / b
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -3.6e-97) {
tmp = (-1.0 - x) / B;
} else if (F <= 1.55e-226) {
tmp = -(x / B);
} else {
tmp = (1.0 - x) / B;
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -3.6e-97: tmp = (-1.0 - x) / B elif F <= 1.55e-226: tmp = -(x / B) else: tmp = (1.0 - x) / B return tmp
function code(F, B, x) tmp = 0.0 if (F <= -3.6e-97) tmp = Float64(Float64(-1.0 - x) / B); elseif (F <= 1.55e-226) tmp = Float64(-Float64(x / B)); else tmp = Float64(Float64(1.0 - x) / B); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -3.6e-97) tmp = (-1.0 - x) / B; elseif (F <= 1.55e-226) tmp = -(x / B); else tmp = (1.0 - x) / B; end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -3.6e-97], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[F, 1.55e-226], (-N[(x / B), $MachinePrecision]), N[(N[(1.0 - x), $MachinePrecision] / B), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.6 \cdot 10^{-97}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{elif}\;F \leq 1.55 \cdot 10^{-226}:\\
\;\;\;\;-\frac{x}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - x}{B}\\
\end{array}
\end{array}
if F < -3.59999999999999997e-97Initial program 64.7%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites45.7%
Taylor expanded in F around -inf
Applied rewrites51.6%
if -3.59999999999999997e-97 < F < 1.54999999999999994e-226Initial program 99.5%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6484.0
Applied rewrites84.0%
Taylor expanded in B around 0
lower-/.f6449.6
Applied rewrites49.6%
if 1.54999999999999994e-226 < F Initial program 70.8%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites35.9%
Taylor expanded in F around inf
Applied rewrites33.0%
(FPCore (F B x) :precision binary64 (if (<= F -3.6e-97) (/ (- -1.0 x) B) (- (/ x B))))
double code(double F, double B, double x) {
double tmp;
if (F <= -3.6e-97) {
tmp = (-1.0 - x) / B;
} else {
tmp = -(x / B);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: tmp
if (f <= (-3.6d-97)) then
tmp = ((-1.0d0) - x) / b
else
tmp = -(x / b)
end if
code = tmp
end function
public static double code(double F, double B, double x) {
double tmp;
if (F <= -3.6e-97) {
tmp = (-1.0 - x) / B;
} else {
tmp = -(x / B);
}
return tmp;
}
def code(F, B, x): tmp = 0 if F <= -3.6e-97: tmp = (-1.0 - x) / B else: tmp = -(x / B) return tmp
function code(F, B, x) tmp = 0.0 if (F <= -3.6e-97) tmp = Float64(Float64(-1.0 - x) / B); else tmp = Float64(-Float64(x / B)); end return tmp end
function tmp_2 = code(F, B, x) tmp = 0.0; if (F <= -3.6e-97) tmp = (-1.0 - x) / B; else tmp = -(x / B); end tmp_2 = tmp; end
code[F_, B_, x_] := If[LessEqual[F, -3.6e-97], N[(N[(-1.0 - x), $MachinePrecision] / B), $MachinePrecision], (-N[(x / B), $MachinePrecision])]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.6 \cdot 10^{-97}:\\
\;\;\;\;\frac{-1 - x}{B}\\
\mathbf{else}:\\
\;\;\;\;-\frac{x}{B}\\
\end{array}
\end{array}
if F < -3.59999999999999997e-97Initial program 64.7%
Taylor expanded in B around 0
lower-/.f64N/A
Applied rewrites45.7%
Taylor expanded in F around -inf
Applied rewrites51.6%
if -3.59999999999999997e-97 < F Initial program 80.9%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6462.2
Applied rewrites62.2%
Taylor expanded in B around 0
lower-/.f6431.8
Applied rewrites31.8%
(FPCore (F B x) :precision binary64 (- (/ x B)))
double code(double F, double B, double x) {
return -(x / B);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(f, b, x)
use fmin_fmax_functions
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = -(x / b)
end function
public static double code(double F, double B, double x) {
return -(x / B);
}
def code(F, B, x): return -(x / B)
function code(F, B, x) return Float64(-Float64(x / B)) end
function tmp = code(F, B, x) tmp = -(x / B); end
code[F_, B_, x_] := (-N[(x / B), $MachinePrecision])
\begin{array}{l}
\\
-\frac{x}{B}
\end{array}
Initial program 75.7%
Taylor expanded in F around 0
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sin.f6456.8
Applied rewrites56.8%
Taylor expanded in B around 0
lower-/.f6428.8
Applied rewrites28.8%
herbie shell --seed 2025065
(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))))))