
(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]
\begin{array}{l}
\\
\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)
\end{array}
Herbie found 13 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]
\begin{array}{l}
\\
\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)
\end{array}
(FPCore (d h l M D)
:precision binary64
(if (<= h -5e-310)
(*
(- (* (pow (sqrt (* h l)) -1.0) d))
(- 1.0 (/ (* (* (pow (* (/ M 2.0) (/ D d)) 2.0) 0.5) h) l)))
(if (<= h 5.7e+135)
(*
(- (- (* (pow (* l h) -0.5) d)))
(- 1.0 (/ (* (* (pow (* (* M 0.5) (/ D d)) 2.0) 0.5) h) l)))
(*
(* (sqrt (/ d l)) (/ (sqrt d) (sqrt h)))
(- 1.0 (* (* 0.5 (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -5e-310) {
tmp = -(pow(sqrt((h * l)), -1.0) * d) * (1.0 - (((pow(((M / 2.0) * (D / d)), 2.0) * 0.5) * h) / l));
} else if (h <= 5.7e+135) {
tmp = -(-(pow((l * h), -0.5) * d)) * (1.0 - (((pow(((M * 0.5) * (D / d)), 2.0) * 0.5) * h) / l));
} else {
tmp = (sqrt((d / l)) * (sqrt(d) / sqrt(h))) * (1.0 - ((0.5 * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (h <= (-5d-310)) then
tmp = -((sqrt((h * l)) ** (-1.0d0)) * d) * (1.0d0 - ((((((m / 2.0d0) * (d_1 / d)) ** 2.0d0) * 0.5d0) * h) / l))
else if (h <= 5.7d+135) then
tmp = -(-(((l * h) ** (-0.5d0)) * d)) * (1.0d0 - ((((((m * 0.5d0) * (d_1 / d)) ** 2.0d0) * 0.5d0) * h) / l))
else
tmp = (sqrt((d / l)) * (sqrt(d) / sqrt(h))) * (1.0d0 - ((0.5d0 * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (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 (h <= -5e-310) {
tmp = -(Math.pow(Math.sqrt((h * l)), -1.0) * d) * (1.0 - (((Math.pow(((M / 2.0) * (D / d)), 2.0) * 0.5) * h) / l));
} else if (h <= 5.7e+135) {
tmp = -(-(Math.pow((l * h), -0.5) * d)) * (1.0 - (((Math.pow(((M * 0.5) * (D / d)), 2.0) * 0.5) * h) / l));
} else {
tmp = (Math.sqrt((d / l)) * (Math.sqrt(d) / Math.sqrt(h))) * (1.0 - ((0.5 * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if h <= -5e-310: tmp = -(math.pow(math.sqrt((h * l)), -1.0) * d) * (1.0 - (((math.pow(((M / 2.0) * (D / d)), 2.0) * 0.5) * h) / l)) elif h <= 5.7e+135: tmp = -(-(math.pow((l * h), -0.5) * d)) * (1.0 - (((math.pow(((M * 0.5) * (D / d)), 2.0) * 0.5) * h) / l)) else: tmp = (math.sqrt((d / l)) * (math.sqrt(d) / math.sqrt(h))) * (1.0 - ((0.5 * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (h <= -5e-310) tmp = Float64(Float64(-Float64((sqrt(Float64(h * l)) ^ -1.0) * d)) * Float64(1.0 - Float64(Float64(Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * 0.5) * h) / l))); elseif (h <= 5.7e+135) tmp = Float64(Float64(-Float64(-Float64((Float64(l * h) ^ -0.5) * d))) * Float64(1.0 - Float64(Float64(Float64((Float64(Float64(M * 0.5) * Float64(D / d)) ^ 2.0) * 0.5) * h) / l))); else tmp = Float64(Float64(sqrt(Float64(d / l)) * Float64(sqrt(d) / sqrt(h))) * Float64(1.0 - Float64(Float64(0.5 * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (h <= -5e-310) tmp = -((sqrt((h * l)) ^ -1.0) * d) * (1.0 - ((((((M / 2.0) * (D / d)) ^ 2.0) * 0.5) * h) / l)); elseif (h <= 5.7e+135) tmp = -(-(((l * h) ^ -0.5) * d)) * (1.0 - ((((((M * 0.5) * (D / d)) ^ 2.0) * 0.5) * h) / l)); else tmp = (sqrt((d / l)) * (sqrt(d) / sqrt(h))) * (1.0 - ((0.5 * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[h, -5e-310], N[((-N[(N[Power[N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision], -1.0], $MachinePrecision] * d), $MachinePrecision]) * N[(1.0 - N[(N[(N[(N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 5.7e+135], N[((-(-N[(N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision] * d), $MachinePrecision])) * N[(1.0 - N[(N[(N[(N[Power[N[(N[(M * 0.5), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(0.5 * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(-{\left(\sqrt{h \cdot \ell}\right)}^{-1} \cdot d\right) \cdot \left(1 - \frac{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}\right)\\
\mathbf{elif}\;h \leq 5.7 \cdot 10^{+135}:\\
\;\;\;\;\left(-\left(-{\left(\ell \cdot h\right)}^{-0.5} \cdot d\right)\right) \cdot \left(1 - \frac{\left({\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \frac{\sqrt{d}}{\sqrt{h}}\right) \cdot \left(1 - \left(0.5 \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\end{array}
\end{array}
if h < -4.999999999999985e-310Initial program 65.3%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites66.8%
Taylor expanded in d around -inf
mul-1-negN/A
lower-neg.f64N/A
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
inv-powN/A
*-commutativeN/A
sqrt-pow1N/A
lower-pow.f64N/A
lift-*.f64N/A
metadata-eval2.9
Applied rewrites2.9%
Taylor expanded in h around -inf
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
sqrt-divN/A
metadata-evalN/A
*-commutativeN/A
inv-powN/A
*-commutativeN/A
lower-pow.f64N/A
*-commutativeN/A
lift-sqrt.f64N/A
*-commutativeN/A
lower-*.f6473.6
Applied rewrites73.6%
if -4.999999999999985e-310 < h < 5.7000000000000002e135Initial program 71.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites72.4%
Taylor expanded in d around -inf
mul-1-negN/A
lower-neg.f64N/A
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
inv-powN/A
*-commutativeN/A
sqrt-pow1N/A
lower-pow.f64N/A
lift-*.f64N/A
metadata-eval80.2
Applied rewrites80.2%
Taylor expanded in M around 0
*-commutativeN/A
lower-*.f6480.2
Applied rewrites80.2%
if 5.7000000000000002e135 < h Initial program 52.3%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f6452.3
Applied rewrites52.3%
lift-/.f64N/A
metadata-eval52.3
Applied rewrites52.3%
lift-/.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lower-/.f64N/A
lift-sqrt.f64N/A
lower-sqrt.f6466.7
Applied rewrites66.7%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l))))
(if (<= h -9e-143)
(*
t_0
(*
(sqrt (/ d h))
(- 1.0 (/ (* (pow (* (/ M 2.0) (/ D d)) 2.0) (* 0.5 h)) l))))
(if (<= h -5e-310)
(* (- d) (sqrt (pow (* l h) -1.0)))
(if (<= h 5.7e+135)
(*
(- (- (* (pow (* l h) -0.5) d)))
(- 1.0 (/ (* (* (pow (* (* M 0.5) (/ D d)) 2.0) 0.5) h) l)))
(*
(* t_0 (/ (sqrt d) (sqrt h)))
(- 1.0 (* (* 0.5 (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double tmp;
if (h <= -9e-143) {
tmp = t_0 * (sqrt((d / h)) * (1.0 - ((pow(((M / 2.0) * (D / d)), 2.0) * (0.5 * h)) / l)));
} else if (h <= -5e-310) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else if (h <= 5.7e+135) {
tmp = -(-(pow((l * h), -0.5) * d)) * (1.0 - (((pow(((M * 0.5) * (D / d)), 2.0) * 0.5) * h) / l));
} else {
tmp = (t_0 * (sqrt(d) / sqrt(h))) * (1.0 - ((0.5 * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((d / l))
if (h <= (-9d-143)) then
tmp = t_0 * (sqrt((d / h)) * (1.0d0 - (((((m / 2.0d0) * (d_1 / d)) ** 2.0d0) * (0.5d0 * h)) / l)))
else if (h <= (-5d-310)) then
tmp = -d * sqrt(((l * h) ** (-1.0d0)))
else if (h <= 5.7d+135) then
tmp = -(-(((l * h) ** (-0.5d0)) * d)) * (1.0d0 - ((((((m * 0.5d0) * (d_1 / d)) ** 2.0d0) * 0.5d0) * h) / l))
else
tmp = (t_0 * (sqrt(d) / sqrt(h))) * (1.0d0 - ((0.5d0 * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / l));
double tmp;
if (h <= -9e-143) {
tmp = t_0 * (Math.sqrt((d / h)) * (1.0 - ((Math.pow(((M / 2.0) * (D / d)), 2.0) * (0.5 * h)) / l)));
} else if (h <= -5e-310) {
tmp = -d * Math.sqrt(Math.pow((l * h), -1.0));
} else if (h <= 5.7e+135) {
tmp = -(-(Math.pow((l * h), -0.5) * d)) * (1.0 - (((Math.pow(((M * 0.5) * (D / d)), 2.0) * 0.5) * h) / l));
} else {
tmp = (t_0 * (Math.sqrt(d) / Math.sqrt(h))) * (1.0 - ((0.5 * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) tmp = 0 if h <= -9e-143: tmp = t_0 * (math.sqrt((d / h)) * (1.0 - ((math.pow(((M / 2.0) * (D / d)), 2.0) * (0.5 * h)) / l))) elif h <= -5e-310: tmp = -d * math.sqrt(math.pow((l * h), -1.0)) elif h <= 5.7e+135: tmp = -(-(math.pow((l * h), -0.5) * d)) * (1.0 - (((math.pow(((M * 0.5) * (D / d)), 2.0) * 0.5) * h) / l)) else: tmp = (t_0 * (math.sqrt(d) / math.sqrt(h))) * (1.0 - ((0.5 * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) tmp = 0.0 if (h <= -9e-143) tmp = Float64(t_0 * Float64(sqrt(Float64(d / h)) * Float64(1.0 - Float64(Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * Float64(0.5 * h)) / l)))); elseif (h <= -5e-310) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); elseif (h <= 5.7e+135) tmp = Float64(Float64(-Float64(-Float64((Float64(l * h) ^ -0.5) * d))) * Float64(1.0 - Float64(Float64(Float64((Float64(Float64(M * 0.5) * Float64(D / d)) ^ 2.0) * 0.5) * h) / l))); else tmp = Float64(Float64(t_0 * Float64(sqrt(d) / sqrt(h))) * Float64(1.0 - Float64(Float64(0.5 * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((d / l)); tmp = 0.0; if (h <= -9e-143) tmp = t_0 * (sqrt((d / h)) * (1.0 - (((((M / 2.0) * (D / d)) ^ 2.0) * (0.5 * h)) / l))); elseif (h <= -5e-310) tmp = -d * sqrt(((l * h) ^ -1.0)); elseif (h <= 5.7e+135) tmp = -(-(((l * h) ^ -0.5) * d)) * (1.0 - ((((((M * 0.5) * (D / d)) ^ 2.0) * 0.5) * h) / l)); else tmp = (t_0 * (sqrt(d) / sqrt(h))) * (1.0 - ((0.5 * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, -9e-143], N[(t$95$0 * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 * h), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -5e-310], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 5.7e+135], N[((-(-N[(N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision] * d), $MachinePrecision])) * N[(1.0 - N[(N[(N[(N[Power[N[(N[(M * 0.5), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(0.5 * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;h \leq -9 \cdot 10^{-143}:\\
\;\;\;\;t\_0 \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 - \frac{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \left(0.5 \cdot h\right)}{\ell}\right)\right)\\
\mathbf{elif}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{elif}\;h \leq 5.7 \cdot 10^{+135}:\\
\;\;\;\;\left(-\left(-{\left(\ell \cdot h\right)}^{-0.5} \cdot d\right)\right) \cdot \left(1 - \frac{\left({\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 \cdot \frac{\sqrt{d}}{\sqrt{h}}\right) \cdot \left(1 - \left(0.5 \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\end{array}
\end{array}
if h < -9.00000000000000001e-143Initial program 66.0%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f6466.0
Applied rewrites66.0%
lift-/.f64N/A
metadata-eval66.0
Applied rewrites66.0%
Applied rewrites67.6%
if -9.00000000000000001e-143 < h < -4.999999999999985e-310Initial program 63.3%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lower-pow.f64N/A
lower-*.f64N/A
lift-/.f64N/A
lift-/.f6456.4
lift-/.f64N/A
metadata-eval56.4
Applied rewrites56.4%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
unpow2N/A
*-commutativeN/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lift-*.f6446.1
Applied rewrites46.1%
Taylor expanded in d around -inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
inv-powN/A
*-commutativeN/A
exp-to-powN/A
lower-sqrt.f64N/A
exp-to-powN/A
lower-pow.f64N/A
lift-*.f6452.2
Applied rewrites52.2%
if -4.999999999999985e-310 < h < 5.7000000000000002e135Initial program 71.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites72.4%
Taylor expanded in d around -inf
mul-1-negN/A
lower-neg.f64N/A
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
inv-powN/A
*-commutativeN/A
sqrt-pow1N/A
lower-pow.f64N/A
lift-*.f64N/A
metadata-eval80.2
Applied rewrites80.2%
Taylor expanded in M around 0
*-commutativeN/A
lower-*.f6480.2
Applied rewrites80.2%
if 5.7000000000000002e135 < h Initial program 52.3%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f6452.3
Applied rewrites52.3%
lift-/.f64N/A
metadata-eval52.3
Applied rewrites52.3%
lift-/.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lower-/.f64N/A
lift-sqrt.f64N/A
lower-sqrt.f6466.7
Applied rewrites66.7%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (/ (* M D) (* 2.0 d)) 2.0))
(t_1 (- (* (pow (* l h) -0.5) d))))
(if (<= h -5e-310)
(* t_1 (- 1.0 (* (* (/ 1.0 2.0) t_0) (/ h l))))
(if (<= h 5.7e+135)
(* (- t_1) (- 1.0 (/ (* (* (pow (* (* M 0.5) (/ D d)) 2.0) 0.5) h) l)))
(*
(* (sqrt (/ d l)) (/ (sqrt d) (sqrt h)))
(- 1.0 (* (* 0.5 t_0) (/ h l))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = pow(((M * D) / (2.0 * d)), 2.0);
double t_1 = -(pow((l * h), -0.5) * d);
double tmp;
if (h <= -5e-310) {
tmp = t_1 * (1.0 - (((1.0 / 2.0) * t_0) * (h / l)));
} else if (h <= 5.7e+135) {
tmp = -t_1 * (1.0 - (((pow(((M * 0.5) * (D / d)), 2.0) * 0.5) * h) / l));
} else {
tmp = (sqrt((d / l)) * (sqrt(d) / sqrt(h))) * (1.0 - ((0.5 * t_0) * (h / l)));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = ((m * d_1) / (2.0d0 * d)) ** 2.0d0
t_1 = -(((l * h) ** (-0.5d0)) * d)
if (h <= (-5d-310)) then
tmp = t_1 * (1.0d0 - (((1.0d0 / 2.0d0) * t_0) * (h / l)))
else if (h <= 5.7d+135) then
tmp = -t_1 * (1.0d0 - ((((((m * 0.5d0) * (d_1 / d)) ** 2.0d0) * 0.5d0) * h) / l))
else
tmp = (sqrt((d / l)) * (sqrt(d) / sqrt(h))) * (1.0d0 - ((0.5d0 * t_0) * (h / l)))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.pow(((M * D) / (2.0 * d)), 2.0);
double t_1 = -(Math.pow((l * h), -0.5) * d);
double tmp;
if (h <= -5e-310) {
tmp = t_1 * (1.0 - (((1.0 / 2.0) * t_0) * (h / l)));
} else if (h <= 5.7e+135) {
tmp = -t_1 * (1.0 - (((Math.pow(((M * 0.5) * (D / d)), 2.0) * 0.5) * h) / l));
} else {
tmp = (Math.sqrt((d / l)) * (Math.sqrt(d) / Math.sqrt(h))) * (1.0 - ((0.5 * t_0) * (h / l)));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.pow(((M * D) / (2.0 * d)), 2.0) t_1 = -(math.pow((l * h), -0.5) * d) tmp = 0 if h <= -5e-310: tmp = t_1 * (1.0 - (((1.0 / 2.0) * t_0) * (h / l))) elif h <= 5.7e+135: tmp = -t_1 * (1.0 - (((math.pow(((M * 0.5) * (D / d)), 2.0) * 0.5) * h) / l)) else: tmp = (math.sqrt((d / l)) * (math.sqrt(d) / math.sqrt(h))) * (1.0 - ((0.5 * t_0) * (h / l))) return tmp
function code(d, h, l, M, D) t_0 = Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0 t_1 = Float64(-Float64((Float64(l * h) ^ -0.5) * d)) tmp = 0.0 if (h <= -5e-310) tmp = Float64(t_1 * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * t_0) * Float64(h / l)))); elseif (h <= 5.7e+135) tmp = Float64(Float64(-t_1) * Float64(1.0 - Float64(Float64(Float64((Float64(Float64(M * 0.5) * Float64(D / d)) ^ 2.0) * 0.5) * h) / l))); else tmp = Float64(Float64(sqrt(Float64(d / l)) * Float64(sqrt(d) / sqrt(h))) * Float64(1.0 - Float64(Float64(0.5 * t_0) * Float64(h / l)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = ((M * D) / (2.0 * d)) ^ 2.0; t_1 = -(((l * h) ^ -0.5) * d); tmp = 0.0; if (h <= -5e-310) tmp = t_1 * (1.0 - (((1.0 / 2.0) * t_0) * (h / l))); elseif (h <= 5.7e+135) tmp = -t_1 * (1.0 - ((((((M * 0.5) * (D / d)) ^ 2.0) * 0.5) * h) / l)); else tmp = (sqrt((d / l)) * (sqrt(d) / sqrt(h))) * (1.0 - ((0.5 * t_0) * (h / l))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = (-N[(N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision] * d), $MachinePrecision])}, If[LessEqual[h, -5e-310], N[(t$95$1 * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * t$95$0), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 5.7e+135], N[((-t$95$1) * N[(1.0 - N[(N[(N[(N[Power[N[(N[(M * 0.5), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(0.5 * t$95$0), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\\
t_1 := -{\left(\ell \cdot h\right)}^{-0.5} \cdot d\\
\mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;t\_1 \cdot \left(1 - \left(\frac{1}{2} \cdot t\_0\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{elif}\;h \leq 5.7 \cdot 10^{+135}:\\
\;\;\;\;\left(-t\_1\right) \cdot \left(1 - \frac{\left({\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \frac{\sqrt{d}}{\sqrt{h}}\right) \cdot \left(1 - \left(0.5 \cdot t\_0\right) \cdot \frac{h}{\ell}\right)\\
\end{array}
\end{array}
if h < -4.999999999999985e-310Initial program 65.3%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lower-pow.f64N/A
lower-*.f64N/A
lift-/.f64N/A
lift-/.f6453.9
lift-/.f64N/A
metadata-eval53.9
Applied rewrites53.9%
Taylor expanded in d around -inf
unpow-prod-downN/A
metadata-evalN/A
metadata-evalN/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
inv-powN/A
*-commutativeN/A
sqrt-pow1N/A
lower-pow.f64N/A
lift-*.f64N/A
metadata-eval69.3
Applied rewrites69.3%
if -4.999999999999985e-310 < h < 5.7000000000000002e135Initial program 71.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites72.4%
Taylor expanded in d around -inf
mul-1-negN/A
lower-neg.f64N/A
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
inv-powN/A
*-commutativeN/A
sqrt-pow1N/A
lower-pow.f64N/A
lift-*.f64N/A
metadata-eval80.2
Applied rewrites80.2%
Taylor expanded in M around 0
*-commutativeN/A
lower-*.f6480.2
Applied rewrites80.2%
if 5.7000000000000002e135 < h Initial program 52.3%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f6452.3
Applied rewrites52.3%
lift-/.f64N/A
metadata-eval52.3
Applied rewrites52.3%
lift-/.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lower-/.f64N/A
lift-sqrt.f64N/A
lower-sqrt.f6466.7
Applied rewrites66.7%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l))) (t_1 (pow (/ (* M D) (* 2.0 d)) 2.0)))
(if (<= d 2.5e-278)
(*
t_0
(*
(sqrt (/ d h))
(- 1.0 (/ (* (pow (* (/ M 2.0) (/ D d)) 2.0) (* 0.5 h)) l))))
(if (<= d 3.6e-162)
(* (* (/ 1.0 (sqrt (* l h))) d) (- 1.0 (* (* (/ 1.0 2.0) t_1) (/ h l))))
(* (* t_0 (/ (sqrt d) (sqrt h))) (- 1.0 (* (* 0.5 t_1) (/ h l))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double t_1 = pow(((M * D) / (2.0 * d)), 2.0);
double tmp;
if (d <= 2.5e-278) {
tmp = t_0 * (sqrt((d / h)) * (1.0 - ((pow(((M / 2.0) * (D / d)), 2.0) * (0.5 * h)) / l)));
} else if (d <= 3.6e-162) {
tmp = ((1.0 / sqrt((l * h))) * d) * (1.0 - (((1.0 / 2.0) * t_1) * (h / l)));
} else {
tmp = (t_0 * (sqrt(d) / sqrt(h))) * (1.0 - ((0.5 * t_1) * (h / l)));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt((d / l))
t_1 = ((m * d_1) / (2.0d0 * d)) ** 2.0d0
if (d <= 2.5d-278) then
tmp = t_0 * (sqrt((d / h)) * (1.0d0 - (((((m / 2.0d0) * (d_1 / d)) ** 2.0d0) * (0.5d0 * h)) / l)))
else if (d <= 3.6d-162) then
tmp = ((1.0d0 / sqrt((l * h))) * d) * (1.0d0 - (((1.0d0 / 2.0d0) * t_1) * (h / l)))
else
tmp = (t_0 * (sqrt(d) / sqrt(h))) * (1.0d0 - ((0.5d0 * t_1) * (h / l)))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / l));
double t_1 = Math.pow(((M * D) / (2.0 * d)), 2.0);
double tmp;
if (d <= 2.5e-278) {
tmp = t_0 * (Math.sqrt((d / h)) * (1.0 - ((Math.pow(((M / 2.0) * (D / d)), 2.0) * (0.5 * h)) / l)));
} else if (d <= 3.6e-162) {
tmp = ((1.0 / Math.sqrt((l * h))) * d) * (1.0 - (((1.0 / 2.0) * t_1) * (h / l)));
} else {
tmp = (t_0 * (Math.sqrt(d) / Math.sqrt(h))) * (1.0 - ((0.5 * t_1) * (h / l)));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) t_1 = math.pow(((M * D) / (2.0 * d)), 2.0) tmp = 0 if d <= 2.5e-278: tmp = t_0 * (math.sqrt((d / h)) * (1.0 - ((math.pow(((M / 2.0) * (D / d)), 2.0) * (0.5 * h)) / l))) elif d <= 3.6e-162: tmp = ((1.0 / math.sqrt((l * h))) * d) * (1.0 - (((1.0 / 2.0) * t_1) * (h / l))) else: tmp = (t_0 * (math.sqrt(d) / math.sqrt(h))) * (1.0 - ((0.5 * t_1) * (h / l))) return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) t_1 = Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0 tmp = 0.0 if (d <= 2.5e-278) tmp = Float64(t_0 * Float64(sqrt(Float64(d / h)) * Float64(1.0 - Float64(Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * Float64(0.5 * h)) / l)))); elseif (d <= 3.6e-162) tmp = Float64(Float64(Float64(1.0 / sqrt(Float64(l * h))) * d) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * t_1) * Float64(h / l)))); else tmp = Float64(Float64(t_0 * Float64(sqrt(d) / sqrt(h))) * Float64(1.0 - Float64(Float64(0.5 * t_1) * Float64(h / l)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((d / l)); t_1 = ((M * D) / (2.0 * d)) ^ 2.0; tmp = 0.0; if (d <= 2.5e-278) tmp = t_0 * (sqrt((d / h)) * (1.0 - (((((M / 2.0) * (D / d)) ^ 2.0) * (0.5 * h)) / l))); elseif (d <= 3.6e-162) tmp = ((1.0 / sqrt((l * h))) * d) * (1.0 - (((1.0 / 2.0) * t_1) * (h / l))); else tmp = (t_0 * (sqrt(d) / sqrt(h))) * (1.0 - ((0.5 * t_1) * (h / l))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[d, 2.5e-278], N[(t$95$0 * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 * h), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.6e-162], N[(N[(N[(1.0 / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * d), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * t$95$1), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(0.5 * t$95$1), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\\
\mathbf{if}\;d \leq 2.5 \cdot 10^{-278}:\\
\;\;\;\;t\_0 \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 - \frac{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \left(0.5 \cdot h\right)}{\ell}\right)\right)\\
\mathbf{elif}\;d \leq 3.6 \cdot 10^{-162}:\\
\;\;\;\;\left(\frac{1}{\sqrt{\ell \cdot h}} \cdot d\right) \cdot \left(1 - \left(\frac{1}{2} \cdot t\_1\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 \cdot \frac{\sqrt{d}}{\sqrt{h}}\right) \cdot \left(1 - \left(0.5 \cdot t\_1\right) \cdot \frac{h}{\ell}\right)\\
\end{array}
\end{array}
if d < 2.49999999999999992e-278Initial program 63.9%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f6463.9
Applied rewrites63.9%
lift-/.f64N/A
metadata-eval63.9
Applied rewrites63.9%
Applied rewrites65.3%
if 2.49999999999999992e-278 < d < 3.5999999999999998e-162Initial program 42.7%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6458.4
Applied rewrites58.4%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
*-commutativeN/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
*-commutativeN/A
lower-sqrt.f64N/A
lift-*.f6458.7
Applied rewrites58.7%
if 3.5999999999999998e-162 < d Initial program 74.1%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f6474.1
Applied rewrites74.1%
lift-/.f64N/A
metadata-eval74.1
Applied rewrites74.1%
lift-/.f64N/A
lift-sqrt.f64N/A
sqrt-divN/A
lower-/.f64N/A
lift-sqrt.f64N/A
lower-sqrt.f6482.6
Applied rewrites82.6%
(FPCore (d h l M D)
:precision binary64
(if (<= l -2.3e+232)
(- (* (pow (* l h) -0.5) d))
(if (<= l 2.2e-304)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(- 1.0 (/ (* (pow (* (/ M 2.0) (/ D d)) 2.0) (* 0.5 h)) l))))
(*
(* (/ 1.0 (sqrt (* l h))) d)
(- 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) {
double tmp;
if (l <= -2.3e+232) {
tmp = -(pow((l * h), -0.5) * d);
} else if (l <= 2.2e-304) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 - ((pow(((M / 2.0) * (D / d)), 2.0) * (0.5 * h)) / l)));
} else {
tmp = ((1.0 / sqrt((l * h))) * d) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-2.3d+232)) then
tmp = -(((l * h) ** (-0.5d0)) * d)
else if (l <= 2.2d-304) then
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 - (((((m / 2.0d0) * (d_1 / d)) ** 2.0d0) * (0.5d0 * h)) / l)))
else
tmp = ((1.0d0 / sqrt((l * h))) * d) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (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 (l <= -2.3e+232) {
tmp = -(Math.pow((l * h), -0.5) * d);
} else if (l <= 2.2e-304) {
tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 - ((Math.pow(((M / 2.0) * (D / d)), 2.0) * (0.5 * h)) / l)));
} else {
tmp = ((1.0 / Math.sqrt((l * h))) * d) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if l <= -2.3e+232: tmp = -(math.pow((l * h), -0.5) * d) elif l <= 2.2e-304: tmp = math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 - ((math.pow(((M / 2.0) * (D / d)), 2.0) * (0.5 * h)) / l))) else: tmp = ((1.0 / math.sqrt((l * h))) * d) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (l <= -2.3e+232) tmp = Float64(-Float64((Float64(l * h) ^ -0.5) * d)); elseif (l <= 2.2e-304) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 - Float64(Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * Float64(0.5 * h)) / l)))); else tmp = Float64(Float64(Float64(1.0 / sqrt(Float64(l * h))) * d) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (l <= -2.3e+232) tmp = -(((l * h) ^ -0.5) * d); elseif (l <= 2.2e-304) tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 - (((((M / 2.0) * (D / d)) ^ 2.0) * (0.5 * h)) / l))); else tmp = ((1.0 / sqrt((l * h))) * d) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -2.3e+232], (-N[(N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision] * d), $MachinePrecision]), If[LessEqual[l, 2.2e-304], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 * h), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * d), $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]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.3 \cdot 10^{+232}:\\
\;\;\;\;-{\left(\ell \cdot h\right)}^{-0.5} \cdot d\\
\mathbf{elif}\;\ell \leq 2.2 \cdot 10^{-304}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 - \frac{{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \left(0.5 \cdot h\right)}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{\sqrt{\ell \cdot h}} \cdot d\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)\\
\end{array}
\end{array}
if l < -2.30000000000000006e232Initial program 44.6%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lower-pow.f64N/A
lower-*.f64N/A
lift-/.f64N/A
lift-/.f6436.8
lift-/.f64N/A
metadata-eval36.8
Applied rewrites36.8%
Taylor expanded in d around -inf
metadata-evalN/A
unpow-prod-downN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
mul-1-negN/A
Applied rewrites46.3%
if -2.30000000000000006e232 < l < 2.2e-304Initial program 68.3%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f6468.3
Applied rewrites68.3%
lift-/.f64N/A
metadata-eval68.3
Applied rewrites68.3%
Applied rewrites70.1%
if 2.2e-304 < l Initial program 65.8%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6468.8
Applied rewrites68.8%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
*-commutativeN/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
*-commutativeN/A
lower-sqrt.f64N/A
lift-*.f6469.1
Applied rewrites69.1%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (/ (* M D) (* 2.0 d)) 2.0)))
(if (<= h -8e-144)
(* (* (sqrt (/ d l)) (sqrt (/ d h))) (- 1.0 (* (* 0.5 t_0) (/ h l))))
(if (<= h 2.2e-307)
(* (- d) (sqrt (pow (* l h) -1.0)))
(*
(* (/ 1.0 (sqrt (* l h))) d)
(- 1.0 (* (* (/ 1.0 2.0) t_0) (/ h l))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = pow(((M * D) / (2.0 * d)), 2.0);
double tmp;
if (h <= -8e-144) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((0.5 * t_0) * (h / l)));
} else if (h <= 2.2e-307) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else {
tmp = ((1.0 / sqrt((l * h))) * d) * (1.0 - (((1.0 / 2.0) * t_0) * (h / l)));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = ((m * d_1) / (2.0d0 * d)) ** 2.0d0
if (h <= (-8d-144)) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0d0 - ((0.5d0 * t_0) * (h / l)))
else if (h <= 2.2d-307) then
tmp = -d * sqrt(((l * h) ** (-1.0d0)))
else
tmp = ((1.0d0 / sqrt((l * h))) * d) * (1.0d0 - (((1.0d0 / 2.0d0) * t_0) * (h / l)))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.pow(((M * D) / (2.0 * d)), 2.0);
double tmp;
if (h <= -8e-144) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 - ((0.5 * t_0) * (h / l)));
} else if (h <= 2.2e-307) {
tmp = -d * Math.sqrt(Math.pow((l * h), -1.0));
} else {
tmp = ((1.0 / Math.sqrt((l * h))) * d) * (1.0 - (((1.0 / 2.0) * t_0) * (h / l)));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.pow(((M * D) / (2.0 * d)), 2.0) tmp = 0 if h <= -8e-144: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 - ((0.5 * t_0) * (h / l))) elif h <= 2.2e-307: tmp = -d * math.sqrt(math.pow((l * h), -1.0)) else: tmp = ((1.0 / math.sqrt((l * h))) * d) * (1.0 - (((1.0 / 2.0) * t_0) * (h / l))) return tmp
function code(d, h, l, M, D) t_0 = Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0 tmp = 0.0 if (h <= -8e-144) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(Float64(0.5 * t_0) * Float64(h / l)))); elseif (h <= 2.2e-307) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); else tmp = Float64(Float64(Float64(1.0 / sqrt(Float64(l * h))) * d) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * t_0) * Float64(h / l)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = ((M * D) / (2.0 * d)) ^ 2.0; tmp = 0.0; if (h <= -8e-144) tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((0.5 * t_0) * (h / l))); elseif (h <= 2.2e-307) tmp = -d * sqrt(((l * h) ^ -1.0)); else tmp = ((1.0 / sqrt((l * h))) * d) * (1.0 - (((1.0 / 2.0) * t_0) * (h / l))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[h, -8e-144], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(0.5 * t$95$0), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 2.2e-307], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * d), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * t$95$0), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\\
\mathbf{if}\;h \leq -8 \cdot 10^{-144}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \left(0.5 \cdot t\_0\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{elif}\;h \leq 2.2 \cdot 10^{-307}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{\sqrt{\ell \cdot h}} \cdot d\right) \cdot \left(1 - \left(\frac{1}{2} \cdot t\_0\right) \cdot \frac{h}{\ell}\right)\\
\end{array}
\end{array}
if h < -7.9999999999999996e-144Initial program 66.0%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f6466.0
Applied rewrites66.0%
lift-/.f64N/A
metadata-eval66.0
Applied rewrites66.0%
if -7.9999999999999996e-144 < h < 2.2e-307Initial program 63.2%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lower-pow.f64N/A
lower-*.f64N/A
lift-/.f64N/A
lift-/.f6456.4
lift-/.f64N/A
metadata-eval56.4
Applied rewrites56.4%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
unpow2N/A
*-commutativeN/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lift-*.f6446.0
Applied rewrites46.0%
Taylor expanded in d around -inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
inv-powN/A
*-commutativeN/A
exp-to-powN/A
lower-sqrt.f64N/A
exp-to-powN/A
lower-pow.f64N/A
lift-*.f6452.0
Applied rewrites52.0%
if 2.2e-307 < h Initial program 65.8%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6468.9
Applied rewrites68.9%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
*-commutativeN/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
*-commutativeN/A
lower-sqrt.f64N/A
lift-*.f6469.2
Applied rewrites69.2%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (/ M 2.0) (/ D d))))
(if (<= h -9e-143)
(*
(* (sqrt (/ d l)) (sqrt (/ d h)))
(- 1.0 (* (* 0.5 (* t_0 t_0)) (/ h l))))
(if (<= h 2.2e-307)
(* (- d) (sqrt (pow (* l h) -1.0)))
(*
(* (/ 1.0 (sqrt (* l h))) d)
(-
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) {
double t_0 = (M / 2.0) * (D / d);
double tmp;
if (h <= -9e-143) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((0.5 * (t_0 * t_0)) * (h / l)));
} else if (h <= 2.2e-307) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else {
tmp = ((1.0 / sqrt((l * h))) * d) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = (m / 2.0d0) * (d_1 / d)
if (h <= (-9d-143)) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0d0 - ((0.5d0 * (t_0 * t_0)) * (h / l)))
else if (h <= 2.2d-307) then
tmp = -d * sqrt(((l * h) ** (-1.0d0)))
else
tmp = ((1.0d0 / sqrt((l * h))) * d) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (M / 2.0) * (D / d);
double tmp;
if (h <= -9e-143) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 - ((0.5 * (t_0 * t_0)) * (h / l)));
} else if (h <= 2.2e-307) {
tmp = -d * Math.sqrt(Math.pow((l * h), -1.0));
} else {
tmp = ((1.0 / Math.sqrt((l * h))) * d) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = (M / 2.0) * (D / d) tmp = 0 if h <= -9e-143: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 - ((0.5 * (t_0 * t_0)) * (h / l))) elif h <= 2.2e-307: tmp = -d * math.sqrt(math.pow((l * h), -1.0)) else: tmp = ((1.0 / math.sqrt((l * h))) * d) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) return tmp
function code(d, h, l, M, D) t_0 = Float64(Float64(M / 2.0) * Float64(D / d)) tmp = 0.0 if (h <= -9e-143) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(Float64(0.5 * Float64(t_0 * t_0)) * Float64(h / l)))); elseif (h <= 2.2e-307) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); else tmp = Float64(Float64(Float64(1.0 / sqrt(Float64(l * h))) * d) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (M / 2.0) * (D / d); tmp = 0.0; if (h <= -9e-143) tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((0.5 * (t_0 * t_0)) * (h / l))); elseif (h <= 2.2e-307) tmp = -d * sqrt(((l * h) ^ -1.0)); else tmp = ((1.0 / sqrt((l * h))) * d) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -9e-143], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(0.5 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 2.2e-307], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * d), $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]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{M}{2} \cdot \frac{D}{d}\\
\mathbf{if}\;h \leq -9 \cdot 10^{-143}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \left(0.5 \cdot \left(t\_0 \cdot t\_0\right)\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{elif}\;h \leq 2.2 \cdot 10^{-307}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{\sqrt{\ell \cdot h}} \cdot d\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)\\
\end{array}
\end{array}
if h < -9.00000000000000001e-143Initial program 66.0%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f6466.0
Applied rewrites66.0%
lift-/.f64N/A
metadata-eval66.0
Applied rewrites66.0%
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
unpow2N/A
lower-*.f6465.6
Applied rewrites65.6%
if -9.00000000000000001e-143 < h < 2.2e-307Initial program 63.3%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lower-pow.f64N/A
lower-*.f64N/A
lift-/.f64N/A
lift-/.f6456.5
lift-/.f64N/A
metadata-eval56.5
Applied rewrites56.5%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
unpow2N/A
*-commutativeN/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lift-*.f6446.1
Applied rewrites46.1%
Taylor expanded in d around -inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
inv-powN/A
*-commutativeN/A
exp-to-powN/A
lower-sqrt.f64N/A
exp-to-powN/A
lower-pow.f64N/A
lift-*.f6452.1
Applied rewrites52.1%
if 2.2e-307 < h Initial program 65.8%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6468.9
Applied rewrites68.9%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
*-commutativeN/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
*-commutativeN/A
lower-sqrt.f64N/A
lift-*.f6469.2
Applied rewrites69.2%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (/ M 2.0) (/ D d))))
(if (<= h -9e-143)
(*
(* (sqrt (/ d l)) (sqrt (/ d h)))
(- 1.0 (* (* 0.5 (* t_0 t_0)) (/ h l))))
(if (<= h 2.2e-307)
(* (- d) (sqrt (pow (* l h) -1.0)))
(*
(* (sqrt (/ 1.0 (* l h))) d)
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (+ d d)) 2.0)) (/ h l))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = (M / 2.0) * (D / d);
double tmp;
if (h <= -9e-143) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((0.5 * (t_0 * t_0)) * (h / l)));
} else if (h <= 2.2e-307) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else {
tmp = (sqrt((1.0 / (l * h))) * d) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (d + d)), 2.0)) * (h / l)));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = (m / 2.0d0) * (d_1 / d)
if (h <= (-9d-143)) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0d0 - ((0.5d0 * (t_0 * t_0)) * (h / l)))
else if (h <= 2.2d-307) then
tmp = -d * sqrt(((l * h) ** (-1.0d0)))
else
tmp = (sqrt((1.0d0 / (l * h))) * d) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (d + d)) ** 2.0d0)) * (h / l)))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (M / 2.0) * (D / d);
double tmp;
if (h <= -9e-143) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 - ((0.5 * (t_0 * t_0)) * (h / l)));
} else if (h <= 2.2e-307) {
tmp = -d * Math.sqrt(Math.pow((l * h), -1.0));
} else {
tmp = (Math.sqrt((1.0 / (l * h))) * d) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (d + d)), 2.0)) * (h / l)));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = (M / 2.0) * (D / d) tmp = 0 if h <= -9e-143: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 - ((0.5 * (t_0 * t_0)) * (h / l))) elif h <= 2.2e-307: tmp = -d * math.sqrt(math.pow((l * h), -1.0)) else: tmp = (math.sqrt((1.0 / (l * h))) * d) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (d + d)), 2.0)) * (h / l))) return tmp
function code(d, h, l, M, D) t_0 = Float64(Float64(M / 2.0) * Float64(D / d)) tmp = 0.0 if (h <= -9e-143) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(Float64(0.5 * Float64(t_0 * t_0)) * Float64(h / l)))); elseif (h <= 2.2e-307) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); else tmp = Float64(Float64(sqrt(Float64(1.0 / Float64(l * h))) * d) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(d + d)) ^ 2.0)) * Float64(h / l)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (M / 2.0) * (D / d); tmp = 0.0; if (h <= -9e-143) tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((0.5 * (t_0 * t_0)) * (h / l))); elseif (h <= 2.2e-307) tmp = -d * sqrt(((l * h) ^ -1.0)); else tmp = (sqrt((1.0 / (l * h))) * d) * (1.0 - (((1.0 / 2.0) * (((M * D) / (d + d)) ^ 2.0)) * (h / l))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -9e-143], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(0.5 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 2.2e-307], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(d + d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{M}{2} \cdot \frac{D}{d}\\
\mathbf{if}\;h \leq -9 \cdot 10^{-143}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \left(0.5 \cdot \left(t\_0 \cdot t\_0\right)\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{elif}\;h \leq 2.2 \cdot 10^{-307}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{d + d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\end{array}
\end{array}
if h < -9.00000000000000001e-143Initial program 66.0%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f6466.0
Applied rewrites66.0%
lift-/.f64N/A
metadata-eval66.0
Applied rewrites66.0%
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
unpow2N/A
lower-*.f6465.6
Applied rewrites65.6%
if -9.00000000000000001e-143 < h < 2.2e-307Initial program 63.3%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lower-pow.f64N/A
lower-*.f64N/A
lift-/.f64N/A
lift-/.f6456.5
lift-/.f64N/A
metadata-eval56.5
Applied rewrites56.5%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
unpow2N/A
*-commutativeN/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lift-*.f6446.1
Applied rewrites46.1%
Taylor expanded in d around -inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
inv-powN/A
*-commutativeN/A
exp-to-powN/A
lower-sqrt.f64N/A
exp-to-powN/A
lower-pow.f64N/A
lift-*.f6452.1
Applied rewrites52.1%
if 2.2e-307 < h Initial program 65.8%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6468.9
Applied rewrites68.9%
lift-*.f64N/A
lift-pow.f64N/A
unpow-1N/A
lower-/.f64N/A
lift-*.f6468.9
Applied rewrites68.9%
lift-*.f64N/A
count-2-revN/A
lower-+.f6468.9
Applied rewrites68.9%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (/ M 2.0) (/ D d))))
(if (<= l -2.3e+232)
(- (* (pow (* l h) -0.5) d))
(if (<= l 2.2e+92)
(*
(* (sqrt (/ d l)) (sqrt (/ d h)))
(- 1.0 (* (* 0.5 (* t_0 t_0)) (/ h l))))
(* (/ 1.0 (* (sqrt l) (sqrt h))) d)))))
double code(double d, double h, double l, double M, double D) {
double t_0 = (M / 2.0) * (D / d);
double tmp;
if (l <= -2.3e+232) {
tmp = -(pow((l * h), -0.5) * d);
} else if (l <= 2.2e+92) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((0.5 * (t_0 * t_0)) * (h / l)));
} else {
tmp = (1.0 / (sqrt(l) * sqrt(h))) * d;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = (m / 2.0d0) * (d_1 / d)
if (l <= (-2.3d+232)) then
tmp = -(((l * h) ** (-0.5d0)) * d)
else if (l <= 2.2d+92) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0d0 - ((0.5d0 * (t_0 * t_0)) * (h / l)))
else
tmp = (1.0d0 / (sqrt(l) * sqrt(h))) * d
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (M / 2.0) * (D / d);
double tmp;
if (l <= -2.3e+232) {
tmp = -(Math.pow((l * h), -0.5) * d);
} else if (l <= 2.2e+92) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 - ((0.5 * (t_0 * t_0)) * (h / l)));
} else {
tmp = (1.0 / (Math.sqrt(l) * Math.sqrt(h))) * d;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = (M / 2.0) * (D / d) tmp = 0 if l <= -2.3e+232: tmp = -(math.pow((l * h), -0.5) * d) elif l <= 2.2e+92: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 - ((0.5 * (t_0 * t_0)) * (h / l))) else: tmp = (1.0 / (math.sqrt(l) * math.sqrt(h))) * d return tmp
function code(d, h, l, M, D) t_0 = Float64(Float64(M / 2.0) * Float64(D / d)) tmp = 0.0 if (l <= -2.3e+232) tmp = Float64(-Float64((Float64(l * h) ^ -0.5) * d)); elseif (l <= 2.2e+92) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(Float64(0.5 * Float64(t_0 * t_0)) * Float64(h / l)))); else tmp = Float64(Float64(1.0 / Float64(sqrt(l) * sqrt(h))) * d); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (M / 2.0) * (D / d); tmp = 0.0; if (l <= -2.3e+232) tmp = -(((l * h) ^ -0.5) * d); elseif (l <= 2.2e+92) tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((0.5 * (t_0 * t_0)) * (h / l))); else tmp = (1.0 / (sqrt(l) * sqrt(h))) * d; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -2.3e+232], (-N[(N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision] * d), $MachinePrecision]), If[LessEqual[l, 2.2e+92], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(0.5 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * d), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{M}{2} \cdot \frac{D}{d}\\
\mathbf{if}\;\ell \leq -2.3 \cdot 10^{+232}:\\
\;\;\;\;-{\left(\ell \cdot h\right)}^{-0.5} \cdot d\\
\mathbf{elif}\;\ell \leq 2.2 \cdot 10^{+92}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \left(0.5 \cdot \left(t\_0 \cdot t\_0\right)\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{\ell} \cdot \sqrt{h}} \cdot d\\
\end{array}
\end{array}
if l < -2.30000000000000006e232Initial program 44.6%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lower-pow.f64N/A
lower-*.f64N/A
lift-/.f64N/A
lift-/.f6436.8
lift-/.f64N/A
metadata-eval36.8
Applied rewrites36.8%
Taylor expanded in d around -inf
metadata-evalN/A
unpow-prod-downN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
mul-1-negN/A
Applied rewrites46.3%
if -2.30000000000000006e232 < l < 2.19999999999999992e92Initial program 69.8%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f6469.8
Applied rewrites69.8%
lift-/.f64N/A
metadata-eval69.8
Applied rewrites69.8%
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
unpow2N/A
lower-*.f6469.3
Applied rewrites69.3%
if 2.19999999999999992e92 < l Initial program 54.0%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6450.0
Applied rewrites50.0%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
*-commutativeN/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
*-commutativeN/A
lower-sqrt.f64N/A
lift-*.f6450.0
Applied rewrites50.0%
lift-*.f64N/A
lift-sqrt.f64N/A
sqrt-prodN/A
lower-*.f64N/A
lift-sqrt.f64N/A
lower-sqrt.f6462.0
Applied rewrites62.0%
(FPCore (d h l M D) :precision binary64 (if (<= d 7.4e-279) (- (* (pow (* l h) -0.5) d)) (* (/ 1.0 (* (sqrt l) (sqrt h))) d)))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= 7.4e-279) {
tmp = -(pow((l * h), -0.5) * d);
} else {
tmp = (1.0 / (sqrt(l) * sqrt(h))) * d;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (d <= 7.4d-279) then
tmp = -(((l * h) ** (-0.5d0)) * d)
else
tmp = (1.0d0 / (sqrt(l) * sqrt(h))) * d
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= 7.4e-279) {
tmp = -(Math.pow((l * h), -0.5) * d);
} else {
tmp = (1.0 / (Math.sqrt(l) * Math.sqrt(h))) * d;
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if d <= 7.4e-279: tmp = -(math.pow((l * h), -0.5) * d) else: tmp = (1.0 / (math.sqrt(l) * math.sqrt(h))) * d return tmp
function code(d, h, l, M, D) tmp = 0.0 if (d <= 7.4e-279) tmp = Float64(-Float64((Float64(l * h) ^ -0.5) * d)); else tmp = Float64(Float64(1.0 / Float64(sqrt(l) * sqrt(h))) * d); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (d <= 7.4e-279) tmp = -(((l * h) ^ -0.5) * d); else tmp = (1.0 / (sqrt(l) * sqrt(h))) * d; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[d, 7.4e-279], (-N[(N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision] * d), $MachinePrecision]), N[(N[(1.0 / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * d), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq 7.4 \cdot 10^{-279}:\\
\;\;\;\;-{\left(\ell \cdot h\right)}^{-0.5} \cdot d\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{\ell} \cdot \sqrt{h}} \cdot d\\
\end{array}
\end{array}
if d < 7.40000000000000076e-279Initial program 63.9%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-prod-downN/A
lower-pow.f64N/A
lower-*.f64N/A
lift-/.f64N/A
lift-/.f6452.6
lift-/.f64N/A
metadata-eval52.6
Applied rewrites52.6%
Taylor expanded in d around -inf
metadata-evalN/A
unpow-prod-downN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
mul-1-negN/A
Applied rewrites41.9%
if 7.40000000000000076e-279 < d Initial program 67.3%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6444.2
Applied rewrites44.2%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
*-commutativeN/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
*-commutativeN/A
lower-sqrt.f64N/A
lift-*.f6444.3
Applied rewrites44.3%
lift-*.f64N/A
lift-sqrt.f64N/A
sqrt-prodN/A
lower-*.f64N/A
lift-sqrt.f64N/A
lower-sqrt.f6451.9
Applied rewrites51.9%
(FPCore (d h l M D) :precision binary64 (if (<= d 5.4e-291) (* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0) (* (/ 1.0 (* (sqrt l) (sqrt h))) d)))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= 5.4e-291) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
} else {
tmp = (1.0 / (sqrt(l) * sqrt(h))) * d;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (d <= 5.4d-291) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0d0
else
tmp = (1.0d0 / (sqrt(l) * sqrt(h))) * d
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= 5.4e-291) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * 1.0;
} else {
tmp = (1.0 / (Math.sqrt(l) * Math.sqrt(h))) * d;
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if d <= 5.4e-291: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * 1.0 else: tmp = (1.0 / (math.sqrt(l) * math.sqrt(h))) * d return tmp
function code(d, h, l, M, D) tmp = 0.0 if (d <= 5.4e-291) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0); else tmp = Float64(Float64(1.0 / Float64(sqrt(l) * sqrt(h))) * d); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (d <= 5.4e-291) tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0; else tmp = (1.0 / (sqrt(l) * sqrt(h))) * d; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[d, 5.4e-291], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * d), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq 5.4 \cdot 10^{-291}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{\ell} \cdot \sqrt{h}} \cdot d\\
\end{array}
\end{array}
if d < 5.39999999999999983e-291Initial program 64.5%
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f6464.5
Applied rewrites64.5%
lift-/.f64N/A
metadata-eval64.5
Applied rewrites64.5%
Taylor expanded in d around inf
Applied rewrites38.1%
if 5.39999999999999983e-291 < d Initial program 66.6%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6443.7
Applied rewrites43.7%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
*-commutativeN/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
*-commutativeN/A
lower-sqrt.f64N/A
lift-*.f6443.8
Applied rewrites43.8%
lift-*.f64N/A
lift-sqrt.f64N/A
sqrt-prodN/A
lower-*.f64N/A
lift-sqrt.f64N/A
lower-sqrt.f6451.3
Applied rewrites51.3%
(FPCore (d h l M D) :precision binary64 (if (<= d 4.5e-96) (* (sqrt (/ 1.0 (* l h))) d) (* (/ 1.0 (* (sqrt l) (sqrt h))) d)))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= 4.5e-96) {
tmp = sqrt((1.0 / (l * h))) * d;
} else {
tmp = (1.0 / (sqrt(l) * sqrt(h))) * d;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (d <= 4.5d-96) then
tmp = sqrt((1.0d0 / (l * h))) * d
else
tmp = (1.0d0 / (sqrt(l) * sqrt(h))) * d
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= 4.5e-96) {
tmp = Math.sqrt((1.0 / (l * h))) * d;
} else {
tmp = (1.0 / (Math.sqrt(l) * Math.sqrt(h))) * d;
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if d <= 4.5e-96: tmp = math.sqrt((1.0 / (l * h))) * d else: tmp = (1.0 / (math.sqrt(l) * math.sqrt(h))) * d return tmp
function code(d, h, l, M, D) tmp = 0.0 if (d <= 4.5e-96) tmp = Float64(sqrt(Float64(1.0 / Float64(l * h))) * d); else tmp = Float64(Float64(1.0 / Float64(sqrt(l) * sqrt(h))) * d); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (d <= 4.5e-96) tmp = sqrt((1.0 / (l * h))) * d; else tmp = (1.0 / (sqrt(l) * sqrt(h))) * d; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[d, 4.5e-96], N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * d), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq 4.5 \cdot 10^{-96}:\\
\;\;\;\;\sqrt{\frac{1}{\ell \cdot h}} \cdot d\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{\ell} \cdot \sqrt{h}} \cdot d\\
\end{array}
\end{array}
if d < 4.5e-96Initial program 60.3%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6414.1
Applied rewrites14.1%
lift-*.f64N/A
lift-pow.f64N/A
unpow-1N/A
lower-/.f64N/A
lift-*.f6414.1
Applied rewrites14.1%
if 4.5e-96 < d Initial program 76.6%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6453.7
Applied rewrites53.7%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
*-commutativeN/A
inv-powN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
*-commutativeN/A
lower-sqrt.f64N/A
lift-*.f6453.9
Applied rewrites53.9%
lift-*.f64N/A
lift-sqrt.f64N/A
sqrt-prodN/A
lower-*.f64N/A
lift-sqrt.f64N/A
lower-sqrt.f6463.5
Applied rewrites63.5%
(FPCore (d h l M D) :precision binary64 (* (sqrt (/ 1.0 (* l h))) d))
double code(double d, double h, double l, double M, double D) {
return sqrt((1.0 / (l * h))) * d;
}
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 = sqrt((1.0d0 / (l * h))) * d
end function
public static double code(double d, double h, double l, double M, double D) {
return Math.sqrt((1.0 / (l * h))) * d;
}
def code(d, h, l, M, D): return math.sqrt((1.0 / (l * h))) * d
function code(d, h, l, M, D) return Float64(sqrt(Float64(1.0 / Float64(l * h))) * d) end
function tmp = code(d, h, l, M, D) tmp = sqrt((1.0 / (l * h))) * d; end
code[d_, h_, l_, M_, D_] := N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{1}{\ell \cdot h}} \cdot d
\end{array}
Initial program 65.6%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6426.8
Applied rewrites26.8%
lift-*.f64N/A
lift-pow.f64N/A
unpow-1N/A
lower-/.f64N/A
lift-*.f6426.8
Applied rewrites26.8%
herbie shell --seed 2025092
(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)))))