
(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 25 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
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))
(t_1 (/ D (+ d d)))
(t_2 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) t_0))
(t_3 (* l (+ d d)))
(t_4 (* (sqrt (/ d l)) (sqrt (/ d h))))
(t_5 (fabs (/ d (sqrt (* l h))))))
(if (<= t_2 -5e+200)
(* t_4 (- 1.0 (* (* t_1 M) (* (* t_1 (* M 0.5)) (/ h l)))))
(if (<= t_2 0.0)
(* t_5 (- 1.0 (/ (* (* 0.25 (/ (* D (* M h)) d)) (* M D)) t_3)))
(if (<= t_2 4e+233)
(* t_4 t_0)
(* t_5 (- 1.0 (/ (* (* (/ (* (* M D) 0.25) d) h) (* M D)) t_3))))))))double code(double d, double h, double l, double M, double D) {
double t_0 = 1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l));
double t_1 = D / (d + d);
double t_2 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * t_0;
double t_3 = l * (d + d);
double t_4 = sqrt((d / l)) * sqrt((d / h));
double t_5 = fabs((d / sqrt((l * h))));
double tmp;
if (t_2 <= -5e+200) {
tmp = t_4 * (1.0 - ((t_1 * M) * ((t_1 * (M * 0.5)) * (h / l))));
} else if (t_2 <= 0.0) {
tmp = t_5 * (1.0 - (((0.25 * ((D * (M * h)) / d)) * (M * D)) / t_3));
} else if (t_2 <= 4e+233) {
tmp = t_4 * t_0;
} else {
tmp = t_5 * (1.0 - ((((((M * D) * 0.25) / d) * h) * (M * D)) / t_3));
}
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) :: t_5
real(8) :: tmp
t_0 = 1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l))
t_1 = d_1 / (d + d)
t_2 = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * t_0
t_3 = l * (d + d)
t_4 = sqrt((d / l)) * sqrt((d / h))
t_5 = abs((d / sqrt((l * h))))
if (t_2 <= (-5d+200)) then
tmp = t_4 * (1.0d0 - ((t_1 * m) * ((t_1 * (m * 0.5d0)) * (h / l))))
else if (t_2 <= 0.0d0) then
tmp = t_5 * (1.0d0 - (((0.25d0 * ((d_1 * (m * h)) / d)) * (m * d_1)) / t_3))
else if (t_2 <= 4d+233) then
tmp = t_4 * t_0
else
tmp = t_5 * (1.0d0 - ((((((m * d_1) * 0.25d0) / d) * h) * (m * d_1)) / t_3))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = 1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l));
double t_1 = D / (d + d);
double t_2 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * t_0;
double t_3 = l * (d + d);
double t_4 = Math.sqrt((d / l)) * Math.sqrt((d / h));
double t_5 = Math.abs((d / Math.sqrt((l * h))));
double tmp;
if (t_2 <= -5e+200) {
tmp = t_4 * (1.0 - ((t_1 * M) * ((t_1 * (M * 0.5)) * (h / l))));
} else if (t_2 <= 0.0) {
tmp = t_5 * (1.0 - (((0.25 * ((D * (M * h)) / d)) * (M * D)) / t_3));
} else if (t_2 <= 4e+233) {
tmp = t_4 * t_0;
} else {
tmp = t_5 * (1.0 - ((((((M * D) * 0.25) / d) * h) * (M * D)) / t_3));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = 1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)) t_1 = D / (d + d) t_2 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * t_0 t_3 = l * (d + d) t_4 = math.sqrt((d / l)) * math.sqrt((d / h)) t_5 = math.fabs((d / math.sqrt((l * h)))) tmp = 0 if t_2 <= -5e+200: tmp = t_4 * (1.0 - ((t_1 * M) * ((t_1 * (M * 0.5)) * (h / l)))) elif t_2 <= 0.0: tmp = t_5 * (1.0 - (((0.25 * ((D * (M * h)) / d)) * (M * D)) / t_3)) elif t_2 <= 4e+233: tmp = t_4 * t_0 else: tmp = t_5 * (1.0 - ((((((M * D) * 0.25) / d) * h) * (M * D)) / t_3)) return tmp
function code(d, h, l, M, D) t_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(D / Float64(d + d)) t_2 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * t_0) t_3 = Float64(l * Float64(d + d)) t_4 = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) t_5 = abs(Float64(d / sqrt(Float64(l * h)))) tmp = 0.0 if (t_2 <= -5e+200) tmp = Float64(t_4 * Float64(1.0 - Float64(Float64(t_1 * M) * Float64(Float64(t_1 * Float64(M * 0.5)) * Float64(h / l))))); elseif (t_2 <= 0.0) tmp = Float64(t_5 * Float64(1.0 - Float64(Float64(Float64(0.25 * Float64(Float64(D * Float64(M * h)) / d)) * Float64(M * D)) / t_3))); elseif (t_2 <= 4e+233) tmp = Float64(t_4 * t_0); else tmp = Float64(t_5 * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(M * D) * 0.25) / d) * h) * Float64(M * D)) / t_3))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = 1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l)); t_1 = D / (d + d); t_2 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * t_0; t_3 = l * (d + d); t_4 = sqrt((d / l)) * sqrt((d / h)); t_5 = abs((d / sqrt((l * h)))); tmp = 0.0; if (t_2 <= -5e+200) tmp = t_4 * (1.0 - ((t_1 * M) * ((t_1 * (M * 0.5)) * (h / l)))); elseif (t_2 <= 0.0) tmp = t_5 * (1.0 - (((0.25 * ((D * (M * h)) / d)) * (M * D)) / t_3)); elseif (t_2 <= 4e+233) tmp = t_4 * t_0; else tmp = t_5 * (1.0 - ((((((M * D) * 0.25) / d) * h) * (M * D)) / t_3)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = 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]}, Block[{t$95$1 = N[(D / N[(d + 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] * t$95$0), $MachinePrecision]}, Block[{t$95$3 = N[(l * N[(d + d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$2, -5e+200], N[(t$95$4 * N[(1.0 - N[(N[(t$95$1 * M), $MachinePrecision] * N[(N[(t$95$1 * N[(M * 0.5), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0], N[(t$95$5 * N[(1.0 - N[(N[(N[(0.25 * N[(N[(D * N[(M * h), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 4e+233], N[(t$95$4 * t$95$0), $MachinePrecision], N[(t$95$5 * N[(1.0 - N[(N[(N[(N[(N[(N[(M * D), $MachinePrecision] * 0.25), $MachinePrecision] / d), $MachinePrecision] * h), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
t_0 := 1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\\
t_1 := \frac{D}{d + d}\\
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 t\_0\\
t_3 := \ell \cdot \left(d + d\right)\\
t_4 := \sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
t_5 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+200}:\\
\;\;\;\;t\_4 \cdot \left(1 - \left(t\_1 \cdot M\right) \cdot \left(\left(t\_1 \cdot \left(M \cdot 0.5\right)\right) \cdot \frac{h}{\ell}\right)\right)\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;t\_5 \cdot \left(1 - \frac{\left(0.25 \cdot \frac{D \cdot \left(M \cdot h\right)}{d}\right) \cdot \left(M \cdot D\right)}{t\_3}\right)\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+233}:\\
\;\;\;\;t\_4 \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_5 \cdot \left(1 - \frac{\left(\frac{\left(M \cdot D\right) \cdot 0.25}{d} \cdot h\right) \cdot \left(M \cdot D\right)}{t\_3}\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)))) < -5.00000000000000019e200Initial program 67.1%
lift-*.f64N/A
lift-*.f64N/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 rewrites68.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6468.0%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6468.0%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6468.0%
Applied rewrites68.0%
if -5.00000000000000019e200 < (*.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 67.1%
lift-*.f64N/A
lift-*.f64N/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 rewrites68.0%
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
lift-*.f64N/A
pow1/2N/A
sqrt-undivN/A
lift-*.f64N/A
rem-sqrt-squareN/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
div-fabsN/A
lower-fabs.f64N/A
lower-/.f6471.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.3%
Applied rewrites71.3%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-/l*N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites74.2%
Taylor expanded in d around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6473.4%
Applied rewrites73.4%
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)))) < 3.99999999999999989e233Initial program 67.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6467.1%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6467.1%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6467.1%
Applied rewrites67.1%
if 3.99999999999999989e233 < (*.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 67.1%
lift-*.f64N/A
lift-*.f64N/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 rewrites68.0%
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
lift-*.f64N/A
pow1/2N/A
sqrt-undivN/A
lift-*.f64N/A
rem-sqrt-squareN/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
div-fabsN/A
lower-fabs.f64N/A
lower-/.f6471.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.3%
Applied rewrites71.3%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-/l*N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites74.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6475.6%
Applied rewrites75.6%
(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))))
(t_2
(*
t_1
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
(t_3 (* l (+ d d)))
(t_4 (fabs (/ d (sqrt (* l h))))))
(if (<= t_2 -5e+200)
(*
(* (sqrt (/ d l)) (sqrt (/ d h)))
(- 1.0 (* (* t_0 M) (* (* t_0 (* M 0.5)) (/ h l)))))
(if (<= t_2 0.0)
(* t_4 (- 1.0 (/ (* (* 0.25 (/ (* D (* M h)) d)) (* M D)) t_3)))
(if (<= t_2 4e+233)
(* t_1 1.0)
(* t_4 (- 1.0 (/ (* (* (/ (* (* M D) 0.25) d) h) (* M D)) t_3))))))))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));
double t_2 = t_1 * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_3 = l * (d + d);
double t_4 = fabs((d / sqrt((l * h))));
double tmp;
if (t_2 <= -5e+200) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((t_0 * M) * ((t_0 * (M * 0.5)) * (h / l))));
} else if (t_2 <= 0.0) {
tmp = t_4 * (1.0 - (((0.25 * ((D * (M * h)) / d)) * (M * D)) / t_3));
} else if (t_2 <= 4e+233) {
tmp = t_1 * 1.0;
} else {
tmp = t_4 * (1.0 - ((((((M * D) * 0.25) / d) * h) * (M * D)) / t_3));
}
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 = d_1 / (d + d)
t_1 = ((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))
t_2 = t_1 * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
t_3 = l * (d + d)
t_4 = abs((d / sqrt((l * h))))
if (t_2 <= (-5d+200)) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0d0 - ((t_0 * m) * ((t_0 * (m * 0.5d0)) * (h / l))))
else if (t_2 <= 0.0d0) then
tmp = t_4 * (1.0d0 - (((0.25d0 * ((d_1 * (m * h)) / d)) * (m * d_1)) / t_3))
else if (t_2 <= 4d+233) then
tmp = t_1 * 1.0d0
else
tmp = t_4 * (1.0d0 - ((((((m * d_1) * 0.25d0) / d) * h) * (m * d_1)) / t_3))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = D / (d + d);
double t_1 = Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0));
double t_2 = t_1 * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_3 = l * (d + d);
double t_4 = Math.abs((d / Math.sqrt((l * h))));
double tmp;
if (t_2 <= -5e+200) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 - ((t_0 * M) * ((t_0 * (M * 0.5)) * (h / l))));
} else if (t_2 <= 0.0) {
tmp = t_4 * (1.0 - (((0.25 * ((D * (M * h)) / d)) * (M * D)) / t_3));
} else if (t_2 <= 4e+233) {
tmp = t_1 * 1.0;
} else {
tmp = t_4 * (1.0 - ((((((M * D) * 0.25) / d) * h) * (M * D)) / t_3));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = D / (d + d) t_1 = math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0)) t_2 = t_1 * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) t_3 = l * (d + d) t_4 = math.fabs((d / math.sqrt((l * h)))) tmp = 0 if t_2 <= -5e+200: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 - ((t_0 * M) * ((t_0 * (M * 0.5)) * (h / l)))) elif t_2 <= 0.0: tmp = t_4 * (1.0 - (((0.25 * ((D * (M * h)) / d)) * (M * D)) / t_3)) elif t_2 <= 4e+233: tmp = t_1 * 1.0 else: tmp = t_4 * (1.0 - ((((((M * D) * 0.25) / d) * h) * (M * D)) / t_3)) return tmp
function code(d, h, l, M, D) t_0 = Float64(D / Float64(d + d)) t_1 = Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) t_2 = Float64(t_1 * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_3 = Float64(l * Float64(d + d)) t_4 = abs(Float64(d / sqrt(Float64(l * h)))) tmp = 0.0 if (t_2 <= -5e+200) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(Float64(t_0 * M) * Float64(Float64(t_0 * Float64(M * 0.5)) * Float64(h / l))))); elseif (t_2 <= 0.0) tmp = Float64(t_4 * Float64(1.0 - Float64(Float64(Float64(0.25 * Float64(Float64(D * Float64(M * h)) / d)) * Float64(M * D)) / t_3))); elseif (t_2 <= 4e+233) tmp = Float64(t_1 * 1.0); else tmp = Float64(t_4 * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(M * D) * 0.25) / d) * h) * Float64(M * D)) / t_3))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = D / (d + d); t_1 = ((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0)); t_2 = t_1 * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); t_3 = l * (d + d); t_4 = abs((d / sqrt((l * h)))); tmp = 0.0; if (t_2 <= -5e+200) tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((t_0 * M) * ((t_0 * (M * 0.5)) * (h / l)))); elseif (t_2 <= 0.0) tmp = t_4 * (1.0 - (((0.25 * ((D * (M * h)) / d)) * (M * D)) / t_3)); elseif (t_2 <= 4e+233) tmp = t_1 * 1.0; else tmp = t_4 * (1.0 - ((((((M * D) * 0.25) / d) * h) * (M * D)) / t_3)); end tmp_2 = 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[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]}, Block[{t$95$2 = N[(t$95$1 * 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$3 = N[(l * N[(d + d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$2, -5e+200], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(t$95$0 * M), $MachinePrecision] * N[(N[(t$95$0 * N[(M * 0.5), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0], N[(t$95$4 * N[(1.0 - N[(N[(N[(0.25 * N[(N[(D * N[(M * h), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 4e+233], N[(t$95$1 * 1.0), $MachinePrecision], N[(t$95$4 * N[(1.0 - N[(N[(N[(N[(N[(N[(M * D), $MachinePrecision] * 0.25), $MachinePrecision] / d), $MachinePrecision] * h), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
t_0 := \frac{D}{d + d}\\
t_1 := {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\\
t_2 := t\_1 \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_3 := \ell \cdot \left(d + d\right)\\
t_4 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+200}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \left(t\_0 \cdot M\right) \cdot \left(\left(t\_0 \cdot \left(M \cdot 0.5\right)\right) \cdot \frac{h}{\ell}\right)\right)\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;t\_4 \cdot \left(1 - \frac{\left(0.25 \cdot \frac{D \cdot \left(M \cdot h\right)}{d}\right) \cdot \left(M \cdot D\right)}{t\_3}\right)\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+233}:\\
\;\;\;\;t\_1 \cdot 1\\
\mathbf{else}:\\
\;\;\;\;t\_4 \cdot \left(1 - \frac{\left(\frac{\left(M \cdot D\right) \cdot 0.25}{d} \cdot h\right) \cdot \left(M \cdot D\right)}{t\_3}\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)))) < -5.00000000000000019e200Initial program 67.1%
lift-*.f64N/A
lift-*.f64N/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 rewrites68.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6468.0%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6468.0%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6468.0%
Applied rewrites68.0%
if -5.00000000000000019e200 < (*.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 67.1%
lift-*.f64N/A
lift-*.f64N/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 rewrites68.0%
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
lift-*.f64N/A
pow1/2N/A
sqrt-undivN/A
lift-*.f64N/A
rem-sqrt-squareN/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
div-fabsN/A
lower-fabs.f64N/A
lower-/.f6471.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.3%
Applied rewrites71.3%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-/l*N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites74.2%
Taylor expanded in d around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6473.4%
Applied rewrites73.4%
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)))) < 3.99999999999999989e233Initial program 67.1%
Taylor expanded in d around inf
Applied rewrites40.1%
if 3.99999999999999989e233 < (*.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 67.1%
lift-*.f64N/A
lift-*.f64N/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 rewrites68.0%
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
lift-*.f64N/A
pow1/2N/A
sqrt-undivN/A
lift-*.f64N/A
rem-sqrt-squareN/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
div-fabsN/A
lower-fabs.f64N/A
lower-/.f6471.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.3%
Applied rewrites71.3%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-/l*N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites74.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6475.6%
Applied rewrites75.6%
(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 (* l (+ d d)))
(t_3
(*
(* (sqrt (/ d l)) (sqrt (/ d h)))
(- 1.0 (* (* t_0 M) (* (* t_0 (* M 0.5)) (/ h l))))))
(t_4 (fabs (/ d (sqrt (* l h))))))
(if (<= t_1 -5e+200)
t_3
(if (<= t_1 0.0)
(* t_4 (- 1.0 (/ (* (* 0.25 (/ (* D (* M h)) d)) (* M D)) t_2)))
(if (<= t_1 4e+233)
t_3
(* t_4 (- 1.0 (/ (* (* (/ (* (* M D) 0.25) d) h) (* M D)) t_2))))))))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 = l * (d + d);
double t_3 = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((t_0 * M) * ((t_0 * (M * 0.5)) * (h / l))));
double t_4 = fabs((d / sqrt((l * h))));
double tmp;
if (t_1 <= -5e+200) {
tmp = t_3;
} else if (t_1 <= 0.0) {
tmp = t_4 * (1.0 - (((0.25 * ((D * (M * h)) / d)) * (M * D)) / t_2));
} else if (t_1 <= 4e+233) {
tmp = t_3;
} else {
tmp = t_4 * (1.0 - ((((((M * D) * 0.25) / d) * h) * (M * D)) / t_2));
}
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 = d_1 / (d + d)
t_1 = (((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_2 = l * (d + d)
t_3 = (sqrt((d / l)) * sqrt((d / h))) * (1.0d0 - ((t_0 * m) * ((t_0 * (m * 0.5d0)) * (h / l))))
t_4 = abs((d / sqrt((l * h))))
if (t_1 <= (-5d+200)) then
tmp = t_3
else if (t_1 <= 0.0d0) then
tmp = t_4 * (1.0d0 - (((0.25d0 * ((d_1 * (m * h)) / d)) * (m * d_1)) / t_2))
else if (t_1 <= 4d+233) then
tmp = t_3
else
tmp = t_4 * (1.0d0 - ((((((m * d_1) * 0.25d0) / d) * h) * (m * d_1)) / t_2))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = D / (d + d);
double t_1 = (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_2 = l * (d + d);
double t_3 = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 - ((t_0 * M) * ((t_0 * (M * 0.5)) * (h / l))));
double t_4 = Math.abs((d / Math.sqrt((l * h))));
double tmp;
if (t_1 <= -5e+200) {
tmp = t_3;
} else if (t_1 <= 0.0) {
tmp = t_4 * (1.0 - (((0.25 * ((D * (M * h)) / d)) * (M * D)) / t_2));
} else if (t_1 <= 4e+233) {
tmp = t_3;
} else {
tmp = t_4 * (1.0 - ((((((M * D) * 0.25) / d) * h) * (M * D)) / t_2));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = D / (d + d) t_1 = (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_2 = l * (d + d) t_3 = (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 - ((t_0 * M) * ((t_0 * (M * 0.5)) * (h / l)))) t_4 = math.fabs((d / math.sqrt((l * h)))) tmp = 0 if t_1 <= -5e+200: tmp = t_3 elif t_1 <= 0.0: tmp = t_4 * (1.0 - (((0.25 * ((D * (M * h)) / d)) * (M * D)) / t_2)) elif t_1 <= 4e+233: tmp = t_3 else: tmp = t_4 * (1.0 - ((((((M * D) * 0.25) / d) * h) * (M * D)) / t_2)) 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(l * Float64(d + d)) t_3 = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(Float64(t_0 * M) * Float64(Float64(t_0 * Float64(M * 0.5)) * Float64(h / l))))) t_4 = abs(Float64(d / sqrt(Float64(l * h)))) tmp = 0.0 if (t_1 <= -5e+200) tmp = t_3; elseif (t_1 <= 0.0) tmp = Float64(t_4 * Float64(1.0 - Float64(Float64(Float64(0.25 * Float64(Float64(D * Float64(M * h)) / d)) * Float64(M * D)) / t_2))); elseif (t_1 <= 4e+233) tmp = t_3; else tmp = Float64(t_4 * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(M * D) * 0.25) / d) * h) * Float64(M * D)) / t_2))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = D / (d + d); t_1 = (((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_2 = l * (d + d); t_3 = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((t_0 * M) * ((t_0 * (M * 0.5)) * (h / l)))); t_4 = abs((d / sqrt((l * h)))); tmp = 0.0; if (t_1 <= -5e+200) tmp = t_3; elseif (t_1 <= 0.0) tmp = t_4 * (1.0 - (((0.25 * ((D * (M * h)) / d)) * (M * D)) / t_2)); elseif (t_1 <= 4e+233) tmp = t_3; else tmp = t_4 * (1.0 - ((((((M * D) * 0.25) / d) * h) * (M * D)) / t_2)); end tmp_2 = 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[(l * N[(d + d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(t$95$0 * M), $MachinePrecision] * N[(N[(t$95$0 * N[(M * 0.5), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, -5e+200], t$95$3, If[LessEqual[t$95$1, 0.0], N[(t$95$4 * N[(1.0 - N[(N[(N[(0.25 * N[(N[(D * N[(M * h), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e+233], t$95$3, N[(t$95$4 * N[(1.0 - N[(N[(N[(N[(N[(N[(M * D), $MachinePrecision] * 0.25), $MachinePrecision] / d), $MachinePrecision] * h), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / t$95$2), $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 := \ell \cdot \left(d + d\right)\\
t_3 := \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \left(t\_0 \cdot M\right) \cdot \left(\left(t\_0 \cdot \left(M \cdot 0.5\right)\right) \cdot \frac{h}{\ell}\right)\right)\\
t_4 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+200}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;t\_4 \cdot \left(1 - \frac{\left(0.25 \cdot \frac{D \cdot \left(M \cdot h\right)}{d}\right) \cdot \left(M \cdot D\right)}{t\_2}\right)\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+233}:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;t\_4 \cdot \left(1 - \frac{\left(\frac{\left(M \cdot D\right) \cdot 0.25}{d} \cdot h\right) \cdot \left(M \cdot D\right)}{t\_2}\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)))) < -5.00000000000000019e200 or -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)))) < 3.99999999999999989e233Initial program 67.1%
lift-*.f64N/A
lift-*.f64N/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 rewrites68.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6468.0%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6468.0%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6468.0%
Applied rewrites68.0%
if -5.00000000000000019e200 < (*.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 67.1%
lift-*.f64N/A
lift-*.f64N/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 rewrites68.0%
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
lift-*.f64N/A
pow1/2N/A
sqrt-undivN/A
lift-*.f64N/A
rem-sqrt-squareN/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
div-fabsN/A
lower-fabs.f64N/A
lower-/.f6471.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.3%
Applied rewrites71.3%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-/l*N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites74.2%
Taylor expanded in d around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6473.4%
Applied rewrites73.4%
if 3.99999999999999989e233 < (*.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 67.1%
lift-*.f64N/A
lift-*.f64N/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 rewrites68.0%
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
lift-*.f64N/A
pow1/2N/A
sqrt-undivN/A
lift-*.f64N/A
rem-sqrt-squareN/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
div-fabsN/A
lower-fabs.f64N/A
lower-/.f6471.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.3%
Applied rewrites71.3%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-/l*N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites74.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6475.6%
Applied rewrites75.6%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (fabs (/ d (sqrt (* l h)))))
(t_1 (fmin (fabs M) D))
(t_2 (sqrt (/ d l)))
(t_3 (fmax (fabs M) D))
(t_4 (/ t_3 d))
(t_5 (* t_1 t_3))
(t_6
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ t_5 (* 2.0 d)) 2.0)) (/ h l)))))
(t_7 (sqrt (/ d h))))
(if (<= t_6 -1e+222)
(* (* (- 1.0 (/ (* t_5 (* (* (/ t_5 d) 0.25) h)) (* (+ d d) l))) t_2) t_7)
(if (<= t_6 0.0)
(*
t_0
(-
1.0
(* (* (/ t_3 (+ d d)) t_1) (* (* 0.25 (/ (* t_3 t_1) d)) (/ h l)))))
(if (<= t_6 4e+233)
(*
(* t_2 t_7)
(- 1.0 (* (* t_4 (* (* t_1 t_1) 0.25)) (* t_4 (* 0.5 (/ h l))))))
(*
t_0
(- 1.0 (/ (* (* (/ (* t_5 0.25) d) h) t_5) (* l (+ d d))))))))))double code(double d, double h, double l, double M, double D) {
double t_0 = fabs((d / sqrt((l * h))));
double t_1 = fmin(fabs(M), D);
double t_2 = sqrt((d / l));
double t_3 = fmax(fabs(M), D);
double t_4 = t_3 / d;
double t_5 = t_1 * t_3;
double t_6 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow((t_5 / (2.0 * d)), 2.0)) * (h / l)));
double t_7 = sqrt((d / h));
double tmp;
if (t_6 <= -1e+222) {
tmp = ((1.0 - ((t_5 * (((t_5 / d) * 0.25) * h)) / ((d + d) * l))) * t_2) * t_7;
} else if (t_6 <= 0.0) {
tmp = t_0 * (1.0 - (((t_3 / (d + d)) * t_1) * ((0.25 * ((t_3 * t_1) / d)) * (h / l))));
} else if (t_6 <= 4e+233) {
tmp = (t_2 * t_7) * (1.0 - ((t_4 * ((t_1 * t_1) * 0.25)) * (t_4 * (0.5 * (h / l)))));
} else {
tmp = t_0 * (1.0 - (((((t_5 * 0.25) / d) * h) * t_5) / (l * (d + d))));
}
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) :: t_5
real(8) :: t_6
real(8) :: t_7
real(8) :: tmp
t_0 = abs((d / sqrt((l * h))))
t_1 = fmin(abs(m), d_1)
t_2 = sqrt((d / l))
t_3 = fmax(abs(m), d_1)
t_4 = t_3 / d
t_5 = t_1 * t_3
t_6 = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * ((t_5 / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
t_7 = sqrt((d / h))
if (t_6 <= (-1d+222)) then
tmp = ((1.0d0 - ((t_5 * (((t_5 / d) * 0.25d0) * h)) / ((d + d) * l))) * t_2) * t_7
else if (t_6 <= 0.0d0) then
tmp = t_0 * (1.0d0 - (((t_3 / (d + d)) * t_1) * ((0.25d0 * ((t_3 * t_1) / d)) * (h / l))))
else if (t_6 <= 4d+233) then
tmp = (t_2 * t_7) * (1.0d0 - ((t_4 * ((t_1 * t_1) * 0.25d0)) * (t_4 * (0.5d0 * (h / l)))))
else
tmp = t_0 * (1.0d0 - (((((t_5 * 0.25d0) / d) * h) * t_5) / (l * (d + d))))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.abs((d / Math.sqrt((l * h))));
double t_1 = fmin(Math.abs(M), D);
double t_2 = Math.sqrt((d / l));
double t_3 = fmax(Math.abs(M), D);
double t_4 = t_3 / d;
double t_5 = t_1 * t_3;
double t_6 = (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_5 / (2.0 * d)), 2.0)) * (h / l)));
double t_7 = Math.sqrt((d / h));
double tmp;
if (t_6 <= -1e+222) {
tmp = ((1.0 - ((t_5 * (((t_5 / d) * 0.25) * h)) / ((d + d) * l))) * t_2) * t_7;
} else if (t_6 <= 0.0) {
tmp = t_0 * (1.0 - (((t_3 / (d + d)) * t_1) * ((0.25 * ((t_3 * t_1) / d)) * (h / l))));
} else if (t_6 <= 4e+233) {
tmp = (t_2 * t_7) * (1.0 - ((t_4 * ((t_1 * t_1) * 0.25)) * (t_4 * (0.5 * (h / l)))));
} else {
tmp = t_0 * (1.0 - (((((t_5 * 0.25) / d) * h) * t_5) / (l * (d + d))));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.fabs((d / math.sqrt((l * h)))) t_1 = fmin(math.fabs(M), D) t_2 = math.sqrt((d / l)) t_3 = fmax(math.fabs(M), D) t_4 = t_3 / d t_5 = t_1 * t_3 t_6 = (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_5 / (2.0 * d)), 2.0)) * (h / l))) t_7 = math.sqrt((d / h)) tmp = 0 if t_6 <= -1e+222: tmp = ((1.0 - ((t_5 * (((t_5 / d) * 0.25) * h)) / ((d + d) * l))) * t_2) * t_7 elif t_6 <= 0.0: tmp = t_0 * (1.0 - (((t_3 / (d + d)) * t_1) * ((0.25 * ((t_3 * t_1) / d)) * (h / l)))) elif t_6 <= 4e+233: tmp = (t_2 * t_7) * (1.0 - ((t_4 * ((t_1 * t_1) * 0.25)) * (t_4 * (0.5 * (h / l))))) else: tmp = t_0 * (1.0 - (((((t_5 * 0.25) / d) * h) * t_5) / (l * (d + d)))) return tmp
function code(d, h, l, M, D) t_0 = abs(Float64(d / sqrt(Float64(l * h)))) t_1 = fmin(abs(M), D) t_2 = sqrt(Float64(d / l)) t_3 = fmax(abs(M), D) t_4 = Float64(t_3 / d) t_5 = Float64(t_1 * t_3) t_6 = 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_5 / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_7 = sqrt(Float64(d / h)) tmp = 0.0 if (t_6 <= -1e+222) tmp = Float64(Float64(Float64(1.0 - Float64(Float64(t_5 * Float64(Float64(Float64(t_5 / d) * 0.25) * h)) / Float64(Float64(d + d) * l))) * t_2) * t_7); elseif (t_6 <= 0.0) tmp = Float64(t_0 * Float64(1.0 - Float64(Float64(Float64(t_3 / Float64(d + d)) * t_1) * Float64(Float64(0.25 * Float64(Float64(t_3 * t_1) / d)) * Float64(h / l))))); elseif (t_6 <= 4e+233) tmp = Float64(Float64(t_2 * t_7) * Float64(1.0 - Float64(Float64(t_4 * Float64(Float64(t_1 * t_1) * 0.25)) * Float64(t_4 * Float64(0.5 * Float64(h / l)))))); else tmp = Float64(t_0 * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(t_5 * 0.25) / d) * h) * t_5) / Float64(l * Float64(d + d))))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = abs((d / sqrt((l * h)))); t_1 = min(abs(M), D); t_2 = sqrt((d / l)); t_3 = max(abs(M), D); t_4 = t_3 / d; t_5 = t_1 * t_3; t_6 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * ((t_5 / (2.0 * d)) ^ 2.0)) * (h / l))); t_7 = sqrt((d / h)); tmp = 0.0; if (t_6 <= -1e+222) tmp = ((1.0 - ((t_5 * (((t_5 / d) * 0.25) * h)) / ((d + d) * l))) * t_2) * t_7; elseif (t_6 <= 0.0) tmp = t_0 * (1.0 - (((t_3 / (d + d)) * t_1) * ((0.25 * ((t_3 * t_1) / d)) * (h / l)))); elseif (t_6 <= 4e+233) tmp = (t_2 * t_7) * (1.0 - ((t_4 * ((t_1 * t_1) * 0.25)) * (t_4 * (0.5 * (h / l))))); else tmp = t_0 * (1.0 - (((((t_5 * 0.25) / d) * h) * t_5) / (l * (d + d)))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Min[N[Abs[M], $MachinePrecision], D], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Max[N[Abs[M], $MachinePrecision], D], $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 / d), $MachinePrecision]}, Block[{t$95$5 = N[(t$95$1 * t$95$3), $MachinePrecision]}, Block[{t$95$6 = 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$5 / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$7 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$6, -1e+222], N[(N[(N[(1.0 - N[(N[(t$95$5 * N[(N[(N[(t$95$5 / d), $MachinePrecision] * 0.25), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] / N[(N[(d + d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision] * t$95$7), $MachinePrecision], If[LessEqual[t$95$6, 0.0], N[(t$95$0 * N[(1.0 - N[(N[(N[(t$95$3 / N[(d + d), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * N[(N[(0.25 * N[(N[(t$95$3 * t$95$1), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$6, 4e+233], N[(N[(t$95$2 * t$95$7), $MachinePrecision] * N[(1.0 - N[(N[(t$95$4 * N[(N[(t$95$1 * t$95$1), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] * N[(t$95$4 * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(1.0 - N[(N[(N[(N[(N[(t$95$5 * 0.25), $MachinePrecision] / d), $MachinePrecision] * h), $MachinePrecision] * t$95$5), $MachinePrecision] / N[(l * N[(d + d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]
\begin{array}{l}
t_0 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
t_1 := \mathsf{min}\left(\left|M\right|, D\right)\\
t_2 := \sqrt{\frac{d}{\ell}}\\
t_3 := \mathsf{max}\left(\left|M\right|, D\right)\\
t_4 := \frac{t\_3}{d}\\
t_5 := t\_1 \cdot t\_3\\
t_6 := \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\_5}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_7 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;t\_6 \leq -1 \cdot 10^{+222}:\\
\;\;\;\;\left(\left(1 - \frac{t\_5 \cdot \left(\left(\frac{t\_5}{d} \cdot 0.25\right) \cdot h\right)}{\left(d + d\right) \cdot \ell}\right) \cdot t\_2\right) \cdot t\_7\\
\mathbf{elif}\;t\_6 \leq 0:\\
\;\;\;\;t\_0 \cdot \left(1 - \left(\frac{t\_3}{d + d} \cdot t\_1\right) \cdot \left(\left(0.25 \cdot \frac{t\_3 \cdot t\_1}{d}\right) \cdot \frac{h}{\ell}\right)\right)\\
\mathbf{elif}\;t\_6 \leq 4 \cdot 10^{+233}:\\
\;\;\;\;\left(t\_2 \cdot t\_7\right) \cdot \left(1 - \left(t\_4 \cdot \left(\left(t\_1 \cdot t\_1\right) \cdot 0.25\right)\right) \cdot \left(t\_4 \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(1 - \frac{\left(\frac{t\_5 \cdot 0.25}{d} \cdot h\right) \cdot t\_5}{\ell \cdot \left(d + d\right)}\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)))) < -1e222Initial program 67.1%
lift-*.f64N/A
lift-*.f64N/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 rewrites68.0%
Applied rewrites66.5%
if -1e222 < (*.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 67.1%
lift-*.f64N/A
lift-*.f64N/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 rewrites68.0%
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
lift-*.f64N/A
pow1/2N/A
sqrt-undivN/A
lift-*.f64N/A
rem-sqrt-squareN/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
div-fabsN/A
lower-fabs.f64N/A
lower-/.f6471.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.3%
Applied rewrites71.3%
Taylor expanded in d around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6470.7%
Applied rewrites70.7%
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)))) < 3.99999999999999989e233Initial program 67.1%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites60.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6460.1%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6460.1%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6460.1%
Applied rewrites60.1%
if 3.99999999999999989e233 < (*.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 67.1%
lift-*.f64N/A
lift-*.f64N/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 rewrites68.0%
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
lift-*.f64N/A
pow1/2N/A
sqrt-undivN/A
lift-*.f64N/A
rem-sqrt-squareN/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
div-fabsN/A
lower-fabs.f64N/A
lower-/.f6471.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.3%
Applied rewrites71.3%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-/l*N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites74.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6475.6%
Applied rewrites75.6%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (fabs (/ d (sqrt (* l h)))))
(t_1 (fmin (fabs M) (fabs D)))
(t_2 (fmax (fabs M) (fabs D)))
(t_3 (* t_1 t_2))
(t_4
(*
(*
(- 1.0 (/ (* t_3 (* (* (/ t_3 d) 0.25) h)) (* (+ d d) l)))
(sqrt (/ d l)))
(sqrt (/ d h))))
(t_5
(*
(* (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_5 -1e+222)
t_4
(if (<= t_5 0.0)
(*
t_0
(-
1.0
(* (* (/ t_2 (+ d d)) t_1) (* (* 0.25 (/ (* t_2 t_1) d)) (/ h l)))))
(if (<= t_5 4e+233)
t_4
(*
t_0
(- 1.0 (/ (* (* (/ (* t_3 0.25) d) h) t_3) (* l (+ d d))))))))))double code(double d, double h, double l, double M, double D) {
double t_0 = fabs((d / sqrt((l * h))));
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 = ((1.0 - ((t_3 * (((t_3 / d) * 0.25) * h)) / ((d + d) * l))) * sqrt((d / l))) * sqrt((d / h));
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_3 / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_5 <= -1e+222) {
tmp = t_4;
} else if (t_5 <= 0.0) {
tmp = t_0 * (1.0 - (((t_2 / (d + d)) * t_1) * ((0.25 * ((t_2 * t_1) / d)) * (h / l))));
} else if (t_5 <= 4e+233) {
tmp = t_4;
} else {
tmp = t_0 * (1.0 - (((((t_3 * 0.25) / d) * h) * t_3) / (l * (d + d))));
}
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) :: t_5
real(8) :: tmp
t_0 = abs((d / sqrt((l * h))))
t_1 = fmin(abs(m), abs(d_1))
t_2 = fmax(abs(m), abs(d_1))
t_3 = t_1 * t_2
t_4 = ((1.0d0 - ((t_3 * (((t_3 / d) * 0.25d0) * h)) / ((d + d) * l))) * sqrt((d / l))) * sqrt((d / h))
t_5 = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * ((t_3 / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
if (t_5 <= (-1d+222)) then
tmp = t_4
else if (t_5 <= 0.0d0) then
tmp = t_0 * (1.0d0 - (((t_2 / (d + d)) * t_1) * ((0.25d0 * ((t_2 * t_1) / d)) * (h / l))))
else if (t_5 <= 4d+233) then
tmp = t_4
else
tmp = t_0 * (1.0d0 - (((((t_3 * 0.25d0) / d) * h) * t_3) / (l * (d + d))))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.abs((d / Math.sqrt((l * h))));
double t_1 = fmin(Math.abs(M), Math.abs(D));
double t_2 = fmax(Math.abs(M), Math.abs(D));
double t_3 = t_1 * t_2;
double t_4 = ((1.0 - ((t_3 * (((t_3 / d) * 0.25) * h)) / ((d + d) * l))) * Math.sqrt((d / l))) * Math.sqrt((d / h));
double t_5 = (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_3 / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_5 <= -1e+222) {
tmp = t_4;
} else if (t_5 <= 0.0) {
tmp = t_0 * (1.0 - (((t_2 / (d + d)) * t_1) * ((0.25 * ((t_2 * t_1) / d)) * (h / l))));
} else if (t_5 <= 4e+233) {
tmp = t_4;
} else {
tmp = t_0 * (1.0 - (((((t_3 * 0.25) / d) * h) * t_3) / (l * (d + d))));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.fabs((d / math.sqrt((l * h)))) t_1 = fmin(math.fabs(M), math.fabs(D)) t_2 = fmax(math.fabs(M), math.fabs(D)) t_3 = t_1 * t_2 t_4 = ((1.0 - ((t_3 * (((t_3 / d) * 0.25) * h)) / ((d + d) * l))) * math.sqrt((d / l))) * math.sqrt((d / h)) t_5 = (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_3 / (2.0 * d)), 2.0)) * (h / l))) tmp = 0 if t_5 <= -1e+222: tmp = t_4 elif t_5 <= 0.0: tmp = t_0 * (1.0 - (((t_2 / (d + d)) * t_1) * ((0.25 * ((t_2 * t_1) / d)) * (h / l)))) elif t_5 <= 4e+233: tmp = t_4 else: tmp = t_0 * (1.0 - (((((t_3 * 0.25) / d) * h) * t_3) / (l * (d + d)))) return tmp
function code(d, h, l, M, D) t_0 = abs(Float64(d / sqrt(Float64(l * h)))) 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(1.0 - Float64(Float64(t_3 * Float64(Float64(Float64(t_3 / d) * 0.25) * h)) / Float64(Float64(d + d) * l))) * sqrt(Float64(d / l))) * sqrt(Float64(d / h))) 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_3 / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_5 <= -1e+222) tmp = t_4; elseif (t_5 <= 0.0) tmp = Float64(t_0 * Float64(1.0 - Float64(Float64(Float64(t_2 / Float64(d + d)) * t_1) * Float64(Float64(0.25 * Float64(Float64(t_2 * t_1) / d)) * Float64(h / l))))); elseif (t_5 <= 4e+233) tmp = t_4; else tmp = Float64(t_0 * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(t_3 * 0.25) / d) * h) * t_3) / Float64(l * Float64(d + d))))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = abs((d / sqrt((l * h)))); t_1 = min(abs(M), abs(D)); t_2 = max(abs(M), abs(D)); t_3 = t_1 * t_2; t_4 = ((1.0 - ((t_3 * (((t_3 / d) * 0.25) * h)) / ((d + d) * l))) * sqrt((d / l))) * sqrt((d / h)); t_5 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * ((t_3 / (2.0 * d)) ^ 2.0)) * (h / l))); tmp = 0.0; if (t_5 <= -1e+222) tmp = t_4; elseif (t_5 <= 0.0) tmp = t_0 * (1.0 - (((t_2 / (d + d)) * t_1) * ((0.25 * ((t_2 * t_1) / d)) * (h / l)))); elseif (t_5 <= 4e+233) tmp = t_4; else tmp = t_0 * (1.0 - (((((t_3 * 0.25) / d) * h) * t_3) / (l * (d + d)))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $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[(1.0 - N[(N[(t$95$3 * N[(N[(N[(t$95$3 / d), $MachinePrecision] * 0.25), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] / N[(N[(d + d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $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$3 / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$5, -1e+222], t$95$4, If[LessEqual[t$95$5, 0.0], N[(t$95$0 * N[(1.0 - N[(N[(N[(t$95$2 / N[(d + d), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * N[(N[(0.25 * N[(N[(t$95$2 * t$95$1), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 4e+233], t$95$4, N[(t$95$0 * N[(1.0 - N[(N[(N[(N[(N[(t$95$3 * 0.25), $MachinePrecision] / d), $MachinePrecision] * h), $MachinePrecision] * t$95$3), $MachinePrecision] / N[(l * N[(d + d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
t_0 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
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(1 - \frac{t\_3 \cdot \left(\left(\frac{t\_3}{d} \cdot 0.25\right) \cdot h\right)}{\left(d + d\right) \cdot \ell}\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}}\\
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\_3}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_5 \leq -1 \cdot 10^{+222}:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_5 \leq 0:\\
\;\;\;\;t\_0 \cdot \left(1 - \left(\frac{t\_2}{d + d} \cdot t\_1\right) \cdot \left(\left(0.25 \cdot \frac{t\_2 \cdot t\_1}{d}\right) \cdot \frac{h}{\ell}\right)\right)\\
\mathbf{elif}\;t\_5 \leq 4 \cdot 10^{+233}:\\
\;\;\;\;t\_4\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(1 - \frac{\left(\frac{t\_3 \cdot 0.25}{d} \cdot h\right) \cdot t\_3}{\ell \cdot \left(d + d\right)}\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)))) < -1e222 or -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)))) < 3.99999999999999989e233Initial program 67.1%
lift-*.f64N/A
lift-*.f64N/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 rewrites68.0%
Applied rewrites66.5%
if -1e222 < (*.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 67.1%
lift-*.f64N/A
lift-*.f64N/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 rewrites68.0%
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
lift-*.f64N/A
pow1/2N/A
sqrt-undivN/A
lift-*.f64N/A
rem-sqrt-squareN/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
div-fabsN/A
lower-fabs.f64N/A
lower-/.f6471.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.3%
Applied rewrites71.3%
Taylor expanded in d around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6470.7%
Applied rewrites70.7%
if 3.99999999999999989e233 < (*.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 67.1%
lift-*.f64N/A
lift-*.f64N/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 rewrites68.0%
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
lift-*.f64N/A
pow1/2N/A
sqrt-undivN/A
lift-*.f64N/A
rem-sqrt-squareN/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
div-fabsN/A
lower-fabs.f64N/A
lower-/.f6471.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.3%
Applied rewrites71.3%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-/l*N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites74.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6475.6%
Applied rewrites75.6%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (/ 0.5 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 (fabs (/ d (sqrt (* l h))))))
(if (<= t_1 0.0)
(* t_2 (- 1.0 (* (* t_0 M) (* (* t_0 (* M 0.5)) (/ h l)))))
(if (<= t_1 5e+144)
(/ (* h (* (sqrt (/ d h)) (sqrt (/ d l)))) h)
(*
t_2
(- 1.0 (/ (* (* (/ (* (* M D) 0.25) d) h) (* M D)) (* l (+ d d)))))))))double code(double d, double h, double l, double M, double D) {
double t_0 = (0.5 / 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 = fabs((d / sqrt((l * h))));
double tmp;
if (t_1 <= 0.0) {
tmp = t_2 * (1.0 - ((t_0 * M) * ((t_0 * (M * 0.5)) * (h / l))));
} else if (t_1 <= 5e+144) {
tmp = (h * (sqrt((d / h)) * sqrt((d / l)))) / h;
} else {
tmp = t_2 * (1.0 - ((((((M * D) * 0.25) / d) * h) * (M * D)) / (l * (d + d))));
}
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 = (0.5d0 / d) * d_1
t_1 = (((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_2 = abs((d / sqrt((l * h))))
if (t_1 <= 0.0d0) then
tmp = t_2 * (1.0d0 - ((t_0 * m) * ((t_0 * (m * 0.5d0)) * (h / l))))
else if (t_1 <= 5d+144) then
tmp = (h * (sqrt((d / h)) * sqrt((d / l)))) / h
else
tmp = t_2 * (1.0d0 - ((((((m * d_1) * 0.25d0) / d) * h) * (m * d_1)) / (l * (d + d))))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (0.5 / d) * D;
double t_1 = (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_2 = Math.abs((d / Math.sqrt((l * h))));
double tmp;
if (t_1 <= 0.0) {
tmp = t_2 * (1.0 - ((t_0 * M) * ((t_0 * (M * 0.5)) * (h / l))));
} else if (t_1 <= 5e+144) {
tmp = (h * (Math.sqrt((d / h)) * Math.sqrt((d / l)))) / h;
} else {
tmp = t_2 * (1.0 - ((((((M * D) * 0.25) / d) * h) * (M * D)) / (l * (d + d))));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = (0.5 / d) * D t_1 = (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_2 = math.fabs((d / math.sqrt((l * h)))) tmp = 0 if t_1 <= 0.0: tmp = t_2 * (1.0 - ((t_0 * M) * ((t_0 * (M * 0.5)) * (h / l)))) elif t_1 <= 5e+144: tmp = (h * (math.sqrt((d / h)) * math.sqrt((d / l)))) / h else: tmp = t_2 * (1.0 - ((((((M * D) * 0.25) / d) * h) * (M * D)) / (l * (d + d)))) return tmp
function code(d, h, l, M, D) t_0 = Float64(Float64(0.5 / 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 = abs(Float64(d / sqrt(Float64(l * h)))) tmp = 0.0 if (t_1 <= 0.0) tmp = Float64(t_2 * Float64(1.0 - Float64(Float64(t_0 * M) * Float64(Float64(t_0 * Float64(M * 0.5)) * Float64(h / l))))); elseif (t_1 <= 5e+144) tmp = Float64(Float64(h * Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)))) / h); else tmp = Float64(t_2 * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(M * D) * 0.25) / d) * h) * Float64(M * D)) / Float64(l * Float64(d + d))))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (0.5 / d) * D; t_1 = (((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_2 = abs((d / sqrt((l * h)))); tmp = 0.0; if (t_1 <= 0.0) tmp = t_2 * (1.0 - ((t_0 * M) * ((t_0 * (M * 0.5)) * (h / l)))); elseif (t_1 <= 5e+144) tmp = (h * (sqrt((d / h)) * sqrt((d / l)))) / h; else tmp = t_2 * (1.0 - ((((((M * D) * 0.25) / d) * h) * (M * D)) / (l * (d + d)))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(0.5 / d), $MachinePrecision] * D), $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[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[(t$95$2 * N[(1.0 - N[(N[(t$95$0 * M), $MachinePrecision] * N[(N[(t$95$0 * N[(M * 0.5), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+144], N[(N[(h * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(t$95$2 * N[(1.0 - N[(N[(N[(N[(N[(N[(M * D), $MachinePrecision] * 0.25), $MachinePrecision] / d), $MachinePrecision] * h), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / N[(l * N[(d + d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := \frac{0.5}{d} \cdot 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 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;t\_2 \cdot \left(1 - \left(t\_0 \cdot M\right) \cdot \left(\left(t\_0 \cdot \left(M \cdot 0.5\right)\right) \cdot \frac{h}{\ell}\right)\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+144}:\\
\;\;\;\;\frac{h \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;t\_2 \cdot \left(1 - \frac{\left(\frac{\left(M \cdot D\right) \cdot 0.25}{d} \cdot h\right) \cdot \left(M \cdot D\right)}{\ell \cdot \left(d + d\right)}\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)))) < -0.0Initial program 67.1%
lift-*.f64N/A
lift-*.f64N/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 rewrites68.0%
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
lift-*.f64N/A
pow1/2N/A
sqrt-undivN/A
lift-*.f64N/A
rem-sqrt-squareN/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
div-fabsN/A
lower-fabs.f64N/A
lower-/.f6471.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.3%
Applied rewrites71.3%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
count-2-revN/A
associate-/r*N/A
metadata-evalN/A
lower-/.f6471.3%
Applied rewrites71.3%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
count-2-revN/A
associate-/r*N/A
metadata-evalN/A
lower-/.f6471.4%
Applied rewrites71.4%
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)))) < 4.9999999999999999e144Initial program 67.1%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6424.0%
Applied rewrites24.0%
Taylor expanded in h around inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6438.2%
Applied rewrites38.2%
if 4.9999999999999999e144 < (*.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 67.1%
lift-*.f64N/A
lift-*.f64N/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 rewrites68.0%
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
lift-*.f64N/A
pow1/2N/A
sqrt-undivN/A
lift-*.f64N/A
rem-sqrt-squareN/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
div-fabsN/A
lower-fabs.f64N/A
lower-/.f6471.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.3%
Applied rewrites71.3%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-/l*N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites74.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6475.6%
Applied rewrites75.6%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (/ D d) M))
(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 (fabs (/ d (sqrt (* l h))))))
(if (<= t_1 0.0)
(* t_2 (fma (* (/ h l) (* t_0 0.25)) (* t_0 -0.5) 1.0))
(if (<= t_1 5e+144)
(/ (* h (* (sqrt (/ d h)) (sqrt (/ d l)))) h)
(*
t_2
(- 1.0 (/ (* (* (/ (* (* M D) 0.25) d) h) (* M D)) (* l (+ d d)))))))))double code(double d, double h, double l, double M, double D) {
double t_0 = (D / d) * M;
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 = fabs((d / sqrt((l * h))));
double tmp;
if (t_1 <= 0.0) {
tmp = t_2 * fma(((h / l) * (t_0 * 0.25)), (t_0 * -0.5), 1.0);
} else if (t_1 <= 5e+144) {
tmp = (h * (sqrt((d / h)) * sqrt((d / l)))) / h;
} else {
tmp = t_2 * (1.0 - ((((((M * D) * 0.25) / d) * h) * (M * D)) / (l * (d + d))));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(Float64(D / d) * M) 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 = abs(Float64(d / sqrt(Float64(l * h)))) tmp = 0.0 if (t_1 <= 0.0) tmp = Float64(t_2 * fma(Float64(Float64(h / l) * Float64(t_0 * 0.25)), Float64(t_0 * -0.5), 1.0)); elseif (t_1 <= 5e+144) tmp = Float64(Float64(h * Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)))) / h); else tmp = Float64(t_2 * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(M * D) * 0.25) / d) * h) * Float64(M * D)) / Float64(l * Float64(d + d))))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(D / d), $MachinePrecision] * M), $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[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[(t$95$2 * N[(N[(N[(h / l), $MachinePrecision] * N[(t$95$0 * 0.25), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * -0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+144], N[(N[(h * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(t$95$2 * N[(1.0 - N[(N[(N[(N[(N[(N[(M * D), $MachinePrecision] * 0.25), $MachinePrecision] / d), $MachinePrecision] * h), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / N[(l * N[(d + d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := \frac{D}{d} \cdot M\\
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 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;t\_2 \cdot \mathsf{fma}\left(\frac{h}{\ell} \cdot \left(t\_0 \cdot 0.25\right), t\_0 \cdot -0.5, 1\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+144}:\\
\;\;\;\;\frac{h \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;t\_2 \cdot \left(1 - \frac{\left(\frac{\left(M \cdot D\right) \cdot 0.25}{d} \cdot h\right) \cdot \left(M \cdot D\right)}{\ell \cdot \left(d + d\right)}\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)))) < -0.0Initial program 67.1%
lift-*.f64N/A
lift-*.f64N/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 rewrites68.0%
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
lift-*.f64N/A
pow1/2N/A
sqrt-undivN/A
lift-*.f64N/A
rem-sqrt-squareN/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
div-fabsN/A
lower-fabs.f64N/A
lower-/.f6471.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.3%
Applied rewrites71.3%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites71.4%
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)))) < 4.9999999999999999e144Initial program 67.1%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6424.0%
Applied rewrites24.0%
Taylor expanded in h around inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6438.2%
Applied rewrites38.2%
if 4.9999999999999999e144 < (*.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 67.1%
lift-*.f64N/A
lift-*.f64N/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 rewrites68.0%
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
lift-*.f64N/A
pow1/2N/A
sqrt-undivN/A
lift-*.f64N/A
rem-sqrt-squareN/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
div-fabsN/A
lower-fabs.f64N/A
lower-/.f6471.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.3%
Applied rewrites71.3%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-/l*N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites74.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6475.6%
Applied rewrites75.6%
(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
(*
(fabs (/ d (sqrt (* l h))))
(- 1.0 (/ (* (* (/ (* (* M D) 0.25) d) h) (* M D)) (* l (+ d d)))))))
(if (<= t_0 0.0)
t_1
(if (<= t_0 5e+144) (/ (* h (* (sqrt (/ d h)) (sqrt (/ d l)))) h) 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 = fabs((d / sqrt((l * h)))) * (1.0 - ((((((M * D) * 0.25) / d) * h) * (M * D)) / (l * (d + d))));
double tmp;
if (t_0 <= 0.0) {
tmp = t_1;
} else if (t_0 <= 5e+144) {
tmp = (h * (sqrt((d / h)) * sqrt((d / l)))) / h;
} 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 = abs((d / sqrt((l * h)))) * (1.0d0 - ((((((m * d_1) * 0.25d0) / d) * h) * (m * d_1)) / (l * (d + d))))
if (t_0 <= 0.0d0) then
tmp = t_1
else if (t_0 <= 5d+144) then
tmp = (h * (sqrt((d / h)) * sqrt((d / l)))) / h
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.abs((d / Math.sqrt((l * h)))) * (1.0 - ((((((M * D) * 0.25) / d) * h) * (M * D)) / (l * (d + d))));
double tmp;
if (t_0 <= 0.0) {
tmp = t_1;
} else if (t_0 <= 5e+144) {
tmp = (h * (Math.sqrt((d / h)) * Math.sqrt((d / l)))) / h;
} 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.fabs((d / math.sqrt((l * h)))) * (1.0 - ((((((M * D) * 0.25) / d) * h) * (M * D)) / (l * (d + d)))) tmp = 0 if t_0 <= 0.0: tmp = t_1 elif t_0 <= 5e+144: tmp = (h * (math.sqrt((d / h)) * math.sqrt((d / l)))) / h 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(abs(Float64(d / sqrt(Float64(l * h)))) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(M * D) * 0.25) / d) * h) * Float64(M * D)) / Float64(l * Float64(d + d))))) tmp = 0.0 if (t_0 <= 0.0) tmp = t_1; elseif (t_0 <= 5e+144) tmp = Float64(Float64(h * Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)))) / h); 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 = abs((d / sqrt((l * h)))) * (1.0 - ((((((M * D) * 0.25) / d) * h) * (M * D)) / (l * (d + d)))); tmp = 0.0; if (t_0 <= 0.0) tmp = t_1; elseif (t_0 <= 5e+144) tmp = (h * (sqrt((d / h)) * sqrt((d / l)))) / h; 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[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(N[(N[(M * D), $MachinePrecision] * 0.25), $MachinePrecision] / d), $MachinePrecision] * h), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / N[(l * N[(d + d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], t$95$1, If[LessEqual[t$95$0, 5e+144], N[(N[(h * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $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 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \cdot \left(1 - \frac{\left(\frac{\left(M \cdot D\right) \cdot 0.25}{d} \cdot h\right) \cdot \left(M \cdot D\right)}{\ell \cdot \left(d + d\right)}\right)\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+144}:\\
\;\;\;\;\frac{h \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)}{h}\\
\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)))) < -0.0 or 4.9999999999999999e144 < (*.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 67.1%
lift-*.f64N/A
lift-*.f64N/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 rewrites68.0%
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
lift-*.f64N/A
pow1/2N/A
sqrt-undivN/A
lift-*.f64N/A
rem-sqrt-squareN/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
div-fabsN/A
lower-fabs.f64N/A
lower-/.f6471.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.3%
Applied rewrites71.3%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-/l*N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites74.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6475.6%
Applied rewrites75.6%
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)))) < 4.9999999999999999e144Initial program 67.1%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6424.0%
Applied rewrites24.0%
Taylor expanded in h around inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6438.2%
Applied rewrites38.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 (* l (+ d d)))
(t_2 (fabs (/ d (sqrt (* l h))))))
(if (<= t_0 0.0)
(* t_2 (- 1.0 (/ (* (* (* (* (/ D d) M) 0.25) h) (* M D)) t_1)))
(if (<= t_0 4e+233)
(/ (* h (* (sqrt (/ d h)) (sqrt (/ d l)))) h)
(* t_2 (- 1.0 (/ (* (* 0.25 (/ (* D (* M h)) d)) (* M D)) 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 = l * (d + d);
double t_2 = fabs((d / sqrt((l * h))));
double tmp;
if (t_0 <= 0.0) {
tmp = t_2 * (1.0 - ((((((D / d) * M) * 0.25) * h) * (M * D)) / t_1));
} else if (t_0 <= 4e+233) {
tmp = (h * (sqrt((d / h)) * sqrt((d / l)))) / h;
} else {
tmp = t_2 * (1.0 - (((0.25 * ((D * (M * h)) / d)) * (M * D)) / 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) :: t_2
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 = l * (d + d)
t_2 = abs((d / sqrt((l * h))))
if (t_0 <= 0.0d0) then
tmp = t_2 * (1.0d0 - ((((((d_1 / d) * m) * 0.25d0) * h) * (m * d_1)) / t_1))
else if (t_0 <= 4d+233) then
tmp = (h * (sqrt((d / h)) * sqrt((d / l)))) / h
else
tmp = t_2 * (1.0d0 - (((0.25d0 * ((d_1 * (m * h)) / d)) * (m * d_1)) / 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 = l * (d + d);
double t_2 = Math.abs((d / Math.sqrt((l * h))));
double tmp;
if (t_0 <= 0.0) {
tmp = t_2 * (1.0 - ((((((D / d) * M) * 0.25) * h) * (M * D)) / t_1));
} else if (t_0 <= 4e+233) {
tmp = (h * (Math.sqrt((d / h)) * Math.sqrt((d / l)))) / h;
} else {
tmp = t_2 * (1.0 - (((0.25 * ((D * (M * h)) / d)) * (M * D)) / 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 = l * (d + d) t_2 = math.fabs((d / math.sqrt((l * h)))) tmp = 0 if t_0 <= 0.0: tmp = t_2 * (1.0 - ((((((D / d) * M) * 0.25) * h) * (M * D)) / t_1)) elif t_0 <= 4e+233: tmp = (h * (math.sqrt((d / h)) * math.sqrt((d / l)))) / h else: tmp = t_2 * (1.0 - (((0.25 * ((D * (M * h)) / d)) * (M * D)) / 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(l * Float64(d + d)) t_2 = abs(Float64(d / sqrt(Float64(l * h)))) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(t_2 * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(D / d) * M) * 0.25) * h) * Float64(M * D)) / t_1))); elseif (t_0 <= 4e+233) tmp = Float64(Float64(h * Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)))) / h); else tmp = Float64(t_2 * Float64(1.0 - Float64(Float64(Float64(0.25 * Float64(Float64(D * Float64(M * h)) / d)) * Float64(M * D)) / 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 = l * (d + d); t_2 = abs((d / sqrt((l * h)))); tmp = 0.0; if (t_0 <= 0.0) tmp = t_2 * (1.0 - ((((((D / d) * M) * 0.25) * h) * (M * D)) / t_1)); elseif (t_0 <= 4e+233) tmp = (h * (sqrt((d / h)) * sqrt((d / l)))) / h; else tmp = t_2 * (1.0 - (((0.25 * ((D * (M * h)) / d)) * (M * D)) / 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[(l * N[(d + d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(t$95$2 * N[(1.0 - N[(N[(N[(N[(N[(N[(D / d), $MachinePrecision] * M), $MachinePrecision] * 0.25), $MachinePrecision] * h), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 4e+233], N[(N[(h * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(t$95$2 * N[(1.0 - N[(N[(N[(0.25 * N[(N[(D * N[(M * h), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $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 := \ell \cdot \left(d + d\right)\\
t_2 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;t\_2 \cdot \left(1 - \frac{\left(\left(\left(\frac{D}{d} \cdot M\right) \cdot 0.25\right) \cdot h\right) \cdot \left(M \cdot D\right)}{t\_1}\right)\\
\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+233}:\\
\;\;\;\;\frac{h \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;t\_2 \cdot \left(1 - \frac{\left(0.25 \cdot \frac{D \cdot \left(M \cdot h\right)}{d}\right) \cdot \left(M \cdot D\right)}{t\_1}\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)))) < -0.0Initial program 67.1%
lift-*.f64N/A
lift-*.f64N/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 rewrites68.0%
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
lift-*.f64N/A
pow1/2N/A
sqrt-undivN/A
lift-*.f64N/A
rem-sqrt-squareN/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
div-fabsN/A
lower-fabs.f64N/A
lower-/.f6471.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.3%
Applied rewrites71.3%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-/l*N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites74.2%
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)))) < 3.99999999999999989e233Initial program 67.1%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6424.0%
Applied rewrites24.0%
Taylor expanded in h around inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6438.2%
Applied rewrites38.2%
if 3.99999999999999989e233 < (*.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 67.1%
lift-*.f64N/A
lift-*.f64N/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 rewrites68.0%
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
lift-*.f64N/A
pow1/2N/A
sqrt-undivN/A
lift-*.f64N/A
rem-sqrt-squareN/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
div-fabsN/A
lower-fabs.f64N/A
lower-/.f6471.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.3%
Applied rewrites71.3%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-/l*N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites74.2%
Taylor expanded in d around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6473.4%
Applied rewrites73.4%
(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 (* D (* M h)))
(t_2 (fabs (/ d (sqrt (* l h))))))
(if (<= t_0 0.0)
(* t_2 (- 1.0 (* (* (/ D (+ d d)) M) (* 0.25 (/ t_1 (* d l))))))
(if (<= t_0 4e+233)
(/ (* h (* (sqrt (/ d h)) (sqrt (/ d l)))) h)
(* t_2 (- 1.0 (/ (* (* 0.25 (/ t_1 d)) (* M D)) (* l (+ d d)))))))))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 = D * (M * h);
double t_2 = fabs((d / sqrt((l * h))));
double tmp;
if (t_0 <= 0.0) {
tmp = t_2 * (1.0 - (((D / (d + d)) * M) * (0.25 * (t_1 / (d * l)))));
} else if (t_0 <= 4e+233) {
tmp = (h * (sqrt((d / h)) * sqrt((d / l)))) / h;
} else {
tmp = t_2 * (1.0 - (((0.25 * (t_1 / d)) * (M * D)) / (l * (d + d))));
}
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 = (((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 = d_1 * (m * h)
t_2 = abs((d / sqrt((l * h))))
if (t_0 <= 0.0d0) then
tmp = t_2 * (1.0d0 - (((d_1 / (d + d)) * m) * (0.25d0 * (t_1 / (d * l)))))
else if (t_0 <= 4d+233) then
tmp = (h * (sqrt((d / h)) * sqrt((d / l)))) / h
else
tmp = t_2 * (1.0d0 - (((0.25d0 * (t_1 / d)) * (m * d_1)) / (l * (d + d))))
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 = D * (M * h);
double t_2 = Math.abs((d / Math.sqrt((l * h))));
double tmp;
if (t_0 <= 0.0) {
tmp = t_2 * (1.0 - (((D / (d + d)) * M) * (0.25 * (t_1 / (d * l)))));
} else if (t_0 <= 4e+233) {
tmp = (h * (Math.sqrt((d / h)) * Math.sqrt((d / l)))) / h;
} else {
tmp = t_2 * (1.0 - (((0.25 * (t_1 / d)) * (M * D)) / (l * (d + d))));
}
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 = D * (M * h) t_2 = math.fabs((d / math.sqrt((l * h)))) tmp = 0 if t_0 <= 0.0: tmp = t_2 * (1.0 - (((D / (d + d)) * M) * (0.25 * (t_1 / (d * l))))) elif t_0 <= 4e+233: tmp = (h * (math.sqrt((d / h)) * math.sqrt((d / l)))) / h else: tmp = t_2 * (1.0 - (((0.25 * (t_1 / d)) * (M * D)) / (l * (d + d)))) 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(D * Float64(M * h)) t_2 = abs(Float64(d / sqrt(Float64(l * h)))) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(t_2 * Float64(1.0 - Float64(Float64(Float64(D / Float64(d + d)) * M) * Float64(0.25 * Float64(t_1 / Float64(d * l)))))); elseif (t_0 <= 4e+233) tmp = Float64(Float64(h * Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)))) / h); else tmp = Float64(t_2 * Float64(1.0 - Float64(Float64(Float64(0.25 * Float64(t_1 / d)) * Float64(M * D)) / Float64(l * Float64(d + d))))); 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 = D * (M * h); t_2 = abs((d / sqrt((l * h)))); tmp = 0.0; if (t_0 <= 0.0) tmp = t_2 * (1.0 - (((D / (d + d)) * M) * (0.25 * (t_1 / (d * l))))); elseif (t_0 <= 4e+233) tmp = (h * (sqrt((d / h)) * sqrt((d / l)))) / h; else tmp = t_2 * (1.0 - (((0.25 * (t_1 / d)) * (M * D)) / (l * (d + d)))); 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[(D * N[(M * h), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(t$95$2 * N[(1.0 - N[(N[(N[(D / N[(d + d), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision] * N[(0.25 * N[(t$95$1 / N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 4e+233], N[(N[(h * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(t$95$2 * N[(1.0 - N[(N[(N[(0.25 * N[(t$95$1 / d), $MachinePrecision]), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / N[(l * N[(d + d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 := D \cdot \left(M \cdot h\right)\\
t_2 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;t\_2 \cdot \left(1 - \left(\frac{D}{d + d} \cdot M\right) \cdot \left(0.25 \cdot \frac{t\_1}{d \cdot \ell}\right)\right)\\
\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+233}:\\
\;\;\;\;\frac{h \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;t\_2 \cdot \left(1 - \frac{\left(0.25 \cdot \frac{t\_1}{d}\right) \cdot \left(M \cdot D\right)}{\ell \cdot \left(d + d\right)}\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)))) < -0.0Initial program 67.1%
lift-*.f64N/A
lift-*.f64N/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 rewrites68.0%
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
lift-*.f64N/A
pow1/2N/A
sqrt-undivN/A
lift-*.f64N/A
rem-sqrt-squareN/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
div-fabsN/A
lower-fabs.f64N/A
lower-/.f6471.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.3%
Applied rewrites71.3%
Taylor expanded in d around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6473.2%
Applied rewrites73.2%
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)))) < 3.99999999999999989e233Initial program 67.1%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6424.0%
Applied rewrites24.0%
Taylor expanded in h around inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6438.2%
Applied rewrites38.2%
if 3.99999999999999989e233 < (*.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 67.1%
lift-*.f64N/A
lift-*.f64N/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 rewrites68.0%
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
lift-*.f64N/A
pow1/2N/A
sqrt-undivN/A
lift-*.f64N/A
rem-sqrt-squareN/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
div-fabsN/A
lower-fabs.f64N/A
lower-/.f6471.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.3%
Applied rewrites71.3%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-/l*N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites74.2%
Taylor expanded in d around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6473.4%
Applied rewrites73.4%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(fabs (/ d (sqrt (* l h))))
(-
1.0
(*
(* (/ (fmax M D) (+ d d)) (fmin M D))
(* 0.25 (/ (* (fmax M D) (* (fmin M D) h)) (* d l)))))))
(t_1
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(-
1.0
(*
(* (/ 1.0 2.0) (pow (/ (* (fmin M D) (fmax M D)) (* 2.0 d)) 2.0))
(/ h l))))))
(if (<= t_1 0.0)
t_0
(if (<= t_1 4e+233) (/ (* h (* (sqrt (/ d h)) (sqrt (/ d l)))) h) t_0))))double code(double d, double h, double l, double M, double D) {
double t_0 = fabs((d / sqrt((l * h)))) * (1.0 - (((fmax(M, D) / (d + d)) * fmin(M, D)) * (0.25 * ((fmax(M, D) * (fmin(M, D) * h)) / (d * l)))));
double t_1 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((fmin(M, D) * fmax(M, D)) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_1 <= 0.0) {
tmp = t_0;
} else if (t_1 <= 4e+233) {
tmp = (h * (sqrt((d / h)) * sqrt((d / l)))) / h;
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(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 = abs((d / sqrt((l * h)))) * (1.0d0 - (((fmax(m, d_1) / (d + d)) * fmin(m, d_1)) * (0.25d0 * ((fmax(m, d_1) * (fmin(m, d_1) * h)) / (d * l)))))
t_1 = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((fmin(m, d_1) * fmax(m, d_1)) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
if (t_1 <= 0.0d0) then
tmp = t_0
else if (t_1 <= 4d+233) then
tmp = (h * (sqrt((d / h)) * sqrt((d / l)))) / h
else
tmp = t_0
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.abs((d / Math.sqrt((l * h)))) * (1.0 - (((fmax(M, D) / (d + d)) * fmin(M, D)) * (0.25 * ((fmax(M, D) * (fmin(M, D) * h)) / (d * l)))));
double t_1 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((fmin(M, D) * fmax(M, D)) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_1 <= 0.0) {
tmp = t_0;
} else if (t_1 <= 4e+233) {
tmp = (h * (Math.sqrt((d / h)) * Math.sqrt((d / l)))) / h;
} else {
tmp = t_0;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.fabs((d / math.sqrt((l * h)))) * (1.0 - (((fmax(M, D) / (d + d)) * fmin(M, D)) * (0.25 * ((fmax(M, D) * (fmin(M, D) * h)) / (d * l))))) t_1 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((fmin(M, D) * fmax(M, D)) / (2.0 * d)), 2.0)) * (h / l))) tmp = 0 if t_1 <= 0.0: tmp = t_0 elif t_1 <= 4e+233: tmp = (h * (math.sqrt((d / h)) * math.sqrt((d / l)))) / h else: tmp = t_0 return tmp
function code(d, h, l, M, D) t_0 = Float64(abs(Float64(d / sqrt(Float64(l * h)))) * Float64(1.0 - Float64(Float64(Float64(fmax(M, D) / Float64(d + d)) * fmin(M, D)) * Float64(0.25 * Float64(Float64(fmax(M, D) * Float64(fmin(M, D) * h)) / Float64(d * l)))))) 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(fmin(M, D) * fmax(M, D)) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_1 <= 0.0) tmp = t_0; elseif (t_1 <= 4e+233) tmp = Float64(Float64(h * Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)))) / h); else tmp = t_0; end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = abs((d / sqrt((l * h)))) * (1.0 - (((max(M, D) / (d + d)) * min(M, D)) * (0.25 * ((max(M, D) * (min(M, D) * h)) / (d * l))))); t_1 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((min(M, D) * max(M, D)) / (2.0 * d)) ^ 2.0)) * (h / l))); tmp = 0.0; if (t_1 <= 0.0) tmp = t_0; elseif (t_1 <= 4e+233) tmp = (h * (sqrt((d / h)) * sqrt((d / l)))) / h; else tmp = t_0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(N[(N[Max[M, D], $MachinePrecision] / N[(d + d), $MachinePrecision]), $MachinePrecision] * N[Min[M, D], $MachinePrecision]), $MachinePrecision] * N[(0.25 * N[(N[(N[Max[M, D], $MachinePrecision] * N[(N[Min[M, D], $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] / N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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[(N[Min[M, D], $MachinePrecision] * N[Max[M, D], $MachinePrecision]), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], t$95$0, If[LessEqual[t$95$1, 4e+233], N[(N[(h * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
t_0 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \cdot \left(1 - \left(\frac{\mathsf{max}\left(M, D\right)}{d + d} \cdot \mathsf{min}\left(M, D\right)\right) \cdot \left(0.25 \cdot \frac{\mathsf{max}\left(M, D\right) \cdot \left(\mathsf{min}\left(M, D\right) \cdot h\right)}{d \cdot \ell}\right)\right)\\
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{\mathsf{min}\left(M, D\right) \cdot \mathsf{max}\left(M, D\right)}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+233}:\\
\;\;\;\;\frac{h \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\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)))) < -0.0 or 3.99999999999999989e233 < (*.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 67.1%
lift-*.f64N/A
lift-*.f64N/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 rewrites68.0%
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
lift-*.f64N/A
pow1/2N/A
sqrt-undivN/A
lift-*.f64N/A
rem-sqrt-squareN/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
div-fabsN/A
lower-fabs.f64N/A
lower-/.f6471.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.3%
Applied rewrites71.3%
Taylor expanded in d around 0
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6473.2%
Applied rewrites73.2%
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)))) < 3.99999999999999989e233Initial program 67.1%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6424.0%
Applied rewrites24.0%
Taylor expanded in h around inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6438.2%
Applied rewrites38.2%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (fmin (fabs M) (fabs D)))
(t_1 (fmax (fabs M) (fabs D)))
(t_2
(*
(fma
(* (* (* (/ t_1 d) t_0) t_0) -0.25)
(/ (* (* 0.5 h) t_1) (* l d))
1.0)
(/ (fabs d) (sqrt (* l h)))))
(t_3
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(-
1.0
(* (* (/ 1.0 2.0) (pow (/ (* t_0 t_1) (* 2.0 d)) 2.0)) (/ h l))))))
(if (<= t_3 0.0)
t_2
(if (<= t_3 4e+233) (/ (* h (* (sqrt (/ d h)) (sqrt (/ d l)))) h) t_2))))double code(double d, double h, double l, double M, double D) {
double t_0 = fmin(fabs(M), fabs(D));
double t_1 = fmax(fabs(M), fabs(D));
double t_2 = fma(((((t_1 / d) * t_0) * t_0) * -0.25), (((0.5 * h) * t_1) / (l * d)), 1.0) * (fabs(d) / sqrt((l * h)));
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_0 * t_1) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_3 <= 0.0) {
tmp = t_2;
} else if (t_3 <= 4e+233) {
tmp = (h * (sqrt((d / h)) * sqrt((d / l)))) / h;
} else {
tmp = t_2;
}
return tmp;
}
function code(d, h, l, M, D) t_0 = fmin(abs(M), abs(D)) t_1 = fmax(abs(M), abs(D)) t_2 = Float64(fma(Float64(Float64(Float64(Float64(t_1 / d) * t_0) * t_0) * -0.25), Float64(Float64(Float64(0.5 * h) * t_1) / Float64(l * d)), 1.0) * Float64(abs(d) / sqrt(Float64(l * h)))) 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_0 * t_1) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_3 <= 0.0) tmp = t_2; elseif (t_3 <= 4e+233) tmp = Float64(Float64(h * Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)))) / h); else tmp = t_2; end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Min[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Max[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(N[(N[(t$95$1 / d), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision] * -0.25), $MachinePrecision] * N[(N[(N[(0.5 * h), $MachinePrecision] * t$95$1), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $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$0 * t$95$1), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, 0.0], t$95$2, If[LessEqual[t$95$3, 4e+233], N[(N[(h * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], t$95$2]]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(\left|M\right|, \left|D\right|\right)\\
t_1 := \mathsf{max}\left(\left|M\right|, \left|D\right|\right)\\
t_2 := \mathsf{fma}\left(\left(\left(\frac{t\_1}{d} \cdot t\_0\right) \cdot t\_0\right) \cdot -0.25, \frac{\left(0.5 \cdot h\right) \cdot t\_1}{\ell \cdot d}, 1\right) \cdot \frac{\left|d\right|}{\sqrt{\ell \cdot h}}\\
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\_0 \cdot t\_1}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_3 \leq 0:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_3 \leq 4 \cdot 10^{+233}:\\
\;\;\;\;\frac{h \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\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)))) < -0.0 or 3.99999999999999989e233 < (*.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 67.1%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites60.1%
Applied rewrites36.4%
rem-square-sqrtN/A
sqrt-unprodN/A
rem-sqrt-squareN/A
lift-neg.f64N/A
neg-fabsN/A
lower-fabs.f6469.9%
Applied rewrites69.9%
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)))) < 3.99999999999999989e233Initial program 67.1%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6424.0%
Applied rewrites24.0%
Taylor expanded in h around inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6438.2%
Applied rewrites38.2%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (* h l)))
(t_1 (fmin (fabs M) (fabs D)))
(t_2 (fmax (fabs M) (fabs D)))
(t_3 (/ t_2 d))
(t_4 (* t_1 t_2)))
(if (<= h -5e+30)
(/
(*
(fma (/ (* t_2 (* (* (* 0.5 h) t_1) (* t_1 t_3))) (* l d)) -0.25 1.0)
d)
(- t_0))
(if (<= h 4.2e-308)
(*
(fma (/ (* t_4 (* -0.25 t_1)) d) (/ (* (* 0.5 h) t_2) (* l d)) 1.0)
(/ (- d) (sqrt (* l h))))
(*
(/ d t_0)
(- 1.0 (/ (* (* (* (* t_3 t_1) 0.25) h) t_4) (* l (+ d d)))))))))double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((h * l));
double t_1 = fmin(fabs(M), fabs(D));
double t_2 = fmax(fabs(M), fabs(D));
double t_3 = t_2 / d;
double t_4 = t_1 * t_2;
double tmp;
if (h <= -5e+30) {
tmp = (fma(((t_2 * (((0.5 * h) * t_1) * (t_1 * t_3))) / (l * d)), -0.25, 1.0) * d) / -t_0;
} else if (h <= 4.2e-308) {
tmp = fma(((t_4 * (-0.25 * t_1)) / d), (((0.5 * h) * t_2) / (l * d)), 1.0) * (-d / sqrt((l * h)));
} else {
tmp = (d / t_0) * (1.0 - (((((t_3 * t_1) * 0.25) * h) * t_4) / (l * (d + d))));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = sqrt(Float64(h * l)) t_1 = fmin(abs(M), abs(D)) t_2 = fmax(abs(M), abs(D)) t_3 = Float64(t_2 / d) t_4 = Float64(t_1 * t_2) tmp = 0.0 if (h <= -5e+30) tmp = Float64(Float64(fma(Float64(Float64(t_2 * Float64(Float64(Float64(0.5 * h) * t_1) * Float64(t_1 * t_3))) / Float64(l * d)), -0.25, 1.0) * d) / Float64(-t_0)); elseif (h <= 4.2e-308) tmp = Float64(fma(Float64(Float64(t_4 * Float64(-0.25 * t_1)) / d), Float64(Float64(Float64(0.5 * h) * t_2) / Float64(l * d)), 1.0) * Float64(Float64(-d) / sqrt(Float64(l * h)))); else tmp = Float64(Float64(d / t_0) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(t_3 * t_1) * 0.25) * h) * t_4) / Float64(l * Float64(d + d))))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(h * l), $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$2 / d), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$1 * t$95$2), $MachinePrecision]}, If[LessEqual[h, -5e+30], N[(N[(N[(N[(N[(t$95$2 * N[(N[(N[(0.5 * h), $MachinePrecision] * t$95$1), $MachinePrecision] * N[(t$95$1 * t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision] * -0.25 + 1.0), $MachinePrecision] * d), $MachinePrecision] / (-t$95$0)), $MachinePrecision], If[LessEqual[h, 4.2e-308], N[(N[(N[(N[(t$95$4 * N[(-0.25 * t$95$1), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * N[(N[(N[(0.5 * h), $MachinePrecision] * t$95$2), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[((-d) / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / t$95$0), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(N[(t$95$3 * t$95$1), $MachinePrecision] * 0.25), $MachinePrecision] * h), $MachinePrecision] * t$95$4), $MachinePrecision] / N[(l * N[(d + d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
t_0 := \sqrt{h \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 := \frac{t\_2}{d}\\
t_4 := t\_1 \cdot t\_2\\
\mathbf{if}\;h \leq -5 \cdot 10^{+30}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{t\_2 \cdot \left(\left(\left(0.5 \cdot h\right) \cdot t\_1\right) \cdot \left(t\_1 \cdot t\_3\right)\right)}{\ell \cdot d}, -0.25, 1\right) \cdot d}{-t\_0}\\
\mathbf{elif}\;h \leq 4.2 \cdot 10^{-308}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t\_4 \cdot \left(-0.25 \cdot t\_1\right)}{d}, \frac{\left(0.5 \cdot h\right) \cdot t\_2}{\ell \cdot d}, 1\right) \cdot \frac{-d}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{t\_0} \cdot \left(1 - \frac{\left(\left(\left(t\_3 \cdot t\_1\right) \cdot 0.25\right) \cdot h\right) \cdot t\_4}{\ell \cdot \left(d + d\right)}\right)\\
\end{array}
if h < -4.9999999999999998e30Initial program 67.1%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites60.1%
Applied rewrites36.4%
Applied rewrites37.7%
metadata-evalN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites38.1%
if -4.9999999999999998e30 < h < 4.2e-308Initial program 67.1%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites60.1%
Applied rewrites36.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6436.0%
Applied rewrites36.0%
if 4.2e-308 < h Initial program 67.1%
lift-*.f64N/A
lift-*.f64N/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 rewrites68.0%
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
lift-*.f64N/A
pow1/2N/A
sqrt-undivN/A
lift-*.f64N/A
rem-sqrt-squareN/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
div-fabsN/A
lower-fabs.f64N/A
lower-/.f6471.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.3%
Applied rewrites71.3%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-/l*N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites74.2%
lift-fabs.f64N/A
neg-fabsN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
distribute-frac-negN/A
lift-neg.f64N/A
frac-2negN/A
lift-neg.f64N/A
fabs-divN/A
lift-neg.f64N/A
remove-double-negN/A
rem-sqrt-squareN/A
sqrt-unprodN/A
rem-square-sqrtN/A
remove-double-negN/A
lift-neg.f64N/A
lift-neg.f64N/A
neg-fabsN/A
lift-sqrt.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
remove-double-negN/A
Applied rewrites38.5%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (* h l))))
(if (<= l -4e+197)
(/ (* (sqrt (- d)) (sqrt (/ d l))) (sqrt (- h)))
(if (<= l -1.2e-306)
(/
(*
(fma (/ (* D (* (* (* 0.5 h) M) (* M (/ D d)))) (* l d)) -0.25 1.0)
d)
(- t_0))
(*
(/ d t_0)
(- 1.0 (/ (* (* (* (* (/ D d) M) 0.25) h) (* M D)) (* l (+ d d)))))))))double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((h * l));
double tmp;
if (l <= -4e+197) {
tmp = (sqrt(-d) * sqrt((d / l))) / sqrt(-h);
} else if (l <= -1.2e-306) {
tmp = (fma(((D * (((0.5 * h) * M) * (M * (D / d)))) / (l * d)), -0.25, 1.0) * d) / -t_0;
} else {
tmp = (d / t_0) * (1.0 - ((((((D / d) * M) * 0.25) * h) * (M * D)) / (l * (d + d))));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = sqrt(Float64(h * l)) tmp = 0.0 if (l <= -4e+197) tmp = Float64(Float64(sqrt(Float64(-d)) * sqrt(Float64(d / l))) / sqrt(Float64(-h))); elseif (l <= -1.2e-306) tmp = Float64(Float64(fma(Float64(Float64(D * Float64(Float64(Float64(0.5 * h) * M) * Float64(M * Float64(D / d)))) / Float64(l * d)), -0.25, 1.0) * d) / Float64(-t_0)); else tmp = Float64(Float64(d / t_0) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(D / d) * M) * 0.25) * h) * Float64(M * D)) / Float64(l * Float64(d + d))))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -4e+197], N[(N[(N[Sqrt[(-d)], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1.2e-306], N[(N[(N[(N[(N[(D * N[(N[(N[(0.5 * h), $MachinePrecision] * M), $MachinePrecision] * N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision] * -0.25 + 1.0), $MachinePrecision] * d), $MachinePrecision] / (-t$95$0)), $MachinePrecision], N[(N[(d / t$95$0), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(N[(N[(D / d), $MachinePrecision] * M), $MachinePrecision] * 0.25), $MachinePrecision] * h), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / N[(l * N[(d + d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \sqrt{h \cdot \ell}\\
\mathbf{if}\;\ell \leq -4 \cdot 10^{+197}:\\
\;\;\;\;\frac{\sqrt{-d} \cdot \sqrt{\frac{d}{\ell}}}{\sqrt{-h}}\\
\mathbf{elif}\;\ell \leq -1.2 \cdot 10^{-306}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{D \cdot \left(\left(\left(0.5 \cdot h\right) \cdot M\right) \cdot \left(M \cdot \frac{D}{d}\right)\right)}{\ell \cdot d}, -0.25, 1\right) \cdot d}{-t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{t\_0} \cdot \left(1 - \frac{\left(\left(\left(\frac{D}{d} \cdot M\right) \cdot 0.25\right) \cdot h\right) \cdot \left(M \cdot D\right)}{\ell \cdot \left(d + d\right)}\right)\\
\end{array}
if l < -3.9999999999999998e197Initial program 67.1%
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.7%
Applied rewrites37.7%
Taylor expanded in l around inf
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f6422.2%
Applied rewrites22.2%
if -3.9999999999999998e197 < l < -1.2e-306Initial program 67.1%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites60.1%
Applied rewrites36.4%
Applied rewrites37.7%
metadata-evalN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites38.1%
if -1.2e-306 < l Initial program 67.1%
lift-*.f64N/A
lift-*.f64N/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 rewrites68.0%
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
lift-*.f64N/A
pow1/2N/A
sqrt-undivN/A
lift-*.f64N/A
rem-sqrt-squareN/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
div-fabsN/A
lower-fabs.f64N/A
lower-/.f6471.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.3%
Applied rewrites71.3%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-/l*N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites74.2%
lift-fabs.f64N/A
neg-fabsN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
distribute-frac-negN/A
lift-neg.f64N/A
frac-2negN/A
lift-neg.f64N/A
fabs-divN/A
lift-neg.f64N/A
remove-double-negN/A
rem-sqrt-squareN/A
sqrt-unprodN/A
rem-square-sqrtN/A
remove-double-negN/A
lift-neg.f64N/A
lift-neg.f64N/A
neg-fabsN/A
lift-sqrt.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
remove-double-negN/A
Applied rewrites38.5%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (/ D d) M)) (t_1 (sqrt (* h l))))
(if (<= l -4e+197)
(/ (* (sqrt (- d)) (sqrt (/ d l))) (sqrt (- h)))
(if (<= l -3e-307)
(/
(* (fma (* (* (/ D (* l d)) (* 0.5 h)) (* t_0 M)) -0.25 1.0) d)
(- t_1))
(*
(/ d t_1)
(- 1.0 (/ (* (* (* t_0 0.25) h) (* M D)) (* l (+ d d)))))))))double code(double d, double h, double l, double M, double D) {
double t_0 = (D / d) * M;
double t_1 = sqrt((h * l));
double tmp;
if (l <= -4e+197) {
tmp = (sqrt(-d) * sqrt((d / l))) / sqrt(-h);
} else if (l <= -3e-307) {
tmp = (fma((((D / (l * d)) * (0.5 * h)) * (t_0 * M)), -0.25, 1.0) * d) / -t_1;
} else {
tmp = (d / t_1) * (1.0 - ((((t_0 * 0.25) * h) * (M * D)) / (l * (d + d))));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(Float64(D / d) * M) t_1 = sqrt(Float64(h * l)) tmp = 0.0 if (l <= -4e+197) tmp = Float64(Float64(sqrt(Float64(-d)) * sqrt(Float64(d / l))) / sqrt(Float64(-h))); elseif (l <= -3e-307) tmp = Float64(Float64(fma(Float64(Float64(Float64(D / Float64(l * d)) * Float64(0.5 * h)) * Float64(t_0 * M)), -0.25, 1.0) * d) / Float64(-t_1)); else tmp = Float64(Float64(d / t_1) * Float64(1.0 - Float64(Float64(Float64(Float64(t_0 * 0.25) * h) * Float64(M * D)) / Float64(l * Float64(d + d))))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(D / d), $MachinePrecision] * M), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -4e+197], N[(N[(N[Sqrt[(-d)], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -3e-307], N[(N[(N[(N[(N[(N[(D / N[(l * d), $MachinePrecision]), $MachinePrecision] * N[(0.5 * h), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * M), $MachinePrecision]), $MachinePrecision] * -0.25 + 1.0), $MachinePrecision] * d), $MachinePrecision] / (-t$95$1)), $MachinePrecision], N[(N[(d / t$95$1), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(t$95$0 * 0.25), $MachinePrecision] * h), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / N[(l * N[(d + d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \frac{D}{d} \cdot M\\
t_1 := \sqrt{h \cdot \ell}\\
\mathbf{if}\;\ell \leq -4 \cdot 10^{+197}:\\
\;\;\;\;\frac{\sqrt{-d} \cdot \sqrt{\frac{d}{\ell}}}{\sqrt{-h}}\\
\mathbf{elif}\;\ell \leq -3 \cdot 10^{-307}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(\frac{D}{\ell \cdot d} \cdot \left(0.5 \cdot h\right)\right) \cdot \left(t\_0 \cdot M\right), -0.25, 1\right) \cdot d}{-t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{t\_1} \cdot \left(1 - \frac{\left(\left(t\_0 \cdot 0.25\right) \cdot h\right) \cdot \left(M \cdot D\right)}{\ell \cdot \left(d + d\right)}\right)\\
\end{array}
if l < -3.9999999999999998e197Initial program 67.1%
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.7%
Applied rewrites37.7%
Taylor expanded in l around inf
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f6422.2%
Applied rewrites22.2%
if -3.9999999999999998e197 < l < -2.9999999999999999e-307Initial program 67.1%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites60.1%
Applied rewrites36.4%
Applied rewrites37.7%
if -2.9999999999999999e-307 < l Initial program 67.1%
lift-*.f64N/A
lift-*.f64N/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 rewrites68.0%
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
lift-*.f64N/A
pow1/2N/A
sqrt-undivN/A
lift-*.f64N/A
rem-sqrt-squareN/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
div-fabsN/A
lower-fabs.f64N/A
lower-/.f6471.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.3%
Applied rewrites71.3%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-/l*N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites74.2%
lift-fabs.f64N/A
neg-fabsN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
distribute-frac-negN/A
lift-neg.f64N/A
frac-2negN/A
lift-neg.f64N/A
fabs-divN/A
lift-neg.f64N/A
remove-double-negN/A
rem-sqrt-squareN/A
sqrt-unprodN/A
rem-square-sqrtN/A
remove-double-negN/A
lift-neg.f64N/A
lift-neg.f64N/A
neg-fabsN/A
lift-sqrt.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
remove-double-negN/A
Applied rewrites38.5%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (/ D d) M)))
(if (<= l -2e+98)
(/ (* (sqrt (- d)) (sqrt (/ d l))) (sqrt (- h)))
(if (<= l -3e-307)
(*
(fma (* (* (/ D (* l d)) (* 0.5 h)) (* t_0 M)) -0.25 1.0)
(/ (- d) (sqrt (* l h))))
(*
(/ d (sqrt (* h l)))
(- 1.0 (/ (* (* (* t_0 0.25) h) (* M D)) (* l (+ d d)))))))))double code(double d, double h, double l, double M, double D) {
double t_0 = (D / d) * M;
double tmp;
if (l <= -2e+98) {
tmp = (sqrt(-d) * sqrt((d / l))) / sqrt(-h);
} else if (l <= -3e-307) {
tmp = fma((((D / (l * d)) * (0.5 * h)) * (t_0 * M)), -0.25, 1.0) * (-d / sqrt((l * h)));
} else {
tmp = (d / sqrt((h * l))) * (1.0 - ((((t_0 * 0.25) * h) * (M * D)) / (l * (d + d))));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(Float64(D / d) * M) tmp = 0.0 if (l <= -2e+98) tmp = Float64(Float64(sqrt(Float64(-d)) * sqrt(Float64(d / l))) / sqrt(Float64(-h))); elseif (l <= -3e-307) tmp = Float64(fma(Float64(Float64(Float64(D / Float64(l * d)) * Float64(0.5 * h)) * Float64(t_0 * M)), -0.25, 1.0) * Float64(Float64(-d) / sqrt(Float64(l * h)))); else tmp = Float64(Float64(d / sqrt(Float64(h * l))) * Float64(1.0 - Float64(Float64(Float64(Float64(t_0 * 0.25) * h) * Float64(M * D)) / Float64(l * Float64(d + d))))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(D / d), $MachinePrecision] * M), $MachinePrecision]}, If[LessEqual[l, -2e+98], N[(N[(N[Sqrt[(-d)], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -3e-307], N[(N[(N[(N[(N[(D / N[(l * d), $MachinePrecision]), $MachinePrecision] * N[(0.5 * h), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * M), $MachinePrecision]), $MachinePrecision] * -0.25 + 1.0), $MachinePrecision] * N[((-d) / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(t$95$0 * 0.25), $MachinePrecision] * h), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / N[(l * N[(d + d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \frac{D}{d} \cdot M\\
\mathbf{if}\;\ell \leq -2 \cdot 10^{+98}:\\
\;\;\;\;\frac{\sqrt{-d} \cdot \sqrt{\frac{d}{\ell}}}{\sqrt{-h}}\\
\mathbf{elif}\;\ell \leq -3 \cdot 10^{-307}:\\
\;\;\;\;\mathsf{fma}\left(\left(\frac{D}{\ell \cdot d} \cdot \left(0.5 \cdot h\right)\right) \cdot \left(t\_0 \cdot M\right), -0.25, 1\right) \cdot \frac{-d}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 - \frac{\left(\left(t\_0 \cdot 0.25\right) \cdot h\right) \cdot \left(M \cdot D\right)}{\ell \cdot \left(d + d\right)}\right)\\
\end{array}
if l < -2e98Initial program 67.1%
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.7%
Applied rewrites37.7%
Taylor expanded in l around inf
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f6422.2%
Applied rewrites22.2%
if -2e98 < l < -2.9999999999999999e-307Initial program 67.1%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites60.1%
Applied rewrites36.4%
lift-fma.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites37.0%
if -2.9999999999999999e-307 < l Initial program 67.1%
lift-*.f64N/A
lift-*.f64N/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 rewrites68.0%
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
lift-*.f64N/A
pow1/2N/A
sqrt-undivN/A
lift-*.f64N/A
rem-sqrt-squareN/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
div-fabsN/A
lower-fabs.f64N/A
lower-/.f6471.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.3%
Applied rewrites71.3%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-/l*N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites74.2%
lift-fabs.f64N/A
neg-fabsN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
distribute-frac-negN/A
lift-neg.f64N/A
frac-2negN/A
lift-neg.f64N/A
fabs-divN/A
lift-neg.f64N/A
remove-double-negN/A
rem-sqrt-squareN/A
sqrt-unprodN/A
rem-square-sqrtN/A
remove-double-negN/A
lift-neg.f64N/A
lift-neg.f64N/A
neg-fabsN/A
lift-sqrt.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
remove-double-negN/A
Applied rewrites38.5%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (fmin M D) (fmax M D))) (t_1 (sqrt (* h l))))
(if (<= l -4e+197)
(/ (* (sqrt (- d)) (sqrt (/ d l))) (sqrt (- h)))
(if (<= l -3e-307)
(/
(*
(fma
(* (/ (* (* (* 0.5 h) (fmax M D)) t_0) (* (* l d) d)) (fmin M D))
-0.25
1.0)
d)
(- t_1))
(*
(/ d t_1)
(-
1.0
(/
(* (* (* (* (/ (fmax M D) d) (fmin M D)) 0.25) h) t_0)
(* l (+ d d)))))))))double code(double d, double h, double l, double M, double D) {
double t_0 = fmin(M, D) * fmax(M, D);
double t_1 = sqrt((h * l));
double tmp;
if (l <= -4e+197) {
tmp = (sqrt(-d) * sqrt((d / l))) / sqrt(-h);
} else if (l <= -3e-307) {
tmp = (fma((((((0.5 * h) * fmax(M, D)) * t_0) / ((l * d) * d)) * fmin(M, D)), -0.25, 1.0) * d) / -t_1;
} else {
tmp = (d / t_1) * (1.0 - ((((((fmax(M, D) / d) * fmin(M, D)) * 0.25) * h) * t_0) / (l * (d + d))));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(fmin(M, D) * fmax(M, D)) t_1 = sqrt(Float64(h * l)) tmp = 0.0 if (l <= -4e+197) tmp = Float64(Float64(sqrt(Float64(-d)) * sqrt(Float64(d / l))) / sqrt(Float64(-h))); elseif (l <= -3e-307) tmp = Float64(Float64(fma(Float64(Float64(Float64(Float64(Float64(0.5 * h) * fmax(M, D)) * t_0) / Float64(Float64(l * d) * d)) * fmin(M, D)), -0.25, 1.0) * d) / Float64(-t_1)); else tmp = Float64(Float64(d / t_1) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(fmax(M, D) / d) * fmin(M, D)) * 0.25) * h) * t_0) / Float64(l * Float64(d + d))))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Min[M, D], $MachinePrecision] * N[Max[M, D], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -4e+197], N[(N[(N[Sqrt[(-d)], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -3e-307], N[(N[(N[(N[(N[(N[(N[(N[(0.5 * h), $MachinePrecision] * N[Max[M, D], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] / N[(N[(l * d), $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] * N[Min[M, D], $MachinePrecision]), $MachinePrecision] * -0.25 + 1.0), $MachinePrecision] * d), $MachinePrecision] / (-t$95$1)), $MachinePrecision], N[(N[(d / t$95$1), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(N[(N[(N[Max[M, D], $MachinePrecision] / d), $MachinePrecision] * N[Min[M, D], $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision] * h), $MachinePrecision] * t$95$0), $MachinePrecision] / N[(l * N[(d + d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(M, D\right) \cdot \mathsf{max}\left(M, D\right)\\
t_1 := \sqrt{h \cdot \ell}\\
\mathbf{if}\;\ell \leq -4 \cdot 10^{+197}:\\
\;\;\;\;\frac{\sqrt{-d} \cdot \sqrt{\frac{d}{\ell}}}{\sqrt{-h}}\\
\mathbf{elif}\;\ell \leq -3 \cdot 10^{-307}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{\left(\left(0.5 \cdot h\right) \cdot \mathsf{max}\left(M, D\right)\right) \cdot t\_0}{\left(\ell \cdot d\right) \cdot d} \cdot \mathsf{min}\left(M, D\right), -0.25, 1\right) \cdot d}{-t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{t\_1} \cdot \left(1 - \frac{\left(\left(\left(\frac{\mathsf{max}\left(M, D\right)}{d} \cdot \mathsf{min}\left(M, D\right)\right) \cdot 0.25\right) \cdot h\right) \cdot t\_0}{\ell \cdot \left(d + d\right)}\right)\\
\end{array}
if l < -3.9999999999999998e197Initial program 67.1%
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.7%
Applied rewrites37.7%
Taylor expanded in l around inf
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f6422.2%
Applied rewrites22.2%
if -3.9999999999999998e197 < l < -2.9999999999999999e-307Initial program 67.1%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites60.1%
Applied rewrites36.4%
Applied rewrites37.7%
metadata-evalN/A
Applied rewrites35.2%
if -2.9999999999999999e-307 < l Initial program 67.1%
lift-*.f64N/A
lift-*.f64N/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 rewrites68.0%
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
lift-*.f64N/A
pow1/2N/A
sqrt-undivN/A
lift-*.f64N/A
rem-sqrt-squareN/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
div-fabsN/A
lower-fabs.f64N/A
lower-/.f6471.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.3%
Applied rewrites71.3%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-/l*N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites74.2%
lift-fabs.f64N/A
neg-fabsN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
distribute-frac-negN/A
lift-neg.f64N/A
frac-2negN/A
lift-neg.f64N/A
fabs-divN/A
lift-neg.f64N/A
remove-double-negN/A
rem-sqrt-squareN/A
sqrt-unprodN/A
rem-square-sqrtN/A
remove-double-negN/A
lift-neg.f64N/A
lift-neg.f64N/A
neg-fabsN/A
lift-sqrt.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
remove-double-negN/A
Applied rewrites38.5%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (- d))))
(if (<= l -5e-153)
(/ (* t_0 (sqrt (/ d l))) (sqrt (- h)))
(if (<= l -1.25e-306)
(/ (* t_0 (* -1.0 (* d (sqrt (* -1.0 (/ h (* d l))))))) h)
(*
(/ d (sqrt (* h l)))
(-
1.0
(/
(*
(* (* (* (/ (fmax M D) d) (fmin M D)) 0.25) h)
(* (fmin M D) (fmax M D)))
(* l (+ d d)))))))))double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt(-d);
double tmp;
if (l <= -5e-153) {
tmp = (t_0 * sqrt((d / l))) / sqrt(-h);
} else if (l <= -1.25e-306) {
tmp = (t_0 * (-1.0 * (d * sqrt((-1.0 * (h / (d * l))))))) / h;
} else {
tmp = (d / sqrt((h * l))) * (1.0 - ((((((fmax(M, D) / d) * fmin(M, D)) * 0.25) * h) * (fmin(M, D) * fmax(M, D))) / (l * (d + d))));
}
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)
if (l <= (-5d-153)) then
tmp = (t_0 * sqrt((d / l))) / sqrt(-h)
else if (l <= (-1.25d-306)) then
tmp = (t_0 * ((-1.0d0) * (d * sqrt(((-1.0d0) * (h / (d * l))))))) / h
else
tmp = (d / sqrt((h * l))) * (1.0d0 - ((((((fmax(m, d_1) / d) * fmin(m, d_1)) * 0.25d0) * h) * (fmin(m, d_1) * fmax(m, d_1))) / (l * (d + d))))
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);
double tmp;
if (l <= -5e-153) {
tmp = (t_0 * Math.sqrt((d / l))) / Math.sqrt(-h);
} else if (l <= -1.25e-306) {
tmp = (t_0 * (-1.0 * (d * Math.sqrt((-1.0 * (h / (d * l))))))) / h;
} else {
tmp = (d / Math.sqrt((h * l))) * (1.0 - ((((((fmax(M, D) / d) * fmin(M, D)) * 0.25) * h) * (fmin(M, D) * fmax(M, D))) / (l * (d + d))));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt(-d) tmp = 0 if l <= -5e-153: tmp = (t_0 * math.sqrt((d / l))) / math.sqrt(-h) elif l <= -1.25e-306: tmp = (t_0 * (-1.0 * (d * math.sqrt((-1.0 * (h / (d * l))))))) / h else: tmp = (d / math.sqrt((h * l))) * (1.0 - ((((((fmax(M, D) / d) * fmin(M, D)) * 0.25) * h) * (fmin(M, D) * fmax(M, D))) / (l * (d + d)))) return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(-d)) tmp = 0.0 if (l <= -5e-153) tmp = Float64(Float64(t_0 * sqrt(Float64(d / l))) / sqrt(Float64(-h))); elseif (l <= -1.25e-306) tmp = Float64(Float64(t_0 * Float64(-1.0 * Float64(d * sqrt(Float64(-1.0 * Float64(h / Float64(d * l))))))) / h); else tmp = Float64(Float64(d / sqrt(Float64(h * l))) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(fmax(M, D) / d) * fmin(M, D)) * 0.25) * h) * Float64(fmin(M, D) * fmax(M, D))) / Float64(l * Float64(d + d))))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt(-d); tmp = 0.0; if (l <= -5e-153) tmp = (t_0 * sqrt((d / l))) / sqrt(-h); elseif (l <= -1.25e-306) tmp = (t_0 * (-1.0 * (d * sqrt((-1.0 * (h / (d * l))))))) / h; else tmp = (d / sqrt((h * l))) * (1.0 - ((((((max(M, D) / d) * min(M, D)) * 0.25) * h) * (min(M, D) * max(M, D))) / (l * (d + d)))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[l, -5e-153], N[(N[(t$95$0 * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1.25e-306], N[(N[(t$95$0 * N[(-1.0 * N[(d * N[Sqrt[N[(-1.0 * N[(h / N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(N[(N[(N[Max[M, D], $MachinePrecision] / d), $MachinePrecision] * N[Min[M, D], $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision] * h), $MachinePrecision] * N[(N[Min[M, D], $MachinePrecision] * N[Max[M, D], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l * N[(d + d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \sqrt{-d}\\
\mathbf{if}\;\ell \leq -5 \cdot 10^{-153}:\\
\;\;\;\;\frac{t\_0 \cdot \sqrt{\frac{d}{\ell}}}{\sqrt{-h}}\\
\mathbf{elif}\;\ell \leq -1.25 \cdot 10^{-306}:\\
\;\;\;\;\frac{t\_0 \cdot \left(-1 \cdot \left(d \cdot \sqrt{-1 \cdot \frac{h}{d \cdot \ell}}\right)\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 - \frac{\left(\left(\left(\frac{\mathsf{max}\left(M, D\right)}{d} \cdot \mathsf{min}\left(M, D\right)\right) \cdot 0.25\right) \cdot h\right) \cdot \left(\mathsf{min}\left(M, D\right) \cdot \mathsf{max}\left(M, D\right)\right)}{\ell \cdot \left(d + d\right)}\right)\\
\end{array}
if l < -5.00000000000000033e-153Initial program 67.1%
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.7%
Applied rewrites37.7%
Taylor expanded in l around inf
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f6422.2%
Applied rewrites22.2%
if -5.00000000000000033e-153 < l < -1.25e-306Initial program 67.1%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites60.1%
lift-*.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqrt-undivN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f64N/A
sqrt-undivN/A
lower-sqrt.f64N/A
Applied rewrites29.7%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f645.9%
Applied rewrites5.9%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f649.3%
Applied rewrites9.3%
if -1.25e-306 < l Initial program 67.1%
lift-*.f64N/A
lift-*.f64N/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 rewrites68.0%
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
lift-*.f64N/A
pow1/2N/A
sqrt-undivN/A
lift-*.f64N/A
rem-sqrt-squareN/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
div-fabsN/A
lower-fabs.f64N/A
lower-/.f6471.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.3%
Applied rewrites71.3%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-/l*N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites74.2%
lift-fabs.f64N/A
neg-fabsN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
distribute-frac-negN/A
lift-neg.f64N/A
frac-2negN/A
lift-neg.f64N/A
fabs-divN/A
lift-neg.f64N/A
remove-double-negN/A
rem-sqrt-squareN/A
sqrt-unprodN/A
rem-square-sqrtN/A
remove-double-negN/A
lift-neg.f64N/A
lift-neg.f64N/A
neg-fabsN/A
lift-sqrt.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
remove-double-negN/A
Applied rewrites38.5%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (fabs (/ d (sqrt (* l h)))) 1.0))
(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 -1e+86)
(*
(fma (* (/ (* (* (* 0.5 h) t_2) t_3) (* (* l d) d)) t_1) -0.25 1.0)
(/ d (sqrt (* h l))))
(if (<= t_4 0.0)
t_0
(if (<= t_4 5e+144)
(/ (* h (* (sqrt (/ d h)) (sqrt (/ d l)))) h)
t_0)))))double code(double d, double h, double l, double M, double D) {
double t_0 = fabs((d / sqrt((l * h)))) * 1.0;
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 <= -1e+86) {
tmp = fma((((((0.5 * h) * t_2) * t_3) / ((l * d) * d)) * t_1), -0.25, 1.0) * (d / sqrt((h * l)));
} else if (t_4 <= 0.0) {
tmp = t_0;
} else if (t_4 <= 5e+144) {
tmp = (h * (sqrt((d / h)) * sqrt((d / l)))) / h;
} else {
tmp = t_0;
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(abs(Float64(d / sqrt(Float64(l * h)))) * 1.0) 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 <= -1e+86) tmp = Float64(fma(Float64(Float64(Float64(Float64(Float64(0.5 * h) * t_2) * t_3) / Float64(Float64(l * d) * d)) * t_1), -0.25, 1.0) * Float64(d / sqrt(Float64(h * l)))); elseif (t_4 <= 0.0) tmp = t_0; elseif (t_4 <= 5e+144) tmp = Float64(Float64(h * Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)))) / h); else tmp = t_0; end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $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, -1e+86], N[(N[(N[(N[(N[(N[(N[(0.5 * h), $MachinePrecision] * t$95$2), $MachinePrecision] * t$95$3), $MachinePrecision] / N[(N[(l * d), $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * -0.25 + 1.0), $MachinePrecision] * N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.0], t$95$0, If[LessEqual[t$95$4, 5e+144], N[(N[(h * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], t$95$0]]]]]]]]
\begin{array}{l}
t_0 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \cdot 1\\
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 -1 \cdot 10^{+86}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(\left(0.5 \cdot h\right) \cdot t\_2\right) \cdot t\_3}{\left(\ell \cdot d\right) \cdot d} \cdot t\_1, -0.25, 1\right) \cdot \frac{d}{\sqrt{h \cdot \ell}}\\
\mathbf{elif}\;t\_4 \leq 0:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_4 \leq 5 \cdot 10^{+144}:\\
\;\;\;\;\frac{h \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\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)))) < -1e86Initial program 67.1%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites60.1%
Applied rewrites36.4%
Applied rewrites37.7%
Applied rewrites34.3%
if -1e86 < (*.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 4.9999999999999999e144 < (*.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 67.1%
lift-*.f64N/A
lift-*.f64N/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 rewrites68.0%
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
lift-*.f64N/A
pow1/2N/A
sqrt-undivN/A
lift-*.f64N/A
rem-sqrt-squareN/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
div-fabsN/A
lower-fabs.f64N/A
lower-/.f6471.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.3%
Applied rewrites71.3%
Taylor expanded in d around inf
Applied rewrites43.7%
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)))) < 4.9999999999999999e144Initial program 67.1%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6424.0%
Applied rewrites24.0%
Taylor expanded in h around inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6438.2%
Applied rewrites38.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 (* (fabs (/ d (sqrt (* l h)))) 1.0)))
(if (<= t_0 -1e-33)
(* -1.0 (/ d (* h (sqrt (/ l h)))))
(if (<= t_0 0.0)
t_1
(if (<= t_0 5e+144)
(/ (* h (* (sqrt (/ d h)) (sqrt (/ d l)))) h)
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 = fabs((d / sqrt((l * h)))) * 1.0;
double tmp;
if (t_0 <= -1e-33) {
tmp = -1.0 * (d / (h * sqrt((l / h))));
} else if (t_0 <= 0.0) {
tmp = t_1;
} else if (t_0 <= 5e+144) {
tmp = (h * (sqrt((d / h)) * sqrt((d / l)))) / h;
} 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 = abs((d / sqrt((l * h)))) * 1.0d0
if (t_0 <= (-1d-33)) then
tmp = (-1.0d0) * (d / (h * sqrt((l / h))))
else if (t_0 <= 0.0d0) then
tmp = t_1
else if (t_0 <= 5d+144) then
tmp = (h * (sqrt((d / h)) * sqrt((d / l)))) / h
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.abs((d / Math.sqrt((l * h)))) * 1.0;
double tmp;
if (t_0 <= -1e-33) {
tmp = -1.0 * (d / (h * Math.sqrt((l / h))));
} else if (t_0 <= 0.0) {
tmp = t_1;
} else if (t_0 <= 5e+144) {
tmp = (h * (Math.sqrt((d / h)) * Math.sqrt((d / l)))) / h;
} 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.fabs((d / math.sqrt((l * h)))) * 1.0 tmp = 0 if t_0 <= -1e-33: tmp = -1.0 * (d / (h * math.sqrt((l / h)))) elif t_0 <= 0.0: tmp = t_1 elif t_0 <= 5e+144: tmp = (h * (math.sqrt((d / h)) * math.sqrt((d / l)))) / h 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(abs(Float64(d / sqrt(Float64(l * h)))) * 1.0) tmp = 0.0 if (t_0 <= -1e-33) tmp = Float64(-1.0 * Float64(d / Float64(h * sqrt(Float64(l / h))))); elseif (t_0 <= 0.0) tmp = t_1; elseif (t_0 <= 5e+144) tmp = Float64(Float64(h * Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)))) / h); 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 = abs((d / sqrt((l * h)))) * 1.0; tmp = 0.0; if (t_0 <= -1e-33) tmp = -1.0 * (d / (h * sqrt((l / h)))); elseif (t_0 <= 0.0) tmp = t_1; elseif (t_0 <= 5e+144) tmp = (h * (sqrt((d / h)) * sqrt((d / l)))) / h; 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[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]}, If[LessEqual[t$95$0, -1e-33], N[(-1.0 * N[(d / N[(h * N[Sqrt[N[(l / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], t$95$1, If[LessEqual[t$95$0, 5e+144], N[(N[(h * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $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 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \cdot 1\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-33}:\\
\;\;\;\;-1 \cdot \frac{d}{h \cdot \sqrt{\frac{\ell}{h}}}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+144}:\\
\;\;\;\;\frac{h \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)}{h}\\
\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)))) < -1.0000000000000001e-33Initial program 67.1%
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
sqrt-divN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f64N/A
lower-*.f64N/A
lower-unsound-sqrt.f64N/A
lower-*.f6448.9%
Applied rewrites48.9%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-*.f6426.7%
Applied rewrites26.7%
Taylor expanded in h around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6412.1%
Applied rewrites12.1%
if -1.0000000000000001e-33 < (*.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 4.9999999999999999e144 < (*.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 67.1%
lift-*.f64N/A
lift-*.f64N/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 rewrites68.0%
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
lift-*.f64N/A
pow1/2N/A
sqrt-undivN/A
lift-*.f64N/A
rem-sqrt-squareN/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
div-fabsN/A
lower-fabs.f64N/A
lower-/.f6471.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.3%
Applied rewrites71.3%
Taylor expanded in d around inf
Applied rewrites43.7%
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)))) < 4.9999999999999999e144Initial program 67.1%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6424.0%
Applied rewrites24.0%
Taylor expanded in h around inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6438.2%
Applied rewrites38.2%
(FPCore (d h l M D)
:precision binary64
(if (<=
(*
(* (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))))
-1e-33)
(* -1.0 (/ d (* h (sqrt (/ l h)))))
(* (fabs (/ d (sqrt (* l h)))) 1.0)))double code(double d, double h, double l, double M, double D) {
double tmp;
if (((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)))) <= -1e-33) {
tmp = -1.0 * (d / (h * sqrt((l / h))));
} else {
tmp = fabs((d / sqrt((l * h)))) * 1.0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(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 (((((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)))) <= (-1d-33)) then
tmp = (-1.0d0) * (d / (h * sqrt((l / h))))
else
tmp = abs((d / sqrt((l * h)))) * 1.0d0
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (((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)))) <= -1e-33) {
tmp = -1.0 * (d / (h * Math.sqrt((l / h))));
} else {
tmp = Math.abs((d / Math.sqrt((l * h)))) * 1.0;
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if ((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)))) <= -1e-33: tmp = -1.0 * (d / (h * math.sqrt((l / h)))) else: tmp = math.fabs((d / math.sqrt((l * h)))) * 1.0 return tmp
function code(d, h, l, M, D) tmp = 0.0 if (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)))) <= -1e-33) tmp = Float64(-1.0 * Float64(d / Float64(h * sqrt(Float64(l / h))))); else tmp = Float64(abs(Float64(d / sqrt(Float64(l * h)))) * 1.0); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (((((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)))) <= -1e-33) tmp = -1.0 * (d / (h * sqrt((l / h)))); else tmp = abs((d / sqrt((l * h)))) * 1.0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[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], -1e-33], N[(-1.0 * N[(d / N[(h * N[Sqrt[N[(l / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\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) \leq -1 \cdot 10^{-33}:\\
\;\;\;\;-1 \cdot \frac{d}{h \cdot \sqrt{\frac{\ell}{h}}}\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right| \cdot 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)))) < -1.0000000000000001e-33Initial program 67.1%
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
sqrt-divN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f64N/A
lower-*.f64N/A
lower-unsound-sqrt.f64N/A
lower-*.f6448.9%
Applied rewrites48.9%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-*.f6426.7%
Applied rewrites26.7%
Taylor expanded in h around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6412.1%
Applied rewrites12.1%
if -1.0000000000000001e-33 < (*.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 67.1%
lift-*.f64N/A
lift-*.f64N/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 rewrites68.0%
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
lift-*.f64N/A
pow1/2N/A
sqrt-undivN/A
lift-*.f64N/A
rem-sqrt-squareN/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
div-fabsN/A
lower-fabs.f64N/A
lower-/.f6471.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.3%
Applied rewrites71.3%
Taylor expanded in d around inf
Applied rewrites43.7%
(FPCore (d h l M D)
:precision binary64
(if (<=
(*
(* (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))))
-5e-5)
(/ (sqrt (* (* h (/ d l)) d)) h)
(* (fabs (/ d (sqrt (* l h)))) 1.0)))double code(double d, double h, double l, double M, double D) {
double tmp;
if (((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)))) <= -5e-5) {
tmp = sqrt(((h * (d / l)) * d)) / h;
} else {
tmp = fabs((d / sqrt((l * h)))) * 1.0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(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 (((((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)))) <= (-5d-5)) then
tmp = sqrt(((h * (d / l)) * d)) / h
else
tmp = abs((d / sqrt((l * h)))) * 1.0d0
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (((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)))) <= -5e-5) {
tmp = Math.sqrt(((h * (d / l)) * d)) / h;
} else {
tmp = Math.abs((d / Math.sqrt((l * h)))) * 1.0;
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if ((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)))) <= -5e-5: tmp = math.sqrt(((h * (d / l)) * d)) / h else: tmp = math.fabs((d / math.sqrt((l * h)))) * 1.0 return tmp
function code(d, h, l, M, D) tmp = 0.0 if (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)))) <= -5e-5) tmp = Float64(sqrt(Float64(Float64(h * Float64(d / l)) * d)) / h); else tmp = Float64(abs(Float64(d / sqrt(Float64(l * h)))) * 1.0); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (((((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)))) <= -5e-5) tmp = sqrt(((h * (d / l)) * d)) / h; else tmp = abs((d / sqrt((l * h)))) * 1.0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[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], -5e-5], N[(N[Sqrt[N[(N[(h * N[(d / l), $MachinePrecision]), $MachinePrecision] * d), $MachinePrecision]], $MachinePrecision] / h), $MachinePrecision], N[(N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\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) \leq -5 \cdot 10^{-5}:\\
\;\;\;\;\frac{\sqrt{\left(h \cdot \frac{d}{\ell}\right) \cdot d}}{h}\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right| \cdot 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.00000000000000024e-5Initial program 67.1%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
unpow2N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites60.1%
lift-*.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqrt-undivN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f64N/A
sqrt-undivN/A
lower-sqrt.f64N/A
Applied rewrites29.7%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f645.9%
Applied rewrites5.9%
Applied rewrites22.3%
if -5.00000000000000024e-5 < (*.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 67.1%
lift-*.f64N/A
lift-*.f64N/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 rewrites68.0%
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
lift-*.f64N/A
pow1/2N/A
sqrt-undivN/A
lift-*.f64N/A
rem-sqrt-squareN/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
div-fabsN/A
lower-fabs.f64N/A
lower-/.f6471.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.3%
Applied rewrites71.3%
Taylor expanded in d around inf
Applied rewrites43.7%
(FPCore (d h l M D)
:precision binary64
(if (<=
(*
(* (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))))
-1e-33)
(/ (- d) (sqrt (* h l)))
(* (fabs (/ d (sqrt (* l h)))) 1.0)))double code(double d, double h, double l, double M, double D) {
double tmp;
if (((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)))) <= -1e-33) {
tmp = -d / sqrt((h * l));
} else {
tmp = fabs((d / sqrt((l * h)))) * 1.0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(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 (((((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)))) <= (-1d-33)) then
tmp = -d / sqrt((h * l))
else
tmp = abs((d / sqrt((l * h)))) * 1.0d0
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (((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)))) <= -1e-33) {
tmp = -d / Math.sqrt((h * l));
} else {
tmp = Math.abs((d / Math.sqrt((l * h)))) * 1.0;
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if ((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)))) <= -1e-33: tmp = -d / math.sqrt((h * l)) else: tmp = math.fabs((d / math.sqrt((l * h)))) * 1.0 return tmp
function code(d, h, l, M, D) tmp = 0.0 if (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)))) <= -1e-33) tmp = Float64(Float64(-d) / sqrt(Float64(h * l))); else tmp = Float64(abs(Float64(d / sqrt(Float64(l * h)))) * 1.0); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (((((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)))) <= -1e-33) tmp = -d / sqrt((h * l)); else tmp = abs((d / sqrt((l * h)))) * 1.0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[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], -1e-33], N[((-d) / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\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) \leq -1 \cdot 10^{-33}:\\
\;\;\;\;\frac{-d}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right| \cdot 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)))) < -1.0000000000000001e-33Initial program 67.1%
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
sqrt-divN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f64N/A
lower-*.f64N/A
lower-unsound-sqrt.f64N/A
lower-*.f6448.9%
Applied rewrites48.9%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-*.f6426.7%
Applied rewrites26.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
mul-1-negN/A
lift-neg.f64N/A
lower-/.f6426.7%
Applied rewrites26.7%
if -1.0000000000000001e-33 < (*.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 67.1%
lift-*.f64N/A
lift-*.f64N/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 rewrites68.0%
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
lift-*.f64N/A
pow1/2N/A
sqrt-undivN/A
lift-*.f64N/A
rem-sqrt-squareN/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
div-fabsN/A
lower-fabs.f64N/A
lower-/.f6471.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.3%
Applied rewrites71.3%
Taylor expanded in d around inf
Applied rewrites43.7%
(FPCore (d h l M D) :precision binary64 (let* ((t_0 (sqrt (* h l)))) (if (<= l -2.1e-254) (/ (- d) t_0) (/ d t_0))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((h * l));
double tmp;
if (l <= -2.1e-254) {
tmp = -d / t_0;
} else {
tmp = d / t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(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((h * l))
if (l <= (-2.1d-254)) then
tmp = -d / t_0
else
tmp = d / t_0
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((h * l));
double tmp;
if (l <= -2.1e-254) {
tmp = -d / t_0;
} else {
tmp = d / t_0;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((h * l)) tmp = 0 if l <= -2.1e-254: tmp = -d / t_0 else: tmp = d / t_0 return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(h * l)) tmp = 0.0 if (l <= -2.1e-254) tmp = Float64(Float64(-d) / t_0); else tmp = Float64(d / t_0); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((h * l)); tmp = 0.0; if (l <= -2.1e-254) tmp = -d / t_0; else tmp = d / t_0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -2.1e-254], N[((-d) / t$95$0), $MachinePrecision], N[(d / t$95$0), $MachinePrecision]]]
\begin{array}{l}
t_0 := \sqrt{h \cdot \ell}\\
\mathbf{if}\;\ell \leq -2.1 \cdot 10^{-254}:\\
\;\;\;\;\frac{-d}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{t\_0}\\
\end{array}
if l < -2.09999999999999997e-254Initial program 67.1%
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
sqrt-divN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f64N/A
lower-*.f64N/A
lower-unsound-sqrt.f64N/A
lower-*.f6448.9%
Applied rewrites48.9%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-*.f6426.7%
Applied rewrites26.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
mul-1-negN/A
lift-neg.f64N/A
lower-/.f6426.7%
Applied rewrites26.7%
if -2.09999999999999997e-254 < l Initial program 67.1%
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
sqrt-divN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f64N/A
lower-*.f64N/A
lower-unsound-sqrt.f64N/A
lower-*.f6448.9%
Applied rewrites48.9%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-*.f6426.7%
Applied rewrites26.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
mul-1-negN/A
lift-neg.f64N/A
lower-/.f6426.7%
Applied rewrites26.7%
rem-square-sqrtN/A
sqrt-unprodN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqr-neg-revN/A
sqrt-unprodN/A
rem-square-sqrt26.6%
Applied rewrites26.6%
(FPCore (d h l M D) :precision binary64 (/ d (sqrt (* h l))))
double code(double d, double h, double l, double M, double D) {
return d / sqrt((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 / sqrt((h * l))
end function
public static double code(double d, double h, double l, double M, double D) {
return d / Math.sqrt((h * l));
}
def code(d, h, l, M, D): return d / math.sqrt((h * l))
function code(d, h, l, M, D) return Float64(d / sqrt(Float64(h * l))) end
function tmp = code(d, h, l, M, D) tmp = d / sqrt((h * l)); end
code[d_, h_, l_, M_, D_] := N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\frac{d}{\sqrt{h \cdot \ell}}
Initial program 67.1%
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
sqrt-divN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f64N/A
lower-*.f64N/A
lower-unsound-sqrt.f64N/A
lower-*.f6448.9%
Applied rewrites48.9%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-*.f6426.7%
Applied rewrites26.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
mul-1-negN/A
lift-neg.f64N/A
lower-/.f6426.7%
Applied rewrites26.7%
rem-square-sqrtN/A
sqrt-unprodN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqr-neg-revN/A
sqrt-unprodN/A
rem-square-sqrt26.6%
Applied rewrites26.6%
herbie shell --seed 2025183
(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)))))