
(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 18 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}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))
(t_1 (pow (/ h l) 0.75))
(t_2 (pow (/ d h) 0.25))
(t_3 (pow (/ d l) (/ 1.0 2.0)))
(t_4 (* (/ M 2.0) (/ D d)))
(t_5 (- 1.0 (/ (* (* (* t_4 t_4) 0.5) h) l)))
(t_6 (pow (* l h) -1.0))
(t_7 (pow t_6 0.25)))
(if (<= d -9.5e+133)
(* (* (* -1.0 d) (* t_7 t_7)) t_5)
(if (<= d -5.6e-140)
(* (* (* t_2 t_2) t_3) t_5)
(if (<= d -1.02e-207)
(* (* (* -1.0 d) (pow t_6 0.5)) t_0)
(if (<= d 6e-202)
(/
(fma
(* -0.125 (/ (pow (* D M) 2.0) d))
(* t_1 t_1)
(* (pow (/ h l) 0.5) d))
h)
(* (* (/ (sqrt d) (sqrt h)) t_3) t_0)))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = 1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l));
double t_1 = pow((h / l), 0.75);
double t_2 = pow((d / h), 0.25);
double t_3 = pow((d / l), (1.0 / 2.0));
double t_4 = (M / 2.0) * (D / d);
double t_5 = 1.0 - ((((t_4 * t_4) * 0.5) * h) / l);
double t_6 = pow((l * h), -1.0);
double t_7 = pow(t_6, 0.25);
double tmp;
if (d <= -9.5e+133) {
tmp = ((-1.0 * d) * (t_7 * t_7)) * t_5;
} else if (d <= -5.6e-140) {
tmp = ((t_2 * t_2) * t_3) * t_5;
} else if (d <= -1.02e-207) {
tmp = ((-1.0 * d) * pow(t_6, 0.5)) * t_0;
} else if (d <= 6e-202) {
tmp = fma((-0.125 * (pow((D * M), 2.0) / d)), (t_1 * t_1), (pow((h / l), 0.5) * d)) / h;
} else {
tmp = ((sqrt(d) / sqrt(h)) * t_3) * t_0;
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))) t_1 = Float64(h / l) ^ 0.75 t_2 = Float64(d / h) ^ 0.25 t_3 = Float64(d / l) ^ Float64(1.0 / 2.0) t_4 = Float64(Float64(M / 2.0) * Float64(D / d)) t_5 = Float64(1.0 - Float64(Float64(Float64(Float64(t_4 * t_4) * 0.5) * h) / l)) t_6 = Float64(l * h) ^ -1.0 t_7 = t_6 ^ 0.25 tmp = 0.0 if (d <= -9.5e+133) tmp = Float64(Float64(Float64(-1.0 * d) * Float64(t_7 * t_7)) * t_5); elseif (d <= -5.6e-140) tmp = Float64(Float64(Float64(t_2 * t_2) * t_3) * t_5); elseif (d <= -1.02e-207) tmp = Float64(Float64(Float64(-1.0 * d) * (t_6 ^ 0.5)) * t_0); elseif (d <= 6e-202) tmp = Float64(fma(Float64(-0.125 * Float64((Float64(D * M) ^ 2.0) / d)), Float64(t_1 * t_1), Float64((Float64(h / l) ^ 0.5) * d)) / h); else tmp = Float64(Float64(Float64(sqrt(d) / sqrt(h)) * t_3) * t_0); end return tmp end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(h / l), $MachinePrecision], 0.75], $MachinePrecision]}, Block[{t$95$2 = N[Power[N[(d / h), $MachinePrecision], 0.25], $MachinePrecision]}, Block[{t$95$3 = N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(1.0 - N[(N[(N[(N[(t$95$4 * t$95$4), $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]}, Block[{t$95$7 = N[Power[t$95$6, 0.25], $MachinePrecision]}, If[LessEqual[d, -9.5e+133], N[(N[(N[(-1.0 * d), $MachinePrecision] * N[(t$95$7 * t$95$7), $MachinePrecision]), $MachinePrecision] * t$95$5), $MachinePrecision], If[LessEqual[d, -5.6e-140], N[(N[(N[(t$95$2 * t$95$2), $MachinePrecision] * t$95$3), $MachinePrecision] * t$95$5), $MachinePrecision], If[LessEqual[d, -1.02e-207], N[(N[(N[(-1.0 * d), $MachinePrecision] * N[Power[t$95$6, 0.5], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[d, 6e-202], N[(N[(N[(-0.125 * N[(N[Power[N[(D * M), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * t$95$1), $MachinePrecision] + N[(N[Power[N[(h / l), $MachinePrecision], 0.5], $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * t$95$3), $MachinePrecision] * t$95$0), $MachinePrecision]]]]]]]]]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := 1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\\
t_1 := {\left(\frac{h}{\ell}\right)}^{0.75}\\
t_2 := {\left(\frac{d}{h}\right)}^{0.25}\\
t_3 := {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\\
t_4 := \frac{M}{2} \cdot \frac{D}{d}\\
t_5 := 1 - \frac{\left(\left(t\_4 \cdot t\_4\right) \cdot 0.5\right) \cdot h}{\ell}\\
t_6 := {\left(\ell \cdot h\right)}^{-1}\\
t_7 := {t\_6}^{0.25}\\
\mathbf{if}\;d \leq -9.5 \cdot 10^{+133}:\\
\;\;\;\;\left(\left(-1 \cdot d\right) \cdot \left(t\_7 \cdot t\_7\right)\right) \cdot t\_5\\
\mathbf{elif}\;d \leq -5.6 \cdot 10^{-140}:\\
\;\;\;\;\left(\left(t\_2 \cdot t\_2\right) \cdot t\_3\right) \cdot t\_5\\
\mathbf{elif}\;d \leq -1.02 \cdot 10^{-207}:\\
\;\;\;\;\left(\left(-1 \cdot d\right) \cdot {t\_6}^{0.5}\right) \cdot t\_0\\
\mathbf{elif}\;d \leq 6 \cdot 10^{-202}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.125 \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, t\_1 \cdot t\_1, {\left(\frac{h}{\ell}\right)}^{0.5} \cdot d\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{h}} \cdot t\_3\right) \cdot t\_0\\
\end{array}
\end{array}
if d < -9.49999999999999996e133Initial program 59.7%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites60.5%
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-divN/A
lower-/.f64N/A
pow1/2N/A
metadata-evalN/A
lower-pow.f64N/A
metadata-evalN/A
lower-sqrt.f640.0
Applied rewrites0.0%
Taylor expanded in l around -inf
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
pow1/2N/A
inv-powN/A
*-commutativeN/A
metadata-evalN/A
pow-prod-upN/A
lift-pow.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f6485.2
Applied rewrites85.2%
if -9.49999999999999996e133 < d < -5.6000000000000005e-140Initial program 87.4%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites87.5%
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
sqr-powN/A
lower-*.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f6487.4
Applied rewrites87.4%
if -5.6000000000000005e-140 < d < -1.02e-207Initial program 50.4%
Taylor expanded in h around -inf
lower-*.f64N/A
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lower-pow.f64N/A
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6481.5
lift-/.f64N/A
metadata-eval81.5
Applied rewrites81.5%
if -1.02e-207 < d < 6.00000000000000022e-202Initial program 36.3%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites45.5%
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-powN/A
lower-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval54.2
Applied rewrites54.2%
lift-/.f64N/A
lift-pow.f64N/A
sqr-powN/A
lower-*.f64N/A
lower-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f64N/A
metadata-eval54.2
Applied rewrites54.2%
if 6.00000000000000022e-202 < d Initial program 74.4%
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6483.1
Applied rewrites83.1%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (/ h l) 0.75))
(t_1 (pow (/ d h) 0.25))
(t_2 (pow (/ d l) (/ 1.0 2.0)))
(t_3 (* (/ M 2.0) (/ D d)))
(t_4 (- 1.0 (/ (* (* (* t_3 t_3) 0.5) h) l)))
(t_5 (pow (* l h) -1.0))
(t_6 (pow t_5 0.25)))
(if (<= d -9.5e+133)
(* (* (* -1.0 d) (* t_6 t_6)) t_4)
(if (<= d -5.6e-140)
(* (* (* t_1 t_1) t_2) t_4)
(if (<= d -1.02e-207)
(*
(* (* -1.0 d) (pow t_5 0.5))
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))
(if (<= d 6.2e-202)
(/
(fma
(* -0.125 (/ (pow (* D M) 2.0) d))
(* t_0 t_0)
(* (pow (/ h l) 0.5) d))
h)
(* (* (/ (exp (* (log d) 0.5)) (sqrt h)) t_2) t_4)))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = pow((h / l), 0.75);
double t_1 = pow((d / h), 0.25);
double t_2 = pow((d / l), (1.0 / 2.0));
double t_3 = (M / 2.0) * (D / d);
double t_4 = 1.0 - ((((t_3 * t_3) * 0.5) * h) / l);
double t_5 = pow((l * h), -1.0);
double t_6 = pow(t_5, 0.25);
double tmp;
if (d <= -9.5e+133) {
tmp = ((-1.0 * d) * (t_6 * t_6)) * t_4;
} else if (d <= -5.6e-140) {
tmp = ((t_1 * t_1) * t_2) * t_4;
} else if (d <= -1.02e-207) {
tmp = ((-1.0 * d) * pow(t_5, 0.5)) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
} else if (d <= 6.2e-202) {
tmp = fma((-0.125 * (pow((D * M), 2.0) / d)), (t_0 * t_0), (pow((h / l), 0.5) * d)) / h;
} else {
tmp = ((exp((log(d) * 0.5)) / sqrt(h)) * t_2) * t_4;
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(h / l) ^ 0.75 t_1 = Float64(d / h) ^ 0.25 t_2 = Float64(d / l) ^ Float64(1.0 / 2.0) t_3 = Float64(Float64(M / 2.0) * Float64(D / d)) t_4 = Float64(1.0 - Float64(Float64(Float64(Float64(t_3 * t_3) * 0.5) * h) / l)) t_5 = Float64(l * h) ^ -1.0 t_6 = t_5 ^ 0.25 tmp = 0.0 if (d <= -9.5e+133) tmp = Float64(Float64(Float64(-1.0 * d) * Float64(t_6 * t_6)) * t_4); elseif (d <= -5.6e-140) tmp = Float64(Float64(Float64(t_1 * t_1) * t_2) * t_4); elseif (d <= -1.02e-207) tmp = Float64(Float64(Float64(-1.0 * d) * (t_5 ^ 0.5)) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))); elseif (d <= 6.2e-202) tmp = Float64(fma(Float64(-0.125 * Float64((Float64(D * M) ^ 2.0) / d)), Float64(t_0 * t_0), Float64((Float64(h / l) ^ 0.5) * d)) / h); else tmp = Float64(Float64(Float64(exp(Float64(log(d) * 0.5)) / sqrt(h)) * t_2) * t_4); end return tmp end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(h / l), $MachinePrecision], 0.75], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(d / h), $MachinePrecision], 0.25], $MachinePrecision]}, Block[{t$95$2 = N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(1.0 - N[(N[(N[(N[(t$95$3 * t$95$3), $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]}, Block[{t$95$6 = N[Power[t$95$5, 0.25], $MachinePrecision]}, If[LessEqual[d, -9.5e+133], N[(N[(N[(-1.0 * d), $MachinePrecision] * N[(t$95$6 * t$95$6), $MachinePrecision]), $MachinePrecision] * t$95$4), $MachinePrecision], If[LessEqual[d, -5.6e-140], N[(N[(N[(t$95$1 * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision] * t$95$4), $MachinePrecision], If[LessEqual[d, -1.02e-207], N[(N[(N[(-1.0 * d), $MachinePrecision] * N[Power[t$95$5, 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 6.2e-202], N[(N[(N[(-0.125 * N[(N[Power[N[(D * M), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision] + N[(N[Power[N[(h / l), $MachinePrecision], 0.5], $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(N[(N[(N[Exp[N[(N[Log[d], $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision] * t$95$4), $MachinePrecision]]]]]]]]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := {\left(\frac{h}{\ell}\right)}^{0.75}\\
t_1 := {\left(\frac{d}{h}\right)}^{0.25}\\
t_2 := {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\\
t_3 := \frac{M}{2} \cdot \frac{D}{d}\\
t_4 := 1 - \frac{\left(\left(t\_3 \cdot t\_3\right) \cdot 0.5\right) \cdot h}{\ell}\\
t_5 := {\left(\ell \cdot h\right)}^{-1}\\
t_6 := {t\_5}^{0.25}\\
\mathbf{if}\;d \leq -9.5 \cdot 10^{+133}:\\
\;\;\;\;\left(\left(-1 \cdot d\right) \cdot \left(t\_6 \cdot t\_6\right)\right) \cdot t\_4\\
\mathbf{elif}\;d \leq -5.6 \cdot 10^{-140}:\\
\;\;\;\;\left(\left(t\_1 \cdot t\_1\right) \cdot t\_2\right) \cdot t\_4\\
\mathbf{elif}\;d \leq -1.02 \cdot 10^{-207}:\\
\;\;\;\;\left(\left(-1 \cdot d\right) \cdot {t\_5}^{0.5}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{elif}\;d \leq 6.2 \cdot 10^{-202}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.125 \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, t\_0 \cdot t\_0, {\left(\frac{h}{\ell}\right)}^{0.5} \cdot d\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{e^{\log d \cdot 0.5}}{\sqrt{h}} \cdot t\_2\right) \cdot t\_4\\
\end{array}
\end{array}
if d < -9.49999999999999996e133Initial program 59.7%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites60.5%
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-divN/A
lower-/.f64N/A
pow1/2N/A
metadata-evalN/A
lower-pow.f64N/A
metadata-evalN/A
lower-sqrt.f640.0
Applied rewrites0.0%
Taylor expanded in l around -inf
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
pow1/2N/A
inv-powN/A
*-commutativeN/A
metadata-evalN/A
pow-prod-upN/A
lift-pow.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f6485.2
Applied rewrites85.2%
if -9.49999999999999996e133 < d < -5.6000000000000005e-140Initial program 87.4%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites87.5%
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
sqr-powN/A
lower-*.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f6487.4
Applied rewrites87.4%
if -5.6000000000000005e-140 < d < -1.02e-207Initial program 50.4%
Taylor expanded in h around -inf
lower-*.f64N/A
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lower-pow.f64N/A
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6481.5
lift-/.f64N/A
metadata-eval81.5
Applied rewrites81.5%
if -1.02e-207 < d < 6.2e-202Initial program 36.3%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites45.5%
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-powN/A
lower-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval54.2
Applied rewrites54.2%
lift-/.f64N/A
lift-pow.f64N/A
sqr-powN/A
lower-*.f64N/A
lower-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f64N/A
metadata-eval54.2
Applied rewrites54.2%
if 6.2e-202 < d Initial program 74.4%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites74.7%
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-divN/A
lower-/.f64N/A
pow1/2N/A
metadata-evalN/A
lower-pow.f64N/A
metadata-evalN/A
lower-sqrt.f6483.8
Applied rewrites83.8%
lift-pow.f64N/A
pow-to-expN/A
lower-exp.f64N/A
lower-*.f64N/A
lower-log.f6480.9
Applied rewrites80.9%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (/ d l) (/ 1.0 2.0)))
(t_1
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))
(t_2 (pow (pow (* l h) -1.0) 0.25))
(t_3 (* t_2 t_2))
(t_4 (* (/ M 2.0) (/ D d)))
(t_5 (- 1.0 (/ (* (* (* t_4 t_4) 0.5) h) l))))
(if (<= h -3.25e+156)
(* (* (pow (/ d h) (/ 1.0 2.0)) t_0) t_1)
(if (<= h -2e-310)
(* (* (* -1.0 d) t_3) t_5)
(if (<= h 4.4e+186)
(* (* t_3 d) t_5)
(* (* (/ (sqrt d) (sqrt h)) t_0) t_1))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = pow((d / l), (1.0 / 2.0));
double t_1 = 1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l));
double t_2 = pow(pow((l * h), -1.0), 0.25);
double t_3 = t_2 * t_2;
double t_4 = (M / 2.0) * (D / d);
double t_5 = 1.0 - ((((t_4 * t_4) * 0.5) * h) / l);
double tmp;
if (h <= -3.25e+156) {
tmp = (pow((d / h), (1.0 / 2.0)) * t_0) * t_1;
} else if (h <= -2e-310) {
tmp = ((-1.0 * d) * t_3) * t_5;
} else if (h <= 4.4e+186) {
tmp = (t_3 * d) * t_5;
} else {
tmp = ((sqrt(d) / sqrt(h)) * t_0) * t_1;
}
return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: tmp
t_0 = (d / l) ** (1.0d0 / 2.0d0)
t_1 = 1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l))
t_2 = ((l * h) ** (-1.0d0)) ** 0.25d0
t_3 = t_2 * t_2
t_4 = (m / 2.0d0) * (d_1 / d)
t_5 = 1.0d0 - ((((t_4 * t_4) * 0.5d0) * h) / l)
if (h <= (-3.25d+156)) then
tmp = (((d / h) ** (1.0d0 / 2.0d0)) * t_0) * t_1
else if (h <= (-2d-310)) then
tmp = (((-1.0d0) * d) * t_3) * t_5
else if (h <= 4.4d+186) then
tmp = (t_3 * d) * t_5
else
tmp = ((sqrt(d) / sqrt(h)) * t_0) * t_1
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.pow((d / l), (1.0 / 2.0));
double t_1 = 1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l));
double t_2 = Math.pow(Math.pow((l * h), -1.0), 0.25);
double t_3 = t_2 * t_2;
double t_4 = (M / 2.0) * (D / d);
double t_5 = 1.0 - ((((t_4 * t_4) * 0.5) * h) / l);
double tmp;
if (h <= -3.25e+156) {
tmp = (Math.pow((d / h), (1.0 / 2.0)) * t_0) * t_1;
} else if (h <= -2e-310) {
tmp = ((-1.0 * d) * t_3) * t_5;
} else if (h <= 4.4e+186) {
tmp = (t_3 * d) * t_5;
} else {
tmp = ((Math.sqrt(d) / Math.sqrt(h)) * t_0) * t_1;
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): t_0 = math.pow((d / l), (1.0 / 2.0)) t_1 = 1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)) t_2 = math.pow(math.pow((l * h), -1.0), 0.25) t_3 = t_2 * t_2 t_4 = (M / 2.0) * (D / d) t_5 = 1.0 - ((((t_4 * t_4) * 0.5) * h) / l) tmp = 0 if h <= -3.25e+156: tmp = (math.pow((d / h), (1.0 / 2.0)) * t_0) * t_1 elif h <= -2e-310: tmp = ((-1.0 * d) * t_3) * t_5 elif h <= 4.4e+186: tmp = (t_3 * d) * t_5 else: tmp = ((math.sqrt(d) / math.sqrt(h)) * t_0) * t_1 return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(d / l) ^ Float64(1.0 / 2.0) t_1 = Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))) t_2 = (Float64(l * h) ^ -1.0) ^ 0.25 t_3 = Float64(t_2 * t_2) t_4 = Float64(Float64(M / 2.0) * Float64(D / d)) t_5 = Float64(1.0 - Float64(Float64(Float64(Float64(t_4 * t_4) * 0.5) * h) / l)) tmp = 0.0 if (h <= -3.25e+156) tmp = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * t_0) * t_1); elseif (h <= -2e-310) tmp = Float64(Float64(Float64(-1.0 * d) * t_3) * t_5); elseif (h <= 4.4e+186) tmp = Float64(Float64(t_3 * d) * t_5); else tmp = Float64(Float64(Float64(sqrt(d) / sqrt(h)) * t_0) * t_1); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = (d / l) ^ (1.0 / 2.0);
t_1 = 1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l));
t_2 = ((l * h) ^ -1.0) ^ 0.25;
t_3 = t_2 * t_2;
t_4 = (M / 2.0) * (D / d);
t_5 = 1.0 - ((((t_4 * t_4) * 0.5) * h) / l);
tmp = 0.0;
if (h <= -3.25e+156)
tmp = (((d / h) ^ (1.0 / 2.0)) * t_0) * t_1;
elseif (h <= -2e-310)
tmp = ((-1.0 * d) * t_3) * t_5;
elseif (h <= 4.4e+186)
tmp = (t_3 * d) * t_5;
else
tmp = ((sqrt(d) / sqrt(h)) * t_0) * t_1;
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision], 0.25], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 * t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(1.0 - N[(N[(N[(N[(t$95$4 * t$95$4), $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -3.25e+156], N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[h, -2e-310], N[(N[(N[(-1.0 * d), $MachinePrecision] * t$95$3), $MachinePrecision] * t$95$5), $MachinePrecision], If[LessEqual[h, 4.4e+186], N[(N[(t$95$3 * d), $MachinePrecision] * t$95$5), $MachinePrecision], N[(N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\\
t_1 := 1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\\
t_2 := {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.25}\\
t_3 := t\_2 \cdot t\_2\\
t_4 := \frac{M}{2} \cdot \frac{D}{d}\\
t_5 := 1 - \frac{\left(\left(t\_4 \cdot t\_4\right) \cdot 0.5\right) \cdot h}{\ell}\\
\mathbf{if}\;h \leq -3.25 \cdot 10^{+156}:\\
\;\;\;\;\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot t\_0\right) \cdot t\_1\\
\mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(\left(-1 \cdot d\right) \cdot t\_3\right) \cdot t\_5\\
\mathbf{elif}\;h \leq 4.4 \cdot 10^{+186}:\\
\;\;\;\;\left(t\_3 \cdot d\right) \cdot t\_5\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{h}} \cdot t\_0\right) \cdot t\_1\\
\end{array}
\end{array}
if h < -3.25000000000000014e156Initial program 66.6%
if -3.25000000000000014e156 < h < -1.999999999999994e-310Initial program 69.0%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites70.2%
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-divN/A
lower-/.f64N/A
pow1/2N/A
metadata-evalN/A
lower-pow.f64N/A
metadata-evalN/A
lower-sqrt.f640.0
Applied rewrites0.0%
Taylor expanded in l around -inf
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
pow1/2N/A
inv-powN/A
*-commutativeN/A
metadata-evalN/A
pow-prod-upN/A
lift-pow.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f6481.9
Applied rewrites81.9%
if -1.999999999999994e-310 < h < 4.3999999999999997e186Initial program 67.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites69.4%
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-divN/A
lower-/.f64N/A
pow1/2N/A
metadata-evalN/A
lower-pow.f64N/A
metadata-evalN/A
lower-sqrt.f6474.4
Applied rewrites74.4%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
inv-powN/A
*-commutativeN/A
metadata-evalN/A
pow-prod-upN/A
lift-pow.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f6479.7
Applied rewrites79.7%
if 4.3999999999999997e186 < h Initial program 59.6%
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6476.1
Applied rewrites76.1%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (/ M 2.0) (/ D d)))
(t_1 (pow (/ d l) 0.25))
(t_2
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))
(t_3 (pow (pow (* l h) -1.0) 0.25))
(t_4 (* t_3 t_3))
(t_5 (- 1.0 (/ (* (* (* t_0 t_0) 0.5) h) l))))
(if (<= h -4.4e+156)
(* (* (pow (/ d h) (/ 1.0 2.0)) (* t_1 t_1)) t_2)
(if (<= h -2e-310)
(* (* (* -1.0 d) t_4) t_5)
(if (<= h 4.4e+186)
(* (* t_4 d) t_5)
(* (* (/ (sqrt d) (sqrt h)) (pow (/ d l) (/ 1.0 2.0))) t_2))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = (M / 2.0) * (D / d);
double t_1 = pow((d / l), 0.25);
double t_2 = 1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l));
double t_3 = pow(pow((l * h), -1.0), 0.25);
double t_4 = t_3 * t_3;
double t_5 = 1.0 - ((((t_0 * t_0) * 0.5) * h) / l);
double tmp;
if (h <= -4.4e+156) {
tmp = (pow((d / h), (1.0 / 2.0)) * (t_1 * t_1)) * t_2;
} else if (h <= -2e-310) {
tmp = ((-1.0 * d) * t_4) * t_5;
} else if (h <= 4.4e+186) {
tmp = (t_4 * d) * t_5;
} else {
tmp = ((sqrt(d) / sqrt(h)) * pow((d / l), (1.0 / 2.0))) * t_2;
}
return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: tmp
t_0 = (m / 2.0d0) * (d_1 / d)
t_1 = (d / l) ** 0.25d0
t_2 = 1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l))
t_3 = ((l * h) ** (-1.0d0)) ** 0.25d0
t_4 = t_3 * t_3
t_5 = 1.0d0 - ((((t_0 * t_0) * 0.5d0) * h) / l)
if (h <= (-4.4d+156)) then
tmp = (((d / h) ** (1.0d0 / 2.0d0)) * (t_1 * t_1)) * t_2
else if (h <= (-2d-310)) then
tmp = (((-1.0d0) * d) * t_4) * t_5
else if (h <= 4.4d+186) then
tmp = (t_4 * d) * t_5
else
tmp = ((sqrt(d) / sqrt(h)) * ((d / l) ** (1.0d0 / 2.0d0))) * t_2
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (M / 2.0) * (D / d);
double t_1 = Math.pow((d / l), 0.25);
double t_2 = 1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l));
double t_3 = Math.pow(Math.pow((l * h), -1.0), 0.25);
double t_4 = t_3 * t_3;
double t_5 = 1.0 - ((((t_0 * t_0) * 0.5) * h) / l);
double tmp;
if (h <= -4.4e+156) {
tmp = (Math.pow((d / h), (1.0 / 2.0)) * (t_1 * t_1)) * t_2;
} else if (h <= -2e-310) {
tmp = ((-1.0 * d) * t_4) * t_5;
} else if (h <= 4.4e+186) {
tmp = (t_4 * d) * t_5;
} else {
tmp = ((Math.sqrt(d) / Math.sqrt(h)) * Math.pow((d / l), (1.0 / 2.0))) * t_2;
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): t_0 = (M / 2.0) * (D / d) t_1 = math.pow((d / l), 0.25) t_2 = 1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)) t_3 = math.pow(math.pow((l * h), -1.0), 0.25) t_4 = t_3 * t_3 t_5 = 1.0 - ((((t_0 * t_0) * 0.5) * h) / l) tmp = 0 if h <= -4.4e+156: tmp = (math.pow((d / h), (1.0 / 2.0)) * (t_1 * t_1)) * t_2 elif h <= -2e-310: tmp = ((-1.0 * d) * t_4) * t_5 elif h <= 4.4e+186: tmp = (t_4 * d) * t_5 else: tmp = ((math.sqrt(d) / math.sqrt(h)) * math.pow((d / l), (1.0 / 2.0))) * t_2 return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64(M / 2.0) * Float64(D / d)) t_1 = Float64(d / l) ^ 0.25 t_2 = Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))) t_3 = (Float64(l * h) ^ -1.0) ^ 0.25 t_4 = Float64(t_3 * t_3) t_5 = Float64(1.0 - Float64(Float64(Float64(Float64(t_0 * t_0) * 0.5) * h) / l)) tmp = 0.0 if (h <= -4.4e+156) tmp = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * Float64(t_1 * t_1)) * t_2); elseif (h <= -2e-310) tmp = Float64(Float64(Float64(-1.0 * d) * t_4) * t_5); elseif (h <= 4.4e+186) tmp = Float64(Float64(t_4 * d) * t_5); else tmp = Float64(Float64(Float64(sqrt(d) / sqrt(h)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * t_2); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = (M / 2.0) * (D / d);
t_1 = (d / l) ^ 0.25;
t_2 = 1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l));
t_3 = ((l * h) ^ -1.0) ^ 0.25;
t_4 = t_3 * t_3;
t_5 = 1.0 - ((((t_0 * t_0) * 0.5) * h) / l);
tmp = 0.0;
if (h <= -4.4e+156)
tmp = (((d / h) ^ (1.0 / 2.0)) * (t_1 * t_1)) * t_2;
elseif (h <= -2e-310)
tmp = ((-1.0 * d) * t_4) * t_5;
elseif (h <= 4.4e+186)
tmp = (t_4 * d) * t_5;
else
tmp = ((sqrt(d) / sqrt(h)) * ((d / l) ^ (1.0 / 2.0))) * t_2;
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(d / l), $MachinePrecision], 0.25], $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision], 0.25], $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 * t$95$3), $MachinePrecision]}, Block[{t$95$5 = N[(1.0 - N[(N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -4.4e+156], N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[h, -2e-310], N[(N[(N[(-1.0 * d), $MachinePrecision] * t$95$4), $MachinePrecision] * t$95$5), $MachinePrecision], If[LessEqual[h, 4.4e+186], N[(N[(t$95$4 * d), $MachinePrecision] * t$95$5), $MachinePrecision], 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$2), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \frac{M}{2} \cdot \frac{D}{d}\\
t_1 := {\left(\frac{d}{\ell}\right)}^{0.25}\\
t_2 := 1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\\
t_3 := {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.25}\\
t_4 := t\_3 \cdot t\_3\\
t_5 := 1 - \frac{\left(\left(t\_0 \cdot t\_0\right) \cdot 0.5\right) \cdot h}{\ell}\\
\mathbf{if}\;h \leq -4.4 \cdot 10^{+156}:\\
\;\;\;\;\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \left(t\_1 \cdot t\_1\right)\right) \cdot t\_2\\
\mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(\left(-1 \cdot d\right) \cdot t\_4\right) \cdot t\_5\\
\mathbf{elif}\;h \leq 4.4 \cdot 10^{+186}:\\
\;\;\;\;\left(t\_4 \cdot d\right) \cdot t\_5\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{h}} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot t\_2\\
\end{array}
\end{array}
if h < -4.40000000000000008e156Initial program 66.6%
lift-/.f64N/A
lift-pow.f64N/A
sqr-powN/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f6466.4
Applied rewrites66.4%
if -4.40000000000000008e156 < h < -1.999999999999994e-310Initial program 69.0%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites70.2%
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-divN/A
lower-/.f64N/A
pow1/2N/A
metadata-evalN/A
lower-pow.f64N/A
metadata-evalN/A
lower-sqrt.f640.0
Applied rewrites0.0%
Taylor expanded in l around -inf
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
pow1/2N/A
inv-powN/A
*-commutativeN/A
metadata-evalN/A
pow-prod-upN/A
lift-pow.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f6481.9
Applied rewrites81.9%
if -1.999999999999994e-310 < h < 4.3999999999999997e186Initial program 67.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites69.4%
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-divN/A
lower-/.f64N/A
pow1/2N/A
metadata-evalN/A
lower-pow.f64N/A
metadata-evalN/A
lower-sqrt.f6474.4
Applied rewrites74.4%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
inv-powN/A
*-commutativeN/A
metadata-evalN/A
pow-prod-upN/A
lift-pow.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f6479.7
Applied rewrites79.7%
if 4.3999999999999997e186 < h Initial program 59.6%
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6476.1
Applied rewrites76.1%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (/ M 2.0) (/ D d)))
(t_1 (pow (/ d l) 0.125))
(t_2
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))
(t_3 (pow (pow (* l h) -1.0) 0.25))
(t_4 (* t_3 t_3))
(t_5 (- 1.0 (/ (* (* (* t_0 t_0) 0.5) h) l))))
(if (<= h -3.25e+156)
(* (* (pow (/ d h) (/ 1.0 2.0)) (* (pow (/ d l) 0.25) (* t_1 t_1))) t_2)
(if (<= h -2e-310)
(* (* (* -1.0 d) t_4) t_5)
(if (<= h 4.4e+186)
(* (* t_4 d) t_5)
(* (* (/ (sqrt d) (sqrt h)) (pow (/ d l) (/ 1.0 2.0))) t_2))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = (M / 2.0) * (D / d);
double t_1 = pow((d / l), 0.125);
double t_2 = 1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l));
double t_3 = pow(pow((l * h), -1.0), 0.25);
double t_4 = t_3 * t_3;
double t_5 = 1.0 - ((((t_0 * t_0) * 0.5) * h) / l);
double tmp;
if (h <= -3.25e+156) {
tmp = (pow((d / h), (1.0 / 2.0)) * (pow((d / l), 0.25) * (t_1 * t_1))) * t_2;
} else if (h <= -2e-310) {
tmp = ((-1.0 * d) * t_4) * t_5;
} else if (h <= 4.4e+186) {
tmp = (t_4 * d) * t_5;
} else {
tmp = ((sqrt(d) / sqrt(h)) * pow((d / l), (1.0 / 2.0))) * t_2;
}
return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: tmp
t_0 = (m / 2.0d0) * (d_1 / d)
t_1 = (d / l) ** 0.125d0
t_2 = 1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l))
t_3 = ((l * h) ** (-1.0d0)) ** 0.25d0
t_4 = t_3 * t_3
t_5 = 1.0d0 - ((((t_0 * t_0) * 0.5d0) * h) / l)
if (h <= (-3.25d+156)) then
tmp = (((d / h) ** (1.0d0 / 2.0d0)) * (((d / l) ** 0.25d0) * (t_1 * t_1))) * t_2
else if (h <= (-2d-310)) then
tmp = (((-1.0d0) * d) * t_4) * t_5
else if (h <= 4.4d+186) then
tmp = (t_4 * d) * t_5
else
tmp = ((sqrt(d) / sqrt(h)) * ((d / l) ** (1.0d0 / 2.0d0))) * t_2
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (M / 2.0) * (D / d);
double t_1 = Math.pow((d / l), 0.125);
double t_2 = 1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l));
double t_3 = Math.pow(Math.pow((l * h), -1.0), 0.25);
double t_4 = t_3 * t_3;
double t_5 = 1.0 - ((((t_0 * t_0) * 0.5) * h) / l);
double tmp;
if (h <= -3.25e+156) {
tmp = (Math.pow((d / h), (1.0 / 2.0)) * (Math.pow((d / l), 0.25) * (t_1 * t_1))) * t_2;
} else if (h <= -2e-310) {
tmp = ((-1.0 * d) * t_4) * t_5;
} else if (h <= 4.4e+186) {
tmp = (t_4 * d) * t_5;
} else {
tmp = ((Math.sqrt(d) / Math.sqrt(h)) * Math.pow((d / l), (1.0 / 2.0))) * t_2;
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): t_0 = (M / 2.0) * (D / d) t_1 = math.pow((d / l), 0.125) t_2 = 1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)) t_3 = math.pow(math.pow((l * h), -1.0), 0.25) t_4 = t_3 * t_3 t_5 = 1.0 - ((((t_0 * t_0) * 0.5) * h) / l) tmp = 0 if h <= -3.25e+156: tmp = (math.pow((d / h), (1.0 / 2.0)) * (math.pow((d / l), 0.25) * (t_1 * t_1))) * t_2 elif h <= -2e-310: tmp = ((-1.0 * d) * t_4) * t_5 elif h <= 4.4e+186: tmp = (t_4 * d) * t_5 else: tmp = ((math.sqrt(d) / math.sqrt(h)) * math.pow((d / l), (1.0 / 2.0))) * t_2 return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64(M / 2.0) * Float64(D / d)) t_1 = Float64(d / l) ^ 0.125 t_2 = Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))) t_3 = (Float64(l * h) ^ -1.0) ^ 0.25 t_4 = Float64(t_3 * t_3) t_5 = Float64(1.0 - Float64(Float64(Float64(Float64(t_0 * t_0) * 0.5) * h) / l)) tmp = 0.0 if (h <= -3.25e+156) tmp = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * Float64((Float64(d / l) ^ 0.25) * Float64(t_1 * t_1))) * t_2); elseif (h <= -2e-310) tmp = Float64(Float64(Float64(-1.0 * d) * t_4) * t_5); elseif (h <= 4.4e+186) tmp = Float64(Float64(t_4 * d) * t_5); else tmp = Float64(Float64(Float64(sqrt(d) / sqrt(h)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * t_2); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = (M / 2.0) * (D / d);
t_1 = (d / l) ^ 0.125;
t_2 = 1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l));
t_3 = ((l * h) ^ -1.0) ^ 0.25;
t_4 = t_3 * t_3;
t_5 = 1.0 - ((((t_0 * t_0) * 0.5) * h) / l);
tmp = 0.0;
if (h <= -3.25e+156)
tmp = (((d / h) ^ (1.0 / 2.0)) * (((d / l) ^ 0.25) * (t_1 * t_1))) * t_2;
elseif (h <= -2e-310)
tmp = ((-1.0 * d) * t_4) * t_5;
elseif (h <= 4.4e+186)
tmp = (t_4 * d) * t_5;
else
tmp = ((sqrt(d) / sqrt(h)) * ((d / l) ^ (1.0 / 2.0))) * t_2;
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(d / l), $MachinePrecision], 0.125], $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision], 0.25], $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 * t$95$3), $MachinePrecision]}, Block[{t$95$5 = N[(1.0 - N[(N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -3.25e+156], N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], 0.25], $MachinePrecision] * N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[h, -2e-310], N[(N[(N[(-1.0 * d), $MachinePrecision] * t$95$4), $MachinePrecision] * t$95$5), $MachinePrecision], If[LessEqual[h, 4.4e+186], N[(N[(t$95$4 * d), $MachinePrecision] * t$95$5), $MachinePrecision], 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$2), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \frac{M}{2} \cdot \frac{D}{d}\\
t_1 := {\left(\frac{d}{\ell}\right)}^{0.125}\\
t_2 := 1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\\
t_3 := {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.25}\\
t_4 := t\_3 \cdot t\_3\\
t_5 := 1 - \frac{\left(\left(t\_0 \cdot t\_0\right) \cdot 0.5\right) \cdot h}{\ell}\\
\mathbf{if}\;h \leq -3.25 \cdot 10^{+156}:\\
\;\;\;\;\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \left({\left(\frac{d}{\ell}\right)}^{0.25} \cdot \left(t\_1 \cdot t\_1\right)\right)\right) \cdot t\_2\\
\mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(\left(-1 \cdot d\right) \cdot t\_4\right) \cdot t\_5\\
\mathbf{elif}\;h \leq 4.4 \cdot 10^{+186}:\\
\;\;\;\;\left(t\_4 \cdot d\right) \cdot t\_5\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{h}} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot t\_2\\
\end{array}
\end{array}
if h < -3.25000000000000014e156Initial program 66.6%
lift-/.f64N/A
lift-pow.f64N/A
sqr-powN/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f6466.4
Applied rewrites66.4%
lift-/.f64N/A
lift-pow.f64N/A
sqr-powN/A
lower-*.f64N/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f6466.3
Applied rewrites66.3%
if -3.25000000000000014e156 < h < -1.999999999999994e-310Initial program 69.0%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites70.2%
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-divN/A
lower-/.f64N/A
pow1/2N/A
metadata-evalN/A
lower-pow.f64N/A
metadata-evalN/A
lower-sqrt.f640.0
Applied rewrites0.0%
Taylor expanded in l around -inf
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
pow1/2N/A
inv-powN/A
*-commutativeN/A
metadata-evalN/A
pow-prod-upN/A
lift-pow.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f6481.9
Applied rewrites81.9%
if -1.999999999999994e-310 < h < 4.3999999999999997e186Initial program 67.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites69.4%
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-divN/A
lower-/.f64N/A
pow1/2N/A
metadata-evalN/A
lower-pow.f64N/A
metadata-evalN/A
lower-sqrt.f6474.4
Applied rewrites74.4%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
inv-powN/A
*-commutativeN/A
metadata-evalN/A
pow-prod-upN/A
lift-pow.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f6479.7
Applied rewrites79.7%
if 4.3999999999999997e186 < h Initial program 59.6%
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6476.1
Applied rewrites76.1%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (/ M 2.0) (/ D d)))
(t_1 (- 1.0 (/ (* (* (* t_0 t_0) 0.5) h) l)))
(t_2 (pow (pow (* l h) -1.0) 0.25))
(t_3 (* t_2 t_2)))
(if (<= l -4e-310)
(* (* (* -1.0 d) t_3) t_1)
(if (<= l 4.6e+173)
(* (* t_3 d) t_1)
(/
(fma
(* -0.125 (/ (pow (* D M) 2.0) d))
(pow (/ h l) 1.5)
(* (/ (sqrt h) (sqrt l)) d))
h)))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = (M / 2.0) * (D / d);
double t_1 = 1.0 - ((((t_0 * t_0) * 0.5) * h) / l);
double t_2 = pow(pow((l * h), -1.0), 0.25);
double t_3 = t_2 * t_2;
double tmp;
if (l <= -4e-310) {
tmp = ((-1.0 * d) * t_3) * t_1;
} else if (l <= 4.6e+173) {
tmp = (t_3 * d) * t_1;
} else {
tmp = fma((-0.125 * (pow((D * M), 2.0) / d)), pow((h / l), 1.5), ((sqrt(h) / sqrt(l)) * d)) / h;
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64(M / 2.0) * Float64(D / d)) t_1 = Float64(1.0 - Float64(Float64(Float64(Float64(t_0 * t_0) * 0.5) * h) / l)) t_2 = (Float64(l * h) ^ -1.0) ^ 0.25 t_3 = Float64(t_2 * t_2) tmp = 0.0 if (l <= -4e-310) tmp = Float64(Float64(Float64(-1.0 * d) * t_3) * t_1); elseif (l <= 4.6e+173) tmp = Float64(Float64(t_3 * d) * t_1); else tmp = Float64(fma(Float64(-0.125 * Float64((Float64(D * M) ^ 2.0) / d)), (Float64(h / l) ^ 1.5), Float64(Float64(sqrt(h) / sqrt(l)) * d)) / h); end return tmp end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[(N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision], 0.25], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 * t$95$2), $MachinePrecision]}, If[LessEqual[l, -4e-310], N[(N[(N[(-1.0 * d), $MachinePrecision] * t$95$3), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[l, 4.6e+173], N[(N[(t$95$3 * d), $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(N[(-0.125 * N[(N[Power[N[(D * M), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] + N[(N[(N[Sqrt[h], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]]]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \frac{M}{2} \cdot \frac{D}{d}\\
t_1 := 1 - \frac{\left(\left(t\_0 \cdot t\_0\right) \cdot 0.5\right) \cdot h}{\ell}\\
t_2 := {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.25}\\
t_3 := t\_2 \cdot t\_2\\
\mathbf{if}\;\ell \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\left(\left(-1 \cdot d\right) \cdot t\_3\right) \cdot t\_1\\
\mathbf{elif}\;\ell \leq 4.6 \cdot 10^{+173}:\\
\;\;\;\;\left(t\_3 \cdot d\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.125 \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, {\left(\frac{h}{\ell}\right)}^{1.5}, \frac{\sqrt{h}}{\sqrt{\ell}} \cdot d\right)}{h}\\
\end{array}
\end{array}
if l < -3.999999999999988e-310Initial program 68.4%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites68.7%
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-divN/A
lower-/.f64N/A
pow1/2N/A
metadata-evalN/A
lower-pow.f64N/A
metadata-evalN/A
lower-sqrt.f640.0
Applied rewrites0.0%
Taylor expanded in l around -inf
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
pow1/2N/A
inv-powN/A
*-commutativeN/A
metadata-evalN/A
pow-prod-upN/A
lift-pow.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f6473.8
Applied rewrites73.8%
if -3.999999999999988e-310 < l < 4.5999999999999999e173Initial program 70.4%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites70.6%
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-divN/A
lower-/.f64N/A
pow1/2N/A
metadata-evalN/A
lower-pow.f64N/A
metadata-evalN/A
lower-sqrt.f6479.5
Applied rewrites79.5%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
inv-powN/A
*-commutativeN/A
metadata-evalN/A
pow-prod-upN/A
lift-pow.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f6479.5
Applied rewrites79.5%
if 4.5999999999999999e173 < l Initial program 48.5%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites45.2%
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-powN/A
lower-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval48.3
Applied rewrites48.3%
metadata-evalN/A
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6460.2
Applied rewrites60.2%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (/ M 2.0) (/ D d)))
(t_1 (pow (pow (* l h) -1.0) 0.25))
(t_2 (* t_1 t_1)))
(if (<= l -4e-310)
(* (* (* -1.0 d) t_2) (- 1.0 (/ (* (* (* t_0 t_0) 0.5) h) l)))
(if (<= l 4.6e+173)
(*
(* t_2 d)
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))
(/
(fma
(* -0.125 (/ (pow (* D M) 2.0) d))
(pow (/ h l) 1.5)
(* (/ (sqrt h) (sqrt l)) d))
h)))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = (M / 2.0) * (D / d);
double t_1 = pow(pow((l * h), -1.0), 0.25);
double t_2 = t_1 * t_1;
double tmp;
if (l <= -4e-310) {
tmp = ((-1.0 * d) * t_2) * (1.0 - ((((t_0 * t_0) * 0.5) * h) / l));
} else if (l <= 4.6e+173) {
tmp = (t_2 * d) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
} else {
tmp = fma((-0.125 * (pow((D * M), 2.0) / d)), pow((h / l), 1.5), ((sqrt(h) / sqrt(l)) * d)) / h;
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64(M / 2.0) * Float64(D / d)) t_1 = (Float64(l * h) ^ -1.0) ^ 0.25 t_2 = Float64(t_1 * t_1) tmp = 0.0 if (l <= -4e-310) tmp = Float64(Float64(Float64(-1.0 * d) * t_2) * Float64(1.0 - Float64(Float64(Float64(Float64(t_0 * t_0) * 0.5) * h) / l))); elseif (l <= 4.6e+173) tmp = Float64(Float64(t_2 * d) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))); else tmp = Float64(fma(Float64(-0.125 * Float64((Float64(D * M) ^ 2.0) / d)), (Float64(h / l) ^ 1.5), Float64(Float64(sqrt(h) / sqrt(l)) * d)) / h); end return tmp end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision], 0.25], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * t$95$1), $MachinePrecision]}, If[LessEqual[l, -4e-310], N[(N[(N[(-1.0 * d), $MachinePrecision] * t$95$2), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.6e+173], N[(N[(t$95$2 * d), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-0.125 * N[(N[Power[N[(D * M), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] + N[(N[(N[Sqrt[h], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \frac{M}{2} \cdot \frac{D}{d}\\
t_1 := {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.25}\\
t_2 := t\_1 \cdot t\_1\\
\mathbf{if}\;\ell \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\left(\left(-1 \cdot d\right) \cdot t\_2\right) \cdot \left(1 - \frac{\left(\left(t\_0 \cdot t\_0\right) \cdot 0.5\right) \cdot h}{\ell}\right)\\
\mathbf{elif}\;\ell \leq 4.6 \cdot 10^{+173}:\\
\;\;\;\;\left(t\_2 \cdot d\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.125 \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, {\left(\frac{h}{\ell}\right)}^{1.5}, \frac{\sqrt{h}}{\sqrt{\ell}} \cdot d\right)}{h}\\
\end{array}
\end{array}
if l < -3.999999999999988e-310Initial program 68.4%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites68.7%
lift-/.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-divN/A
lower-/.f64N/A
pow1/2N/A
metadata-evalN/A
lower-pow.f64N/A
metadata-evalN/A
lower-sqrt.f640.0
Applied rewrites0.0%
Taylor expanded in l around -inf
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
pow1/2N/A
inv-powN/A
*-commutativeN/A
metadata-evalN/A
pow-prod-upN/A
lift-pow.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f6473.8
Applied rewrites73.8%
if -3.999999999999988e-310 < l < 4.5999999999999999e173Initial program 70.4%
lift-/.f64N/A
lift-pow.f64N/A
sqr-powN/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f6470.2
Applied rewrites70.2%
lift-/.f64N/A
lift-pow.f64N/A
sqr-powN/A
lower-*.f64N/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f6470.2
Applied rewrites70.2%
Taylor expanded in d around 0
metadata-evalN/A
metadata-evalN/A
pow-prod-upN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
sqr-powN/A
metadata-evalN/A
metadata-evalN/A
pow-prod-upN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites76.9%
if 4.5999999999999999e173 < l Initial program 48.5%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites45.2%
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-powN/A
lower-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval48.3
Applied rewrites48.3%
metadata-evalN/A
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6460.2
Applied rewrites60.2%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (/ h l) 0.75))
(t_1 (* -0.125 (/ (pow (* D M) 2.0) d)))
(t_2 (pow (* l h) -1.0))
(t_3 (pow t_2 0.25)))
(if (<= d -7e+181)
(* (* -1.0 d) (pow t_2 0.5))
(if (<= d 4e-285)
(/ (fma t_1 (* t_0 t_0) (* (pow (/ h l) 0.5) d)) h)
(if (<= d 6e+80)
(/ (fma t_1 (pow (/ h l) 1.5) (* (/ (sqrt h) (sqrt l)) d)) h)
(*
(* (* t_3 t_3) d)
(-
1.0
(* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = pow((h / l), 0.75);
double t_1 = -0.125 * (pow((D * M), 2.0) / d);
double t_2 = pow((l * h), -1.0);
double t_3 = pow(t_2, 0.25);
double tmp;
if (d <= -7e+181) {
tmp = (-1.0 * d) * pow(t_2, 0.5);
} else if (d <= 4e-285) {
tmp = fma(t_1, (t_0 * t_0), (pow((h / l), 0.5) * d)) / h;
} else if (d <= 6e+80) {
tmp = fma(t_1, pow((h / l), 1.5), ((sqrt(h) / sqrt(l)) * d)) / h;
} else {
tmp = ((t_3 * t_3) * d) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(h / l) ^ 0.75 t_1 = Float64(-0.125 * Float64((Float64(D * M) ^ 2.0) / d)) t_2 = Float64(l * h) ^ -1.0 t_3 = t_2 ^ 0.25 tmp = 0.0 if (d <= -7e+181) tmp = Float64(Float64(-1.0 * d) * (t_2 ^ 0.5)); elseif (d <= 4e-285) tmp = Float64(fma(t_1, Float64(t_0 * t_0), Float64((Float64(h / l) ^ 0.5) * d)) / h); elseif (d <= 6e+80) tmp = Float64(fma(t_1, (Float64(h / l) ^ 1.5), Float64(Float64(sqrt(h) / sqrt(l)) * d)) / h); else tmp = Float64(Float64(Float64(t_3 * t_3) * d) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))); end return tmp end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(h / l), $MachinePrecision], 0.75], $MachinePrecision]}, Block[{t$95$1 = N[(-0.125 * N[(N[Power[N[(D * M), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]}, Block[{t$95$3 = N[Power[t$95$2, 0.25], $MachinePrecision]}, If[LessEqual[d, -7e+181], N[(N[(-1.0 * d), $MachinePrecision] * N[Power[t$95$2, 0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 4e-285], N[(N[(t$95$1 * N[(t$95$0 * t$95$0), $MachinePrecision] + N[(N[Power[N[(h / l), $MachinePrecision], 0.5], $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[d, 6e+80], N[(N[(t$95$1 * N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] + N[(N[(N[Sqrt[h], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(N[(N[(t$95$3 * t$95$3), $MachinePrecision] * d), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := {\left(\frac{h}{\ell}\right)}^{0.75}\\
t_1 := -0.125 \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}\\
t_2 := {\left(\ell \cdot h\right)}^{-1}\\
t_3 := {t\_2}^{0.25}\\
\mathbf{if}\;d \leq -7 \cdot 10^{+181}:\\
\;\;\;\;\left(-1 \cdot d\right) \cdot {t\_2}^{0.5}\\
\mathbf{elif}\;d \leq 4 \cdot 10^{-285}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t\_1, t\_0 \cdot t\_0, {\left(\frac{h}{\ell}\right)}^{0.5} \cdot d\right)}{h}\\
\mathbf{elif}\;d \leq 6 \cdot 10^{+80}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t\_1, {\left(\frac{h}{\ell}\right)}^{1.5}, \frac{\sqrt{h}}{\sqrt{\ell}} \cdot d\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(t\_3 \cdot t\_3\right) \cdot d\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\end{array}
\end{array}
if d < -7.00000000000000016e181Initial program 57.0%
Taylor expanded in l around -inf
lower-*.f64N/A
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lower-pow.f64N/A
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6476.2
lift-/.f64N/A
metadata-eval76.2
Applied rewrites76.2%
if -7.00000000000000016e181 < d < 4.0000000000000003e-285Initial program 69.3%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites55.5%
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-powN/A
lower-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval67.1
Applied rewrites67.1%
lift-/.f64N/A
lift-pow.f64N/A
sqr-powN/A
lower-*.f64N/A
lower-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f64N/A
metadata-eval67.1
Applied rewrites67.1%
if 4.0000000000000003e-285 < d < 5.99999999999999974e80Initial program 55.9%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites48.3%
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-powN/A
lower-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval58.1
Applied rewrites58.1%
metadata-evalN/A
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6469.0
Applied rewrites69.0%
if 5.99999999999999974e80 < d Initial program 86.6%
lift-/.f64N/A
lift-pow.f64N/A
sqr-powN/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f6486.3
Applied rewrites86.3%
lift-/.f64N/A
lift-pow.f64N/A
sqr-powN/A
lower-*.f64N/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f6486.3
Applied rewrites86.3%
Taylor expanded in d around 0
metadata-evalN/A
metadata-evalN/A
pow-prod-upN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
sqr-powN/A
metadata-evalN/A
metadata-evalN/A
pow-prod-upN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites81.8%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (/ h l) 0.75)) (t_1 (* -0.125 (/ (pow (* D M) 2.0) d))))
(if (<= d -7e+181)
(* (* -1.0 d) (pow (pow (* l h) -1.0) 0.5))
(if (<= d 4e-285)
(/ (fma t_1 (* t_0 t_0) (* (pow (/ h l) 0.5) d)) h)
(/ (fma t_1 (pow (/ h l) 1.5) (* (/ (sqrt h) (sqrt l)) d)) h)))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = pow((h / l), 0.75);
double t_1 = -0.125 * (pow((D * M), 2.0) / d);
double tmp;
if (d <= -7e+181) {
tmp = (-1.0 * d) * pow(pow((l * h), -1.0), 0.5);
} else if (d <= 4e-285) {
tmp = fma(t_1, (t_0 * t_0), (pow((h / l), 0.5) * d)) / h;
} else {
tmp = fma(t_1, pow((h / l), 1.5), ((sqrt(h) / sqrt(l)) * d)) / h;
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(h / l) ^ 0.75 t_1 = Float64(-0.125 * Float64((Float64(D * M) ^ 2.0) / d)) tmp = 0.0 if (d <= -7e+181) tmp = Float64(Float64(-1.0 * d) * ((Float64(l * h) ^ -1.0) ^ 0.5)); elseif (d <= 4e-285) tmp = Float64(fma(t_1, Float64(t_0 * t_0), Float64((Float64(h / l) ^ 0.5) * d)) / h); else tmp = Float64(fma(t_1, (Float64(h / l) ^ 1.5), Float64(Float64(sqrt(h) / sqrt(l)) * d)) / h); end return tmp end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(h / l), $MachinePrecision], 0.75], $MachinePrecision]}, Block[{t$95$1 = N[(-0.125 * N[(N[Power[N[(D * M), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -7e+181], N[(N[(-1.0 * d), $MachinePrecision] * N[Power[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 4e-285], N[(N[(t$95$1 * N[(t$95$0 * t$95$0), $MachinePrecision] + N[(N[Power[N[(h / l), $MachinePrecision], 0.5], $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(N[(t$95$1 * N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] + N[(N[(N[Sqrt[h], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := {\left(\frac{h}{\ell}\right)}^{0.75}\\
t_1 := -0.125 \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}\\
\mathbf{if}\;d \leq -7 \cdot 10^{+181}:\\
\;\;\;\;\left(-1 \cdot d\right) \cdot {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5}\\
\mathbf{elif}\;d \leq 4 \cdot 10^{-285}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t\_1, t\_0 \cdot t\_0, {\left(\frac{h}{\ell}\right)}^{0.5} \cdot d\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t\_1, {\left(\frac{h}{\ell}\right)}^{1.5}, \frac{\sqrt{h}}{\sqrt{\ell}} \cdot d\right)}{h}\\
\end{array}
\end{array}
if d < -7.00000000000000016e181Initial program 57.0%
Taylor expanded in l around -inf
lower-*.f64N/A
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lower-pow.f64N/A
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6476.2
lift-/.f64N/A
metadata-eval76.2
Applied rewrites76.2%
if -7.00000000000000016e181 < d < 4.0000000000000003e-285Initial program 69.3%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites55.5%
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-powN/A
lower-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval67.1
Applied rewrites67.1%
lift-/.f64N/A
lift-pow.f64N/A
sqr-powN/A
lower-*.f64N/A
lower-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f64N/A
metadata-eval67.1
Applied rewrites67.1%
if 4.0000000000000003e-285 < d Initial program 66.7%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites49.8%
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-powN/A
lower-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval61.1
Applied rewrites61.1%
metadata-evalN/A
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6468.9
Applied rewrites68.9%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (/ h l) 0.75)) (t_1 (pow (pow (* l h) -1.0) 0.5)))
(if (<= d -7e+181)
(* (* -1.0 d) t_1)
(if (<= d 8.2e+200)
(/
(fma
(* -0.125 (/ (pow (* D M) 2.0) d))
(* t_0 t_0)
(* (pow (/ h l) 0.5) d))
h)
(* t_1 d)))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = pow((h / l), 0.75);
double t_1 = pow(pow((l * h), -1.0), 0.5);
double tmp;
if (d <= -7e+181) {
tmp = (-1.0 * d) * t_1;
} else if (d <= 8.2e+200) {
tmp = fma((-0.125 * (pow((D * M), 2.0) / d)), (t_0 * t_0), (pow((h / l), 0.5) * d)) / h;
} else {
tmp = t_1 * d;
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(h / l) ^ 0.75 t_1 = (Float64(l * h) ^ -1.0) ^ 0.5 tmp = 0.0 if (d <= -7e+181) tmp = Float64(Float64(-1.0 * d) * t_1); elseif (d <= 8.2e+200) tmp = Float64(fma(Float64(-0.125 * Float64((Float64(D * M) ^ 2.0) / d)), Float64(t_0 * t_0), Float64((Float64(h / l) ^ 0.5) * d)) / h); else tmp = Float64(t_1 * d); end return tmp end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(h / l), $MachinePrecision], 0.75], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision]}, If[LessEqual[d, -7e+181], N[(N[(-1.0 * d), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[d, 8.2e+200], N[(N[(N[(-0.125 * N[(N[Power[N[(D * M), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision] + N[(N[Power[N[(h / l), $MachinePrecision], 0.5], $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(t$95$1 * d), $MachinePrecision]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := {\left(\frac{h}{\ell}\right)}^{0.75}\\
t_1 := {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5}\\
\mathbf{if}\;d \leq -7 \cdot 10^{+181}:\\
\;\;\;\;\left(-1 \cdot d\right) \cdot t\_1\\
\mathbf{elif}\;d \leq 8.2 \cdot 10^{+200}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.125 \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, t\_0 \cdot t\_0, {\left(\frac{h}{\ell}\right)}^{0.5} \cdot d\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot d\\
\end{array}
\end{array}
if d < -7.00000000000000016e181Initial program 57.0%
Taylor expanded in l around -inf
lower-*.f64N/A
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lower-pow.f64N/A
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6476.2
lift-/.f64N/A
metadata-eval76.2
Applied rewrites76.2%
if -7.00000000000000016e181 < d < 8.2000000000000005e200Initial program 67.5%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites53.0%
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow-powN/A
lower-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval64.9
Applied rewrites64.9%
lift-/.f64N/A
lift-pow.f64N/A
sqr-powN/A
lower-*.f64N/A
lower-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lower-pow.f64N/A
lift-/.f64N/A
metadata-eval64.9
Applied rewrites64.9%
if 8.2000000000000005e200 < d Initial program 72.9%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lower-pow.f64N/A
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6477.9
lift-/.f64N/A
metadata-eval77.9
Applied rewrites77.9%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (pow (* l h) -1.0) 0.5))
(t_1 (pow (* D M) 1.0))
(t_2
(/
(/
(fma
(* (pow (pow (/ h l) 3.0) 0.5) (* t_1 t_1))
-0.125
(* (pow (/ h l) 0.5) (* d d)))
d)
h)))
(if (<= d -5e+51)
(* (* -1.0 d) t_0)
(if (<= d 9.6e-266)
t_2
(if (<= d 7.2e-130)
(/ (/ (* (pow (* l h) 0.5) (* (/ (pow (* D M) 2.0) d) -0.125)) l) l)
(if (<= d 2.2e+152) t_2 (* t_0 d)))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = pow(pow((l * h), -1.0), 0.5);
double t_1 = pow((D * M), 1.0);
double t_2 = (fma((pow(pow((h / l), 3.0), 0.5) * (t_1 * t_1)), -0.125, (pow((h / l), 0.5) * (d * d))) / d) / h;
double tmp;
if (d <= -5e+51) {
tmp = (-1.0 * d) * t_0;
} else if (d <= 9.6e-266) {
tmp = t_2;
} else if (d <= 7.2e-130) {
tmp = ((pow((l * h), 0.5) * ((pow((D * M), 2.0) / d) * -0.125)) / l) / l;
} else if (d <= 2.2e+152) {
tmp = t_2;
} else {
tmp = t_0 * d;
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = (Float64(l * h) ^ -1.0) ^ 0.5 t_1 = Float64(D * M) ^ 1.0 t_2 = Float64(Float64(fma(Float64(((Float64(h / l) ^ 3.0) ^ 0.5) * Float64(t_1 * t_1)), -0.125, Float64((Float64(h / l) ^ 0.5) * Float64(d * d))) / d) / h) tmp = 0.0 if (d <= -5e+51) tmp = Float64(Float64(-1.0 * d) * t_0); elseif (d <= 9.6e-266) tmp = t_2; elseif (d <= 7.2e-130) tmp = Float64(Float64(Float64((Float64(l * h) ^ 0.5) * Float64(Float64((Float64(D * M) ^ 2.0) / d) * -0.125)) / l) / l); elseif (d <= 2.2e+152) tmp = t_2; else tmp = Float64(t_0 * d); end return tmp end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(D * M), $MachinePrecision], 1.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(N[Power[N[Power[N[(h / l), $MachinePrecision], 3.0], $MachinePrecision], 0.5], $MachinePrecision] * N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] * -0.125 + N[(N[Power[N[(h / l), $MachinePrecision], 0.5], $MachinePrecision] * N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] / h), $MachinePrecision]}, If[LessEqual[d, -5e+51], N[(N[(-1.0 * d), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[d, 9.6e-266], t$95$2, If[LessEqual[d, 7.2e-130], N[(N[(N[(N[Power[N[(l * h), $MachinePrecision], 0.5], $MachinePrecision] * N[(N[(N[Power[N[(D * M), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] / l), $MachinePrecision], If[LessEqual[d, 2.2e+152], t$95$2, N[(t$95$0 * d), $MachinePrecision]]]]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5}\\
t_1 := {\left(D \cdot M\right)}^{1}\\
t_2 := \frac{\frac{\mathsf{fma}\left({\left({\left(\frac{h}{\ell}\right)}^{3}\right)}^{0.5} \cdot \left(t\_1 \cdot t\_1\right), -0.125, {\left(\frac{h}{\ell}\right)}^{0.5} \cdot \left(d \cdot d\right)\right)}{d}}{h}\\
\mathbf{if}\;d \leq -5 \cdot 10^{+51}:\\
\;\;\;\;\left(-1 \cdot d\right) \cdot t\_0\\
\mathbf{elif}\;d \leq 9.6 \cdot 10^{-266}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;d \leq 7.2 \cdot 10^{-130}:\\
\;\;\;\;\frac{\frac{{\left(\ell \cdot h\right)}^{0.5} \cdot \left(\frac{{\left(D \cdot M\right)}^{2}}{d} \cdot -0.125\right)}{\ell}}{\ell}\\
\mathbf{elif}\;d \leq 2.2 \cdot 10^{+152}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot d\\
\end{array}
\end{array}
if d < -5e51Initial program 66.8%
Taylor expanded in l around -inf
lower-*.f64N/A
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lower-pow.f64N/A
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6461.7
lift-/.f64N/A
metadata-eval61.7
Applied rewrites61.7%
if -5e51 < d < 9.5999999999999999e-266 or 7.2000000000000003e-130 < d < 2.1999999999999998e152Initial program 72.7%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites59.4%
Taylor expanded in d around 0
lower-/.f64N/A
Applied rewrites58.5%
if 9.5999999999999999e-266 < d < 7.2000000000000003e-130Initial program 26.2%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites23.4%
Taylor expanded in l around 0
lower-/.f64N/A
Applied rewrites24.4%
Taylor expanded in d around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow-prod-downN/A
lift-pow.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow1/2N/A
*-commutativeN/A
metadata-evalN/A
lift-pow.f64N/A
lift-*.f64N/A
metadata-eval39.3
Applied rewrites39.3%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites49.1%
if 2.1999999999999998e152 < d Initial program 82.9%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lower-pow.f64N/A
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6479.5
lift-/.f64N/A
metadata-eval79.5
Applied rewrites79.5%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (pow (* l h) -1.0) 0.5)))
(if (<= l 3.8e-287)
(* (* -1.0 d) t_0)
(if (<= l 3.2e+77)
(/
(/
(fma
(* (/ (pow (* D M) 2.0) d) -0.125)
(pow (* l h) 0.5)
(* (pow (/ (pow l 3.0) h) 0.5) d))
l)
l)
(* t_0 d)))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = pow(pow((l * h), -1.0), 0.5);
double tmp;
if (l <= 3.8e-287) {
tmp = (-1.0 * d) * t_0;
} else if (l <= 3.2e+77) {
tmp = (fma(((pow((D * M), 2.0) / d) * -0.125), pow((l * h), 0.5), (pow((pow(l, 3.0) / h), 0.5) * d)) / l) / l;
} else {
tmp = t_0 * d;
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = (Float64(l * h) ^ -1.0) ^ 0.5 tmp = 0.0 if (l <= 3.8e-287) tmp = Float64(Float64(-1.0 * d) * t_0); elseif (l <= 3.2e+77) tmp = Float64(Float64(fma(Float64(Float64((Float64(D * M) ^ 2.0) / d) * -0.125), (Float64(l * h) ^ 0.5), Float64((Float64((l ^ 3.0) / h) ^ 0.5) * d)) / l) / l); else tmp = Float64(t_0 * d); end return tmp end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision], 0.5], $MachinePrecision]}, If[LessEqual[l, 3.8e-287], N[(N[(-1.0 * d), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[l, 3.2e+77], N[(N[(N[(N[(N[(N[Power[N[(D * M), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision] * -0.125), $MachinePrecision] * N[Power[N[(l * h), $MachinePrecision], 0.5], $MachinePrecision] + N[(N[Power[N[(N[Power[l, 3.0], $MachinePrecision] / h), $MachinePrecision], 0.5], $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] / l), $MachinePrecision], N[(t$95$0 * d), $MachinePrecision]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.5}\\
\mathbf{if}\;\ell \leq 3.8 \cdot 10^{-287}:\\
\;\;\;\;\left(-1 \cdot d\right) \cdot t\_0\\
\mathbf{elif}\;\ell \leq 3.2 \cdot 10^{+77}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(\frac{{\left(D \cdot M\right)}^{2}}{d} \cdot -0.125, {\left(\ell \cdot h\right)}^{0.5}, {\left(\frac{{\ell}^{3}}{h}\right)}^{0.5} \cdot d\right)}{\ell}}{\ell}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot d\\
\end{array}
\end{array}
if l < 3.79999999999999982e-287Initial program 68.9%
Taylor expanded in l around -inf
lower-*.f64N/A
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lower-pow.f64N/A
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6442.2
lift-/.f64N/A
metadata-eval42.2
Applied rewrites42.2%
if 3.79999999999999982e-287 < l < 3.2000000000000002e77Initial program 69.1%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites49.7%
Taylor expanded in l around 0
lower-/.f64N/A
Applied rewrites50.1%
Applied rewrites63.2%
if 3.2000000000000002e77 < l Initial program 57.1%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lower-pow.f64N/A
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6447.6
lift-/.f64N/A
metadata-eval47.6
Applied rewrites47.6%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (* l h) -1.0)) (t_1 (pow t_0 0.25)))
(if (<= l 3.8e-287)
(* (* -1.0 d) (pow t_0 0.5))
(if (<= l 1.8e+79)
(/
(/
(fma
(* (/ (pow (* D M) 2.0) d) -0.125)
(pow (* l h) 0.5)
(* (pow (/ (pow l 3.0) h) 0.5) d))
l)
l)
(* (* -1.0 d) (* (* t_1 t_1) -1.0))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = pow((l * h), -1.0);
double t_1 = pow(t_0, 0.25);
double tmp;
if (l <= 3.8e-287) {
tmp = (-1.0 * d) * pow(t_0, 0.5);
} else if (l <= 1.8e+79) {
tmp = (fma(((pow((D * M), 2.0) / d) * -0.125), pow((l * h), 0.5), (pow((pow(l, 3.0) / h), 0.5) * d)) / l) / l;
} else {
tmp = (-1.0 * d) * ((t_1 * t_1) * -1.0);
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(l * h) ^ -1.0 t_1 = t_0 ^ 0.25 tmp = 0.0 if (l <= 3.8e-287) tmp = Float64(Float64(-1.0 * d) * (t_0 ^ 0.5)); elseif (l <= 1.8e+79) tmp = Float64(Float64(fma(Float64(Float64((Float64(D * M) ^ 2.0) / d) * -0.125), (Float64(l * h) ^ 0.5), Float64((Float64((l ^ 3.0) / h) ^ 0.5) * d)) / l) / l); else tmp = Float64(Float64(-1.0 * d) * Float64(Float64(t_1 * t_1) * -1.0)); end return tmp end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]}, Block[{t$95$1 = N[Power[t$95$0, 0.25], $MachinePrecision]}, If[LessEqual[l, 3.8e-287], N[(N[(-1.0 * d), $MachinePrecision] * N[Power[t$95$0, 0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.8e+79], N[(N[(N[(N[(N[(N[Power[N[(D * M), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision] * -0.125), $MachinePrecision] * N[Power[N[(l * h), $MachinePrecision], 0.5], $MachinePrecision] + N[(N[Power[N[(N[Power[l, 3.0], $MachinePrecision] / h), $MachinePrecision], 0.5], $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] / l), $MachinePrecision], N[(N[(-1.0 * d), $MachinePrecision] * N[(N[(t$95$1 * t$95$1), $MachinePrecision] * -1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := {\left(\ell \cdot h\right)}^{-1}\\
t_1 := {t\_0}^{0.25}\\
\mathbf{if}\;\ell \leq 3.8 \cdot 10^{-287}:\\
\;\;\;\;\left(-1 \cdot d\right) \cdot {t\_0}^{0.5}\\
\mathbf{elif}\;\ell \leq 1.8 \cdot 10^{+79}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(\frac{{\left(D \cdot M\right)}^{2}}{d} \cdot -0.125, {\left(\ell \cdot h\right)}^{0.5}, {\left(\frac{{\ell}^{3}}{h}\right)}^{0.5} \cdot d\right)}{\ell}}{\ell}\\
\mathbf{else}:\\
\;\;\;\;\left(-1 \cdot d\right) \cdot \left(\left(t\_1 \cdot t\_1\right) \cdot -1\right)\\
\end{array}
\end{array}
if l < 3.79999999999999982e-287Initial program 68.9%
Taylor expanded in l around -inf
lower-*.f64N/A
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lower-pow.f64N/A
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6442.2
lift-/.f64N/A
metadata-eval42.2
Applied rewrites42.2%
if 3.79999999999999982e-287 < l < 1.8e79Initial program 69.5%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites50.4%
Taylor expanded in l around 0
lower-/.f64N/A
Applied rewrites50.7%
Applied rewrites63.7%
if 1.8e79 < l Initial program 56.3%
Taylor expanded in l around -inf
lower-*.f64N/A
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lower-pow.f64N/A
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f648.8
lift-/.f64N/A
metadata-eval8.8
Applied rewrites8.8%
Taylor expanded in h around -inf
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
Applied rewrites46.4%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (pow (* l h) -1.0) 0.25)) (t_1 (pow (* l h) 0.5)))
(if (<= l 3.8e-287)
(* (* -1.0 d) (/ 1.0 t_1))
(if (<= l 1.8e+79)
(/
(/
(fma
(* (/ (pow (* D M) 2.0) d) -0.125)
t_1
(* (pow (/ (pow l 3.0) h) 0.5) d))
l)
l)
(* (* -1.0 d) (* (* t_0 t_0) -1.0))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = pow(pow((l * h), -1.0), 0.25);
double t_1 = pow((l * h), 0.5);
double tmp;
if (l <= 3.8e-287) {
tmp = (-1.0 * d) * (1.0 / t_1);
} else if (l <= 1.8e+79) {
tmp = (fma(((pow((D * M), 2.0) / d) * -0.125), t_1, (pow((pow(l, 3.0) / h), 0.5) * d)) / l) / l;
} else {
tmp = (-1.0 * d) * ((t_0 * t_0) * -1.0);
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = (Float64(l * h) ^ -1.0) ^ 0.25 t_1 = Float64(l * h) ^ 0.5 tmp = 0.0 if (l <= 3.8e-287) tmp = Float64(Float64(-1.0 * d) * Float64(1.0 / t_1)); elseif (l <= 1.8e+79) tmp = Float64(Float64(fma(Float64(Float64((Float64(D * M) ^ 2.0) / d) * -0.125), t_1, Float64((Float64((l ^ 3.0) / h) ^ 0.5) * d)) / l) / l); else tmp = Float64(Float64(-1.0 * d) * Float64(Float64(t_0 * t_0) * -1.0)); end return tmp end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision], 0.25], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(l * h), $MachinePrecision], 0.5], $MachinePrecision]}, If[LessEqual[l, 3.8e-287], N[(N[(-1.0 * d), $MachinePrecision] * N[(1.0 / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.8e+79], N[(N[(N[(N[(N[(N[Power[N[(D * M), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision] * -0.125), $MachinePrecision] * t$95$1 + N[(N[Power[N[(N[Power[l, 3.0], $MachinePrecision] / h), $MachinePrecision], 0.5], $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] / l), $MachinePrecision], N[(N[(-1.0 * d), $MachinePrecision] * N[(N[(t$95$0 * t$95$0), $MachinePrecision] * -1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.25}\\
t_1 := {\left(\ell \cdot h\right)}^{0.5}\\
\mathbf{if}\;\ell \leq 3.8 \cdot 10^{-287}:\\
\;\;\;\;\left(-1 \cdot d\right) \cdot \frac{1}{t\_1}\\
\mathbf{elif}\;\ell \leq 1.8 \cdot 10^{+79}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(\frac{{\left(D \cdot M\right)}^{2}}{d} \cdot -0.125, t\_1, {\left(\frac{{\ell}^{3}}{h}\right)}^{0.5} \cdot d\right)}{\ell}}{\ell}\\
\mathbf{else}:\\
\;\;\;\;\left(-1 \cdot d\right) \cdot \left(\left(t\_0 \cdot t\_0\right) \cdot -1\right)\\
\end{array}
\end{array}
if l < 3.79999999999999982e-287Initial program 68.9%
Taylor expanded in l around -inf
lower-*.f64N/A
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lower-pow.f64N/A
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6442.2
lift-/.f64N/A
metadata-eval42.2
Applied rewrites42.2%
metadata-evalN/A
lift-pow.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
*-commutativeN/A
inv-powN/A
metadata-evalN/A
pow1/2N/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
pow1/2N/A
*-commutativeN/A
metadata-evalN/A
lower-pow.f64N/A
lift-*.f64N/A
metadata-eval42.1
Applied rewrites42.1%
if 3.79999999999999982e-287 < l < 1.8e79Initial program 69.5%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites50.4%
Taylor expanded in l around 0
lower-/.f64N/A
Applied rewrites50.7%
Applied rewrites63.7%
if 1.8e79 < l Initial program 56.3%
Taylor expanded in l around -inf
lower-*.f64N/A
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lower-pow.f64N/A
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f648.8
lift-/.f64N/A
metadata-eval8.8
Applied rewrites8.8%
Taylor expanded in h around -inf
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
Applied rewrites46.4%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (pow (* l h) -1.0) 0.25))
(t_1
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
(t_2
(/ (/ (* (pow (* l h) 0.5) (* (/ (pow (* D M) 2.0) d) -0.125)) l) l)))
(if (<= t_1 -5e+149)
t_2
(if (<= t_1 INFINITY) (* (* -1.0 d) (* (* t_0 t_0) -1.0)) t_2))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = pow(pow((l * h), -1.0), 0.25);
double t_1 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_2 = ((pow((l * h), 0.5) * ((pow((D * M), 2.0) / d) * -0.125)) / l) / l;
double tmp;
if (t_1 <= -5e+149) {
tmp = t_2;
} else if (t_1 <= ((double) INFINITY)) {
tmp = (-1.0 * d) * ((t_0 * t_0) * -1.0);
} else {
tmp = t_2;
}
return tmp;
}
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.pow(Math.pow((l * h), -1.0), 0.25);
double t_1 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_2 = ((Math.pow((l * h), 0.5) * ((Math.pow((D * M), 2.0) / d) * -0.125)) / l) / l;
double tmp;
if (t_1 <= -5e+149) {
tmp = t_2;
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = (-1.0 * d) * ((t_0 * t_0) * -1.0);
} else {
tmp = t_2;
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): t_0 = math.pow(math.pow((l * h), -1.0), 0.25) t_1 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) t_2 = ((math.pow((l * h), 0.5) * ((math.pow((D * M), 2.0) / d) * -0.125)) / l) / l tmp = 0 if t_1 <= -5e+149: tmp = t_2 elif t_1 <= math.inf: tmp = (-1.0 * d) * ((t_0 * t_0) * -1.0) else: tmp = t_2 return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = (Float64(l * h) ^ -1.0) ^ 0.25 t_1 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_2 = Float64(Float64(Float64((Float64(l * h) ^ 0.5) * Float64(Float64((Float64(D * M) ^ 2.0) / d) * -0.125)) / l) / l) tmp = 0.0 if (t_1 <= -5e+149) tmp = t_2; elseif (t_1 <= Inf) tmp = Float64(Float64(-1.0 * d) * Float64(Float64(t_0 * t_0) * -1.0)); else tmp = t_2; end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = ((l * h) ^ -1.0) ^ 0.25;
t_1 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l)));
t_2 = ((((l * h) ^ 0.5) * ((((D * M) ^ 2.0) / d) * -0.125)) / l) / l;
tmp = 0.0;
if (t_1 <= -5e+149)
tmp = t_2;
elseif (t_1 <= Inf)
tmp = (-1.0 * d) * ((t_0 * t_0) * -1.0);
else
tmp = t_2;
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision], 0.25], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[Power[N[(l * h), $MachinePrecision], 0.5], $MachinePrecision] * N[(N[(N[Power[N[(D * M), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] / l), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+149], t$95$2, If[LessEqual[t$95$1, Infinity], N[(N[(-1.0 * d), $MachinePrecision] * N[(N[(t$95$0 * t$95$0), $MachinePrecision] * -1.0), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := {\left({\left(\ell \cdot h\right)}^{-1}\right)}^{0.25}\\
t_1 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_2 := \frac{\frac{{\left(\ell \cdot h\right)}^{0.5} \cdot \left(\frac{{\left(D \cdot M\right)}^{2}}{d} \cdot -0.125\right)}{\ell}}{\ell}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+149}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\left(-1 \cdot d\right) \cdot \left(\left(t\_0 \cdot t\_0\right) \cdot -1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -4.9999999999999999e149 or +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 53.7%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites43.3%
Taylor expanded in l around 0
lower-/.f64N/A
Applied rewrites21.8%
Taylor expanded in d around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow-prod-downN/A
lift-pow.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow1/2N/A
*-commutativeN/A
metadata-evalN/A
lift-pow.f64N/A
lift-*.f64N/A
metadata-eval29.2
Applied rewrites29.2%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites34.8%
if -4.9999999999999999e149 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 80.0%
Taylor expanded in l around -inf
lower-*.f64N/A
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lower-pow.f64N/A
inv-powN/A
lower-pow.f64N/A
*-commutativeN/A
lower-*.f6440.9
lift-/.f64N/A
metadata-eval40.9
Applied rewrites40.9%
Taylor expanded in h around -inf
sqrt-pow2N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
Applied rewrites41.7%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (* l h) 0.5)) (t_1 (* (/ (pow (* D M) 2.0) d) -0.125)))
(if (<= l 7.2e+78)
(/ (/ (fma t_1 t_0 (* (pow (/ (pow l 3.0) h) 0.5) d)) l) l)
(/ (/ (* t_0 t_1) l) l))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = pow((l * h), 0.5);
double t_1 = (pow((D * M), 2.0) / d) * -0.125;
double tmp;
if (l <= 7.2e+78) {
tmp = (fma(t_1, t_0, (pow((pow(l, 3.0) / h), 0.5) * d)) / l) / l;
} else {
tmp = ((t_0 * t_1) / l) / l;
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(l * h) ^ 0.5 t_1 = Float64(Float64((Float64(D * M) ^ 2.0) / d) * -0.125) tmp = 0.0 if (l <= 7.2e+78) tmp = Float64(Float64(fma(t_1, t_0, Float64((Float64((l ^ 3.0) / h) ^ 0.5) * d)) / l) / l); else tmp = Float64(Float64(Float64(t_0 * t_1) / l) / l); end return tmp end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(l * h), $MachinePrecision], 0.5], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(D * M), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision] * -0.125), $MachinePrecision]}, If[LessEqual[l, 7.2e+78], N[(N[(N[(t$95$1 * t$95$0 + N[(N[Power[N[(N[Power[l, 3.0], $MachinePrecision] / h), $MachinePrecision], 0.5], $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] / l), $MachinePrecision], N[(N[(N[(t$95$0 * t$95$1), $MachinePrecision] / l), $MachinePrecision] / l), $MachinePrecision]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := {\left(\ell \cdot h\right)}^{0.5}\\
t_1 := \frac{{\left(D \cdot M\right)}^{2}}{d} \cdot -0.125\\
\mathbf{if}\;\ell \leq 7.2 \cdot 10^{+78}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(t\_1, t\_0, {\left(\frac{{\ell}^{3}}{h}\right)}^{0.5} \cdot d\right)}{\ell}}{\ell}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_0 \cdot t\_1}{\ell}}{\ell}\\
\end{array}
\end{array}
if l < 7.20000000000000039e78Initial program 69.1%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites53.3%
Taylor expanded in l around 0
lower-/.f64N/A
Applied rewrites20.5%
Applied rewrites25.7%
if 7.20000000000000039e78 < l Initial program 56.3%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites46.1%
Taylor expanded in l around 0
lower-/.f64N/A
Applied rewrites2.5%
Taylor expanded in d around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow-prod-downN/A
lift-pow.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow1/2N/A
*-commutativeN/A
metadata-evalN/A
lift-pow.f64N/A
lift-*.f64N/A
metadata-eval7.9
Applied rewrites7.9%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites20.6%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (/ (/ (* (pow (* l h) 0.5) (* (/ (pow (* D M) 2.0) d) -0.125)) l) l))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
return ((pow((l * h), 0.5) * ((pow((D * M), 2.0) / d) * -0.125)) / l) / l;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
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 = ((((l * h) ** 0.5d0) * ((((d_1 * m) ** 2.0d0) / d) * (-0.125d0))) / l) / l
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
return ((Math.pow((l * h), 0.5) * ((Math.pow((D * M), 2.0) / d) * -0.125)) / l) / l;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): return ((math.pow((l * h), 0.5) * ((math.pow((D * M), 2.0) / d) * -0.125)) / l) / l
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) return Float64(Float64(Float64((Float64(l * h) ^ 0.5) * Float64(Float64((Float64(D * M) ^ 2.0) / d) * -0.125)) / l) / l) end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = ((((l * h) ^ 0.5) * ((((D * M) ^ 2.0) / d) * -0.125)) / l) / l;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := N[(N[(N[(N[Power[N[(l * h), $MachinePrecision], 0.5], $MachinePrecision] * N[(N[(N[Power[N[(D * M), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] / l), $MachinePrecision]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\frac{\frac{{\left(\ell \cdot h\right)}^{0.5} \cdot \left(\frac{{\left(D \cdot M\right)}^{2}}{d} \cdot -0.125\right)}{\ell}}{\ell}
\end{array}
Initial program 66.7%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites51.9%
Taylor expanded in l around 0
lower-/.f64N/A
Applied rewrites17.1%
Taylor expanded in d around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow-prod-downN/A
lift-pow.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow1/2N/A
*-commutativeN/A
metadata-evalN/A
lift-pow.f64N/A
lift-*.f64N/A
metadata-eval16.6
Applied rewrites16.6%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites19.6%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (/ (* (* (/ (pow (* D M) 2.0) d) -0.125) (pow (* l h) 0.5)) (* l l)))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
return (((pow((D * M), 2.0) / d) * -0.125) * pow((l * h), 0.5)) / (l * l);
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
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_1 * m) ** 2.0d0) / d) * (-0.125d0)) * ((l * h) ** 0.5d0)) / (l * l)
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
return (((Math.pow((D * M), 2.0) / d) * -0.125) * Math.pow((l * h), 0.5)) / (l * l);
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): return (((math.pow((D * M), 2.0) / d) * -0.125) * math.pow((l * h), 0.5)) / (l * l)
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) return Float64(Float64(Float64(Float64((Float64(D * M) ^ 2.0) / d) * -0.125) * (Float64(l * h) ^ 0.5)) / Float64(l * l)) end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = (((((D * M) ^ 2.0) / d) * -0.125) * ((l * h) ^ 0.5)) / (l * l);
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := N[(N[(N[(N[(N[Power[N[(D * M), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision] * -0.125), $MachinePrecision] * N[Power[N[(l * h), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\frac{\left(\frac{{\left(D \cdot M\right)}^{2}}{d} \cdot -0.125\right) \cdot {\left(\ell \cdot h\right)}^{0.5}}{\ell \cdot \ell}
\end{array}
Initial program 66.7%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites51.9%
Taylor expanded in l around 0
lower-/.f64N/A
Applied rewrites17.1%
Taylor expanded in d around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow-prod-downN/A
lift-pow.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow1/2N/A
*-commutativeN/A
metadata-evalN/A
lift-pow.f64N/A
lift-*.f64N/A
metadata-eval16.6
Applied rewrites16.6%
herbie shell --seed 2025066
(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)))))