
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
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(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
Herbie found 20 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
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(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d h)))
(t_1 (/ D (+ d d)))
(t_2 (* t_1 M))
(t_3 (- 1.0 (* t_2 (* (/ (* (* D M) h) (* (+ d d) l)) 0.5))))
(t_4 (sqrt (- d))))
(if (<= h -2e-44)
(* (* (/ t_4 (sqrt (- l))) t_0) t_3)
(if (<= h -2.1e-307)
(*
(* (* t_4 (sqrt (/ -1.0 h))) (pow (/ d l) (/ 1.0 2.0)))
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))
(if (<= h 2e+53)
(* (* (/ (sqrt d) (sqrt l)) t_0) t_3)
(*
(/ (sqrt (* (/ d l) d)) (sqrt h))
(- 1.0 (* t_2 (/ (* (* h (* M t_1)) 0.5) l)))))))))double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / h));
double t_1 = D / (d + d);
double t_2 = t_1 * M;
double t_3 = 1.0 - (t_2 * ((((D * M) * h) / ((d + d) * l)) * 0.5));
double t_4 = sqrt(-d);
double tmp;
if (h <= -2e-44) {
tmp = ((t_4 / sqrt(-l)) * t_0) * t_3;
} else if (h <= -2.1e-307) {
tmp = ((t_4 * sqrt((-1.0 / h))) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
} else if (h <= 2e+53) {
tmp = ((sqrt(d) / sqrt(l)) * t_0) * t_3;
} else {
tmp = (sqrt(((d / l) * d)) / sqrt(h)) * (1.0 - (t_2 * (((h * (M * t_1)) * 0.5) / l)));
}
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(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_0 = sqrt((d / h))
t_1 = d_1 / (d + d)
t_2 = t_1 * m
t_3 = 1.0d0 - (t_2 * ((((d_1 * m) * h) / ((d + d) * l)) * 0.5d0))
t_4 = sqrt(-d)
if (h <= (-2d-44)) then
tmp = ((t_4 / sqrt(-l)) * t_0) * t_3
else if (h <= (-2.1d-307)) then
tmp = ((t_4 * sqrt(((-1.0d0) / h))) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
else if (h <= 2d+53) then
tmp = ((sqrt(d) / sqrt(l)) * t_0) * t_3
else
tmp = (sqrt(((d / l) * d)) / sqrt(h)) * (1.0d0 - (t_2 * (((h * (m * t_1)) * 0.5d0) / l)))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / h));
double t_1 = D / (d + d);
double t_2 = t_1 * M;
double t_3 = 1.0 - (t_2 * ((((D * M) * h) / ((d + d) * l)) * 0.5));
double t_4 = Math.sqrt(-d);
double tmp;
if (h <= -2e-44) {
tmp = ((t_4 / Math.sqrt(-l)) * t_0) * t_3;
} else if (h <= -2.1e-307) {
tmp = ((t_4 * Math.sqrt((-1.0 / h))) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
} else if (h <= 2e+53) {
tmp = ((Math.sqrt(d) / Math.sqrt(l)) * t_0) * t_3;
} else {
tmp = (Math.sqrt(((d / l) * d)) / Math.sqrt(h)) * (1.0 - (t_2 * (((h * (M * t_1)) * 0.5) / l)));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((d / h)) t_1 = D / (d + d) t_2 = t_1 * M t_3 = 1.0 - (t_2 * ((((D * M) * h) / ((d + d) * l)) * 0.5)) t_4 = math.sqrt(-d) tmp = 0 if h <= -2e-44: tmp = ((t_4 / math.sqrt(-l)) * t_0) * t_3 elif h <= -2.1e-307: tmp = ((t_4 * math.sqrt((-1.0 / h))) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) elif h <= 2e+53: tmp = ((math.sqrt(d) / math.sqrt(l)) * t_0) * t_3 else: tmp = (math.sqrt(((d / l) * d)) / math.sqrt(h)) * (1.0 - (t_2 * (((h * (M * t_1)) * 0.5) / l))) return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(d / h)) t_1 = Float64(D / Float64(d + d)) t_2 = Float64(t_1 * M) t_3 = Float64(1.0 - Float64(t_2 * Float64(Float64(Float64(Float64(D * M) * h) / Float64(Float64(d + d) * l)) * 0.5))) t_4 = sqrt(Float64(-d)) tmp = 0.0 if (h <= -2e-44) tmp = Float64(Float64(Float64(t_4 / sqrt(Float64(-l))) * t_0) * t_3); elseif (h <= -2.1e-307) tmp = Float64(Float64(Float64(t_4 * sqrt(Float64(-1.0 / h))) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))); elseif (h <= 2e+53) tmp = Float64(Float64(Float64(sqrt(d) / sqrt(l)) * t_0) * t_3); else tmp = Float64(Float64(sqrt(Float64(Float64(d / l) * d)) / sqrt(h)) * Float64(1.0 - Float64(t_2 * Float64(Float64(Float64(h * Float64(M * t_1)) * 0.5) / l)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((d / h)); t_1 = D / (d + d); t_2 = t_1 * M; t_3 = 1.0 - (t_2 * ((((D * M) * h) / ((d + d) * l)) * 0.5)); t_4 = sqrt(-d); tmp = 0.0; if (h <= -2e-44) tmp = ((t_4 / sqrt(-l)) * t_0) * t_3; elseif (h <= -2.1e-307) tmp = ((t_4 * sqrt((-1.0 / h))) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); elseif (h <= 2e+53) tmp = ((sqrt(d) / sqrt(l)) * t_0) * t_3; else tmp = (sqrt(((d / l) * d)) / sqrt(h)) * (1.0 - (t_2 * (((h * (M * t_1)) * 0.5) / l))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(D / N[(d + d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * M), $MachinePrecision]}, Block[{t$95$3 = N[(1.0 - N[(t$95$2 * N[(N[(N[(N[(D * M), $MachinePrecision] * h), $MachinePrecision] / N[(N[(d + d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[h, -2e-44], N[(N[(N[(t$95$4 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$3), $MachinePrecision], If[LessEqual[h, -2.1e-307], N[(N[(N[(t$95$4 * N[Sqrt[N[(-1.0 / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 2e+53], N[(N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$3), $MachinePrecision], N[(N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * d), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(t$95$2 * N[(N[(N[(h * N[(M * t$95$1), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \frac{D}{d + d}\\
t_2 := t\_1 \cdot M\\
t_3 := 1 - t\_2 \cdot \left(\frac{\left(D \cdot M\right) \cdot h}{\left(d + d\right) \cdot \ell} \cdot 0.5\right)\\
t_4 := \sqrt{-d}\\
\mathbf{if}\;h \leq -2 \cdot 10^{-44}:\\
\;\;\;\;\left(\frac{t\_4}{\sqrt{-\ell}} \cdot t\_0\right) \cdot t\_3\\
\mathbf{elif}\;h \leq -2.1 \cdot 10^{-307}:\\
\;\;\;\;\left(\left(t\_4 \cdot \sqrt{\frac{-1}{h}}\right) \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{elif}\;h \leq 2 \cdot 10^{+53}:\\
\;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot t\_0\right) \cdot t\_3\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{\frac{d}{\ell} \cdot d}}{\sqrt{h}} \cdot \left(1 - t\_2 \cdot \frac{\left(h \cdot \left(M \cdot t\_1\right)\right) \cdot 0.5}{\ell}\right)\\
\end{array}
if h < -1.99999999999999991e-44Initial program 66.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites65.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
Applied rewrites65.5%
lift-sqrt.f64N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f64N/A
lower-neg.f64N/A
lower-unsound-sqrt.f64N/A
lower-neg.f6436.4%
Applied rewrites36.4%
if -1.99999999999999991e-44 < h < -2.1000000000000001e-307Initial program 66.9%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
sqrt-prodN/A
lower-unsound-*.f64N/A
lower-unsound-sqrt.f64N/A
lower-neg.f64N/A
lower-unsound-sqrt.f64N/A
frac-2negN/A
metadata-evalN/A
remove-double-negN/A
lower-/.f6437.8%
Applied rewrites37.8%
if -2.1000000000000001e-307 < h < 2e53Initial program 66.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites65.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
Applied rewrites65.5%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f6436.4%
Applied rewrites36.4%
if 2e53 < h Initial program 66.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites65.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
Applied rewrites65.5%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites70.6%
lift-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
associate-*l/N/A
sqrt-divN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-unsound-sqrt.f6432.5%
Applied rewrites32.5%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d h)))
(t_1 (/ D (+ d d)))
(t_2 (* t_1 M))
(t_3 (- 1.0 (* t_2 (* (/ (* (* D M) h) (* (+ d d) l)) 0.5))))
(t_4 (sqrt (- d))))
(if (<= h -2e-44)
(* (* (/ t_4 (sqrt (- l))) t_0) t_3)
(if (<= h -2.1e-307)
(*
(* (/ t_4 (sqrt (- h))) (pow (/ d l) (/ 1.0 2.0)))
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))
(if (<= h 2e+53)
(* (* (/ (sqrt d) (sqrt l)) t_0) t_3)
(*
(/ (sqrt (* (/ d l) d)) (sqrt h))
(- 1.0 (* t_2 (/ (* (* h (* M t_1)) 0.5) l)))))))))double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / h));
double t_1 = D / (d + d);
double t_2 = t_1 * M;
double t_3 = 1.0 - (t_2 * ((((D * M) * h) / ((d + d) * l)) * 0.5));
double t_4 = sqrt(-d);
double tmp;
if (h <= -2e-44) {
tmp = ((t_4 / sqrt(-l)) * t_0) * t_3;
} else if (h <= -2.1e-307) {
tmp = ((t_4 / sqrt(-h)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
} else if (h <= 2e+53) {
tmp = ((sqrt(d) / sqrt(l)) * t_0) * t_3;
} else {
tmp = (sqrt(((d / l) * d)) / sqrt(h)) * (1.0 - (t_2 * (((h * (M * t_1)) * 0.5) / l)));
}
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(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_0 = sqrt((d / h))
t_1 = d_1 / (d + d)
t_2 = t_1 * m
t_3 = 1.0d0 - (t_2 * ((((d_1 * m) * h) / ((d + d) * l)) * 0.5d0))
t_4 = sqrt(-d)
if (h <= (-2d-44)) then
tmp = ((t_4 / sqrt(-l)) * t_0) * t_3
else if (h <= (-2.1d-307)) then
tmp = ((t_4 / sqrt(-h)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
else if (h <= 2d+53) then
tmp = ((sqrt(d) / sqrt(l)) * t_0) * t_3
else
tmp = (sqrt(((d / l) * d)) / sqrt(h)) * (1.0d0 - (t_2 * (((h * (m * t_1)) * 0.5d0) / l)))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / h));
double t_1 = D / (d + d);
double t_2 = t_1 * M;
double t_3 = 1.0 - (t_2 * ((((D * M) * h) / ((d + d) * l)) * 0.5));
double t_4 = Math.sqrt(-d);
double tmp;
if (h <= -2e-44) {
tmp = ((t_4 / Math.sqrt(-l)) * t_0) * t_3;
} else if (h <= -2.1e-307) {
tmp = ((t_4 / Math.sqrt(-h)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
} else if (h <= 2e+53) {
tmp = ((Math.sqrt(d) / Math.sqrt(l)) * t_0) * t_3;
} else {
tmp = (Math.sqrt(((d / l) * d)) / Math.sqrt(h)) * (1.0 - (t_2 * (((h * (M * t_1)) * 0.5) / l)));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((d / h)) t_1 = D / (d + d) t_2 = t_1 * M t_3 = 1.0 - (t_2 * ((((D * M) * h) / ((d + d) * l)) * 0.5)) t_4 = math.sqrt(-d) tmp = 0 if h <= -2e-44: tmp = ((t_4 / math.sqrt(-l)) * t_0) * t_3 elif h <= -2.1e-307: tmp = ((t_4 / math.sqrt(-h)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) elif h <= 2e+53: tmp = ((math.sqrt(d) / math.sqrt(l)) * t_0) * t_3 else: tmp = (math.sqrt(((d / l) * d)) / math.sqrt(h)) * (1.0 - (t_2 * (((h * (M * t_1)) * 0.5) / l))) return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(d / h)) t_1 = Float64(D / Float64(d + d)) t_2 = Float64(t_1 * M) t_3 = Float64(1.0 - Float64(t_2 * Float64(Float64(Float64(Float64(D * M) * h) / Float64(Float64(d + d) * l)) * 0.5))) t_4 = sqrt(Float64(-d)) tmp = 0.0 if (h <= -2e-44) tmp = Float64(Float64(Float64(t_4 / sqrt(Float64(-l))) * t_0) * t_3); elseif (h <= -2.1e-307) tmp = Float64(Float64(Float64(t_4 / sqrt(Float64(-h))) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))); elseif (h <= 2e+53) tmp = Float64(Float64(Float64(sqrt(d) / sqrt(l)) * t_0) * t_3); else tmp = Float64(Float64(sqrt(Float64(Float64(d / l) * d)) / sqrt(h)) * Float64(1.0 - Float64(t_2 * Float64(Float64(Float64(h * Float64(M * t_1)) * 0.5) / l)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((d / h)); t_1 = D / (d + d); t_2 = t_1 * M; t_3 = 1.0 - (t_2 * ((((D * M) * h) / ((d + d) * l)) * 0.5)); t_4 = sqrt(-d); tmp = 0.0; if (h <= -2e-44) tmp = ((t_4 / sqrt(-l)) * t_0) * t_3; elseif (h <= -2.1e-307) tmp = ((t_4 / sqrt(-h)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); elseif (h <= 2e+53) tmp = ((sqrt(d) / sqrt(l)) * t_0) * t_3; else tmp = (sqrt(((d / l) * d)) / sqrt(h)) * (1.0 - (t_2 * (((h * (M * t_1)) * 0.5) / l))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(D / N[(d + d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * M), $MachinePrecision]}, Block[{t$95$3 = N[(1.0 - N[(t$95$2 * N[(N[(N[(N[(D * M), $MachinePrecision] * h), $MachinePrecision] / N[(N[(d + d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[h, -2e-44], N[(N[(N[(t$95$4 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$3), $MachinePrecision], If[LessEqual[h, -2.1e-307], N[(N[(N[(t$95$4 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 2e+53], N[(N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$3), $MachinePrecision], N[(N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * d), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(t$95$2 * N[(N[(N[(h * N[(M * t$95$1), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \frac{D}{d + d}\\
t_2 := t\_1 \cdot M\\
t_3 := 1 - t\_2 \cdot \left(\frac{\left(D \cdot M\right) \cdot h}{\left(d + d\right) \cdot \ell} \cdot 0.5\right)\\
t_4 := \sqrt{-d}\\
\mathbf{if}\;h \leq -2 \cdot 10^{-44}:\\
\;\;\;\;\left(\frac{t\_4}{\sqrt{-\ell}} \cdot t\_0\right) \cdot t\_3\\
\mathbf{elif}\;h \leq -2.1 \cdot 10^{-307}:\\
\;\;\;\;\left(\frac{t\_4}{\sqrt{-h}} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{elif}\;h \leq 2 \cdot 10^{+53}:\\
\;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot t\_0\right) \cdot t\_3\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{\frac{d}{\ell} \cdot d}}{\sqrt{h}} \cdot \left(1 - t\_2 \cdot \frac{\left(h \cdot \left(M \cdot t\_1\right)\right) \cdot 0.5}{\ell}\right)\\
\end{array}
if h < -1.99999999999999991e-44Initial program 66.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites65.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
Applied rewrites65.5%
lift-sqrt.f64N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f64N/A
lower-neg.f64N/A
lower-unsound-sqrt.f64N/A
lower-neg.f6436.4%
Applied rewrites36.4%
if -1.99999999999999991e-44 < h < -2.1000000000000001e-307Initial program 66.9%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f64N/A
lower-neg.f64N/A
lower-unsound-sqrt.f64N/A
lower-neg.f6437.8%
Applied rewrites37.8%
if -2.1000000000000001e-307 < h < 2e53Initial program 66.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites65.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
Applied rewrites65.5%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f6436.4%
Applied rewrites36.4%
if 2e53 < h Initial program 66.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites65.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
Applied rewrites65.5%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites70.6%
lift-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
associate-*l/N/A
sqrt-divN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-unsound-sqrt.f6432.5%
Applied rewrites32.5%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d h)))
(t_1 (/ D (+ d d)))
(t_2 (* t_1 M))
(t_3 (- 1.0 (* t_2 (* (/ (* (* D M) h) (* (+ d d) l)) 0.5)))))
(if (<= h -5e-310)
(* (* (/ (sqrt (- d)) (sqrt (- l))) t_0) t_3)
(if (<= h 2e+53)
(* (* (/ (sqrt d) (sqrt l)) t_0) t_3)
(*
(/ (sqrt (* (/ d l) d)) (sqrt h))
(- 1.0 (* t_2 (/ (* (* h (* M t_1)) 0.5) l))))))))double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / h));
double t_1 = D / (d + d);
double t_2 = t_1 * M;
double t_3 = 1.0 - (t_2 * ((((D * M) * h) / ((d + d) * l)) * 0.5));
double tmp;
if (h <= -5e-310) {
tmp = ((sqrt(-d) / sqrt(-l)) * t_0) * t_3;
} else if (h <= 2e+53) {
tmp = ((sqrt(d) / sqrt(l)) * t_0) * t_3;
} else {
tmp = (sqrt(((d / l) * d)) / sqrt(h)) * (1.0 - (t_2 * (((h * (M * t_1)) * 0.5) / l)));
}
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(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = sqrt((d / h))
t_1 = d_1 / (d + d)
t_2 = t_1 * m
t_3 = 1.0d0 - (t_2 * ((((d_1 * m) * h) / ((d + d) * l)) * 0.5d0))
if (h <= (-5d-310)) then
tmp = ((sqrt(-d) / sqrt(-l)) * t_0) * t_3
else if (h <= 2d+53) then
tmp = ((sqrt(d) / sqrt(l)) * t_0) * t_3
else
tmp = (sqrt(((d / l) * d)) / sqrt(h)) * (1.0d0 - (t_2 * (((h * (m * t_1)) * 0.5d0) / l)))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / h));
double t_1 = D / (d + d);
double t_2 = t_1 * M;
double t_3 = 1.0 - (t_2 * ((((D * M) * h) / ((d + d) * l)) * 0.5));
double tmp;
if (h <= -5e-310) {
tmp = ((Math.sqrt(-d) / Math.sqrt(-l)) * t_0) * t_3;
} else if (h <= 2e+53) {
tmp = ((Math.sqrt(d) / Math.sqrt(l)) * t_0) * t_3;
} else {
tmp = (Math.sqrt(((d / l) * d)) / Math.sqrt(h)) * (1.0 - (t_2 * (((h * (M * t_1)) * 0.5) / l)));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((d / h)) t_1 = D / (d + d) t_2 = t_1 * M t_3 = 1.0 - (t_2 * ((((D * M) * h) / ((d + d) * l)) * 0.5)) tmp = 0 if h <= -5e-310: tmp = ((math.sqrt(-d) / math.sqrt(-l)) * t_0) * t_3 elif h <= 2e+53: tmp = ((math.sqrt(d) / math.sqrt(l)) * t_0) * t_3 else: tmp = (math.sqrt(((d / l) * d)) / math.sqrt(h)) * (1.0 - (t_2 * (((h * (M * t_1)) * 0.5) / l))) return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(d / h)) t_1 = Float64(D / Float64(d + d)) t_2 = Float64(t_1 * M) t_3 = Float64(1.0 - Float64(t_2 * Float64(Float64(Float64(Float64(D * M) * h) / Float64(Float64(d + d) * l)) * 0.5))) tmp = 0.0 if (h <= -5e-310) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * t_0) * t_3); elseif (h <= 2e+53) tmp = Float64(Float64(Float64(sqrt(d) / sqrt(l)) * t_0) * t_3); else tmp = Float64(Float64(sqrt(Float64(Float64(d / l) * d)) / sqrt(h)) * Float64(1.0 - Float64(t_2 * Float64(Float64(Float64(h * Float64(M * t_1)) * 0.5) / l)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((d / h)); t_1 = D / (d + d); t_2 = t_1 * M; t_3 = 1.0 - (t_2 * ((((D * M) * h) / ((d + d) * l)) * 0.5)); tmp = 0.0; if (h <= -5e-310) tmp = ((sqrt(-d) / sqrt(-l)) * t_0) * t_3; elseif (h <= 2e+53) tmp = ((sqrt(d) / sqrt(l)) * t_0) * t_3; else tmp = (sqrt(((d / l) * d)) / sqrt(h)) * (1.0 - (t_2 * (((h * (M * t_1)) * 0.5) / l))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(D / N[(d + d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * M), $MachinePrecision]}, Block[{t$95$3 = N[(1.0 - N[(t$95$2 * N[(N[(N[(N[(D * M), $MachinePrecision] * h), $MachinePrecision] / N[(N[(d + d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -5e-310], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$3), $MachinePrecision], If[LessEqual[h, 2e+53], N[(N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$3), $MachinePrecision], N[(N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * d), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(t$95$2 * N[(N[(N[(h * N[(M * t$95$1), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \frac{D}{d + d}\\
t_2 := t\_1 \cdot M\\
t_3 := 1 - t\_2 \cdot \left(\frac{\left(D \cdot M\right) \cdot h}{\left(d + d\right) \cdot \ell} \cdot 0.5\right)\\
\mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot t\_0\right) \cdot t\_3\\
\mathbf{elif}\;h \leq 2 \cdot 10^{+53}:\\
\;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot t\_0\right) \cdot t\_3\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{\frac{d}{\ell} \cdot d}}{\sqrt{h}} \cdot \left(1 - t\_2 \cdot \frac{\left(h \cdot \left(M \cdot t\_1\right)\right) \cdot 0.5}{\ell}\right)\\
\end{array}
if h < -4.999999999999985e-310Initial program 66.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites65.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
Applied rewrites65.5%
lift-sqrt.f64N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f64N/A
lower-neg.f64N/A
lower-unsound-sqrt.f64N/A
lower-neg.f6436.4%
Applied rewrites36.4%
if -4.999999999999985e-310 < h < 2e53Initial program 66.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites65.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
Applied rewrites65.5%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f6436.4%
Applied rewrites36.4%
if 2e53 < h Initial program 66.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites65.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
Applied rewrites65.5%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites70.6%
lift-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
associate-*l/N/A
sqrt-divN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-unsound-sqrt.f6432.5%
Applied rewrites32.5%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (/ D (+ d d)))
(t_1
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
(t_2 (* M t_0)))
(if (<= t_1 2e+240)
(*
(* (sqrt (/ d l)) (sqrt (/ d h)))
(fma (/ (* 0.5 (* t_2 h)) l) (/ (* M D) (* -2.0 d)) 1.0))
(if (<= t_1 INFINITY)
(/ (/ (* (sqrt (* d h)) (sqrt (* d l))) l) h)
(*
(sqrt (* (/ d (* h l)) d))
(- 1.0 (* (* t_0 M) (/ (* (* h t_2) 0.5) l))))))))double code(double d, double h, double l, double M, double D) {
double t_0 = D / (d + d);
double t_1 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_2 = M * t_0;
double tmp;
if (t_1 <= 2e+240) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * fma(((0.5 * (t_2 * h)) / l), ((M * D) / (-2.0 * d)), 1.0);
} else if (t_1 <= ((double) INFINITY)) {
tmp = ((sqrt((d * h)) * sqrt((d * l))) / l) / h;
} else {
tmp = sqrt(((d / (h * l)) * d)) * (1.0 - ((t_0 * M) * (((h * t_2) * 0.5) / l)));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(D / Float64(d + d)) t_1 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_2 = Float64(M * t_0) tmp = 0.0 if (t_1 <= 2e+240) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * fma(Float64(Float64(0.5 * Float64(t_2 * h)) / l), Float64(Float64(M * D) / Float64(-2.0 * d)), 1.0)); elseif (t_1 <= Inf) tmp = Float64(Float64(Float64(sqrt(Float64(d * h)) * sqrt(Float64(d * l))) / l) / h); else tmp = Float64(sqrt(Float64(Float64(d / Float64(h * l)) * d)) * Float64(1.0 - Float64(Float64(t_0 * M) * Float64(Float64(Float64(h * t_2) * 0.5) / l)))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(D / N[(d + d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(M * t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, 2e+240], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(0.5 * N[(t$95$2 * h), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(N[(M * D), $MachinePrecision] / N[(-2.0 * d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(N[(N[Sqrt[N[(d * h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] / h), $MachinePrecision], N[(N[Sqrt[N[(N[(d / N[(h * l), $MachinePrecision]), $MachinePrecision] * d), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(t$95$0 * M), $MachinePrecision] * N[(N[(N[(h * t$95$2), $MachinePrecision] * 0.5), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := \frac{D}{d + d}\\
t_1 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_2 := M \cdot t\_0\\
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{+240}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \mathsf{fma}\left(\frac{0.5 \cdot \left(t\_2 \cdot h\right)}{\ell}, \frac{M \cdot D}{-2 \cdot d}, 1\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{h \cdot \ell} \cdot d} \cdot \left(1 - \left(t\_0 \cdot M\right) \cdot \frac{\left(h \cdot t\_2\right) \cdot 0.5}{\ell}\right)\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000003e240Initial program 66.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites65.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
Applied rewrites65.5%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites70.6%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites70.2%
if 2.00000000000000003e240 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 66.9%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6%
Applied rewrites23.6%
Taylor expanded in l around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f6432.2%
Applied rewrites32.2%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites65.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
Applied rewrites65.5%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites70.6%
lift-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
lift-sqrt.f6456.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6456.4%
Applied rewrites56.4%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (fmax (fabs M) (fabs D)))
(t_1 (fmin (fabs M) (fabs D)))
(t_2
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(-
1.0
(* (* (/ 1.0 2.0) (pow (/ (* t_1 t_0) (* 2.0 d)) 2.0)) (/ h l)))))
(t_3 (/ t_0 (+ d d)))
(t_4 (* t_3 t_1)))
(if (<= t_2 2e+240)
(*
(* (sqrt (/ d l)) (sqrt (/ d h)))
(- 1.0 (* t_4 (/ (* 0.25 (/ (* t_0 (* t_1 h)) d)) l))))
(if (<= t_2 INFINITY)
(/ (/ (* (sqrt (* d h)) (sqrt (* d l))) l) h)
(*
(sqrt (* (/ d (* h l)) d))
(- 1.0 (* t_4 (/ (* (* h (* t_1 t_3)) 0.5) l))))))))double code(double d, double h, double l, double M, double D) {
double t_0 = fmax(fabs(M), fabs(D));
double t_1 = fmin(fabs(M), fabs(D));
double t_2 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((t_1 * t_0) / (2.0 * d)), 2.0)) * (h / l)));
double t_3 = t_0 / (d + d);
double t_4 = t_3 * t_1;
double tmp;
if (t_2 <= 2e+240) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (t_4 * ((0.25 * ((t_0 * (t_1 * h)) / d)) / l)));
} else if (t_2 <= ((double) INFINITY)) {
tmp = ((sqrt((d * h)) * sqrt((d * l))) / l) / h;
} else {
tmp = sqrt(((d / (h * l)) * d)) * (1.0 - (t_4 * (((h * (t_1 * t_3)) * 0.5) / l)));
}
return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
double t_0 = fmax(Math.abs(M), Math.abs(D));
double t_1 = fmin(Math.abs(M), Math.abs(D));
double t_2 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((t_1 * t_0) / (2.0 * d)), 2.0)) * (h / l)));
double t_3 = t_0 / (d + d);
double t_4 = t_3 * t_1;
double tmp;
if (t_2 <= 2e+240) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 - (t_4 * ((0.25 * ((t_0 * (t_1 * h)) / d)) / l)));
} else if (t_2 <= Double.POSITIVE_INFINITY) {
tmp = ((Math.sqrt((d * h)) * Math.sqrt((d * l))) / l) / h;
} else {
tmp = Math.sqrt(((d / (h * l)) * d)) * (1.0 - (t_4 * (((h * (t_1 * t_3)) * 0.5) / l)));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = fmax(math.fabs(M), math.fabs(D)) t_1 = fmin(math.fabs(M), math.fabs(D)) t_2 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((t_1 * t_0) / (2.0 * d)), 2.0)) * (h / l))) t_3 = t_0 / (d + d) t_4 = t_3 * t_1 tmp = 0 if t_2 <= 2e+240: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 - (t_4 * ((0.25 * ((t_0 * (t_1 * h)) / d)) / l))) elif t_2 <= math.inf: tmp = ((math.sqrt((d * h)) * math.sqrt((d * l))) / l) / h else: tmp = math.sqrt(((d / (h * l)) * d)) * (1.0 - (t_4 * (((h * (t_1 * t_3)) * 0.5) / l))) return tmp
function code(d, h, l, M, D) t_0 = fmax(abs(M), abs(D)) t_1 = fmin(abs(M), abs(D)) t_2 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(t_1 * t_0) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_3 = Float64(t_0 / Float64(d + d)) t_4 = Float64(t_3 * t_1) tmp = 0.0 if (t_2 <= 2e+240) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(t_4 * Float64(Float64(0.25 * Float64(Float64(t_0 * Float64(t_1 * h)) / d)) / l)))); elseif (t_2 <= Inf) tmp = Float64(Float64(Float64(sqrt(Float64(d * h)) * sqrt(Float64(d * l))) / l) / h); else tmp = Float64(sqrt(Float64(Float64(d / Float64(h * l)) * d)) * Float64(1.0 - Float64(t_4 * Float64(Float64(Float64(h * Float64(t_1 * t_3)) * 0.5) / l)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = max(abs(M), abs(D)); t_1 = min(abs(M), abs(D)); t_2 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((t_1 * t_0) / (2.0 * d)) ^ 2.0)) * (h / l))); t_3 = t_0 / (d + d); t_4 = t_3 * t_1; tmp = 0.0; if (t_2 <= 2e+240) tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (t_4 * ((0.25 * ((t_0 * (t_1 * h)) / d)) / l))); elseif (t_2 <= Inf) tmp = ((sqrt((d * h)) * sqrt((d * l))) / l) / h; else tmp = sqrt(((d / (h * l)) * d)) * (1.0 - (t_4 * (((h * (t_1 * t_3)) * 0.5) / l))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Max[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Min[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(t$95$1 * t$95$0), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$0 / N[(d + d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 * t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, 2e+240], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(t$95$4 * N[(N[(0.25 * N[(N[(t$95$0 * N[(t$95$1 * h), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[(N[(N[(N[Sqrt[N[(d * h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] / h), $MachinePrecision], N[(N[Sqrt[N[(N[(d / N[(h * l), $MachinePrecision]), $MachinePrecision] * d), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(t$95$4 * N[(N[(N[(h * N[(t$95$1 * t$95$3), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
t_0 := \mathsf{max}\left(\left|M\right|, \left|D\right|\right)\\
t_1 := \mathsf{min}\left(\left|M\right|, \left|D\right|\right)\\
t_2 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{t\_1 \cdot t\_0}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_3 := \frac{t\_0}{d + d}\\
t_4 := t\_3 \cdot t\_1\\
\mathbf{if}\;t\_2 \leq 2 \cdot 10^{+240}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - t\_4 \cdot \frac{0.25 \cdot \frac{t\_0 \cdot \left(t\_1 \cdot h\right)}{d}}{\ell}\right)\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;\frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{h \cdot \ell} \cdot d} \cdot \left(1 - t\_4 \cdot \frac{\left(h \cdot \left(t\_1 \cdot t\_3\right)\right) \cdot 0.5}{\ell}\right)\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000003e240Initial program 66.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites65.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
Applied rewrites65.5%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites70.6%
Taylor expanded in d around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6466.3%
Applied rewrites66.3%
if 2.00000000000000003e240 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 66.9%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6%
Applied rewrites23.6%
Taylor expanded in l around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f6432.2%
Applied rewrites32.2%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites65.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
Applied rewrites65.5%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites70.6%
lift-*.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
lift-sqrt.f6456.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6456.4%
Applied rewrites56.4%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (fmax (fabs M) (fabs D)))
(t_1 (fmin (fabs M) (fabs D)))
(t_2 (sqrt (/ d h))))
(if (<= l 1e+186)
(*
(* (sqrt (/ d l)) t_2)
(-
1.0
(* (* (/ t_0 (+ d d)) t_1) (/ (* 0.25 (/ (* t_0 (* t_1 h)) d)) l))))
(/ (* (sqrt d) t_2) (* l (sqrt (/ 1.0 l)))))))double code(double d, double h, double l, double M, double D) {
double t_0 = fmax(fabs(M), fabs(D));
double t_1 = fmin(fabs(M), fabs(D));
double t_2 = sqrt((d / h));
double tmp;
if (l <= 1e+186) {
tmp = (sqrt((d / l)) * t_2) * (1.0 - (((t_0 / (d + d)) * t_1) * ((0.25 * ((t_0 * (t_1 * h)) / d)) / l)));
} else {
tmp = (sqrt(d) * t_2) / (l * sqrt((1.0 / l)));
}
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(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = fmax(abs(m), abs(d_1))
t_1 = fmin(abs(m), abs(d_1))
t_2 = sqrt((d / h))
if (l <= 1d+186) then
tmp = (sqrt((d / l)) * t_2) * (1.0d0 - (((t_0 / (d + d)) * t_1) * ((0.25d0 * ((t_0 * (t_1 * h)) / d)) / l)))
else
tmp = (sqrt(d) * t_2) / (l * sqrt((1.0d0 / l)))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = fmax(Math.abs(M), Math.abs(D));
double t_1 = fmin(Math.abs(M), Math.abs(D));
double t_2 = Math.sqrt((d / h));
double tmp;
if (l <= 1e+186) {
tmp = (Math.sqrt((d / l)) * t_2) * (1.0 - (((t_0 / (d + d)) * t_1) * ((0.25 * ((t_0 * (t_1 * h)) / d)) / l)));
} else {
tmp = (Math.sqrt(d) * t_2) / (l * Math.sqrt((1.0 / l)));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = fmax(math.fabs(M), math.fabs(D)) t_1 = fmin(math.fabs(M), math.fabs(D)) t_2 = math.sqrt((d / h)) tmp = 0 if l <= 1e+186: tmp = (math.sqrt((d / l)) * t_2) * (1.0 - (((t_0 / (d + d)) * t_1) * ((0.25 * ((t_0 * (t_1 * h)) / d)) / l))) else: tmp = (math.sqrt(d) * t_2) / (l * math.sqrt((1.0 / l))) return tmp
function code(d, h, l, M, D) t_0 = fmax(abs(M), abs(D)) t_1 = fmin(abs(M), abs(D)) t_2 = sqrt(Float64(d / h)) tmp = 0.0 if (l <= 1e+186) tmp = Float64(Float64(sqrt(Float64(d / l)) * t_2) * Float64(1.0 - Float64(Float64(Float64(t_0 / Float64(d + d)) * t_1) * Float64(Float64(0.25 * Float64(Float64(t_0 * Float64(t_1 * h)) / d)) / l)))); else tmp = Float64(Float64(sqrt(d) * t_2) / Float64(l * sqrt(Float64(1.0 / l)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = max(abs(M), abs(D)); t_1 = min(abs(M), abs(D)); t_2 = sqrt((d / h)); tmp = 0.0; if (l <= 1e+186) tmp = (sqrt((d / l)) * t_2) * (1.0 - (((t_0 / (d + d)) * t_1) * ((0.25 * ((t_0 * (t_1 * h)) / d)) / l))); else tmp = (sqrt(d) * t_2) / (l * sqrt((1.0 / l))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Max[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Min[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, 1e+186], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * t$95$2), $MachinePrecision] * N[(1.0 - N[(N[(N[(t$95$0 / N[(d + d), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * N[(N[(0.25 * N[(N[(t$95$0 * N[(t$95$1 * h), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] * t$95$2), $MachinePrecision] / N[(l * N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \mathsf{max}\left(\left|M\right|, \left|D\right|\right)\\
t_1 := \mathsf{min}\left(\left|M\right|, \left|D\right|\right)\\
t_2 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;\ell \leq 10^{+186}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot t\_2\right) \cdot \left(1 - \left(\frac{t\_0}{d + d} \cdot t\_1\right) \cdot \frac{0.25 \cdot \frac{t\_0 \cdot \left(t\_1 \cdot h\right)}{d}}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d} \cdot t\_2}{\ell \cdot \sqrt{\frac{1}{\ell}}}\\
\end{array}
if l < 9.9999999999999998e185Initial program 66.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites65.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
Applied rewrites65.5%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites70.6%
Taylor expanded in d around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6466.3%
Applied rewrites66.3%
if 9.9999999999999998e185 < l Initial program 66.9%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
Applied rewrites53.6%
lift-*.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow-prod-downN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
pow1/2N/A
*-commutativeN/A
sqrt-prodN/A
lower-unsound-sqrt.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-unsound-sqrt.f6426.4%
Applied rewrites26.4%
lift-sqrt.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f6428.7%
Applied rewrites28.7%
Taylor expanded in l around inf
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6422.8%
Applied rewrites22.8%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (sqrt (* d h)) (sqrt (* d l))))
(t_1 (fmin (fabs M) (fabs D)))
(t_2 (sqrt (/ d l)))
(t_3 (fmax (fabs M) (fabs D)))
(t_4 (* t_1 t_3))
(t_5
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ t_4 (* 2.0 d)) 2.0)) (/ h l)))))
(t_6 (sqrt (/ d h))))
(if (<= t_5 -2e-7)
(*
(*
(fma (/ (* (* (* t_4 t_1) t_3) h) (* (* (* d d) 4.0) l)) -0.5 1.0)
t_6)
t_2)
(if (<= t_5 0.0)
(/ t_0 (* h l))
(if (<= t_5 2e+240)
(* (* t_2 t_6) 1.0)
(if (<= t_5 INFINITY)
(/ (/ t_0 l) h)
(*
(fma (/ (* t_4 (* t_4 h)) (* (+ d d) (* (+ d d) l))) -0.5 1.0)
(sqrt (* (/ d (* l h)) d)))))))))double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d * h)) * sqrt((d * l));
double t_1 = fmin(fabs(M), fabs(D));
double t_2 = sqrt((d / l));
double t_3 = fmax(fabs(M), fabs(D));
double t_4 = t_1 * t_3;
double t_5 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow((t_4 / (2.0 * d)), 2.0)) * (h / l)));
double t_6 = sqrt((d / h));
double tmp;
if (t_5 <= -2e-7) {
tmp = (fma(((((t_4 * t_1) * t_3) * h) / (((d * d) * 4.0) * l)), -0.5, 1.0) * t_6) * t_2;
} else if (t_5 <= 0.0) {
tmp = t_0 / (h * l);
} else if (t_5 <= 2e+240) {
tmp = (t_2 * t_6) * 1.0;
} else if (t_5 <= ((double) INFINITY)) {
tmp = (t_0 / l) / h;
} else {
tmp = fma(((t_4 * (t_4 * h)) / ((d + d) * ((d + d) * l))), -0.5, 1.0) * sqrt(((d / (l * h)) * d));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(sqrt(Float64(d * h)) * sqrt(Float64(d * l))) t_1 = fmin(abs(M), abs(D)) t_2 = sqrt(Float64(d / l)) t_3 = fmax(abs(M), abs(D)) t_4 = Float64(t_1 * t_3) t_5 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(t_4 / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_6 = sqrt(Float64(d / h)) tmp = 0.0 if (t_5 <= -2e-7) tmp = Float64(Float64(fma(Float64(Float64(Float64(Float64(t_4 * t_1) * t_3) * h) / Float64(Float64(Float64(d * d) * 4.0) * l)), -0.5, 1.0) * t_6) * t_2); elseif (t_5 <= 0.0) tmp = Float64(t_0 / Float64(h * l)); elseif (t_5 <= 2e+240) tmp = Float64(Float64(t_2 * t_6) * 1.0); elseif (t_5 <= Inf) tmp = Float64(Float64(t_0 / l) / h); else tmp = Float64(fma(Float64(Float64(t_4 * Float64(t_4 * h)) / Float64(Float64(d + d) * Float64(Float64(d + d) * l))), -0.5, 1.0) * sqrt(Float64(Float64(d / Float64(l * h)) * d))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Sqrt[N[(d * h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Min[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Max[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(t$95$1 * t$95$3), $MachinePrecision]}, Block[{t$95$5 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(t$95$4 / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$5, -2e-7], N[(N[(N[(N[(N[(N[(N[(t$95$4 * t$95$1), $MachinePrecision] * t$95$3), $MachinePrecision] * h), $MachinePrecision] / N[(N[(N[(d * d), $MachinePrecision] * 4.0), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] * t$95$6), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[t$95$5, 0.0], N[(t$95$0 / N[(h * l), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 2e+240], N[(N[(t$95$2 * t$95$6), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[t$95$5, Infinity], N[(N[(t$95$0 / l), $MachinePrecision] / h), $MachinePrecision], N[(N[(N[(N[(t$95$4 * N[(t$95$4 * h), $MachinePrecision]), $MachinePrecision] / N[(N[(d + d), $MachinePrecision] * N[(N[(d + d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] * N[Sqrt[N[(N[(d / N[(l * h), $MachinePrecision]), $MachinePrecision] * d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]
\begin{array}{l}
t_0 := \sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}\\
t_1 := \mathsf{min}\left(\left|M\right|, \left|D\right|\right)\\
t_2 := \sqrt{\frac{d}{\ell}}\\
t_3 := \mathsf{max}\left(\left|M\right|, \left|D\right|\right)\\
t_4 := t\_1 \cdot t\_3\\
t_5 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{t\_4}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_6 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;t\_5 \leq -2 \cdot 10^{-7}:\\
\;\;\;\;\left(\mathsf{fma}\left(\frac{\left(\left(t\_4 \cdot t\_1\right) \cdot t\_3\right) \cdot h}{\left(\left(d \cdot d\right) \cdot 4\right) \cdot \ell}, -0.5, 1\right) \cdot t\_6\right) \cdot t\_2\\
\mathbf{elif}\;t\_5 \leq 0:\\
\;\;\;\;\frac{t\_0}{h \cdot \ell}\\
\mathbf{elif}\;t\_5 \leq 2 \cdot 10^{+240}:\\
\;\;\;\;\left(t\_2 \cdot t\_6\right) \cdot 1\\
\mathbf{elif}\;t\_5 \leq \infty:\\
\;\;\;\;\frac{\frac{t\_0}{\ell}}{h}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t\_4 \cdot \left(t\_4 \cdot h\right)}{\left(d + d\right) \cdot \left(\left(d + d\right) \cdot \ell\right)}, -0.5, 1\right) \cdot \sqrt{\frac{d}{\ell \cdot h} \cdot d}\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -1.9999999999999999e-7Initial program 66.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites65.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
Applied rewrites65.5%
Applied rewrites51.6%
if -1.9999999999999999e-7 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0Initial program 66.9%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6%
Applied rewrites23.6%
Taylor expanded in h around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f649.7%
Applied rewrites9.7%
Taylor expanded in l around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-*.f6430.0%
Applied rewrites30.0%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000003e240Initial program 66.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites65.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
Applied rewrites65.5%
Taylor expanded in d around inf
Applied rewrites39.6%
if 2.00000000000000003e240 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 66.9%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6%
Applied rewrites23.6%
Taylor expanded in l around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f6432.2%
Applied rewrites32.2%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites65.5%
Applied rewrites48.7%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (fmax (fabs M) (fabs D)))
(t_1 (fmin (fabs M) (fabs D)))
(t_2 (sqrt (/ d h))))
(if (<= l 1e+186)
(*
(* (sqrt (/ d l)) t_2)
(-
1.0
(* (* (/ t_0 (+ d d)) t_1) (* 0.25 (/ (* t_0 (* t_1 h)) (* d l))))))
(/ (* (sqrt d) t_2) (* l (sqrt (/ 1.0 l)))))))double code(double d, double h, double l, double M, double D) {
double t_0 = fmax(fabs(M), fabs(D));
double t_1 = fmin(fabs(M), fabs(D));
double t_2 = sqrt((d / h));
double tmp;
if (l <= 1e+186) {
tmp = (sqrt((d / l)) * t_2) * (1.0 - (((t_0 / (d + d)) * t_1) * (0.25 * ((t_0 * (t_1 * h)) / (d * l)))));
} else {
tmp = (sqrt(d) * t_2) / (l * sqrt((1.0 / l)));
}
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(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = fmax(abs(m), abs(d_1))
t_1 = fmin(abs(m), abs(d_1))
t_2 = sqrt((d / h))
if (l <= 1d+186) then
tmp = (sqrt((d / l)) * t_2) * (1.0d0 - (((t_0 / (d + d)) * t_1) * (0.25d0 * ((t_0 * (t_1 * h)) / (d * l)))))
else
tmp = (sqrt(d) * t_2) / (l * sqrt((1.0d0 / l)))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = fmax(Math.abs(M), Math.abs(D));
double t_1 = fmin(Math.abs(M), Math.abs(D));
double t_2 = Math.sqrt((d / h));
double tmp;
if (l <= 1e+186) {
tmp = (Math.sqrt((d / l)) * t_2) * (1.0 - (((t_0 / (d + d)) * t_1) * (0.25 * ((t_0 * (t_1 * h)) / (d * l)))));
} else {
tmp = (Math.sqrt(d) * t_2) / (l * Math.sqrt((1.0 / l)));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = fmax(math.fabs(M), math.fabs(D)) t_1 = fmin(math.fabs(M), math.fabs(D)) t_2 = math.sqrt((d / h)) tmp = 0 if l <= 1e+186: tmp = (math.sqrt((d / l)) * t_2) * (1.0 - (((t_0 / (d + d)) * t_1) * (0.25 * ((t_0 * (t_1 * h)) / (d * l))))) else: tmp = (math.sqrt(d) * t_2) / (l * math.sqrt((1.0 / l))) return tmp
function code(d, h, l, M, D) t_0 = fmax(abs(M), abs(D)) t_1 = fmin(abs(M), abs(D)) t_2 = sqrt(Float64(d / h)) tmp = 0.0 if (l <= 1e+186) tmp = Float64(Float64(sqrt(Float64(d / l)) * t_2) * Float64(1.0 - Float64(Float64(Float64(t_0 / Float64(d + d)) * t_1) * Float64(0.25 * Float64(Float64(t_0 * Float64(t_1 * h)) / Float64(d * l)))))); else tmp = Float64(Float64(sqrt(d) * t_2) / Float64(l * sqrt(Float64(1.0 / l)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = max(abs(M), abs(D)); t_1 = min(abs(M), abs(D)); t_2 = sqrt((d / h)); tmp = 0.0; if (l <= 1e+186) tmp = (sqrt((d / l)) * t_2) * (1.0 - (((t_0 / (d + d)) * t_1) * (0.25 * ((t_0 * (t_1 * h)) / (d * l))))); else tmp = (sqrt(d) * t_2) / (l * sqrt((1.0 / l))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Max[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Min[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, 1e+186], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * t$95$2), $MachinePrecision] * N[(1.0 - N[(N[(N[(t$95$0 / N[(d + d), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * N[(0.25 * N[(N[(t$95$0 * N[(t$95$1 * h), $MachinePrecision]), $MachinePrecision] / N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] * t$95$2), $MachinePrecision] / N[(l * N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \mathsf{max}\left(\left|M\right|, \left|D\right|\right)\\
t_1 := \mathsf{min}\left(\left|M\right|, \left|D\right|\right)\\
t_2 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;\ell \leq 10^{+186}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot t\_2\right) \cdot \left(1 - \left(\frac{t\_0}{d + d} \cdot t\_1\right) \cdot \left(0.25 \cdot \frac{t\_0 \cdot \left(t\_1 \cdot h\right)}{d \cdot \ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d} \cdot t\_2}{\ell \cdot \sqrt{\frac{1}{\ell}}}\\
\end{array}
if l < 9.9999999999999998e185Initial program 66.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites65.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
Applied rewrites65.5%
Taylor expanded in d around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6463.6%
Applied rewrites63.6%
if 9.9999999999999998e185 < l Initial program 66.9%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
Applied rewrites53.6%
lift-*.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow-prod-downN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
pow1/2N/A
*-commutativeN/A
sqrt-prodN/A
lower-unsound-sqrt.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-unsound-sqrt.f6426.4%
Applied rewrites26.4%
lift-sqrt.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f6428.7%
Applied rewrites28.7%
Taylor expanded in l around inf
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6422.8%
Applied rewrites22.8%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (sqrt (* d h)) (sqrt (* d l))))
(t_1 (fmin (fabs M) (fabs D)))
(t_2 (sqrt (/ d l)))
(t_3 (fmax (fabs M) (fabs D)))
(t_4 (* t_1 t_3))
(t_5
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ t_4 (* 2.0 d)) 2.0)) (/ h l)))))
(t_6 (sqrt (/ d h))))
(if (<= t_5 -2e-7)
(*
(*
(fma (/ (* (* (* t_4 t_1) t_3) h) (* (* (* d d) 4.0) l)) -0.5 1.0)
t_6)
t_2)
(if (<= t_5 0.0)
(/ t_0 (* h l))
(if (<= t_5 2e+240) (* (* t_2 t_6) 1.0) (/ (/ t_0 l) h))))))double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d * h)) * sqrt((d * l));
double t_1 = fmin(fabs(M), fabs(D));
double t_2 = sqrt((d / l));
double t_3 = fmax(fabs(M), fabs(D));
double t_4 = t_1 * t_3;
double t_5 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow((t_4 / (2.0 * d)), 2.0)) * (h / l)));
double t_6 = sqrt((d / h));
double tmp;
if (t_5 <= -2e-7) {
tmp = (fma(((((t_4 * t_1) * t_3) * h) / (((d * d) * 4.0) * l)), -0.5, 1.0) * t_6) * t_2;
} else if (t_5 <= 0.0) {
tmp = t_0 / (h * l);
} else if (t_5 <= 2e+240) {
tmp = (t_2 * t_6) * 1.0;
} else {
tmp = (t_0 / l) / h;
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(sqrt(Float64(d * h)) * sqrt(Float64(d * l))) t_1 = fmin(abs(M), abs(D)) t_2 = sqrt(Float64(d / l)) t_3 = fmax(abs(M), abs(D)) t_4 = Float64(t_1 * t_3) t_5 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(t_4 / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_6 = sqrt(Float64(d / h)) tmp = 0.0 if (t_5 <= -2e-7) tmp = Float64(Float64(fma(Float64(Float64(Float64(Float64(t_4 * t_1) * t_3) * h) / Float64(Float64(Float64(d * d) * 4.0) * l)), -0.5, 1.0) * t_6) * t_2); elseif (t_5 <= 0.0) tmp = Float64(t_0 / Float64(h * l)); elseif (t_5 <= 2e+240) tmp = Float64(Float64(t_2 * t_6) * 1.0); else tmp = Float64(Float64(t_0 / l) / h); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Sqrt[N[(d * h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Min[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Max[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(t$95$1 * t$95$3), $MachinePrecision]}, Block[{t$95$5 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(t$95$4 / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$5, -2e-7], N[(N[(N[(N[(N[(N[(N[(t$95$4 * t$95$1), $MachinePrecision] * t$95$3), $MachinePrecision] * h), $MachinePrecision] / N[(N[(N[(d * d), $MachinePrecision] * 4.0), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] * t$95$6), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[t$95$5, 0.0], N[(t$95$0 / N[(h * l), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 2e+240], N[(N[(t$95$2 * t$95$6), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(t$95$0 / l), $MachinePrecision] / h), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
t_0 := \sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}\\
t_1 := \mathsf{min}\left(\left|M\right|, \left|D\right|\right)\\
t_2 := \sqrt{\frac{d}{\ell}}\\
t_3 := \mathsf{max}\left(\left|M\right|, \left|D\right|\right)\\
t_4 := t\_1 \cdot t\_3\\
t_5 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{t\_4}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_6 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;t\_5 \leq -2 \cdot 10^{-7}:\\
\;\;\;\;\left(\mathsf{fma}\left(\frac{\left(\left(t\_4 \cdot t\_1\right) \cdot t\_3\right) \cdot h}{\left(\left(d \cdot d\right) \cdot 4\right) \cdot \ell}, -0.5, 1\right) \cdot t\_6\right) \cdot t\_2\\
\mathbf{elif}\;t\_5 \leq 0:\\
\;\;\;\;\frac{t\_0}{h \cdot \ell}\\
\mathbf{elif}\;t\_5 \leq 2 \cdot 10^{+240}:\\
\;\;\;\;\left(t\_2 \cdot t\_6\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_0}{\ell}}{h}\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -1.9999999999999999e-7Initial program 66.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites65.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
Applied rewrites65.5%
Applied rewrites51.6%
if -1.9999999999999999e-7 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0Initial program 66.9%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6%
Applied rewrites23.6%
Taylor expanded in h around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f649.7%
Applied rewrites9.7%
Taylor expanded in l around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-*.f6430.0%
Applied rewrites30.0%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000003e240Initial program 66.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites65.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
Applied rewrites65.5%
Taylor expanded in d around inf
Applied rewrites39.6%
if 2.00000000000000003e240 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.9%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6%
Applied rewrites23.6%
Taylor expanded in l around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f6432.2%
Applied rewrites32.2%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (sqrt (* d h)) (sqrt (* d l))))
(t_1 (fmin (fabs M) (fabs D)))
(t_2 (fmax (fabs M) (fabs D)))
(t_3
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(-
1.0
(* (* (/ 1.0 2.0) (pow (/ (* t_1 t_2) (* 2.0 d)) 2.0)) (/ h l))))))
(if (<= t_3 -2e-7)
(*
(fma
(/ (/ (* (* (* (* t_2 t_2) h) 0.25) (* t_1 t_1)) (* l d)) d)
-0.5
1.0)
(sqrt (* d (/ d (* h l)))))
(if (<= t_3 0.0)
(/ t_0 (* h l))
(if (<= t_3 2e+240)
(* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0)
(/ (/ t_0 l) h))))))double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d * h)) * sqrt((d * l));
double t_1 = fmin(fabs(M), fabs(D));
double t_2 = fmax(fabs(M), fabs(D));
double t_3 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((t_1 * t_2) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_3 <= -2e-7) {
tmp = fma(((((((t_2 * t_2) * h) * 0.25) * (t_1 * t_1)) / (l * d)) / d), -0.5, 1.0) * sqrt((d * (d / (h * l))));
} else if (t_3 <= 0.0) {
tmp = t_0 / (h * l);
} else if (t_3 <= 2e+240) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
} else {
tmp = (t_0 / l) / h;
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(sqrt(Float64(d * h)) * sqrt(Float64(d * l))) t_1 = fmin(abs(M), abs(D)) t_2 = fmax(abs(M), abs(D)) t_3 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(t_1 * t_2) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_3 <= -2e-7) tmp = Float64(fma(Float64(Float64(Float64(Float64(Float64(Float64(t_2 * t_2) * h) * 0.25) * Float64(t_1 * t_1)) / Float64(l * d)) / d), -0.5, 1.0) * sqrt(Float64(d * Float64(d / Float64(h * l))))); elseif (t_3 <= 0.0) tmp = Float64(t_0 / Float64(h * l)); elseif (t_3 <= 2e+240) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0); else tmp = Float64(Float64(t_0 / l) / h); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Sqrt[N[(d * h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Min[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Max[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(t$95$1 * t$95$2), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -2e-7], N[(N[(N[(N[(N[(N[(N[(N[(t$95$2 * t$95$2), $MachinePrecision] * h), $MachinePrecision] * 0.25), $MachinePrecision] * N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] * N[Sqrt[N[(d * N[(d / N[(h * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.0], N[(t$95$0 / N[(h * l), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 2e+240], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(t$95$0 / l), $MachinePrecision] / h), $MachinePrecision]]]]]]]]
\begin{array}{l}
t_0 := \sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}\\
t_1 := \mathsf{min}\left(\left|M\right|, \left|D\right|\right)\\
t_2 := \mathsf{max}\left(\left|M\right|, \left|D\right|\right)\\
t_3 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{t\_1 \cdot t\_2}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_3 \leq -2 \cdot 10^{-7}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\frac{\left(\left(\left(t\_2 \cdot t\_2\right) \cdot h\right) \cdot 0.25\right) \cdot \left(t\_1 \cdot t\_1\right)}{\ell \cdot d}}{d}, -0.5, 1\right) \cdot \sqrt{d \cdot \frac{d}{h \cdot \ell}}\\
\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;\frac{t\_0}{h \cdot \ell}\\
\mathbf{elif}\;t\_3 \leq 2 \cdot 10^{+240}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_0}{\ell}}{h}\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -1.9999999999999999e-7Initial program 66.9%
Applied rewrites35.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6442.1%
Applied rewrites42.1%
if -1.9999999999999999e-7 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0Initial program 66.9%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6%
Applied rewrites23.6%
Taylor expanded in h around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f649.7%
Applied rewrites9.7%
Taylor expanded in l around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-*.f6430.0%
Applied rewrites30.0%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000003e240Initial program 66.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites65.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
Applied rewrites65.5%
Taylor expanded in d around inf
Applied rewrites39.6%
if 2.00000000000000003e240 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.9%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6%
Applied rewrites23.6%
Taylor expanded in l around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f6432.2%
Applied rewrites32.2%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (sqrt (* d h)) (sqrt (* d l))))
(t_1 (fmin (fabs M) (fabs D)))
(t_2 (fmax (fabs M) (fabs D)))
(t_3 (* t_1 t_2))
(t_4
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ t_3 (* 2.0 d)) 2.0)) (/ h l))))))
(if (<= t_4 -2e-7)
(*
(fma (/ (* (* (* t_3 t_1) t_2) h) (* (* (* d d) 4.0) l)) -0.5 1.0)
(sqrt (* (/ d (* h l)) d)))
(if (<= t_4 0.0)
(/ t_0 (* h l))
(if (<= t_4 2e+240)
(* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0)
(/ (/ t_0 l) h))))))double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d * h)) * sqrt((d * l));
double t_1 = fmin(fabs(M), fabs(D));
double t_2 = fmax(fabs(M), fabs(D));
double t_3 = t_1 * t_2;
double t_4 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow((t_3 / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_4 <= -2e-7) {
tmp = fma(((((t_3 * t_1) * t_2) * h) / (((d * d) * 4.0) * l)), -0.5, 1.0) * sqrt(((d / (h * l)) * d));
} else if (t_4 <= 0.0) {
tmp = t_0 / (h * l);
} else if (t_4 <= 2e+240) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
} else {
tmp = (t_0 / l) / h;
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(sqrt(Float64(d * h)) * sqrt(Float64(d * l))) t_1 = fmin(abs(M), abs(D)) t_2 = fmax(abs(M), abs(D)) t_3 = Float64(t_1 * t_2) t_4 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(t_3 / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_4 <= -2e-7) tmp = Float64(fma(Float64(Float64(Float64(Float64(t_3 * t_1) * t_2) * h) / Float64(Float64(Float64(d * d) * 4.0) * l)), -0.5, 1.0) * sqrt(Float64(Float64(d / Float64(h * l)) * d))); elseif (t_4 <= 0.0) tmp = Float64(t_0 / Float64(h * l)); elseif (t_4 <= 2e+240) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0); else tmp = Float64(Float64(t_0 / l) / h); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Sqrt[N[(d * h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Min[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Max[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 * t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(t$95$3 / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, -2e-7], N[(N[(N[(N[(N[(N[(t$95$3 * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision] * h), $MachinePrecision] / N[(N[(N[(d * d), $MachinePrecision] * 4.0), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] * N[Sqrt[N[(N[(d / N[(h * l), $MachinePrecision]), $MachinePrecision] * d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.0], N[(t$95$0 / N[(h * l), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 2e+240], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(t$95$0 / l), $MachinePrecision] / h), $MachinePrecision]]]]]]]]]
\begin{array}{l}
t_0 := \sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}\\
t_1 := \mathsf{min}\left(\left|M\right|, \left|D\right|\right)\\
t_2 := \mathsf{max}\left(\left|M\right|, \left|D\right|\right)\\
t_3 := t\_1 \cdot t\_2\\
t_4 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{t\_3}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_4 \leq -2 \cdot 10^{-7}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(\left(t\_3 \cdot t\_1\right) \cdot t\_2\right) \cdot h}{\left(\left(d \cdot d\right) \cdot 4\right) \cdot \ell}, -0.5, 1\right) \cdot \sqrt{\frac{d}{h \cdot \ell} \cdot d}\\
\mathbf{elif}\;t\_4 \leq 0:\\
\;\;\;\;\frac{t\_0}{h \cdot \ell}\\
\mathbf{elif}\;t\_4 \leq 2 \cdot 10^{+240}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_0}{\ell}}{h}\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -1.9999999999999999e-7Initial program 66.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites65.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
Applied rewrites65.5%
Applied rewrites42.2%
if -1.9999999999999999e-7 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0Initial program 66.9%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6%
Applied rewrites23.6%
Taylor expanded in h around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f649.7%
Applied rewrites9.7%
Taylor expanded in l around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-*.f6430.0%
Applied rewrites30.0%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000003e240Initial program 66.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites65.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
Applied rewrites65.5%
Taylor expanded in d around inf
Applied rewrites39.6%
if 2.00000000000000003e240 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.9%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6%
Applied rewrites23.6%
Taylor expanded in l around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f6432.2%
Applied rewrites32.2%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (sqrt (* d h)) (sqrt (* d l))))
(t_1 (fmin (fabs M) (fabs D)))
(t_2 (fmax (fabs M) (fabs D)))
(t_3
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(-
1.0
(* (* (/ 1.0 2.0) (pow (/ (* t_1 t_2) (* 2.0 d)) 2.0)) (/ h l))))))
(if (<= t_3 -2e-7)
(*
(fma
(* (* (* (* (* t_2 t_2) t_1) t_1) (/ 0.25 (* (* d d) l))) h)
-0.5
1.0)
(sqrt (* (/ d (* h l)) d)))
(if (<= t_3 0.0)
(/ t_0 (* h l))
(if (<= t_3 2e+240)
(* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0)
(/ (/ t_0 l) h))))))double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d * h)) * sqrt((d * l));
double t_1 = fmin(fabs(M), fabs(D));
double t_2 = fmax(fabs(M), fabs(D));
double t_3 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((t_1 * t_2) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_3 <= -2e-7) {
tmp = fma((((((t_2 * t_2) * t_1) * t_1) * (0.25 / ((d * d) * l))) * h), -0.5, 1.0) * sqrt(((d / (h * l)) * d));
} else if (t_3 <= 0.0) {
tmp = t_0 / (h * l);
} else if (t_3 <= 2e+240) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
} else {
tmp = (t_0 / l) / h;
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(sqrt(Float64(d * h)) * sqrt(Float64(d * l))) t_1 = fmin(abs(M), abs(D)) t_2 = fmax(abs(M), abs(D)) t_3 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(t_1 * t_2) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_3 <= -2e-7) tmp = Float64(fma(Float64(Float64(Float64(Float64(Float64(t_2 * t_2) * t_1) * t_1) * Float64(0.25 / Float64(Float64(d * d) * l))) * h), -0.5, 1.0) * sqrt(Float64(Float64(d / Float64(h * l)) * d))); elseif (t_3 <= 0.0) tmp = Float64(t_0 / Float64(h * l)); elseif (t_3 <= 2e+240) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0); else tmp = Float64(Float64(t_0 / l) / h); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Sqrt[N[(d * h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Min[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Max[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(t$95$1 * t$95$2), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -2e-7], N[(N[(N[(N[(N[(N[(N[(t$95$2 * t$95$2), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$1), $MachinePrecision] * N[(0.25 / N[(N[(d * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * h), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] * N[Sqrt[N[(N[(d / N[(h * l), $MachinePrecision]), $MachinePrecision] * d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.0], N[(t$95$0 / N[(h * l), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 2e+240], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(t$95$0 / l), $MachinePrecision] / h), $MachinePrecision]]]]]]]]
\begin{array}{l}
t_0 := \sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}\\
t_1 := \mathsf{min}\left(\left|M\right|, \left|D\right|\right)\\
t_2 := \mathsf{max}\left(\left|M\right|, \left|D\right|\right)\\
t_3 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{t\_1 \cdot t\_2}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_3 \leq -2 \cdot 10^{-7}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(\left(\left(t\_2 \cdot t\_2\right) \cdot t\_1\right) \cdot t\_1\right) \cdot \frac{0.25}{\left(d \cdot d\right) \cdot \ell}\right) \cdot h, -0.5, 1\right) \cdot \sqrt{\frac{d}{h \cdot \ell} \cdot d}\\
\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;\frac{t\_0}{h \cdot \ell}\\
\mathbf{elif}\;t\_3 \leq 2 \cdot 10^{+240}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_0}{\ell}}{h}\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -1.9999999999999999e-7Initial program 66.9%
Applied rewrites35.3%
Applied rewrites39.3%
if -1.9999999999999999e-7 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0Initial program 66.9%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6%
Applied rewrites23.6%
Taylor expanded in h around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f649.7%
Applied rewrites9.7%
Taylor expanded in l around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-*.f6430.0%
Applied rewrites30.0%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000003e240Initial program 66.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites65.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
Applied rewrites65.5%
Taylor expanded in d around inf
Applied rewrites39.6%
if 2.00000000000000003e240 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.9%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6%
Applied rewrites23.6%
Taylor expanded in l around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f6432.2%
Applied rewrites32.2%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
(t_1 (* (sqrt (* d h)) (sqrt (* d l)))))
(if (<= t_0 -5e-34)
(* -1.0 (sqrt (/ (pow d 2.0) (* h l))))
(if (<= t_0 0.0)
(/ t_1 (* h l))
(if (<= t_0 2e+240)
(* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0)
(/ (/ t_1 l) h))))))double code(double d, double h, double l, double M, double D) {
double t_0 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_1 = sqrt((d * h)) * sqrt((d * l));
double tmp;
if (t_0 <= -5e-34) {
tmp = -1.0 * sqrt((pow(d, 2.0) / (h * l)));
} else if (t_0 <= 0.0) {
tmp = t_1 / (h * l);
} else if (t_0 <= 2e+240) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
} else {
tmp = (t_1 / l) / h;
}
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(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
t_1 = sqrt((d * h)) * sqrt((d * l))
if (t_0 <= (-5d-34)) then
tmp = (-1.0d0) * sqrt(((d ** 2.0d0) / (h * l)))
else if (t_0 <= 0.0d0) then
tmp = t_1 / (h * l)
else if (t_0 <= 2d+240) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0d0
else
tmp = (t_1 / l) / h
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_1 = Math.sqrt((d * h)) * Math.sqrt((d * l));
double tmp;
if (t_0 <= -5e-34) {
tmp = -1.0 * Math.sqrt((Math.pow(d, 2.0) / (h * l)));
} else if (t_0 <= 0.0) {
tmp = t_1 / (h * l);
} else if (t_0 <= 2e+240) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * 1.0;
} else {
tmp = (t_1 / l) / h;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) t_1 = math.sqrt((d * h)) * math.sqrt((d * l)) tmp = 0 if t_0 <= -5e-34: tmp = -1.0 * math.sqrt((math.pow(d, 2.0) / (h * l))) elif t_0 <= 0.0: tmp = t_1 / (h * l) elif t_0 <= 2e+240: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * 1.0 else: tmp = (t_1 / l) / h return tmp
function code(d, h, l, M, D) t_0 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_1 = Float64(sqrt(Float64(d * h)) * sqrt(Float64(d * l))) tmp = 0.0 if (t_0 <= -5e-34) tmp = Float64(-1.0 * sqrt(Float64((d ^ 2.0) / Float64(h * l)))); elseif (t_0 <= 0.0) tmp = Float64(t_1 / Float64(h * l)); elseif (t_0 <= 2e+240) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0); else tmp = Float64(Float64(t_1 / l) / h); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); t_1 = sqrt((d * h)) * sqrt((d * l)); tmp = 0.0; if (t_0 <= -5e-34) tmp = -1.0 * sqrt(((d ^ 2.0) / (h * l))); elseif (t_0 <= 0.0) tmp = t_1 / (h * l); elseif (t_0 <= 2e+240) tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0; else tmp = (t_1 / l) / h; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[N[(d * h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-34], N[(-1.0 * N[Sqrt[N[(N[Power[d, 2.0], $MachinePrecision] / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(t$95$1 / N[(h * l), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e+240], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(t$95$1 / l), $MachinePrecision] / h), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_1 := \sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-34}:\\
\;\;\;\;-1 \cdot \sqrt{\frac{{d}^{2}}{h \cdot \ell}}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{t\_1}{h \cdot \ell}\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+240}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_1}{\ell}}{h}\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -5.0000000000000003e-34Initial program 66.9%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6%
Applied rewrites23.6%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6421.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.7%
Applied rewrites21.7%
Taylor expanded in h around -inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-*.f6411.9%
Applied rewrites11.9%
if -5.0000000000000003e-34 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0Initial program 66.9%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6%
Applied rewrites23.6%
Taylor expanded in h around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f649.7%
Applied rewrites9.7%
Taylor expanded in l around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-*.f6430.0%
Applied rewrites30.0%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000003e240Initial program 66.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites65.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
Applied rewrites65.5%
Taylor expanded in d around inf
Applied rewrites39.6%
if 2.00000000000000003e240 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.9%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6%
Applied rewrites23.6%
Taylor expanded in l around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f6432.2%
Applied rewrites32.2%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
(t_1 (* (sqrt (* d h)) (sqrt (* d l)))))
(if (<= t_0 -5e-34)
(/ (* (sqrt (* (/ d (* h l)) d)) (- h)) h)
(if (<= t_0 0.0)
(/ t_1 (* h l))
(if (<= t_0 2e+240)
(* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0)
(/ (/ t_1 l) h))))))double code(double d, double h, double l, double M, double D) {
double t_0 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_1 = sqrt((d * h)) * sqrt((d * l));
double tmp;
if (t_0 <= -5e-34) {
tmp = (sqrt(((d / (h * l)) * d)) * -h) / h;
} else if (t_0 <= 0.0) {
tmp = t_1 / (h * l);
} else if (t_0 <= 2e+240) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
} else {
tmp = (t_1 / l) / h;
}
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(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
t_1 = sqrt((d * h)) * sqrt((d * l))
if (t_0 <= (-5d-34)) then
tmp = (sqrt(((d / (h * l)) * d)) * -h) / h
else if (t_0 <= 0.0d0) then
tmp = t_1 / (h * l)
else if (t_0 <= 2d+240) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0d0
else
tmp = (t_1 / l) / h
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_1 = Math.sqrt((d * h)) * Math.sqrt((d * l));
double tmp;
if (t_0 <= -5e-34) {
tmp = (Math.sqrt(((d / (h * l)) * d)) * -h) / h;
} else if (t_0 <= 0.0) {
tmp = t_1 / (h * l);
} else if (t_0 <= 2e+240) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * 1.0;
} else {
tmp = (t_1 / l) / h;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) t_1 = math.sqrt((d * h)) * math.sqrt((d * l)) tmp = 0 if t_0 <= -5e-34: tmp = (math.sqrt(((d / (h * l)) * d)) * -h) / h elif t_0 <= 0.0: tmp = t_1 / (h * l) elif t_0 <= 2e+240: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * 1.0 else: tmp = (t_1 / l) / h return tmp
function code(d, h, l, M, D) t_0 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_1 = Float64(sqrt(Float64(d * h)) * sqrt(Float64(d * l))) tmp = 0.0 if (t_0 <= -5e-34) tmp = Float64(Float64(sqrt(Float64(Float64(d / Float64(h * l)) * d)) * Float64(-h)) / h); elseif (t_0 <= 0.0) tmp = Float64(t_1 / Float64(h * l)); elseif (t_0 <= 2e+240) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0); else tmp = Float64(Float64(t_1 / l) / h); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); t_1 = sqrt((d * h)) * sqrt((d * l)); tmp = 0.0; if (t_0 <= -5e-34) tmp = (sqrt(((d / (h * l)) * d)) * -h) / h; elseif (t_0 <= 0.0) tmp = t_1 / (h * l); elseif (t_0 <= 2e+240) tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0; else tmp = (t_1 / l) / h; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[N[(d * h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-34], N[(N[(N[Sqrt[N[(N[(d / N[(h * l), $MachinePrecision]), $MachinePrecision] * d), $MachinePrecision]], $MachinePrecision] * (-h)), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(t$95$1 / N[(h * l), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e+240], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(t$95$1 / l), $MachinePrecision] / h), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_1 := \sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-34}:\\
\;\;\;\;\frac{\sqrt{\frac{d}{h \cdot \ell} \cdot d} \cdot \left(-h\right)}{h}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{t\_1}{h \cdot \ell}\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+240}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_1}{\ell}}{h}\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -5.0000000000000003e-34Initial program 66.9%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6%
Applied rewrites23.6%
Taylor expanded in h around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f649.7%
Applied rewrites9.7%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
Applied rewrites13.7%
if -5.0000000000000003e-34 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0Initial program 66.9%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6%
Applied rewrites23.6%
Taylor expanded in h around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f649.7%
Applied rewrites9.7%
Taylor expanded in l around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-*.f6430.0%
Applied rewrites30.0%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000003e240Initial program 66.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites65.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
Applied rewrites65.5%
Taylor expanded in d around inf
Applied rewrites39.6%
if 2.00000000000000003e240 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.9%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6%
Applied rewrites23.6%
Taylor expanded in l around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f6432.2%
Applied rewrites32.2%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
(t_1 (/ (* (sqrt (* d h)) (sqrt (* d l))) (* h l))))
(if (<= t_0 -5e-34)
(/ (* (sqrt (* (/ d (* h l)) d)) (- h)) h)
(if (<= t_0 0.0)
t_1
(if (<= t_0 2e+240) (* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0) t_1)))))double code(double d, double h, double l, double M, double D) {
double t_0 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_1 = (sqrt((d * h)) * sqrt((d * l))) / (h * l);
double tmp;
if (t_0 <= -5e-34) {
tmp = (sqrt(((d / (h * l)) * d)) * -h) / h;
} else if (t_0 <= 0.0) {
tmp = t_1;
} else if (t_0 <= 2e+240) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
} else {
tmp = t_1;
}
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(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
t_1 = (sqrt((d * h)) * sqrt((d * l))) / (h * l)
if (t_0 <= (-5d-34)) then
tmp = (sqrt(((d / (h * l)) * d)) * -h) / h
else if (t_0 <= 0.0d0) then
tmp = t_1
else if (t_0 <= 2d+240) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0d0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_1 = (Math.sqrt((d * h)) * Math.sqrt((d * l))) / (h * l);
double tmp;
if (t_0 <= -5e-34) {
tmp = (Math.sqrt(((d / (h * l)) * d)) * -h) / h;
} else if (t_0 <= 0.0) {
tmp = t_1;
} else if (t_0 <= 2e+240) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * 1.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) t_1 = (math.sqrt((d * h)) * math.sqrt((d * l))) / (h * l) tmp = 0 if t_0 <= -5e-34: tmp = (math.sqrt(((d / (h * l)) * d)) * -h) / h elif t_0 <= 0.0: tmp = t_1 elif t_0 <= 2e+240: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * 1.0 else: tmp = t_1 return tmp
function code(d, h, l, M, D) t_0 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_1 = Float64(Float64(sqrt(Float64(d * h)) * sqrt(Float64(d * l))) / Float64(h * l)) tmp = 0.0 if (t_0 <= -5e-34) tmp = Float64(Float64(sqrt(Float64(Float64(d / Float64(h * l)) * d)) * Float64(-h)) / h); elseif (t_0 <= 0.0) tmp = t_1; elseif (t_0 <= 2e+240) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0); else tmp = t_1; end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); t_1 = (sqrt((d * h)) * sqrt((d * l))) / (h * l); tmp = 0.0; if (t_0 <= -5e-34) tmp = (sqrt(((d / (h * l)) * d)) * -h) / h; elseif (t_0 <= 0.0) tmp = t_1; elseif (t_0 <= 2e+240) tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0; else tmp = t_1; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Sqrt[N[(d * h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(h * l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-34], N[(N[(N[Sqrt[N[(N[(d / N[(h * l), $MachinePrecision]), $MachinePrecision] * d), $MachinePrecision]], $MachinePrecision] * (-h)), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[t$95$0, 0.0], t$95$1, If[LessEqual[t$95$0, 2e+240], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_1 := \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-34}:\\
\;\;\;\;\frac{\sqrt{\frac{d}{h \cdot \ell} \cdot d} \cdot \left(-h\right)}{h}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+240}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -5.0000000000000003e-34Initial program 66.9%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6%
Applied rewrites23.6%
Taylor expanded in h around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f649.7%
Applied rewrites9.7%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
Applied rewrites13.7%
if -5.0000000000000003e-34 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0 or 2.00000000000000003e240 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.9%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6%
Applied rewrites23.6%
Taylor expanded in h around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f649.7%
Applied rewrites9.7%
Taylor expanded in l around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-*.f6430.0%
Applied rewrites30.0%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000003e240Initial program 66.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites65.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
Applied rewrites65.5%
Taylor expanded in d around inf
Applied rewrites39.6%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d h))))
(if (<= h -5e+208)
(* (* (sqrt (/ d l)) t_0) 1.0)
(if (<= h 1.25e-287)
(* -1.0 (* d (sqrt (/ 1.0 (* h l)))))
(/ (* (sqrt d) t_0) (* l (sqrt (/ 1.0 l))))))))double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / h));
double tmp;
if (h <= -5e+208) {
tmp = (sqrt((d / l)) * t_0) * 1.0;
} else if (h <= 1.25e-287) {
tmp = -1.0 * (d * sqrt((1.0 / (h * l))));
} else {
tmp = (sqrt(d) * t_0) / (l * sqrt((1.0 / l)));
}
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(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((d / h))
if (h <= (-5d+208)) then
tmp = (sqrt((d / l)) * t_0) * 1.0d0
else if (h <= 1.25d-287) then
tmp = (-1.0d0) * (d * sqrt((1.0d0 / (h * l))))
else
tmp = (sqrt(d) * t_0) / (l * sqrt((1.0d0 / l)))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / h));
double tmp;
if (h <= -5e+208) {
tmp = (Math.sqrt((d / l)) * t_0) * 1.0;
} else if (h <= 1.25e-287) {
tmp = -1.0 * (d * Math.sqrt((1.0 / (h * l))));
} else {
tmp = (Math.sqrt(d) * t_0) / (l * Math.sqrt((1.0 / l)));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((d / h)) tmp = 0 if h <= -5e+208: tmp = (math.sqrt((d / l)) * t_0) * 1.0 elif h <= 1.25e-287: tmp = -1.0 * (d * math.sqrt((1.0 / (h * l)))) else: tmp = (math.sqrt(d) * t_0) / (l * math.sqrt((1.0 / l))) return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(d / h)) tmp = 0.0 if (h <= -5e+208) tmp = Float64(Float64(sqrt(Float64(d / l)) * t_0) * 1.0); elseif (h <= 1.25e-287) tmp = Float64(-1.0 * Float64(d * sqrt(Float64(1.0 / Float64(h * l))))); else tmp = Float64(Float64(sqrt(d) * t_0) / Float64(l * sqrt(Float64(1.0 / l)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((d / h)); tmp = 0.0; if (h <= -5e+208) tmp = (sqrt((d / l)) * t_0) * 1.0; elseif (h <= 1.25e-287) tmp = -1.0 * (d * sqrt((1.0 / (h * l)))); else tmp = (sqrt(d) * t_0) / (l * sqrt((1.0 / l))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, -5e+208], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[h, 1.25e-287], N[(-1.0 * N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] * t$95$0), $MachinePrecision] / N[(l * N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;h \leq -5 \cdot 10^{+208}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot t\_0\right) \cdot 1\\
\mathbf{elif}\;h \leq 1.25 \cdot 10^{-287}:\\
\;\;\;\;-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d} \cdot t\_0}{\ell \cdot \sqrt{\frac{1}{\ell}}}\\
\end{array}
if h < -5.0000000000000004e208Initial program 66.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites65.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
Applied rewrites65.5%
Taylor expanded in d around inf
Applied rewrites39.6%
if -5.0000000000000004e208 < h < 1.25000000000000006e-287Initial program 66.9%
Applied rewrites35.3%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6426.3%
Applied rewrites26.3%
if 1.25000000000000006e-287 < h Initial program 66.9%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
Applied rewrites53.6%
lift-*.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow-prod-downN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
pow1/2N/A
*-commutativeN/A
sqrt-prodN/A
lower-unsound-sqrt.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-unsound-sqrt.f6426.4%
Applied rewrites26.4%
lift-sqrt.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f6428.7%
Applied rewrites28.7%
Taylor expanded in l around inf
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6422.8%
Applied rewrites22.8%
(FPCore (d h l M D)
:precision binary64
(if (<= h -5e+208)
(* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0)
(if (<= h 1.25e-287)
(* -1.0 (* d (sqrt (/ 1.0 (* h l)))))
(/ (* d (/ (sqrt h) (sqrt l))) h))))double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -5e+208) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
} else if (h <= 1.25e-287) {
tmp = -1.0 * (d * sqrt((1.0 / (h * l))));
} else {
tmp = (d * (sqrt(h) / sqrt(l))) / h;
}
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(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (h <= (-5d+208)) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0d0
else if (h <= 1.25d-287) then
tmp = (-1.0d0) * (d * sqrt((1.0d0 / (h * l))))
else
tmp = (d * (sqrt(h) / sqrt(l))) / h
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -5e+208) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * 1.0;
} else if (h <= 1.25e-287) {
tmp = -1.0 * (d * Math.sqrt((1.0 / (h * l))));
} else {
tmp = (d * (Math.sqrt(h) / Math.sqrt(l))) / h;
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if h <= -5e+208: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * 1.0 elif h <= 1.25e-287: tmp = -1.0 * (d * math.sqrt((1.0 / (h * l)))) else: tmp = (d * (math.sqrt(h) / math.sqrt(l))) / h return tmp
function code(d, h, l, M, D) tmp = 0.0 if (h <= -5e+208) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0); elseif (h <= 1.25e-287) tmp = Float64(-1.0 * Float64(d * sqrt(Float64(1.0 / Float64(h * l))))); else tmp = Float64(Float64(d * Float64(sqrt(h) / sqrt(l))) / h); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (h <= -5e+208) tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0; elseif (h <= 1.25e-287) tmp = -1.0 * (d * sqrt((1.0 / (h * l)))); else tmp = (d * (sqrt(h) / sqrt(l))) / h; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[h, -5e+208], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[h, 1.25e-287], N[(-1.0 * N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d * N[(N[Sqrt[h], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;h \leq -5 \cdot 10^{+208}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
\mathbf{elif}\;h \leq 1.25 \cdot 10^{-287}:\\
\;\;\;\;-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d \cdot \frac{\sqrt{h}}{\sqrt{\ell}}}{h}\\
\end{array}
if h < -5.0000000000000004e208Initial program 66.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
lower-*.f64N/A
Applied rewrites65.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6465.5%
Applied rewrites65.5%
Taylor expanded in d around inf
Applied rewrites39.6%
if -5.0000000000000004e208 < h < 1.25000000000000006e-287Initial program 66.9%
Applied rewrites35.3%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6426.3%
Applied rewrites26.3%
if 1.25000000000000006e-287 < h Initial program 66.9%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6%
Applied rewrites23.6%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6421.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.7%
Applied rewrites21.7%
Taylor expanded in d around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6437.2%
Applied rewrites37.2%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f6422.7%
Applied rewrites22.7%
(FPCore (d h l M D) :precision binary64 (if (<= h 1.25e-287) (* -1.0 (* d (sqrt (/ 1.0 (* h l))))) (/ (* d (/ (sqrt h) (sqrt l))) h)))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= 1.25e-287) {
tmp = -1.0 * (d * sqrt((1.0 / (h * l))));
} else {
tmp = (d * (sqrt(h) / sqrt(l))) / h;
}
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(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (h <= 1.25d-287) then
tmp = (-1.0d0) * (d * sqrt((1.0d0 / (h * l))))
else
tmp = (d * (sqrt(h) / sqrt(l))) / h
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= 1.25e-287) {
tmp = -1.0 * (d * Math.sqrt((1.0 / (h * l))));
} else {
tmp = (d * (Math.sqrt(h) / Math.sqrt(l))) / h;
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if h <= 1.25e-287: tmp = -1.0 * (d * math.sqrt((1.0 / (h * l)))) else: tmp = (d * (math.sqrt(h) / math.sqrt(l))) / h return tmp
function code(d, h, l, M, D) tmp = 0.0 if (h <= 1.25e-287) tmp = Float64(-1.0 * Float64(d * sqrt(Float64(1.0 / Float64(h * l))))); else tmp = Float64(Float64(d * Float64(sqrt(h) / sqrt(l))) / h); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (h <= 1.25e-287) tmp = -1.0 * (d * sqrt((1.0 / (h * l)))); else tmp = (d * (sqrt(h) / sqrt(l))) / h; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[h, 1.25e-287], N[(-1.0 * N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d * N[(N[Sqrt[h], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;h \leq 1.25 \cdot 10^{-287}:\\
\;\;\;\;-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d \cdot \frac{\sqrt{h}}{\sqrt{\ell}}}{h}\\
\end{array}
if h < 1.25000000000000006e-287Initial program 66.9%
Applied rewrites35.3%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6426.3%
Applied rewrites26.3%
if 1.25000000000000006e-287 < h Initial program 66.9%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6%
Applied rewrites23.6%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6421.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.7%
Applied rewrites21.7%
Taylor expanded in d around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6437.2%
Applied rewrites37.2%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f6422.7%
Applied rewrites22.7%
(FPCore (d h l M D) :precision binary64 (if (<= h 2.4e-302) (/ (* d (sqrt (/ h l))) h) (/ (* d (/ (sqrt h) (sqrt l))) h)))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= 2.4e-302) {
tmp = (d * sqrt((h / l))) / h;
} else {
tmp = (d * (sqrt(h) / sqrt(l))) / h;
}
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(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (h <= 2.4d-302) then
tmp = (d * sqrt((h / l))) / h
else
tmp = (d * (sqrt(h) / sqrt(l))) / h
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= 2.4e-302) {
tmp = (d * Math.sqrt((h / l))) / h;
} else {
tmp = (d * (Math.sqrt(h) / Math.sqrt(l))) / h;
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if h <= 2.4e-302: tmp = (d * math.sqrt((h / l))) / h else: tmp = (d * (math.sqrt(h) / math.sqrt(l))) / h return tmp
function code(d, h, l, M, D) tmp = 0.0 if (h <= 2.4e-302) tmp = Float64(Float64(d * sqrt(Float64(h / l))) / h); else tmp = Float64(Float64(d * Float64(sqrt(h) / sqrt(l))) / h); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (h <= 2.4e-302) tmp = (d * sqrt((h / l))) / h; else tmp = (d * (sqrt(h) / sqrt(l))) / h; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[h, 2.4e-302], N[(N[(d * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(N[(d * N[(N[Sqrt[h], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;h \leq 2.4 \cdot 10^{-302}:\\
\;\;\;\;\frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{d \cdot \frac{\sqrt{h}}{\sqrt{\ell}}}{h}\\
\end{array}
if h < 2.40000000000000022e-302Initial program 66.9%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6%
Applied rewrites23.6%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6421.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.7%
Applied rewrites21.7%
Taylor expanded in d around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6437.2%
Applied rewrites37.2%
if 2.40000000000000022e-302 < h Initial program 66.9%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6%
Applied rewrites23.6%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6421.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.7%
Applied rewrites21.7%
Taylor expanded in d around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6437.2%
Applied rewrites37.2%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f64N/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f6422.7%
Applied rewrites22.7%
(FPCore (d h l M D) :precision binary64 (/ (* d (sqrt (/ h l))) h))
double code(double d, double h, double l, double M, double D) {
return (d * sqrt((h / l))) / h;
}
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(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (d * sqrt((h / l))) / h
end function
public static double code(double d, double h, double l, double M, double D) {
return (d * Math.sqrt((h / l))) / h;
}
def code(d, h, l, M, D): return (d * math.sqrt((h / l))) / h
function code(d, h, l, M, D) return Float64(Float64(d * sqrt(Float64(h / l))) / h) end
function tmp = code(d, h, l, M, D) tmp = (d * sqrt((h / l))) / h; end
code[d_, h_, l_, M_, D_] := N[(N[(d * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]
\frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}
Initial program 66.9%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.6%
Applied rewrites23.6%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6421.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.7%
Applied rewrites21.7%
Taylor expanded in d around 0
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6437.2%
Applied rewrites37.2%
herbie shell --seed 2025185
(FPCore (d h l M D)
:name "Henrywood and Agarwal, Equation (12)"
:precision binary64
(* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))