
(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}
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (sqrt (- d))) (t_1 (* D (/ M_m d))) (t_2 (pow t_1 2.0)))
(if (<= d -1e-309)
(*
(/ t_0 (sqrt (- h)))
(* (/ t_0 (sqrt (- l))) (+ (* h (* -0.125 (/ t_2 l))) 1.0)))
(if (<= d 2.2e-149)
(* d (fma -0.125 (* t_2 (sqrt (/ h (pow l 3.0)))) (pow (* h l) -0.5)))
(*
(* (sqrt d) (sqrt (/ 1.0 h)))
(*
(sqrt (/ d l))
(+ 1.0 (* h (* -0.125 (* t_1 (* t_1 (/ 1.0 l))))))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = sqrt(-d);
double t_1 = D * (M_m / d);
double t_2 = pow(t_1, 2.0);
double tmp;
if (d <= -1e-309) {
tmp = (t_0 / sqrt(-h)) * ((t_0 / sqrt(-l)) * ((h * (-0.125 * (t_2 / l))) + 1.0));
} else if (d <= 2.2e-149) {
tmp = d * fma(-0.125, (t_2 * sqrt((h / pow(l, 3.0)))), pow((h * l), -0.5));
} else {
tmp = (sqrt(d) * sqrt((1.0 / h))) * (sqrt((d / l)) * (1.0 + (h * (-0.125 * (t_1 * (t_1 * (1.0 / l)))))));
}
return tmp;
}
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = sqrt(Float64(-d)) t_1 = Float64(D * Float64(M_m / d)) t_2 = t_1 ^ 2.0 tmp = 0.0 if (d <= -1e-309) tmp = Float64(Float64(t_0 / sqrt(Float64(-h))) * Float64(Float64(t_0 / sqrt(Float64(-l))) * Float64(Float64(h * Float64(-0.125 * Float64(t_2 / l))) + 1.0))); elseif (d <= 2.2e-149) tmp = Float64(d * fma(-0.125, Float64(t_2 * sqrt(Float64(h / (l ^ 3.0)))), (Float64(h * l) ^ -0.5))); else tmp = Float64(Float64(sqrt(d) * sqrt(Float64(1.0 / h))) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(h * Float64(-0.125 * Float64(t_1 * Float64(t_1 * Float64(1.0 / l)))))))); end return tmp end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$1 = N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[t$95$1, 2.0], $MachinePrecision]}, If[LessEqual[d, -1e-309], N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(N[(h * N[(-0.125 * N[(t$95$2 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.2e-149], N[(d * N[(-0.125 * N[(t$95$2 * N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] * N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(h * N[(-0.125 * N[(t$95$1 * N[(t$95$1 * N[(1.0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
t_1 := D \cdot \frac{M\_m}{d}\\
t_2 := {t\_1}^{2}\\
\mathbf{if}\;d \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\frac{t\_0}{\sqrt{-h}} \cdot \left(\frac{t\_0}{\sqrt{-\ell}} \cdot \left(h \cdot \left(-0.125 \cdot \frac{t\_2}{\ell}\right) + 1\right)\right)\\
\mathbf{elif}\;d \leq 2.2 \cdot 10^{-149}:\\
\;\;\;\;d \cdot \mathsf{fma}\left(-0.125, t\_2 \cdot \sqrt{\frac{h}{{\ell}^{3}}}, {\left(h \cdot \ell\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{d} \cdot \sqrt{\frac{1}{h}}\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \left(-0.125 \cdot \left(t\_1 \cdot \left(t\_1 \cdot \frac{1}{\ell}\right)\right)\right)\right)\right)\\
\end{array}
\end{array}
if d < -1.000000000000002e-309Initial program 62.1%
Simplified62.1%
Taylor expanded in h around -inf 47.2%
associate-*r*47.2%
neg-mul-147.2%
sub-neg47.2%
distribute-lft-in47.2%
Simplified65.1%
pow165.1%
associate-*r/65.0%
Applied egg-rr65.0%
unpow165.0%
distribute-lft-neg-in65.0%
distribute-rgt-neg-in65.0%
associate-/l*65.1%
distribute-lft-neg-in65.1%
metadata-eval65.1%
associate-*r/65.0%
*-commutative65.0%
associate-/l*65.1%
Simplified65.1%
frac-2neg65.1%
sqrt-div71.7%
Applied egg-rr71.7%
frac-2neg71.7%
sqrt-div90.9%
Applied egg-rr90.9%
if -1.000000000000002e-309 < d < 2.1999999999999998e-149Initial program 30.9%
Simplified27.4%
frac-2neg27.6%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in d around inf 37.0%
+-commutative37.0%
fma-define37.0%
*-commutative37.0%
*-commutative37.0%
associate-/l*37.2%
unpow237.2%
unpow237.2%
unpow237.2%
times-frac55.6%
swap-sqr66.6%
unpow266.6%
associate-*r/66.5%
*-commutative66.5%
associate-/l*63.1%
unpow-163.1%
Simplified63.1%
if 2.1999999999999998e-149 < d Initial program 74.5%
Simplified74.6%
Taylor expanded in h around -inf 49.4%
associate-*r*49.4%
neg-mul-149.4%
sub-neg49.4%
distribute-lft-in49.3%
Simplified77.5%
pow177.5%
associate-*r/77.5%
Applied egg-rr77.5%
unpow177.5%
distribute-lft-neg-in77.5%
distribute-rgt-neg-in77.5%
associate-/l*77.5%
distribute-lft-neg-in77.5%
metadata-eval77.5%
associate-*r/77.5%
*-commutative77.5%
associate-/l*76.5%
Simplified76.5%
div-inv76.5%
unpow276.5%
associate-*l*78.4%
Applied egg-rr78.4%
pow1/278.4%
div-inv78.3%
unpow-prod-down87.5%
pow1/287.5%
Applied egg-rr87.5%
unpow1/287.5%
Simplified87.5%
Final simplification86.6%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (sqrt (- d)))
(t_1 (* D (/ M_m d)))
(t_2
(*
(sqrt (/ d l))
(+ 1.0 (* h (* -0.125 (* t_1 (* t_1 (/ 1.0 l)))))))))
(if (<= l -8.5e+97)
(*
(sqrt (/ d h))
(* (/ t_0 (sqrt (- l))) (+ 1.0 (* h (* -0.125 (* t_1 (/ t_1 l)))))))
(if (<= l -5e-311)
(* (/ t_0 (sqrt (- h))) t_2)
(* (* (sqrt d) (sqrt (/ 1.0 h))) t_2)))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = sqrt(-d);
double t_1 = D * (M_m / d);
double t_2 = sqrt((d / l)) * (1.0 + (h * (-0.125 * (t_1 * (t_1 * (1.0 / l))))));
double tmp;
if (l <= -8.5e+97) {
tmp = sqrt((d / h)) * ((t_0 / sqrt(-l)) * (1.0 + (h * (-0.125 * (t_1 * (t_1 / l))))));
} else if (l <= -5e-311) {
tmp = (t_0 / sqrt(-h)) * t_2;
} else {
tmp = (sqrt(d) * sqrt((1.0 / h))) * t_2;
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = sqrt(-d)
t_1 = d_1 * (m_m / d)
t_2 = sqrt((d / l)) * (1.0d0 + (h * ((-0.125d0) * (t_1 * (t_1 * (1.0d0 / l))))))
if (l <= (-8.5d+97)) then
tmp = sqrt((d / h)) * ((t_0 / sqrt(-l)) * (1.0d0 + (h * ((-0.125d0) * (t_1 * (t_1 / l))))))
else if (l <= (-5d-311)) then
tmp = (t_0 / sqrt(-h)) * t_2
else
tmp = (sqrt(d) * sqrt((1.0d0 / h))) * t_2
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = Math.sqrt(-d);
double t_1 = D * (M_m / d);
double t_2 = Math.sqrt((d / l)) * (1.0 + (h * (-0.125 * (t_1 * (t_1 * (1.0 / l))))));
double tmp;
if (l <= -8.5e+97) {
tmp = Math.sqrt((d / h)) * ((t_0 / Math.sqrt(-l)) * (1.0 + (h * (-0.125 * (t_1 * (t_1 / l))))));
} else if (l <= -5e-311) {
tmp = (t_0 / Math.sqrt(-h)) * t_2;
} else {
tmp = (Math.sqrt(d) * Math.sqrt((1.0 / h))) * t_2;
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = math.sqrt(-d) t_1 = D * (M_m / d) t_2 = math.sqrt((d / l)) * (1.0 + (h * (-0.125 * (t_1 * (t_1 * (1.0 / l)))))) tmp = 0 if l <= -8.5e+97: tmp = math.sqrt((d / h)) * ((t_0 / math.sqrt(-l)) * (1.0 + (h * (-0.125 * (t_1 * (t_1 / l)))))) elif l <= -5e-311: tmp = (t_0 / math.sqrt(-h)) * t_2 else: tmp = (math.sqrt(d) * math.sqrt((1.0 / h))) * t_2 return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = sqrt(Float64(-d)) t_1 = Float64(D * Float64(M_m / d)) t_2 = Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(h * Float64(-0.125 * Float64(t_1 * Float64(t_1 * Float64(1.0 / l))))))) tmp = 0.0 if (l <= -8.5e+97) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(t_0 / sqrt(Float64(-l))) * Float64(1.0 + Float64(h * Float64(-0.125 * Float64(t_1 * Float64(t_1 / l))))))); elseif (l <= -5e-311) tmp = Float64(Float64(t_0 / sqrt(Float64(-h))) * t_2); else tmp = Float64(Float64(sqrt(d) * sqrt(Float64(1.0 / h))) * t_2); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = sqrt(-d);
t_1 = D * (M_m / d);
t_2 = sqrt((d / l)) * (1.0 + (h * (-0.125 * (t_1 * (t_1 * (1.0 / l))))));
tmp = 0.0;
if (l <= -8.5e+97)
tmp = sqrt((d / h)) * ((t_0 / sqrt(-l)) * (1.0 + (h * (-0.125 * (t_1 * (t_1 / l))))));
elseif (l <= -5e-311)
tmp = (t_0 / sqrt(-h)) * t_2;
else
tmp = (sqrt(d) * sqrt((1.0 / h))) * t_2;
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$1 = N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(h * N[(-0.125 * N[(t$95$1 * N[(t$95$1 * N[(1.0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -8.5e+97], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(h * N[(-0.125 * N[(t$95$1 * N[(t$95$1 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-311], N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] * N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
t_1 := D \cdot \frac{M\_m}{d}\\
t_2 := \sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \left(-0.125 \cdot \left(t\_1 \cdot \left(t\_1 \cdot \frac{1}{\ell}\right)\right)\right)\right)\\
\mathbf{if}\;\ell \leq -8.5 \cdot 10^{+97}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{t\_0}{\sqrt{-\ell}} \cdot \left(1 + h \cdot \left(-0.125 \cdot \left(t\_1 \cdot \frac{t\_1}{\ell}\right)\right)\right)\right)\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\frac{t\_0}{\sqrt{-h}} \cdot t\_2\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{d} \cdot \sqrt{\frac{1}{h}}\right) \cdot t\_2\\
\end{array}
\end{array}
if l < -8.4999999999999993e97Initial program 68.3%
Simplified68.3%
Taylor expanded in h around -inf 58.3%
associate-*r*58.3%
neg-mul-158.3%
sub-neg58.3%
distribute-lft-in58.3%
Simplified68.4%
pow168.4%
associate-*r/68.4%
Applied egg-rr68.4%
unpow168.4%
distribute-lft-neg-in68.4%
distribute-rgt-neg-in68.4%
associate-/l*68.4%
distribute-lft-neg-in68.4%
metadata-eval68.4%
associate-*r/68.4%
*-commutative68.4%
associate-/l*68.4%
Simplified68.4%
frac-2neg68.4%
sqrt-div78.0%
Applied egg-rr78.0%
unpow278.0%
associate-/l*79.9%
Applied egg-rr79.9%
if -8.4999999999999993e97 < l < -5.00000000000023e-311Initial program 58.1%
Simplified58.1%
Taylor expanded in h around -inf 39.9%
associate-*r*39.9%
neg-mul-139.9%
sub-neg39.9%
distribute-lft-in39.9%
Simplified62.9%
pow162.9%
associate-*r/62.8%
Applied egg-rr62.8%
unpow162.8%
distribute-lft-neg-in62.8%
distribute-rgt-neg-in62.8%
associate-/l*62.9%
distribute-lft-neg-in62.9%
metadata-eval62.9%
associate-*r/62.9%
*-commutative62.9%
associate-/l*62.9%
Simplified62.9%
div-inv62.9%
unpow262.9%
associate-*l*63.1%
Applied egg-rr63.1%
frac-2neg67.7%
sqrt-div95.4%
Applied egg-rr91.2%
if -5.00000000000023e-311 < l Initial program 65.4%
Simplified65.4%
Taylor expanded in h around -inf 43.0%
associate-*r*43.0%
neg-mul-143.0%
sub-neg43.0%
distribute-lft-in43.0%
Simplified67.0%
pow167.0%
associate-*r/67.0%
Applied egg-rr67.0%
unpow167.0%
distribute-lft-neg-in67.0%
distribute-rgt-neg-in67.0%
associate-/l*67.0%
distribute-lft-neg-in67.0%
metadata-eval67.0%
associate-*r/67.0%
*-commutative67.0%
associate-/l*66.3%
Simplified66.3%
div-inv66.3%
unpow266.3%
associate-*l*67.8%
Applied egg-rr67.8%
pow1/267.8%
div-inv67.8%
unpow-prod-down79.7%
pow1/279.7%
Applied egg-rr79.7%
unpow1/279.7%
Simplified79.7%
Final simplification83.2%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (* D (/ M_m d))))
(if (<= h -3e-227)
(*
(sqrt (/ d h))
(*
(/ (sqrt (- d)) (sqrt (- l)))
(+ 1.0 (* h (* -0.125 (* t_0 (/ t_0 l)))))))
(if (<= h -5e-310)
(* d (- (sqrt (/ (/ 1.0 l) h))))
(*
(* (sqrt d) (sqrt (/ 1.0 h)))
(*
(sqrt (/ d l))
(+ 1.0 (* h (* -0.125 (* t_0 (* t_0 (/ 1.0 l))))))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = D * (M_m / d);
double tmp;
if (h <= -3e-227) {
tmp = sqrt((d / h)) * ((sqrt(-d) / sqrt(-l)) * (1.0 + (h * (-0.125 * (t_0 * (t_0 / l))))));
} else if (h <= -5e-310) {
tmp = d * -sqrt(((1.0 / l) / h));
} else {
tmp = (sqrt(d) * sqrt((1.0 / h))) * (sqrt((d / l)) * (1.0 + (h * (-0.125 * (t_0 * (t_0 * (1.0 / l)))))));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = d_1 * (m_m / d)
if (h <= (-3d-227)) then
tmp = sqrt((d / h)) * ((sqrt(-d) / sqrt(-l)) * (1.0d0 + (h * ((-0.125d0) * (t_0 * (t_0 / l))))))
else if (h <= (-5d-310)) then
tmp = d * -sqrt(((1.0d0 / l) / h))
else
tmp = (sqrt(d) * sqrt((1.0d0 / h))) * (sqrt((d / l)) * (1.0d0 + (h * ((-0.125d0) * (t_0 * (t_0 * (1.0d0 / l)))))))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = D * (M_m / d);
double tmp;
if (h <= -3e-227) {
tmp = Math.sqrt((d / h)) * ((Math.sqrt(-d) / Math.sqrt(-l)) * (1.0 + (h * (-0.125 * (t_0 * (t_0 / l))))));
} else if (h <= -5e-310) {
tmp = d * -Math.sqrt(((1.0 / l) / h));
} else {
tmp = (Math.sqrt(d) * Math.sqrt((1.0 / h))) * (Math.sqrt((d / l)) * (1.0 + (h * (-0.125 * (t_0 * (t_0 * (1.0 / l)))))));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = D * (M_m / d) tmp = 0 if h <= -3e-227: tmp = math.sqrt((d / h)) * ((math.sqrt(-d) / math.sqrt(-l)) * (1.0 + (h * (-0.125 * (t_0 * (t_0 / l)))))) elif h <= -5e-310: tmp = d * -math.sqrt(((1.0 / l) / h)) else: tmp = (math.sqrt(d) * math.sqrt((1.0 / h))) * (math.sqrt((d / l)) * (1.0 + (h * (-0.125 * (t_0 * (t_0 * (1.0 / l))))))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(D * Float64(M_m / d)) tmp = 0.0 if (h <= -3e-227) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * Float64(1.0 + Float64(h * Float64(-0.125 * Float64(t_0 * Float64(t_0 / l))))))); elseif (h <= -5e-310) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / l) / h)))); else tmp = Float64(Float64(sqrt(d) * sqrt(Float64(1.0 / h))) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(h * Float64(-0.125 * Float64(t_0 * Float64(t_0 * Float64(1.0 / l)))))))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = D * (M_m / d);
tmp = 0.0;
if (h <= -3e-227)
tmp = sqrt((d / h)) * ((sqrt(-d) / sqrt(-l)) * (1.0 + (h * (-0.125 * (t_0 * (t_0 / l))))));
elseif (h <= -5e-310)
tmp = d * -sqrt(((1.0 / l) / h));
else
tmp = (sqrt(d) * sqrt((1.0 / h))) * (sqrt((d / l)) * (1.0 + (h * (-0.125 * (t_0 * (t_0 * (1.0 / l)))))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -3e-227], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(h * N[(-0.125 * N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -5e-310], N[(d * (-N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] * N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(h * N[(-0.125 * N[(t$95$0 * N[(t$95$0 * N[(1.0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := D \cdot \frac{M\_m}{d}\\
\mathbf{if}\;h \leq -3 \cdot 10^{-227}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \left(1 + h \cdot \left(-0.125 \cdot \left(t\_0 \cdot \frac{t\_0}{\ell}\right)\right)\right)\right)\\
\mathbf{elif}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{d} \cdot \sqrt{\frac{1}{h}}\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \left(-0.125 \cdot \left(t\_0 \cdot \left(t\_0 \cdot \frac{1}{\ell}\right)\right)\right)\right)\right)\\
\end{array}
\end{array}
if h < -3e-227Initial program 64.3%
Simplified64.3%
Taylor expanded in h around -inf 49.1%
associate-*r*49.1%
neg-mul-149.1%
sub-neg49.1%
distribute-lft-in49.1%
Simplified67.6%
pow167.6%
associate-*r/67.6%
Applied egg-rr67.6%
unpow167.6%
distribute-lft-neg-in67.6%
distribute-rgt-neg-in67.6%
associate-/l*67.6%
distribute-lft-neg-in67.6%
metadata-eval67.6%
associate-*r/67.6%
*-commutative67.6%
associate-/l*67.6%
Simplified67.6%
frac-2neg67.6%
sqrt-div74.4%
Applied egg-rr74.4%
unpow274.4%
associate-/l*75.4%
Applied egg-rr75.4%
if -3e-227 < h < -4.999999999999985e-310Initial program 47.2%
Simplified47.1%
frac-2neg47.1%
sqrt-div53.2%
Applied egg-rr52.9%
Taylor expanded in d around inf 1.2%
unpow-11.2%
metadata-eval1.2%
pow-sqr1.2%
rem-sqrt-square1.2%
rem-square-sqrt1.2%
fabs-sqr1.2%
rem-square-sqrt1.2%
Simplified1.2%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
associate-/l/0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt87.7%
neg-mul-187.7%
Simplified87.7%
if -4.999999999999985e-310 < h Initial program 65.4%
Simplified65.4%
Taylor expanded in h around -inf 43.0%
associate-*r*43.0%
neg-mul-143.0%
sub-neg43.0%
distribute-lft-in43.0%
Simplified67.0%
pow167.0%
associate-*r/67.0%
Applied egg-rr67.0%
unpow167.0%
distribute-lft-neg-in67.0%
distribute-rgt-neg-in67.0%
associate-/l*67.0%
distribute-lft-neg-in67.0%
metadata-eval67.0%
associate-*r/67.0%
*-commutative67.0%
associate-/l*66.3%
Simplified66.3%
div-inv66.3%
unpow266.3%
associate-*l*67.8%
Applied egg-rr67.8%
pow1/267.8%
div-inv67.8%
unpow-prod-down79.7%
pow1/279.7%
Applied egg-rr79.7%
unpow1/279.7%
Simplified79.7%
Final simplification78.3%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (* D (/ M_m d))))
(if (<= h -3e-227)
(*
(sqrt (/ d h))
(*
(/ (sqrt (- d)) (sqrt (- l)))
(+ 1.0 (* h (* -0.125 (* t_0 (/ t_0 l)))))))
(if (<= h -5e-310)
(* d (- (sqrt (/ (/ 1.0 l) h))))
(*
(* (sqrt (/ d l)) (+ 1.0 (* h (* -0.125 (* t_0 (* t_0 (/ 1.0 l)))))))
(/ (sqrt d) (sqrt h)))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = D * (M_m / d);
double tmp;
if (h <= -3e-227) {
tmp = sqrt((d / h)) * ((sqrt(-d) / sqrt(-l)) * (1.0 + (h * (-0.125 * (t_0 * (t_0 / l))))));
} else if (h <= -5e-310) {
tmp = d * -sqrt(((1.0 / l) / h));
} else {
tmp = (sqrt((d / l)) * (1.0 + (h * (-0.125 * (t_0 * (t_0 * (1.0 / l))))))) * (sqrt(d) / sqrt(h));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = d_1 * (m_m / d)
if (h <= (-3d-227)) then
tmp = sqrt((d / h)) * ((sqrt(-d) / sqrt(-l)) * (1.0d0 + (h * ((-0.125d0) * (t_0 * (t_0 / l))))))
else if (h <= (-5d-310)) then
tmp = d * -sqrt(((1.0d0 / l) / h))
else
tmp = (sqrt((d / l)) * (1.0d0 + (h * ((-0.125d0) * (t_0 * (t_0 * (1.0d0 / l))))))) * (sqrt(d) / sqrt(h))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = D * (M_m / d);
double tmp;
if (h <= -3e-227) {
tmp = Math.sqrt((d / h)) * ((Math.sqrt(-d) / Math.sqrt(-l)) * (1.0 + (h * (-0.125 * (t_0 * (t_0 / l))))));
} else if (h <= -5e-310) {
tmp = d * -Math.sqrt(((1.0 / l) / h));
} else {
tmp = (Math.sqrt((d / l)) * (1.0 + (h * (-0.125 * (t_0 * (t_0 * (1.0 / l))))))) * (Math.sqrt(d) / Math.sqrt(h));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = D * (M_m / d) tmp = 0 if h <= -3e-227: tmp = math.sqrt((d / h)) * ((math.sqrt(-d) / math.sqrt(-l)) * (1.0 + (h * (-0.125 * (t_0 * (t_0 / l)))))) elif h <= -5e-310: tmp = d * -math.sqrt(((1.0 / l) / h)) else: tmp = (math.sqrt((d / l)) * (1.0 + (h * (-0.125 * (t_0 * (t_0 * (1.0 / l))))))) * (math.sqrt(d) / math.sqrt(h)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(D * Float64(M_m / d)) tmp = 0.0 if (h <= -3e-227) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * Float64(1.0 + Float64(h * Float64(-0.125 * Float64(t_0 * Float64(t_0 / l))))))); elseif (h <= -5e-310) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / l) / h)))); else tmp = Float64(Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(h * Float64(-0.125 * Float64(t_0 * Float64(t_0 * Float64(1.0 / l))))))) * Float64(sqrt(d) / sqrt(h))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = D * (M_m / d);
tmp = 0.0;
if (h <= -3e-227)
tmp = sqrt((d / h)) * ((sqrt(-d) / sqrt(-l)) * (1.0 + (h * (-0.125 * (t_0 * (t_0 / l))))));
elseif (h <= -5e-310)
tmp = d * -sqrt(((1.0 / l) / h));
else
tmp = (sqrt((d / l)) * (1.0 + (h * (-0.125 * (t_0 * (t_0 * (1.0 / l))))))) * (sqrt(d) / sqrt(h));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -3e-227], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(h * N[(-0.125 * N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -5e-310], N[(d * (-N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(h * N[(-0.125 * N[(t$95$0 * N[(t$95$0 * N[(1.0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := D \cdot \frac{M\_m}{d}\\
\mathbf{if}\;h \leq -3 \cdot 10^{-227}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \left(1 + h \cdot \left(-0.125 \cdot \left(t\_0 \cdot \frac{t\_0}{\ell}\right)\right)\right)\right)\\
\mathbf{elif}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \left(-0.125 \cdot \left(t\_0 \cdot \left(t\_0 \cdot \frac{1}{\ell}\right)\right)\right)\right)\right) \cdot \frac{\sqrt{d}}{\sqrt{h}}\\
\end{array}
\end{array}
if h < -3e-227Initial program 64.3%
Simplified64.3%
Taylor expanded in h around -inf 49.1%
associate-*r*49.1%
neg-mul-149.1%
sub-neg49.1%
distribute-lft-in49.1%
Simplified67.6%
pow167.6%
associate-*r/67.6%
Applied egg-rr67.6%
unpow167.6%
distribute-lft-neg-in67.6%
distribute-rgt-neg-in67.6%
associate-/l*67.6%
distribute-lft-neg-in67.6%
metadata-eval67.6%
associate-*r/67.6%
*-commutative67.6%
associate-/l*67.6%
Simplified67.6%
frac-2neg67.6%
sqrt-div74.4%
Applied egg-rr74.4%
unpow274.4%
associate-/l*75.4%
Applied egg-rr75.4%
if -3e-227 < h < -4.999999999999985e-310Initial program 47.2%
Simplified47.1%
frac-2neg47.1%
sqrt-div53.2%
Applied egg-rr52.9%
Taylor expanded in d around inf 1.2%
unpow-11.2%
metadata-eval1.2%
pow-sqr1.2%
rem-sqrt-square1.2%
rem-square-sqrt1.2%
fabs-sqr1.2%
rem-square-sqrt1.2%
Simplified1.2%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
associate-/l/0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt87.7%
neg-mul-187.7%
Simplified87.7%
if -4.999999999999985e-310 < h Initial program 65.4%
Simplified65.4%
Taylor expanded in h around -inf 43.0%
associate-*r*43.0%
neg-mul-143.0%
sub-neg43.0%
distribute-lft-in43.0%
Simplified67.0%
pow167.0%
associate-*r/67.0%
Applied egg-rr67.0%
unpow167.0%
distribute-lft-neg-in67.0%
distribute-rgt-neg-in67.0%
associate-/l*67.0%
distribute-lft-neg-in67.0%
metadata-eval67.0%
associate-*r/67.0%
*-commutative67.0%
associate-/l*66.3%
Simplified66.3%
div-inv66.3%
unpow266.3%
associate-*l*67.8%
Applied egg-rr67.8%
sqrt-div79.5%
Applied egg-rr79.5%
Final simplification78.2%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (sqrt (/ d h))) (t_1 (* D (/ M_m d))))
(if (<= h -3e-227)
(*
t_0
(*
(/ (sqrt (- d)) (sqrt (- l)))
(+ 1.0 (* h (* -0.125 (* t_1 (/ t_1 l)))))))
(if (<= h -5e-310)
(* d (- (sqrt (/ (/ 1.0 l) h))))
(*
t_0
(*
(+ 1.0 (* h (* -0.125 (* t_1 (* t_1 (/ 1.0 l))))))
(/ (sqrt d) (sqrt l))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = sqrt((d / h));
double t_1 = D * (M_m / d);
double tmp;
if (h <= -3e-227) {
tmp = t_0 * ((sqrt(-d) / sqrt(-l)) * (1.0 + (h * (-0.125 * (t_1 * (t_1 / l))))));
} else if (h <= -5e-310) {
tmp = d * -sqrt(((1.0 / l) / h));
} else {
tmp = t_0 * ((1.0 + (h * (-0.125 * (t_1 * (t_1 * (1.0 / l)))))) * (sqrt(d) / sqrt(l)));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt((d / h))
t_1 = d_1 * (m_m / d)
if (h <= (-3d-227)) then
tmp = t_0 * ((sqrt(-d) / sqrt(-l)) * (1.0d0 + (h * ((-0.125d0) * (t_1 * (t_1 / l))))))
else if (h <= (-5d-310)) then
tmp = d * -sqrt(((1.0d0 / l) / h))
else
tmp = t_0 * ((1.0d0 + (h * ((-0.125d0) * (t_1 * (t_1 * (1.0d0 / l)))))) * (sqrt(d) / sqrt(l)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = Math.sqrt((d / h));
double t_1 = D * (M_m / d);
double tmp;
if (h <= -3e-227) {
tmp = t_0 * ((Math.sqrt(-d) / Math.sqrt(-l)) * (1.0 + (h * (-0.125 * (t_1 * (t_1 / l))))));
} else if (h <= -5e-310) {
tmp = d * -Math.sqrt(((1.0 / l) / h));
} else {
tmp = t_0 * ((1.0 + (h * (-0.125 * (t_1 * (t_1 * (1.0 / l)))))) * (Math.sqrt(d) / Math.sqrt(l)));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = math.sqrt((d / h)) t_1 = D * (M_m / d) tmp = 0 if h <= -3e-227: tmp = t_0 * ((math.sqrt(-d) / math.sqrt(-l)) * (1.0 + (h * (-0.125 * (t_1 * (t_1 / l)))))) elif h <= -5e-310: tmp = d * -math.sqrt(((1.0 / l) / h)) else: tmp = t_0 * ((1.0 + (h * (-0.125 * (t_1 * (t_1 * (1.0 / l)))))) * (math.sqrt(d) / math.sqrt(l))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = sqrt(Float64(d / h)) t_1 = Float64(D * Float64(M_m / d)) tmp = 0.0 if (h <= -3e-227) tmp = Float64(t_0 * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * Float64(1.0 + Float64(h * Float64(-0.125 * Float64(t_1 * Float64(t_1 / l))))))); elseif (h <= -5e-310) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / l) / h)))); else tmp = Float64(t_0 * Float64(Float64(1.0 + Float64(h * Float64(-0.125 * Float64(t_1 * Float64(t_1 * Float64(1.0 / l)))))) * Float64(sqrt(d) / sqrt(l)))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = sqrt((d / h));
t_1 = D * (M_m / d);
tmp = 0.0;
if (h <= -3e-227)
tmp = t_0 * ((sqrt(-d) / sqrt(-l)) * (1.0 + (h * (-0.125 * (t_1 * (t_1 / l))))));
elseif (h <= -5e-310)
tmp = d * -sqrt(((1.0 / l) / h));
else
tmp = t_0 * ((1.0 + (h * (-0.125 * (t_1 * (t_1 * (1.0 / l)))))) * (sqrt(d) / sqrt(l)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -3e-227], N[(t$95$0 * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(h * N[(-0.125 * N[(t$95$1 * N[(t$95$1 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -5e-310], N[(d * (-N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(t$95$0 * N[(N[(1.0 + N[(h * N[(-0.125 * N[(t$95$1 * N[(t$95$1 * N[(1.0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := D \cdot \frac{M\_m}{d}\\
\mathbf{if}\;h \leq -3 \cdot 10^{-227}:\\
\;\;\;\;t\_0 \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \left(1 + h \cdot \left(-0.125 \cdot \left(t\_1 \cdot \frac{t\_1}{\ell}\right)\right)\right)\right)\\
\mathbf{elif}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(\left(1 + h \cdot \left(-0.125 \cdot \left(t\_1 \cdot \left(t\_1 \cdot \frac{1}{\ell}\right)\right)\right)\right) \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\
\end{array}
\end{array}
if h < -3e-227Initial program 64.3%
Simplified64.3%
Taylor expanded in h around -inf 49.1%
associate-*r*49.1%
neg-mul-149.1%
sub-neg49.1%
distribute-lft-in49.1%
Simplified67.6%
pow167.6%
associate-*r/67.6%
Applied egg-rr67.6%
unpow167.6%
distribute-lft-neg-in67.6%
distribute-rgt-neg-in67.6%
associate-/l*67.6%
distribute-lft-neg-in67.6%
metadata-eval67.6%
associate-*r/67.6%
*-commutative67.6%
associate-/l*67.6%
Simplified67.6%
frac-2neg67.6%
sqrt-div74.4%
Applied egg-rr74.4%
unpow274.4%
associate-/l*75.4%
Applied egg-rr75.4%
if -3e-227 < h < -4.999999999999985e-310Initial program 47.2%
Simplified47.1%
frac-2neg47.1%
sqrt-div53.2%
Applied egg-rr52.9%
Taylor expanded in d around inf 1.2%
unpow-11.2%
metadata-eval1.2%
pow-sqr1.2%
rem-sqrt-square1.2%
rem-square-sqrt1.2%
fabs-sqr1.2%
rem-square-sqrt1.2%
Simplified1.2%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
associate-/l/0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt87.7%
neg-mul-187.7%
Simplified87.7%
if -4.999999999999985e-310 < h Initial program 65.4%
Simplified65.4%
Taylor expanded in h around -inf 43.0%
associate-*r*43.0%
neg-mul-143.0%
sub-neg43.0%
distribute-lft-in43.0%
Simplified67.0%
pow167.0%
associate-*r/67.0%
Applied egg-rr67.0%
unpow167.0%
distribute-lft-neg-in67.0%
distribute-rgt-neg-in67.0%
associate-/l*67.0%
distribute-lft-neg-in67.0%
metadata-eval67.0%
associate-*r/67.0%
*-commutative67.0%
associate-/l*66.3%
Simplified66.3%
div-inv66.3%
unpow266.3%
associate-*l*67.8%
Applied egg-rr67.8%
sqrt-div77.2%
Applied egg-rr77.2%
Final simplification77.1%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (* D (/ M_m d)))
(t_1 (sqrt (/ d h)))
(t_2 (+ 1.0 (* h (* -0.125 (* t_0 (* t_0 (/ 1.0 l))))))))
(if (<= d -8e-203)
(* (* (sqrt (/ d l)) t_2) t_1)
(if (<= d -5.5e-303)
(*
-0.125
(* (* D D) (* (sqrt (/ h (pow l 3.0))) (/ (pow M_m 2.0) (- d)))))
(* t_1 (* t_2 (/ (sqrt d) (sqrt l))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = D * (M_m / d);
double t_1 = sqrt((d / h));
double t_2 = 1.0 + (h * (-0.125 * (t_0 * (t_0 * (1.0 / l)))));
double tmp;
if (d <= -8e-203) {
tmp = (sqrt((d / l)) * t_2) * t_1;
} else if (d <= -5.5e-303) {
tmp = -0.125 * ((D * D) * (sqrt((h / pow(l, 3.0))) * (pow(M_m, 2.0) / -d)));
} else {
tmp = t_1 * (t_2 * (sqrt(d) / sqrt(l)));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = d_1 * (m_m / d)
t_1 = sqrt((d / h))
t_2 = 1.0d0 + (h * ((-0.125d0) * (t_0 * (t_0 * (1.0d0 / l)))))
if (d <= (-8d-203)) then
tmp = (sqrt((d / l)) * t_2) * t_1
else if (d <= (-5.5d-303)) then
tmp = (-0.125d0) * ((d_1 * d_1) * (sqrt((h / (l ** 3.0d0))) * ((m_m ** 2.0d0) / -d)))
else
tmp = t_1 * (t_2 * (sqrt(d) / sqrt(l)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = D * (M_m / d);
double t_1 = Math.sqrt((d / h));
double t_2 = 1.0 + (h * (-0.125 * (t_0 * (t_0 * (1.0 / l)))));
double tmp;
if (d <= -8e-203) {
tmp = (Math.sqrt((d / l)) * t_2) * t_1;
} else if (d <= -5.5e-303) {
tmp = -0.125 * ((D * D) * (Math.sqrt((h / Math.pow(l, 3.0))) * (Math.pow(M_m, 2.0) / -d)));
} else {
tmp = t_1 * (t_2 * (Math.sqrt(d) / Math.sqrt(l)));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = D * (M_m / d) t_1 = math.sqrt((d / h)) t_2 = 1.0 + (h * (-0.125 * (t_0 * (t_0 * (1.0 / l))))) tmp = 0 if d <= -8e-203: tmp = (math.sqrt((d / l)) * t_2) * t_1 elif d <= -5.5e-303: tmp = -0.125 * ((D * D) * (math.sqrt((h / math.pow(l, 3.0))) * (math.pow(M_m, 2.0) / -d))) else: tmp = t_1 * (t_2 * (math.sqrt(d) / math.sqrt(l))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(D * Float64(M_m / d)) t_1 = sqrt(Float64(d / h)) t_2 = Float64(1.0 + Float64(h * Float64(-0.125 * Float64(t_0 * Float64(t_0 * Float64(1.0 / l)))))) tmp = 0.0 if (d <= -8e-203) tmp = Float64(Float64(sqrt(Float64(d / l)) * t_2) * t_1); elseif (d <= -5.5e-303) tmp = Float64(-0.125 * Float64(Float64(D * D) * Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64((M_m ^ 2.0) / Float64(-d))))); else tmp = Float64(t_1 * Float64(t_2 * Float64(sqrt(d) / sqrt(l)))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = D * (M_m / d);
t_1 = sqrt((d / h));
t_2 = 1.0 + (h * (-0.125 * (t_0 * (t_0 * (1.0 / l)))));
tmp = 0.0;
if (d <= -8e-203)
tmp = (sqrt((d / l)) * t_2) * t_1;
elseif (d <= -5.5e-303)
tmp = -0.125 * ((D * D) * (sqrt((h / (l ^ 3.0))) * ((M_m ^ 2.0) / -d)));
else
tmp = t_1 * (t_2 * (sqrt(d) / sqrt(l)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(1.0 + N[(h * N[(-0.125 * N[(t$95$0 * N[(t$95$0 * N[(1.0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -8e-203], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * t$95$2), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[d, -5.5e-303], N[(-0.125 * N[(N[(D * D), $MachinePrecision] * N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Power[M$95$m, 2.0], $MachinePrecision] / (-d)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(t$95$2 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := D \cdot \frac{M\_m}{d}\\
t_1 := \sqrt{\frac{d}{h}}\\
t_2 := 1 + h \cdot \left(-0.125 \cdot \left(t\_0 \cdot \left(t\_0 \cdot \frac{1}{\ell}\right)\right)\right)\\
\mathbf{if}\;d \leq -8 \cdot 10^{-203}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot t\_2\right) \cdot t\_1\\
\mathbf{elif}\;d \leq -5.5 \cdot 10^{-303}:\\
\;\;\;\;-0.125 \cdot \left(\left(D \cdot D\right) \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \frac{{M\_m}^{2}}{-d}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(t\_2 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\
\end{array}
\end{array}
if d < -8.0000000000000003e-203Initial program 71.8%
Simplified71.9%
Taylor expanded in h around -inf 53.7%
associate-*r*53.7%
neg-mul-153.7%
sub-neg53.7%
distribute-lft-in53.7%
Simplified75.4%
pow175.4%
associate-*r/75.4%
Applied egg-rr75.4%
unpow175.4%
distribute-lft-neg-in75.4%
distribute-rgt-neg-in75.4%
associate-/l*75.4%
distribute-lft-neg-in75.4%
metadata-eval75.4%
associate-*r/75.4%
*-commutative75.4%
associate-/l*75.4%
Simplified75.4%
div-inv75.4%
unpow275.4%
associate-*l*75.6%
Applied egg-rr75.6%
if -8.0000000000000003e-203 < d < -5.50000000000000018e-303Initial program 18.9%
Simplified18.9%
Taylor expanded in h around -inf 0.0%
associate-/l*0.0%
associate-*l*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt51.2%
mul-1-neg51.2%
Simplified51.2%
unpow251.2%
Applied egg-rr51.2%
if -5.50000000000000018e-303 < d Initial program 64.9%
Simplified64.9%
Taylor expanded in h around -inf 42.7%
associate-*r*42.7%
neg-mul-142.7%
sub-neg42.7%
distribute-lft-in42.7%
Simplified66.5%
pow166.5%
associate-*r/66.5%
Applied egg-rr66.5%
unpow166.5%
distribute-lft-neg-in66.5%
distribute-rgt-neg-in66.5%
associate-/l*66.5%
distribute-lft-neg-in66.5%
metadata-eval66.5%
associate-*r/66.5%
*-commutative66.5%
associate-/l*65.8%
Simplified65.8%
div-inv65.8%
unpow265.8%
associate-*l*67.3%
Applied egg-rr67.3%
sqrt-div76.6%
Applied egg-rr76.6%
Final simplification74.0%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (* D (/ M_m d)))
(t_1
(*
(sqrt (/ d l))
(+ 1.0 (* h (* -0.125 (* t_0 (* t_0 (/ 1.0 l)))))))))
(if (<= h -3.2e-227)
(* t_1 (sqrt (/ d h)))
(if (<= h -5e-310)
(* d (- (sqrt (/ (/ 1.0 l) h))))
(if (<= h 8e-249)
(* d (* (pow l -0.5) (pow h -0.5)))
(* t_1 (/ 1.0 (sqrt (/ h d)))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = D * (M_m / d);
double t_1 = sqrt((d / l)) * (1.0 + (h * (-0.125 * (t_0 * (t_0 * (1.0 / l))))));
double tmp;
if (h <= -3.2e-227) {
tmp = t_1 * sqrt((d / h));
} else if (h <= -5e-310) {
tmp = d * -sqrt(((1.0 / l) / h));
} else if (h <= 8e-249) {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
} else {
tmp = t_1 * (1.0 / sqrt((h / d)));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d_1 * (m_m / d)
t_1 = sqrt((d / l)) * (1.0d0 + (h * ((-0.125d0) * (t_0 * (t_0 * (1.0d0 / l))))))
if (h <= (-3.2d-227)) then
tmp = t_1 * sqrt((d / h))
else if (h <= (-5d-310)) then
tmp = d * -sqrt(((1.0d0 / l) / h))
else if (h <= 8d-249) then
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
else
tmp = t_1 * (1.0d0 / sqrt((h / d)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = D * (M_m / d);
double t_1 = Math.sqrt((d / l)) * (1.0 + (h * (-0.125 * (t_0 * (t_0 * (1.0 / l))))));
double tmp;
if (h <= -3.2e-227) {
tmp = t_1 * Math.sqrt((d / h));
} else if (h <= -5e-310) {
tmp = d * -Math.sqrt(((1.0 / l) / h));
} else if (h <= 8e-249) {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
} else {
tmp = t_1 * (1.0 / Math.sqrt((h / d)));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = D * (M_m / d) t_1 = math.sqrt((d / l)) * (1.0 + (h * (-0.125 * (t_0 * (t_0 * (1.0 / l)))))) tmp = 0 if h <= -3.2e-227: tmp = t_1 * math.sqrt((d / h)) elif h <= -5e-310: tmp = d * -math.sqrt(((1.0 / l) / h)) elif h <= 8e-249: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) else: tmp = t_1 * (1.0 / math.sqrt((h / d))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(D * Float64(M_m / d)) t_1 = Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(h * Float64(-0.125 * Float64(t_0 * Float64(t_0 * Float64(1.0 / l))))))) tmp = 0.0 if (h <= -3.2e-227) tmp = Float64(t_1 * sqrt(Float64(d / h))); elseif (h <= -5e-310) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / l) / h)))); elseif (h <= 8e-249) tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); else tmp = Float64(t_1 * Float64(1.0 / sqrt(Float64(h / d)))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = D * (M_m / d);
t_1 = sqrt((d / l)) * (1.0 + (h * (-0.125 * (t_0 * (t_0 * (1.0 / l))))));
tmp = 0.0;
if (h <= -3.2e-227)
tmp = t_1 * sqrt((d / h));
elseif (h <= -5e-310)
tmp = d * -sqrt(((1.0 / l) / h));
elseif (h <= 8e-249)
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
else
tmp = t_1 * (1.0 / sqrt((h / d)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(h * N[(-0.125 * N[(t$95$0 * N[(t$95$0 * N[(1.0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -3.2e-227], N[(t$95$1 * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -5e-310], N[(d * (-N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[h, 8e-249], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(1.0 / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := D \cdot \frac{M\_m}{d}\\
t_1 := \sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \left(-0.125 \cdot \left(t\_0 \cdot \left(t\_0 \cdot \frac{1}{\ell}\right)\right)\right)\right)\\
\mathbf{if}\;h \leq -3.2 \cdot 10^{-227}:\\
\;\;\;\;t\_1 \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\
\mathbf{elif}\;h \leq 8 \cdot 10^{-249}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \frac{1}{\sqrt{\frac{h}{d}}}\\
\end{array}
\end{array}
if h < -3.2000000000000001e-227Initial program 64.3%
Simplified64.3%
Taylor expanded in h around -inf 49.1%
associate-*r*49.1%
neg-mul-149.1%
sub-neg49.1%
distribute-lft-in49.1%
Simplified67.6%
pow167.6%
associate-*r/67.6%
Applied egg-rr67.6%
unpow167.6%
distribute-lft-neg-in67.6%
distribute-rgt-neg-in67.6%
associate-/l*67.6%
distribute-lft-neg-in67.6%
metadata-eval67.6%
associate-*r/67.6%
*-commutative67.6%
associate-/l*67.6%
Simplified67.6%
div-inv67.7%
unpow267.7%
associate-*l*67.8%
Applied egg-rr67.8%
if -3.2000000000000001e-227 < h < -4.999999999999985e-310Initial program 47.2%
Simplified47.1%
frac-2neg47.1%
sqrt-div53.2%
Applied egg-rr52.9%
Taylor expanded in d around inf 1.2%
unpow-11.2%
metadata-eval1.2%
pow-sqr1.2%
rem-sqrt-square1.2%
rem-square-sqrt1.2%
fabs-sqr1.2%
rem-square-sqrt1.2%
Simplified1.2%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
associate-/l/0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt87.7%
neg-mul-187.7%
Simplified87.7%
if -4.999999999999985e-310 < h < 8.00000000000000043e-249Initial program 46.6%
Simplified46.4%
frac-2neg46.6%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in d around inf 71.8%
unpow-171.8%
metadata-eval71.8%
pow-sqr71.8%
rem-sqrt-square71.8%
rem-square-sqrt71.8%
fabs-sqr71.8%
rem-square-sqrt71.8%
Simplified71.8%
*-commutative71.8%
unpow-prod-down83.6%
Applied egg-rr83.6%
if 8.00000000000000043e-249 < h Initial program 67.7%
Simplified67.7%
Taylor expanded in h around -inf 43.6%
associate-*r*43.6%
neg-mul-143.6%
sub-neg43.6%
distribute-lft-in43.6%
Simplified69.5%
pow169.5%
associate-*r/69.5%
Applied egg-rr69.5%
unpow169.5%
distribute-lft-neg-in69.5%
distribute-rgt-neg-in69.5%
associate-/l*69.5%
distribute-lft-neg-in69.5%
metadata-eval69.5%
associate-*r/69.5%
*-commutative69.5%
associate-/l*68.7%
Simplified68.7%
div-inv68.7%
unpow268.7%
associate-*l*70.4%
Applied egg-rr70.4%
clear-num70.4%
sqrt-div71.7%
metadata-eval71.7%
Applied egg-rr71.7%
Final simplification71.6%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (* D (/ M_m d)))
(t_1 (sqrt (/ d h)))
(t_2 (+ 1.0 (* h (* -0.125 (* t_0 (* t_0 (/ 1.0 l))))))))
(if (<= h -3.2e-227)
(* (* (sqrt (/ d l)) t_2) t_1)
(if (<= h -5e-310)
(* d (- (sqrt (/ (/ 1.0 l) h))))
(if (<= h 4.8e-250)
(* d (* (pow l -0.5) (pow h -0.5)))
(* t_1 (* t_2 (/ 1.0 (sqrt (/ l d))))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = D * (M_m / d);
double t_1 = sqrt((d / h));
double t_2 = 1.0 + (h * (-0.125 * (t_0 * (t_0 * (1.0 / l)))));
double tmp;
if (h <= -3.2e-227) {
tmp = (sqrt((d / l)) * t_2) * t_1;
} else if (h <= -5e-310) {
tmp = d * -sqrt(((1.0 / l) / h));
} else if (h <= 4.8e-250) {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
} else {
tmp = t_1 * (t_2 * (1.0 / sqrt((l / d))));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = d_1 * (m_m / d)
t_1 = sqrt((d / h))
t_2 = 1.0d0 + (h * ((-0.125d0) * (t_0 * (t_0 * (1.0d0 / l)))))
if (h <= (-3.2d-227)) then
tmp = (sqrt((d / l)) * t_2) * t_1
else if (h <= (-5d-310)) then
tmp = d * -sqrt(((1.0d0 / l) / h))
else if (h <= 4.8d-250) then
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
else
tmp = t_1 * (t_2 * (1.0d0 / sqrt((l / d))))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = D * (M_m / d);
double t_1 = Math.sqrt((d / h));
double t_2 = 1.0 + (h * (-0.125 * (t_0 * (t_0 * (1.0 / l)))));
double tmp;
if (h <= -3.2e-227) {
tmp = (Math.sqrt((d / l)) * t_2) * t_1;
} else if (h <= -5e-310) {
tmp = d * -Math.sqrt(((1.0 / l) / h));
} else if (h <= 4.8e-250) {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
} else {
tmp = t_1 * (t_2 * (1.0 / Math.sqrt((l / d))));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = D * (M_m / d) t_1 = math.sqrt((d / h)) t_2 = 1.0 + (h * (-0.125 * (t_0 * (t_0 * (1.0 / l))))) tmp = 0 if h <= -3.2e-227: tmp = (math.sqrt((d / l)) * t_2) * t_1 elif h <= -5e-310: tmp = d * -math.sqrt(((1.0 / l) / h)) elif h <= 4.8e-250: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) else: tmp = t_1 * (t_2 * (1.0 / math.sqrt((l / d)))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(D * Float64(M_m / d)) t_1 = sqrt(Float64(d / h)) t_2 = Float64(1.0 + Float64(h * Float64(-0.125 * Float64(t_0 * Float64(t_0 * Float64(1.0 / l)))))) tmp = 0.0 if (h <= -3.2e-227) tmp = Float64(Float64(sqrt(Float64(d / l)) * t_2) * t_1); elseif (h <= -5e-310) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / l) / h)))); elseif (h <= 4.8e-250) tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); else tmp = Float64(t_1 * Float64(t_2 * Float64(1.0 / sqrt(Float64(l / d))))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = D * (M_m / d);
t_1 = sqrt((d / h));
t_2 = 1.0 + (h * (-0.125 * (t_0 * (t_0 * (1.0 / l)))));
tmp = 0.0;
if (h <= -3.2e-227)
tmp = (sqrt((d / l)) * t_2) * t_1;
elseif (h <= -5e-310)
tmp = d * -sqrt(((1.0 / l) / h));
elseif (h <= 4.8e-250)
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
else
tmp = t_1 * (t_2 * (1.0 / sqrt((l / d))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(1.0 + N[(h * N[(-0.125 * N[(t$95$0 * N[(t$95$0 * N[(1.0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -3.2e-227], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * t$95$2), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[h, -5e-310], N[(d * (-N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[h, 4.8e-250], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(t$95$2 * N[(1.0 / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := D \cdot \frac{M\_m}{d}\\
t_1 := \sqrt{\frac{d}{h}}\\
t_2 := 1 + h \cdot \left(-0.125 \cdot \left(t\_0 \cdot \left(t\_0 \cdot \frac{1}{\ell}\right)\right)\right)\\
\mathbf{if}\;h \leq -3.2 \cdot 10^{-227}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot t\_2\right) \cdot t\_1\\
\mathbf{elif}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\
\mathbf{elif}\;h \leq 4.8 \cdot 10^{-250}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(t\_2 \cdot \frac{1}{\sqrt{\frac{\ell}{d}}}\right)\\
\end{array}
\end{array}
if h < -3.2000000000000001e-227Initial program 64.3%
Simplified64.3%
Taylor expanded in h around -inf 49.1%
associate-*r*49.1%
neg-mul-149.1%
sub-neg49.1%
distribute-lft-in49.1%
Simplified67.6%
pow167.6%
associate-*r/67.6%
Applied egg-rr67.6%
unpow167.6%
distribute-lft-neg-in67.6%
distribute-rgt-neg-in67.6%
associate-/l*67.6%
distribute-lft-neg-in67.6%
metadata-eval67.6%
associate-*r/67.6%
*-commutative67.6%
associate-/l*67.6%
Simplified67.6%
div-inv67.7%
unpow267.7%
associate-*l*67.8%
Applied egg-rr67.8%
if -3.2000000000000001e-227 < h < -4.999999999999985e-310Initial program 47.2%
Simplified47.1%
frac-2neg47.1%
sqrt-div53.2%
Applied egg-rr52.9%
Taylor expanded in d around inf 1.2%
unpow-11.2%
metadata-eval1.2%
pow-sqr1.2%
rem-sqrt-square1.2%
rem-square-sqrt1.2%
fabs-sqr1.2%
rem-square-sqrt1.2%
Simplified1.2%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
associate-/l/0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt87.7%
neg-mul-187.7%
Simplified87.7%
if -4.999999999999985e-310 < h < 4.7999999999999998e-250Initial program 46.6%
Simplified46.4%
frac-2neg46.6%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in d around inf 71.8%
unpow-171.8%
metadata-eval71.8%
pow-sqr71.8%
rem-sqrt-square71.8%
rem-square-sqrt71.8%
fabs-sqr71.8%
rem-square-sqrt71.8%
Simplified71.8%
*-commutative71.8%
unpow-prod-down83.6%
Applied egg-rr83.6%
if 4.7999999999999998e-250 < h Initial program 67.7%
Simplified67.7%
Taylor expanded in h around -inf 43.6%
associate-*r*43.6%
neg-mul-143.6%
sub-neg43.6%
distribute-lft-in43.6%
Simplified69.5%
pow169.5%
associate-*r/69.5%
Applied egg-rr69.5%
unpow169.5%
distribute-lft-neg-in69.5%
distribute-rgt-neg-in69.5%
associate-/l*69.5%
distribute-lft-neg-in69.5%
metadata-eval69.5%
associate-*r/69.5%
*-commutative69.5%
associate-/l*68.7%
Simplified68.7%
div-inv68.7%
unpow268.7%
associate-*l*70.4%
Applied egg-rr70.4%
clear-num70.3%
sqrt-div70.7%
metadata-eval70.7%
Applied egg-rr70.7%
Final simplification71.2%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= D 520000000.0)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(*
(sqrt (* (/ d l) (/ d h)))
(- 1.0 (* 0.5 (* (pow (* (/ M_m 2.0) (/ D d)) 2.0) (/ h l)))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (D <= 520000000.0) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else {
tmp = sqrt(((d / l) * (d / h))) * (1.0 - (0.5 * (pow(((M_m / 2.0) * (D / d)), 2.0) * (h / l))));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: tmp
if (d_1 <= 520000000.0d0) then
tmp = sqrt((d / l)) * sqrt((d / h))
else
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 - (0.5d0 * ((((m_m / 2.0d0) * (d_1 / d)) ** 2.0d0) * (h / l))))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (D <= 520000000.0) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 - (0.5 * (Math.pow(((M_m / 2.0) * (D / d)), 2.0) * (h / l))));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if D <= 520000000.0: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) else: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 - (0.5 * (math.pow(((M_m / 2.0) * (D / d)), 2.0) * (h / l)))) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (D <= 520000000.0) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); else tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(M_m / 2.0) * Float64(D / d)) ^ 2.0) * Float64(h / l))))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (D <= 520000000.0)
tmp = sqrt((d / l)) * sqrt((d / h));
else
tmp = sqrt(((d / l) * (d / h))) * (1.0 - (0.5 * ((((M_m / 2.0) * (D / d)) ^ 2.0) * (h / l))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[D, 520000000.0], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;D \leq 520000000:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M\_m}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\\
\end{array}
\end{array}
if D < 5.2e8Initial program 64.5%
Simplified64.5%
Taylor expanded in d around inf 43.5%
if 5.2e8 < D Initial program 61.4%
Simplified61.3%
pow161.3%
sqrt-unprod54.0%
Applied egg-rr54.0%
unpow154.0%
Simplified54.0%
Final simplification46.0%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (* D (/ M_m d))))
(*
(* (sqrt (/ d l)) (+ 1.0 (* h (* -0.125 (* t_0 (* t_0 (/ 1.0 l)))))))
(sqrt (/ d h)))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = D * (M_m / d);
return (sqrt((d / l)) * (1.0 + (h * (-0.125 * (t_0 * (t_0 * (1.0 / l))))))) * sqrt((d / h));
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
t_0 = d_1 * (m_m / d)
code = (sqrt((d / l)) * (1.0d0 + (h * ((-0.125d0) * (t_0 * (t_0 * (1.0d0 / l))))))) * sqrt((d / h))
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = D * (M_m / d);
return (Math.sqrt((d / l)) * (1.0 + (h * (-0.125 * (t_0 * (t_0 * (1.0 / l))))))) * Math.sqrt((d / h));
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = D * (M_m / d) return (math.sqrt((d / l)) * (1.0 + (h * (-0.125 * (t_0 * (t_0 * (1.0 / l))))))) * math.sqrt((d / h))
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(D * Float64(M_m / d)) return Float64(Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(h * Float64(-0.125 * Float64(t_0 * Float64(t_0 * Float64(1.0 / l))))))) * sqrt(Float64(d / h))) end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp = code(d, h, l, M_m, D)
t_0 = D * (M_m / d);
tmp = (sqrt((d / l)) * (1.0 + (h * (-0.125 * (t_0 * (t_0 * (1.0 / l))))))) * sqrt((d / h));
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(h * N[(-0.125 * N[(t$95$0 * N[(t$95$0 * N[(1.0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := D \cdot \frac{M\_m}{d}\\
\left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \left(-0.125 \cdot \left(t\_0 \cdot \left(t\_0 \cdot \frac{1}{\ell}\right)\right)\right)\right)\right) \cdot \sqrt{\frac{d}{h}}
\end{array}
\end{array}
Initial program 63.8%
Simplified63.8%
Taylor expanded in h around -inf 45.1%
associate-*r*45.1%
neg-mul-145.1%
sub-neg45.1%
distribute-lft-in45.1%
Simplified66.1%
pow166.1%
associate-*r/66.0%
Applied egg-rr66.0%
unpow166.0%
distribute-lft-neg-in66.0%
distribute-rgt-neg-in66.0%
associate-/l*66.1%
distribute-lft-neg-in66.1%
metadata-eval66.1%
associate-*r/66.0%
*-commutative66.0%
associate-/l*65.7%
Simplified65.7%
div-inv65.7%
unpow265.7%
associate-*l*66.5%
Applied egg-rr66.5%
Final simplification66.5%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(let* ((t_0 (* D (/ M_m d))))
(*
(sqrt (/ d h))
(* (sqrt (/ d l)) (+ 1.0 (* h (* -0.125 (* t_0 (/ t_0 l)))))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = D * (M_m / d);
return sqrt((d / h)) * (sqrt((d / l)) * (1.0 + (h * (-0.125 * (t_0 * (t_0 / l))))));
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
t_0 = d_1 * (m_m / d)
code = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 + (h * ((-0.125d0) * (t_0 * (t_0 / l))))))
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = D * (M_m / d);
return Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 + (h * (-0.125 * (t_0 * (t_0 / l))))));
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = D * (M_m / d) return math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 + (h * (-0.125 * (t_0 * (t_0 / l))))))
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(D * Float64(M_m / d)) return Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(h * Float64(-0.125 * Float64(t_0 * Float64(t_0 / l))))))) end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp = code(d, h, l, M_m, D)
t_0 = D * (M_m / d);
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + (h * (-0.125 * (t_0 * (t_0 / l))))));
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(h * N[(-0.125 * N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := D \cdot \frac{M\_m}{d}\\
\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \left(-0.125 \cdot \left(t\_0 \cdot \frac{t\_0}{\ell}\right)\right)\right)\right)
\end{array}
\end{array}
Initial program 63.8%
Simplified63.8%
Taylor expanded in h around -inf 45.1%
associate-*r*45.1%
neg-mul-145.1%
sub-neg45.1%
distribute-lft-in45.1%
Simplified66.1%
pow166.1%
associate-*r/66.0%
Applied egg-rr66.0%
unpow166.0%
distribute-lft-neg-in66.0%
distribute-rgt-neg-in66.0%
associate-/l*66.1%
distribute-lft-neg-in66.1%
metadata-eval66.1%
associate-*r/66.0%
*-commutative66.0%
associate-/l*65.7%
Simplified65.7%
unpow235.6%
associate-/l*36.0%
Applied egg-rr66.5%
Final simplification66.5%
M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. (FPCore (d h l M_m D) :precision binary64 (* (sqrt (/ d h)) (* (sqrt (/ d l)) (+ 1.0 (* h (* -0.125 (* (* D (/ M_m d)) (* D (/ (/ M_m d) l)))))))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
return sqrt((d / h)) * (sqrt((d / l)) * (1.0 + (h * (-0.125 * ((D * (M_m / d)) * (D * ((M_m / d) / l)))))));
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
code = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 + (h * ((-0.125d0) * ((d_1 * (m_m / d)) * (d_1 * ((m_m / d) / l)))))))
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
return Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 + (h * (-0.125 * ((D * (M_m / d)) * (D * ((M_m / d) / l)))))));
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): return math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 + (h * (-0.125 * ((D * (M_m / d)) * (D * ((M_m / d) / l)))))))
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) return Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(h * Float64(-0.125 * Float64(Float64(D * Float64(M_m / d)) * Float64(D * Float64(Float64(M_m / d) / l)))))))) end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp = code(d, h, l, M_m, D)
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + (h * (-0.125 * ((D * (M_m / d)) * (D * ((M_m / d) / l)))))));
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(h * N[(-0.125 * N[(N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision] * N[(D * N[(N[(M$95$m / d), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \left(-0.125 \cdot \left(\left(D \cdot \frac{M\_m}{d}\right) \cdot \left(D \cdot \frac{\frac{M\_m}{d}}{\ell}\right)\right)\right)\right)\right)
\end{array}
Initial program 63.8%
Simplified63.8%
Taylor expanded in h around -inf 45.1%
associate-*r*45.1%
neg-mul-145.1%
sub-neg45.1%
distribute-lft-in45.1%
Simplified66.1%
pow166.1%
associate-*r/66.0%
Applied egg-rr66.0%
unpow166.0%
distribute-lft-neg-in66.0%
distribute-rgt-neg-in66.0%
associate-/l*66.1%
distribute-lft-neg-in66.1%
metadata-eval66.1%
associate-*r/66.0%
*-commutative66.0%
associate-/l*65.7%
Simplified65.7%
div-inv65.7%
unpow265.7%
associate-*l*66.5%
Applied egg-rr66.5%
Taylor expanded in D around 0 63.4%
associate-/r*66.5%
associate-*r/66.5%
associate-*r/64.0%
Simplified64.0%
Final simplification64.0%
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
:precision binary64
(if (<= d -8.5e-161)
(* d (- (sqrt (/ (/ 1.0 l) h))))
(if (<= d -1e-309)
(* d (pow (+ -1.0 (fma h l 1.0)) -0.5))
(* d (* (pow l -0.5) (pow h -0.5))))))M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= -8.5e-161) {
tmp = d * -sqrt(((1.0 / l) / h));
} else if (d <= -1e-309) {
tmp = d * pow((-1.0 + fma(h, l, 1.0)), -0.5);
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (d <= -8.5e-161) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / l) / h)))); elseif (d <= -1e-309) tmp = Float64(d * (Float64(-1.0 + fma(h, l, 1.0)) ^ -0.5)); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[d, -8.5e-161], N[(d * (-N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[d, -1e-309], N[(d * N[Power[N[(-1.0 + N[(h * l + 1.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -8.5 \cdot 10^{-161}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\
\mathbf{elif}\;d \leq -1 \cdot 10^{-309}:\\
\;\;\;\;d \cdot {\left(-1 + \mathsf{fma}\left(h, \ell, 1\right)\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if d < -8.50000000000000054e-161Initial program 74.2%
Simplified74.2%
frac-2neg78.1%
sqrt-div84.9%
Applied egg-rr79.0%
Taylor expanded in d around inf 7.5%
unpow-17.5%
metadata-eval7.5%
pow-sqr7.5%
rem-sqrt-square6.5%
rem-square-sqrt6.5%
fabs-sqr6.5%
rem-square-sqrt6.5%
Simplified6.5%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
associate-/l/0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt58.3%
neg-mul-158.3%
Simplified58.3%
if -8.50000000000000054e-161 < d < -1.000000000000002e-309Initial program 24.7%
Simplified24.7%
frac-2neg24.6%
sqrt-div31.1%
Applied egg-rr31.0%
Taylor expanded in d around inf 5.7%
unpow-15.7%
metadata-eval5.7%
pow-sqr5.7%
rem-sqrt-square5.7%
rem-square-sqrt5.7%
fabs-sqr5.7%
rem-square-sqrt5.7%
Simplified5.7%
expm1-log1p-u5.7%
expm1-undefine37.2%
Applied egg-rr37.2%
sub-neg37.2%
metadata-eval37.2%
+-commutative37.2%
log1p-undefine37.2%
rem-exp-log37.2%
+-commutative37.2%
fma-define37.2%
Simplified37.2%
if -1.000000000000002e-309 < d Initial program 65.4%
Simplified63.9%
frac-2neg66.3%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in d around inf 44.2%
unpow-144.2%
metadata-eval44.2%
pow-sqr44.2%
rem-sqrt-square44.6%
rem-square-sqrt44.4%
fabs-sqr44.4%
rem-square-sqrt44.6%
Simplified44.6%
*-commutative44.6%
unpow-prod-down51.5%
Applied egg-rr51.5%
Final simplification52.3%
M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. (FPCore (d h l M_m D) :precision binary64 (if (<= d 7.8e-227) (* d (- (sqrt (/ (/ 1.0 l) h)))) (* d (* (pow l -0.5) (pow h -0.5)))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= 7.8e-227) {
tmp = d * -sqrt(((1.0 / l) / h));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: tmp
if (d <= 7.8d-227) then
tmp = d * -sqrt(((1.0d0 / l) / h))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= 7.8e-227) {
tmp = d * -Math.sqrt(((1.0 / l) / h));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if d <= 7.8e-227: tmp = d * -math.sqrt(((1.0 / l) / h)) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (d <= 7.8e-227) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / l) / h)))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (d <= 7.8e-227)
tmp = d * -sqrt(((1.0 / l) / h));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[d, 7.8e-227], N[(d * (-N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 7.8 \cdot 10^{-227}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if d < 7.7999999999999999e-227Initial program 60.2%
Simplified59.5%
frac-2neg62.2%
sqrt-div64.6%
Applied egg-rr60.6%
Taylor expanded in d around inf 7.3%
unpow-17.3%
metadata-eval7.3%
pow-sqr7.3%
rem-sqrt-square6.6%
rem-square-sqrt6.6%
fabs-sqr6.6%
rem-square-sqrt6.6%
Simplified6.6%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
associate-/l/0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt42.4%
neg-mul-142.4%
Simplified42.4%
if 7.7999999999999999e-227 < d Initial program 68.1%
Simplified67.2%
frac-2neg69.9%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in d around inf 48.4%
unpow-148.4%
metadata-eval48.4%
pow-sqr48.4%
rem-sqrt-square48.9%
rem-square-sqrt48.7%
fabs-sqr48.7%
rem-square-sqrt48.9%
Simplified48.9%
*-commutative48.9%
unpow-prod-down56.6%
Applied egg-rr56.6%
Final simplification48.8%
M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. (FPCore (d h l M_m D) :precision binary64 (if (<= d 1.2e-228) (* d (- (sqrt (/ (/ 1.0 l) h)))) (/ (* d (pow h -0.5)) (sqrt l))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= 1.2e-228) {
tmp = d * -sqrt(((1.0 / l) / h));
} else {
tmp = (d * pow(h, -0.5)) / sqrt(l);
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: tmp
if (d <= 1.2d-228) then
tmp = d * -sqrt(((1.0d0 / l) / h))
else
tmp = (d * (h ** (-0.5d0))) / sqrt(l)
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= 1.2e-228) {
tmp = d * -Math.sqrt(((1.0 / l) / h));
} else {
tmp = (d * Math.pow(h, -0.5)) / Math.sqrt(l);
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if d <= 1.2e-228: tmp = d * -math.sqrt(((1.0 / l) / h)) else: tmp = (d * math.pow(h, -0.5)) / math.sqrt(l) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (d <= 1.2e-228) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / l) / h)))); else tmp = Float64(Float64(d * (h ^ -0.5)) / sqrt(l)); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (d <= 1.2e-228)
tmp = d * -sqrt(((1.0 / l) / h));
else
tmp = (d * (h ^ -0.5)) / sqrt(l);
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[d, 1.2e-228], N[(d * (-N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[(d * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 1.2 \cdot 10^{-228}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d \cdot {h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < 1.20000000000000001e-228Initial program 60.2%
Simplified59.5%
frac-2neg62.2%
sqrt-div64.6%
Applied egg-rr60.6%
Taylor expanded in d around inf 7.3%
unpow-17.3%
metadata-eval7.3%
pow-sqr7.3%
rem-sqrt-square6.6%
rem-square-sqrt6.6%
fabs-sqr6.6%
rem-square-sqrt6.6%
Simplified6.6%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
associate-/l/0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt42.4%
neg-mul-142.4%
Simplified42.4%
if 1.20000000000000001e-228 < d Initial program 68.1%
Simplified67.2%
frac-2neg69.9%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in d around inf 48.4%
unpow-148.4%
metadata-eval48.4%
pow-sqr48.4%
rem-sqrt-square48.9%
rem-square-sqrt48.7%
fabs-sqr48.7%
rem-square-sqrt48.9%
rem-square-sqrt48.7%
fabs-sqr48.7%
rem-square-sqrt48.9%
rem-sqrt-square48.4%
pow-sqr48.4%
metadata-eval48.4%
unpow-148.4%
associate-/r*48.4%
Simplified48.4%
pow148.4%
sqrt-div56.6%
inv-pow56.6%
sqrt-pow156.5%
metadata-eval56.5%
Applied egg-rr56.5%
unpow156.5%
associate-*r/53.6%
Simplified53.6%
Final simplification47.5%
M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. (FPCore (d h l M_m D) :precision binary64 (if (<= d 3.8e-228) (* d (- (sqrt (/ (/ 1.0 l) h)))) (* d (pow (* h l) -0.5))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= 3.8e-228) {
tmp = d * -sqrt(((1.0 / l) / h));
} else {
tmp = d * pow((h * l), -0.5);
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: tmp
if (d <= 3.8d-228) then
tmp = d * -sqrt(((1.0d0 / l) / h))
else
tmp = d * ((h * l) ** (-0.5d0))
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double tmp;
if (d <= 3.8e-228) {
tmp = d * -Math.sqrt(((1.0 / l) / h));
} else {
tmp = d * Math.pow((h * l), -0.5);
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): tmp = 0 if d <= 3.8e-228: tmp = d * -math.sqrt(((1.0 / l) / h)) else: tmp = d * math.pow((h * l), -0.5) return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) tmp = 0.0 if (d <= 3.8e-228) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / l) / h)))); else tmp = Float64(d * (Float64(h * l) ^ -0.5)); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
tmp = 0.0;
if (d <= 3.8e-228)
tmp = d * -sqrt(((1.0 / l) / h));
else
tmp = d * ((h * l) ^ -0.5);
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[d, 3.8e-228], N[(d * (-N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 3.8 \cdot 10^{-228}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\end{array}
\end{array}
if d < 3.7999999999999999e-228Initial program 60.2%
Simplified59.5%
frac-2neg62.2%
sqrt-div64.6%
Applied egg-rr60.6%
Taylor expanded in d around inf 7.3%
unpow-17.3%
metadata-eval7.3%
pow-sqr7.3%
rem-sqrt-square6.6%
rem-square-sqrt6.6%
fabs-sqr6.6%
rem-square-sqrt6.6%
Simplified6.6%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
associate-/l/0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt42.4%
neg-mul-142.4%
Simplified42.4%
if 3.7999999999999999e-228 < d Initial program 68.1%
Simplified67.2%
frac-2neg69.9%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in d around inf 48.4%
unpow-148.4%
metadata-eval48.4%
pow-sqr48.4%
rem-sqrt-square48.9%
rem-square-sqrt48.7%
fabs-sqr48.7%
rem-square-sqrt48.9%
Simplified48.9%
Final simplification45.3%
M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. (FPCore (d h l M_m D) :precision binary64 (let* ((t_0 (pow (* h l) -0.5))) (if (<= d 2e-227) (* d (- t_0)) (* d t_0))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
double t_0 = pow((h * l), -0.5);
double tmp;
if (d <= 2e-227) {
tmp = d * -t_0;
} else {
tmp = d * t_0;
}
return tmp;
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = (h * l) ** (-0.5d0)
if (d <= 2d-227) then
tmp = d * -t_0
else
tmp = d * t_0
end if
code = tmp
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
double t_0 = Math.pow((h * l), -0.5);
double tmp;
if (d <= 2e-227) {
tmp = d * -t_0;
} else {
tmp = d * t_0;
}
return tmp;
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): t_0 = math.pow((h * l), -0.5) tmp = 0 if d <= 2e-227: tmp = d * -t_0 else: tmp = d * t_0 return tmp
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) t_0 = Float64(h * l) ^ -0.5 tmp = 0.0 if (d <= 2e-227) tmp = Float64(d * Float64(-t_0)); else tmp = Float64(d * t_0); end return tmp end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp_2 = code(d, h, l, M_m, D)
t_0 = (h * l) ^ -0.5;
tmp = 0.0;
if (d <= 2e-227)
tmp = d * -t_0;
else
tmp = d * t_0;
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]}, If[LessEqual[d, 2e-227], N[(d * (-t$95$0)), $MachinePrecision], N[(d * t$95$0), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{if}\;d \leq 2 \cdot 10^{-227}:\\
\;\;\;\;d \cdot \left(-t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot t\_0\\
\end{array}
\end{array}
if d < 1.99999999999999989e-227Initial program 60.2%
Simplified60.3%
Taylor expanded in d around inf 7.3%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt41.9%
neg-mul-141.9%
unpow-141.9%
metadata-eval41.9%
pow-sqr41.9%
rem-sqrt-square41.9%
rem-square-sqrt41.8%
fabs-sqr41.8%
rem-square-sqrt41.9%
Simplified41.9%
if 1.99999999999999989e-227 < d Initial program 68.1%
Simplified67.2%
frac-2neg69.9%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in d around inf 48.4%
unpow-148.4%
metadata-eval48.4%
pow-sqr48.4%
rem-sqrt-square48.9%
rem-square-sqrt48.7%
fabs-sqr48.7%
rem-square-sqrt48.9%
Simplified48.9%
M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. (FPCore (d h l M_m D) :precision binary64 (* d (pow (* h l) -0.5)))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
return d * pow((h * l), -0.5);
}
M_m = abs(m)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_1
code = d * ((h * l) ** (-0.5d0))
end function
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D;
public static double code(double d, double h, double l, double M_m, double D) {
return d * Math.pow((h * l), -0.5);
}
M_m = math.fabs(M) [d, h, l, M_m, D] = sort([d, h, l, M_m, D]) def code(d, h, l, M_m, D): return d * math.pow((h * l), -0.5)
M_m = abs(M) d, h, l, M_m, D = sort([d, h, l, M_m, D]) function code(d, h, l, M_m, D) return Float64(d * (Float64(h * l) ^ -0.5)) end
M_m = abs(M);
d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
function tmp = code(d, h, l, M_m, D)
tmp = d * ((h * l) ^ -0.5);
end
M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D_] := N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
d \cdot {\left(h \cdot \ell\right)}^{-0.5}
\end{array}
Initial program 63.8%
Simplified63.0%
frac-2neg65.7%
sqrt-div35.6%
Applied egg-rr33.4%
Taylor expanded in d around inf 25.7%
unpow-125.7%
metadata-eval25.7%
pow-sqr25.8%
rem-sqrt-square25.6%
rem-square-sqrt25.5%
fabs-sqr25.5%
rem-square-sqrt25.6%
Simplified25.6%
herbie shell --seed 2024158
(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)))))