
(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}
Sampling outcomes in binary64 precision:
Herbie found 22 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
(let* ((t_0 (* (/ (/ D d) 2.0) M))
(t_1 (- 1.0 (/ (* t_0 (* t_0 (* 0.5 h))) l))))
(if (<= h -2e-310)
(* (* (/ (sqrt (- d)) (sqrt (- h))) (pow (/ d l) (/ 1.0 2.0))) t_1)
(if (<= h 1.5e+170)
(* (* (sqrt (/ 1.0 (* l h))) d) t_1)
(/
(*
(sqrt d)
(* (fma (* (/ h l) -0.5) (pow t_0 2.0) 1.0) (sqrt (/ d l))))
(sqrt h))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = ((D / d) / 2.0) * M;
double t_1 = 1.0 - ((t_0 * (t_0 * (0.5 * h))) / l);
double tmp;
if (h <= -2e-310) {
tmp = ((sqrt(-d) / sqrt(-h)) * pow((d / l), (1.0 / 2.0))) * t_1;
} else if (h <= 1.5e+170) {
tmp = (sqrt((1.0 / (l * h))) * d) * t_1;
} else {
tmp = (sqrt(d) * (fma(((h / l) * -0.5), pow(t_0, 2.0), 1.0) * sqrt((d / l)))) / sqrt(h);
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(Float64(Float64(D / d) / 2.0) * M) t_1 = Float64(1.0 - Float64(Float64(t_0 * Float64(t_0 * Float64(0.5 * h))) / l)) tmp = 0.0 if (h <= -2e-310) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * t_1); elseif (h <= 1.5e+170) tmp = Float64(Float64(sqrt(Float64(1.0 / Float64(l * h))) * d) * t_1); else tmp = Float64(Float64(sqrt(d) * Float64(fma(Float64(Float64(h / l) * -0.5), (t_0 ^ 2.0), 1.0) * sqrt(Float64(d / l)))) / sqrt(h)); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[(D / d), $MachinePrecision] / 2.0), $MachinePrecision] * M), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[(N[(t$95$0 * N[(t$95$0 * N[(0.5 * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -2e-310], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[h, 1.5e+170], N[(N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[t$95$0, 2.0], $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{D}{d}}{2} \cdot M\\
t_1 := 1 - \frac{t\_0 \cdot \left(t\_0 \cdot \left(0.5 \cdot h\right)\right)}{\ell}\\
\mathbf{if}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot t\_1\\
\mathbf{elif}\;h \leq 1.5 \cdot 10^{+170}:\\
\;\;\;\;\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d} \cdot \left(\mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {t\_0}^{2}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right)}{\sqrt{h}}\\
\end{array}
\end{array}
if h < -1.999999999999994e-310Initial program 70.2%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6469.4
lift-/.f64N/A
metadata-eval69.4
Applied rewrites69.4%
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites72.2%
lift-/.f64N/A
metadata-eval72.2
lift-pow.f64N/A
pow1/2N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-neg.f6480.9
Applied rewrites80.9%
if -1.999999999999994e-310 < h < 1.49999999999999998e170Initial program 69.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6472.6
lift-/.f64N/A
metadata-eval72.6
Applied rewrites72.6%
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites76.3%
Taylor expanded in d around 0
Applied rewrites92.3%
if 1.49999999999999998e170 < h Initial program 61.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6461.4
lift-/.f64N/A
metadata-eval61.4
Applied rewrites61.4%
Applied rewrites79.3%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ 1.0 (* l h))))
(t_1 (* (/ (/ D d) 2.0) M))
(t_2 (- 1.0 (/ (* t_1 (* t_1 (* 0.5 h))) l)))
(t_3 (sqrt (/ d l))))
(if (<= h -1.52e+215)
(*
(*
(fma (* -0.125 (/ (* (* (* (/ M d) D) D) M) d)) (/ h l) 1.0)
(sqrt (/ d h)))
t_3)
(if (<= h -2e-310)
(* (* (- d) t_0) t_2)
(if (<= h 1.5e+170)
(* (* t_0 d) t_2)
(/
(* (sqrt d) (* (fma (* (/ h l) -0.5) (pow t_1 2.0) 1.0) t_3))
(sqrt h)))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((1.0 / (l * h)));
double t_1 = ((D / d) / 2.0) * M;
double t_2 = 1.0 - ((t_1 * (t_1 * (0.5 * h))) / l);
double t_3 = sqrt((d / l));
double tmp;
if (h <= -1.52e+215) {
tmp = (fma((-0.125 * (((((M / d) * D) * D) * M) / d)), (h / l), 1.0) * sqrt((d / h))) * t_3;
} else if (h <= -2e-310) {
tmp = (-d * t_0) * t_2;
} else if (h <= 1.5e+170) {
tmp = (t_0 * d) * t_2;
} else {
tmp = (sqrt(d) * (fma(((h / l) * -0.5), pow(t_1, 2.0), 1.0) * t_3)) / sqrt(h);
}
return tmp;
}
function code(d, h, l, M, D) t_0 = sqrt(Float64(1.0 / Float64(l * h))) t_1 = Float64(Float64(Float64(D / d) / 2.0) * M) t_2 = Float64(1.0 - Float64(Float64(t_1 * Float64(t_1 * Float64(0.5 * h))) / l)) t_3 = sqrt(Float64(d / l)) tmp = 0.0 if (h <= -1.52e+215) tmp = Float64(Float64(fma(Float64(-0.125 * Float64(Float64(Float64(Float64(Float64(M / d) * D) * D) * M) / d)), Float64(h / l), 1.0) * sqrt(Float64(d / h))) * t_3); elseif (h <= -2e-310) tmp = Float64(Float64(Float64(-d) * t_0) * t_2); elseif (h <= 1.5e+170) tmp = Float64(Float64(t_0 * d) * t_2); else tmp = Float64(Float64(sqrt(d) * Float64(fma(Float64(Float64(h / l) * -0.5), (t_1 ^ 2.0), 1.0) * t_3)) / sqrt(h)); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(D / d), $MachinePrecision] / 2.0), $MachinePrecision] * M), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[(N[(t$95$1 * N[(t$95$1 * N[(0.5 * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, -1.52e+215], N[(N[(N[(N[(-0.125 * N[(N[(N[(N[(N[(M / d), $MachinePrecision] * D), $MachinePrecision] * D), $MachinePrecision] * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$3), $MachinePrecision], If[LessEqual[h, -2e-310], N[(N[((-d) * t$95$0), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[h, 1.5e+170], N[(N[(t$95$0 * d), $MachinePrecision] * t$95$2), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[t$95$1, 2.0], $MachinePrecision] + 1.0), $MachinePrecision] * t$95$3), $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{\ell \cdot h}}\\
t_1 := \frac{\frac{D}{d}}{2} \cdot M\\
t_2 := 1 - \frac{t\_1 \cdot \left(t\_1 \cdot \left(0.5 \cdot h\right)\right)}{\ell}\\
t_3 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;h \leq -1.52 \cdot 10^{+215}:\\
\;\;\;\;\left(\mathsf{fma}\left(-0.125 \cdot \frac{\left(\left(\frac{M}{d} \cdot D\right) \cdot D\right) \cdot M}{d}, \frac{h}{\ell}, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot t\_3\\
\mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(\left(-d\right) \cdot t\_0\right) \cdot t\_2\\
\mathbf{elif}\;h \leq 1.5 \cdot 10^{+170}:\\
\;\;\;\;\left(t\_0 \cdot d\right) \cdot t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d} \cdot \left(\mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {t\_1}^{2}, 1\right) \cdot t\_3\right)}{\sqrt{h}}\\
\end{array}
\end{array}
if h < -1.51999999999999999e215Initial program 60.7%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites60.6%
lift-pow.f64N/A
unpow2N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6460.6
Applied rewrites60.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
times-fracN/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f6460.6
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6460.6
Applied rewrites60.6%
if -1.51999999999999999e215 < h < -1.999999999999994e-310Initial program 71.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6471.0
lift-/.f64N/A
metadata-eval71.0
Applied rewrites71.0%
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites74.3%
Taylor expanded in h around -inf
Applied rewrites83.0%
if -1.999999999999994e-310 < h < 1.49999999999999998e170Initial program 69.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6472.6
lift-/.f64N/A
metadata-eval72.6
Applied rewrites72.6%
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites76.3%
Taylor expanded in d around 0
Applied rewrites92.3%
if 1.49999999999999998e170 < h Initial program 61.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6461.4
lift-/.f64N/A
metadata-eval61.4
Applied rewrites61.4%
Applied rewrites79.3%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (/ M d) D))
(t_1 (sqrt (/ 1.0 (* l h))))
(t_2 (/ (/ D d) 2.0))
(t_3 (* t_2 M))
(t_4 (- 1.0 (/ (* t_3 (* t_3 (* 0.5 h))) l)))
(t_5 (sqrt (/ d l))))
(if (<= h -1.52e+215)
(*
(* (fma (* -0.125 (/ (* (* t_0 D) M) d)) (/ h l) 1.0) (sqrt (/ d h)))
t_5)
(if (<= h -2e-310)
(* (* (- d) t_1) t_4)
(if (<= h 1.25e+170)
(* (* t_1 d) t_4)
(*
(/ (* t_5 (sqrt d)) (sqrt h))
(- 1.0 (/ (* t_0 (* (* 0.5 (* M t_2)) (/ h l))) 2.0))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = (M / d) * D;
double t_1 = sqrt((1.0 / (l * h)));
double t_2 = (D / d) / 2.0;
double t_3 = t_2 * M;
double t_4 = 1.0 - ((t_3 * (t_3 * (0.5 * h))) / l);
double t_5 = sqrt((d / l));
double tmp;
if (h <= -1.52e+215) {
tmp = (fma((-0.125 * (((t_0 * D) * M) / d)), (h / l), 1.0) * sqrt((d / h))) * t_5;
} else if (h <= -2e-310) {
tmp = (-d * t_1) * t_4;
} else if (h <= 1.25e+170) {
tmp = (t_1 * d) * t_4;
} else {
tmp = ((t_5 * sqrt(d)) / sqrt(h)) * (1.0 - ((t_0 * ((0.5 * (M * t_2)) * (h / l))) / 2.0));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(Float64(M / d) * D) t_1 = sqrt(Float64(1.0 / Float64(l * h))) t_2 = Float64(Float64(D / d) / 2.0) t_3 = Float64(t_2 * M) t_4 = Float64(1.0 - Float64(Float64(t_3 * Float64(t_3 * Float64(0.5 * h))) / l)) t_5 = sqrt(Float64(d / l)) tmp = 0.0 if (h <= -1.52e+215) tmp = Float64(Float64(fma(Float64(-0.125 * Float64(Float64(Float64(t_0 * D) * M) / d)), Float64(h / l), 1.0) * sqrt(Float64(d / h))) * t_5); elseif (h <= -2e-310) tmp = Float64(Float64(Float64(-d) * t_1) * t_4); elseif (h <= 1.25e+170) tmp = Float64(Float64(t_1 * d) * t_4); else tmp = Float64(Float64(Float64(t_5 * sqrt(d)) / sqrt(h)) * Float64(1.0 - Float64(Float64(t_0 * Float64(Float64(0.5 * Float64(M * t_2)) * Float64(h / l))) / 2.0))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(M / d), $MachinePrecision] * D), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(D / d), $MachinePrecision] / 2.0), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 * M), $MachinePrecision]}, Block[{t$95$4 = N[(1.0 - N[(N[(t$95$3 * N[(t$95$3 * N[(0.5 * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, -1.52e+215], N[(N[(N[(N[(-0.125 * N[(N[(N[(t$95$0 * D), $MachinePrecision] * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$5), $MachinePrecision], If[LessEqual[h, -2e-310], N[(N[((-d) * t$95$1), $MachinePrecision] * t$95$4), $MachinePrecision], If[LessEqual[h, 1.25e+170], N[(N[(t$95$1 * d), $MachinePrecision] * t$95$4), $MachinePrecision], N[(N[(N[(t$95$5 * N[Sqrt[d], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(t$95$0 * N[(N[(0.5 * N[(M * t$95$2), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{M}{d} \cdot D\\
t_1 := \sqrt{\frac{1}{\ell \cdot h}}\\
t_2 := \frac{\frac{D}{d}}{2}\\
t_3 := t\_2 \cdot M\\
t_4 := 1 - \frac{t\_3 \cdot \left(t\_3 \cdot \left(0.5 \cdot h\right)\right)}{\ell}\\
t_5 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;h \leq -1.52 \cdot 10^{+215}:\\
\;\;\;\;\left(\mathsf{fma}\left(-0.125 \cdot \frac{\left(t\_0 \cdot D\right) \cdot M}{d}, \frac{h}{\ell}, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot t\_5\\
\mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(\left(-d\right) \cdot t\_1\right) \cdot t\_4\\
\mathbf{elif}\;h \leq 1.25 \cdot 10^{+170}:\\
\;\;\;\;\left(t\_1 \cdot d\right) \cdot t\_4\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_5 \cdot \sqrt{d}}{\sqrt{h}} \cdot \left(1 - \frac{t\_0 \cdot \left(\left(0.5 \cdot \left(M \cdot t\_2\right)\right) \cdot \frac{h}{\ell}\right)}{2}\right)\\
\end{array}
\end{array}
if h < -1.51999999999999999e215Initial program 60.7%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites60.6%
lift-pow.f64N/A
unpow2N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6460.6
Applied rewrites60.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
times-fracN/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f6460.6
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6460.6
Applied rewrites60.6%
if -1.51999999999999999e215 < h < -1.999999999999994e-310Initial program 71.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6471.0
lift-/.f64N/A
metadata-eval71.0
Applied rewrites71.0%
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites74.3%
Taylor expanded in h around -inf
Applied rewrites83.0%
if -1.999999999999994e-310 < h < 1.24999999999999994e170Initial program 69.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6472.6
lift-/.f64N/A
metadata-eval72.6
Applied rewrites72.6%
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites76.3%
Taylor expanded in d around 0
Applied rewrites92.3%
if 1.24999999999999994e170 < h Initial program 61.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6461.4
lift-/.f64N/A
metadata-eval61.4
Applied rewrites61.4%
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites64.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-*l/N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
associate-*l/N/A
lift-/.f64N/A
lift-*.f64N/A
lower-/.f64N/A
Applied rewrites58.4%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow1/2N/A
sqrt-divN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6474.7
Applied rewrites74.7%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ 1.0 (* l h))))
(t_1 (* (/ (/ D d) 2.0) M))
(t_2 (- 1.0 (/ (* t_1 (* t_1 (* 0.5 h))) l))))
(if (<= h -1.52e+215)
(*
(*
(fma (* -0.125 (/ (* (* (* (/ M d) D) D) M) d)) (/ h l) 1.0)
(sqrt (/ d h)))
(sqrt (/ d l)))
(if (<= h -2e-310) (* (* (- d) t_0) t_2) (* (* t_0 d) t_2)))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((1.0 / (l * h)));
double t_1 = ((D / d) / 2.0) * M;
double t_2 = 1.0 - ((t_1 * (t_1 * (0.5 * h))) / l);
double tmp;
if (h <= -1.52e+215) {
tmp = (fma((-0.125 * (((((M / d) * D) * D) * M) / d)), (h / l), 1.0) * sqrt((d / h))) * sqrt((d / l));
} else if (h <= -2e-310) {
tmp = (-d * t_0) * t_2;
} else {
tmp = (t_0 * d) * t_2;
}
return tmp;
}
function code(d, h, l, M, D) t_0 = sqrt(Float64(1.0 / Float64(l * h))) t_1 = Float64(Float64(Float64(D / d) / 2.0) * M) t_2 = Float64(1.0 - Float64(Float64(t_1 * Float64(t_1 * Float64(0.5 * h))) / l)) tmp = 0.0 if (h <= -1.52e+215) tmp = Float64(Float64(fma(Float64(-0.125 * Float64(Float64(Float64(Float64(Float64(M / d) * D) * D) * M) / d)), Float64(h / l), 1.0) * sqrt(Float64(d / h))) * sqrt(Float64(d / l))); elseif (h <= -2e-310) tmp = Float64(Float64(Float64(-d) * t_0) * t_2); else tmp = Float64(Float64(t_0 * d) * t_2); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(D / d), $MachinePrecision] / 2.0), $MachinePrecision] * M), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[(N[(t$95$1 * N[(t$95$1 * N[(0.5 * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -1.52e+215], N[(N[(N[(N[(-0.125 * N[(N[(N[(N[(N[(M / d), $MachinePrecision] * D), $MachinePrecision] * D), $MachinePrecision] * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -2e-310], N[(N[((-d) * t$95$0), $MachinePrecision] * t$95$2), $MachinePrecision], N[(N[(t$95$0 * d), $MachinePrecision] * t$95$2), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{\ell \cdot h}}\\
t_1 := \frac{\frac{D}{d}}{2} \cdot M\\
t_2 := 1 - \frac{t\_1 \cdot \left(t\_1 \cdot \left(0.5 \cdot h\right)\right)}{\ell}\\
\mathbf{if}\;h \leq -1.52 \cdot 10^{+215}:\\
\;\;\;\;\left(\mathsf{fma}\left(-0.125 \cdot \frac{\left(\left(\frac{M}{d} \cdot D\right) \cdot D\right) \cdot M}{d}, \frac{h}{\ell}, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(\left(-d\right) \cdot t\_0\right) \cdot t\_2\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 \cdot d\right) \cdot t\_2\\
\end{array}
\end{array}
if h < -1.51999999999999999e215Initial program 60.7%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites60.6%
lift-pow.f64N/A
unpow2N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6460.6
Applied rewrites60.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
times-fracN/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f6460.6
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6460.6
Applied rewrites60.6%
if -1.51999999999999999e215 < h < -1.999999999999994e-310Initial program 71.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6471.0
lift-/.f64N/A
metadata-eval71.0
Applied rewrites71.0%
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites74.3%
Taylor expanded in h around -inf
Applied rewrites83.0%
if -1.999999999999994e-310 < h Initial program 67.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6469.9
lift-/.f64N/A
metadata-eval69.9
Applied rewrites69.9%
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites73.5%
Taylor expanded in d around 0
Applied rewrites83.5%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (/ M d) D))
(t_1 (sqrt (/ 1.0 (* l h))))
(t_2 (/ (/ D d) 2.0))
(t_3 (* t_2 M)))
(if (<= h -1.52e+215)
(*
(* (fma (* -0.125 (/ (* (* t_0 D) M) d)) (/ h l) 1.0) (sqrt (/ d h)))
(sqrt (/ d l)))
(if (<= h -2e-310)
(* (* (- d) t_1) (- 1.0 (/ (* t_0 (* (* 0.5 (* M t_2)) (/ h l))) 2.0)))
(* (* t_1 d) (- 1.0 (/ (* t_3 (* t_3 (* 0.5 h))) l)))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = (M / d) * D;
double t_1 = sqrt((1.0 / (l * h)));
double t_2 = (D / d) / 2.0;
double t_3 = t_2 * M;
double tmp;
if (h <= -1.52e+215) {
tmp = (fma((-0.125 * (((t_0 * D) * M) / d)), (h / l), 1.0) * sqrt((d / h))) * sqrt((d / l));
} else if (h <= -2e-310) {
tmp = (-d * t_1) * (1.0 - ((t_0 * ((0.5 * (M * t_2)) * (h / l))) / 2.0));
} else {
tmp = (t_1 * d) * (1.0 - ((t_3 * (t_3 * (0.5 * h))) / l));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(Float64(M / d) * D) t_1 = sqrt(Float64(1.0 / Float64(l * h))) t_2 = Float64(Float64(D / d) / 2.0) t_3 = Float64(t_2 * M) tmp = 0.0 if (h <= -1.52e+215) tmp = Float64(Float64(fma(Float64(-0.125 * Float64(Float64(Float64(t_0 * D) * M) / d)), Float64(h / l), 1.0) * sqrt(Float64(d / h))) * sqrt(Float64(d / l))); elseif (h <= -2e-310) tmp = Float64(Float64(Float64(-d) * t_1) * Float64(1.0 - Float64(Float64(t_0 * Float64(Float64(0.5 * Float64(M * t_2)) * Float64(h / l))) / 2.0))); else tmp = Float64(Float64(t_1 * d) * Float64(1.0 - Float64(Float64(t_3 * Float64(t_3 * Float64(0.5 * h))) / l))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(M / d), $MachinePrecision] * D), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(D / d), $MachinePrecision] / 2.0), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 * M), $MachinePrecision]}, If[LessEqual[h, -1.52e+215], N[(N[(N[(N[(-0.125 * N[(N[(N[(t$95$0 * D), $MachinePrecision] * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -2e-310], N[(N[((-d) * t$95$1), $MachinePrecision] * N[(1.0 - N[(N[(t$95$0 * N[(N[(0.5 * N[(M * t$95$2), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 * d), $MachinePrecision] * N[(1.0 - N[(N[(t$95$3 * N[(t$95$3 * N[(0.5 * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{M}{d} \cdot D\\
t_1 := \sqrt{\frac{1}{\ell \cdot h}}\\
t_2 := \frac{\frac{D}{d}}{2}\\
t_3 := t\_2 \cdot M\\
\mathbf{if}\;h \leq -1.52 \cdot 10^{+215}:\\
\;\;\;\;\left(\mathsf{fma}\left(-0.125 \cdot \frac{\left(t\_0 \cdot D\right) \cdot M}{d}, \frac{h}{\ell}, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(\left(-d\right) \cdot t\_1\right) \cdot \left(1 - \frac{t\_0 \cdot \left(\left(0.5 \cdot \left(M \cdot t\_2\right)\right) \cdot \frac{h}{\ell}\right)}{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 \cdot d\right) \cdot \left(1 - \frac{t\_3 \cdot \left(t\_3 \cdot \left(0.5 \cdot h\right)\right)}{\ell}\right)\\
\end{array}
\end{array}
if h < -1.51999999999999999e215Initial program 60.7%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites60.6%
lift-pow.f64N/A
unpow2N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6460.6
Applied rewrites60.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
times-fracN/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f6460.6
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6460.6
Applied rewrites60.6%
if -1.51999999999999999e215 < h < -1.999999999999994e-310Initial program 71.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6471.0
lift-/.f64N/A
metadata-eval71.0
Applied rewrites71.0%
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites74.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-*l/N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
associate-*l/N/A
lift-/.f64N/A
lift-*.f64N/A
lower-/.f64N/A
Applied rewrites74.1%
Taylor expanded in h around -inf
Applied rewrites80.1%
if -1.999999999999994e-310 < h Initial program 67.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6469.9
lift-/.f64N/A
metadata-eval69.9
Applied rewrites69.9%
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites73.5%
Taylor expanded in d around 0
Applied rewrites83.5%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ 1.0 (* l h)))) (t_1 (* (/ (/ D d) 2.0) M)))
(if (<= d -4.8e-118)
(*
(*
(fma (* -0.5 (* (* M D) (/ (* (/ M d) D) (* 4.0 d)))) (/ h l) 1.0)
(sqrt (/ d h)))
(sqrt (/ d l)))
(if (<= d -4.6e-299)
(*
(* (- d) t_0)
(- 1.0 (* (* (* 0.125 (* D D)) (/ (* M (/ M d)) d)) (/ h l))))
(* (* t_0 d) (- 1.0 (/ (* t_1 (* t_1 (* 0.5 h))) l)))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((1.0 / (l * h)));
double t_1 = ((D / d) / 2.0) * M;
double tmp;
if (d <= -4.8e-118) {
tmp = (fma((-0.5 * ((M * D) * (((M / d) * D) / (4.0 * d)))), (h / l), 1.0) * sqrt((d / h))) * sqrt((d / l));
} else if (d <= -4.6e-299) {
tmp = (-d * t_0) * (1.0 - (((0.125 * (D * D)) * ((M * (M / d)) / d)) * (h / l)));
} else {
tmp = (t_0 * d) * (1.0 - ((t_1 * (t_1 * (0.5 * h))) / l));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = sqrt(Float64(1.0 / Float64(l * h))) t_1 = Float64(Float64(Float64(D / d) / 2.0) * M) tmp = 0.0 if (d <= -4.8e-118) tmp = Float64(Float64(fma(Float64(-0.5 * Float64(Float64(M * D) * Float64(Float64(Float64(M / d) * D) / Float64(4.0 * d)))), Float64(h / l), 1.0) * sqrt(Float64(d / h))) * sqrt(Float64(d / l))); elseif (d <= -4.6e-299) tmp = Float64(Float64(Float64(-d) * t_0) * Float64(1.0 - Float64(Float64(Float64(0.125 * Float64(D * D)) * Float64(Float64(M * Float64(M / d)) / d)) * Float64(h / l)))); else tmp = Float64(Float64(t_0 * d) * Float64(1.0 - Float64(Float64(t_1 * Float64(t_1 * Float64(0.5 * h))) / l))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(D / d), $MachinePrecision] / 2.0), $MachinePrecision] * M), $MachinePrecision]}, If[LessEqual[d, -4.8e-118], N[(N[(N[(N[(-0.5 * N[(N[(M * D), $MachinePrecision] * N[(N[(N[(M / d), $MachinePrecision] * D), $MachinePrecision] / N[(4.0 * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4.6e-299], N[(N[((-d) * t$95$0), $MachinePrecision] * N[(1.0 - N[(N[(N[(0.125 * N[(D * D), $MachinePrecision]), $MachinePrecision] * N[(N[(M * N[(M / d), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 * d), $MachinePrecision] * N[(1.0 - N[(N[(t$95$1 * N[(t$95$1 * N[(0.5 * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{\ell \cdot h}}\\
t_1 := \frac{\frac{D}{d}}{2} \cdot M\\
\mathbf{if}\;d \leq -4.8 \cdot 10^{-118}:\\
\;\;\;\;\left(\mathsf{fma}\left(-0.5 \cdot \left(\left(M \cdot D\right) \cdot \frac{\frac{M}{d} \cdot D}{4 \cdot d}\right), \frac{h}{\ell}, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;d \leq -4.6 \cdot 10^{-299}:\\
\;\;\;\;\left(\left(-d\right) \cdot t\_0\right) \cdot \left(1 - \left(\left(0.125 \cdot \left(D \cdot D\right)\right) \cdot \frac{M \cdot \frac{M}{d}}{d}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 \cdot d\right) \cdot \left(1 - \frac{t\_1 \cdot \left(t\_1 \cdot \left(0.5 \cdot h\right)\right)}{\ell}\right)\\
\end{array}
\end{array}
if d < -4.8000000000000003e-118Initial program 81.5%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites80.4%
lift-pow.f64N/A
unpow2N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6478.0
Applied rewrites78.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6480.4
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
metadata-eval80.4
Applied rewrites80.4%
if -4.8000000000000003e-118 < d < -4.6000000000000001e-299Initial program 42.2%
Taylor expanded in d around 0
Applied rewrites3.9%
Taylor expanded in d around 0
Applied rewrites0.5%
Taylor expanded in h around -inf
Applied rewrites46.9%
if -4.6000000000000001e-299 < d Initial program 67.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6470.1
lift-/.f64N/A
metadata-eval70.1
Applied rewrites70.1%
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites73.6%
Taylor expanded in d around 0
Applied rewrites83.6%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ 1.0 (* l h)))) (t_1 (* (- d) t_0)))
(if (<= d -2.1e+115)
t_1
(if (<= d -4.8e-118)
(*
(*
(fma (* -0.5 (/ (* (* M D) (* M D)) (* d (* 4.0 d)))) (/ h l) 1.0)
(sqrt (/ d h)))
(sqrt (/ d l)))
(if (<= d -4.6e-299)
(* t_1 (- 1.0 (* (* (* 0.125 (* D D)) (/ (* M (/ M d)) d)) (/ h l))))
(*
(* t_0 d)
(-
1.0
(/ (* (* (/ (/ D d) 2.0) M) (* (/ (* (* M h) D) d) 0.25)) l))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((1.0 / (l * h)));
double t_1 = -d * t_0;
double tmp;
if (d <= -2.1e+115) {
tmp = t_1;
} else if (d <= -4.8e-118) {
tmp = (fma((-0.5 * (((M * D) * (M * D)) / (d * (4.0 * d)))), (h / l), 1.0) * sqrt((d / h))) * sqrt((d / l));
} else if (d <= -4.6e-299) {
tmp = t_1 * (1.0 - (((0.125 * (D * D)) * ((M * (M / d)) / d)) * (h / l)));
} else {
tmp = (t_0 * d) * (1.0 - (((((D / d) / 2.0) * M) * ((((M * h) * D) / d) * 0.25)) / l));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = sqrt(Float64(1.0 / Float64(l * h))) t_1 = Float64(Float64(-d) * t_0) tmp = 0.0 if (d <= -2.1e+115) tmp = t_1; elseif (d <= -4.8e-118) tmp = Float64(Float64(fma(Float64(-0.5 * Float64(Float64(Float64(M * D) * Float64(M * D)) / Float64(d * Float64(4.0 * d)))), Float64(h / l), 1.0) * sqrt(Float64(d / h))) * sqrt(Float64(d / l))); elseif (d <= -4.6e-299) tmp = Float64(t_1 * Float64(1.0 - Float64(Float64(Float64(0.125 * Float64(D * D)) * Float64(Float64(M * Float64(M / d)) / d)) * Float64(h / l)))); else tmp = Float64(Float64(t_0 * d) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(D / d) / 2.0) * M) * Float64(Float64(Float64(Float64(M * h) * D) / d) * 0.25)) / l))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[((-d) * t$95$0), $MachinePrecision]}, If[LessEqual[d, -2.1e+115], t$95$1, If[LessEqual[d, -4.8e-118], N[(N[(N[(N[(-0.5 * N[(N[(N[(M * D), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / N[(d * N[(4.0 * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4.6e-299], N[(t$95$1 * N[(1.0 - N[(N[(N[(0.125 * N[(D * D), $MachinePrecision]), $MachinePrecision] * N[(N[(M * N[(M / d), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 * d), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(N[(D / d), $MachinePrecision] / 2.0), $MachinePrecision] * M), $MachinePrecision] * N[(N[(N[(N[(M * h), $MachinePrecision] * D), $MachinePrecision] / d), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{\ell \cdot h}}\\
t_1 := \left(-d\right) \cdot t\_0\\
\mathbf{if}\;d \leq -2.1 \cdot 10^{+115}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d \leq -4.8 \cdot 10^{-118}:\\
\;\;\;\;\left(\mathsf{fma}\left(-0.5 \cdot \frac{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}{d \cdot \left(4 \cdot d\right)}, \frac{h}{\ell}, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;d \leq -4.6 \cdot 10^{-299}:\\
\;\;\;\;t\_1 \cdot \left(1 - \left(\left(0.125 \cdot \left(D \cdot D\right)\right) \cdot \frac{M \cdot \frac{M}{d}}{d}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 \cdot d\right) \cdot \left(1 - \frac{\left(\frac{\frac{D}{d}}{2} \cdot M\right) \cdot \left(\frac{\left(M \cdot h\right) \cdot D}{d} \cdot 0.25\right)}{\ell}\right)\\
\end{array}
\end{array}
if d < -2.10000000000000003e115Initial program 80.7%
Taylor expanded in l around -inf
Applied rewrites70.3%
if -2.10000000000000003e115 < d < -4.8000000000000003e-118Initial program 82.1%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites80.1%
lift-pow.f64N/A
unpow2N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6480.1
Applied rewrites80.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f6482.2
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
metadata-eval82.2
Applied rewrites82.2%
if -4.8000000000000003e-118 < d < -4.6000000000000001e-299Initial program 42.2%
Taylor expanded in d around 0
Applied rewrites3.9%
Taylor expanded in d around 0
Applied rewrites0.5%
Taylor expanded in h around -inf
Applied rewrites46.9%
if -4.6000000000000001e-299 < d Initial program 67.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6470.1
lift-/.f64N/A
metadata-eval70.1
Applied rewrites70.1%
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites73.6%
Taylor expanded in d around 0
Applied rewrites83.6%
Taylor expanded in d around 0
Applied rewrites81.6%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ 1.0 (* l h)))))
(if (<= l -4.6e+139)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(if (<= l -1.05e-302)
(*
(* (- d) t_0)
(- 1.0 (* (* (* 0.125 (* D D)) (/ (* M (/ M d)) d)) (/ h l))))
(if (<= l 8e+63)
(*
(* t_0 d)
(- 1.0 (/ (* (* (/ (/ D d) 2.0) M) (* (/ (* (* M h) D) d) 0.25)) l)))
(* (/ 1.0 (* (sqrt l) (sqrt h))) d))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((1.0 / (l * h)));
double tmp;
if (l <= -4.6e+139) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else if (l <= -1.05e-302) {
tmp = (-d * t_0) * (1.0 - (((0.125 * (D * D)) * ((M * (M / d)) / d)) * (h / l)));
} else if (l <= 8e+63) {
tmp = (t_0 * d) * (1.0 - (((((D / d) / 2.0) * M) * ((((M * h) * D) / d) * 0.25)) / 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 = sqrt((1.0d0 / (l * h)))
if (l <= (-4.6d+139)) then
tmp = sqrt((d / h)) * sqrt((d / l))
else if (l <= (-1.05d-302)) then
tmp = (-d * t_0) * (1.0d0 - (((0.125d0 * (d_1 * d_1)) * ((m * (m / d)) / d)) * (h / l)))
else if (l <= 8d+63) then
tmp = (t_0 * d) * (1.0d0 - (((((d_1 / d) / 2.0d0) * m) * ((((m * h) * d_1) / d) * 0.25d0)) / 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 = Math.sqrt((1.0 / (l * h)));
double tmp;
if (l <= -4.6e+139) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else if (l <= -1.05e-302) {
tmp = (-d * t_0) * (1.0 - (((0.125 * (D * D)) * ((M * (M / d)) / d)) * (h / l)));
} else if (l <= 8e+63) {
tmp = (t_0 * d) * (1.0 - (((((D / d) / 2.0) * M) * ((((M * h) * D) / d) * 0.25)) / l));
} else {
tmp = (1.0 / (Math.sqrt(l) * Math.sqrt(h))) * d;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((1.0 / (l * h))) tmp = 0 if l <= -4.6e+139: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) elif l <= -1.05e-302: tmp = (-d * t_0) * (1.0 - (((0.125 * (D * D)) * ((M * (M / d)) / d)) * (h / l))) elif l <= 8e+63: tmp = (t_0 * d) * (1.0 - (((((D / d) / 2.0) * M) * ((((M * h) * D) / d) * 0.25)) / l)) else: tmp = (1.0 / (math.sqrt(l) * math.sqrt(h))) * d return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(1.0 / Float64(l * h))) tmp = 0.0 if (l <= -4.6e+139) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); elseif (l <= -1.05e-302) tmp = Float64(Float64(Float64(-d) * t_0) * Float64(1.0 - Float64(Float64(Float64(0.125 * Float64(D * D)) * Float64(Float64(M * Float64(M / d)) / d)) * Float64(h / l)))); elseif (l <= 8e+63) tmp = Float64(Float64(t_0 * d) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(D / d) / 2.0) * M) * Float64(Float64(Float64(Float64(M * h) * D) / d) * 0.25)) / 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 = sqrt((1.0 / (l * h))); tmp = 0.0; if (l <= -4.6e+139) tmp = sqrt((d / h)) * sqrt((d / l)); elseif (l <= -1.05e-302) tmp = (-d * t_0) * (1.0 - (((0.125 * (D * D)) * ((M * (M / d)) / d)) * (h / l))); elseif (l <= 8e+63) tmp = (t_0 * d) * (1.0 - (((((D / d) / 2.0) * M) * ((((M * h) * D) / d) * 0.25)) / 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[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -4.6e+139], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1.05e-302], N[(N[((-d) * t$95$0), $MachinePrecision] * N[(1.0 - N[(N[(N[(0.125 * N[(D * D), $MachinePrecision]), $MachinePrecision] * N[(N[(M * N[(M / d), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 8e+63], N[(N[(t$95$0 * d), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(N[(D / d), $MachinePrecision] / 2.0), $MachinePrecision] * M), $MachinePrecision] * N[(N[(N[(N[(M * h), $MachinePrecision] * D), $MachinePrecision] / d), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] / l), $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 := \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{if}\;\ell \leq -4.6 \cdot 10^{+139}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;\ell \leq -1.05 \cdot 10^{-302}:\\
\;\;\;\;\left(\left(-d\right) \cdot t\_0\right) \cdot \left(1 - \left(\left(0.125 \cdot \left(D \cdot D\right)\right) \cdot \frac{M \cdot \frac{M}{d}}{d}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{elif}\;\ell \leq 8 \cdot 10^{+63}:\\
\;\;\;\;\left(t\_0 \cdot d\right) \cdot \left(1 - \frac{\left(\frac{\frac{D}{d}}{2} \cdot M\right) \cdot \left(\frac{\left(M \cdot h\right) \cdot D}{d} \cdot 0.25\right)}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{\ell} \cdot \sqrt{h}} \cdot d\\
\end{array}
\end{array}
if l < -4.6e139Initial program 56.5%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites56.4%
Taylor expanded in d around inf
Applied rewrites55.0%
if -4.6e139 < l < -1.05000000000000006e-302Initial program 75.3%
Taylor expanded in d around 0
Applied rewrites0.5%
Taylor expanded in d around 0
Applied rewrites0.3%
Taylor expanded in h around -inf
Applied rewrites69.0%
if -1.05000000000000006e-302 < l < 8.00000000000000046e63Initial program 76.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6476.9
lift-/.f64N/A
metadata-eval76.9
Applied rewrites76.9%
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites79.1%
Taylor expanded in d around 0
Applied rewrites91.2%
Taylor expanded in d around 0
Applied rewrites88.1%
if 8.00000000000000046e63 < l Initial program 51.9%
Taylor expanded in d around inf
Applied rewrites55.8%
Applied rewrites55.7%
Applied rewrites71.4%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ 1.0 (* l h)))))
(if (<= d -4.8e-118)
(*
(*
(fma (* -0.5 (* (* M D) (/ (* (/ M d) D) (* 4.0 d)))) (/ h l) 1.0)
(sqrt (/ d h)))
(sqrt (/ d l)))
(if (<= d -4.6e-299)
(*
(* (- d) t_0)
(- 1.0 (* (* (* 0.125 (* D D)) (/ (* M (/ M d)) d)) (/ h l))))
(*
(* t_0 d)
(-
1.0
(/
(/ (* (* (* (* (/ (/ D d) 2.0) M) h) 0.5) (* D M)) (* 2.0 d))
l)))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((1.0 / (l * h)));
double tmp;
if (d <= -4.8e-118) {
tmp = (fma((-0.5 * ((M * D) * (((M / d) * D) / (4.0 * d)))), (h / l), 1.0) * sqrt((d / h))) * sqrt((d / l));
} else if (d <= -4.6e-299) {
tmp = (-d * t_0) * (1.0 - (((0.125 * (D * D)) * ((M * (M / d)) / d)) * (h / l)));
} else {
tmp = (t_0 * d) * (1.0 - ((((((((D / d) / 2.0) * M) * h) * 0.5) * (D * M)) / (2.0 * d)) / l));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = sqrt(Float64(1.0 / Float64(l * h))) tmp = 0.0 if (d <= -4.8e-118) tmp = Float64(Float64(fma(Float64(-0.5 * Float64(Float64(M * D) * Float64(Float64(Float64(M / d) * D) / Float64(4.0 * d)))), Float64(h / l), 1.0) * sqrt(Float64(d / h))) * sqrt(Float64(d / l))); elseif (d <= -4.6e-299) tmp = Float64(Float64(Float64(-d) * t_0) * Float64(1.0 - Float64(Float64(Float64(0.125 * Float64(D * D)) * Float64(Float64(M * Float64(M / d)) / d)) * Float64(h / l)))); else tmp = Float64(Float64(t_0 * d) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(D / d) / 2.0) * M) * h) * 0.5) * Float64(D * M)) / Float64(2.0 * d)) / l))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -4.8e-118], N[(N[(N[(N[(-0.5 * N[(N[(M * D), $MachinePrecision] * N[(N[(N[(M / d), $MachinePrecision] * D), $MachinePrecision] / N[(4.0 * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4.6e-299], N[(N[((-d) * t$95$0), $MachinePrecision] * N[(1.0 - N[(N[(N[(0.125 * N[(D * D), $MachinePrecision]), $MachinePrecision] * N[(N[(M * N[(M / d), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 * d), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(N[(N[(N[(N[(D / d), $MachinePrecision] / 2.0), $MachinePrecision] * M), $MachinePrecision] * h), $MachinePrecision] * 0.5), $MachinePrecision] * N[(D * M), $MachinePrecision]), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{if}\;d \leq -4.8 \cdot 10^{-118}:\\
\;\;\;\;\left(\mathsf{fma}\left(-0.5 \cdot \left(\left(M \cdot D\right) \cdot \frac{\frac{M}{d} \cdot D}{4 \cdot d}\right), \frac{h}{\ell}, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;d \leq -4.6 \cdot 10^{-299}:\\
\;\;\;\;\left(\left(-d\right) \cdot t\_0\right) \cdot \left(1 - \left(\left(0.125 \cdot \left(D \cdot D\right)\right) \cdot \frac{M \cdot \frac{M}{d}}{d}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 \cdot d\right) \cdot \left(1 - \frac{\frac{\left(\left(\left(\frac{\frac{D}{d}}{2} \cdot M\right) \cdot h\right) \cdot 0.5\right) \cdot \left(D \cdot M\right)}{2 \cdot d}}{\ell}\right)\\
\end{array}
\end{array}
if d < -4.8000000000000003e-118Initial program 81.5%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites80.4%
lift-pow.f64N/A
unpow2N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6478.0
Applied rewrites78.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6480.4
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
metadata-eval80.4
Applied rewrites80.4%
if -4.8000000000000003e-118 < d < -4.6000000000000001e-299Initial program 42.2%
Taylor expanded in d around 0
Applied rewrites3.9%
Taylor expanded in d around 0
Applied rewrites0.5%
Taylor expanded in h around -inf
Applied rewrites46.9%
if -4.6000000000000001e-299 < d Initial program 67.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6470.1
lift-/.f64N/A
metadata-eval70.1
Applied rewrites70.1%
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites73.6%
Taylor expanded in d around 0
Applied rewrites83.6%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
*-commutativeN/A
associate-/l*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites82.3%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ 1.0 (* l h)))))
(if (<= d -4.8e-118)
(*
(*
(fma (* -0.125 (/ (* (* (* (/ M d) D) D) M) d)) (/ h l) 1.0)
(sqrt (/ d h)))
(sqrt (/ d l)))
(if (<= d -4.6e-299)
(*
(* (- d) t_0)
(- 1.0 (* (* (* 0.125 (* D D)) (/ (* M (/ M d)) d)) (/ h l))))
(*
(* t_0 d)
(-
1.0
(/
(/ (* (* (* (* (/ (/ D d) 2.0) M) h) 0.5) (* D M)) (* 2.0 d))
l)))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((1.0 / (l * h)));
double tmp;
if (d <= -4.8e-118) {
tmp = (fma((-0.125 * (((((M / d) * D) * D) * M) / d)), (h / l), 1.0) * sqrt((d / h))) * sqrt((d / l));
} else if (d <= -4.6e-299) {
tmp = (-d * t_0) * (1.0 - (((0.125 * (D * D)) * ((M * (M / d)) / d)) * (h / l)));
} else {
tmp = (t_0 * d) * (1.0 - ((((((((D / d) / 2.0) * M) * h) * 0.5) * (D * M)) / (2.0 * d)) / l));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = sqrt(Float64(1.0 / Float64(l * h))) tmp = 0.0 if (d <= -4.8e-118) tmp = Float64(Float64(fma(Float64(-0.125 * Float64(Float64(Float64(Float64(Float64(M / d) * D) * D) * M) / d)), Float64(h / l), 1.0) * sqrt(Float64(d / h))) * sqrt(Float64(d / l))); elseif (d <= -4.6e-299) tmp = Float64(Float64(Float64(-d) * t_0) * Float64(1.0 - Float64(Float64(Float64(0.125 * Float64(D * D)) * Float64(Float64(M * Float64(M / d)) / d)) * Float64(h / l)))); else tmp = Float64(Float64(t_0 * d) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(D / d) / 2.0) * M) * h) * 0.5) * Float64(D * M)) / Float64(2.0 * d)) / l))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -4.8e-118], N[(N[(N[(N[(-0.125 * N[(N[(N[(N[(N[(M / d), $MachinePrecision] * D), $MachinePrecision] * D), $MachinePrecision] * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4.6e-299], N[(N[((-d) * t$95$0), $MachinePrecision] * N[(1.0 - N[(N[(N[(0.125 * N[(D * D), $MachinePrecision]), $MachinePrecision] * N[(N[(M * N[(M / d), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 * d), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(N[(N[(N[(N[(D / d), $MachinePrecision] / 2.0), $MachinePrecision] * M), $MachinePrecision] * h), $MachinePrecision] * 0.5), $MachinePrecision] * N[(D * M), $MachinePrecision]), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{if}\;d \leq -4.8 \cdot 10^{-118}:\\
\;\;\;\;\left(\mathsf{fma}\left(-0.125 \cdot \frac{\left(\left(\frac{M}{d} \cdot D\right) \cdot D\right) \cdot M}{d}, \frac{h}{\ell}, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;d \leq -4.6 \cdot 10^{-299}:\\
\;\;\;\;\left(\left(-d\right) \cdot t\_0\right) \cdot \left(1 - \left(\left(0.125 \cdot \left(D \cdot D\right)\right) \cdot \frac{M \cdot \frac{M}{d}}{d}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 \cdot d\right) \cdot \left(1 - \frac{\frac{\left(\left(\left(\frac{\frac{D}{d}}{2} \cdot M\right) \cdot h\right) \cdot 0.5\right) \cdot \left(D \cdot M\right)}{2 \cdot d}}{\ell}\right)\\
\end{array}
\end{array}
if d < -4.8000000000000003e-118Initial program 81.5%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites80.4%
lift-pow.f64N/A
unpow2N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6478.0
Applied rewrites78.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
times-fracN/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f6478.0
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6478.0
Applied rewrites78.0%
if -4.8000000000000003e-118 < d < -4.6000000000000001e-299Initial program 42.2%
Taylor expanded in d around 0
Applied rewrites3.9%
Taylor expanded in d around 0
Applied rewrites0.5%
Taylor expanded in h around -inf
Applied rewrites46.9%
if -4.6000000000000001e-299 < d Initial program 67.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6470.1
lift-/.f64N/A
metadata-eval70.1
Applied rewrites70.1%
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites73.6%
Taylor expanded in d around 0
Applied rewrites83.6%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
*-commutativeN/A
associate-/l*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites82.3%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ 1.0 (* l h)))) (t_1 (* t_0 d)))
(if (<= d -4.7e+38)
(* (- d) t_0)
(if (<= d -4.6e-299)
(*
(* (* -0.125 (sqrt (/ h (* (* d d) d)))) (/ (* (* D D) (* M M)) (- l)))
(sqrt (/ d l)))
(if (<= d 1.6e-149)
(* t_1 (- 1.0 (* (* (* 0.125 (* D D)) (/ (* M (/ M d)) d)) (/ h l))))
(if (<= d 8.2e+197)
(*
t_1
(- 1.0 (/ (* (* (/ (* (* M M) h) d) (* D (/ D d))) 0.125) l)))
(/ d (* (sqrt l) (sqrt h)))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((1.0 / (l * h)));
double t_1 = t_0 * d;
double tmp;
if (d <= -4.7e+38) {
tmp = -d * t_0;
} else if (d <= -4.6e-299) {
tmp = ((-0.125 * sqrt((h / ((d * d) * d)))) * (((D * D) * (M * M)) / -l)) * sqrt((d / l));
} else if (d <= 1.6e-149) {
tmp = t_1 * (1.0 - (((0.125 * (D * D)) * ((M * (M / d)) / d)) * (h / l)));
} else if (d <= 8.2e+197) {
tmp = t_1 * (1.0 - ((((((M * M) * h) / d) * (D * (D / d))) * 0.125) / l));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt((1.0d0 / (l * h)))
t_1 = t_0 * d
if (d <= (-4.7d+38)) then
tmp = -d * t_0
else if (d <= (-4.6d-299)) then
tmp = (((-0.125d0) * sqrt((h / ((d * d) * d)))) * (((d_1 * d_1) * (m * m)) / -l)) * sqrt((d / l))
else if (d <= 1.6d-149) then
tmp = t_1 * (1.0d0 - (((0.125d0 * (d_1 * d_1)) * ((m * (m / d)) / d)) * (h / l)))
else if (d <= 8.2d+197) then
tmp = t_1 * (1.0d0 - ((((((m * m) * h) / d) * (d_1 * (d_1 / d))) * 0.125d0) / l))
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((1.0 / (l * h)));
double t_1 = t_0 * d;
double tmp;
if (d <= -4.7e+38) {
tmp = -d * t_0;
} else if (d <= -4.6e-299) {
tmp = ((-0.125 * Math.sqrt((h / ((d * d) * d)))) * (((D * D) * (M * M)) / -l)) * Math.sqrt((d / l));
} else if (d <= 1.6e-149) {
tmp = t_1 * (1.0 - (((0.125 * (D * D)) * ((M * (M / d)) / d)) * (h / l)));
} else if (d <= 8.2e+197) {
tmp = t_1 * (1.0 - ((((((M * M) * h) / d) * (D * (D / d))) * 0.125) / l));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((1.0 / (l * h))) t_1 = t_0 * d tmp = 0 if d <= -4.7e+38: tmp = -d * t_0 elif d <= -4.6e-299: tmp = ((-0.125 * math.sqrt((h / ((d * d) * d)))) * (((D * D) * (M * M)) / -l)) * math.sqrt((d / l)) elif d <= 1.6e-149: tmp = t_1 * (1.0 - (((0.125 * (D * D)) * ((M * (M / d)) / d)) * (h / l))) elif d <= 8.2e+197: tmp = t_1 * (1.0 - ((((((M * M) * h) / d) * (D * (D / d))) * 0.125) / l)) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(1.0 / Float64(l * h))) t_1 = Float64(t_0 * d) tmp = 0.0 if (d <= -4.7e+38) tmp = Float64(Float64(-d) * t_0); elseif (d <= -4.6e-299) tmp = Float64(Float64(Float64(-0.125 * sqrt(Float64(h / Float64(Float64(d * d) * d)))) * Float64(Float64(Float64(D * D) * Float64(M * M)) / Float64(-l))) * sqrt(Float64(d / l))); elseif (d <= 1.6e-149) tmp = Float64(t_1 * Float64(1.0 - Float64(Float64(Float64(0.125 * Float64(D * D)) * Float64(Float64(M * Float64(M / d)) / d)) * Float64(h / l)))); elseif (d <= 8.2e+197) tmp = Float64(t_1 * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(M * M) * h) / d) * Float64(D * Float64(D / d))) * 0.125) / l))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((1.0 / (l * h))); t_1 = t_0 * d; tmp = 0.0; if (d <= -4.7e+38) tmp = -d * t_0; elseif (d <= -4.6e-299) tmp = ((-0.125 * sqrt((h / ((d * d) * d)))) * (((D * D) * (M * M)) / -l)) * sqrt((d / l)); elseif (d <= 1.6e-149) tmp = t_1 * (1.0 - (((0.125 * (D * D)) * ((M * (M / d)) / d)) * (h / l))); elseif (d <= 8.2e+197) tmp = t_1 * (1.0 - ((((((M * M) * h) / d) * (D * (D / d))) * 0.125) / l)); else tmp = d / (sqrt(l) * sqrt(h)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * d), $MachinePrecision]}, If[LessEqual[d, -4.7e+38], N[((-d) * t$95$0), $MachinePrecision], If[LessEqual[d, -4.6e-299], N[(N[(N[(-0.125 * N[Sqrt[N[(h / N[(N[(d * d), $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(D * D), $MachinePrecision] * N[(M * M), $MachinePrecision]), $MachinePrecision] / (-l)), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.6e-149], N[(t$95$1 * N[(1.0 - N[(N[(N[(0.125 * N[(D * D), $MachinePrecision]), $MachinePrecision] * N[(N[(M * N[(M / d), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 8.2e+197], N[(t$95$1 * N[(1.0 - N[(N[(N[(N[(N[(N[(M * M), $MachinePrecision] * h), $MachinePrecision] / d), $MachinePrecision] * N[(D * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{\ell \cdot h}}\\
t_1 := t\_0 \cdot d\\
\mathbf{if}\;d \leq -4.7 \cdot 10^{+38}:\\
\;\;\;\;\left(-d\right) \cdot t\_0\\
\mathbf{elif}\;d \leq -4.6 \cdot 10^{-299}:\\
\;\;\;\;\left(\left(-0.125 \cdot \sqrt{\frac{h}{\left(d \cdot d\right) \cdot d}}\right) \cdot \frac{\left(D \cdot D\right) \cdot \left(M \cdot M\right)}{-\ell}\right) \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;d \leq 1.6 \cdot 10^{-149}:\\
\;\;\;\;t\_1 \cdot \left(1 - \left(\left(0.125 \cdot \left(D \cdot D\right)\right) \cdot \frac{M \cdot \frac{M}{d}}{d}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{elif}\;d \leq 8.2 \cdot 10^{+197}:\\
\;\;\;\;t\_1 \cdot \left(1 - \frac{\left(\frac{\left(M \cdot M\right) \cdot h}{d} \cdot \left(D \cdot \frac{D}{d}\right)\right) \cdot 0.125}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -4.6999999999999999e38Initial program 80.8%
Taylor expanded in l around -inf
Applied rewrites64.0%
if -4.6999999999999999e38 < d < -4.6000000000000001e-299Initial program 60.6%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites59.9%
Taylor expanded in h around -inf
Applied rewrites42.0%
Applied rewrites42.0%
if -4.6000000000000001e-299 < d < 1.60000000000000001e-149Initial program 48.0%
Taylor expanded in d around 0
Applied rewrites79.3%
Taylor expanded in d around 0
Applied rewrites75.4%
if 1.60000000000000001e-149 < d < 8.2000000000000006e197Initial program 78.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6481.3
lift-/.f64N/A
metadata-eval81.3
Applied rewrites81.3%
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites86.6%
Taylor expanded in d around 0
Applied rewrites86.8%
Taylor expanded in d around 0
Applied rewrites74.7%
if 8.2000000000000006e197 < d Initial program 65.2%
Taylor expanded in d around inf
Applied rewrites56.1%
Applied rewrites56.0%
Applied rewrites56.1%
Applied rewrites77.5%
Final simplification64.6%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ 1.0 (* l h)))))
(if (<= d -4.8e-118)
(*
(*
(fma (* -0.125 (/ (* (* (* (/ M d) D) D) M) d)) (/ h l) 1.0)
(sqrt (/ d h)))
(sqrt (/ d l)))
(if (<= d -4.6e-299)
(*
(* (- d) t_0)
(- 1.0 (* (* (* 0.125 (* D D)) (/ (* M (/ M d)) d)) (/ h l))))
(*
(* t_0 d)
(-
1.0
(/ (* (* (/ (/ D d) 2.0) M) (* (/ (* (* M h) D) d) 0.25)) l)))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((1.0 / (l * h)));
double tmp;
if (d <= -4.8e-118) {
tmp = (fma((-0.125 * (((((M / d) * D) * D) * M) / d)), (h / l), 1.0) * sqrt((d / h))) * sqrt((d / l));
} else if (d <= -4.6e-299) {
tmp = (-d * t_0) * (1.0 - (((0.125 * (D * D)) * ((M * (M / d)) / d)) * (h / l)));
} else {
tmp = (t_0 * d) * (1.0 - (((((D / d) / 2.0) * M) * ((((M * h) * D) / d) * 0.25)) / l));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = sqrt(Float64(1.0 / Float64(l * h))) tmp = 0.0 if (d <= -4.8e-118) tmp = Float64(Float64(fma(Float64(-0.125 * Float64(Float64(Float64(Float64(Float64(M / d) * D) * D) * M) / d)), Float64(h / l), 1.0) * sqrt(Float64(d / h))) * sqrt(Float64(d / l))); elseif (d <= -4.6e-299) tmp = Float64(Float64(Float64(-d) * t_0) * Float64(1.0 - Float64(Float64(Float64(0.125 * Float64(D * D)) * Float64(Float64(M * Float64(M / d)) / d)) * Float64(h / l)))); else tmp = Float64(Float64(t_0 * d) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(D / d) / 2.0) * M) * Float64(Float64(Float64(Float64(M * h) * D) / d) * 0.25)) / l))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -4.8e-118], N[(N[(N[(N[(-0.125 * N[(N[(N[(N[(N[(M / d), $MachinePrecision] * D), $MachinePrecision] * D), $MachinePrecision] * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4.6e-299], N[(N[((-d) * t$95$0), $MachinePrecision] * N[(1.0 - N[(N[(N[(0.125 * N[(D * D), $MachinePrecision]), $MachinePrecision] * N[(N[(M * N[(M / d), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 * d), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(N[(D / d), $MachinePrecision] / 2.0), $MachinePrecision] * M), $MachinePrecision] * N[(N[(N[(N[(M * h), $MachinePrecision] * D), $MachinePrecision] / d), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{if}\;d \leq -4.8 \cdot 10^{-118}:\\
\;\;\;\;\left(\mathsf{fma}\left(-0.125 \cdot \frac{\left(\left(\frac{M}{d} \cdot D\right) \cdot D\right) \cdot M}{d}, \frac{h}{\ell}, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;d \leq -4.6 \cdot 10^{-299}:\\
\;\;\;\;\left(\left(-d\right) \cdot t\_0\right) \cdot \left(1 - \left(\left(0.125 \cdot \left(D \cdot D\right)\right) \cdot \frac{M \cdot \frac{M}{d}}{d}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 \cdot d\right) \cdot \left(1 - \frac{\left(\frac{\frac{D}{d}}{2} \cdot M\right) \cdot \left(\frac{\left(M \cdot h\right) \cdot D}{d} \cdot 0.25\right)}{\ell}\right)\\
\end{array}
\end{array}
if d < -4.8000000000000003e-118Initial program 81.5%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites80.4%
lift-pow.f64N/A
unpow2N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6478.0
Applied rewrites78.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
times-fracN/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f6478.0
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6478.0
Applied rewrites78.0%
if -4.8000000000000003e-118 < d < -4.6000000000000001e-299Initial program 42.2%
Taylor expanded in d around 0
Applied rewrites3.9%
Taylor expanded in d around 0
Applied rewrites0.5%
Taylor expanded in h around -inf
Applied rewrites46.9%
if -4.6000000000000001e-299 < d Initial program 67.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6470.1
lift-/.f64N/A
metadata-eval70.1
Applied rewrites70.1%
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites73.6%
Taylor expanded in d around 0
Applied rewrites83.6%
Taylor expanded in d around 0
Applied rewrites81.6%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ 1.0 (* l h)))))
(if (<= l -4.6e+139)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(if (<= l -2.05e-275)
(*
(* (- d) t_0)
(- 1.0 (* (* (* 0.125 (* D D)) (/ (* M (/ M d)) d)) (/ h l))))
(if (<= l 1.95e+57)
(*
(* t_0 d)
(- 1.0 (* (/ (* (* (* (* D D) 0.125) M) (/ M d)) d) (/ h l))))
(* (/ 1.0 (* (sqrt l) (sqrt h))) d))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((1.0 / (l * h)));
double tmp;
if (l <= -4.6e+139) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else if (l <= -2.05e-275) {
tmp = (-d * t_0) * (1.0 - (((0.125 * (D * D)) * ((M * (M / d)) / d)) * (h / l)));
} else if (l <= 1.95e+57) {
tmp = (t_0 * d) * (1.0 - ((((((D * D) * 0.125) * M) * (M / d)) / d) * (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 = sqrt((1.0d0 / (l * h)))
if (l <= (-4.6d+139)) then
tmp = sqrt((d / h)) * sqrt((d / l))
else if (l <= (-2.05d-275)) then
tmp = (-d * t_0) * (1.0d0 - (((0.125d0 * (d_1 * d_1)) * ((m * (m / d)) / d)) * (h / l)))
else if (l <= 1.95d+57) then
tmp = (t_0 * d) * (1.0d0 - ((((((d_1 * d_1) * 0.125d0) * m) * (m / d)) / d) * (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 = Math.sqrt((1.0 / (l * h)));
double tmp;
if (l <= -4.6e+139) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else if (l <= -2.05e-275) {
tmp = (-d * t_0) * (1.0 - (((0.125 * (D * D)) * ((M * (M / d)) / d)) * (h / l)));
} else if (l <= 1.95e+57) {
tmp = (t_0 * d) * (1.0 - ((((((D * D) * 0.125) * M) * (M / d)) / d) * (h / l)));
} else {
tmp = (1.0 / (Math.sqrt(l) * Math.sqrt(h))) * d;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((1.0 / (l * h))) tmp = 0 if l <= -4.6e+139: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) elif l <= -2.05e-275: tmp = (-d * t_0) * (1.0 - (((0.125 * (D * D)) * ((M * (M / d)) / d)) * (h / l))) elif l <= 1.95e+57: tmp = (t_0 * d) * (1.0 - ((((((D * D) * 0.125) * M) * (M / d)) / d) * (h / l))) else: tmp = (1.0 / (math.sqrt(l) * math.sqrt(h))) * d return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(1.0 / Float64(l * h))) tmp = 0.0 if (l <= -4.6e+139) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); elseif (l <= -2.05e-275) tmp = Float64(Float64(Float64(-d) * t_0) * Float64(1.0 - Float64(Float64(Float64(0.125 * Float64(D * D)) * Float64(Float64(M * Float64(M / d)) / d)) * Float64(h / l)))); elseif (l <= 1.95e+57) tmp = Float64(Float64(t_0 * d) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(D * D) * 0.125) * M) * Float64(M / d)) / d) * 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 = sqrt((1.0 / (l * h))); tmp = 0.0; if (l <= -4.6e+139) tmp = sqrt((d / h)) * sqrt((d / l)); elseif (l <= -2.05e-275) tmp = (-d * t_0) * (1.0 - (((0.125 * (D * D)) * ((M * (M / d)) / d)) * (h / l))); elseif (l <= 1.95e+57) tmp = (t_0 * d) * (1.0 - ((((((D * D) * 0.125) * M) * (M / d)) / d) * (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[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -4.6e+139], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2.05e-275], N[(N[((-d) * t$95$0), $MachinePrecision] * N[(1.0 - N[(N[(N[(0.125 * N[(D * D), $MachinePrecision]), $MachinePrecision] * N[(N[(M * N[(M / d), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.95e+57], N[(N[(t$95$0 * d), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(N[(N[(D * D), $MachinePrecision] * 0.125), $MachinePrecision] * M), $MachinePrecision] * N[(M / d), $MachinePrecision]), $MachinePrecision] / d), $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 := \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{if}\;\ell \leq -4.6 \cdot 10^{+139}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;\ell \leq -2.05 \cdot 10^{-275}:\\
\;\;\;\;\left(\left(-d\right) \cdot t\_0\right) \cdot \left(1 - \left(\left(0.125 \cdot \left(D \cdot D\right)\right) \cdot \frac{M \cdot \frac{M}{d}}{d}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{elif}\;\ell \leq 1.95 \cdot 10^{+57}:\\
\;\;\;\;\left(t\_0 \cdot d\right) \cdot \left(1 - \frac{\left(\left(\left(D \cdot D\right) \cdot 0.125\right) \cdot M\right) \cdot \frac{M}{d}}{d} \cdot \frac{h}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{\ell} \cdot \sqrt{h}} \cdot d\\
\end{array}
\end{array}
if l < -4.6e139Initial program 56.5%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites56.4%
Taylor expanded in d around inf
Applied rewrites55.0%
if -4.6e139 < l < -2.04999999999999987e-275Initial program 74.1%
Taylor expanded in d around 0
Applied rewrites0.5%
Taylor expanded in d around 0
Applied rewrites0.3%
Taylor expanded in h around -inf
Applied rewrites68.7%
if -2.04999999999999987e-275 < l < 1.94999999999999984e57Initial program 79.3%
Taylor expanded in d around 0
Applied rewrites83.8%
Taylor expanded in d around 0
Applied rewrites73.3%
Applied rewrites77.1%
if 1.94999999999999984e57 < l Initial program 50.9%
Taylor expanded in d around inf
Applied rewrites54.6%
Applied rewrites54.5%
Applied rewrites69.2%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ 1.0 (* l h)))))
(if (<= d -4.7e+38)
(* (- d) t_0)
(if (<= d -4.6e-299)
(*
(* (* -0.125 (sqrt (/ h (* (* d d) d)))) (/ (* (* D D) (* M M)) (- l)))
(sqrt (/ d l)))
(if (<= d 5.7e+197)
(*
(* t_0 d)
(- 1.0 (* (/ (* (* (* (* D D) 0.125) M) (/ M d)) d) (/ h l))))
(/ d (* (sqrt l) (sqrt h))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((1.0 / (l * h)));
double tmp;
if (d <= -4.7e+38) {
tmp = -d * t_0;
} else if (d <= -4.6e-299) {
tmp = ((-0.125 * sqrt((h / ((d * d) * d)))) * (((D * D) * (M * M)) / -l)) * sqrt((d / l));
} else if (d <= 5.7e+197) {
tmp = (t_0 * d) * (1.0 - ((((((D * D) * 0.125) * M) * (M / d)) / d) * (h / l)));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((1.0d0 / (l * h)))
if (d <= (-4.7d+38)) then
tmp = -d * t_0
else if (d <= (-4.6d-299)) then
tmp = (((-0.125d0) * sqrt((h / ((d * d) * d)))) * (((d_1 * d_1) * (m * m)) / -l)) * sqrt((d / l))
else if (d <= 5.7d+197) then
tmp = (t_0 * d) * (1.0d0 - ((((((d_1 * d_1) * 0.125d0) * m) * (m / d)) / d) * (h / l)))
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((1.0 / (l * h)));
double tmp;
if (d <= -4.7e+38) {
tmp = -d * t_0;
} else if (d <= -4.6e-299) {
tmp = ((-0.125 * Math.sqrt((h / ((d * d) * d)))) * (((D * D) * (M * M)) / -l)) * Math.sqrt((d / l));
} else if (d <= 5.7e+197) {
tmp = (t_0 * d) * (1.0 - ((((((D * D) * 0.125) * M) * (M / d)) / d) * (h / l)));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((1.0 / (l * h))) tmp = 0 if d <= -4.7e+38: tmp = -d * t_0 elif d <= -4.6e-299: tmp = ((-0.125 * math.sqrt((h / ((d * d) * d)))) * (((D * D) * (M * M)) / -l)) * math.sqrt((d / l)) elif d <= 5.7e+197: tmp = (t_0 * d) * (1.0 - ((((((D * D) * 0.125) * M) * (M / d)) / d) * (h / l))) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(1.0 / Float64(l * h))) tmp = 0.0 if (d <= -4.7e+38) tmp = Float64(Float64(-d) * t_0); elseif (d <= -4.6e-299) tmp = Float64(Float64(Float64(-0.125 * sqrt(Float64(h / Float64(Float64(d * d) * d)))) * Float64(Float64(Float64(D * D) * Float64(M * M)) / Float64(-l))) * sqrt(Float64(d / l))); elseif (d <= 5.7e+197) tmp = Float64(Float64(t_0 * d) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(D * D) * 0.125) * M) * Float64(M / d)) / d) * Float64(h / l)))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((1.0 / (l * h))); tmp = 0.0; if (d <= -4.7e+38) tmp = -d * t_0; elseif (d <= -4.6e-299) tmp = ((-0.125 * sqrt((h / ((d * d) * d)))) * (((D * D) * (M * M)) / -l)) * sqrt((d / l)); elseif (d <= 5.7e+197) tmp = (t_0 * d) * (1.0 - ((((((D * D) * 0.125) * M) * (M / d)) / d) * (h / l))); else tmp = d / (sqrt(l) * sqrt(h)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -4.7e+38], N[((-d) * t$95$0), $MachinePrecision], If[LessEqual[d, -4.6e-299], N[(N[(N[(-0.125 * N[Sqrt[N[(h / N[(N[(d * d), $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(D * D), $MachinePrecision] * N[(M * M), $MachinePrecision]), $MachinePrecision] / (-l)), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 5.7e+197], N[(N[(t$95$0 * d), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(N[(N[(D * D), $MachinePrecision] * 0.125), $MachinePrecision] * M), $MachinePrecision] * N[(M / d), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{if}\;d \leq -4.7 \cdot 10^{+38}:\\
\;\;\;\;\left(-d\right) \cdot t\_0\\
\mathbf{elif}\;d \leq -4.6 \cdot 10^{-299}:\\
\;\;\;\;\left(\left(-0.125 \cdot \sqrt{\frac{h}{\left(d \cdot d\right) \cdot d}}\right) \cdot \frac{\left(D \cdot D\right) \cdot \left(M \cdot M\right)}{-\ell}\right) \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;d \leq 5.7 \cdot 10^{+197}:\\
\;\;\;\;\left(t\_0 \cdot d\right) \cdot \left(1 - \frac{\left(\left(\left(D \cdot D\right) \cdot 0.125\right) \cdot M\right) \cdot \frac{M}{d}}{d} \cdot \frac{h}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -4.6999999999999999e38Initial program 80.8%
Taylor expanded in l around -inf
Applied rewrites64.0%
if -4.6999999999999999e38 < d < -4.6000000000000001e-299Initial program 60.6%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites59.9%
Taylor expanded in h around -inf
Applied rewrites42.0%
Applied rewrites42.0%
if -4.6000000000000001e-299 < d < 5.70000000000000022e197Initial program 68.6%
Taylor expanded in d around 0
Applied rewrites77.2%
Taylor expanded in d around 0
Applied rewrites65.0%
Applied rewrites69.9%
if 5.70000000000000022e197 < d Initial program 65.2%
Taylor expanded in d around inf
Applied rewrites56.1%
Applied rewrites56.0%
Applied rewrites56.1%
Applied rewrites77.5%
Final simplification62.5%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ 1.0 (* l h)))))
(if (<= d -4.7e+38)
(* (- d) t_0)
(if (<= d -4.6e-299)
(*
(* (* -0.125 (sqrt (/ h (* (* d d) d)))) (/ (* (* D D) (* M M)) (- l)))
(sqrt (/ d l)))
(if (<= d 1.26e+197)
(*
(* t_0 d)
(- 1.0 (* (* (* 0.125 (* D D)) (/ (* M (/ M d)) d)) (/ h l))))
(/ d (* (sqrt l) (sqrt h))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((1.0 / (l * h)));
double tmp;
if (d <= -4.7e+38) {
tmp = -d * t_0;
} else if (d <= -4.6e-299) {
tmp = ((-0.125 * sqrt((h / ((d * d) * d)))) * (((D * D) * (M * M)) / -l)) * sqrt((d / l));
} else if (d <= 1.26e+197) {
tmp = (t_0 * d) * (1.0 - (((0.125 * (D * D)) * ((M * (M / d)) / d)) * (h / l)));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((1.0d0 / (l * h)))
if (d <= (-4.7d+38)) then
tmp = -d * t_0
else if (d <= (-4.6d-299)) then
tmp = (((-0.125d0) * sqrt((h / ((d * d) * d)))) * (((d_1 * d_1) * (m * m)) / -l)) * sqrt((d / l))
else if (d <= 1.26d+197) then
tmp = (t_0 * d) * (1.0d0 - (((0.125d0 * (d_1 * d_1)) * ((m * (m / d)) / d)) * (h / l)))
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((1.0 / (l * h)));
double tmp;
if (d <= -4.7e+38) {
tmp = -d * t_0;
} else if (d <= -4.6e-299) {
tmp = ((-0.125 * Math.sqrt((h / ((d * d) * d)))) * (((D * D) * (M * M)) / -l)) * Math.sqrt((d / l));
} else if (d <= 1.26e+197) {
tmp = (t_0 * d) * (1.0 - (((0.125 * (D * D)) * ((M * (M / d)) / d)) * (h / l)));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((1.0 / (l * h))) tmp = 0 if d <= -4.7e+38: tmp = -d * t_0 elif d <= -4.6e-299: tmp = ((-0.125 * math.sqrt((h / ((d * d) * d)))) * (((D * D) * (M * M)) / -l)) * math.sqrt((d / l)) elif d <= 1.26e+197: tmp = (t_0 * d) * (1.0 - (((0.125 * (D * D)) * ((M * (M / d)) / d)) * (h / l))) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(1.0 / Float64(l * h))) tmp = 0.0 if (d <= -4.7e+38) tmp = Float64(Float64(-d) * t_0); elseif (d <= -4.6e-299) tmp = Float64(Float64(Float64(-0.125 * sqrt(Float64(h / Float64(Float64(d * d) * d)))) * Float64(Float64(Float64(D * D) * Float64(M * M)) / Float64(-l))) * sqrt(Float64(d / l))); elseif (d <= 1.26e+197) tmp = Float64(Float64(t_0 * d) * Float64(1.0 - Float64(Float64(Float64(0.125 * Float64(D * D)) * Float64(Float64(M * Float64(M / d)) / d)) * Float64(h / l)))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((1.0 / (l * h))); tmp = 0.0; if (d <= -4.7e+38) tmp = -d * t_0; elseif (d <= -4.6e-299) tmp = ((-0.125 * sqrt((h / ((d * d) * d)))) * (((D * D) * (M * M)) / -l)) * sqrt((d / l)); elseif (d <= 1.26e+197) tmp = (t_0 * d) * (1.0 - (((0.125 * (D * D)) * ((M * (M / d)) / d)) * (h / l))); else tmp = d / (sqrt(l) * sqrt(h)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -4.7e+38], N[((-d) * t$95$0), $MachinePrecision], If[LessEqual[d, -4.6e-299], N[(N[(N[(-0.125 * N[Sqrt[N[(h / N[(N[(d * d), $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(D * D), $MachinePrecision] * N[(M * M), $MachinePrecision]), $MachinePrecision] / (-l)), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.26e+197], N[(N[(t$95$0 * d), $MachinePrecision] * N[(1.0 - N[(N[(N[(0.125 * N[(D * D), $MachinePrecision]), $MachinePrecision] * N[(N[(M * N[(M / d), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{if}\;d \leq -4.7 \cdot 10^{+38}:\\
\;\;\;\;\left(-d\right) \cdot t\_0\\
\mathbf{elif}\;d \leq -4.6 \cdot 10^{-299}:\\
\;\;\;\;\left(\left(-0.125 \cdot \sqrt{\frac{h}{\left(d \cdot d\right) \cdot d}}\right) \cdot \frac{\left(D \cdot D\right) \cdot \left(M \cdot M\right)}{-\ell}\right) \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;d \leq 1.26 \cdot 10^{+197}:\\
\;\;\;\;\left(t\_0 \cdot d\right) \cdot \left(1 - \left(\left(0.125 \cdot \left(D \cdot D\right)\right) \cdot \frac{M \cdot \frac{M}{d}}{d}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -4.6999999999999999e38Initial program 80.8%
Taylor expanded in l around -inf
Applied rewrites64.0%
if -4.6999999999999999e38 < d < -4.6000000000000001e-299Initial program 60.6%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites59.9%
Taylor expanded in h around -inf
Applied rewrites42.0%
Applied rewrites42.0%
if -4.6000000000000001e-299 < d < 1.26e197Initial program 68.6%
Taylor expanded in d around 0
Applied rewrites77.2%
Taylor expanded in d around 0
Applied rewrites65.0%
if 1.26e197 < d Initial program 65.2%
Taylor expanded in d around inf
Applied rewrites56.1%
Applied rewrites56.0%
Applied rewrites56.1%
Applied rewrites77.5%
Final simplification60.4%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ 1.0 (* l h)))))
(if (<= l -3.2e-102)
(* (- d) t_0)
(if (<= l -1.05e-302)
(*
(* (* -0.125 (sqrt (/ h (* (* d d) d)))) (/ (* (* D D) (* M M)) (- l)))
(sqrt (/ d l)))
(if (<= l 7.5e+56)
(*
(* t_0 d)
(- 1.0 (* (* (* 0.125 (* D D)) (/ (* M M) (* d d))) (/ h l))))
(* (/ 1.0 (* (sqrt l) (sqrt h))) d))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((1.0 / (l * h)));
double tmp;
if (l <= -3.2e-102) {
tmp = -d * t_0;
} else if (l <= -1.05e-302) {
tmp = ((-0.125 * sqrt((h / ((d * d) * d)))) * (((D * D) * (M * M)) / -l)) * sqrt((d / l));
} else if (l <= 7.5e+56) {
tmp = (t_0 * d) * (1.0 - (((0.125 * (D * D)) * ((M * M) / (d * d))) * (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 = sqrt((1.0d0 / (l * h)))
if (l <= (-3.2d-102)) then
tmp = -d * t_0
else if (l <= (-1.05d-302)) then
tmp = (((-0.125d0) * sqrt((h / ((d * d) * d)))) * (((d_1 * d_1) * (m * m)) / -l)) * sqrt((d / l))
else if (l <= 7.5d+56) then
tmp = (t_0 * d) * (1.0d0 - (((0.125d0 * (d_1 * d_1)) * ((m * m) / (d * d))) * (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 = Math.sqrt((1.0 / (l * h)));
double tmp;
if (l <= -3.2e-102) {
tmp = -d * t_0;
} else if (l <= -1.05e-302) {
tmp = ((-0.125 * Math.sqrt((h / ((d * d) * d)))) * (((D * D) * (M * M)) / -l)) * Math.sqrt((d / l));
} else if (l <= 7.5e+56) {
tmp = (t_0 * d) * (1.0 - (((0.125 * (D * D)) * ((M * M) / (d * d))) * (h / l)));
} else {
tmp = (1.0 / (Math.sqrt(l) * Math.sqrt(h))) * d;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((1.0 / (l * h))) tmp = 0 if l <= -3.2e-102: tmp = -d * t_0 elif l <= -1.05e-302: tmp = ((-0.125 * math.sqrt((h / ((d * d) * d)))) * (((D * D) * (M * M)) / -l)) * math.sqrt((d / l)) elif l <= 7.5e+56: tmp = (t_0 * d) * (1.0 - (((0.125 * (D * D)) * ((M * M) / (d * d))) * (h / l))) else: tmp = (1.0 / (math.sqrt(l) * math.sqrt(h))) * d return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(1.0 / Float64(l * h))) tmp = 0.0 if (l <= -3.2e-102) tmp = Float64(Float64(-d) * t_0); elseif (l <= -1.05e-302) tmp = Float64(Float64(Float64(-0.125 * sqrt(Float64(h / Float64(Float64(d * d) * d)))) * Float64(Float64(Float64(D * D) * Float64(M * M)) / Float64(-l))) * sqrt(Float64(d / l))); elseif (l <= 7.5e+56) tmp = Float64(Float64(t_0 * d) * Float64(1.0 - Float64(Float64(Float64(0.125 * Float64(D * D)) * Float64(Float64(M * M) / Float64(d * d))) * 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 = sqrt((1.0 / (l * h))); tmp = 0.0; if (l <= -3.2e-102) tmp = -d * t_0; elseif (l <= -1.05e-302) tmp = ((-0.125 * sqrt((h / ((d * d) * d)))) * (((D * D) * (M * M)) / -l)) * sqrt((d / l)); elseif (l <= 7.5e+56) tmp = (t_0 * d) * (1.0 - (((0.125 * (D * D)) * ((M * M) / (d * d))) * (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[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -3.2e-102], N[((-d) * t$95$0), $MachinePrecision], If[LessEqual[l, -1.05e-302], N[(N[(N[(-0.125 * N[Sqrt[N[(h / N[(N[(d * d), $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(D * D), $MachinePrecision] * N[(M * M), $MachinePrecision]), $MachinePrecision] / (-l)), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 7.5e+56], N[(N[(t$95$0 * d), $MachinePrecision] * N[(1.0 - N[(N[(N[(0.125 * N[(D * D), $MachinePrecision]), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] / N[(d * d), $MachinePrecision]), $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 := \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{if}\;\ell \leq -3.2 \cdot 10^{-102}:\\
\;\;\;\;\left(-d\right) \cdot t\_0\\
\mathbf{elif}\;\ell \leq -1.05 \cdot 10^{-302}:\\
\;\;\;\;\left(\left(-0.125 \cdot \sqrt{\frac{h}{\left(d \cdot d\right) \cdot d}}\right) \cdot \frac{\left(D \cdot D\right) \cdot \left(M \cdot M\right)}{-\ell}\right) \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;\ell \leq 7.5 \cdot 10^{+56}:\\
\;\;\;\;\left(t\_0 \cdot d\right) \cdot \left(1 - \left(\left(0.125 \cdot \left(D \cdot D\right)\right) \cdot \frac{M \cdot M}{d \cdot d}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{\ell} \cdot \sqrt{h}} \cdot d\\
\end{array}
\end{array}
if l < -3.19999999999999986e-102Initial program 68.1%
Taylor expanded in l around -inf
Applied rewrites48.3%
if -3.19999999999999986e-102 < l < -1.05000000000000006e-302Initial program 74.2%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites75.6%
Taylor expanded in h around -inf
Applied rewrites42.3%
Applied rewrites42.3%
if -1.05000000000000006e-302 < l < 7.4999999999999999e56Initial program 78.3%
Taylor expanded in d around 0
Applied rewrites87.8%
Taylor expanded in d around 0
Applied rewrites76.8%
Applied rewrites61.5%
if 7.4999999999999999e56 < l Initial program 50.9%
Taylor expanded in d around inf
Applied rewrites54.6%
Applied rewrites54.5%
Applied rewrites69.2%
Final simplification56.1%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ 1.0 (* l h)))))
(if (<= l 2e-310)
(* (- d) t_0)
(if (<= l 7.5e+56)
(*
(* t_0 d)
(- 1.0 (* (* (* 0.125 (* D D)) (/ (* M M) (* d d))) (/ h l))))
(* (/ 1.0 (* (sqrt l) (sqrt h))) d)))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((1.0 / (l * h)));
double tmp;
if (l <= 2e-310) {
tmp = -d * t_0;
} else if (l <= 7.5e+56) {
tmp = (t_0 * d) * (1.0 - (((0.125 * (D * D)) * ((M * M) / (d * d))) * (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 = sqrt((1.0d0 / (l * h)))
if (l <= 2d-310) then
tmp = -d * t_0
else if (l <= 7.5d+56) then
tmp = (t_0 * d) * (1.0d0 - (((0.125d0 * (d_1 * d_1)) * ((m * m) / (d * d))) * (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 = Math.sqrt((1.0 / (l * h)));
double tmp;
if (l <= 2e-310) {
tmp = -d * t_0;
} else if (l <= 7.5e+56) {
tmp = (t_0 * d) * (1.0 - (((0.125 * (D * D)) * ((M * M) / (d * d))) * (h / l)));
} else {
tmp = (1.0 / (Math.sqrt(l) * Math.sqrt(h))) * d;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((1.0 / (l * h))) tmp = 0 if l <= 2e-310: tmp = -d * t_0 elif l <= 7.5e+56: tmp = (t_0 * d) * (1.0 - (((0.125 * (D * D)) * ((M * M) / (d * d))) * (h / l))) else: tmp = (1.0 / (math.sqrt(l) * math.sqrt(h))) * d return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(1.0 / Float64(l * h))) tmp = 0.0 if (l <= 2e-310) tmp = Float64(Float64(-d) * t_0); elseif (l <= 7.5e+56) tmp = Float64(Float64(t_0 * d) * Float64(1.0 - Float64(Float64(Float64(0.125 * Float64(D * D)) * Float64(Float64(M * M) / Float64(d * d))) * 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 = sqrt((1.0 / (l * h))); tmp = 0.0; if (l <= 2e-310) tmp = -d * t_0; elseif (l <= 7.5e+56) tmp = (t_0 * d) * (1.0 - (((0.125 * (D * D)) * ((M * M) / (d * d))) * (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[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, 2e-310], N[((-d) * t$95$0), $MachinePrecision], If[LessEqual[l, 7.5e+56], N[(N[(t$95$0 * d), $MachinePrecision] * N[(1.0 - N[(N[(N[(0.125 * N[(D * D), $MachinePrecision]), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] / N[(d * d), $MachinePrecision]), $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 := \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{if}\;\ell \leq 2 \cdot 10^{-310}:\\
\;\;\;\;\left(-d\right) \cdot t\_0\\
\mathbf{elif}\;\ell \leq 7.5 \cdot 10^{+56}:\\
\;\;\;\;\left(t\_0 \cdot d\right) \cdot \left(1 - \left(\left(0.125 \cdot \left(D \cdot D\right)\right) \cdot \frac{M \cdot M}{d \cdot d}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{\ell} \cdot \sqrt{h}} \cdot d\\
\end{array}
\end{array}
if l < 1.999999999999994e-310Initial program 70.2%
Taylor expanded in l around -inf
Applied rewrites42.7%
if 1.999999999999994e-310 < l < 7.4999999999999999e56Initial program 78.1%
Taylor expanded in d around 0
Applied rewrites88.8%
Taylor expanded in d around 0
Applied rewrites77.7%
Applied rewrites62.3%
if 7.4999999999999999e56 < l Initial program 50.9%
Taylor expanded in d around inf
Applied rewrites54.6%
Applied rewrites54.5%
Applied rewrites69.2%
(FPCore (d h l M D) :precision binary64 (if (<= l 2.1e-171) (* (- d) (sqrt (/ 1.0 (* l h)))) (* (/ 1.0 (* (sqrt l) (sqrt h))) d)))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 2.1e-171) {
tmp = -d * sqrt((1.0 / (l * h)));
} 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 (l <= 2.1d-171) then
tmp = -d * sqrt((1.0d0 / (l * h)))
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 (l <= 2.1e-171) {
tmp = -d * Math.sqrt((1.0 / (l * h)));
} else {
tmp = (1.0 / (Math.sqrt(l) * Math.sqrt(h))) * d;
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if l <= 2.1e-171: tmp = -d * math.sqrt((1.0 / (l * h))) else: tmp = (1.0 / (math.sqrt(l) * math.sqrt(h))) * d return tmp
function code(d, h, l, M, D) tmp = 0.0 if (l <= 2.1e-171) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(l * h)))); 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 (l <= 2.1e-171) tmp = -d * sqrt((1.0 / (l * h))); else tmp = (1.0 / (sqrt(l) * sqrt(h))) * d; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, 2.1e-171], N[((-d) * N[Sqrt[N[(1.0 / N[(l * h), $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}
\mathbf{if}\;\ell \leq 2.1 \cdot 10^{-171}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{\ell} \cdot \sqrt{h}} \cdot d\\
\end{array}
\end{array}
if l < 2.1e-171Initial program 73.3%
Taylor expanded in l around -inf
Applied rewrites41.8%
if 2.1e-171 < l Initial program 62.2%
Taylor expanded in d around inf
Applied rewrites51.5%
Applied rewrites51.4%
Applied rewrites60.7%
(FPCore (d h l M D) :precision binary64 (if (<= l 2.1e-171) (* (- d) (sqrt (/ 1.0 (* l h)))) (/ d (* (sqrt l) (sqrt h)))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 2.1e-171) {
tmp = -d * sqrt((1.0 / (l * h)));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= 2.1d-171) then
tmp = -d * sqrt((1.0d0 / (l * h)))
else
tmp = d / (sqrt(l) * sqrt(h))
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.1e-171) {
tmp = -d * Math.sqrt((1.0 / (l * h)));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if l <= 2.1e-171: tmp = -d * math.sqrt((1.0 / (l * h))) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (l <= 2.1e-171) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(l * h)))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (l <= 2.1e-171) tmp = -d * sqrt((1.0 / (l * h))); else tmp = d / (sqrt(l) * sqrt(h)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, 2.1e-171], N[((-d) * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 2.1 \cdot 10^{-171}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < 2.1e-171Initial program 73.3%
Taylor expanded in l around -inf
Applied rewrites41.8%
if 2.1e-171 < l Initial program 62.2%
Taylor expanded in d around inf
Applied rewrites51.5%
Applied rewrites51.4%
Applied rewrites51.4%
Applied rewrites60.7%
(FPCore (d h l M D) :precision binary64 (let* ((t_0 (sqrt (/ 1.0 (* l h))))) (if (<= l 2.8e-171) (* (- d) t_0) (* t_0 d))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((1.0 / (l * h)));
double tmp;
if (l <= 2.8e-171) {
tmp = -d * t_0;
} else {
tmp = t_0 * d;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((1.0d0 / (l * h)))
if (l <= 2.8d-171) then
tmp = -d * t_0
else
tmp = t_0 * d
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((1.0 / (l * h)));
double tmp;
if (l <= 2.8e-171) {
tmp = -d * t_0;
} else {
tmp = t_0 * d;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((1.0 / (l * h))) tmp = 0 if l <= 2.8e-171: tmp = -d * t_0 else: tmp = t_0 * d return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(1.0 / Float64(l * h))) tmp = 0.0 if (l <= 2.8e-171) tmp = Float64(Float64(-d) * t_0); else tmp = Float64(t_0 * d); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((1.0 / (l * h))); tmp = 0.0; if (l <= 2.8e-171) tmp = -d * t_0; else tmp = t_0 * d; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, 2.8e-171], N[((-d) * t$95$0), $MachinePrecision], N[(t$95$0 * d), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{if}\;\ell \leq 2.8 \cdot 10^{-171}:\\
\;\;\;\;\left(-d\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot d\\
\end{array}
\end{array}
if l < 2.80000000000000023e-171Initial program 73.3%
Taylor expanded in l around -inf
Applied rewrites41.8%
if 2.80000000000000023e-171 < l Initial program 62.2%
Taylor expanded in d around inf
Applied rewrites51.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 68.9%
Taylor expanded in d around inf
Applied rewrites26.6%
(FPCore (d h l M D) :precision binary64 (/ d (sqrt (* l h))))
double code(double d, double h, double l, double M, double D) {
return d / sqrt((l * h));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = d / sqrt((l * h))
end function
public static double code(double d, double h, double l, double M, double D) {
return d / Math.sqrt((l * h));
}
def code(d, h, l, M, D): return d / math.sqrt((l * h))
function code(d, h, l, M, D) return Float64(d / sqrt(Float64(l * h))) end
function tmp = code(d, h, l, M, D) tmp = d / sqrt((l * h)); end
code[d_, h_, l_, M_, D_] := N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{d}{\sqrt{\ell \cdot h}}
\end{array}
Initial program 68.9%
Taylor expanded in d around inf
Applied rewrites26.6%
Applied rewrites26.2%
Applied rewrites26.3%
herbie shell --seed 2025018
(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)))))