
(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 23 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 (/ (fabs d) (sqrt (* l h))))
(t_1 (fmax (fabs M) (fabs D)))
(t_2 (/ t_1 (+ d d)))
(t_3 (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))))
(t_4 (fmin (fabs M) (fabs D)))
(t_5 (* t_4 t_1))
(t_6
(*
t_3
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ t_5 (* 2.0 d)) 2.0)) (/ h l)))))
(t_7 (* t_2 t_4)))
(if (<= t_6 -5e+42)
(*
(* (sqrt (/ d l)) (sqrt (/ d h)))
(- 1.0 (* (* t_7 (* t_7 0.5)) (/ h l))))
(if (<= t_6 0.0)
(*
t_0
(-
1.0
(* (* 0.5 (pow (* t_1 (/ 1.0 (/ d (* t_4 0.5)))) 2.0)) (/ h l))))
(if (<= t_6 5e+107)
(* t_3 1.0)
(* t_0 (- 1.0 (/ (* (* (* (* 0.25 (/ t_5 d)) t_2) t_4) h) l))))))))double code(double d, double h, double l, double M, double D) {
double t_0 = fabs(d) / sqrt((l * h));
double t_1 = fmax(fabs(M), fabs(D));
double t_2 = t_1 / (d + d);
double t_3 = pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0));
double t_4 = fmin(fabs(M), fabs(D));
double t_5 = t_4 * t_1;
double t_6 = t_3 * (1.0 - (((1.0 / 2.0) * pow((t_5 / (2.0 * d)), 2.0)) * (h / l)));
double t_7 = t_2 * t_4;
double tmp;
if (t_6 <= -5e+42) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((t_7 * (t_7 * 0.5)) * (h / l)));
} else if (t_6 <= 0.0) {
tmp = t_0 * (1.0 - ((0.5 * pow((t_1 * (1.0 / (d / (t_4 * 0.5)))), 2.0)) * (h / l)));
} else if (t_6 <= 5e+107) {
tmp = t_3 * 1.0;
} else {
tmp = t_0 * (1.0 - (((((0.25 * (t_5 / d)) * t_2) * t_4) * h) / l));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: t_7
real(8) :: tmp
t_0 = abs(d) / sqrt((l * h))
t_1 = fmax(abs(m), abs(d_1))
t_2 = t_1 / (d + d)
t_3 = ((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))
t_4 = fmin(abs(m), abs(d_1))
t_5 = t_4 * t_1
t_6 = t_3 * (1.0d0 - (((1.0d0 / 2.0d0) * ((t_5 / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
t_7 = t_2 * t_4
if (t_6 <= (-5d+42)) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0d0 - ((t_7 * (t_7 * 0.5d0)) * (h / l)))
else if (t_6 <= 0.0d0) then
tmp = t_0 * (1.0d0 - ((0.5d0 * ((t_1 * (1.0d0 / (d / (t_4 * 0.5d0)))) ** 2.0d0)) * (h / l)))
else if (t_6 <= 5d+107) then
tmp = t_3 * 1.0d0
else
tmp = t_0 * (1.0d0 - (((((0.25d0 * (t_5 / d)) * t_2) * t_4) * h) / l))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.abs(d) / Math.sqrt((l * h));
double t_1 = fmax(Math.abs(M), Math.abs(D));
double t_2 = t_1 / (d + d);
double t_3 = Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0));
double t_4 = fmin(Math.abs(M), Math.abs(D));
double t_5 = t_4 * t_1;
double t_6 = t_3 * (1.0 - (((1.0 / 2.0) * Math.pow((t_5 / (2.0 * d)), 2.0)) * (h / l)));
double t_7 = t_2 * t_4;
double tmp;
if (t_6 <= -5e+42) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 - ((t_7 * (t_7 * 0.5)) * (h / l)));
} else if (t_6 <= 0.0) {
tmp = t_0 * (1.0 - ((0.5 * Math.pow((t_1 * (1.0 / (d / (t_4 * 0.5)))), 2.0)) * (h / l)));
} else if (t_6 <= 5e+107) {
tmp = t_3 * 1.0;
} else {
tmp = t_0 * (1.0 - (((((0.25 * (t_5 / d)) * t_2) * t_4) * h) / l));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.fabs(d) / math.sqrt((l * h)) t_1 = fmax(math.fabs(M), math.fabs(D)) t_2 = t_1 / (d + d) t_3 = math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0)) t_4 = fmin(math.fabs(M), math.fabs(D)) t_5 = t_4 * t_1 t_6 = t_3 * (1.0 - (((1.0 / 2.0) * math.pow((t_5 / (2.0 * d)), 2.0)) * (h / l))) t_7 = t_2 * t_4 tmp = 0 if t_6 <= -5e+42: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 - ((t_7 * (t_7 * 0.5)) * (h / l))) elif t_6 <= 0.0: tmp = t_0 * (1.0 - ((0.5 * math.pow((t_1 * (1.0 / (d / (t_4 * 0.5)))), 2.0)) * (h / l))) elif t_6 <= 5e+107: tmp = t_3 * 1.0 else: tmp = t_0 * (1.0 - (((((0.25 * (t_5 / d)) * t_2) * t_4) * h) / l)) return tmp
function code(d, h, l, M, D) t_0 = Float64(abs(d) / sqrt(Float64(l * h))) t_1 = fmax(abs(M), abs(D)) t_2 = Float64(t_1 / Float64(d + d)) t_3 = Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) t_4 = fmin(abs(M), abs(D)) t_5 = Float64(t_4 * t_1) t_6 = Float64(t_3 * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(t_5 / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_7 = Float64(t_2 * t_4) tmp = 0.0 if (t_6 <= -5e+42) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(Float64(t_7 * Float64(t_7 * 0.5)) * Float64(h / l)))); elseif (t_6 <= 0.0) tmp = Float64(t_0 * Float64(1.0 - Float64(Float64(0.5 * (Float64(t_1 * Float64(1.0 / Float64(d / Float64(t_4 * 0.5)))) ^ 2.0)) * Float64(h / l)))); elseif (t_6 <= 5e+107) tmp = Float64(t_3 * 1.0); else tmp = Float64(t_0 * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(0.25 * Float64(t_5 / d)) * t_2) * t_4) * h) / l))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = abs(d) / sqrt((l * h)); t_1 = max(abs(M), abs(D)); t_2 = t_1 / (d + d); t_3 = ((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0)); t_4 = min(abs(M), abs(D)); t_5 = t_4 * t_1; t_6 = t_3 * (1.0 - (((1.0 / 2.0) * ((t_5 / (2.0 * d)) ^ 2.0)) * (h / l))); t_7 = t_2 * t_4; tmp = 0.0; if (t_6 <= -5e+42) tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((t_7 * (t_7 * 0.5)) * (h / l))); elseif (t_6 <= 0.0) tmp = t_0 * (1.0 - ((0.5 * ((t_1 * (1.0 / (d / (t_4 * 0.5)))) ^ 2.0)) * (h / l))); elseif (t_6 <= 5e+107) tmp = t_3 * 1.0; else tmp = t_0 * (1.0 - (((((0.25 * (t_5 / d)) * t_2) * t_4) * h) / l)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Max[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 / N[(d + d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = 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$4 = N[Min[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[(t$95$4 * t$95$1), $MachinePrecision]}, Block[{t$95$6 = N[(t$95$3 * 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[(t$95$2 * t$95$4), $MachinePrecision]}, If[LessEqual[t$95$6, -5e+42], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(t$95$7 * N[(t$95$7 * 0.5), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$6, 0.0], N[(t$95$0 * N[(1.0 - N[(N[(0.5 * N[Power[N[(t$95$1 * N[(1.0 / N[(d / N[(t$95$4 * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$6, 5e+107], N[(t$95$3 * 1.0), $MachinePrecision], N[(t$95$0 * N[(1.0 - N[(N[(N[(N[(N[(0.25 * N[(t$95$5 / d), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision] * t$95$4), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]
\begin{array}{l}
t_0 := \frac{\left|d\right|}{\sqrt{\ell \cdot h}}\\
t_1 := \mathsf{max}\left(\left|M\right|, \left|D\right|\right)\\
t_2 := \frac{t\_1}{d + d}\\
t_3 := {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\\
t_4 := \mathsf{min}\left(\left|M\right|, \left|D\right|\right)\\
t_5 := t\_4 \cdot t\_1\\
t_6 := t\_3 \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 := t\_2 \cdot t\_4\\
\mathbf{if}\;t\_6 \leq -5 \cdot 10^{+42}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \left(t\_7 \cdot \left(t\_7 \cdot 0.5\right)\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{elif}\;t\_6 \leq 0:\\
\;\;\;\;t\_0 \cdot \left(1 - \left(0.5 \cdot {\left(t\_1 \cdot \frac{1}{\frac{d}{t\_4 \cdot 0.5}}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{elif}\;t\_6 \leq 5 \cdot 10^{+107}:\\
\;\;\;\;t\_3 \cdot 1\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(1 - \frac{\left(\left(\left(0.25 \cdot \frac{t\_5}{d}\right) \cdot t\_2\right) \cdot t\_4\right) \cdot h}{\ell}\right)\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -5.00000000000000007e42Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6465.8
lift-/.f64N/A
metadata-eval65.8
Applied rewrites65.8%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow-prod-downN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6470.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6470.2
Applied rewrites70.2%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
associate-/r*N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
mult-flipN/A
lift-/.f64N/A
Applied rewrites70.3%
lift-/.f64N/A
lift-fabs.f64N/A
rem-sqrt-square-revN/A
lift-sqrt.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
sqrt-undivN/A
lift-*.f64N/A
frac-timesN/A
sqrt-unprodN/A
lift-sqrt.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6466.1
Applied rewrites66.1%
if -5.00000000000000007e42 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6465.8
lift-/.f64N/A
metadata-eval65.8
Applied rewrites65.8%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow-prod-downN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6470.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6470.2
Applied rewrites70.2%
Evaluated real constant70.2%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-flipN/A
lower-unsound-/.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flipN/A
lower-unsound-/.f64N/A
mult-flipN/A
metadata-evalN/A
lower-*.f6470.1
Applied rewrites70.1%
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)))) < 5.0000000000000002e107Initial program 66.3%
Taylor expanded in d around inf
Applied rewrites39.0%
if 5.0000000000000002e107 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6465.8
lift-/.f64N/A
metadata-eval65.8
Applied rewrites65.8%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow-prod-downN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6470.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6470.2
Applied rewrites70.2%
Evaluated real constant70.2%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
Applied rewrites73.3%
(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))))
(t_1
(*
t_0
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
(t_2 (/ (fabs d) (sqrt (* l h))))
(t_3 (/ D (+ d d)))
(t_4 (* t_3 M))
(t_5 (* 0.25 (/ (* M D) d))))
(if (<= t_1 -5e+42)
(*
(* (sqrt (/ d l)) (sqrt (/ d h)))
(- 1.0 (* (* t_4 (* t_4 0.5)) (/ h l))))
(if (<= t_1 0.0)
(* t_2 (- 1.0 (* (/ (* (* M D) t_5) (+ d d)) (/ h l))))
(if (<= t_1 5e+107)
(* t_0 1.0)
(* t_2 (- 1.0 (/ (* (* (* t_5 t_3) M) h) l))))))))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));
double t_1 = t_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 t_3 = D / (d + d);
double t_4 = t_3 * M;
double t_5 = 0.25 * ((M * D) / d);
double tmp;
if (t_1 <= -5e+42) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((t_4 * (t_4 * 0.5)) * (h / l)));
} else if (t_1 <= 0.0) {
tmp = t_2 * (1.0 - ((((M * D) * t_5) / (d + d)) * (h / l)));
} else if (t_1 <= 5e+107) {
tmp = t_0 * 1.0;
} else {
tmp = t_2 * (1.0 - ((((t_5 * t_3) * M) * h) / l));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: tmp
t_0 = ((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))
t_1 = t_0 * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
t_2 = abs(d) / sqrt((l * h))
t_3 = d_1 / (d + d)
t_4 = t_3 * m
t_5 = 0.25d0 * ((m * d_1) / d)
if (t_1 <= (-5d+42)) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0d0 - ((t_4 * (t_4 * 0.5d0)) * (h / l)))
else if (t_1 <= 0.0d0) then
tmp = t_2 * (1.0d0 - ((((m * d_1) * t_5) / (d + d)) * (h / l)))
else if (t_1 <= 5d+107) then
tmp = t_0 * 1.0d0
else
tmp = t_2 * (1.0d0 - ((((t_5 * t_3) * m) * h) / l))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0));
double t_1 = t_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 t_3 = D / (d + d);
double t_4 = t_3 * M;
double t_5 = 0.25 * ((M * D) / d);
double tmp;
if (t_1 <= -5e+42) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 - ((t_4 * (t_4 * 0.5)) * (h / l)));
} else if (t_1 <= 0.0) {
tmp = t_2 * (1.0 - ((((M * D) * t_5) / (d + d)) * (h / l)));
} else if (t_1 <= 5e+107) {
tmp = t_0 * 1.0;
} else {
tmp = t_2 * (1.0 - ((((t_5 * t_3) * M) * h) / l));
}
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)) t_1 = t_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)) t_3 = D / (d + d) t_4 = t_3 * M t_5 = 0.25 * ((M * D) / d) tmp = 0 if t_1 <= -5e+42: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 - ((t_4 * (t_4 * 0.5)) * (h / l))) elif t_1 <= 0.0: tmp = t_2 * (1.0 - ((((M * D) * t_5) / (d + d)) * (h / l))) elif t_1 <= 5e+107: tmp = t_0 * 1.0 else: tmp = t_2 * (1.0 - ((((t_5 * t_3) * M) * h) / l)) return tmp
function code(d, h, l, M, D) t_0 = Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) t_1 = Float64(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_2 = Float64(abs(d) / sqrt(Float64(l * h))) t_3 = Float64(D / Float64(d + d)) t_4 = Float64(t_3 * M) t_5 = Float64(0.25 * Float64(Float64(M * D) / d)) tmp = 0.0 if (t_1 <= -5e+42) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(Float64(t_4 * Float64(t_4 * 0.5)) * Float64(h / l)))); elseif (t_1 <= 0.0) tmp = Float64(t_2 * Float64(1.0 - Float64(Float64(Float64(Float64(M * D) * t_5) / Float64(d + d)) * Float64(h / l)))); elseif (t_1 <= 5e+107) tmp = Float64(t_0 * 1.0); else tmp = Float64(t_2 * Float64(1.0 - Float64(Float64(Float64(Float64(t_5 * t_3) * M) * h) / l))); 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)); t_1 = t_0 * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); t_2 = abs(d) / sqrt((l * h)); t_3 = D / (d + d); t_4 = t_3 * M; t_5 = 0.25 * ((M * D) / d); tmp = 0.0; if (t_1 <= -5e+42) tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((t_4 * (t_4 * 0.5)) * (h / l))); elseif (t_1 <= 0.0) tmp = t_2 * (1.0 - ((((M * D) * t_5) / (d + d)) * (h / l))); elseif (t_1 <= 5e+107) tmp = t_0 * 1.0; else tmp = t_2 * (1.0 - ((((t_5 * t_3) * M) * h) / l)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = 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$1 = N[(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]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(D / N[(d + d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 * M), $MachinePrecision]}, Block[{t$95$5 = N[(0.25 * N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+42], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(t$95$4 * N[(t$95$4 * 0.5), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(t$95$2 * N[(1.0 - N[(N[(N[(N[(M * D), $MachinePrecision] * t$95$5), $MachinePrecision] / N[(d + d), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+107], N[(t$95$0 * 1.0), $MachinePrecision], N[(t$95$2 * N[(1.0 - N[(N[(N[(N[(t$95$5 * t$95$3), $MachinePrecision] * M), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
t_0 := {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\\
t_1 := t\_0 \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 := \frac{\left|d\right|}{\sqrt{\ell \cdot h}}\\
t_3 := \frac{D}{d + d}\\
t_4 := t\_3 \cdot M\\
t_5 := 0.25 \cdot \frac{M \cdot D}{d}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+42}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \left(t\_4 \cdot \left(t\_4 \cdot 0.5\right)\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;t\_2 \cdot \left(1 - \frac{\left(M \cdot D\right) \cdot t\_5}{d + d} \cdot \frac{h}{\ell}\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+107}:\\
\;\;\;\;t\_0 \cdot 1\\
\mathbf{else}:\\
\;\;\;\;t\_2 \cdot \left(1 - \frac{\left(\left(t\_5 \cdot t\_3\right) \cdot M\right) \cdot h}{\ell}\right)\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -5.00000000000000007e42Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6465.8
lift-/.f64N/A
metadata-eval65.8
Applied rewrites65.8%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow-prod-downN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6470.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6470.2
Applied rewrites70.2%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
associate-/r*N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
mult-flipN/A
lift-/.f64N/A
Applied rewrites70.3%
lift-/.f64N/A
lift-fabs.f64N/A
rem-sqrt-square-revN/A
lift-sqrt.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
sqrt-undivN/A
lift-*.f64N/A
frac-timesN/A
sqrt-unprodN/A
lift-sqrt.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6466.1
Applied rewrites66.1%
if -5.00000000000000007e42 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6465.8
lift-/.f64N/A
metadata-eval65.8
Applied rewrites65.8%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow-prod-downN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6470.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6470.2
Applied rewrites70.2%
Evaluated real constant70.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-/.f64N/A
metadata-evalN/A
associate-/r*N/A
count-2-revN/A
lift-+.f64N/A
mult-flipN/A
lift-/.f64N/A
lift-*.f64N/A
pow2N/A
associate-*r*N/A
lift-*.f64N/A
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)))) < 5.0000000000000002e107Initial program 66.3%
Taylor expanded in d around inf
Applied rewrites39.0%
if 5.0000000000000002e107 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6465.8
lift-/.f64N/A
metadata-eval65.8
Applied rewrites65.8%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow-prod-downN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6470.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6470.2
Applied rewrites70.2%
Evaluated real constant70.2%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
Applied rewrites73.3%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l)))
(t_1 (sqrt (/ d h)))
(t_2
(*
(* (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_3 (/ (fabs d) (sqrt (* l h))))
(t_4 (/ D (+ d d)))
(t_5 (* t_4 M))
(t_6 (* 0.25 (/ (* M D) d))))
(if (<= t_2 -5e+42)
(* (* t_0 t_1) (- 1.0 (* (* t_5 (* t_5 0.5)) (/ h l))))
(if (<= t_2 0.0)
(* t_3 (- 1.0 (* (/ (* (* M D) t_6) (+ d d)) (/ h l))))
(if (<= t_2 5e+107)
(* t_1 t_0)
(* t_3 (- 1.0 (/ (* (* (* t_6 t_4) M) h) l))))))))double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double t_1 = sqrt((d / h));
double t_2 = (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_3 = fabs(d) / sqrt((l * h));
double t_4 = D / (d + d);
double t_5 = t_4 * M;
double t_6 = 0.25 * ((M * D) / d);
double tmp;
if (t_2 <= -5e+42) {
tmp = (t_0 * t_1) * (1.0 - ((t_5 * (t_5 * 0.5)) * (h / l)));
} else if (t_2 <= 0.0) {
tmp = t_3 * (1.0 - ((((M * D) * t_6) / (d + d)) * (h / l)));
} else if (t_2 <= 5e+107) {
tmp = t_1 * t_0;
} else {
tmp = t_3 * (1.0 - ((((t_6 * t_4) * M) * h) / l));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: t_6
real(8) :: tmp
t_0 = sqrt((d / l))
t_1 = sqrt((d / h))
t_2 = (((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_3 = abs(d) / sqrt((l * h))
t_4 = d_1 / (d + d)
t_5 = t_4 * m
t_6 = 0.25d0 * ((m * d_1) / d)
if (t_2 <= (-5d+42)) then
tmp = (t_0 * t_1) * (1.0d0 - ((t_5 * (t_5 * 0.5d0)) * (h / l)))
else if (t_2 <= 0.0d0) then
tmp = t_3 * (1.0d0 - ((((m * d_1) * t_6) / (d + d)) * (h / l)))
else if (t_2 <= 5d+107) then
tmp = t_1 * t_0
else
tmp = t_3 * (1.0d0 - ((((t_6 * t_4) * m) * h) / l))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / l));
double t_1 = Math.sqrt((d / h));
double t_2 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_3 = Math.abs(d) / Math.sqrt((l * h));
double t_4 = D / (d + d);
double t_5 = t_4 * M;
double t_6 = 0.25 * ((M * D) / d);
double tmp;
if (t_2 <= -5e+42) {
tmp = (t_0 * t_1) * (1.0 - ((t_5 * (t_5 * 0.5)) * (h / l)));
} else if (t_2 <= 0.0) {
tmp = t_3 * (1.0 - ((((M * D) * t_6) / (d + d)) * (h / l)));
} else if (t_2 <= 5e+107) {
tmp = t_1 * t_0;
} else {
tmp = t_3 * (1.0 - ((((t_6 * t_4) * M) * h) / l));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) t_1 = math.sqrt((d / h)) t_2 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) t_3 = math.fabs(d) / math.sqrt((l * h)) t_4 = D / (d + d) t_5 = t_4 * M t_6 = 0.25 * ((M * D) / d) tmp = 0 if t_2 <= -5e+42: tmp = (t_0 * t_1) * (1.0 - ((t_5 * (t_5 * 0.5)) * (h / l))) elif t_2 <= 0.0: tmp = t_3 * (1.0 - ((((M * D) * t_6) / (d + d)) * (h / l))) elif t_2 <= 5e+107: tmp = t_1 * t_0 else: tmp = t_3 * (1.0 - ((((t_6 * t_4) * M) * h) / l)) return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) t_1 = sqrt(Float64(d / h)) t_2 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_3 = Float64(abs(d) / sqrt(Float64(l * h))) t_4 = Float64(D / Float64(d + d)) t_5 = Float64(t_4 * M) t_6 = Float64(0.25 * Float64(Float64(M * D) / d)) tmp = 0.0 if (t_2 <= -5e+42) tmp = Float64(Float64(t_0 * t_1) * Float64(1.0 - Float64(Float64(t_5 * Float64(t_5 * 0.5)) * Float64(h / l)))); elseif (t_2 <= 0.0) tmp = Float64(t_3 * Float64(1.0 - Float64(Float64(Float64(Float64(M * D) * t_6) / Float64(d + d)) * Float64(h / l)))); elseif (t_2 <= 5e+107) tmp = Float64(t_1 * t_0); else tmp = Float64(t_3 * Float64(1.0 - Float64(Float64(Float64(Float64(t_6 * t_4) * M) * h) / l))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((d / l)); t_1 = sqrt((d / h)); t_2 = (((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_3 = abs(d) / sqrt((l * h)); t_4 = D / (d + d); t_5 = t_4 * M; t_6 = 0.25 * ((M * D) / d); tmp = 0.0; if (t_2 <= -5e+42) tmp = (t_0 * t_1) * (1.0 - ((t_5 * (t_5 * 0.5)) * (h / l))); elseif (t_2 <= 0.0) tmp = t_3 * (1.0 - ((((M * D) * t_6) / (d + d)) * (h / l))); elseif (t_2 <= 5e+107) tmp = t_1 * t_0; else tmp = t_3 * (1.0 - ((((t_6 * t_4) * M) * h) / l)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(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[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(D / N[(d + d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(t$95$4 * M), $MachinePrecision]}, Block[{t$95$6 = N[(0.25 * N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+42], N[(N[(t$95$0 * t$95$1), $MachinePrecision] * N[(1.0 - N[(N[(t$95$5 * N[(t$95$5 * 0.5), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0], N[(t$95$3 * N[(1.0 - N[(N[(N[(N[(M * D), $MachinePrecision] * t$95$6), $MachinePrecision] / N[(d + d), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e+107], N[(t$95$1 * t$95$0), $MachinePrecision], N[(t$95$3 * N[(1.0 - N[(N[(N[(N[(t$95$6 * t$95$4), $MachinePrecision] * M), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \sqrt{\frac{d}{h}}\\
t_2 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_3 := \frac{\left|d\right|}{\sqrt{\ell \cdot h}}\\
t_4 := \frac{D}{d + d}\\
t_5 := t\_4 \cdot M\\
t_6 := 0.25 \cdot \frac{M \cdot D}{d}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+42}:\\
\;\;\;\;\left(t\_0 \cdot t\_1\right) \cdot \left(1 - \left(t\_5 \cdot \left(t\_5 \cdot 0.5\right)\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;t\_3 \cdot \left(1 - \frac{\left(M \cdot D\right) \cdot t\_6}{d + d} \cdot \frac{h}{\ell}\right)\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+107}:\\
\;\;\;\;t\_1 \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_3 \cdot \left(1 - \frac{\left(\left(t\_6 \cdot t\_4\right) \cdot M\right) \cdot h}{\ell}\right)\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -5.00000000000000007e42Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6465.8
lift-/.f64N/A
metadata-eval65.8
Applied rewrites65.8%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow-prod-downN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6470.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6470.2
Applied rewrites70.2%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
associate-/r*N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
mult-flipN/A
lift-/.f64N/A
Applied rewrites70.3%
lift-/.f64N/A
lift-fabs.f64N/A
rem-sqrt-square-revN/A
lift-sqrt.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
sqrt-undivN/A
lift-*.f64N/A
frac-timesN/A
sqrt-unprodN/A
lift-sqrt.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6466.1
Applied rewrites66.1%
if -5.00000000000000007e42 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6465.8
lift-/.f64N/A
metadata-eval65.8
Applied rewrites65.8%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow-prod-downN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6470.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6470.2
Applied rewrites70.2%
Evaluated real constant70.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-/.f64N/A
metadata-evalN/A
associate-/r*N/A
count-2-revN/A
lift-+.f64N/A
mult-flipN/A
lift-/.f64N/A
lift-*.f64N/A
pow2N/A
associate-*r*N/A
lift-*.f64N/A
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)))) < 5.0000000000000002e107Initial program 66.3%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.9
Applied rewrites23.9%
Taylor expanded in l around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f6431.5
Applied rewrites31.5%
Taylor expanded in h around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6439.0
Applied rewrites39.0%
if 5.0000000000000002e107 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6465.8
lift-/.f64N/A
metadata-eval65.8
Applied rewrites65.8%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow-prod-downN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6470.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6470.2
Applied rewrites70.2%
Evaluated real constant70.2%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
Applied rewrites73.3%
(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 (sqrt (/ d l)))
(t_3 (fmax (fabs M) (fabs D)))
(t_4 (* t_1 t_3))
(t_5
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ t_4 (* 2.0 d)) 2.0)) (/ h l)))))
(t_6 (* 0.25 (/ t_4 d)))
(t_7 (sqrt (/ d h))))
(if (<= t_5 -5e+42)
(* (* (fma (* (* (* t_6 t_1) (/ t_3 d)) -0.5) (/ h l) 1.0) t_2) t_7)
(if (<= t_5 0.0)
(* t_0 (- 1.0 (* (/ (* t_4 t_6) (+ d d)) (/ h l))))
(if (<= t_5 5e+107)
(* t_7 t_2)
(* t_0 (- 1.0 (/ (* (* (* t_6 (/ t_3 (+ d d))) t_1) h) l))))))))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 = sqrt((d / l));
double t_3 = fmax(fabs(M), fabs(D));
double t_4 = t_1 * t_3;
double t_5 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow((t_4 / (2.0 * d)), 2.0)) * (h / l)));
double t_6 = 0.25 * (t_4 / d);
double t_7 = sqrt((d / h));
double tmp;
if (t_5 <= -5e+42) {
tmp = (fma((((t_6 * t_1) * (t_3 / d)) * -0.5), (h / l), 1.0) * t_2) * t_7;
} else if (t_5 <= 0.0) {
tmp = t_0 * (1.0 - (((t_4 * t_6) / (d + d)) * (h / l)));
} else if (t_5 <= 5e+107) {
tmp = t_7 * t_2;
} else {
tmp = t_0 * (1.0 - ((((t_6 * (t_3 / (d + d))) * t_1) * h) / l));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(abs(d) / sqrt(Float64(l * h))) t_1 = fmin(abs(M), abs(D)) t_2 = sqrt(Float64(d / l)) t_3 = fmax(abs(M), abs(D)) t_4 = Float64(t_1 * t_3) t_5 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(t_4 / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_6 = Float64(0.25 * Float64(t_4 / d)) t_7 = sqrt(Float64(d / h)) tmp = 0.0 if (t_5 <= -5e+42) tmp = Float64(Float64(fma(Float64(Float64(Float64(t_6 * t_1) * Float64(t_3 / d)) * -0.5), Float64(h / l), 1.0) * t_2) * t_7); elseif (t_5 <= 0.0) tmp = Float64(t_0 * Float64(1.0 - Float64(Float64(Float64(t_4 * t_6) / Float64(d + d)) * Float64(h / l)))); elseif (t_5 <= 5e+107) tmp = Float64(t_7 * t_2); else tmp = Float64(t_0 * Float64(1.0 - Float64(Float64(Float64(Float64(t_6 * Float64(t_3 / Float64(d + d))) * t_1) * h) / l))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Min[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Max[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(t$95$1 * t$95$3), $MachinePrecision]}, Block[{t$95$5 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(t$95$4 / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(0.25 * N[(t$95$4 / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$7 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$5, -5e+42], N[(N[(N[(N[(N[(N[(t$95$6 * t$95$1), $MachinePrecision] * N[(t$95$3 / d), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision] * N[(h / l), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$2), $MachinePrecision] * t$95$7), $MachinePrecision], If[LessEqual[t$95$5, 0.0], N[(t$95$0 * N[(1.0 - N[(N[(N[(t$95$4 * t$95$6), $MachinePrecision] / N[(d + d), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 5e+107], N[(t$95$7 * t$95$2), $MachinePrecision], N[(t$95$0 * N[(1.0 - N[(N[(N[(N[(t$95$6 * N[(t$95$3 / N[(d + d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]
\begin{array}{l}
t_0 := \frac{\left|d\right|}{\sqrt{\ell \cdot h}}\\
t_1 := \mathsf{min}\left(\left|M\right|, \left|D\right|\right)\\
t_2 := \sqrt{\frac{d}{\ell}}\\
t_3 := \mathsf{max}\left(\left|M\right|, \left|D\right|\right)\\
t_4 := t\_1 \cdot t\_3\\
t_5 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{t\_4}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_6 := 0.25 \cdot \frac{t\_4}{d}\\
t_7 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;t\_5 \leq -5 \cdot 10^{+42}:\\
\;\;\;\;\left(\mathsf{fma}\left(\left(\left(t\_6 \cdot t\_1\right) \cdot \frac{t\_3}{d}\right) \cdot -0.5, \frac{h}{\ell}, 1\right) \cdot t\_2\right) \cdot t\_7\\
\mathbf{elif}\;t\_5 \leq 0:\\
\;\;\;\;t\_0 \cdot \left(1 - \frac{t\_4 \cdot t\_6}{d + d} \cdot \frac{h}{\ell}\right)\\
\mathbf{elif}\;t\_5 \leq 5 \cdot 10^{+107}:\\
\;\;\;\;t\_7 \cdot t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(1 - \frac{\left(\left(t\_6 \cdot \frac{t\_3}{d + d}\right) \cdot t\_1\right) \cdot h}{\ell}\right)\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -5.00000000000000007e42Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6465.8
lift-/.f64N/A
metadata-eval65.8
Applied rewrites65.8%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow-prod-downN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6470.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6470.2
Applied rewrites70.2%
Evaluated real constant70.2%
Applied rewrites64.7%
if -5.00000000000000007e42 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6465.8
lift-/.f64N/A
metadata-eval65.8
Applied rewrites65.8%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow-prod-downN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6470.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6470.2
Applied rewrites70.2%
Evaluated real constant70.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-/.f64N/A
metadata-evalN/A
associate-/r*N/A
count-2-revN/A
lift-+.f64N/A
mult-flipN/A
lift-/.f64N/A
lift-*.f64N/A
pow2N/A
associate-*r*N/A
lift-*.f64N/A
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)))) < 5.0000000000000002e107Initial program 66.3%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.9
Applied rewrites23.9%
Taylor expanded in l around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f6431.5
Applied rewrites31.5%
Taylor expanded in h around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6439.0
Applied rewrites39.0%
if 5.0000000000000002e107 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6465.8
lift-/.f64N/A
metadata-eval65.8
Applied rewrites65.8%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow-prod-downN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6470.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6470.2
Applied rewrites70.2%
Evaluated real constant70.2%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
Applied rewrites73.3%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (fmin (fabs M) D))
(t_1 (fmax (fabs M) D))
(t_2 (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))))
(t_3 (* t_0 t_1)))
(if (<=
(* t_2 (- 1.0 (* (* (/ 1.0 2.0) (pow (/ t_3 (* 2.0 d)) 2.0)) (/ h l))))
5e+107)
(*
t_2
(- 1.0 (* (* (/ 1.0 2.0) (pow (* t_1 (* (/ 0.5 d) t_0)) 2.0)) (/ h l))))
(*
(/ (fabs d) (sqrt (* l h)))
(- 1.0 (/ (* (* (* (* 0.25 (/ t_3 d)) (/ t_1 (+ d d))) t_0) h) l))))))double code(double d, double h, double l, double M, double D) {
double t_0 = fmin(fabs(M), D);
double t_1 = fmax(fabs(M), D);
double t_2 = pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0));
double t_3 = t_0 * t_1;
double tmp;
if ((t_2 * (1.0 - (((1.0 / 2.0) * pow((t_3 / (2.0 * d)), 2.0)) * (h / l)))) <= 5e+107) {
tmp = t_2 * (1.0 - (((1.0 / 2.0) * pow((t_1 * ((0.5 / d) * t_0)), 2.0)) * (h / l)));
} else {
tmp = (fabs(d) / sqrt((l * h))) * (1.0 - (((((0.25 * (t_3 / d)) * (t_1 / (d + d))) * t_0) * h) / l));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = fmin(abs(m), d_1)
t_1 = fmax(abs(m), d_1)
t_2 = ((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))
t_3 = t_0 * t_1
if ((t_2 * (1.0d0 - (((1.0d0 / 2.0d0) * ((t_3 / (2.0d0 * d)) ** 2.0d0)) * (h / l)))) <= 5d+107) then
tmp = t_2 * (1.0d0 - (((1.0d0 / 2.0d0) * ((t_1 * ((0.5d0 / d) * t_0)) ** 2.0d0)) * (h / l)))
else
tmp = (abs(d) / sqrt((l * h))) * (1.0d0 - (((((0.25d0 * (t_3 / d)) * (t_1 / (d + d))) * t_0) * h) / l))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = fmin(Math.abs(M), D);
double t_1 = fmax(Math.abs(M), D);
double t_2 = Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0));
double t_3 = t_0 * t_1;
double tmp;
if ((t_2 * (1.0 - (((1.0 / 2.0) * Math.pow((t_3 / (2.0 * d)), 2.0)) * (h / l)))) <= 5e+107) {
tmp = t_2 * (1.0 - (((1.0 / 2.0) * Math.pow((t_1 * ((0.5 / d) * t_0)), 2.0)) * (h / l)));
} else {
tmp = (Math.abs(d) / Math.sqrt((l * h))) * (1.0 - (((((0.25 * (t_3 / d)) * (t_1 / (d + d))) * t_0) * h) / l));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = fmin(math.fabs(M), D) t_1 = fmax(math.fabs(M), D) t_2 = math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0)) t_3 = t_0 * t_1 tmp = 0 if (t_2 * (1.0 - (((1.0 / 2.0) * math.pow((t_3 / (2.0 * d)), 2.0)) * (h / l)))) <= 5e+107: tmp = t_2 * (1.0 - (((1.0 / 2.0) * math.pow((t_1 * ((0.5 / d) * t_0)), 2.0)) * (h / l))) else: tmp = (math.fabs(d) / math.sqrt((l * h))) * (1.0 - (((((0.25 * (t_3 / d)) * (t_1 / (d + d))) * t_0) * h) / l)) return tmp
function code(d, h, l, M, D) t_0 = fmin(abs(M), D) t_1 = fmax(abs(M), D) t_2 = Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) t_3 = Float64(t_0 * t_1) tmp = 0.0 if (Float64(t_2 * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(t_3 / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= 5e+107) tmp = Float64(t_2 * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(t_1 * Float64(Float64(0.5 / d) * t_0)) ^ 2.0)) * Float64(h / l)))); else tmp = Float64(Float64(abs(d) / sqrt(Float64(l * h))) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(0.25 * Float64(t_3 / d)) * Float64(t_1 / Float64(d + d))) * t_0) * h) / l))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = min(abs(M), D); t_1 = max(abs(M), D); t_2 = ((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0)); t_3 = t_0 * t_1; tmp = 0.0; if ((t_2 * (1.0 - (((1.0 / 2.0) * ((t_3 / (2.0 * d)) ^ 2.0)) * (h / l)))) <= 5e+107) tmp = t_2 * (1.0 - (((1.0 / 2.0) * ((t_1 * ((0.5 / d) * t_0)) ^ 2.0)) * (h / l))); else tmp = (abs(d) / sqrt((l * h))) * (1.0 - (((((0.25 * (t_3 / d)) * (t_1 / (d + d))) * t_0) * h) / l)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Min[N[Abs[M], $MachinePrecision], D], $MachinePrecision]}, Block[{t$95$1 = N[Max[N[Abs[M], $MachinePrecision], D], $MachinePrecision]}, Block[{t$95$2 = 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$3 = N[(t$95$0 * t$95$1), $MachinePrecision]}, If[LessEqual[N[(t$95$2 * 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], 5e+107], N[(t$95$2 * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(t$95$1 * N[(N[(0.5 / d), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(N[(0.25 * N[(t$95$3 / d), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 / N[(d + d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(\left|M\right|, D\right)\\
t_1 := \mathsf{max}\left(\left|M\right|, D\right)\\
t_2 := {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\\
t_3 := t\_0 \cdot t\_1\\
\mathbf{if}\;t\_2 \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{t\_3}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 5 \cdot 10^{+107}:\\
\;\;\;\;t\_2 \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(t\_1 \cdot \left(\frac{0.5}{d} \cdot t\_0\right)\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \frac{\left(\left(\left(0.25 \cdot \frac{t\_3}{d}\right) \cdot \frac{t\_1}{d + d}\right) \cdot t\_0\right) \cdot h}{\ell}\right)\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 5.0000000000000002e107Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6465.8
lift-/.f64N/A
metadata-eval65.8
Applied rewrites65.8%
if 5.0000000000000002e107 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6465.8
lift-/.f64N/A
metadata-eval65.8
Applied rewrites65.8%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow-prod-downN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6470.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6470.2
Applied rewrites70.2%
Evaluated real constant70.2%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
Applied rewrites73.3%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (fmin (fabs M) D)) (t_1 (fmax (fabs M) D)) (t_2 (* t_0 t_1)))
(if (<=
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ t_2 (* 2.0 d)) 2.0)) (/ h l))))
5e+107)
(*
(* (sqrt (/ d l)) (sqrt (/ d h)))
(- 1.0 (* (* (/ 1.0 2.0) (pow (* t_1 (* (/ 0.5 d) t_0)) 2.0)) (/ h l))))
(*
(/ (fabs d) (sqrt (* l h)))
(- 1.0 (/ (* (* (* (* 0.25 (/ t_2 d)) (/ t_1 (+ d d))) t_0) h) l))))))double code(double d, double h, double l, double M, double D) {
double t_0 = fmin(fabs(M), D);
double t_1 = fmax(fabs(M), D);
double t_2 = t_0 * t_1;
double tmp;
if (((pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow((t_2 / (2.0 * d)), 2.0)) * (h / l)))) <= 5e+107) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (((1.0 / 2.0) * pow((t_1 * ((0.5 / d) * t_0)), 2.0)) * (h / l)));
} else {
tmp = (fabs(d) / sqrt((l * h))) * (1.0 - (((((0.25 * (t_2 / d)) * (t_1 / (d + d))) * t_0) * h) / l));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = fmin(abs(m), d_1)
t_1 = fmax(abs(m), d_1)
t_2 = t_0 * t_1
if (((((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * ((t_2 / (2.0d0 * d)) ** 2.0d0)) * (h / l)))) <= 5d+107) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0d0 - (((1.0d0 / 2.0d0) * ((t_1 * ((0.5d0 / d) * t_0)) ** 2.0d0)) * (h / l)))
else
tmp = (abs(d) / sqrt((l * h))) * (1.0d0 - (((((0.25d0 * (t_2 / d)) * (t_1 / (d + d))) * t_0) * h) / l))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = fmin(Math.abs(M), D);
double t_1 = fmax(Math.abs(M), D);
double t_2 = t_0 * t_1;
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((t_2 / (2.0 * d)), 2.0)) * (h / l)))) <= 5e+107) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 - (((1.0 / 2.0) * Math.pow((t_1 * ((0.5 / d) * t_0)), 2.0)) * (h / l)));
} else {
tmp = (Math.abs(d) / Math.sqrt((l * h))) * (1.0 - (((((0.25 * (t_2 / d)) * (t_1 / (d + d))) * t_0) * h) / l));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = fmin(math.fabs(M), D) t_1 = fmax(math.fabs(M), D) t_2 = t_0 * t_1 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((t_2 / (2.0 * d)), 2.0)) * (h / l)))) <= 5e+107: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 - (((1.0 / 2.0) * math.pow((t_1 * ((0.5 / d) * t_0)), 2.0)) * (h / l))) else: tmp = (math.fabs(d) / math.sqrt((l * h))) * (1.0 - (((((0.25 * (t_2 / d)) * (t_1 / (d + d))) * t_0) * h) / l)) return tmp
function code(d, h, l, M, D) t_0 = fmin(abs(M), D) t_1 = fmax(abs(M), D) t_2 = Float64(t_0 * t_1) 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(t_2 / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= 5e+107) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(t_1 * Float64(Float64(0.5 / d) * t_0)) ^ 2.0)) * Float64(h / l)))); else tmp = Float64(Float64(abs(d) / sqrt(Float64(l * h))) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(0.25 * Float64(t_2 / d)) * Float64(t_1 / Float64(d + d))) * t_0) * h) / l))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = min(abs(M), D); t_1 = max(abs(M), D); t_2 = t_0 * t_1; tmp = 0.0; if (((((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * ((t_2 / (2.0 * d)) ^ 2.0)) * (h / l)))) <= 5e+107) tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (((1.0 / 2.0) * ((t_1 * ((0.5 / d) * t_0)) ^ 2.0)) * (h / l))); else tmp = (abs(d) / sqrt((l * h))) * (1.0 - (((((0.25 * (t_2 / d)) * (t_1 / (d + d))) * t_0) * h) / l)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Min[N[Abs[M], $MachinePrecision], D], $MachinePrecision]}, Block[{t$95$1 = N[Max[N[Abs[M], $MachinePrecision], D], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 * t$95$1), $MachinePrecision]}, 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[(t$95$2 / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+107], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(t$95$1 * N[(N[(0.5 / d), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(N[(0.25 * N[(t$95$2 / d), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 / N[(d + d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(\left|M\right|, D\right)\\
t_1 := \mathsf{max}\left(\left|M\right|, D\right)\\
t_2 := t\_0 \cdot t\_1\\
\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{t\_2}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 5 \cdot 10^{+107}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(t\_1 \cdot \left(\frac{0.5}{d} \cdot t\_0\right)\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \frac{\left(\left(\left(0.25 \cdot \frac{t\_2}{d}\right) \cdot \frac{t\_1}{d + d}\right) \cdot t\_0\right) \cdot h}{\ell}\right)\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 5.0000000000000002e107Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6465.8
lift-/.f64N/A
metadata-eval65.8
Applied rewrites65.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.8
lift-/.f64N/A
metadata-eval65.8
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6465.8
lift-/.f64N/A
metadata-eval65.8
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6465.8
Applied rewrites65.8%
if 5.0000000000000002e107 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6465.8
lift-/.f64N/A
metadata-eval65.8
Applied rewrites65.8%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow-prod-downN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6470.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6470.2
Applied rewrites70.2%
Evaluated real constant70.2%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
Applied rewrites73.3%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (/ (* M D) (* 2.0 d)) 2.0)))
(if (<=
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(- 1.0 (* (* (/ 1.0 2.0) t_0) (/ h l))))
5e+107)
(* (* (sqrt (/ d l)) (sqrt (/ d h))) (- 1.0 (* (* 0.5 t_0) (/ h l))))
(*
(/ (fabs d) (sqrt (* l h)))
(- 1.0 (/ (* (* (* (* 0.25 (/ (* M D) d)) (/ D (+ d d))) M) h) l))))))double code(double d, double h, double l, double M, double D) {
double t_0 = pow(((M * D) / (2.0 * d)), 2.0);
double tmp;
if (((pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * t_0) * (h / l)))) <= 5e+107) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((0.5 * t_0) * (h / l)));
} else {
tmp = (fabs(d) / sqrt((l * h))) * (1.0 - (((((0.25 * ((M * D) / d)) * (D / (d + d))) * M) * h) / l));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = ((m * d_1) / (2.0d0 * d)) ** 2.0d0
if (((((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * t_0) * (h / l)))) <= 5d+107) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0d0 - ((0.5d0 * t_0) * (h / l)))
else
tmp = (abs(d) / sqrt((l * h))) * (1.0d0 - (((((0.25d0 * ((m * d_1) / d)) * (d_1 / (d + d))) * m) * h) / l))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.pow(((M * D) / (2.0 * d)), 2.0);
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) * t_0) * (h / l)))) <= 5e+107) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 - ((0.5 * t_0) * (h / l)));
} else {
tmp = (Math.abs(d) / Math.sqrt((l * h))) * (1.0 - (((((0.25 * ((M * D) / d)) * (D / (d + d))) * M) * h) / l));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.pow(((M * D) / (2.0 * d)), 2.0) 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) * t_0) * (h / l)))) <= 5e+107: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 - ((0.5 * t_0) * (h / l))) else: tmp = (math.fabs(d) / math.sqrt((l * h))) * (1.0 - (((((0.25 * ((M * D) / d)) * (D / (d + d))) * M) * h) / l)) return tmp
function code(d, h, l, M, D) t_0 = Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0 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) * t_0) * Float64(h / l)))) <= 5e+107) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(Float64(0.5 * t_0) * Float64(h / l)))); else tmp = Float64(Float64(abs(d) / sqrt(Float64(l * h))) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(0.25 * Float64(Float64(M * D) / d)) * Float64(D / Float64(d + d))) * M) * h) / l))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = ((M * D) / (2.0 * d)) ^ 2.0; tmp = 0.0; if (((((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * t_0) * (h / l)))) <= 5e+107) tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((0.5 * t_0) * (h / l))); else tmp = (abs(d) / sqrt((l * h))) * (1.0 - (((((0.25 * ((M * D) / d)) * (D / (d + d))) * M) * h) / l)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, 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] * t$95$0), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+107], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(0.5 * t$95$0), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(N[(0.25 * N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(D / N[(d + d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\\
\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 t\_0\right) \cdot \frac{h}{\ell}\right) \leq 5 \cdot 10^{+107}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \left(0.5 \cdot t\_0\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \frac{\left(\left(\left(0.25 \cdot \frac{M \cdot D}{d}\right) \cdot \frac{D}{d + d}\right) \cdot M\right) \cdot h}{\ell}\right)\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 5.0000000000000002e107Initial program 66.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6466.3
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.3
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6466.3
Applied rewrites66.3%
Evaluated real constant66.3%
if 5.0000000000000002e107 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6465.8
lift-/.f64N/A
metadata-eval65.8
Applied rewrites65.8%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow-prod-downN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6470.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6470.2
Applied rewrites70.2%
Evaluated real constant70.2%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
Applied rewrites73.3%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (/ (fabs d) (sqrt (* l h))))
(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 (* 0.25 (/ (* M D) d))))
(if (<= t_1 0.0)
(* t_0 (- 1.0 (* (/ (* (* M D) t_2) (+ d d)) (/ h l))))
(if (<= t_1 5e+107)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(* t_0 (- 1.0 (/ (* (* (* t_2 (/ D (+ d d))) M) h) l)))))))double code(double d, double h, double l, double M, double D) {
double t_0 = fabs(d) / sqrt((l * h));
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 = 0.25 * ((M * D) / d);
double tmp;
if (t_1 <= 0.0) {
tmp = t_0 * (1.0 - ((((M * D) * t_2) / (d + d)) * (h / l)));
} else if (t_1 <= 5e+107) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else {
tmp = t_0 * (1.0 - ((((t_2 * (D / (d + d))) * M) * h) / l));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = abs(d) / sqrt((l * h))
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 = 0.25d0 * ((m * d_1) / d)
if (t_1 <= 0.0d0) then
tmp = t_0 * (1.0d0 - ((((m * d_1) * t_2) / (d + d)) * (h / l)))
else if (t_1 <= 5d+107) then
tmp = sqrt((d / h)) * sqrt((d / l))
else
tmp = t_0 * (1.0d0 - ((((t_2 * (d_1 / (d + d))) * m) * h) / l))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.abs(d) / Math.sqrt((l * h));
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 = 0.25 * ((M * D) / d);
double tmp;
if (t_1 <= 0.0) {
tmp = t_0 * (1.0 - ((((M * D) * t_2) / (d + d)) * (h / l)));
} else if (t_1 <= 5e+107) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else {
tmp = t_0 * (1.0 - ((((t_2 * (D / (d + d))) * M) * h) / l));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.fabs(d) / math.sqrt((l * h)) 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 = 0.25 * ((M * D) / d) tmp = 0 if t_1 <= 0.0: tmp = t_0 * (1.0 - ((((M * D) * t_2) / (d + d)) * (h / l))) elif t_1 <= 5e+107: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) else: tmp = t_0 * (1.0 - ((((t_2 * (D / (d + d))) * M) * h) / l)) return tmp
function code(d, h, l, M, D) t_0 = Float64(abs(d) / sqrt(Float64(l * h))) 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(0.25 * Float64(Float64(M * D) / d)) tmp = 0.0 if (t_1 <= 0.0) tmp = Float64(t_0 * Float64(1.0 - Float64(Float64(Float64(Float64(M * D) * t_2) / Float64(d + d)) * Float64(h / l)))); elseif (t_1 <= 5e+107) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); else tmp = Float64(t_0 * Float64(1.0 - Float64(Float64(Float64(Float64(t_2 * Float64(D / Float64(d + d))) * M) * h) / l))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = abs(d) / sqrt((l * h)); 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 = 0.25 * ((M * D) / d); tmp = 0.0; if (t_1 <= 0.0) tmp = t_0 * (1.0 - ((((M * D) * t_2) / (d + d)) * (h / l))); elseif (t_1 <= 5e+107) tmp = sqrt((d / h)) * sqrt((d / l)); else tmp = t_0 * (1.0 - ((((t_2 * (D / (d + d))) * M) * h) / l)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(l * h), $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[(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[(0.25 * N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[(t$95$0 * N[(1.0 - N[(N[(N[(N[(M * D), $MachinePrecision] * t$95$2), $MachinePrecision] / N[(d + d), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+107], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(1.0 - N[(N[(N[(N[(t$95$2 * N[(D / N[(d + d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := \frac{\left|d\right|}{\sqrt{\ell \cdot h}}\\
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 := 0.25 \cdot \frac{M \cdot D}{d}\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;t\_0 \cdot \left(1 - \frac{\left(M \cdot D\right) \cdot t\_2}{d + d} \cdot \frac{h}{\ell}\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+107}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(1 - \frac{\left(\left(t\_2 \cdot \frac{D}{d + d}\right) \cdot M\right) \cdot h}{\ell}\right)\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6465.8
lift-/.f64N/A
metadata-eval65.8
Applied rewrites65.8%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow-prod-downN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6470.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6470.2
Applied rewrites70.2%
Evaluated real constant70.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-/.f64N/A
metadata-evalN/A
associate-/r*N/A
count-2-revN/A
lift-+.f64N/A
mult-flipN/A
lift-/.f64N/A
lift-*.f64N/A
pow2N/A
associate-*r*N/A
lift-*.f64N/A
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)))) < 5.0000000000000002e107Initial program 66.3%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.9
Applied rewrites23.9%
Taylor expanded in l around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f6431.5
Applied rewrites31.5%
Taylor expanded in h around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6439.0
Applied rewrites39.0%
if 5.0000000000000002e107 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6465.8
lift-/.f64N/A
metadata-eval65.8
Applied rewrites65.8%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow-prod-downN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6470.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6470.2
Applied rewrites70.2%
Evaluated real constant70.2%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
Applied rewrites73.3%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (/ (fabs d) (sqrt (* l h))))
(t_1 (fmin (fabs M) D))
(t_2 (fmax (fabs M) 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)))))
(t_5 (* 0.25 (/ t_3 d))))
(if (<= t_4 0.0)
(* t_0 (- 1.0 (* (/ (* t_2 (* t_5 t_1)) (+ d d)) (/ h l))))
(if (<= t_4 5e+107)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(* t_0 (- 1.0 (/ (* (* (* t_5 (/ t_2 (+ d d))) t_1) h) l)))))))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 = fmax(fabs(M), 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 t_5 = 0.25 * (t_3 / d);
double tmp;
if (t_4 <= 0.0) {
tmp = t_0 * (1.0 - (((t_2 * (t_5 * t_1)) / (d + d)) * (h / l)));
} else if (t_4 <= 5e+107) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else {
tmp = t_0 * (1.0 - ((((t_5 * (t_2 / (d + d))) * t_1) * h) / l));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: tmp
t_0 = abs(d) / sqrt((l * h))
t_1 = fmin(abs(m), d_1)
t_2 = fmax(abs(m), d_1)
t_3 = t_1 * t_2
t_4 = (((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)))
t_5 = 0.25d0 * (t_3 / d)
if (t_4 <= 0.0d0) then
tmp = t_0 * (1.0d0 - (((t_2 * (t_5 * t_1)) / (d + d)) * (h / l)))
else if (t_4 <= 5d+107) then
tmp = sqrt((d / h)) * sqrt((d / l))
else
tmp = t_0 * (1.0d0 - ((((t_5 * (t_2 / (d + d))) * t_1) * h) / l))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.abs(d) / Math.sqrt((l * h));
double t_1 = fmin(Math.abs(M), D);
double t_2 = fmax(Math.abs(M), D);
double t_3 = t_1 * t_2;
double t_4 = (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 t_5 = 0.25 * (t_3 / d);
double tmp;
if (t_4 <= 0.0) {
tmp = t_0 * (1.0 - (((t_2 * (t_5 * t_1)) / (d + d)) * (h / l)));
} else if (t_4 <= 5e+107) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else {
tmp = t_0 * (1.0 - ((((t_5 * (t_2 / (d + d))) * t_1) * h) / l));
}
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 = fmax(math.fabs(M), D) t_3 = t_1 * t_2 t_4 = (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))) t_5 = 0.25 * (t_3 / d) tmp = 0 if t_4 <= 0.0: tmp = t_0 * (1.0 - (((t_2 * (t_5 * t_1)) / (d + d)) * (h / l))) elif t_4 <= 5e+107: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) else: tmp = t_0 * (1.0 - ((((t_5 * (t_2 / (d + d))) * t_1) * h) / l)) return tmp
function code(d, h, l, M, D) t_0 = Float64(abs(d) / sqrt(Float64(l * h))) t_1 = fmin(abs(M), D) t_2 = fmax(abs(M), 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)))) t_5 = Float64(0.25 * Float64(t_3 / d)) tmp = 0.0 if (t_4 <= 0.0) tmp = Float64(t_0 * Float64(1.0 - Float64(Float64(Float64(t_2 * Float64(t_5 * t_1)) / Float64(d + d)) * Float64(h / l)))); elseif (t_4 <= 5e+107) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); else tmp = Float64(t_0 * Float64(1.0 - Float64(Float64(Float64(Float64(t_5 * Float64(t_2 / Float64(d + d))) * t_1) * h) / l))); 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 = max(abs(M), D); t_3 = t_1 * t_2; t_4 = (((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))); t_5 = 0.25 * (t_3 / d); tmp = 0.0; if (t_4 <= 0.0) tmp = t_0 * (1.0 - (((t_2 * (t_5 * t_1)) / (d + d)) * (h / l))); elseif (t_4 <= 5e+107) tmp = sqrt((d / h)) * sqrt((d / l)); else tmp = t_0 * (1.0 - ((((t_5 * (t_2 / (d + d))) * t_1) * h) / l)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Min[N[Abs[M], $MachinePrecision], D], $MachinePrecision]}, Block[{t$95$2 = N[Max[N[Abs[M], $MachinePrecision], D], $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]}, Block[{t$95$5 = N[(0.25 * N[(t$95$3 / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, 0.0], N[(t$95$0 * N[(1.0 - N[(N[(N[(t$95$2 * N[(t$95$5 * t$95$1), $MachinePrecision]), $MachinePrecision] / N[(d + d), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 5e+107], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(1.0 - N[(N[(N[(N[(t$95$5 * N[(t$95$2 / N[(d + d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
t_0 := \frac{\left|d\right|}{\sqrt{\ell \cdot h}}\\
t_1 := \mathsf{min}\left(\left|M\right|, D\right)\\
t_2 := \mathsf{max}\left(\left|M\right|, D\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)\\
t_5 := 0.25 \cdot \frac{t\_3}{d}\\
\mathbf{if}\;t\_4 \leq 0:\\
\;\;\;\;t\_0 \cdot \left(1 - \frac{t\_2 \cdot \left(t\_5 \cdot t\_1\right)}{d + d} \cdot \frac{h}{\ell}\right)\\
\mathbf{elif}\;t\_4 \leq 5 \cdot 10^{+107}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(1 - \frac{\left(\left(t\_5 \cdot \frac{t\_2}{d + d}\right) \cdot t\_1\right) \cdot h}{\ell}\right)\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6465.8
lift-/.f64N/A
metadata-eval65.8
Applied rewrites65.8%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow-prod-downN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6470.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6470.2
Applied rewrites70.2%
Evaluated real constant70.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-/.f64N/A
metadata-evalN/A
associate-/r*N/A
count-2-revN/A
lift-+.f64N/A
mult-flipN/A
lift-/.f64N/A
lift-*.f64N/A
pow2N/A
associate-*r*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
Applied rewrites69.1%
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)))) < 5.0000000000000002e107Initial program 66.3%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.9
Applied rewrites23.9%
Taylor expanded in l around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f6431.5
Applied rewrites31.5%
Taylor expanded in h around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6439.0
Applied rewrites39.0%
if 5.0000000000000002e107 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6465.8
lift-/.f64N/A
metadata-eval65.8
Applied rewrites65.8%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow-prod-downN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6470.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6470.2
Applied rewrites70.2%
Evaluated real constant70.2%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
Applied rewrites73.3%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (fmin M D) (fmax M D)))
(t_1 (* 0.25 (/ t_0 d)))
(t_2
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ t_0 (* 2.0 d)) 2.0)) (/ h l))))))
(if (<= t_2 0.0)
(/
(*
(fma (* (* (* t_1 (fmin M D)) (/ (fmax M D) d)) -0.5) (/ h l) 1.0)
(fabs d))
(sqrt (* h l)))
(if (<= t_2 5e+107)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(*
(/ (fabs d) (sqrt (* l h)))
(- 1.0 (/ (* (* (* t_1 (/ (fmax M D) (+ d d))) (fmin M D)) h) l)))))))double code(double d, double h, double l, double M, double D) {
double t_0 = fmin(M, D) * fmax(M, D);
double t_1 = 0.25 * (t_0 / d);
double t_2 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow((t_0 / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_2 <= 0.0) {
tmp = (fma((((t_1 * fmin(M, D)) * (fmax(M, D) / d)) * -0.5), (h / l), 1.0) * fabs(d)) / sqrt((h * l));
} else if (t_2 <= 5e+107) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else {
tmp = (fabs(d) / sqrt((l * h))) * (1.0 - ((((t_1 * (fmax(M, D) / (d + d))) * fmin(M, D)) * h) / l));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(fmin(M, D) * fmax(M, D)) t_1 = Float64(0.25 * Float64(t_0 / d)) t_2 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(t_0 / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_2 <= 0.0) tmp = Float64(Float64(fma(Float64(Float64(Float64(t_1 * fmin(M, D)) * Float64(fmax(M, D) / d)) * -0.5), Float64(h / l), 1.0) * abs(d)) / sqrt(Float64(h * l))); elseif (t_2 <= 5e+107) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); else tmp = Float64(Float64(abs(d) / sqrt(Float64(l * h))) * Float64(1.0 - Float64(Float64(Float64(Float64(t_1 * Float64(fmax(M, D) / Float64(d + d))) * fmin(M, D)) * h) / l))); 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[(0.25 * N[(t$95$0 / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(t$95$0 / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, 0.0], N[(N[(N[(N[(N[(N[(t$95$1 * N[Min[M, D], $MachinePrecision]), $MachinePrecision] * N[(N[Max[M, D], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision] * N[(h / l), $MachinePrecision] + 1.0), $MachinePrecision] * N[Abs[d], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e+107], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(t$95$1 * N[(N[Max[M, D], $MachinePrecision] / N[(d + d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Min[M, D], $MachinePrecision]), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(M, D\right) \cdot \mathsf{max}\left(M, D\right)\\
t_1 := 0.25 \cdot \frac{t\_0}{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 \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{t\_0}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_2 \leq 0:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(\left(t\_1 \cdot \mathsf{min}\left(M, D\right)\right) \cdot \frac{\mathsf{max}\left(M, D\right)}{d}\right) \cdot -0.5, \frac{h}{\ell}, 1\right) \cdot \left|d\right|}{\sqrt{h \cdot \ell}}\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+107}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \frac{\left(\left(t\_1 \cdot \frac{\mathsf{max}\left(M, D\right)}{d + d}\right) \cdot \mathsf{min}\left(M, D\right)\right) \cdot h}{\ell}\right)\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6465.8
lift-/.f64N/A
metadata-eval65.8
Applied rewrites65.8%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow-prod-downN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6470.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6470.2
Applied rewrites70.2%
Evaluated real constant70.2%
Applied rewrites69.8%
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)))) < 5.0000000000000002e107Initial program 66.3%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.9
Applied rewrites23.9%
Taylor expanded in l around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f6431.5
Applied rewrites31.5%
Taylor expanded in h around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6439.0
Applied rewrites39.0%
if 5.0000000000000002e107 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6465.8
lift-/.f64N/A
metadata-eval65.8
Applied rewrites65.8%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow-prod-downN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6470.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6470.2
Applied rewrites70.2%
Evaluated real constant70.2%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
Applied rewrites73.3%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (fmin M (fabs D)))
(t_1 (fmax M (fabs D)))
(t_2 (* t_0 t_1))
(t_3
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ t_2 (* 2.0 d)) 2.0)) (/ h l))))))
(if (<= t_3 0.0)
(/
(*
(fma (* (* (* (* 0.25 (/ t_2 d)) t_0) (/ t_1 d)) -0.5) (/ h l) 1.0)
(fabs d))
(sqrt (* h l)))
(if (<= t_3 2e+259)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(*
(/ (fabs d) (sqrt (* l h)))
(-
1.0
(/
(* (* t_0 (* (/ (* t_1 (* t_1 t_0)) (* 4.0 (* d d))) h)) 0.5)
l)))))))double code(double d, double h, double l, double M, double D) {
double t_0 = fmin(M, fabs(D));
double t_1 = fmax(M, fabs(D));
double t_2 = t_0 * t_1;
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_2 / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_3 <= 0.0) {
tmp = (fma(((((0.25 * (t_2 / d)) * t_0) * (t_1 / d)) * -0.5), (h / l), 1.0) * fabs(d)) / sqrt((h * l));
} else if (t_3 <= 2e+259) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else {
tmp = (fabs(d) / sqrt((l * h))) * (1.0 - (((t_0 * (((t_1 * (t_1 * t_0)) / (4.0 * (d * d))) * h)) * 0.5) / l));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = fmin(M, abs(D)) t_1 = fmax(M, abs(D)) t_2 = Float64(t_0 * t_1) 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(t_2 / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_3 <= 0.0) tmp = Float64(Float64(fma(Float64(Float64(Float64(Float64(0.25 * Float64(t_2 / d)) * t_0) * Float64(t_1 / d)) * -0.5), Float64(h / l), 1.0) * abs(d)) / sqrt(Float64(h * l))); elseif (t_3 <= 2e+259) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); else tmp = Float64(Float64(abs(d) / sqrt(Float64(l * h))) * Float64(1.0 - Float64(Float64(Float64(t_0 * Float64(Float64(Float64(t_1 * Float64(t_1 * t_0)) / Float64(4.0 * Float64(d * d))) * h)) * 0.5) / l))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Min[M, N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Max[M, N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 * t$95$1), $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[(t$95$2 / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, 0.0], N[(N[(N[(N[(N[(N[(N[(0.25 * N[(t$95$2 / d), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * N[(t$95$1 / d), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision] * N[(h / l), $MachinePrecision] + 1.0), $MachinePrecision] * N[Abs[d], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 2e+259], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(t$95$0 * N[(N[(N[(t$95$1 * N[(t$95$1 * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(4.0 * N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(M, \left|D\right|\right)\\
t_1 := \mathsf{max}\left(M, \left|D\right|\right)\\
t_2 := t\_0 \cdot t\_1\\
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\_2}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_3 \leq 0:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(\left(\left(0.25 \cdot \frac{t\_2}{d}\right) \cdot t\_0\right) \cdot \frac{t\_1}{d}\right) \cdot -0.5, \frac{h}{\ell}, 1\right) \cdot \left|d\right|}{\sqrt{h \cdot \ell}}\\
\mathbf{elif}\;t\_3 \leq 2 \cdot 10^{+259}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \frac{\left(t\_0 \cdot \left(\frac{t\_1 \cdot \left(t\_1 \cdot t\_0\right)}{4 \cdot \left(d \cdot d\right)} \cdot h\right)\right) \cdot 0.5}{\ell}\right)\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6465.8
lift-/.f64N/A
metadata-eval65.8
Applied rewrites65.8%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow-prod-downN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6470.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6470.2
Applied rewrites70.2%
Evaluated real constant70.2%
Applied rewrites69.8%
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)))) < 2e259Initial program 66.3%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.9
Applied rewrites23.9%
Taylor expanded in l around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f6431.5
Applied rewrites31.5%
Taylor expanded in h around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6439.0
Applied rewrites39.0%
if 2e259 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.3%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites54.6%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow-prod-downN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6460.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6460.9
Applied rewrites60.9%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (fmin M D) (fmax M D)))
(t_1
(/
(*
(fma
(* (* (* (* 0.25 (/ t_0 d)) (fmin M D)) (/ (fmax M D) d)) -0.5)
(/ h l)
1.0)
(fabs d))
(sqrt (* h l))))
(t_2
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ t_0 (* 2.0 d)) 2.0)) (/ h l))))))
(if (<= t_2 0.0)
t_1
(if (<= t_2 5e+107) (* (sqrt (/ d h)) (sqrt (/ d l))) t_1))))double code(double d, double h, double l, double M, double D) {
double t_0 = fmin(M, D) * fmax(M, D);
double t_1 = (fma(((((0.25 * (t_0 / d)) * fmin(M, D)) * (fmax(M, D) / d)) * -0.5), (h / l), 1.0) * fabs(d)) / sqrt((h * l));
double t_2 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow((t_0 / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_2 <= 0.0) {
tmp = t_1;
} else if (t_2 <= 5e+107) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else {
tmp = t_1;
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(fmin(M, D) * fmax(M, D)) t_1 = Float64(Float64(fma(Float64(Float64(Float64(Float64(0.25 * Float64(t_0 / d)) * fmin(M, D)) * Float64(fmax(M, D) / d)) * -0.5), Float64(h / l), 1.0) * abs(d)) / sqrt(Float64(h * l))) t_2 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(t_0 / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_2 <= 0.0) tmp = t_1; elseif (t_2 <= 5e+107) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); else tmp = t_1; 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[(N[(N[(N[(N[(N[(N[(0.25 * N[(t$95$0 / d), $MachinePrecision]), $MachinePrecision] * N[Min[M, D], $MachinePrecision]), $MachinePrecision] * N[(N[Max[M, D], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision] * N[(h / l), $MachinePrecision] + 1.0), $MachinePrecision] * N[Abs[d], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(t$95$0 / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, 0.0], t$95$1, If[LessEqual[t$95$2, 5e+107], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(M, D\right) \cdot \mathsf{max}\left(M, D\right)\\
t_1 := \frac{\mathsf{fma}\left(\left(\left(\left(0.25 \cdot \frac{t\_0}{d}\right) \cdot \mathsf{min}\left(M, D\right)\right) \cdot \frac{\mathsf{max}\left(M, D\right)}{d}\right) \cdot -0.5, \frac{h}{\ell}, 1\right) \cdot \left|d\right|}{\sqrt{h \cdot \ell}}\\
t_2 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{t\_0}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_2 \leq 0:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+107}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\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 5.0000000000000002e107 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6465.8
lift-/.f64N/A
metadata-eval65.8
Applied rewrites65.8%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow-prod-downN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6470.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6470.2
Applied rewrites70.2%
Evaluated real constant70.2%
Applied rewrites69.8%
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)))) < 5.0000000000000002e107Initial program 66.3%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.9
Applied rewrites23.9%
Taylor expanded in l around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f6431.5
Applied rewrites31.5%
Taylor expanded in h around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6439.0
Applied rewrites39.0%
(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))))
(t_2 (* t_1 1.0)))
(if (<= t_0 -1e+113)
(*
(fma (* (* (* (* M D) (* M D)) (/ 0.25 (* d d))) -0.5) (/ h l) 1.0)
t_1)
(if (<= t_0 0.0)
t_2
(if (<= t_0 5e+107)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(if (<= t_0 INFINITY)
t_2
(-
(*
(fma M (/ (* (/ (* (* D D) (* M h)) (* d d)) 0.125) l) -1.0)
(/ (fabs d) (sqrt (* h l)))))))))))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));
double t_2 = t_1 * 1.0;
double tmp;
if (t_0 <= -1e+113) {
tmp = fma(((((M * D) * (M * D)) * (0.25 / (d * d))) * -0.5), (h / l), 1.0) * t_1;
} else if (t_0 <= 0.0) {
tmp = t_2;
} else if (t_0 <= 5e+107) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else if (t_0 <= ((double) INFINITY)) {
tmp = t_2;
} else {
tmp = -(fma(M, (((((D * D) * (M * h)) / (d * d)) * 0.125) / l), -1.0) * (fabs(d) / sqrt((h * l))));
}
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(d) / sqrt(Float64(l * h))) t_2 = Float64(t_1 * 1.0) tmp = 0.0 if (t_0 <= -1e+113) tmp = Float64(fma(Float64(Float64(Float64(Float64(M * D) * Float64(M * D)) * Float64(0.25 / Float64(d * d))) * -0.5), Float64(h / l), 1.0) * t_1); elseif (t_0 <= 0.0) tmp = t_2; elseif (t_0 <= 5e+107) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); elseif (t_0 <= Inf) tmp = t_2; else tmp = Float64(-Float64(fma(M, Float64(Float64(Float64(Float64(Float64(D * D) * Float64(M * h)) / Float64(d * d)) * 0.125) / l), -1.0) * Float64(abs(d) / sqrt(Float64(h * l))))); end return 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[d], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * 1.0), $MachinePrecision]}, If[LessEqual[t$95$0, -1e+113], N[(N[(N[(N[(N[(N[(M * D), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] * N[(0.25 / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision] * N[(h / l), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[t$95$0, 0.0], t$95$2, If[LessEqual[t$95$0, 5e+107], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], t$95$2, (-N[(N[(M * N[(N[(N[(N[(N[(D * D), $MachinePrecision] * N[(M * h), $MachinePrecision]), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision] / l), $MachinePrecision] + -1.0), $MachinePrecision] * N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $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 := \frac{\left|d\right|}{\sqrt{\ell \cdot h}}\\
t_2 := t\_1 \cdot 1\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+113}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(\left(M \cdot D\right) \cdot \left(M \cdot D\right)\right) \cdot \frac{0.25}{d \cdot d}\right) \cdot -0.5, \frac{h}{\ell}, 1\right) \cdot t\_1\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+107}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;-\mathsf{fma}\left(M, \frac{\frac{\left(D \cdot D\right) \cdot \left(M \cdot h\right)}{d \cdot d} \cdot 0.125}{\ell}, -1\right) \cdot \frac{\left|d\right|}{\sqrt{h \cdot \ell}}\\
\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)))) < -1e113Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6465.8
lift-/.f64N/A
metadata-eval65.8
Applied rewrites65.8%
Applied rewrites56.9%
if -1e113 < (*.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 5.0000000000000002e107 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6465.8
lift-/.f64N/A
metadata-eval65.8
Applied rewrites65.8%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow-prod-downN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6470.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6470.2
Applied rewrites70.2%
Taylor expanded in d around inf
Applied rewrites43.1%
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)))) < 5.0000000000000002e107Initial program 66.3%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.9
Applied rewrites23.9%
Taylor expanded in l around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f6431.5
Applied rewrites31.5%
Taylor expanded in h around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6439.0
Applied rewrites39.0%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.3%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites54.6%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow-prod-downN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
lift-sqrt.f6443.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6443.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6443.5
Applied rewrites43.5%
Applied rewrites56.0%
(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))))
(t_2 (* t_1 1.0)))
(if (<= t_0 -5e+42)
(* (fma (* (* (/ (* (* D D) M) (* d d)) -0.125) M) (/ h l) 1.0) t_1)
(if (<= t_0 0.0)
t_2
(if (<= t_0 5e+107)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(if (<= t_0 INFINITY)
t_2
(-
(*
(fma M (/ (* (/ (* (* D D) (* M h)) (* d d)) 0.125) l) -1.0)
(/ (fabs d) (sqrt (* h l)))))))))))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));
double t_2 = t_1 * 1.0;
double tmp;
if (t_0 <= -5e+42) {
tmp = fma((((((D * D) * M) / (d * d)) * -0.125) * M), (h / l), 1.0) * t_1;
} else if (t_0 <= 0.0) {
tmp = t_2;
} else if (t_0 <= 5e+107) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else if (t_0 <= ((double) INFINITY)) {
tmp = t_2;
} else {
tmp = -(fma(M, (((((D * D) * (M * h)) / (d * d)) * 0.125) / l), -1.0) * (fabs(d) / sqrt((h * l))));
}
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(d) / sqrt(Float64(l * h))) t_2 = Float64(t_1 * 1.0) tmp = 0.0 if (t_0 <= -5e+42) tmp = Float64(fma(Float64(Float64(Float64(Float64(Float64(D * D) * M) / Float64(d * d)) * -0.125) * M), Float64(h / l), 1.0) * t_1); elseif (t_0 <= 0.0) tmp = t_2; elseif (t_0 <= 5e+107) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); elseif (t_0 <= Inf) tmp = t_2; else tmp = Float64(-Float64(fma(M, Float64(Float64(Float64(Float64(Float64(D * D) * Float64(M * h)) / Float64(d * d)) * 0.125) / l), -1.0) * Float64(abs(d) / sqrt(Float64(h * l))))); end return 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[d], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * 1.0), $MachinePrecision]}, If[LessEqual[t$95$0, -5e+42], N[(N[(N[(N[(N[(N[(N[(D * D), $MachinePrecision] * M), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision] * M), $MachinePrecision] * N[(h / l), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[t$95$0, 0.0], t$95$2, If[LessEqual[t$95$0, 5e+107], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], t$95$2, (-N[(N[(M * N[(N[(N[(N[(N[(D * D), $MachinePrecision] * N[(M * h), $MachinePrecision]), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision] / l), $MachinePrecision] + -1.0), $MachinePrecision] * N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $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 := \frac{\left|d\right|}{\sqrt{\ell \cdot h}}\\
t_2 := t\_1 \cdot 1\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{+42}:\\
\;\;\;\;\mathsf{fma}\left(\left(\frac{\left(D \cdot D\right) \cdot M}{d \cdot d} \cdot -0.125\right) \cdot M, \frac{h}{\ell}, 1\right) \cdot t\_1\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+107}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;-\mathsf{fma}\left(M, \frac{\frac{\left(D \cdot D\right) \cdot \left(M \cdot h\right)}{d \cdot d} \cdot 0.125}{\ell}, -1\right) \cdot \frac{\left|d\right|}{\sqrt{h \cdot \ell}}\\
\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.00000000000000007e42Initial program 66.3%
Applied rewrites29.0%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
distribute-lft1-inN/A
lower-*.f64N/A
Applied rewrites52.8%
if -5.00000000000000007e42 < (*.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 5.0000000000000002e107 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6465.8
lift-/.f64N/A
metadata-eval65.8
Applied rewrites65.8%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow-prod-downN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6470.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6470.2
Applied rewrites70.2%
Taylor expanded in d around inf
Applied rewrites43.1%
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)))) < 5.0000000000000002e107Initial program 66.3%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.9
Applied rewrites23.9%
Taylor expanded in l around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f6431.5
Applied rewrites31.5%
Taylor expanded in h around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6439.0
Applied rewrites39.0%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.3%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites54.6%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow-prod-downN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
lift-sqrt.f6443.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6443.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6443.5
Applied rewrites43.5%
Applied rewrites56.0%
(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))))
(t_2 (* t_1 1.0)))
(if (<= t_0 -5e+42)
(* (fma (* (* (/ (* (* D D) M) (* d d)) -0.125) M) (/ h l) 1.0) t_1)
(if (<= t_0 0.0)
t_2
(if (<= t_0 5e+107)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(if (<= t_0 INFINITY)
t_2
(/
(*
(/ (fabs d) (sqrt (* h l)))
(- l (* (* (/ (* (* D D) (* M h)) (* d d)) 0.125) M)))
l)))))))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));
double t_2 = t_1 * 1.0;
double tmp;
if (t_0 <= -5e+42) {
tmp = fma((((((D * D) * M) / (d * d)) * -0.125) * M), (h / l), 1.0) * t_1;
} else if (t_0 <= 0.0) {
tmp = t_2;
} else if (t_0 <= 5e+107) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else if (t_0 <= ((double) INFINITY)) {
tmp = t_2;
} else {
tmp = ((fabs(d) / sqrt((h * l))) * (l - (((((D * D) * (M * h)) / (d * d)) * 0.125) * M))) / l;
}
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(d) / sqrt(Float64(l * h))) t_2 = Float64(t_1 * 1.0) tmp = 0.0 if (t_0 <= -5e+42) tmp = Float64(fma(Float64(Float64(Float64(Float64(Float64(D * D) * M) / Float64(d * d)) * -0.125) * M), Float64(h / l), 1.0) * t_1); elseif (t_0 <= 0.0) tmp = t_2; elseif (t_0 <= 5e+107) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); elseif (t_0 <= Inf) tmp = t_2; else tmp = Float64(Float64(Float64(abs(d) / sqrt(Float64(h * l))) * Float64(l - Float64(Float64(Float64(Float64(Float64(D * D) * Float64(M * h)) / Float64(d * d)) * 0.125) * M))) / l); end return 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[d], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * 1.0), $MachinePrecision]}, If[LessEqual[t$95$0, -5e+42], N[(N[(N[(N[(N[(N[(N[(D * D), $MachinePrecision] * M), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision] * M), $MachinePrecision] * N[(h / l), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[t$95$0, 0.0], t$95$2, If[LessEqual[t$95$0, 5e+107], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], t$95$2, N[(N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(l - N[(N[(N[(N[(N[(D * D), $MachinePrecision] * N[(M * h), $MachinePrecision]), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision] * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $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 := \frac{\left|d\right|}{\sqrt{\ell \cdot h}}\\
t_2 := t\_1 \cdot 1\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{+42}:\\
\;\;\;\;\mathsf{fma}\left(\left(\frac{\left(D \cdot D\right) \cdot M}{d \cdot d} \cdot -0.125\right) \cdot M, \frac{h}{\ell}, 1\right) \cdot t\_1\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+107}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\left|d\right|}{\sqrt{h \cdot \ell}} \cdot \left(\ell - \left(\frac{\left(D \cdot D\right) \cdot \left(M \cdot h\right)}{d \cdot d} \cdot 0.125\right) \cdot M\right)}{\ell}\\
\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.00000000000000007e42Initial program 66.3%
Applied rewrites29.0%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
distribute-lft1-inN/A
lower-*.f64N/A
Applied rewrites52.8%
if -5.00000000000000007e42 < (*.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 5.0000000000000002e107 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6465.8
lift-/.f64N/A
metadata-eval65.8
Applied rewrites65.8%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow-prod-downN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6470.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6470.2
Applied rewrites70.2%
Taylor expanded in d around inf
Applied rewrites43.1%
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)))) < 5.0000000000000002e107Initial program 66.3%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.9
Applied rewrites23.9%
Taylor expanded in l around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f6431.5
Applied rewrites31.5%
Taylor expanded in h around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6439.0
Applied rewrites39.0%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.3%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites54.6%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow-prod-downN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
lift-sqrt.f6443.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6443.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6443.5
Applied rewrites43.5%
Applied rewrites52.1%
(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))))
(t_2 (* t_1 1.0)))
(if (<= t_0 -5e+42)
(* (fma (* (* (/ (* (* D D) M) (* d d)) -0.125) M) (/ h l) 1.0) t_1)
(if (<= t_0 0.0)
t_2
(if (<= t_0 5e+107) (* (sqrt (/ d h)) (sqrt (/ d l))) t_2)))))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));
double t_2 = t_1 * 1.0;
double tmp;
if (t_0 <= -5e+42) {
tmp = fma((((((D * D) * M) / (d * d)) * -0.125) * M), (h / l), 1.0) * t_1;
} else if (t_0 <= 0.0) {
tmp = t_2;
} else if (t_0 <= 5e+107) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else {
tmp = t_2;
}
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(d) / sqrt(Float64(l * h))) t_2 = Float64(t_1 * 1.0) tmp = 0.0 if (t_0 <= -5e+42) tmp = Float64(fma(Float64(Float64(Float64(Float64(Float64(D * D) * M) / Float64(d * d)) * -0.125) * M), Float64(h / l), 1.0) * t_1); elseif (t_0 <= 0.0) tmp = t_2; elseif (t_0 <= 5e+107) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); else tmp = t_2; end return 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[d], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * 1.0), $MachinePrecision]}, If[LessEqual[t$95$0, -5e+42], N[(N[(N[(N[(N[(N[(N[(D * D), $MachinePrecision] * M), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision] * M), $MachinePrecision] * N[(h / l), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[t$95$0, 0.0], t$95$2, If[LessEqual[t$95$0, 5e+107], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_1 := \frac{\left|d\right|}{\sqrt{\ell \cdot h}}\\
t_2 := t\_1 \cdot 1\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{+42}:\\
\;\;\;\;\mathsf{fma}\left(\left(\frac{\left(D \cdot D\right) \cdot M}{d \cdot d} \cdot -0.125\right) \cdot M, \frac{h}{\ell}, 1\right) \cdot t\_1\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+107}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\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)))) < -5.00000000000000007e42Initial program 66.3%
Applied rewrites29.0%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
distribute-lft1-inN/A
lower-*.f64N/A
Applied rewrites52.8%
if -5.00000000000000007e42 < (*.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 5.0000000000000002e107 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6465.8
lift-/.f64N/A
metadata-eval65.8
Applied rewrites65.8%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow-prod-downN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6470.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6470.2
Applied rewrites70.2%
Taylor expanded in d around inf
Applied rewrites43.1%
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)))) < 5.0000000000000002e107Initial program 66.3%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.9
Applied rewrites23.9%
Taylor expanded in l around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f6431.5
Applied rewrites31.5%
Taylor expanded in h around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6439.0
Applied rewrites39.0%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (/ 1.0 (* h l)))
(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))))))
(if (<= t_1 0.0)
(* (sqrt (sqrt (* t_0 t_0))) (- d))
(if (<= t_1 5e+107)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(* (/ (fabs d) (sqrt (* l h))) 1.0)))))double code(double d, double h, double l, double M, double D) {
double t_0 = 1.0 / (h * 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(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_1 <= 0.0) {
tmp = sqrt(sqrt((t_0 * t_0))) * -d;
} else if (t_1 <= 5e+107) {
tmp = sqrt((d / h)) * sqrt((d / 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 / (h * l)
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)))
if (t_1 <= 0.0d0) then
tmp = sqrt(sqrt((t_0 * t_0))) * -d
else if (t_1 <= 5d+107) then
tmp = sqrt((d / h)) * sqrt((d / 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 t_0 = 1.0 / (h * 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(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double tmp;
if (t_1 <= 0.0) {
tmp = Math.sqrt(Math.sqrt((t_0 * t_0))) * -d;
} else if (t_1 <= 5e+107) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else {
tmp = (Math.abs(d) / Math.sqrt((l * h))) * 1.0;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = 1.0 / (h * 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(((M * D) / (2.0 * d)), 2.0)) * (h / l))) tmp = 0 if t_1 <= 0.0: tmp = math.sqrt(math.sqrt((t_0 * t_0))) * -d elif t_1 <= 5e+107: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) else: tmp = (math.fabs(d) / math.sqrt((l * h))) * 1.0 return tmp
function code(d, h, l, M, D) t_0 = Float64(1.0 / Float64(h * 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(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) tmp = 0.0 if (t_1 <= 0.0) tmp = Float64(sqrt(sqrt(Float64(t_0 * t_0))) * Float64(-d)); elseif (t_1 <= 5e+107) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); else tmp = Float64(Float64(abs(d) / sqrt(Float64(l * h))) * 1.0); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = 1.0 / (h * l); 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))); tmp = 0.0; if (t_1 <= 0.0) tmp = sqrt(sqrt((t_0 * t_0))) * -d; elseif (t_1 <= 5e+107) tmp = sqrt((d / h)) * sqrt((d / l)); else tmp = (abs(d) / sqrt((l * h))) * 1.0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(1.0 / N[(h * l), $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]}, If[LessEqual[t$95$1, 0.0], N[(N[Sqrt[N[Sqrt[N[(t$95$0 * t$95$0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision], If[LessEqual[t$95$1, 5e+107], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \frac{1}{h \cdot \ell}\\
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)\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;\sqrt{\sqrt{t\_0 \cdot t\_0}} \cdot \left(-d\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+107}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|d\right|}{\sqrt{\ell \cdot h}} \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)))) < 0.0Initial program 66.3%
Applied rewrites29.0%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6426.2
Applied rewrites26.2%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-neg.f6426.2
Applied rewrites26.2%
rem-square-sqrtN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6422.5
Applied rewrites22.5%
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)))) < 5.0000000000000002e107Initial program 66.3%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.9
Applied rewrites23.9%
Taylor expanded in l around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f6431.5
Applied rewrites31.5%
Taylor expanded in h around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6439.0
Applied rewrites39.0%
if 5.0000000000000002e107 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6465.8
lift-/.f64N/A
metadata-eval65.8
Applied rewrites65.8%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow-prod-downN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6470.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6470.2
Applied rewrites70.2%
Taylor expanded in d around inf
Applied rewrites43.1%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (/ (fabs d) (sqrt (* l h))) 1.0))
(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))))))
(if (<= t_1 -2e-250)
(* -1.0 (/ (* d (sqrt (/ h l))) h))
(if (<= t_1 0.0)
t_0
(if (<= t_1 5e+107) (* (sqrt (/ d h)) (sqrt (/ d l))) 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 = (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 tmp;
if (t_1 <= -2e-250) {
tmp = -1.0 * ((d * sqrt((h / l))) / h);
} else if (t_1 <= 0.0) {
tmp = t_0;
} else if (t_1 <= 5e+107) {
tmp = sqrt((d / h)) * sqrt((d / l));
} 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
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)))
if (t_1 <= (-2d-250)) then
tmp = (-1.0d0) * ((d * sqrt((h / l))) / h)
else if (t_1 <= 0.0d0) then
tmp = t_0
else if (t_1 <= 5d+107) then
tmp = sqrt((d / h)) * sqrt((d / l))
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;
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 tmp;
if (t_1 <= -2e-250) {
tmp = -1.0 * ((d * Math.sqrt((h / l))) / h);
} else if (t_1 <= 0.0) {
tmp = t_0;
} else if (t_1 <= 5e+107) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else {
tmp = t_0;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = (math.fabs(d) / math.sqrt((l * h))) * 1.0 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))) tmp = 0 if t_1 <= -2e-250: tmp = -1.0 * ((d * math.sqrt((h / l))) / h) elif t_1 <= 0.0: tmp = t_0 elif t_1 <= 5e+107: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) else: tmp = t_0 return tmp
function code(d, h, l, M, D) t_0 = Float64(Float64(abs(d) / sqrt(Float64(l * h))) * 1.0) 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)))) tmp = 0.0 if (t_1 <= -2e-250) tmp = Float64(-1.0 * Float64(Float64(d * sqrt(Float64(h / l))) / h)); elseif (t_1 <= 0.0) tmp = t_0; elseif (t_1 <= 5e+107) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); 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; 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))); tmp = 0.0; if (t_1 <= -2e-250) tmp = -1.0 * ((d * sqrt((h / l))) / h); elseif (t_1 <= 0.0) tmp = t_0; elseif (t_1 <= 5e+107) tmp = sqrt((d / h)) * sqrt((d / l)); else tmp = t_0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $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]}, If[LessEqual[t$95$1, -2e-250], N[(-1.0 * N[(N[(d * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], t$95$0, If[LessEqual[t$95$1, 5e+107], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
t_0 := \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot 1\\
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)\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-250}:\\
\;\;\;\;-1 \cdot \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+107}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\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)))) < -2.0000000000000001e-250Initial program 66.3%
Applied rewrites29.0%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6426.2
Applied rewrites26.2%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6414.1
Applied rewrites14.1%
if -2.0000000000000001e-250 < (*.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 5.0000000000000002e107 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6465.8
lift-/.f64N/A
metadata-eval65.8
Applied rewrites65.8%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow-prod-downN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6470.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6470.2
Applied rewrites70.2%
Taylor expanded in d around inf
Applied rewrites43.1%
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)))) < 5.0000000000000002e107Initial program 66.3%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.9
Applied rewrites23.9%
Taylor expanded in l around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f6431.5
Applied rewrites31.5%
Taylor expanded in h around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6439.0
Applied rewrites39.0%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (/ (fabs d) (sqrt (* l h))) 1.0))
(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))))))
(if (<= t_1 -2e-250)
(* (/ (sqrt (/ h l)) h) (- d))
(if (<= t_1 0.0)
t_0
(if (<= t_1 5e+107) (* (sqrt (/ d h)) (sqrt (/ d l))) 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 = (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 tmp;
if (t_1 <= -2e-250) {
tmp = (sqrt((h / l)) / h) * -d;
} else if (t_1 <= 0.0) {
tmp = t_0;
} else if (t_1 <= 5e+107) {
tmp = sqrt((d / h)) * sqrt((d / l));
} 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
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)))
if (t_1 <= (-2d-250)) then
tmp = (sqrt((h / l)) / h) * -d
else if (t_1 <= 0.0d0) then
tmp = t_0
else if (t_1 <= 5d+107) then
tmp = sqrt((d / h)) * sqrt((d / l))
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;
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 tmp;
if (t_1 <= -2e-250) {
tmp = (Math.sqrt((h / l)) / h) * -d;
} else if (t_1 <= 0.0) {
tmp = t_0;
} else if (t_1 <= 5e+107) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else {
tmp = t_0;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = (math.fabs(d) / math.sqrt((l * h))) * 1.0 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))) tmp = 0 if t_1 <= -2e-250: tmp = (math.sqrt((h / l)) / h) * -d elif t_1 <= 0.0: tmp = t_0 elif t_1 <= 5e+107: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) else: tmp = t_0 return tmp
function code(d, h, l, M, D) t_0 = Float64(Float64(abs(d) / sqrt(Float64(l * h))) * 1.0) 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)))) tmp = 0.0 if (t_1 <= -2e-250) tmp = Float64(Float64(sqrt(Float64(h / l)) / h) * Float64(-d)); elseif (t_1 <= 0.0) tmp = t_0; elseif (t_1 <= 5e+107) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); 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; 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))); tmp = 0.0; if (t_1 <= -2e-250) tmp = (sqrt((h / l)) / h) * -d; elseif (t_1 <= 0.0) tmp = t_0; elseif (t_1 <= 5e+107) tmp = sqrt((d / h)) * sqrt((d / l)); else tmp = t_0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $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]}, If[LessEqual[t$95$1, -2e-250], N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] / h), $MachinePrecision] * (-d)), $MachinePrecision], If[LessEqual[t$95$1, 0.0], t$95$0, If[LessEqual[t$95$1, 5e+107], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
t_0 := \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot 1\\
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)\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-250}:\\
\;\;\;\;\frac{\sqrt{\frac{h}{\ell}}}{h} \cdot \left(-d\right)\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+107}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\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)))) < -2.0000000000000001e-250Initial program 66.3%
Applied rewrites29.0%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6426.2
Applied rewrites26.2%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-neg.f6426.2
Applied rewrites26.2%
Taylor expanded in h around 0
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6413.6
Applied rewrites13.6%
if -2.0000000000000001e-250 < (*.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 5.0000000000000002e107 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6465.8
lift-/.f64N/A
metadata-eval65.8
Applied rewrites65.8%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow-prod-downN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6470.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6470.2
Applied rewrites70.2%
Taylor expanded in d around inf
Applied rewrites43.1%
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)))) < 5.0000000000000002e107Initial program 66.3%
Taylor expanded in h around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.9
Applied rewrites23.9%
Taylor expanded in l around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f6431.5
Applied rewrites31.5%
Taylor expanded in h around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6439.0
Applied rewrites39.0%
(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))))
-2e-250)
(* (/ (sqrt (/ h l)) h) (- d))
(* (/ (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)))) <= -2e-250) {
tmp = (sqrt((h / l)) / h) * -d;
} 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)))) <= (-2d-250)) then
tmp = (sqrt((h / l)) / h) * -d
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)))) <= -2e-250) {
tmp = (Math.sqrt((h / l)) / h) * -d;
} 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)))) <= -2e-250: tmp = (math.sqrt((h / l)) / h) * -d 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)))) <= -2e-250) tmp = Float64(Float64(sqrt(Float64(h / l)) / h) * Float64(-d)); else tmp = Float64(Float64(abs(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)))) <= -2e-250) tmp = (sqrt((h / l)) / h) * -d; 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], -2e-250], N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] / h), $MachinePrecision] * (-d)), $MachinePrecision], N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(l * h), $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 -2 \cdot 10^{-250}:\\
\;\;\;\;\frac{\sqrt{\frac{h}{\ell}}}{h} \cdot \left(-d\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|d\right|}{\sqrt{\ell \cdot h}} \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)))) < -2.0000000000000001e-250Initial program 66.3%
Applied rewrites29.0%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6426.2
Applied rewrites26.2%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-neg.f6426.2
Applied rewrites26.2%
Taylor expanded in h around 0
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6413.6
Applied rewrites13.6%
if -2.0000000000000001e-250 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6465.8
lift-/.f64N/A
metadata-eval65.8
Applied rewrites65.8%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow-prod-downN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6470.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6470.2
Applied rewrites70.2%
Taylor expanded in d around inf
Applied rewrites43.1%
(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-156)
(* d (sqrt (/ 1.0 (* 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)))) <= -5e-156) {
tmp = d * sqrt((1.0 / (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)))) <= (-5d-156)) then
tmp = d * sqrt((1.0d0 / (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)))) <= -5e-156) {
tmp = d * Math.sqrt((1.0 / (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)))) <= -5e-156: tmp = d * math.sqrt((1.0 / (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)))) <= -5e-156) tmp = Float64(d * sqrt(Float64(1.0 / Float64(h * l)))); else tmp = Float64(Float64(abs(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-156) tmp = d * sqrt((1.0 / (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], -5e-156], N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(l * h), $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^{-156}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|d\right|}{\sqrt{\ell \cdot h}} \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.00000000000000007e-156Initial program 66.3%
Applied rewrites29.0%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6426.2
Applied rewrites26.2%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-neg.f6426.2
Applied rewrites26.2%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6427.0
Applied rewrites27.0%
if -5.00000000000000007e-156 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6465.8
lift-/.f64N/A
metadata-eval65.8
Applied rewrites65.8%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow-prod-downN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-*.f64N/A
lift-*.f64N/A
sqrt-divN/A
lower-unsound-sqrt.f32N/A
lower-sqrt.f32N/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lower-unsound-/.f64N/A
lower-fabs.f64N/A
lower-unsound-sqrt.f6470.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6470.2
Applied rewrites70.2%
Taylor expanded in d around inf
Applied rewrites43.1%
(FPCore (d h l M D) :precision binary64 (let* ((t_0 (sqrt (/ 1.0 (* h l))))) (if (<= d 1.65e-127) (* t_0 (- d)) (* d t_0))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((1.0 / (h * l)));
double tmp;
if (d <= 1.65e-127) {
tmp = t_0 * -d;
} 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((1.0d0 / (h * l)))
if (d <= 1.65d-127) then
tmp = t_0 * -d
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((1.0 / (h * l)));
double tmp;
if (d <= 1.65e-127) {
tmp = t_0 * -d;
} else {
tmp = d * t_0;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((1.0 / (h * l))) tmp = 0 if d <= 1.65e-127: tmp = t_0 * -d else: tmp = d * t_0 return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(1.0 / Float64(h * l))) tmp = 0.0 if (d <= 1.65e-127) tmp = Float64(t_0 * Float64(-d)); else tmp = Float64(d * t_0); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((1.0 / (h * l))); tmp = 0.0; if (d <= 1.65e-127) tmp = t_0 * -d; else tmp = d * t_0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, 1.65e-127], N[(t$95$0 * (-d)), $MachinePrecision], N[(d * t$95$0), $MachinePrecision]]]
\begin{array}{l}
t_0 := \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{if}\;d \leq 1.65 \cdot 10^{-127}:\\
\;\;\;\;t\_0 \cdot \left(-d\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot t\_0\\
\end{array}
if d < 1.6499999999999999e-127Initial program 66.3%
Applied rewrites29.0%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6426.2
Applied rewrites26.2%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-neg.f6426.2
Applied rewrites26.2%
if 1.6499999999999999e-127 < d Initial program 66.3%
Applied rewrites29.0%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6426.2
Applied rewrites26.2%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-neg.f6426.2
Applied rewrites26.2%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6427.0
Applied rewrites27.0%
(FPCore (d h l M D) :precision binary64 (* d (sqrt (/ 1.0 (* h l)))))
double code(double d, double h, double l, double M, double D) {
return d * sqrt((1.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 * sqrt((1.0d0 / (h * l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return d * Math.sqrt((1.0 / (h * l)));
}
def code(d, h, l, M, D): return d * math.sqrt((1.0 / (h * l)))
function code(d, h, l, M, D) return Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) end
function tmp = code(d, h, l, M, D) tmp = d * sqrt((1.0 / (h * l))); end
code[d_, h_, l_, M_, D_] := N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
d \cdot \sqrt{\frac{1}{h \cdot \ell}}
Initial program 66.3%
Applied rewrites29.0%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6426.2
Applied rewrites26.2%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-neg.f6426.2
Applied rewrites26.2%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6427.0
Applied rewrites27.0%
herbie shell --seed 2025175
(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)))))