
(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)));
}
real(8) function code(d, h, l, m, d_1)
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)));
}
real(8) function code(d, h, l, m, d_1)
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: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l))))
(if (<= l -2e-310)
(*
t_0
(*
(/ (sqrt (- d)) (sqrt (- h)))
(+ 1.0 (/ (* (* h (pow (/ (* M (* 0.5 D)) d) 2.0)) -0.5) l))))
(if (<= l 2e+185)
(*
t_0
(*
(/ (sqrt d) (sqrt h))
(+ 1.0 (/ (* -0.5 (* h (pow (* M (* 0.5 (/ D d))) 2.0))) l))))
(/ d (* (sqrt h) (sqrt l)))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double tmp;
if (l <= -2e-310) {
tmp = t_0 * ((sqrt(-d) / sqrt(-h)) * (1.0 + (((h * pow(((M * (0.5 * D)) / d), 2.0)) * -0.5) / l)));
} else if (l <= 2e+185) {
tmp = t_0 * ((sqrt(d) / sqrt(h)) * (1.0 + ((-0.5 * (h * pow((M * (0.5 * (D / d))), 2.0))) / l)));
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((d / l))
if (l <= (-2d-310)) then
tmp = t_0 * ((sqrt(-d) / sqrt(-h)) * (1.0d0 + (((h * (((m * (0.5d0 * d_1)) / d) ** 2.0d0)) * (-0.5d0)) / l)))
else if (l <= 2d+185) then
tmp = t_0 * ((sqrt(d) / sqrt(h)) * (1.0d0 + (((-0.5d0) * (h * ((m * (0.5d0 * (d_1 / d))) ** 2.0d0))) / l)))
else
tmp = d / (sqrt(h) * sqrt(l))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / l));
double tmp;
if (l <= -2e-310) {
tmp = t_0 * ((Math.sqrt(-d) / Math.sqrt(-h)) * (1.0 + (((h * Math.pow(((M * (0.5 * D)) / d), 2.0)) * -0.5) / l)));
} else if (l <= 2e+185) {
tmp = t_0 * ((Math.sqrt(d) / Math.sqrt(h)) * (1.0 + ((-0.5 * (h * Math.pow((M * (0.5 * (D / d))), 2.0))) / l)));
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) tmp = 0 if l <= -2e-310: tmp = t_0 * ((math.sqrt(-d) / math.sqrt(-h)) * (1.0 + (((h * math.pow(((M * (0.5 * D)) / d), 2.0)) * -0.5) / l))) elif l <= 2e+185: tmp = t_0 * ((math.sqrt(d) / math.sqrt(h)) * (1.0 + ((-0.5 * (h * math.pow((M * (0.5 * (D / d))), 2.0))) / l))) else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= -2e-310) tmp = Float64(t_0 * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(Float64(h * (Float64(Float64(M * Float64(0.5 * D)) / d) ^ 2.0)) * -0.5) / l)))); elseif (l <= 2e+185) tmp = Float64(t_0 * Float64(Float64(sqrt(d) / sqrt(h)) * Float64(1.0 + Float64(Float64(-0.5 * Float64(h * (Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0))) / l)))); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / l));
tmp = 0.0;
if (l <= -2e-310)
tmp = t_0 * ((sqrt(-d) / sqrt(-h)) * (1.0 + (((h * (((M * (0.5 * D)) / d) ^ 2.0)) * -0.5) / l)));
elseif (l <= 2e+185)
tmp = t_0 * ((sqrt(d) / sqrt(h)) * (1.0 + ((-0.5 * (h * ((M * (0.5 * (D / d))) ^ 2.0))) / l)));
else
tmp = d / (sqrt(h) * sqrt(l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -2e-310], N[(t$95$0 * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(N[(h * N[Power[N[(N[(M * N[(0.5 * D), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2e+185], N[(t$95$0 * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(-0.5 * N[(h * N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;t_0 \cdot \left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(1 + \frac{\left(h \cdot {\left(\frac{M \cdot \left(0.5 \cdot D\right)}{d}\right)}^{2}\right) \cdot -0.5}{\ell}\right)\right)\\
\mathbf{elif}\;\ell \leq 2 \cdot 10^{+185}:\\
\;\;\;\;t_0 \cdot \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(1 + \frac{-0.5 \cdot \left(h \cdot {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -1.999999999999994e-310Initial program 63.5%
Simplified62.8%
associate-*r*62.8%
*-commutative62.8%
associate-*r/67.8%
associate-*l/67.8%
div-inv67.8%
associate-*l*67.8%
metadata-eval67.8%
Applied egg-rr67.8%
associate-*r*67.8%
metadata-eval67.8%
div-inv67.8%
associate-*r/68.5%
div-inv68.5%
metadata-eval68.5%
associate-*r*68.5%
Applied egg-rr68.5%
frac-2neg68.5%
sqrt-div80.5%
Applied egg-rr80.5%
if -1.999999999999994e-310 < l < 2e185Initial program 72.5%
Simplified70.7%
associate-*r*70.7%
*-commutative70.7%
associate-*r/72.7%
associate-*l/72.7%
div-inv72.7%
associate-*l*72.7%
metadata-eval72.7%
Applied egg-rr72.7%
sqrt-div85.0%
div-inv84.9%
Applied egg-rr84.9%
associate-*r/85.0%
*-rgt-identity85.0%
Simplified85.0%
if 2e185 < l Initial program 50.9%
Taylor expanded in d around inf 62.0%
expm1-log1p-u61.7%
expm1-udef35.6%
pow1/235.6%
inv-pow35.6%
pow-pow35.6%
metadata-eval35.6%
Applied egg-rr35.6%
expm1-def61.8%
expm1-log1p62.2%
Simplified62.2%
add-sqr-sqrt61.9%
sqrt-unprod62.2%
pow-prod-up62.0%
metadata-eval62.0%
inv-pow62.0%
*-commutative62.0%
associate-/l/64.4%
rem-cbrt-cube45.6%
unpow1/344.3%
expm1-log1p-u43.2%
expm1-udef27.7%
Applied egg-rr35.6%
expm1-def60.0%
expm1-log1p62.0%
Simplified62.0%
*-commutative62.0%
sqrt-prod82.5%
Applied egg-rr82.5%
Final simplification82.6%
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d h)))
(t_1
(*
(* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
(- 1.0 (* (* 0.5 (pow (/ (* M D) (* d 2.0)) 2.0)) (/ h l)))))
(t_2 (* M (* 0.5 D)))
(t_3 (sqrt (/ d l))))
(if (<= t_1 -1e-85)
(* t_3 (* t_0 (+ 1.0 (* (/ h l) (* -0.5 (pow (/ d t_2) -2.0))))))
(if (or (<= t_1 0.0) (not (<= t_1 2e+229)))
(fabs (/ d (sqrt (* l h))))
(* t_3 (* (+ 1.0 (/ (* (* h (pow (/ t_2 d) 2.0)) -0.5) l)) t_0))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / h));
double t_1 = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((0.5 * pow(((M * D) / (d * 2.0)), 2.0)) * (h / l)));
double t_2 = M * (0.5 * D);
double t_3 = sqrt((d / l));
double tmp;
if (t_1 <= -1e-85) {
tmp = t_3 * (t_0 * (1.0 + ((h / l) * (-0.5 * pow((d / t_2), -2.0)))));
} else if ((t_1 <= 0.0) || !(t_1 <= 2e+229)) {
tmp = fabs((d / sqrt((l * h))));
} else {
tmp = t_3 * ((1.0 + (((h * pow((t_2 / d), 2.0)) * -0.5) / l)) * t_0);
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = sqrt((d / h))
t_1 = (((d / h) ** 0.5d0) * ((d / l) ** 0.5d0)) * (1.0d0 - ((0.5d0 * (((m * d_1) / (d * 2.0d0)) ** 2.0d0)) * (h / l)))
t_2 = m * (0.5d0 * d_1)
t_3 = sqrt((d / l))
if (t_1 <= (-1d-85)) then
tmp = t_3 * (t_0 * (1.0d0 + ((h / l) * ((-0.5d0) * ((d / t_2) ** (-2.0d0))))))
else if ((t_1 <= 0.0d0) .or. (.not. (t_1 <= 2d+229))) then
tmp = abs((d / sqrt((l * h))))
else
tmp = t_3 * ((1.0d0 + (((h * ((t_2 / d) ** 2.0d0)) * (-0.5d0)) / l)) * t_0)
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / h));
double t_1 = (Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((0.5 * Math.pow(((M * D) / (d * 2.0)), 2.0)) * (h / l)));
double t_2 = M * (0.5 * D);
double t_3 = Math.sqrt((d / l));
double tmp;
if (t_1 <= -1e-85) {
tmp = t_3 * (t_0 * (1.0 + ((h / l) * (-0.5 * Math.pow((d / t_2), -2.0)))));
} else if ((t_1 <= 0.0) || !(t_1 <= 2e+229)) {
tmp = Math.abs((d / Math.sqrt((l * h))));
} else {
tmp = t_3 * ((1.0 + (((h * Math.pow((t_2 / d), 2.0)) * -0.5) / l)) * t_0);
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / h)) t_1 = (math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((0.5 * math.pow(((M * D) / (d * 2.0)), 2.0)) * (h / l))) t_2 = M * (0.5 * D) t_3 = math.sqrt((d / l)) tmp = 0 if t_1 <= -1e-85: tmp = t_3 * (t_0 * (1.0 + ((h / l) * (-0.5 * math.pow((d / t_2), -2.0))))) elif (t_1 <= 0.0) or not (t_1 <= 2e+229): tmp = math.fabs((d / math.sqrt((l * h)))) else: tmp = t_3 * ((1.0 + (((h * math.pow((t_2 / d), 2.0)) * -0.5) / l)) * t_0) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / h)) t_1 = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(0.5 * (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0)) * Float64(h / l)))) t_2 = Float64(M * Float64(0.5 * D)) t_3 = sqrt(Float64(d / l)) tmp = 0.0 if (t_1 <= -1e-85) tmp = Float64(t_3 * Float64(t_0 * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(d / t_2) ^ -2.0)))))); elseif ((t_1 <= 0.0) || !(t_1 <= 2e+229)) tmp = abs(Float64(d / sqrt(Float64(l * h)))); else tmp = Float64(t_3 * Float64(Float64(1.0 + Float64(Float64(Float64(h * (Float64(t_2 / d) ^ 2.0)) * -0.5) / l)) * t_0)); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / h));
t_1 = (((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((0.5 * (((M * D) / (d * 2.0)) ^ 2.0)) * (h / l)));
t_2 = M * (0.5 * D);
t_3 = sqrt((d / l));
tmp = 0.0;
if (t_1 <= -1e-85)
tmp = t_3 * (t_0 * (1.0 + ((h / l) * (-0.5 * ((d / t_2) ^ -2.0)))));
elseif ((t_1 <= 0.0) || ~((t_1 <= 2e+229)))
tmp = abs((d / sqrt((l * h))));
else
tmp = t_3 * ((1.0 + (((h * ((t_2 / d) ^ 2.0)) * -0.5) / l)) * t_0);
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(0.5 * N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(M * N[(0.5 * D), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, -1e-85], N[(t$95$3 * N[(t$95$0 * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(d / t$95$2), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t$95$1, 0.0], N[Not[LessEqual[t$95$1, 2e+229]], $MachinePrecision]], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(t$95$3 * N[(N[(1.0 + N[(N[(N[(h * N[Power[N[(t$95$2 / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_2 := M \cdot \left(0.5 \cdot D\right)\\
t_3 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;t_1 \leq -1 \cdot 10^{-85}:\\
\;\;\;\;t_3 \cdot \left(t_0 \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{d}{t_2}\right)}^{-2}\right)\right)\right)\\
\mathbf{elif}\;t_1 \leq 0 \lor \neg \left(t_1 \leq 2 \cdot 10^{+229}\right):\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\mathbf{else}:\\
\;\;\;\;t_3 \cdot \left(\left(1 + \frac{\left(h \cdot {\left(\frac{t_2}{d}\right)}^{2}\right) \cdot -0.5}{\ell}\right) \cdot t_0\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < -9.9999999999999998e-86Initial program 89.2%
Simplified86.0%
associate-*r/89.2%
clear-num89.2%
div-inv89.2%
associate-*l*89.2%
metadata-eval89.2%
Applied egg-rr89.2%
expm1-log1p-u0.0%
expm1-udef0.0%
inv-pow0.0%
pow-pow0.0%
associate-/r*0.0%
metadata-eval0.0%
Applied egg-rr0.0%
expm1-def0.0%
expm1-log1p84.9%
*-commutative84.9%
associate-/r*89.2%
*-commutative89.2%
Simplified89.2%
if -9.9999999999999998e-86 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < 0.0 or 2e229 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) Initial program 22.4%
Taylor expanded in d around inf 33.9%
expm1-log1p-u33.6%
expm1-udef26.3%
pow1/226.3%
inv-pow26.3%
pow-pow26.3%
metadata-eval26.3%
Applied egg-rr26.3%
expm1-def33.6%
expm1-log1p33.9%
Simplified33.9%
add-sqr-sqrt30.9%
sqrt-prod37.3%
unpow237.3%
add-sqr-sqrt37.2%
sqrt-unprod37.3%
pow-prod-up37.3%
metadata-eval37.3%
inv-pow37.3%
*-commutative37.3%
associate-/l/37.3%
sqrt-prod32.6%
associate-/l/32.7%
*-commutative32.7%
div-inv32.7%
add-sqr-sqrt32.7%
rem-sqrt-square32.7%
sqrt-div37.3%
unpow237.3%
sqrt-prod30.9%
add-sqr-sqrt58.2%
Applied egg-rr58.2%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < 2e229Initial program 98.5%
Simplified98.5%
associate-*r*98.5%
*-commutative98.5%
associate-*r/98.5%
associate-*l/98.5%
div-inv98.5%
associate-*l*98.5%
metadata-eval98.5%
Applied egg-rr98.5%
associate-*r*98.5%
metadata-eval98.5%
div-inv98.5%
associate-*r/98.5%
div-inv98.5%
metadata-eval98.5%
associate-*r*98.5%
Applied egg-rr98.5%
Final simplification79.8%
NOTE: M should be positive before calling this function
NOTE: 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 (/ (* -0.5 (* h (pow (* M (* 0.5 (/ D d))) 2.0))) l)))
(t_1 (sqrt (/ d l))))
(if (<= l -2e-310)
(* t_1 (* (/ (sqrt (- d)) (sqrt (- h))) t_0))
(if (<= l 1.35e+184)
(* t_1 (* (/ (sqrt d) (sqrt h)) t_0))
(/ d (* (sqrt h) (sqrt l)))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = 1.0 + ((-0.5 * (h * pow((M * (0.5 * (D / d))), 2.0))) / l);
double t_1 = sqrt((d / l));
double tmp;
if (l <= -2e-310) {
tmp = t_1 * ((sqrt(-d) / sqrt(-h)) * t_0);
} else if (l <= 1.35e+184) {
tmp = t_1 * ((sqrt(d) / sqrt(h)) * t_0);
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 + (((-0.5d0) * (h * ((m * (0.5d0 * (d_1 / d))) ** 2.0d0))) / l)
t_1 = sqrt((d / l))
if (l <= (-2d-310)) then
tmp = t_1 * ((sqrt(-d) / sqrt(-h)) * t_0)
else if (l <= 1.35d+184) then
tmp = t_1 * ((sqrt(d) / sqrt(h)) * t_0)
else
tmp = d / (sqrt(h) * sqrt(l))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = 1.0 + ((-0.5 * (h * Math.pow((M * (0.5 * (D / d))), 2.0))) / l);
double t_1 = Math.sqrt((d / l));
double tmp;
if (l <= -2e-310) {
tmp = t_1 * ((Math.sqrt(-d) / Math.sqrt(-h)) * t_0);
} else if (l <= 1.35e+184) {
tmp = t_1 * ((Math.sqrt(d) / Math.sqrt(h)) * t_0);
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = 1.0 + ((-0.5 * (h * math.pow((M * (0.5 * (D / d))), 2.0))) / l) t_1 = math.sqrt((d / l)) tmp = 0 if l <= -2e-310: tmp = t_1 * ((math.sqrt(-d) / math.sqrt(-h)) * t_0) elif l <= 1.35e+184: tmp = t_1 * ((math.sqrt(d) / math.sqrt(h)) * t_0) else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(1.0 + Float64(Float64(-0.5 * Float64(h * (Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0))) / l)) t_1 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= -2e-310) tmp = Float64(t_1 * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_0)); elseif (l <= 1.35e+184) tmp = Float64(t_1 * Float64(Float64(sqrt(d) / sqrt(h)) * t_0)); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = 1.0 + ((-0.5 * (h * ((M * (0.5 * (D / d))) ^ 2.0))) / l);
t_1 = sqrt((d / l));
tmp = 0.0;
if (l <= -2e-310)
tmp = t_1 * ((sqrt(-d) / sqrt(-h)) * t_0);
elseif (l <= 1.35e+184)
tmp = t_1 * ((sqrt(d) / sqrt(h)) * t_0);
else
tmp = d / (sqrt(h) * sqrt(l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: 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[(-0.5 * N[(h * N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -2e-310], N[(t$95$1 * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.35e+184], N[(t$95$1 * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := 1 + \frac{-0.5 \cdot \left(h \cdot {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)}{\ell}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;t_1 \cdot \left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t_0\right)\\
\mathbf{elif}\;\ell \leq 1.35 \cdot 10^{+184}:\\
\;\;\;\;t_1 \cdot \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot t_0\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -1.999999999999994e-310Initial program 63.5%
Simplified62.8%
associate-*r*62.8%
*-commutative62.8%
associate-*r/67.8%
associate-*l/67.8%
div-inv67.8%
associate-*l*67.8%
metadata-eval67.8%
Applied egg-rr67.8%
frac-2neg68.5%
sqrt-div80.5%
Applied egg-rr79.8%
if -1.999999999999994e-310 < l < 1.35e184Initial program 72.5%
Simplified70.7%
associate-*r*70.7%
*-commutative70.7%
associate-*r/72.7%
associate-*l/72.7%
div-inv72.7%
associate-*l*72.7%
metadata-eval72.7%
Applied egg-rr72.7%
sqrt-div85.0%
div-inv84.9%
Applied egg-rr84.9%
associate-*r/85.0%
*-rgt-identity85.0%
Simplified85.0%
if 1.35e184 < l Initial program 50.9%
Taylor expanded in d around inf 62.0%
expm1-log1p-u61.7%
expm1-udef35.6%
pow1/235.6%
inv-pow35.6%
pow-pow35.6%
metadata-eval35.6%
Applied egg-rr35.6%
expm1-def61.8%
expm1-log1p62.2%
Simplified62.2%
add-sqr-sqrt61.9%
sqrt-unprod62.2%
pow-prod-up62.0%
metadata-eval62.0%
inv-pow62.0%
*-commutative62.0%
associate-/l/64.4%
rem-cbrt-cube45.6%
unpow1/344.3%
expm1-log1p-u43.2%
expm1-udef27.7%
Applied egg-rr35.6%
expm1-def60.0%
expm1-log1p62.0%
Simplified62.0%
*-commutative62.0%
sqrt-prod82.5%
Applied egg-rr82.5%
Final simplification82.2%
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -1.38e+119)
(fabs (/ d (sqrt (* l h))))
(if (<= l 2.6e+133)
(*
(sqrt (/ d h))
(*
(sqrt (/ d l))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D d) (/ M 2.0)) 2.0))))))
(/ d (* (sqrt h) (sqrt l))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -1.38e+119) {
tmp = fabs((d / sqrt((l * h))));
} else if (l <= 2.6e+133) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (0.5 * ((h / l) * pow(((D / d) * (M / 2.0)), 2.0)))));
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-1.38d+119)) then
tmp = abs((d / sqrt((l * h))))
else if (l <= 2.6d+133) then
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 - (0.5d0 * ((h / l) * (((d_1 / d) * (m / 2.0d0)) ** 2.0d0)))))
else
tmp = d / (sqrt(h) * sqrt(l))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -1.38e+119) {
tmp = Math.abs((d / Math.sqrt((l * h))));
} else if (l <= 2.6e+133) {
tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 - (0.5 * ((h / l) * Math.pow(((D / d) * (M / 2.0)), 2.0)))));
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -1.38e+119: tmp = math.fabs((d / math.sqrt((l * h)))) elif l <= 2.6e+133: tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 - (0.5 * ((h / l) * math.pow(((D / d) * (M / 2.0)), 2.0))))) else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -1.38e+119) tmp = abs(Float64(d / sqrt(Float64(l * h)))); elseif (l <= 2.6e+133) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D / d) * Float64(M / 2.0)) ^ 2.0)))))); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -1.38e+119)
tmp = abs((d / sqrt((l * h))));
elseif (l <= 2.6e+133)
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (0.5 * ((h / l) * (((D / d) * (M / 2.0)) ^ 2.0)))));
else
tmp = d / (sqrt(h) * sqrt(l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -1.38e+119], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, 2.6e+133], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.38 \cdot 10^{+119}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\mathbf{elif}\;\ell \leq 2.6 \cdot 10^{+133}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -1.38000000000000001e119Initial program 42.1%
Taylor expanded in d around inf 8.1%
expm1-log1p-u8.1%
expm1-udef8.4%
pow1/28.4%
inv-pow8.4%
pow-pow8.4%
metadata-eval8.4%
Applied egg-rr8.4%
expm1-def8.1%
expm1-log1p8.1%
Simplified8.1%
add-sqr-sqrt0.0%
sqrt-prod39.8%
unpow239.8%
add-sqr-sqrt39.5%
sqrt-unprod39.8%
pow-prod-up39.7%
metadata-eval39.7%
inv-pow39.7%
*-commutative39.7%
associate-/l/39.6%
sqrt-prod34.7%
associate-/l/34.8%
*-commutative34.8%
div-inv34.8%
add-sqr-sqrt34.8%
rem-sqrt-square34.8%
sqrt-div39.8%
unpow239.8%
sqrt-prod0.0%
add-sqr-sqrt55.1%
Applied egg-rr55.1%
if -1.38000000000000001e119 < l < 2.5999999999999998e133Initial program 73.0%
Simplified71.4%
if 2.5999999999999998e133 < l Initial program 56.5%
Taylor expanded in d around inf 65.6%
expm1-log1p-u65.2%
expm1-udef25.8%
pow1/225.8%
inv-pow25.8%
pow-pow25.8%
metadata-eval25.8%
Applied egg-rr25.8%
expm1-def65.3%
expm1-log1p65.7%
Simplified65.7%
add-sqr-sqrt65.5%
sqrt-unprod65.7%
pow-prod-up65.6%
metadata-eval65.6%
inv-pow65.6%
*-commutative65.6%
associate-/l/67.0%
rem-cbrt-cube34.7%
unpow1/333.5%
expm1-log1p-u32.7%
expm1-udef20.8%
Applied egg-rr35.1%
expm1-def63.1%
expm1-log1p65.8%
Simplified65.8%
*-commutative65.8%
sqrt-prod81.0%
Applied egg-rr81.0%
Final simplification70.5%
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -5.6e+117)
(fabs (/ d (sqrt (* l h))))
(if (<= l 2.1e+133)
(*
(sqrt (/ d h))
(*
(sqrt (/ d l))
(- 1.0 (* 0.5 (* (pow (/ (* M (* 0.5 D)) d) 2.0) (/ h l))))))
(/ d (* (sqrt h) (sqrt l))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -5.6e+117) {
tmp = fabs((d / sqrt((l * h))));
} else if (l <= 2.1e+133) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (0.5 * (pow(((M * (0.5 * D)) / d), 2.0) * (h / l)))));
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-5.6d+117)) then
tmp = abs((d / sqrt((l * h))))
else if (l <= 2.1d+133) then
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 - (0.5d0 * ((((m * (0.5d0 * d_1)) / d) ** 2.0d0) * (h / l)))))
else
tmp = d / (sqrt(h) * sqrt(l))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -5.6e+117) {
tmp = Math.abs((d / Math.sqrt((l * h))));
} else if (l <= 2.1e+133) {
tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 - (0.5 * (Math.pow(((M * (0.5 * D)) / d), 2.0) * (h / l)))));
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -5.6e+117: tmp = math.fabs((d / math.sqrt((l * h)))) elif l <= 2.1e+133: tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 - (0.5 * (math.pow(((M * (0.5 * D)) / d), 2.0) * (h / l))))) else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -5.6e+117) tmp = abs(Float64(d / sqrt(Float64(l * h)))); elseif (l <= 2.1e+133) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(M * Float64(0.5 * D)) / d) ^ 2.0) * Float64(h / l)))))); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -5.6e+117)
tmp = abs((d / sqrt((l * h))));
elseif (l <= 2.1e+133)
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (0.5 * ((((M * (0.5 * D)) / d) ^ 2.0) * (h / l)))));
else
tmp = d / (sqrt(h) * sqrt(l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -5.6e+117], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, 2.1e+133], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[Power[N[(N[(M * N[(0.5 * D), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5.6 \cdot 10^{+117}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\mathbf{elif}\;\ell \leq 2.1 \cdot 10^{+133}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M \cdot \left(0.5 \cdot D\right)}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -5.59999999999999995e117Initial program 42.1%
Taylor expanded in d around inf 8.1%
expm1-log1p-u8.1%
expm1-udef8.4%
pow1/28.4%
inv-pow8.4%
pow-pow8.4%
metadata-eval8.4%
Applied egg-rr8.4%
expm1-def8.1%
expm1-log1p8.1%
Simplified8.1%
add-sqr-sqrt0.0%
sqrt-prod39.8%
unpow239.8%
add-sqr-sqrt39.5%
sqrt-unprod39.8%
pow-prod-up39.7%
metadata-eval39.7%
inv-pow39.7%
*-commutative39.7%
associate-/l/39.6%
sqrt-prod34.7%
associate-/l/34.8%
*-commutative34.8%
div-inv34.8%
add-sqr-sqrt34.8%
rem-sqrt-square34.8%
sqrt-div39.8%
unpow239.8%
sqrt-prod0.0%
add-sqr-sqrt55.1%
Applied egg-rr55.1%
if -5.59999999999999995e117 < l < 2.1e133Initial program 73.0%
Simplified71.4%
associate-*r/73.0%
div-inv73.0%
associate-*l*73.0%
metadata-eval73.0%
Applied egg-rr73.0%
if 2.1e133 < l Initial program 56.5%
Taylor expanded in d around inf 65.6%
expm1-log1p-u65.2%
expm1-udef25.8%
pow1/225.8%
inv-pow25.8%
pow-pow25.8%
metadata-eval25.8%
Applied egg-rr25.8%
expm1-def65.3%
expm1-log1p65.7%
Simplified65.7%
add-sqr-sqrt65.5%
sqrt-unprod65.7%
pow-prod-up65.6%
metadata-eval65.6%
inv-pow65.6%
*-commutative65.6%
associate-/l/67.0%
rem-cbrt-cube34.7%
unpow1/333.5%
expm1-log1p-u32.7%
expm1-udef20.8%
Applied egg-rr35.1%
expm1-def63.1%
expm1-log1p65.8%
Simplified65.8%
*-commutative65.8%
sqrt-prod81.0%
Applied egg-rr81.0%
Final simplification71.5%
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -2.6e+118)
(fabs (/ d (sqrt (* l h))))
(if (<= l 2.2e+133)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+ 1.0 (* (/ h l) (* -0.5 (pow (/ d (* M (* 0.5 D))) -2.0))))))
(/ d (* (sqrt h) (sqrt l))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -2.6e+118) {
tmp = fabs((d / sqrt((l * h))));
} else if (l <= 2.2e+133) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * pow((d / (M * (0.5 * D))), -2.0)))));
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-2.6d+118)) then
tmp = abs((d / sqrt((l * h))))
else if (l <= 2.2d+133) then
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 + ((h / l) * ((-0.5d0) * ((d / (m * (0.5d0 * d_1))) ** (-2.0d0))))))
else
tmp = d / (sqrt(h) * sqrt(l))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -2.6e+118) {
tmp = Math.abs((d / Math.sqrt((l * h))));
} else if (l <= 2.2e+133) {
tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * Math.pow((d / (M * (0.5 * D))), -2.0)))));
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -2.6e+118: tmp = math.fabs((d / math.sqrt((l * h)))) elif l <= 2.2e+133: tmp = math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * math.pow((d / (M * (0.5 * D))), -2.0))))) else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -2.6e+118) tmp = abs(Float64(d / sqrt(Float64(l * h)))); elseif (l <= 2.2e+133) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(d / Float64(M * Float64(0.5 * D))) ^ -2.0)))))); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -2.6e+118)
tmp = abs((d / sqrt((l * h))));
elseif (l <= 2.2e+133)
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * ((d / (M * (0.5 * D))) ^ -2.0)))));
else
tmp = d / (sqrt(h) * sqrt(l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -2.6e+118], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, 2.2e+133], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(d / N[(M * N[(0.5 * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.6 \cdot 10^{+118}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\mathbf{elif}\;\ell \leq 2.2 \cdot 10^{+133}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{d}{M \cdot \left(0.5 \cdot D\right)}\right)}^{-2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -2.60000000000000016e118Initial program 42.1%
Taylor expanded in d around inf 8.1%
expm1-log1p-u8.1%
expm1-udef8.4%
pow1/28.4%
inv-pow8.4%
pow-pow8.4%
metadata-eval8.4%
Applied egg-rr8.4%
expm1-def8.1%
expm1-log1p8.1%
Simplified8.1%
add-sqr-sqrt0.0%
sqrt-prod39.8%
unpow239.8%
add-sqr-sqrt39.5%
sqrt-unprod39.8%
pow-prod-up39.7%
metadata-eval39.7%
inv-pow39.7%
*-commutative39.7%
associate-/l/39.6%
sqrt-prod34.7%
associate-/l/34.8%
*-commutative34.8%
div-inv34.8%
add-sqr-sqrt34.8%
rem-sqrt-square34.8%
sqrt-div39.8%
unpow239.8%
sqrt-prod0.0%
add-sqr-sqrt55.1%
Applied egg-rr55.1%
if -2.60000000000000016e118 < l < 2.2e133Initial program 73.0%
Simplified71.4%
associate-*r/73.0%
clear-num73.0%
div-inv73.0%
associate-*l*73.0%
metadata-eval73.0%
Applied egg-rr73.0%
expm1-log1p-u31.1%
expm1-udef31.1%
inv-pow31.1%
pow-pow31.1%
associate-/r*30.6%
metadata-eval30.6%
Applied egg-rr30.6%
expm1-def30.6%
expm1-log1p70.3%
*-commutative70.3%
associate-/r*73.0%
*-commutative73.0%
Simplified73.0%
if 2.2e133 < l Initial program 56.5%
Taylor expanded in d around inf 65.6%
expm1-log1p-u65.2%
expm1-udef25.8%
pow1/225.8%
inv-pow25.8%
pow-pow25.8%
metadata-eval25.8%
Applied egg-rr25.8%
expm1-def65.3%
expm1-log1p65.7%
Simplified65.7%
add-sqr-sqrt65.5%
sqrt-unprod65.7%
pow-prod-up65.6%
metadata-eval65.6%
inv-pow65.6%
*-commutative65.6%
associate-/l/67.0%
rem-cbrt-cube34.7%
unpow1/333.5%
expm1-log1p-u32.7%
expm1-udef20.8%
Applied egg-rr35.1%
expm1-def63.1%
expm1-log1p65.8%
Simplified65.8%
*-commutative65.8%
sqrt-prod81.0%
Applied egg-rr81.0%
Final simplification71.6%
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l 5.5e+132)
(*
(sqrt (/ d l))
(*
(+ 1.0 (/ (* -0.5 (* h (pow (* M (* 0.5 (/ D d))) 2.0))) l))
(sqrt (/ d h))))
(/ d (* (sqrt h) (sqrt l)))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 5.5e+132) {
tmp = sqrt((d / l)) * ((1.0 + ((-0.5 * (h * pow((M * (0.5 * (D / d))), 2.0))) / l)) * sqrt((d / h)));
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= 5.5d+132) then
tmp = sqrt((d / l)) * ((1.0d0 + (((-0.5d0) * (h * ((m * (0.5d0 * (d_1 / d))) ** 2.0d0))) / l)) * sqrt((d / h)))
else
tmp = d / (sqrt(h) * sqrt(l))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 5.5e+132) {
tmp = Math.sqrt((d / l)) * ((1.0 + ((-0.5 * (h * Math.pow((M * (0.5 * (D / d))), 2.0))) / l)) * Math.sqrt((d / h)));
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 5.5e+132: tmp = math.sqrt((d / l)) * ((1.0 + ((-0.5 * (h * math.pow((M * (0.5 * (D / d))), 2.0))) / l)) * math.sqrt((d / h))) else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 5.5e+132) tmp = Float64(sqrt(Float64(d / l)) * Float64(Float64(1.0 + Float64(Float64(-0.5 * Float64(h * (Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0))) / l)) * sqrt(Float64(d / h)))); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= 5.5e+132)
tmp = sqrt((d / l)) * ((1.0 + ((-0.5 * (h * ((M * (0.5 * (D / d))) ^ 2.0))) / l)) * sqrt((d / h)));
else
tmp = d / (sqrt(h) * sqrt(l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, 5.5e+132], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(1.0 + N[(N[(-0.5 * N[(h * N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 5.5 \cdot 10^{+132}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\left(1 + \frac{-0.5 \cdot \left(h \cdot {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)}{\ell}\right) \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < 5.5e132Initial program 67.8%
Simplified66.5%
associate-*r*66.5%
*-commutative66.5%
associate-*r/70.3%
associate-*l/70.3%
div-inv70.3%
associate-*l*70.3%
metadata-eval70.3%
Applied egg-rr70.3%
if 5.5e132 < l Initial program 56.5%
Taylor expanded in d around inf 65.6%
expm1-log1p-u65.2%
expm1-udef25.8%
pow1/225.8%
inv-pow25.8%
pow-pow25.8%
metadata-eval25.8%
Applied egg-rr25.8%
expm1-def65.3%
expm1-log1p65.7%
Simplified65.7%
add-sqr-sqrt65.5%
sqrt-unprod65.7%
pow-prod-up65.6%
metadata-eval65.6%
inv-pow65.6%
*-commutative65.6%
associate-/l/67.0%
rem-cbrt-cube34.7%
unpow1/333.5%
expm1-log1p-u32.7%
expm1-udef20.8%
Applied egg-rr35.1%
expm1-def63.1%
expm1-log1p65.8%
Simplified65.8%
*-commutative65.8%
sqrt-prod81.0%
Applied egg-rr81.0%
Final simplification71.9%
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* -0.125 (* (sqrt (* h (pow l -3.0))) (/ (pow (* M D) 2.0) d))))
(t_1 (/ d (sqrt (* l h)))))
(if (<= d -1.25e+60)
(fabs t_1)
(if (<= d -1.9e-292)
(* t_1 (fma (pow (* (/ D d) (* M 0.5)) 2.0) (/ 0.5 (/ l h)) 1.0))
(if (<= d 1e-86)
t_0
(if (<= d 3e-24)
(* (pow l -0.5) (* d (pow h -0.5)))
(if (<= d 2.85e+137) t_0 (* d (* (pow l -0.5) (pow h -0.5))))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = -0.125 * (sqrt((h * pow(l, -3.0))) * (pow((M * D), 2.0) / d));
double t_1 = d / sqrt((l * h));
double tmp;
if (d <= -1.25e+60) {
tmp = fabs(t_1);
} else if (d <= -1.9e-292) {
tmp = t_1 * fma(pow(((D / d) * (M * 0.5)), 2.0), (0.5 / (l / h)), 1.0);
} else if (d <= 1e-86) {
tmp = t_0;
} else if (d <= 3e-24) {
tmp = pow(l, -0.5) * (d * pow(h, -0.5));
} else if (d <= 2.85e+137) {
tmp = t_0;
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(-0.125 * Float64(sqrt(Float64(h * (l ^ -3.0))) * Float64((Float64(M * D) ^ 2.0) / d))) t_1 = Float64(d / sqrt(Float64(l * h))) tmp = 0.0 if (d <= -1.25e+60) tmp = abs(t_1); elseif (d <= -1.9e-292) tmp = Float64(t_1 * fma((Float64(Float64(D / d) * Float64(M * 0.5)) ^ 2.0), Float64(0.5 / Float64(l / h)), 1.0)); elseif (d <= 1e-86) tmp = t_0; elseif (d <= 3e-24) tmp = Float64((l ^ -0.5) * Float64(d * (h ^ -0.5))); elseif (d <= 2.85e+137) tmp = t_0; else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(-0.125 * N[(N[Sqrt[N[(h * N[Power[l, -3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Power[N[(M * D), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.25e+60], N[Abs[t$95$1], $MachinePrecision], If[LessEqual[d, -1.9e-292], N[(t$95$1 * N[(N[Power[N[(N[(D / d), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 / N[(l / h), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1e-86], t$95$0, If[LessEqual[d, 3e-24], N[(N[Power[l, -0.5], $MachinePrecision] * N[(d * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.85e+137], t$95$0, N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := -0.125 \cdot \left(\sqrt{h \cdot {\ell}^{-3}} \cdot \frac{{\left(M \cdot D\right)}^{2}}{d}\right)\\
t_1 := \frac{d}{\sqrt{\ell \cdot h}}\\
\mathbf{if}\;d \leq -1.25 \cdot 10^{+60}:\\
\;\;\;\;\left|t_1\right|\\
\mathbf{elif}\;d \leq -1.9 \cdot 10^{-292}:\\
\;\;\;\;t_1 \cdot \mathsf{fma}\left({\left(\frac{D}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}, \frac{0.5}{\frac{\ell}{h}}, 1\right)\\
\mathbf{elif}\;d \leq 10^{-86}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 3 \cdot 10^{-24}:\\
\;\;\;\;{\ell}^{-0.5} \cdot \left(d \cdot {h}^{-0.5}\right)\\
\mathbf{elif}\;d \leq 2.85 \cdot 10^{+137}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if d < -1.24999999999999994e60Initial program 66.1%
Taylor expanded in d around inf 5.5%
expm1-log1p-u5.5%
expm1-udef5.6%
pow1/25.6%
inv-pow5.6%
pow-pow5.6%
metadata-eval5.6%
Applied egg-rr5.6%
expm1-def5.5%
expm1-log1p5.5%
Simplified5.5%
add-sqr-sqrt0.0%
sqrt-prod42.6%
unpow242.6%
add-sqr-sqrt42.5%
sqrt-unprod42.6%
pow-prod-up42.6%
metadata-eval42.6%
inv-pow42.6%
*-commutative42.6%
associate-/l/42.6%
sqrt-prod32.4%
associate-/l/32.4%
*-commutative32.4%
div-inv32.4%
add-sqr-sqrt32.4%
rem-sqrt-square32.4%
sqrt-div42.6%
unpow242.6%
sqrt-prod0.0%
add-sqr-sqrt65.6%
Applied egg-rr65.6%
if -1.24999999999999994e60 < d < -1.9000000000000001e-292Initial program 64.2%
Applied egg-rr15.4%
expm1-log1p-u15.2%
expm1-udef6.9%
Applied egg-rr4.0%
expm1-def7.8%
expm1-log1p46.3%
fma-udef46.3%
fma-udef46.3%
associate-/l*46.3%
Simplified46.3%
if -1.9000000000000001e-292 < d < 1.00000000000000008e-86 or 2.99999999999999995e-24 < d < 2.8499999999999999e137Initial program 60.5%
Taylor expanded in d around 0 36.3%
*-commutative36.3%
associate-*l*36.3%
associate-/l*33.8%
associate-/r/36.1%
Simplified36.1%
expm1-log1p-u4.6%
expm1-udef4.6%
associate-*r*4.6%
associate-*l/4.7%
pow-prod-down4.9%
div-inv4.9%
pow-flip4.8%
metadata-eval4.8%
Applied egg-rr4.8%
expm1-def4.8%
expm1-log1p50.6%
*-commutative50.6%
*-commutative50.6%
Simplified50.6%
if 1.00000000000000008e-86 < d < 2.99999999999999995e-24Initial program 69.8%
Taylor expanded in d around inf 57.2%
expm1-log1p-u55.4%
expm1-udef23.8%
pow1/223.8%
inv-pow23.8%
pow-pow23.8%
metadata-eval23.8%
Applied egg-rr23.8%
expm1-def55.4%
expm1-log1p57.2%
Simplified57.2%
add-sqr-sqrt56.9%
sqrt-unprod57.2%
pow-prod-up57.2%
metadata-eval57.2%
inv-pow57.2%
*-commutative57.2%
associate-/l/57.2%
rem-cbrt-cube25.4%
unpow1/323.9%
expm1-log1p-u23.9%
expm1-udef4.2%
Applied egg-rr24.4%
expm1-def56.1%
expm1-log1p57.4%
Simplified57.4%
clear-num57.1%
associate-/r/57.2%
pow1/257.2%
pow-flip57.2%
*-commutative57.2%
metadata-eval57.2%
pow-prod-down77.6%
associate-*l*77.7%
Applied egg-rr77.7%
if 2.8499999999999999e137 < d Initial program 78.7%
Taylor expanded in d around inf 68.5%
expm1-log1p-u67.7%
expm1-udef44.8%
pow1/244.8%
inv-pow44.8%
pow-pow44.8%
metadata-eval44.8%
Applied egg-rr44.8%
expm1-def67.7%
expm1-log1p68.5%
Simplified68.5%
*-commutative68.5%
unpow-prod-down77.1%
Applied egg-rr77.1%
Final simplification58.1%
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= M 5.9e-28)
(fabs (/ d (sqrt (* l h))))
(if (<= M 1700000.0)
(* d (log1p (expm1 (pow (* l h) -0.5))))
(* -0.125 (* (sqrt (* h (pow l -3.0))) (/ (pow (* M D) 2.0) d))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (M <= 5.9e-28) {
tmp = fabs((d / sqrt((l * h))));
} else if (M <= 1700000.0) {
tmp = d * log1p(expm1(pow((l * h), -0.5)));
} else {
tmp = -0.125 * (sqrt((h * pow(l, -3.0))) * (pow((M * D), 2.0) / d));
}
return tmp;
}
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (M <= 5.9e-28) {
tmp = Math.abs((d / Math.sqrt((l * h))));
} else if (M <= 1700000.0) {
tmp = d * Math.log1p(Math.expm1(Math.pow((l * h), -0.5)));
} else {
tmp = -0.125 * (Math.sqrt((h * Math.pow(l, -3.0))) * (Math.pow((M * D), 2.0) / d));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if M <= 5.9e-28: tmp = math.fabs((d / math.sqrt((l * h)))) elif M <= 1700000.0: tmp = d * math.log1p(math.expm1(math.pow((l * h), -0.5))) else: tmp = -0.125 * (math.sqrt((h * math.pow(l, -3.0))) * (math.pow((M * D), 2.0) / d)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (M <= 5.9e-28) tmp = abs(Float64(d / sqrt(Float64(l * h)))); elseif (M <= 1700000.0) tmp = Float64(d * log1p(expm1((Float64(l * h) ^ -0.5)))); else tmp = Float64(-0.125 * Float64(sqrt(Float64(h * (l ^ -3.0))) * Float64((Float64(M * D) ^ 2.0) / d))); end return tmp end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[M, 5.9e-28], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[M, 1700000.0], N[(d * N[Log[1 + N[(Exp[N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(-0.125 * N[(N[Sqrt[N[(h * N[Power[l, -3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Power[N[(M * D), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq 5.9 \cdot 10^{-28}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\mathbf{elif}\;M \leq 1700000:\\
\;\;\;\;d \cdot \mathsf{log1p}\left(\mathsf{expm1}\left({\left(\ell \cdot h\right)}^{-0.5}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \left(\sqrt{h \cdot {\ell}^{-3}} \cdot \frac{{\left(M \cdot D\right)}^{2}}{d}\right)\\
\end{array}
\end{array}
if M < 5.9000000000000002e-28Initial program 66.7%
Taylor expanded in d around inf 30.9%
expm1-log1p-u30.4%
expm1-udef20.7%
pow1/220.7%
inv-pow20.7%
pow-pow20.6%
metadata-eval20.6%
Applied egg-rr20.6%
expm1-def30.3%
expm1-log1p30.8%
Simplified30.8%
add-sqr-sqrt26.4%
sqrt-prod32.0%
unpow232.0%
add-sqr-sqrt31.8%
sqrt-unprod31.7%
pow-prod-up31.7%
metadata-eval31.7%
inv-pow31.7%
*-commutative31.7%
associate-/l/31.7%
sqrt-prod25.3%
associate-/l/25.3%
*-commutative25.3%
div-inv25.6%
add-sqr-sqrt25.6%
rem-sqrt-square25.6%
sqrt-div32.0%
unpow232.0%
sqrt-prod26.4%
add-sqr-sqrt51.5%
Applied egg-rr51.5%
if 5.9000000000000002e-28 < M < 1.7e6Initial program 74.5%
Taylor expanded in d around inf 26.3%
expm1-log1p-u26.3%
expm1-udef3.0%
pow1/23.0%
inv-pow3.0%
pow-pow3.0%
metadata-eval3.0%
Applied egg-rr3.0%
expm1-def26.3%
expm1-log1p26.3%
Simplified26.3%
log1p-expm1-u38.3%
Applied egg-rr38.3%
if 1.7e6 < M Initial program 63.4%
Taylor expanded in d around 0 26.5%
*-commutative26.5%
associate-*l*26.5%
associate-/l*24.8%
associate-/r/26.3%
Simplified26.3%
expm1-log1p-u3.5%
expm1-udef3.5%
associate-*r*3.5%
associate-*l/3.8%
pow-prod-down3.9%
div-inv3.9%
pow-flip3.8%
metadata-eval3.8%
Applied egg-rr3.8%
expm1-def3.8%
expm1-log1p30.3%
*-commutative30.3%
*-commutative30.3%
Simplified30.3%
Final simplification46.0%
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -6.6e-94)
(* (- d) (pow (* l h) -0.5))
(if (<= l -2e-310)
(/ d (log (exp (sqrt (* l h)))))
(/ d (* (sqrt h) (sqrt l))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -6.6e-94) {
tmp = -d * pow((l * h), -0.5);
} else if (l <= -2e-310) {
tmp = d / log(exp(sqrt((l * h))));
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-6.6d-94)) then
tmp = -d * ((l * h) ** (-0.5d0))
else if (l <= (-2d-310)) then
tmp = d / log(exp(sqrt((l * h))))
else
tmp = d / (sqrt(h) * sqrt(l))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -6.6e-94) {
tmp = -d * Math.pow((l * h), -0.5);
} else if (l <= -2e-310) {
tmp = d / Math.log(Math.exp(Math.sqrt((l * h))));
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -6.6e-94: tmp = -d * math.pow((l * h), -0.5) elif l <= -2e-310: tmp = d / math.log(math.exp(math.sqrt((l * h)))) else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -6.6e-94) tmp = Float64(Float64(-d) * (Float64(l * h) ^ -0.5)); elseif (l <= -2e-310) tmp = Float64(d / log(exp(sqrt(Float64(l * h))))); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -6.6e-94)
tmp = -d * ((l * h) ^ -0.5);
elseif (l <= -2e-310)
tmp = d / log(exp(sqrt((l * h))));
else
tmp = d / (sqrt(h) * sqrt(l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -6.6e-94], N[((-d) * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2e-310], N[(d / N[Log[N[Exp[N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -6.6 \cdot 10^{-94}:\\
\;\;\;\;\left(-d\right) \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\log \left(e^{\sqrt{\ell \cdot h}}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -6.6000000000000003e-94Initial program 58.6%
Applied egg-rr24.3%
Taylor expanded in d around -inf 52.1%
mul-1-neg52.1%
unpow-152.1%
metadata-eval52.1%
pow-sqr52.1%
rem-sqrt-square53.1%
metadata-eval53.1%
pow-sqr52.8%
fabs-sqr52.8%
pow-sqr53.1%
metadata-eval53.1%
distribute-rgt-neg-in53.1%
Simplified53.1%
if -6.6000000000000003e-94 < l < -1.999999999999994e-310Initial program 72.1%
Taylor expanded in d around inf 22.0%
expm1-log1p-u22.0%
expm1-udef21.9%
pow1/221.9%
inv-pow21.9%
pow-pow17.7%
metadata-eval17.7%
Applied egg-rr17.7%
expm1-def17.8%
expm1-log1p17.8%
Simplified17.8%
add-sqr-sqrt17.8%
sqrt-unprod22.0%
pow-prod-up22.0%
metadata-eval22.0%
inv-pow22.0%
*-commutative22.0%
associate-/l/22.0%
rem-cbrt-cube30.1%
unpow1/330.1%
expm1-log1p-u0.3%
expm1-udef0.2%
Applied egg-rr0.4%
expm1-def0.6%
expm1-log1p17.8%
Simplified17.8%
add-log-exp42.6%
Applied egg-rr42.6%
if -1.999999999999994e-310 < l Initial program 68.7%
Taylor expanded in d around inf 44.4%
expm1-log1p-u43.5%
expm1-udef28.1%
pow1/228.1%
inv-pow28.1%
pow-pow28.7%
metadata-eval28.7%
Applied egg-rr28.7%
expm1-def44.1%
expm1-log1p45.0%
Simplified45.0%
add-sqr-sqrt44.9%
sqrt-unprod44.5%
pow-prod-up44.4%
metadata-eval44.4%
inv-pow44.4%
*-commutative44.4%
associate-/l/44.8%
rem-cbrt-cube27.6%
unpow1/326.8%
expm1-log1p-u26.3%
expm1-udef21.0%
Applied egg-rr31.7%
expm1-def43.1%
expm1-log1p45.1%
Simplified45.1%
*-commutative45.1%
sqrt-prod50.9%
Applied egg-rr50.9%
Final simplification50.1%
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= M 7.2e-26) (fabs (/ d (sqrt (* l h)))) (* d (log (exp (pow (* l h) -0.5))))))
M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (M <= 7.2e-26) {
tmp = fabs((d / sqrt((l * h))));
} else {
tmp = d * log(exp(pow((l * h), -0.5)));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (m <= 7.2d-26) then
tmp = abs((d / sqrt((l * h))))
else
tmp = d * log(exp(((l * h) ** (-0.5d0))))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (M <= 7.2e-26) {
tmp = Math.abs((d / Math.sqrt((l * h))));
} else {
tmp = d * Math.log(Math.exp(Math.pow((l * h), -0.5)));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if M <= 7.2e-26: tmp = math.fabs((d / math.sqrt((l * h)))) else: tmp = d * math.log(math.exp(math.pow((l * h), -0.5))) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (M <= 7.2e-26) tmp = abs(Float64(d / sqrt(Float64(l * h)))); else tmp = Float64(d * log(exp((Float64(l * h) ^ -0.5)))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (M <= 7.2e-26)
tmp = abs((d / sqrt((l * h))));
else
tmp = d * log(exp(((l * h) ^ -0.5)));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[M, 7.2e-26], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(d * N[Log[N[Exp[N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq 7.2 \cdot 10^{-26}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\mathbf{else}:\\
\;\;\;\;d \cdot \log \left(e^{{\left(\ell \cdot h\right)}^{-0.5}}\right)\\
\end{array}
\end{array}
if M < 7.2000000000000003e-26Initial program 66.3%
Taylor expanded in d around inf 31.3%
expm1-log1p-u30.7%
expm1-udef20.6%
pow1/220.6%
inv-pow20.6%
pow-pow20.5%
metadata-eval20.5%
Applied egg-rr20.5%
expm1-def30.7%
expm1-log1p31.2%
Simplified31.2%
add-sqr-sqrt26.8%
sqrt-prod32.3%
unpow232.3%
add-sqr-sqrt32.2%
sqrt-unprod32.1%
pow-prod-up32.0%
metadata-eval32.0%
inv-pow32.0%
*-commutative32.0%
associate-/l/32.0%
sqrt-prod25.7%
associate-/l/25.7%
*-commutative25.7%
div-inv26.0%
add-sqr-sqrt26.0%
rem-sqrt-square26.0%
sqrt-div32.4%
unpow232.4%
sqrt-prod26.8%
add-sqr-sqrt51.8%
Applied egg-rr51.8%
if 7.2000000000000003e-26 < M Initial program 65.6%
Taylor expanded in d around inf 19.2%
add-log-exp25.9%
pow1/225.9%
inv-pow25.9%
pow-pow25.9%
metadata-eval25.9%
Applied egg-rr25.9%
Final simplification44.8%
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= M 2.5e-31) (fabs (/ d (sqrt (* l h)))) (* d (log1p (expm1 (pow (* l h) -0.5))))))
M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (M <= 2.5e-31) {
tmp = fabs((d / sqrt((l * h))));
} else {
tmp = d * log1p(expm1(pow((l * h), -0.5)));
}
return tmp;
}
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (M <= 2.5e-31) {
tmp = Math.abs((d / Math.sqrt((l * h))));
} else {
tmp = d * Math.log1p(Math.expm1(Math.pow((l * h), -0.5)));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if M <= 2.5e-31: tmp = math.fabs((d / math.sqrt((l * h)))) else: tmp = d * math.log1p(math.expm1(math.pow((l * h), -0.5))) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (M <= 2.5e-31) tmp = abs(Float64(d / sqrt(Float64(l * h)))); else tmp = Float64(d * log1p(expm1((Float64(l * h) ^ -0.5)))); end return tmp end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[M, 2.5e-31], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(d * N[Log[1 + N[(Exp[N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq 2.5 \cdot 10^{-31}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\mathbf{else}:\\
\;\;\;\;d \cdot \mathsf{log1p}\left(\mathsf{expm1}\left({\left(\ell \cdot h\right)}^{-0.5}\right)\right)\\
\end{array}
\end{array}
if M < 2.5e-31Initial program 66.5%
Taylor expanded in d around inf 31.0%
expm1-log1p-u30.5%
expm1-udef20.8%
pow1/220.8%
inv-pow20.8%
pow-pow20.7%
metadata-eval20.7%
Applied egg-rr20.7%
expm1-def30.4%
expm1-log1p31.0%
Simplified31.0%
add-sqr-sqrt26.5%
sqrt-prod32.2%
unpow232.2%
add-sqr-sqrt32.0%
sqrt-unprod31.9%
pow-prod-up31.8%
metadata-eval31.8%
inv-pow31.8%
*-commutative31.8%
associate-/l/31.8%
sqrt-prod25.5%
associate-/l/25.5%
*-commutative25.5%
div-inv25.7%
add-sqr-sqrt25.7%
rem-sqrt-square25.7%
sqrt-div32.2%
unpow232.2%
sqrt-prod26.5%
add-sqr-sqrt51.8%
Applied egg-rr51.8%
if 2.5e-31 < M Initial program 65.2%
Taylor expanded in d around inf 20.1%
expm1-log1p-u19.8%
expm1-udef17.0%
pow1/217.0%
inv-pow17.0%
pow-pow15.7%
metadata-eval15.7%
Applied egg-rr15.7%
expm1-def18.4%
expm1-log1p18.8%
Simplified18.8%
log1p-expm1-u28.1%
Applied egg-rr28.1%
Final simplification45.2%
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (let* ((t_0 (/ d (sqrt (* l h))))) (if (<= M 4.1e-23) (fabs t_0) (log (exp t_0)))))
M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = d / sqrt((l * h));
double tmp;
if (M <= 4.1e-23) {
tmp = fabs(t_0);
} else {
tmp = log(exp(t_0));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = d / sqrt((l * h))
if (m <= 4.1d-23) then
tmp = abs(t_0)
else
tmp = log(exp(t_0))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = d / Math.sqrt((l * h));
double tmp;
if (M <= 4.1e-23) {
tmp = Math.abs(t_0);
} else {
tmp = Math.log(Math.exp(t_0));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = d / math.sqrt((l * h)) tmp = 0 if M <= 4.1e-23: tmp = math.fabs(t_0) else: tmp = math.log(math.exp(t_0)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(d / sqrt(Float64(l * h))) tmp = 0.0 if (M <= 4.1e-23) tmp = abs(t_0); else tmp = log(exp(t_0)); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = d / sqrt((l * h));
tmp = 0.0;
if (M <= 4.1e-23)
tmp = abs(t_0);
else
tmp = log(exp(t_0));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M, 4.1e-23], N[Abs[t$95$0], $MachinePrecision], N[Log[N[Exp[t$95$0], $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \frac{d}{\sqrt{\ell \cdot h}}\\
\mathbf{if}\;M \leq 4.1 \cdot 10^{-23}:\\
\;\;\;\;\left|t_0\right|\\
\mathbf{else}:\\
\;\;\;\;\log \left(e^{t_0}\right)\\
\end{array}
\end{array}
if M < 4.10000000000000029e-23Initial program 66.7%
Taylor expanded in d around inf 31.5%
expm1-log1p-u30.9%
expm1-udef20.4%
pow1/220.4%
inv-pow20.4%
pow-pow20.3%
metadata-eval20.3%
Applied egg-rr20.3%
expm1-def30.9%
expm1-log1p31.4%
Simplified31.4%
add-sqr-sqrt27.0%
sqrt-prod32.5%
unpow232.5%
add-sqr-sqrt32.4%
sqrt-unprod32.2%
pow-prod-up32.2%
metadata-eval32.2%
inv-pow32.2%
*-commutative32.2%
associate-/l/32.2%
sqrt-prod25.5%
associate-/l/25.5%
*-commutative25.5%
div-inv25.8%
add-sqr-sqrt25.8%
rem-sqrt-square25.8%
sqrt-div32.5%
unpow232.5%
sqrt-prod27.1%
add-sqr-sqrt51.7%
Applied egg-rr51.7%
if 4.10000000000000029e-23 < M Initial program 64.6%
Taylor expanded in d around inf 18.3%
expm1-log1p-u18.0%
expm1-udef17.8%
pow1/217.8%
inv-pow17.8%
pow-pow16.4%
metadata-eval16.4%
Applied egg-rr16.4%
expm1-def16.5%
expm1-log1p16.9%
Simplified16.9%
add-sqr-sqrt10.7%
sqrt-prod19.1%
unpow219.1%
add-sqr-sqrt19.0%
sqrt-unprod19.0%
pow-prod-up19.1%
metadata-eval19.1%
inv-pow19.1%
*-commutative19.1%
associate-/l/19.1%
sqrt-prod16.1%
associate-/l/16.1%
*-commutative16.1%
div-inv16.1%
add-log-exp7.5%
sqrt-div7.5%
unpow27.5%
sqrt-prod6.4%
add-sqr-sqrt23.7%
Applied egg-rr23.7%
Final simplification44.4%
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (let* ((t_0 (/ d (sqrt (* l h))))) (if (<= M 1.42e-28) (fabs t_0) (log1p (expm1 t_0)))))
M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = d / sqrt((l * h));
double tmp;
if (M <= 1.42e-28) {
tmp = fabs(t_0);
} else {
tmp = log1p(expm1(t_0));
}
return tmp;
}
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = d / Math.sqrt((l * h));
double tmp;
if (M <= 1.42e-28) {
tmp = Math.abs(t_0);
} else {
tmp = Math.log1p(Math.expm1(t_0));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = d / math.sqrt((l * h)) tmp = 0 if M <= 1.42e-28: tmp = math.fabs(t_0) else: tmp = math.log1p(math.expm1(t_0)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(d / sqrt(Float64(l * h))) tmp = 0.0 if (M <= 1.42e-28) tmp = abs(t_0); else tmp = log1p(expm1(t_0)); end return tmp end
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M, 1.42e-28], N[Abs[t$95$0], $MachinePrecision], N[Log[1 + N[(Exp[t$95$0] - 1), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \frac{d}{\sqrt{\ell \cdot h}}\\
\mathbf{if}\;M \leq 1.42 \cdot 10^{-28}:\\
\;\;\;\;\left|t_0\right|\\
\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(t_0\right)\right)\\
\end{array}
\end{array}
if M < 1.42000000000000001e-28Initial program 66.7%
Taylor expanded in d around inf 30.9%
expm1-log1p-u30.4%
expm1-udef20.7%
pow1/220.7%
inv-pow20.7%
pow-pow20.6%
metadata-eval20.6%
Applied egg-rr20.6%
expm1-def30.3%
expm1-log1p30.8%
Simplified30.8%
add-sqr-sqrt26.4%
sqrt-prod32.0%
unpow232.0%
add-sqr-sqrt31.8%
sqrt-unprod31.7%
pow-prod-up31.7%
metadata-eval31.7%
inv-pow31.7%
*-commutative31.7%
associate-/l/31.7%
sqrt-prod25.3%
associate-/l/25.3%
*-commutative25.3%
div-inv25.6%
add-sqr-sqrt25.6%
rem-sqrt-square25.6%
sqrt-div32.0%
unpow232.0%
sqrt-prod26.4%
add-sqr-sqrt51.5%
Applied egg-rr51.5%
if 1.42000000000000001e-28 < M Initial program 64.7%
Taylor expanded in d around inf 20.4%
expm1-log1p-u20.0%
expm1-udef17.2%
pow1/217.2%
inv-pow17.2%
pow-pow15.8%
metadata-eval15.8%
Applied egg-rr15.8%
expm1-def18.7%
expm1-log1p19.0%
Simplified19.0%
add-sqr-sqrt18.9%
sqrt-unprod20.4%
pow-prod-up20.4%
metadata-eval20.4%
inv-pow20.4%
*-commutative20.4%
associate-/l/20.4%
rem-cbrt-cube23.0%
unpow1/322.6%
expm1-log1p-u10.4%
expm1-udef7.9%
Applied egg-rr9.3%
expm1-def13.5%
expm1-log1p19.0%
Simplified19.0%
log1p-expm1-u27.0%
Applied egg-rr27.0%
Final simplification44.8%
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= D 2.1e+231) (fabs (/ d (sqrt (* l h)))) (* d (sqrt (/ (/ 1.0 h) l)))))
M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (D <= 2.1e+231) {
tmp = fabs((d / sqrt((l * h))));
} else {
tmp = d * sqrt(((1.0 / h) / l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (d_1 <= 2.1d+231) then
tmp = abs((d / sqrt((l * h))))
else
tmp = d * sqrt(((1.0d0 / h) / l))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (D <= 2.1e+231) {
tmp = Math.abs((d / Math.sqrt((l * h))));
} else {
tmp = d * Math.sqrt(((1.0 / h) / l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if D <= 2.1e+231: tmp = math.fabs((d / math.sqrt((l * h)))) else: tmp = d * math.sqrt(((1.0 / h) / l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (D <= 2.1e+231) tmp = abs(Float64(d / sqrt(Float64(l * h)))); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / h) / l))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (D <= 2.1e+231)
tmp = abs((d / sqrt((l * h))));
else
tmp = d * sqrt(((1.0 / h) / l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[D, 2.1e+231], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;D \leq 2.1 \cdot 10^{+231}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\end{array}
\end{array}
if D < 2.09999999999999984e231Initial program 64.9%
Taylor expanded in d around inf 28.8%
expm1-log1p-u28.3%
expm1-udef20.0%
pow1/220.0%
inv-pow20.0%
pow-pow19.5%
metadata-eval19.5%
Applied egg-rr19.5%
expm1-def27.8%
expm1-log1p28.3%
Simplified28.3%
add-sqr-sqrt24.1%
sqrt-prod30.8%
unpow230.8%
add-sqr-sqrt30.6%
sqrt-unprod30.6%
pow-prod-up30.5%
metadata-eval30.5%
inv-pow30.5%
*-commutative30.5%
associate-/l/30.5%
sqrt-prod24.4%
associate-/l/24.4%
*-commutative24.4%
div-inv24.6%
add-sqr-sqrt24.6%
rem-sqrt-square24.6%
sqrt-div30.8%
unpow230.8%
sqrt-prod24.2%
add-sqr-sqrt46.7%
Applied egg-rr46.7%
if 2.09999999999999984e231 < D Initial program 86.6%
Taylor expanded in d around inf 15.5%
add-cbrt-cube28.2%
pow1/328.2%
pow328.2%
associate-/r*28.2%
Applied egg-rr28.2%
Taylor expanded in h around 0 15.5%
associate-/r*15.5%
Simplified15.5%
Final simplification44.9%
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= d 2.3e-236) (* (- d) (pow (* l h) -0.5)) (/ d (* (sqrt h) (sqrt l)))))
M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= 2.3e-236) {
tmp = -d * pow((l * h), -0.5);
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (d <= 2.3d-236) then
tmp = -d * ((l * h) ** (-0.5d0))
else
tmp = d / (sqrt(h) * sqrt(l))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= 2.3e-236) {
tmp = -d * Math.pow((l * h), -0.5);
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if d <= 2.3e-236: tmp = -d * math.pow((l * h), -0.5) else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= 2.3e-236) tmp = Float64(Float64(-d) * (Float64(l * h) ^ -0.5)); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (d <= 2.3e-236)
tmp = -d * ((l * h) ^ -0.5);
else
tmp = d / (sqrt(h) * sqrt(l));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[d, 2.3e-236], N[((-d) * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 2.3 \cdot 10^{-236}:\\
\;\;\;\;\left(-d\right) \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < 2.30000000000000006e-236Initial program 58.3%
Applied egg-rr18.8%
Taylor expanded in d around -inf 40.3%
mul-1-neg40.3%
unpow-140.3%
metadata-eval40.3%
pow-sqr40.3%
rem-sqrt-square40.8%
metadata-eval40.8%
pow-sqr40.7%
fabs-sqr40.7%
pow-sqr40.8%
metadata-eval40.8%
distribute-rgt-neg-in40.8%
Simplified40.8%
if 2.30000000000000006e-236 < d Initial program 76.1%
Taylor expanded in d around inf 48.2%
expm1-log1p-u47.2%
expm1-udef29.5%
pow1/229.5%
inv-pow29.5%
pow-pow30.2%
metadata-eval30.2%
Applied egg-rr30.2%
expm1-def47.9%
expm1-log1p49.0%
Simplified49.0%
add-sqr-sqrt48.8%
sqrt-unprod48.3%
pow-prod-up48.2%
metadata-eval48.2%
inv-pow48.2%
*-commutative48.2%
associate-/l/48.7%
rem-cbrt-cube28.9%
unpow1/328.0%
expm1-log1p-u27.5%
expm1-udef22.2%
Applied egg-rr34.4%
expm1-def46.8%
expm1-log1p49.0%
Simplified49.0%
*-commutative49.0%
sqrt-prod55.7%
Applied egg-rr55.7%
Final simplification47.4%
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= h -6e-283) (* (- d) (pow (* l h) -0.5)) (/ d (sqrt (* l h)))))
M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -6e-283) {
tmp = -d * pow((l * h), -0.5);
} else {
tmp = d / sqrt((l * h));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (h <= (-6d-283)) then
tmp = -d * ((l * h) ** (-0.5d0))
else
tmp = d / sqrt((l * h))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -6e-283) {
tmp = -d * Math.pow((l * h), -0.5);
} else {
tmp = d / Math.sqrt((l * h));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if h <= -6e-283: tmp = -d * math.pow((l * h), -0.5) else: tmp = d / math.sqrt((l * h)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (h <= -6e-283) tmp = Float64(Float64(-d) * (Float64(l * h) ^ -0.5)); else tmp = Float64(d / sqrt(Float64(l * h))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (h <= -6e-283)
tmp = -d * ((l * h) ^ -0.5);
else
tmp = d / sqrt((l * h));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[h, -6e-283], N[((-d) * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -6 \cdot 10^{-283}:\\
\;\;\;\;\left(-d\right) \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\
\end{array}
\end{array}
if h < -5.99999999999999992e-283Initial program 64.8%
Applied egg-rr21.7%
Taylor expanded in d around -inf 44.7%
mul-1-neg44.7%
unpow-144.7%
metadata-eval44.7%
pow-sqr44.8%
rem-sqrt-square45.4%
metadata-eval45.4%
pow-sqr45.2%
fabs-sqr45.2%
pow-sqr45.4%
metadata-eval45.4%
distribute-rgt-neg-in45.4%
Simplified45.4%
if -5.99999999999999992e-283 < h Initial program 67.3%
Taylor expanded in d around inf 43.8%
expm1-log1p-u43.0%
expm1-udef28.4%
pow1/228.4%
inv-pow28.4%
pow-pow28.9%
metadata-eval28.9%
Applied egg-rr28.9%
expm1-def43.6%
expm1-log1p44.5%
Simplified44.5%
add-sqr-sqrt44.3%
sqrt-unprod43.9%
pow-prod-up43.8%
metadata-eval43.8%
inv-pow43.8%
*-commutative43.8%
associate-/l/44.3%
rem-cbrt-cube28.5%
unpow1/327.7%
expm1-log1p-u25.0%
expm1-udef19.9%
Applied egg-rr30.1%
expm1-def41.1%
expm1-log1p44.5%
Simplified44.5%
Final simplification44.9%
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (/ d (sqrt (* l h))))
M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d / sqrt((l * h));
}
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = d / sqrt((l * h))
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
return d / Math.sqrt((l * h));
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): return d / math.sqrt((l * h))
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d / sqrt(Float64(l * h))) end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d / sqrt((l * h));
end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\frac{d}{\sqrt{\ell \cdot h}}
\end{array}
Initial program 66.1%
Taylor expanded in d around inf 28.0%
expm1-log1p-u27.5%
expm1-udef19.7%
pow1/219.7%
inv-pow19.7%
pow-pow19.3%
metadata-eval19.3%
Applied egg-rr19.3%
expm1-def27.1%
expm1-log1p27.6%
Simplified27.6%
add-sqr-sqrt27.5%
sqrt-unprod28.0%
pow-prod-up28.0%
metadata-eval28.0%
inv-pow28.0%
*-commutative28.0%
associate-/l/28.2%
rem-cbrt-cube22.4%
unpow1/322.0%
expm1-log1p-u14.7%
expm1-udef12.0%
Applied egg-rr17.5%
expm1-def23.3%
expm1-log1p27.6%
Simplified27.6%
Final simplification27.6%
herbie shell --seed 2023306
(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)))))