
(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 17 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 (* (/ -0.5 d) (* D M)))
(t_1 (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))))
(t_2
(*
t_1
(-
1.0
(*
(* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0))
(/ h l)))))
(t_3
(*
(/ (fabs d) (sqrt (* h l)))
(-
1.0
(*
(* (* M D) (/ 0.25 d))
(/ (* (* D M) h) (* (+ d d) l)))))))
(if (<= t_2 -1e-147)
(* t_1 (- 1.0 (* t_0 (* t_0 (* 0.5 (/ h l))))))
(if (<= t_2 0.0) t_3 (if (<= t_2 1e+234) (* t_1 1.0) t_3)))))double code(double d, double h, double l, double M, double D) {
double t_0 = (-0.5 / d) * (D * M);
double t_1 = pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0));
double t_2 = t_1 * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_3 = (fabs(d) / sqrt((h * l))) * (1.0 - (((M * D) * (0.25 / d)) * (((D * M) * h) / ((d + d) * l))));
double tmp;
if (t_2 <= -1e-147) {
tmp = t_1 * (1.0 - (t_0 * (t_0 * (0.5 * (h / l)))));
} else if (t_2 <= 0.0) {
tmp = t_3;
} else if (t_2 <= 1e+234) {
tmp = t_1 * 1.0;
} else {
tmp = t_3;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = ((-0.5d0) / d) * (d_1 * m)
t_1 = ((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))
t_2 = t_1 * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
t_3 = (abs(d) / sqrt((h * l))) * (1.0d0 - (((m * d_1) * (0.25d0 / d)) * (((d_1 * m) * h) / ((d + d) * l))))
if (t_2 <= (-1d-147)) then
tmp = t_1 * (1.0d0 - (t_0 * (t_0 * (0.5d0 * (h / l)))))
else if (t_2 <= 0.0d0) then
tmp = t_3
else if (t_2 <= 1d+234) then
tmp = t_1 * 1.0d0
else
tmp = t_3
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (-0.5 / d) * (D * M);
double t_1 = Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0));
double t_2 = t_1 * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_3 = (Math.abs(d) / Math.sqrt((h * l))) * (1.0 - (((M * D) * (0.25 / d)) * (((D * M) * h) / ((d + d) * l))));
double tmp;
if (t_2 <= -1e-147) {
tmp = t_1 * (1.0 - (t_0 * (t_0 * (0.5 * (h / l)))));
} else if (t_2 <= 0.0) {
tmp = t_3;
} else if (t_2 <= 1e+234) {
tmp = t_1 * 1.0;
} else {
tmp = t_3;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = (-0.5 / d) * (D * M) t_1 = math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0)) t_2 = t_1 * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) t_3 = (math.fabs(d) / math.sqrt((h * l))) * (1.0 - (((M * D) * (0.25 / d)) * (((D * M) * h) / ((d + d) * l)))) tmp = 0 if t_2 <= -1e-147: tmp = t_1 * (1.0 - (t_0 * (t_0 * (0.5 * (h / l))))) elif t_2 <= 0.0: tmp = t_3 elif t_2 <= 1e+234: tmp = t_1 * 1.0 else: tmp = t_3 return tmp
function code(d, h, l, M, D) t_0 = Float64(Float64(-0.5 / d) * Float64(D * M)) t_1 = Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) t_2 = Float64(t_1 * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_3 = Float64(Float64(abs(d) / sqrt(Float64(h * l))) * Float64(1.0 - Float64(Float64(Float64(M * D) * Float64(0.25 / d)) * Float64(Float64(Float64(D * M) * h) / Float64(Float64(d + d) * l))))) tmp = 0.0 if (t_2 <= -1e-147) tmp = Float64(t_1 * Float64(1.0 - Float64(t_0 * Float64(t_0 * Float64(0.5 * Float64(h / l)))))); elseif (t_2 <= 0.0) tmp = t_3; elseif (t_2 <= 1e+234) tmp = Float64(t_1 * 1.0); else tmp = t_3; end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (-0.5 / d) * (D * M); t_1 = ((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0)); t_2 = t_1 * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); t_3 = (abs(d) / sqrt((h * l))) * (1.0 - (((M * D) * (0.25 / d)) * (((D * M) * h) / ((d + d) * l)))); tmp = 0.0; if (t_2 <= -1e-147) tmp = t_1 * (1.0 - (t_0 * (t_0 * (0.5 * (h / l))))); elseif (t_2 <= 0.0) tmp = t_3; elseif (t_2 <= 1e+234) tmp = t_1 * 1.0; else tmp = t_3; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(-0.5 / d), $MachinePrecision] * N[(D * M), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(M * D), $MachinePrecision] * N[(0.25 / d), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(D * M), $MachinePrecision] * h), $MachinePrecision] / N[(N[(d + d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e-147], N[(t$95$1 * N[(1.0 - N[(t$95$0 * N[(t$95$0 * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0], t$95$3, If[LessEqual[t$95$2, 1e+234], N[(t$95$1 * 1.0), $MachinePrecision], t$95$3]]]]]]]
\begin{array}{l}
t_0 := \frac{-0.5}{d} \cdot \left(D \cdot M\right)\\
t_1 := {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\\
t_2 := t\_1 \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_3 := \frac{\left|d\right|}{\sqrt{h \cdot \ell}} \cdot \left(1 - \left(\left(M \cdot D\right) \cdot \frac{0.25}{d}\right) \cdot \frac{\left(D \cdot M\right) \cdot h}{\left(d + d\right) \cdot \ell}\right)\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{-147}:\\
\;\;\;\;t\_1 \cdot \left(1 - t\_0 \cdot \left(t\_0 \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)\right)\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 10^{+234}:\\
\;\;\;\;t\_1 \cdot 1\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\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)))) < -9.9999999999999997e-148Initial program 65.8%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-pow.f64N/A
unpow2N/A
sqr-neg-revN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites67.4%
if -9.9999999999999997e-148 < (*.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 1e234 < (*.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 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-fabs-revN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
pow-prod-downN/A
lift-pow.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fabs.f6465.2%
lift-*.f64N/A
Applied rewrites74.7%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
count-2N/A
times-fracN/A
metadata-evalN/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6474.7%
Applied rewrites74.7%
lift-fabs.f64N/A
lift-/.f64N/A
fabs-divN/A
lift-neg.f64N/A
neg-fabsN/A
lift-sqrt.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lower-/.f64N/A
lower-fabs.f6474.7%
lift-*.f64N/A
*-commutativeN/A
lift-*.f6474.7%
Applied rewrites74.7%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 1e234Initial program 65.8%
Taylor expanded in d around inf
Applied rewrites38.8%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (fmax M D) (fmin M D)))
(t_1 (/ (* t_0 h) (* (+ d d) l)))
(t_2 (* (/ (fmax M D) (+ d d)) (fmin M D))))
(if (<= h -1.5e+91)
(*
(* (/ (sqrt (- d)) (sqrt (- h))) (pow (/ d l) (/ 1.0 2.0)))
(- 1.0 (* (* (/ 1.0 2.0) (* t_2 t_2)) (/ h l))))
(if (<= h 3e-297)
(*
(/ (fabs d) (sqrt (* h l)))
(- 1.0 (* (* (* (fmin M D) (fmax M D)) (/ 0.25 d)) t_1)))
(*
(fabs (/ (- d) (* (sqrt l) (sqrt h))))
(- 1.0 (* (/ (* 0.5 t_0) (+ d d)) t_1)))))))double code(double d, double h, double l, double M, double D) {
double t_0 = fmax(M, D) * fmin(M, D);
double t_1 = (t_0 * h) / ((d + d) * l);
double t_2 = (fmax(M, D) / (d + d)) * fmin(M, D);
double tmp;
if (h <= -1.5e+91) {
tmp = ((sqrt(-d) / sqrt(-h)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (t_2 * t_2)) * (h / l)));
} else if (h <= 3e-297) {
tmp = (fabs(d) / sqrt((h * l))) * (1.0 - (((fmin(M, D) * fmax(M, D)) * (0.25 / d)) * t_1));
} else {
tmp = fabs((-d / (sqrt(l) * sqrt(h)))) * (1.0 - (((0.5 * t_0) / (d + d)) * t_1));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = fmax(m, d_1) * fmin(m, d_1)
t_1 = (t_0 * h) / ((d + d) * l)
t_2 = (fmax(m, d_1) / (d + d)) * fmin(m, d_1)
if (h <= (-1.5d+91)) then
tmp = ((sqrt(-d) / sqrt(-h)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (t_2 * t_2)) * (h / l)))
else if (h <= 3d-297) then
tmp = (abs(d) / sqrt((h * l))) * (1.0d0 - (((fmin(m, d_1) * fmax(m, d_1)) * (0.25d0 / d)) * t_1))
else
tmp = abs((-d / (sqrt(l) * sqrt(h)))) * (1.0d0 - (((0.5d0 * t_0) / (d + d)) * t_1))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = fmax(M, D) * fmin(M, D);
double t_1 = (t_0 * h) / ((d + d) * l);
double t_2 = (fmax(M, D) / (d + d)) * fmin(M, D);
double tmp;
if (h <= -1.5e+91) {
tmp = ((Math.sqrt(-d) / Math.sqrt(-h)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (t_2 * t_2)) * (h / l)));
} else if (h <= 3e-297) {
tmp = (Math.abs(d) / Math.sqrt((h * l))) * (1.0 - (((fmin(M, D) * fmax(M, D)) * (0.25 / d)) * t_1));
} else {
tmp = Math.abs((-d / (Math.sqrt(l) * Math.sqrt(h)))) * (1.0 - (((0.5 * t_0) / (d + d)) * t_1));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = fmax(M, D) * fmin(M, D) t_1 = (t_0 * h) / ((d + d) * l) t_2 = (fmax(M, D) / (d + d)) * fmin(M, D) tmp = 0 if h <= -1.5e+91: tmp = ((math.sqrt(-d) / math.sqrt(-h)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (t_2 * t_2)) * (h / l))) elif h <= 3e-297: tmp = (math.fabs(d) / math.sqrt((h * l))) * (1.0 - (((fmin(M, D) * fmax(M, D)) * (0.25 / d)) * t_1)) else: tmp = math.fabs((-d / (math.sqrt(l) * math.sqrt(h)))) * (1.0 - (((0.5 * t_0) / (d + d)) * t_1)) return tmp
function code(d, h, l, M, D) t_0 = Float64(fmax(M, D) * fmin(M, D)) t_1 = Float64(Float64(t_0 * h) / Float64(Float64(d + d) * l)) t_2 = Float64(Float64(fmax(M, D) / Float64(d + d)) * fmin(M, D)) tmp = 0.0 if (h <= -1.5e+91) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * Float64(t_2 * t_2)) * Float64(h / l)))); elseif (h <= 3e-297) tmp = Float64(Float64(abs(d) / sqrt(Float64(h * l))) * Float64(1.0 - Float64(Float64(Float64(fmin(M, D) * fmax(M, D)) * Float64(0.25 / d)) * t_1))); else tmp = Float64(abs(Float64(Float64(-d) / Float64(sqrt(l) * sqrt(h)))) * Float64(1.0 - Float64(Float64(Float64(0.5 * t_0) / Float64(d + d)) * t_1))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = max(M, D) * min(M, D); t_1 = (t_0 * h) / ((d + d) * l); t_2 = (max(M, D) / (d + d)) * min(M, D); tmp = 0.0; if (h <= -1.5e+91) tmp = ((sqrt(-d) / sqrt(-h)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (t_2 * t_2)) * (h / l))); elseif (h <= 3e-297) tmp = (abs(d) / sqrt((h * l))) * (1.0 - (((min(M, D) * max(M, D)) * (0.25 / d)) * t_1)); else tmp = abs((-d / (sqrt(l) * sqrt(h)))) * (1.0 - (((0.5 * t_0) / (d + d)) * t_1)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Max[M, D], $MachinePrecision] * N[Min[M, D], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 * h), $MachinePrecision] / N[(N[(d + d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Max[M, D], $MachinePrecision] / N[(d + d), $MachinePrecision]), $MachinePrecision] * N[Min[M, D], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -1.5e+91], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[(t$95$2 * t$95$2), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 3e-297], N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[Min[M, D], $MachinePrecision] * N[Max[M, D], $MachinePrecision]), $MachinePrecision] * N[(0.25 / d), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Abs[N[((-d) / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(N[(0.5 * t$95$0), $MachinePrecision] / N[(d + d), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := \mathsf{max}\left(M, D\right) \cdot \mathsf{min}\left(M, D\right)\\
t_1 := \frac{t\_0 \cdot h}{\left(d + d\right) \cdot \ell}\\
t_2 := \frac{\mathsf{max}\left(M, D\right)}{d + d} \cdot \mathsf{min}\left(M, D\right)\\
\mathbf{if}\;h \leq -1.5 \cdot 10^{+91}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot \left(t\_2 \cdot t\_2\right)\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{elif}\;h \leq 3 \cdot 10^{-297}:\\
\;\;\;\;\frac{\left|d\right|}{\sqrt{h \cdot \ell}} \cdot \left(1 - \left(\left(\mathsf{min}\left(M, D\right) \cdot \mathsf{max}\left(M, D\right)\right) \cdot \frac{0.25}{d}\right) \cdot t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-d}{\sqrt{\ell} \cdot \sqrt{h}}\right| \cdot \left(1 - \frac{0.5 \cdot t\_0}{d + d} \cdot t\_1\right)\\
\end{array}
if h < -1.5e91Initial program 65.8%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
lower-unsound-/.f64N/A
lower-unsound-sqrt.f64N/A
lower-neg.f64N/A
lower-unsound-sqrt.f64N/A
lower-neg.f6437.7%
Applied rewrites37.7%
lift-pow.f64N/A
unpow2N/A
lower-*.f6437.7%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lift-+.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6437.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lift-+.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6437.5%
Applied rewrites37.5%
if -1.5e91 < h < 2.9999999999999999e-297Initial program 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-fabs-revN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
pow-prod-downN/A
lift-pow.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fabs.f6465.2%
lift-*.f64N/A
Applied rewrites74.7%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
count-2N/A
times-fracN/A
metadata-evalN/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6474.7%
Applied rewrites74.7%
lift-fabs.f64N/A
lift-/.f64N/A
fabs-divN/A
lift-neg.f64N/A
neg-fabsN/A
lift-sqrt.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lower-/.f64N/A
lower-fabs.f6474.7%
lift-*.f64N/A
*-commutativeN/A
lift-*.f6474.7%
Applied rewrites74.7%
if 2.9999999999999999e-297 < h Initial program 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-fabs-revN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
pow-prod-downN/A
lift-pow.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fabs.f6465.2%
lift-*.f64N/A
Applied rewrites74.7%
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
lower-unsound-*.f64N/A
lower-unsound-sqrt.f64N/A
lower-unsound-sqrt.f6441.6%
Applied rewrites41.6%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))))
(t_1
(*
t_0
(-
1.0
(*
(* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0))
(/ h l)))))
(t_2 (/ (* (* D M) h) (* (+ d d) l))))
(if (<= t_1 0.0)
(*
(fabs (/ (- d) (sqrt (* l h))))
(- 1.0 (* (* (/ (* M D) d) 0.25) t_2)))
(if (<= t_1 1e+234)
(* t_0 1.0)
(*
(/ (fabs d) (sqrt (* h l)))
(- 1.0 (* (* (* M D) (/ 0.25 d)) 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));
double t_1 = t_0 * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_2 = ((D * M) * h) / ((d + d) * l);
double tmp;
if (t_1 <= 0.0) {
tmp = fabs((-d / sqrt((l * h)))) * (1.0 - ((((M * D) / d) * 0.25) * t_2));
} else if (t_1 <= 1e+234) {
tmp = t_0 * 1.0;
} else {
tmp = (fabs(d) / sqrt((h * l))) * (1.0 - (((M * D) * (0.25 / d)) * t_2));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: 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 = ((d_1 * m) * h) / ((d + d) * l)
if (t_1 <= 0.0d0) then
tmp = abs((-d / sqrt((l * h)))) * (1.0d0 - ((((m * d_1) / d) * 0.25d0) * t_2))
else if (t_1 <= 1d+234) then
tmp = t_0 * 1.0d0
else
tmp = (abs(d) / sqrt((h * l))) * (1.0d0 - (((m * d_1) * (0.25d0 / d)) * t_2))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = 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 = ((D * M) * h) / ((d + d) * l);
double tmp;
if (t_1 <= 0.0) {
tmp = Math.abs((-d / Math.sqrt((l * h)))) * (1.0 - ((((M * D) / d) * 0.25) * t_2));
} else if (t_1 <= 1e+234) {
tmp = t_0 * 1.0;
} else {
tmp = (Math.abs(d) / Math.sqrt((h * l))) * (1.0 - (((M * D) * (0.25 / d)) * t_2));
}
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 = ((D * M) * h) / ((d + d) * l) tmp = 0 if t_1 <= 0.0: tmp = math.fabs((-d / math.sqrt((l * h)))) * (1.0 - ((((M * D) / d) * 0.25) * t_2)) elif t_1 <= 1e+234: tmp = t_0 * 1.0 else: tmp = (math.fabs(d) / math.sqrt((h * l))) * (1.0 - (((M * D) * (0.25 / d)) * t_2)) 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(Float64(Float64(D * M) * h) / Float64(Float64(d + d) * l)) tmp = 0.0 if (t_1 <= 0.0) tmp = Float64(abs(Float64(Float64(-d) / sqrt(Float64(l * h)))) * Float64(1.0 - Float64(Float64(Float64(Float64(M * D) / d) * 0.25) * t_2))); elseif (t_1 <= 1e+234) tmp = Float64(t_0 * 1.0); else tmp = Float64(Float64(abs(d) / sqrt(Float64(h * l))) * Float64(1.0 - Float64(Float64(Float64(M * D) * Float64(0.25 / d)) * t_2))); 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 = ((D * M) * h) / ((d + d) * l); tmp = 0.0; if (t_1 <= 0.0) tmp = abs((-d / sqrt((l * h)))) * (1.0 - ((((M * D) / d) * 0.25) * t_2)); elseif (t_1 <= 1e+234) tmp = t_0 * 1.0; else tmp = (abs(d) / sqrt((h * l))) * (1.0 - (((M * D) * (0.25 / d)) * t_2)); 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[(N[(D * M), $MachinePrecision] * h), $MachinePrecision] / N[(N[(d + d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[(N[Abs[N[((-d) / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision] * 0.25), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+234], N[(t$95$0 * 1.0), $MachinePrecision], N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(M * D), $MachinePrecision] * N[(0.25 / d), $MachinePrecision]), $MachinePrecision] * t$95$2), $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 \cdot M\right) \cdot h}{\left(d + d\right) \cdot \ell}\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;\left|\frac{-d}{\sqrt{\ell \cdot h}}\right| \cdot \left(1 - \left(\frac{M \cdot D}{d} \cdot 0.25\right) \cdot t\_2\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+234}:\\
\;\;\;\;t\_0 \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|d\right|}{\sqrt{h \cdot \ell}} \cdot \left(1 - \left(\left(M \cdot D\right) \cdot \frac{0.25}{d}\right) \cdot t\_2\right)\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0Initial program 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-fabs-revN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
pow-prod-downN/A
lift-pow.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fabs.f6465.2%
lift-*.f64N/A
Applied rewrites74.7%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
count-2N/A
times-fracN/A
metadata-evalN/A
lift-/.f64N/A
*-commutativeN/A
lift-*.f6474.7%
Applied rewrites74.7%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 1e234Initial program 65.8%
Taylor expanded in d around inf
Applied rewrites38.8%
if 1e234 < (*.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 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-fabs-revN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
pow-prod-downN/A
lift-pow.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fabs.f6465.2%
lift-*.f64N/A
Applied rewrites74.7%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
count-2N/A
times-fracN/A
metadata-evalN/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6474.7%
Applied rewrites74.7%
lift-fabs.f64N/A
lift-/.f64N/A
fabs-divN/A
lift-neg.f64N/A
neg-fabsN/A
lift-sqrt.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lower-/.f64N/A
lower-fabs.f6474.7%
lift-*.f64N/A
*-commutativeN/A
lift-*.f6474.7%
Applied rewrites74.7%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(-
1.0
(*
(* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0))
(/ h l)))))
(t_1 (/ (* (* D M) h) (* (+ d d) l))))
(if (<= t_0 0.0)
(*
(fabs (/ (- d) (sqrt (* l h))))
(- 1.0 (* (* (/ (* M D) d) 0.25) t_1)))
(if (<= t_0 1e+234)
(* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0)
(*
(/ (fabs d) (sqrt (* h l)))
(- 1.0 (* (* (* M D) (/ 0.25 d)) t_1)))))))double code(double d, double h, double l, double M, double D) {
double t_0 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_1 = ((D * M) * h) / ((d + d) * l);
double tmp;
if (t_0 <= 0.0) {
tmp = fabs((-d / sqrt((l * h)))) * (1.0 - ((((M * D) / d) * 0.25) * t_1));
} else if (t_0 <= 1e+234) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
} else {
tmp = (fabs(d) / sqrt((h * l))) * (1.0 - (((M * D) * (0.25 / d)) * t_1));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
t_1 = ((d_1 * m) * h) / ((d + d) * l)
if (t_0 <= 0.0d0) then
tmp = abs((-d / sqrt((l * h)))) * (1.0d0 - ((((m * d_1) / d) * 0.25d0) * t_1))
else if (t_0 <= 1d+234) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0d0
else
tmp = (abs(d) / sqrt((h * l))) * (1.0d0 - (((m * d_1) * (0.25d0 / d)) * t_1))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_1 = ((D * M) * h) / ((d + d) * l);
double tmp;
if (t_0 <= 0.0) {
tmp = Math.abs((-d / Math.sqrt((l * h)))) * (1.0 - ((((M * D) / d) * 0.25) * t_1));
} else if (t_0 <= 1e+234) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * 1.0;
} else {
tmp = (Math.abs(d) / Math.sqrt((h * l))) * (1.0 - (((M * D) * (0.25 / d)) * t_1));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) t_1 = ((D * M) * h) / ((d + d) * l) tmp = 0 if t_0 <= 0.0: tmp = math.fabs((-d / math.sqrt((l * h)))) * (1.0 - ((((M * D) / d) * 0.25) * t_1)) elif t_0 <= 1e+234: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * 1.0 else: tmp = (math.fabs(d) / math.sqrt((h * l))) * (1.0 - (((M * D) * (0.25 / d)) * t_1)) return tmp
function code(d, h, l, M, D) t_0 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_1 = Float64(Float64(Float64(D * M) * h) / Float64(Float64(d + d) * l)) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(abs(Float64(Float64(-d) / sqrt(Float64(l * h)))) * Float64(1.0 - Float64(Float64(Float64(Float64(M * D) / d) * 0.25) * t_1))); elseif (t_0 <= 1e+234) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0); else tmp = Float64(Float64(abs(d) / sqrt(Float64(h * l))) * Float64(1.0 - Float64(Float64(Float64(M * D) * Float64(0.25 / d)) * t_1))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); t_1 = ((D * M) * h) / ((d + d) * l); tmp = 0.0; if (t_0 <= 0.0) tmp = abs((-d / sqrt((l * h)))) * (1.0 - ((((M * D) / d) * 0.25) * t_1)); elseif (t_0 <= 1e+234) tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0; else tmp = (abs(d) / sqrt((h * l))) * (1.0 - (((M * D) * (0.25 / d)) * t_1)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(D * M), $MachinePrecision] * h), $MachinePrecision] / N[(N[(d + d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(N[Abs[N[((-d) / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision] * 0.25), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e+234], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(M * D), $MachinePrecision] * N[(0.25 / d), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_1 := \frac{\left(D \cdot M\right) \cdot h}{\left(d + d\right) \cdot \ell}\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;\left|\frac{-d}{\sqrt{\ell \cdot h}}\right| \cdot \left(1 - \left(\frac{M \cdot D}{d} \cdot 0.25\right) \cdot t\_1\right)\\
\mathbf{elif}\;t\_0 \leq 10^{+234}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|d\right|}{\sqrt{h \cdot \ell}} \cdot \left(1 - \left(\left(M \cdot D\right) \cdot \frac{0.25}{d}\right) \cdot t\_1\right)\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0Initial program 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-fabs-revN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
pow-prod-downN/A
lift-pow.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fabs.f6465.2%
lift-*.f64N/A
Applied rewrites74.7%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
count-2N/A
times-fracN/A
metadata-evalN/A
lift-/.f64N/A
*-commutativeN/A
lift-*.f6474.7%
Applied rewrites74.7%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 1e234Initial program 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-fabs-revN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
pow-prod-downN/A
lift-pow.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fabs.f6465.2%
lift-*.f64N/A
Applied rewrites74.7%
Taylor expanded in d around inf
Applied rewrites43.0%
lift-fabs.f64N/A
lift-/.f64N/A
fabs-divN/A
lift-neg.f64N/A
neg-fabsN/A
rem-sqrt-square-revN/A
lift-*.f64N/A
lift-sqrt.f64N/A
sqrt-fabs-revN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
sqrt-undivN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
times-fracN/A
lift-/.f64N/A
sqrt-prodN/A
lower-unsound-*.f64N/A
lower-unsound-sqrt.f64N/A
lower-unsound-sqrt.f64N/A
lower-/.f6438.8%
Applied rewrites38.8%
if 1e234 < (*.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 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-fabs-revN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
pow-prod-downN/A
lift-pow.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fabs.f6465.2%
lift-*.f64N/A
Applied rewrites74.7%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
count-2N/A
times-fracN/A
metadata-evalN/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6474.7%
Applied rewrites74.7%
lift-fabs.f64N/A
lift-/.f64N/A
fabs-divN/A
lift-neg.f64N/A
neg-fabsN/A
lift-sqrt.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lower-/.f64N/A
lower-fabs.f6474.7%
lift-*.f64N/A
*-commutativeN/A
lift-*.f6474.7%
Applied rewrites74.7%
(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 (* h l)))
(-
1.0
(*
(* (* M D) (/ 0.25 d))
(/ (* (* D M) h) (* (+ d d) l)))))))
(if (<= t_0 0.0)
t_1
(if (<= t_0 1e+234)
(* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0)
t_1))))double code(double d, double h, double l, double M, double D) {
double t_0 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_1 = (fabs(d) / sqrt((h * l))) * (1.0 - (((M * D) * (0.25 / d)) * (((D * M) * h) / ((d + d) * l))));
double tmp;
if (t_0 <= 0.0) {
tmp = t_1;
} else if (t_0 <= 1e+234) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
t_1 = (abs(d) / sqrt((h * l))) * (1.0d0 - (((m * d_1) * (0.25d0 / d)) * (((d_1 * m) * h) / ((d + d) * l))))
if (t_0 <= 0.0d0) then
tmp = t_1
else if (t_0 <= 1d+234) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0d0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_1 = (Math.abs(d) / Math.sqrt((h * l))) * (1.0 - (((M * D) * (0.25 / d)) * (((D * M) * h) / ((d + d) * l))));
double tmp;
if (t_0 <= 0.0) {
tmp = t_1;
} else if (t_0 <= 1e+234) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * 1.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) t_1 = (math.fabs(d) / math.sqrt((h * l))) * (1.0 - (((M * D) * (0.25 / d)) * (((D * M) * h) / ((d + d) * l)))) tmp = 0 if t_0 <= 0.0: tmp = t_1 elif t_0 <= 1e+234: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * 1.0 else: tmp = t_1 return tmp
function code(d, h, l, M, D) t_0 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_1 = Float64(Float64(abs(d) / sqrt(Float64(h * l))) * Float64(1.0 - Float64(Float64(Float64(M * D) * Float64(0.25 / d)) * Float64(Float64(Float64(D * M) * h) / Float64(Float64(d + d) * l))))) tmp = 0.0 if (t_0 <= 0.0) tmp = t_1; elseif (t_0 <= 1e+234) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0); else tmp = t_1; end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); t_1 = (abs(d) / sqrt((h * l))) * (1.0 - (((M * D) * (0.25 / d)) * (((D * M) * h) / ((d + d) * l)))); tmp = 0.0; if (t_0 <= 0.0) tmp = t_1; elseif (t_0 <= 1e+234) tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0; else tmp = t_1; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(M * D), $MachinePrecision] * N[(0.25 / d), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(D * M), $MachinePrecision] * h), $MachinePrecision] / N[(N[(d + d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], t$95$1, If[LessEqual[t$95$0, 1e+234], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_1 := \frac{\left|d\right|}{\sqrt{h \cdot \ell}} \cdot \left(1 - \left(\left(M \cdot D\right) \cdot \frac{0.25}{d}\right) \cdot \frac{\left(D \cdot M\right) \cdot h}{\left(d + d\right) \cdot \ell}\right)\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 10^{+234}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0 or 1e234 < (*.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 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-fabs-revN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
pow-prod-downN/A
lift-pow.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fabs.f6465.2%
lift-*.f64N/A
Applied rewrites74.7%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
count-2N/A
times-fracN/A
metadata-evalN/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6474.7%
Applied rewrites74.7%
lift-fabs.f64N/A
lift-/.f64N/A
fabs-divN/A
lift-neg.f64N/A
neg-fabsN/A
lift-sqrt.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lower-/.f64N/A
lower-fabs.f6474.7%
lift-*.f64N/A
*-commutativeN/A
lift-*.f6474.7%
Applied rewrites74.7%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 1e234Initial program 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-fabs-revN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
pow-prod-downN/A
lift-pow.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fabs.f6465.2%
lift-*.f64N/A
Applied rewrites74.7%
Taylor expanded in d around inf
Applied rewrites43.0%
lift-fabs.f64N/A
lift-/.f64N/A
fabs-divN/A
lift-neg.f64N/A
neg-fabsN/A
rem-sqrt-square-revN/A
lift-*.f64N/A
lift-sqrt.f64N/A
sqrt-fabs-revN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
sqrt-undivN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
times-fracN/A
lift-/.f64N/A
sqrt-prodN/A
lower-unsound-*.f64N/A
lower-unsound-sqrt.f64N/A
lower-unsound-sqrt.f64N/A
lower-/.f6438.8%
Applied rewrites38.8%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (* D M) h))
(t_1 (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 (/ (* M D) (* 2.0 d)) 2.0))
(/ h l)))))
(t_3 (* (+ d d) l)))
(if (<= t_2 0.0)
(-
(*
(fma (/ (* 0.25 t_0) (* d t_3)) (* D M) -1.0)
(/ (fabs d) t_1)))
(if (<= t_2 2e+256)
(* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0)
(/
(* (- 1.0 (/ (* t_0 (* (* D M) 0.25)) (* t_3 d))) (fabs d))
t_1)))))double code(double d, double h, double l, double M, double D) {
double t_0 = (D * M) * h;
double t_1 = 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(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_3 = (d + d) * l;
double tmp;
if (t_2 <= 0.0) {
tmp = -(fma(((0.25 * t_0) / (d * t_3)), (D * M), -1.0) * (fabs(d) / t_1));
} else if (t_2 <= 2e+256) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
} else {
tmp = ((1.0 - ((t_0 * ((D * M) * 0.25)) / (t_3 * d))) * fabs(d)) / t_1;
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(Float64(D * M) * h) t_1 = 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(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_3 = Float64(Float64(d + d) * l) tmp = 0.0 if (t_2 <= 0.0) tmp = Float64(-Float64(fma(Float64(Float64(0.25 * t_0) / Float64(d * t_3)), Float64(D * M), -1.0) * Float64(abs(d) / t_1))); elseif (t_2 <= 2e+256) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0); else tmp = Float64(Float64(Float64(1.0 - Float64(Float64(t_0 * Float64(Float64(D * M) * 0.25)) / Float64(t_3 * d))) * abs(d)) / t_1); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(D * M), $MachinePrecision] * h), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(h * l), $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[(d + d), $MachinePrecision] * l), $MachinePrecision]}, If[LessEqual[t$95$2, 0.0], (-N[(N[(N[(N[(0.25 * t$95$0), $MachinePrecision] / N[(d * t$95$3), $MachinePrecision]), $MachinePrecision] * N[(D * M), $MachinePrecision] + -1.0), $MachinePrecision] * N[(N[Abs[d], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), If[LessEqual[t$95$2, 2e+256], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(N[(1.0 - N[(N[(t$95$0 * N[(N[(D * M), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] / N[(t$95$3 * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Abs[d], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]]]]]]]
\begin{array}{l}
t_0 := \left(D \cdot M\right) \cdot h\\
t_1 := \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{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_3 := \left(d + d\right) \cdot \ell\\
\mathbf{if}\;t\_2 \leq 0:\\
\;\;\;\;-\mathsf{fma}\left(\frac{0.25 \cdot t\_0}{d \cdot t\_3}, D \cdot M, -1\right) \cdot \frac{\left|d\right|}{t\_1}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+256}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 - \frac{t\_0 \cdot \left(\left(D \cdot M\right) \cdot 0.25\right)}{t\_3 \cdot d}\right) \cdot \left|d\right|}{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.0Initial program 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-fabs-revN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
pow-prod-downN/A
lift-pow.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fabs.f6465.2%
lift-*.f64N/A
Applied rewrites74.7%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
count-2N/A
times-fracN/A
metadata-evalN/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6474.7%
Applied rewrites74.7%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
distribute-lft-neg-outN/A
lower-neg.f64N/A
lower-*.f64N/A
Applied rewrites68.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)))) < 2.0000000000000001e256Initial program 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-fabs-revN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
pow-prod-downN/A
lift-pow.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fabs.f6465.2%
lift-*.f64N/A
Applied rewrites74.7%
Taylor expanded in d around inf
Applied rewrites43.0%
lift-fabs.f64N/A
lift-/.f64N/A
fabs-divN/A
lift-neg.f64N/A
neg-fabsN/A
rem-sqrt-square-revN/A
lift-*.f64N/A
lift-sqrt.f64N/A
sqrt-fabs-revN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
sqrt-undivN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
times-fracN/A
lift-/.f64N/A
sqrt-prodN/A
lower-unsound-*.f64N/A
lower-unsound-sqrt.f64N/A
lower-unsound-sqrt.f64N/A
lower-/.f6438.8%
Applied rewrites38.8%
if 2.0000000000000001e256 < (*.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 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-fabs-revN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
pow-prod-downN/A
lift-pow.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fabs.f6465.2%
lift-*.f64N/A
Applied rewrites74.7%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
count-2N/A
times-fracN/A
metadata-evalN/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6474.7%
Applied rewrites74.7%
lift-*.f64N/A
*-commutativeN/A
lift-fabs.f64N/A
lift-/.f64N/A
fabs-divN/A
lift-neg.f64N/A
neg-fabsN/A
lift-sqrt.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites68.7%
(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
(/
(*
(-
1.0
(/ (* (* (* D M) h) (* (* D M) 0.25)) (* (* (+ d d) l) d)))
(fabs d))
(sqrt (* h l)))))
(if (<= t_0 0.0)
t_1
(if (<= t_0 2e+256)
(* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0)
t_1))))double code(double d, double h, double l, double M, double D) {
double t_0 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_1 = ((1.0 - ((((D * M) * h) * ((D * M) * 0.25)) / (((d + d) * l) * d))) * fabs(d)) / sqrt((h * l));
double tmp;
if (t_0 <= 0.0) {
tmp = t_1;
} else if (t_0 <= 2e+256) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
t_1 = ((1.0d0 - ((((d_1 * m) * h) * ((d_1 * m) * 0.25d0)) / (((d + d) * l) * d))) * abs(d)) / sqrt((h * l))
if (t_0 <= 0.0d0) then
tmp = t_1
else if (t_0 <= 2d+256) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0d0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_1 = ((1.0 - ((((D * M) * h) * ((D * M) * 0.25)) / (((d + d) * l) * d))) * Math.abs(d)) / Math.sqrt((h * l));
double tmp;
if (t_0 <= 0.0) {
tmp = t_1;
} else if (t_0 <= 2e+256) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * 1.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) t_1 = ((1.0 - ((((D * M) * h) * ((D * M) * 0.25)) / (((d + d) * l) * d))) * math.fabs(d)) / math.sqrt((h * l)) tmp = 0 if t_0 <= 0.0: tmp = t_1 elif t_0 <= 2e+256: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * 1.0 else: tmp = t_1 return tmp
function code(d, h, l, M, D) t_0 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_1 = Float64(Float64(Float64(1.0 - Float64(Float64(Float64(Float64(D * M) * h) * Float64(Float64(D * M) * 0.25)) / Float64(Float64(Float64(d + d) * l) * d))) * abs(d)) / sqrt(Float64(h * l))) tmp = 0.0 if (t_0 <= 0.0) tmp = t_1; elseif (t_0 <= 2e+256) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0); else tmp = t_1; end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); t_1 = ((1.0 - ((((D * M) * h) * ((D * M) * 0.25)) / (((d + d) * l) * d))) * abs(d)) / sqrt((h * l)); tmp = 0.0; if (t_0 <= 0.0) tmp = t_1; elseif (t_0 <= 2e+256) tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0; else tmp = t_1; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(1.0 - N[(N[(N[(N[(D * M), $MachinePrecision] * h), $MachinePrecision] * N[(N[(D * M), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(d + d), $MachinePrecision] * l), $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Abs[d], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], t$95$1, If[LessEqual[t$95$0, 2e+256], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_1 := \frac{\left(1 - \frac{\left(\left(D \cdot M\right) \cdot h\right) \cdot \left(\left(D \cdot M\right) \cdot 0.25\right)}{\left(\left(d + d\right) \cdot \ell\right) \cdot d}\right) \cdot \left|d\right|}{\sqrt{h \cdot \ell}}\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+256}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0 or 2.0000000000000001e256 < (*.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 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-fabs-revN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
pow-prod-downN/A
lift-pow.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fabs.f6465.2%
lift-*.f64N/A
Applied rewrites74.7%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
count-2N/A
times-fracN/A
metadata-evalN/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6474.7%
Applied rewrites74.7%
lift-*.f64N/A
*-commutativeN/A
lift-fabs.f64N/A
lift-/.f64N/A
fabs-divN/A
lift-neg.f64N/A
neg-fabsN/A
lift-sqrt.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites68.7%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.0000000000000001e256Initial program 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-fabs-revN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
pow-prod-downN/A
lift-pow.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fabs.f6465.2%
lift-*.f64N/A
Applied rewrites74.7%
Taylor expanded in d around inf
Applied rewrites43.0%
lift-fabs.f64N/A
lift-/.f64N/A
fabs-divN/A
lift-neg.f64N/A
neg-fabsN/A
rem-sqrt-square-revN/A
lift-*.f64N/A
lift-sqrt.f64N/A
sqrt-fabs-revN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
sqrt-undivN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
times-fracN/A
lift-/.f64N/A
sqrt-prodN/A
lower-unsound-*.f64N/A
lower-unsound-sqrt.f64N/A
lower-unsound-sqrt.f64N/A
lower-/.f6438.8%
Applied rewrites38.8%
(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 (/ (* (fmin M D) (fmax M D)) (* 2.0 d)) 2.0))
(/ h l)))))
(t_1 (sqrt (* h l)))
(t_2
(*
(fma
(*
(* (* (* (* (fmax M D) (fmax M D)) h) 0.25) (fmin M D))
(/ (fmin M D) (* (* d d) l)))
-0.5
1.0)
(/ (fabs d) t_1))))
(if (<= t_0 -2e-45)
t_2
(if (<= t_0 0.0)
(* (fabs (* d (/ -1.0 t_1))) 1.0)
(if (<= t_0 1e+234)
(* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0)
(if (<= t_0 INFINITY)
(* (* (sqrt (/ 1.0 (* h l))) (fabs d)) 1.0)
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(((fmin(M, D) * fmax(M, D)) / (2.0 * d)), 2.0)) * (h / l)));
double t_1 = sqrt((h * l));
double t_2 = fma((((((fmax(M, D) * fmax(M, D)) * h) * 0.25) * fmin(M, D)) * (fmin(M, D) / ((d * d) * l))), -0.5, 1.0) * (fabs(d) / t_1);
double tmp;
if (t_0 <= -2e-45) {
tmp = t_2;
} else if (t_0 <= 0.0) {
tmp = fabs((d * (-1.0 / t_1))) * 1.0;
} else if (t_0 <= 1e+234) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
} else if (t_0 <= ((double) INFINITY)) {
tmp = (sqrt((1.0 / (h * l))) * fabs(d)) * 1.0;
} 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(fmin(M, D) * fmax(M, D)) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_1 = sqrt(Float64(h * l)) t_2 = Float64(fma(Float64(Float64(Float64(Float64(Float64(fmax(M, D) * fmax(M, D)) * h) * 0.25) * fmin(M, D)) * Float64(fmin(M, D) / Float64(Float64(d * d) * l))), -0.5, 1.0) * Float64(abs(d) / t_1)) tmp = 0.0 if (t_0 <= -2e-45) tmp = t_2; elseif (t_0 <= 0.0) tmp = Float64(abs(Float64(d * Float64(-1.0 / t_1))) * 1.0); elseif (t_0 <= 1e+234) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0); elseif (t_0 <= Inf) tmp = Float64(Float64(sqrt(Float64(1.0 / Float64(h * l))) * abs(d)) * 1.0); 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[(N[Min[M, D], $MachinePrecision] * N[Max[M, D], $MachinePrecision]), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(N[(N[(N[(N[Max[M, D], $MachinePrecision] * N[Max[M, D], $MachinePrecision]), $MachinePrecision] * h), $MachinePrecision] * 0.25), $MachinePrecision] * N[Min[M, D], $MachinePrecision]), $MachinePrecision] * N[(N[Min[M, D], $MachinePrecision] / N[(N[(d * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] * N[(N[Abs[d], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-45], t$95$2, If[LessEqual[t$95$0, 0.0], N[(N[Abs[N[(d * N[(-1.0 / t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[t$95$0, 1e+234], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[(N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Abs[d], $MachinePrecision]), $MachinePrecision] * 1.0), $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{\mathsf{min}\left(M, D\right) \cdot \mathsf{max}\left(M, D\right)}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_1 := \sqrt{h \cdot \ell}\\
t_2 := \mathsf{fma}\left(\left(\left(\left(\left(\mathsf{max}\left(M, D\right) \cdot \mathsf{max}\left(M, D\right)\right) \cdot h\right) \cdot 0.25\right) \cdot \mathsf{min}\left(M, D\right)\right) \cdot \frac{\mathsf{min}\left(M, D\right)}{\left(d \cdot d\right) \cdot \ell}, -0.5, 1\right) \cdot \frac{\left|d\right|}{t\_1}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-45}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\left|d \cdot \frac{-1}{t\_1}\right| \cdot 1\\
\mathbf{elif}\;t\_0 \leq 10^{+234}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\left(\sqrt{\frac{1}{h \cdot \ell}} \cdot \left|d\right|\right) \cdot 1\\
\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)))) < -2e-45 or +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 65.8%
Applied rewrites35.9%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6437.3%
Applied rewrites37.3%
Applied rewrites54.2%
if -2e-45 < (*.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 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-fabs-revN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
pow-prod-downN/A
lift-pow.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fabs.f6465.2%
lift-*.f64N/A
Applied rewrites74.7%
Taylor expanded in d around inf
Applied rewrites43.0%
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
lift-neg.f64N/A
remove-double-negN/A
lower-*.f64N/A
metadata-evalN/A
frac-2neg-revN/A
lower-/.f6443.0%
lift-*.f64N/A
*-commutativeN/A
lift-*.f6443.0%
Applied rewrites43.0%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 1e234Initial program 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-fabs-revN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
pow-prod-downN/A
lift-pow.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fabs.f6465.2%
lift-*.f64N/A
Applied rewrites74.7%
Taylor expanded in d around inf
Applied rewrites43.0%
lift-fabs.f64N/A
lift-/.f64N/A
fabs-divN/A
lift-neg.f64N/A
neg-fabsN/A
rem-sqrt-square-revN/A
lift-*.f64N/A
lift-sqrt.f64N/A
sqrt-fabs-revN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
sqrt-undivN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
times-fracN/A
lift-/.f64N/A
sqrt-prodN/A
lower-unsound-*.f64N/A
lower-unsound-sqrt.f64N/A
lower-unsound-sqrt.f64N/A
lower-/.f6438.8%
Applied rewrites38.8%
if 1e234 < (*.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 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-fabs-revN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
pow-prod-downN/A
lift-pow.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fabs.f6465.2%
lift-*.f64N/A
Applied rewrites74.7%
Taylor expanded in d around inf
Applied rewrites43.0%
lift-fabs.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
fabs-mulN/A
div-fabsN/A
metadata-evalN/A
lift-sqrt.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lift-neg.f64N/A
neg-fabsN/A
lower-*.f64N/A
Applied rewrites42.8%
(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
(*
(fma
(* -0.5 h)
(/ (* (* (* D D) 0.25) (* M M)) (* (* d d) l))
1.0)
(/ (fabs d) (sqrt (* l h))))))
(if (<= t_0 -2e-45)
t_1
(if (<= t_0 0.0)
(* (fabs (* d (/ -1.0 (sqrt (* h l))))) 1.0)
(if (<= t_0 1e+234)
(* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0)
(if (<= t_0 INFINITY)
(* (* (sqrt (/ 1.0 (* h l))) (fabs d)) 1.0)
t_1))))))double code(double d, double h, double l, double M, double D) {
double t_0 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_1 = fma((-0.5 * h), ((((D * D) * 0.25) * (M * M)) / ((d * d) * l)), 1.0) * (fabs(d) / sqrt((l * h)));
double tmp;
if (t_0 <= -2e-45) {
tmp = t_1;
} else if (t_0 <= 0.0) {
tmp = fabs((d * (-1.0 / sqrt((h * l))))) * 1.0;
} else if (t_0 <= 1e+234) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
} else if (t_0 <= ((double) INFINITY)) {
tmp = (sqrt((1.0 / (h * l))) * fabs(d)) * 1.0;
} else {
tmp = t_1;
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_1 = Float64(fma(Float64(-0.5 * h), Float64(Float64(Float64(Float64(D * D) * 0.25) * Float64(M * M)) / Float64(Float64(d * d) * l)), 1.0) * Float64(abs(d) / sqrt(Float64(l * h)))) tmp = 0.0 if (t_0 <= -2e-45) tmp = t_1; elseif (t_0 <= 0.0) tmp = Float64(abs(Float64(d * Float64(-1.0 / sqrt(Float64(h * l))))) * 1.0); elseif (t_0 <= 1e+234) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0); elseif (t_0 <= Inf) tmp = Float64(Float64(sqrt(Float64(1.0 / Float64(h * l))) * abs(d)) * 1.0); else tmp = t_1; 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[(N[(-0.5 * h), $MachinePrecision] * N[(N[(N[(N[(D * D), $MachinePrecision] * 0.25), $MachinePrecision] * N[(M * M), $MachinePrecision]), $MachinePrecision] / N[(N[(d * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-45], t$95$1, If[LessEqual[t$95$0, 0.0], N[(N[Abs[N[(d * N[(-1.0 / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[t$95$0, 1e+234], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[(N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Abs[d], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_1 := \mathsf{fma}\left(-0.5 \cdot h, \frac{\left(\left(D \cdot D\right) \cdot 0.25\right) \cdot \left(M \cdot M\right)}{\left(d \cdot d\right) \cdot \ell}, 1\right) \cdot \frac{\left|d\right|}{\sqrt{\ell \cdot h}}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-45}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\left|d \cdot \frac{-1}{\sqrt{h \cdot \ell}}\right| \cdot 1\\
\mathbf{elif}\;t\_0 \leq 10^{+234}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\left(\sqrt{\frac{1}{h \cdot \ell}} \cdot \left|d\right|\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2e-45 or +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 65.8%
Applied rewrites35.9%
Applied rewrites25.0%
rem-square-sqrtN/A
sqrt-unprodN/A
rem-sqrt-square-revN/A
lift-neg.f64N/A
neg-fabsN/A
lower-fabs.f6449.4%
Applied rewrites49.4%
if -2e-45 < (*.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 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-fabs-revN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
pow-prod-downN/A
lift-pow.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fabs.f6465.2%
lift-*.f64N/A
Applied rewrites74.7%
Taylor expanded in d around inf
Applied rewrites43.0%
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
lift-neg.f64N/A
remove-double-negN/A
lower-*.f64N/A
metadata-evalN/A
frac-2neg-revN/A
lower-/.f6443.0%
lift-*.f64N/A
*-commutativeN/A
lift-*.f6443.0%
Applied rewrites43.0%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 1e234Initial program 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-fabs-revN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
pow-prod-downN/A
lift-pow.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fabs.f6465.2%
lift-*.f64N/A
Applied rewrites74.7%
Taylor expanded in d around inf
Applied rewrites43.0%
lift-fabs.f64N/A
lift-/.f64N/A
fabs-divN/A
lift-neg.f64N/A
neg-fabsN/A
rem-sqrt-square-revN/A
lift-*.f64N/A
lift-sqrt.f64N/A
sqrt-fabs-revN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
sqrt-undivN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
times-fracN/A
lift-/.f64N/A
sqrt-prodN/A
lower-unsound-*.f64N/A
lower-unsound-sqrt.f64N/A
lower-unsound-sqrt.f64N/A
lower-/.f6438.8%
Applied rewrites38.8%
if 1e234 < (*.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 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-fabs-revN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
pow-prod-downN/A
lift-pow.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fabs.f6465.2%
lift-*.f64N/A
Applied rewrites74.7%
Taylor expanded in d around inf
Applied rewrites43.0%
lift-fabs.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
fabs-mulN/A
div-fabsN/A
metadata-evalN/A
lift-sqrt.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lift-neg.f64N/A
neg-fabsN/A
lower-*.f64N/A
Applied rewrites42.8%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (fmin (fabs M) (fabs D))) (t_1 (fmax (fabs M) (fabs D))))
(if (<= l -9.2e+95)
(* -1.0 (/ (* d (sqrt (/ -1.0 l))) (sqrt (- h))))
(if (<= l 1.85e-303)
(*
(fma
(* -0.5 h)
(* t_1 (* (* 0.25 t_1) (* t_0 (/ t_0 (* (* d d) l)))))
1.0)
(/ (- d) (sqrt (* l h))))
(* (fabs (/ (- d) (* (sqrt l) (sqrt h)))) 1.0)))))double code(double d, double h, double l, double M, double D) {
double t_0 = fmin(fabs(M), fabs(D));
double t_1 = fmax(fabs(M), fabs(D));
double tmp;
if (l <= -9.2e+95) {
tmp = -1.0 * ((d * sqrt((-1.0 / l))) / sqrt(-h));
} else if (l <= 1.85e-303) {
tmp = fma((-0.5 * h), (t_1 * ((0.25 * t_1) * (t_0 * (t_0 / ((d * d) * l))))), 1.0) * (-d / sqrt((l * h)));
} else {
tmp = fabs((-d / (sqrt(l) * sqrt(h)))) * 1.0;
}
return tmp;
}
function code(d, h, l, M, D) t_0 = fmin(abs(M), abs(D)) t_1 = fmax(abs(M), abs(D)) tmp = 0.0 if (l <= -9.2e+95) tmp = Float64(-1.0 * Float64(Float64(d * sqrt(Float64(-1.0 / l))) / sqrt(Float64(-h)))); elseif (l <= 1.85e-303) tmp = Float64(fma(Float64(-0.5 * h), Float64(t_1 * Float64(Float64(0.25 * t_1) * Float64(t_0 * Float64(t_0 / Float64(Float64(d * d) * l))))), 1.0) * Float64(Float64(-d) / sqrt(Float64(l * h)))); else tmp = Float64(abs(Float64(Float64(-d) / Float64(sqrt(l) * sqrt(h)))) * 1.0); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Min[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Max[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -9.2e+95], N[(-1.0 * N[(N[(d * N[Sqrt[N[(-1.0 / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.85e-303], N[(N[(N[(-0.5 * h), $MachinePrecision] * N[(t$95$1 * N[(N[(0.25 * t$95$1), $MachinePrecision] * N[(t$95$0 * N[(t$95$0 / N[(N[(d * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[((-d) / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Abs[N[((-d) / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(\left|M\right|, \left|D\right|\right)\\
t_1 := \mathsf{max}\left(\left|M\right|, \left|D\right|\right)\\
\mathbf{if}\;\ell \leq -9.2 \cdot 10^{+95}:\\
\;\;\;\;-1 \cdot \frac{d \cdot \sqrt{\frac{-1}{\ell}}}{\sqrt{-h}}\\
\mathbf{elif}\;\ell \leq 1.85 \cdot 10^{-303}:\\
\;\;\;\;\mathsf{fma}\left(-0.5 \cdot h, t\_1 \cdot \left(\left(0.25 \cdot t\_1\right) \cdot \left(t\_0 \cdot \frac{t\_0}{\left(d \cdot d\right) \cdot \ell}\right)\right), 1\right) \cdot \frac{-d}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-d}{\sqrt{\ell} \cdot \sqrt{h}}\right| \cdot 1\\
\end{array}
if l < -9.1999999999999999e95Initial program 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
Applied rewrites28.6%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f6424.1%
Applied rewrites24.1%
if -9.1999999999999999e95 < l < 1.8500000000000001e-303Initial program 65.8%
Applied rewrites35.9%
Applied rewrites25.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6432.2%
Applied rewrites32.2%
if 1.8500000000000001e-303 < l Initial program 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-fabs-revN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
pow-prod-downN/A
lift-pow.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fabs.f6465.2%
lift-*.f64N/A
Applied rewrites74.7%
Taylor expanded in d around inf
Applied rewrites43.0%
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
lower-unsound-*.f64N/A
lower-unsound-sqrt.f64N/A
lower-unsound-sqrt.f6425.7%
Applied rewrites25.7%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (fmin M (fabs D))) (t_1 (fmax M (fabs D))))
(if (<= l -2.15e+58)
(* -1.0 (/ (* d (sqrt (/ -1.0 l))) (sqrt (- h))))
(if (<= l -5e-310)
(/
(*
(fma
(* (* (* 0.25 (* t_1 t_1)) t_0) (/ t_0 (* (* d d) l)))
(* -0.5 h)
1.0)
(- d))
(sqrt (* h l)))
(* (fabs (/ (- d) (* (sqrt l) (sqrt h)))) 1.0)))))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 tmp;
if (l <= -2.15e+58) {
tmp = -1.0 * ((d * sqrt((-1.0 / l))) / sqrt(-h));
} else if (l <= -5e-310) {
tmp = (fma((((0.25 * (t_1 * t_1)) * t_0) * (t_0 / ((d * d) * l))), (-0.5 * h), 1.0) * -d) / sqrt((h * l));
} else {
tmp = fabs((-d / (sqrt(l) * sqrt(h)))) * 1.0;
}
return tmp;
}
function code(d, h, l, M, D) t_0 = fmin(M, abs(D)) t_1 = fmax(M, abs(D)) tmp = 0.0 if (l <= -2.15e+58) tmp = Float64(-1.0 * Float64(Float64(d * sqrt(Float64(-1.0 / l))) / sqrt(Float64(-h)))); elseif (l <= -5e-310) tmp = Float64(Float64(fma(Float64(Float64(Float64(0.25 * Float64(t_1 * t_1)) * t_0) * Float64(t_0 / Float64(Float64(d * d) * l))), Float64(-0.5 * h), 1.0) * Float64(-d)) / sqrt(Float64(h * l))); else tmp = Float64(abs(Float64(Float64(-d) / Float64(sqrt(l) * sqrt(h)))) * 1.0); 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]}, If[LessEqual[l, -2.15e+58], N[(-1.0 * N[(N[(d * N[Sqrt[N[(-1.0 / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-310], N[(N[(N[(N[(N[(N[(0.25 * N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * N[(t$95$0 / N[(N[(d * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-0.5 * h), $MachinePrecision] + 1.0), $MachinePrecision] * (-d)), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Abs[N[((-d) / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(M, \left|D\right|\right)\\
t_1 := \mathsf{max}\left(M, \left|D\right|\right)\\
\mathbf{if}\;\ell \leq -2.15 \cdot 10^{+58}:\\
\;\;\;\;-1 \cdot \frac{d \cdot \sqrt{\frac{-1}{\ell}}}{\sqrt{-h}}\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(\left(0.25 \cdot \left(t\_1 \cdot t\_1\right)\right) \cdot t\_0\right) \cdot \frac{t\_0}{\left(d \cdot d\right) \cdot \ell}, -0.5 \cdot h, 1\right) \cdot \left(-d\right)}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{-d}{\sqrt{\ell} \cdot \sqrt{h}}\right| \cdot 1\\
\end{array}
if l < -2.15e58Initial program 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
Applied rewrites28.6%
Taylor expanded in d around -inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f6424.1%
Applied rewrites24.1%
if -2.15e58 < l < -4.9999999999999847e-310Initial program 65.8%
Applied rewrites35.9%
Applied rewrites25.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites28.9%
if -4.9999999999999847e-310 < l Initial program 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-fabs-revN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
pow-prod-downN/A
lift-pow.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fabs.f6465.2%
lift-*.f64N/A
Applied rewrites74.7%
Taylor expanded in d around inf
Applied rewrites43.0%
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
lower-unsound-*.f64N/A
lower-unsound-sqrt.f64N/A
lower-unsound-sqrt.f6425.7%
Applied rewrites25.7%
(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))))))
(if (<= t_0 -2e+114)
(/ (* d (sqrt (/ -1.0 l))) (sqrt (- h)))
(if (<= t_0 0.0)
(* (fabs (* d (/ -1.0 (sqrt (* h l))))) 1.0)
(if (<= t_0 1e+234)
(* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0)
(* (* (sqrt (/ 1.0 (* h l))) (fabs d)) 1.0))))))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 tmp;
if (t_0 <= -2e+114) {
tmp = (d * sqrt((-1.0 / l))) / sqrt(-h);
} else if (t_0 <= 0.0) {
tmp = fabs((d * (-1.0 / sqrt((h * l))))) * 1.0;
} else if (t_0 <= 1e+234) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
} else {
tmp = (sqrt((1.0 / (h * l))) * fabs(d)) * 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) :: tmp
t_0 = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
if (t_0 <= (-2d+114)) then
tmp = (d * sqrt(((-1.0d0) / l))) / sqrt(-h)
else if (t_0 <= 0.0d0) then
tmp = abs((d * ((-1.0d0) / sqrt((h * l))))) * 1.0d0
else if (t_0 <= 1d+234) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0d0
else
tmp = (sqrt((1.0d0 / (h * l))) * abs(d)) * 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 = (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_0 <= -2e+114) {
tmp = (d * Math.sqrt((-1.0 / l))) / Math.sqrt(-h);
} else if (t_0 <= 0.0) {
tmp = Math.abs((d * (-1.0 / Math.sqrt((h * l))))) * 1.0;
} else if (t_0 <= 1e+234) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * 1.0;
} else {
tmp = (Math.sqrt((1.0 / (h * l))) * Math.abs(d)) * 1.0;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) tmp = 0 if t_0 <= -2e+114: tmp = (d * math.sqrt((-1.0 / l))) / math.sqrt(-h) elif t_0 <= 0.0: tmp = math.fabs((d * (-1.0 / math.sqrt((h * l))))) * 1.0 elif t_0 <= 1e+234: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * 1.0 else: tmp = (math.sqrt((1.0 / (h * l))) * math.fabs(d)) * 1.0 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)))) tmp = 0.0 if (t_0 <= -2e+114) tmp = Float64(Float64(d * sqrt(Float64(-1.0 / l))) / sqrt(Float64(-h))); elseif (t_0 <= 0.0) tmp = Float64(abs(Float64(d * Float64(-1.0 / sqrt(Float64(h * l))))) * 1.0); elseif (t_0 <= 1e+234) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0); else tmp = Float64(Float64(sqrt(Float64(1.0 / Float64(h * l))) * abs(d)) * 1.0); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); tmp = 0.0; if (t_0 <= -2e+114) tmp = (d * sqrt((-1.0 / l))) / sqrt(-h); elseif (t_0 <= 0.0) tmp = abs((d * (-1.0 / sqrt((h * l))))) * 1.0; elseif (t_0 <= 1e+234) tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0; else tmp = (sqrt((1.0 / (h * l))) * abs(d)) * 1.0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e+114], N[(N[(d * N[Sqrt[N[(-1.0 / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[Abs[N[(d * N[(-1.0 / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[t$95$0, 1e+234], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Abs[d], $MachinePrecision]), $MachinePrecision] * 1.0), $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)\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{+114}:\\
\;\;\;\;\frac{d \cdot \sqrt{\frac{-1}{\ell}}}{\sqrt{-h}}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\left|d \cdot \frac{-1}{\sqrt{h \cdot \ell}}\right| \cdot 1\\
\mathbf{elif}\;t\_0 \leq 10^{+234}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\frac{1}{h \cdot \ell}} \cdot \left|d\right|\right) \cdot 1\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2e114Initial program 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
Applied rewrites28.6%
Taylor expanded in d around inf
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f643.3%
Applied rewrites3.3%
if -2e114 < (*.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 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-fabs-revN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
pow-prod-downN/A
lift-pow.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fabs.f6465.2%
lift-*.f64N/A
Applied rewrites74.7%
Taylor expanded in d around inf
Applied rewrites43.0%
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
lift-neg.f64N/A
remove-double-negN/A
lower-*.f64N/A
metadata-evalN/A
frac-2neg-revN/A
lower-/.f6443.0%
lift-*.f64N/A
*-commutativeN/A
lift-*.f6443.0%
Applied rewrites43.0%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 1e234Initial program 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-fabs-revN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
pow-prod-downN/A
lift-pow.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fabs.f6465.2%
lift-*.f64N/A
Applied rewrites74.7%
Taylor expanded in d around inf
Applied rewrites43.0%
lift-fabs.f64N/A
lift-/.f64N/A
fabs-divN/A
lift-neg.f64N/A
neg-fabsN/A
rem-sqrt-square-revN/A
lift-*.f64N/A
lift-sqrt.f64N/A
sqrt-fabs-revN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
sqrt-undivN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
times-fracN/A
lift-/.f64N/A
sqrt-prodN/A
lower-unsound-*.f64N/A
lower-unsound-sqrt.f64N/A
lower-unsound-sqrt.f64N/A
lower-/.f6438.8%
Applied rewrites38.8%
if 1e234 < (*.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 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-fabs-revN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
pow-prod-downN/A
lift-pow.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fabs.f6465.2%
lift-*.f64N/A
Applied rewrites74.7%
Taylor expanded in d around inf
Applied rewrites43.0%
lift-fabs.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
fabs-mulN/A
div-fabsN/A
metadata-evalN/A
lift-sqrt.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lift-neg.f64N/A
neg-fabsN/A
lower-*.f64N/A
Applied rewrites42.8%
(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))))))
(if (<= t_0 -2e+114)
(/ (* d (sqrt (/ -1.0 l))) (sqrt (- h)))
(if (<= t_0 0.0)
(* (fabs (* d (/ -1.0 (sqrt (* h l))))) 1.0)
(if (<= t_0 1e+61)
(* (fabs (/ d (* l (sqrt (/ h l))))) 1.0)
(* (* (sqrt (/ 1.0 (* h l))) (fabs d)) 1.0))))))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 tmp;
if (t_0 <= -2e+114) {
tmp = (d * sqrt((-1.0 / l))) / sqrt(-h);
} else if (t_0 <= 0.0) {
tmp = fabs((d * (-1.0 / sqrt((h * l))))) * 1.0;
} else if (t_0 <= 1e+61) {
tmp = fabs((d / (l * sqrt((h / l))))) * 1.0;
} else {
tmp = (sqrt((1.0 / (h * l))) * fabs(d)) * 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) :: tmp
t_0 = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
if (t_0 <= (-2d+114)) then
tmp = (d * sqrt(((-1.0d0) / l))) / sqrt(-h)
else if (t_0 <= 0.0d0) then
tmp = abs((d * ((-1.0d0) / sqrt((h * l))))) * 1.0d0
else if (t_0 <= 1d+61) then
tmp = abs((d / (l * sqrt((h / l))))) * 1.0d0
else
tmp = (sqrt((1.0d0 / (h * l))) * abs(d)) * 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 = (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_0 <= -2e+114) {
tmp = (d * Math.sqrt((-1.0 / l))) / Math.sqrt(-h);
} else if (t_0 <= 0.0) {
tmp = Math.abs((d * (-1.0 / Math.sqrt((h * l))))) * 1.0;
} else if (t_0 <= 1e+61) {
tmp = Math.abs((d / (l * Math.sqrt((h / l))))) * 1.0;
} else {
tmp = (Math.sqrt((1.0 / (h * l))) * Math.abs(d)) * 1.0;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) tmp = 0 if t_0 <= -2e+114: tmp = (d * math.sqrt((-1.0 / l))) / math.sqrt(-h) elif t_0 <= 0.0: tmp = math.fabs((d * (-1.0 / math.sqrt((h * l))))) * 1.0 elif t_0 <= 1e+61: tmp = math.fabs((d / (l * math.sqrt((h / l))))) * 1.0 else: tmp = (math.sqrt((1.0 / (h * l))) * math.fabs(d)) * 1.0 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)))) tmp = 0.0 if (t_0 <= -2e+114) tmp = Float64(Float64(d * sqrt(Float64(-1.0 / l))) / sqrt(Float64(-h))); elseif (t_0 <= 0.0) tmp = Float64(abs(Float64(d * Float64(-1.0 / sqrt(Float64(h * l))))) * 1.0); elseif (t_0 <= 1e+61) tmp = Float64(abs(Float64(d / Float64(l * sqrt(Float64(h / l))))) * 1.0); else tmp = Float64(Float64(sqrt(Float64(1.0 / Float64(h * l))) * abs(d)) * 1.0); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); tmp = 0.0; if (t_0 <= -2e+114) tmp = (d * sqrt((-1.0 / l))) / sqrt(-h); elseif (t_0 <= 0.0) tmp = abs((d * (-1.0 / sqrt((h * l))))) * 1.0; elseif (t_0 <= 1e+61) tmp = abs((d / (l * sqrt((h / l))))) * 1.0; else tmp = (sqrt((1.0 / (h * l))) * abs(d)) * 1.0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e+114], N[(N[(d * N[Sqrt[N[(-1.0 / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[Abs[N[(d * N[(-1.0 / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[t$95$0, 1e+61], N[(N[Abs[N[(d / N[(l * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Abs[d], $MachinePrecision]), $MachinePrecision] * 1.0), $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)\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{+114}:\\
\;\;\;\;\frac{d \cdot \sqrt{\frac{-1}{\ell}}}{\sqrt{-h}}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\left|d \cdot \frac{-1}{\sqrt{h \cdot \ell}}\right| \cdot 1\\
\mathbf{elif}\;t\_0 \leq 10^{+61}:\\
\;\;\;\;\left|\frac{d}{\ell \cdot \sqrt{\frac{h}{\ell}}}\right| \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\frac{1}{h \cdot \ell}} \cdot \left|d\right|\right) \cdot 1\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2e114Initial program 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
Applied rewrites28.6%
Taylor expanded in d around inf
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f643.3%
Applied rewrites3.3%
if -2e114 < (*.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 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-fabs-revN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
pow-prod-downN/A
lift-pow.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fabs.f6465.2%
lift-*.f64N/A
Applied rewrites74.7%
Taylor expanded in d around inf
Applied rewrites43.0%
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
lift-neg.f64N/A
remove-double-negN/A
lower-*.f64N/A
metadata-evalN/A
frac-2neg-revN/A
lower-/.f6443.0%
lift-*.f64N/A
*-commutativeN/A
lift-*.f6443.0%
Applied rewrites43.0%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 9.9999999999999995e60Initial program 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-fabs-revN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
pow-prod-downN/A
lift-pow.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fabs.f6465.2%
lift-*.f64N/A
Applied rewrites74.7%
Taylor expanded in d around inf
Applied rewrites43.0%
Taylor expanded in l around -inf
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6439.3%
Applied rewrites39.3%
if 9.9999999999999995e60 < (*.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 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-fabs-revN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
pow-prod-downN/A
lift-pow.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fabs.f6465.2%
lift-*.f64N/A
Applied rewrites74.7%
Taylor expanded in d around inf
Applied rewrites43.0%
lift-fabs.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
fabs-mulN/A
div-fabsN/A
metadata-evalN/A
lift-sqrt.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lift-neg.f64N/A
neg-fabsN/A
lower-*.f64N/A
Applied rewrites42.8%
(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))))))
(if (<= t_0 -2e+114)
(/ (* d (sqrt (/ -1.0 l))) (sqrt (- h)))
(if (<= t_0 0.0)
(* (fabs (* d (/ -1.0 (sqrt (* h l))))) 1.0)
(if (<= t_0 1e+61)
(* (fabs (/ d (* h (sqrt (/ l h))))) 1.0)
(* (* (sqrt (/ 1.0 (* h l))) (fabs d)) 1.0))))))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 tmp;
if (t_0 <= -2e+114) {
tmp = (d * sqrt((-1.0 / l))) / sqrt(-h);
} else if (t_0 <= 0.0) {
tmp = fabs((d * (-1.0 / sqrt((h * l))))) * 1.0;
} else if (t_0 <= 1e+61) {
tmp = fabs((d / (h * sqrt((l / h))))) * 1.0;
} else {
tmp = (sqrt((1.0 / (h * l))) * fabs(d)) * 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) :: tmp
t_0 = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
if (t_0 <= (-2d+114)) then
tmp = (d * sqrt(((-1.0d0) / l))) / sqrt(-h)
else if (t_0 <= 0.0d0) then
tmp = abs((d * ((-1.0d0) / sqrt((h * l))))) * 1.0d0
else if (t_0 <= 1d+61) then
tmp = abs((d / (h * sqrt((l / h))))) * 1.0d0
else
tmp = (sqrt((1.0d0 / (h * l))) * abs(d)) * 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 = (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_0 <= -2e+114) {
tmp = (d * Math.sqrt((-1.0 / l))) / Math.sqrt(-h);
} else if (t_0 <= 0.0) {
tmp = Math.abs((d * (-1.0 / Math.sqrt((h * l))))) * 1.0;
} else if (t_0 <= 1e+61) {
tmp = Math.abs((d / (h * Math.sqrt((l / h))))) * 1.0;
} else {
tmp = (Math.sqrt((1.0 / (h * l))) * Math.abs(d)) * 1.0;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) tmp = 0 if t_0 <= -2e+114: tmp = (d * math.sqrt((-1.0 / l))) / math.sqrt(-h) elif t_0 <= 0.0: tmp = math.fabs((d * (-1.0 / math.sqrt((h * l))))) * 1.0 elif t_0 <= 1e+61: tmp = math.fabs((d / (h * math.sqrt((l / h))))) * 1.0 else: tmp = (math.sqrt((1.0 / (h * l))) * math.fabs(d)) * 1.0 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)))) tmp = 0.0 if (t_0 <= -2e+114) tmp = Float64(Float64(d * sqrt(Float64(-1.0 / l))) / sqrt(Float64(-h))); elseif (t_0 <= 0.0) tmp = Float64(abs(Float64(d * Float64(-1.0 / sqrt(Float64(h * l))))) * 1.0); elseif (t_0 <= 1e+61) tmp = Float64(abs(Float64(d / Float64(h * sqrt(Float64(l / h))))) * 1.0); else tmp = Float64(Float64(sqrt(Float64(1.0 / Float64(h * l))) * abs(d)) * 1.0); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); tmp = 0.0; if (t_0 <= -2e+114) tmp = (d * sqrt((-1.0 / l))) / sqrt(-h); elseif (t_0 <= 0.0) tmp = abs((d * (-1.0 / sqrt((h * l))))) * 1.0; elseif (t_0 <= 1e+61) tmp = abs((d / (h * sqrt((l / h))))) * 1.0; else tmp = (sqrt((1.0 / (h * l))) * abs(d)) * 1.0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e+114], N[(N[(d * N[Sqrt[N[(-1.0 / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[Abs[N[(d * N[(-1.0 / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[t$95$0, 1e+61], N[(N[Abs[N[(d / N[(h * N[Sqrt[N[(l / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Abs[d], $MachinePrecision]), $MachinePrecision] * 1.0), $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)\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{+114}:\\
\;\;\;\;\frac{d \cdot \sqrt{\frac{-1}{\ell}}}{\sqrt{-h}}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\left|d \cdot \frac{-1}{\sqrt{h \cdot \ell}}\right| \cdot 1\\
\mathbf{elif}\;t\_0 \leq 10^{+61}:\\
\;\;\;\;\left|\frac{d}{h \cdot \sqrt{\frac{\ell}{h}}}\right| \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\frac{1}{h \cdot \ell}} \cdot \left|d\right|\right) \cdot 1\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2e114Initial program 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
Applied rewrites28.6%
Taylor expanded in d around inf
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f643.3%
Applied rewrites3.3%
if -2e114 < (*.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 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-fabs-revN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
pow-prod-downN/A
lift-pow.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fabs.f6465.2%
lift-*.f64N/A
Applied rewrites74.7%
Taylor expanded in d around inf
Applied rewrites43.0%
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
lift-neg.f64N/A
remove-double-negN/A
lower-*.f64N/A
metadata-evalN/A
frac-2neg-revN/A
lower-/.f6443.0%
lift-*.f64N/A
*-commutativeN/A
lift-*.f6443.0%
Applied rewrites43.0%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 9.9999999999999995e60Initial program 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-fabs-revN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
pow-prod-downN/A
lift-pow.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fabs.f6465.2%
lift-*.f64N/A
Applied rewrites74.7%
Taylor expanded in d around inf
Applied rewrites43.0%
Taylor expanded in h around -inf
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6439.2%
Applied rewrites39.2%
if 9.9999999999999995e60 < (*.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 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-fabs-revN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
pow-prod-downN/A
lift-pow.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fabs.f6465.2%
lift-*.f64N/A
Applied rewrites74.7%
Taylor expanded in d around inf
Applied rewrites43.0%
lift-fabs.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
fabs-mulN/A
div-fabsN/A
metadata-evalN/A
lift-sqrt.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lift-neg.f64N/A
neg-fabsN/A
lower-*.f64N/A
Applied rewrites42.8%
(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+114)
(/ (* d (sqrt (/ -1.0 l))) (sqrt (- h)))
(* (* (sqrt (/ 1.0 (* h l))) (fabs d)) 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+114) {
tmp = (d * sqrt((-1.0 / l))) / sqrt(-h);
} else {
tmp = (sqrt((1.0 / (h * l))) * fabs(d)) * 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+114)) then
tmp = (d * sqrt(((-1.0d0) / l))) / sqrt(-h)
else
tmp = (sqrt((1.0d0 / (h * l))) * abs(d)) * 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+114) {
tmp = (d * Math.sqrt((-1.0 / l))) / Math.sqrt(-h);
} else {
tmp = (Math.sqrt((1.0 / (h * l))) * Math.abs(d)) * 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+114: tmp = (d * math.sqrt((-1.0 / l))) / math.sqrt(-h) else: tmp = (math.sqrt((1.0 / (h * l))) * math.fabs(d)) * 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+114) tmp = Float64(Float64(d * sqrt(Float64(-1.0 / l))) / sqrt(Float64(-h))); else tmp = Float64(Float64(sqrt(Float64(1.0 / Float64(h * l))) * abs(d)) * 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+114) tmp = (d * sqrt((-1.0 / l))) / sqrt(-h); else tmp = (sqrt((1.0 / (h * l))) * abs(d)) * 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+114], N[(N[(d * N[Sqrt[N[(-1.0 / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Abs[d], $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^{+114}:\\
\;\;\;\;\frac{d \cdot \sqrt{\frac{-1}{\ell}}}{\sqrt{-h}}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\frac{1}{h \cdot \ell}} \cdot \left|d\right|\right) \cdot 1\\
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2e114Initial program 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
Applied rewrites28.6%
Taylor expanded in d around inf
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f643.3%
Applied rewrites3.3%
if -2e114 < (*.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 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-fabs-revN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
pow-prod-downN/A
lift-pow.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fabs.f6465.2%
lift-*.f64N/A
Applied rewrites74.7%
Taylor expanded in d around inf
Applied rewrites43.0%
lift-fabs.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
fabs-mulN/A
div-fabsN/A
metadata-evalN/A
lift-sqrt.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
lift-neg.f64N/A
neg-fabsN/A
lower-*.f64N/A
Applied rewrites42.8%
(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+114)
(/ (* d (sqrt (/ -1.0 l))) (sqrt (- h)))
(/ (* (fabs d) 1.0) (sqrt (* h l)))))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+114) {
tmp = (d * sqrt((-1.0 / l))) / sqrt(-h);
} else {
tmp = (fabs(d) * 1.0) / sqrt((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) :: 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+114)) then
tmp = (d * sqrt(((-1.0d0) / l))) / sqrt(-h)
else
tmp = (abs(d) * 1.0d0) / sqrt((h * l))
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+114) {
tmp = (d * Math.sqrt((-1.0 / l))) / Math.sqrt(-h);
} else {
tmp = (Math.abs(d) * 1.0) / Math.sqrt((h * l));
}
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+114: tmp = (d * math.sqrt((-1.0 / l))) / math.sqrt(-h) else: tmp = (math.fabs(d) * 1.0) / math.sqrt((h * l)) 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+114) tmp = Float64(Float64(d * sqrt(Float64(-1.0 / l))) / sqrt(Float64(-h))); else tmp = Float64(Float64(abs(d) * 1.0) / sqrt(Float64(h * l))); 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+114) tmp = (d * sqrt((-1.0 / l))) / sqrt(-h); else tmp = (abs(d) * 1.0) / sqrt((h * l)); 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+114], N[(N[(d * N[Sqrt[N[(-1.0 / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], N[(N[(N[Abs[d], $MachinePrecision] * 1.0), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $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^{+114}:\\
\;\;\;\;\frac{d \cdot \sqrt{\frac{-1}{\ell}}}{\sqrt{-h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|d\right| \cdot 1}{\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)))) < -2e114Initial program 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
Applied rewrites28.6%
Taylor expanded in d around inf
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f643.3%
Applied rewrites3.3%
if -2e114 < (*.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 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-fabs-revN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
pow-prod-downN/A
lift-pow.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fabs.f6465.2%
lift-*.f64N/A
Applied rewrites74.7%
Taylor expanded in d around inf
Applied rewrites43.0%
lift-*.f64N/A
lift-fabs.f64N/A
lift-/.f64N/A
fabs-divN/A
lift-neg.f64N/A
neg-fabsN/A
lift-sqrt.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites43.0%
(FPCore (d h l M D) :precision binary64 (/ (* (fabs d) 1.0) (sqrt (* h l))))
double code(double d, double h, double l, double M, double D) {
return (fabs(d) * 1.0) / sqrt((h * l));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (abs(d) * 1.0d0) / sqrt((h * l))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.abs(d) * 1.0) / Math.sqrt((h * l));
}
def code(d, h, l, M, D): return (math.fabs(d) * 1.0) / math.sqrt((h * l))
function code(d, h, l, M, D) return Float64(Float64(abs(d) * 1.0) / sqrt(Float64(h * l))) end
function tmp = code(d, h, l, M, D) tmp = (abs(d) * 1.0) / sqrt((h * l)); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Abs[d], $MachinePrecision] * 1.0), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\frac{\left|d\right| \cdot 1}{\sqrt{h \cdot \ell}}
Initial program 65.8%
lift-*.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
count-2-revN/A
lower-+.f64N/A
Applied rewrites65.2%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-fabs-revN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
pow-prod-downN/A
lift-pow.f64N/A
lift-pow.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fabs.f6465.2%
lift-*.f64N/A
Applied rewrites74.7%
Taylor expanded in d around inf
Applied rewrites43.0%
lift-*.f64N/A
lift-fabs.f64N/A
lift-/.f64N/A
fabs-divN/A
lift-neg.f64N/A
neg-fabsN/A
lift-sqrt.f64N/A
sqrt-fabs-revN/A
lift-sqrt.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites43.0%
herbie shell --seed 2025214
(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)))))