
(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 30 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)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (+ 1.0 (* (/ h l) (* -0.5 (pow (* D_m (/ (/ M_m 2.0) d)) 2.0)))))
(t_1 (sqrt (- d)))
(t_2 (/ t_1 (sqrt (- l)))))
(if (<= l -3.8e-149)
(* t_2 (* (/ t_1 (sqrt (- h))) t_0))
(if (<= l -5e-310)
(*
t_2
(*
(+ 1.0 (/ (* (* h -0.5) (pow (* D_m (* 0.5 (/ M_m d))) 2.0)) l))
(sqrt (/ d h))))
(* (/ (sqrt d) (sqrt l)) (* (/ (sqrt d) (sqrt h)) t_0))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = 1.0 + ((h / l) * (-0.5 * pow((D_m * ((M_m / 2.0) / d)), 2.0)));
double t_1 = sqrt(-d);
double t_2 = t_1 / sqrt(-l);
double tmp;
if (l <= -3.8e-149) {
tmp = t_2 * ((t_1 / sqrt(-h)) * t_0);
} else if (l <= -5e-310) {
tmp = t_2 * ((1.0 + (((h * -0.5) * pow((D_m * (0.5 * (M_m / d))), 2.0)) / l)) * sqrt((d / h)));
} else {
tmp = (sqrt(d) / sqrt(l)) * ((sqrt(d) / sqrt(h)) * t_0);
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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_m
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = 1.0d0 + ((h / l) * ((-0.5d0) * ((d_m * ((m_m / 2.0d0) / d)) ** 2.0d0)))
t_1 = sqrt(-d)
t_2 = t_1 / sqrt(-l)
if (l <= (-3.8d-149)) then
tmp = t_2 * ((t_1 / sqrt(-h)) * t_0)
else if (l <= (-5d-310)) then
tmp = t_2 * ((1.0d0 + (((h * (-0.5d0)) * ((d_m * (0.5d0 * (m_m / d))) ** 2.0d0)) / l)) * sqrt((d / h)))
else
tmp = (sqrt(d) / sqrt(l)) * ((sqrt(d) / sqrt(h)) * t_0)
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = 1.0 + ((h / l) * (-0.5 * Math.pow((D_m * ((M_m / 2.0) / d)), 2.0)));
double t_1 = Math.sqrt(-d);
double t_2 = t_1 / Math.sqrt(-l);
double tmp;
if (l <= -3.8e-149) {
tmp = t_2 * ((t_1 / Math.sqrt(-h)) * t_0);
} else if (l <= -5e-310) {
tmp = t_2 * ((1.0 + (((h * -0.5) * Math.pow((D_m * (0.5 * (M_m / d))), 2.0)) / l)) * Math.sqrt((d / h)));
} else {
tmp = (Math.sqrt(d) / Math.sqrt(l)) * ((Math.sqrt(d) / Math.sqrt(h)) * t_0);
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = 1.0 + ((h / l) * (-0.5 * math.pow((D_m * ((M_m / 2.0) / d)), 2.0))) t_1 = math.sqrt(-d) t_2 = t_1 / math.sqrt(-l) tmp = 0 if l <= -3.8e-149: tmp = t_2 * ((t_1 / math.sqrt(-h)) * t_0) elif l <= -5e-310: tmp = t_2 * ((1.0 + (((h * -0.5) * math.pow((D_m * (0.5 * (M_m / d))), 2.0)) / l)) * math.sqrt((d / h))) else: tmp = (math.sqrt(d) / math.sqrt(l)) * ((math.sqrt(d) / math.sqrt(h)) * t_0) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(D_m * Float64(Float64(M_m / 2.0) / d)) ^ 2.0)))) t_1 = sqrt(Float64(-d)) t_2 = Float64(t_1 / sqrt(Float64(-l))) tmp = 0.0 if (l <= -3.8e-149) tmp = Float64(t_2 * Float64(Float64(t_1 / sqrt(Float64(-h))) * t_0)); elseif (l <= -5e-310) tmp = Float64(t_2 * Float64(Float64(1.0 + Float64(Float64(Float64(h * -0.5) * (Float64(D_m * Float64(0.5 * Float64(M_m / d))) ^ 2.0)) / l)) * sqrt(Float64(d / h)))); else tmp = Float64(Float64(sqrt(d) / sqrt(l)) * Float64(Float64(sqrt(d) / sqrt(h)) * t_0)); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = 1.0 + ((h / l) * (-0.5 * ((D_m * ((M_m / 2.0) / d)) ^ 2.0)));
t_1 = sqrt(-d);
t_2 = t_1 / sqrt(-l);
tmp = 0.0;
if (l <= -3.8e-149)
tmp = t_2 * ((t_1 / sqrt(-h)) * t_0);
elseif (l <= -5e-310)
tmp = t_2 * ((1.0 + (((h * -0.5) * ((D_m * (0.5 * (M_m / d))) ^ 2.0)) / l)) * sqrt((d / h)));
else
tmp = (sqrt(d) / sqrt(l)) * ((sqrt(d) / sqrt(h)) * t_0);
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D$95$m * N[(N[(M$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -3.8e-149], N[(t$95$2 * N[(N[(t$95$1 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-310], N[(t$95$2 * N[(N[(1.0 + N[(N[(N[(h * -0.5), $MachinePrecision] * N[Power[N[(D$95$m * N[(0.5 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := 1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(D\_m \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2}\right)\\
t_1 := \sqrt{-d}\\
t_2 := \frac{t\_1}{\sqrt{-\ell}}\\
\mathbf{if}\;\ell \leq -3.8 \cdot 10^{-149}:\\
\;\;\;\;t\_2 \cdot \left(\frac{t\_1}{\sqrt{-h}} \cdot t\_0\right)\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;t\_2 \cdot \left(\left(1 + \frac{\left(h \cdot -0.5\right) \cdot {\left(D\_m \cdot \left(0.5 \cdot \frac{M\_m}{d}\right)\right)}^{2}}{\ell}\right) \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot t\_0\right)\\
\end{array}
\end{array}
if l < -3.80000000000000005e-149Initial program 78.3%
Simplified78.3%
frac-2neg84.1%
sqrt-div87.8%
Applied egg-rr80.0%
frac-2neg76.7%
sqrt-div84.1%
Applied egg-rr89.5%
if -3.80000000000000005e-149 < l < -4.999999999999985e-310Initial program 69.4%
Simplified64.0%
associate-*l/73.1%
Applied egg-rr73.1%
frac-2neg73.0%
sqrt-div86.1%
Applied egg-rr86.2%
if -4.999999999999985e-310 < l Initial program 65.7%
Simplified64.2%
sqrt-div75.9%
div-inv75.9%
Applied egg-rr75.9%
associate-*r/75.9%
*-rgt-identity75.9%
Simplified75.9%
sqrt-div80.4%
div-inv80.3%
Applied egg-rr80.3%
associate-*r/80.4%
*-rgt-identity80.4%
Simplified80.4%
Final simplification84.9%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<=
(*
(* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
(- 1.0 (* (/ h l) (* 0.5 (pow (/ (* D_m M_m) (* d 2.0)) 2.0)))))
INFINITY)
(*
(* (sqrt (/ d h)) (sqrt (/ d l)))
(- 1.0 (* 0.5 (pow (* (* 0.5 (/ (* D_m M_m) d)) (sqrt (/ h l))) 2.0))))
(*
(* d (sqrt (/ 1.0 (* l h))))
(-
1.0
(* 0.5 (pow (* (* D_m (* 0.5 (/ M_m d))) (/ (sqrt h) (sqrt l))) 2.0))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (((pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * pow(((D_m * M_m) / (d * 2.0)), 2.0))))) <= ((double) INFINITY)) {
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (0.5 * pow(((0.5 * ((D_m * M_m) / d)) * sqrt((h / l))), 2.0)));
} else {
tmp = (d * sqrt((1.0 / (l * h)))) * (1.0 - (0.5 * pow(((D_m * (0.5 * (M_m / d))) * (sqrt(h) / sqrt(l))), 2.0)));
}
return tmp;
}
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (((Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * Math.pow(((D_m * M_m) / (d * 2.0)), 2.0))))) <= Double.POSITIVE_INFINITY) {
tmp = (Math.sqrt((d / h)) * Math.sqrt((d / l))) * (1.0 - (0.5 * Math.pow(((0.5 * ((D_m * M_m) / d)) * Math.sqrt((h / l))), 2.0)));
} else {
tmp = (d * Math.sqrt((1.0 / (l * h)))) * (1.0 - (0.5 * Math.pow(((D_m * (0.5 * (M_m / d))) * (Math.sqrt(h) / Math.sqrt(l))), 2.0)));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if ((math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * math.pow(((D_m * M_m) / (d * 2.0)), 2.0))))) <= math.inf: tmp = (math.sqrt((d / h)) * math.sqrt((d / l))) * (1.0 - (0.5 * math.pow(((0.5 * ((D_m * M_m) / d)) * math.sqrt((h / l))), 2.0))) else: tmp = (d * math.sqrt((1.0 / (l * h)))) * (1.0 - (0.5 * math.pow(((D_m * (0.5 * (M_m / d))) * (math.sqrt(h) / math.sqrt(l))), 2.0))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(D_m * M_m) / Float64(d * 2.0)) ^ 2.0))))) <= Inf) tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(0.5 * (Float64(Float64(0.5 * Float64(Float64(D_m * M_m) / d)) * sqrt(Float64(h / l))) ^ 2.0)))); else tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(1.0 - Float64(0.5 * (Float64(Float64(D_m * Float64(0.5 * Float64(M_m / d))) * Float64(sqrt(h) / sqrt(l))) ^ 2.0)))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (((((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h / l) * (0.5 * (((D_m * M_m) / (d * 2.0)) ^ 2.0))))) <= Inf)
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (0.5 * (((0.5 * ((D_m * M_m) / d)) * sqrt((h / l))) ^ 2.0)));
else
tmp = (d * sqrt((1.0 / (l * h)))) * (1.0 - (0.5 * (((D_m * (0.5 * (M_m / d))) * (sqrt(h) / sqrt(l))) ^ 2.0)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[Power[N[(N[(0.5 * N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[Power[N[(N[(D$95$m * N[(0.5 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[h], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{D\_m \cdot M\_m}{d \cdot 2}\right)}^{2}\right)\right) \leq \infty:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(0.5 \cdot \frac{D\_m \cdot M\_m}{d}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D\_m \cdot \left(0.5 \cdot \frac{M\_m}{d}\right)\right) \cdot \frac{\sqrt{h}}{\sqrt{\ell}}\right)}^{2}\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 88.2%
Simplified86.3%
add-sqr-sqrt86.3%
pow286.3%
sqrt-prod86.3%
sqrt-pow187.2%
*-commutative87.2%
metadata-eval87.2%
pow187.2%
div-inv87.2%
associate-*l*87.3%
times-frac87.3%
*-commutative87.3%
times-frac87.3%
metadata-eval87.3%
Applied egg-rr87.3%
Taylor expanded in D around 0 89.1%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 0.0%
Simplified0.0%
add-sqr-sqrt0.0%
pow20.0%
sqrt-prod0.0%
sqrt-pow14.5%
*-commutative4.5%
metadata-eval4.5%
pow14.5%
div-inv4.5%
associate-*l*2.5%
times-frac2.5%
*-commutative2.5%
times-frac2.5%
metadata-eval2.5%
Applied egg-rr2.5%
sqrt-div8.0%
Applied egg-rr8.0%
Taylor expanded in d around 0 31.2%
*-commutative31.2%
Simplified31.2%
Final simplification78.0%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<=
(*
(* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
(- 1.0 (* (/ h l) (* 0.5 (pow (/ (* D_m M_m) (* d 2.0)) 2.0)))))
INFINITY)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+ 1.0 (* (/ h l) (* -0.5 (pow (/ (* D_m (* 0.5 M_m)) d) 2.0))))))
(*
(* d (sqrt (/ 1.0 (* l h))))
(-
1.0
(* 0.5 (pow (* (* D_m (* 0.5 (/ M_m d))) (/ (sqrt h) (sqrt l))) 2.0))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (((pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * pow(((D_m * M_m) / (d * 2.0)), 2.0))))) <= ((double) INFINITY)) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * pow(((D_m * (0.5 * M_m)) / d), 2.0)))));
} else {
tmp = (d * sqrt((1.0 / (l * h)))) * (1.0 - (0.5 * pow(((D_m * (0.5 * (M_m / d))) * (sqrt(h) / sqrt(l))), 2.0)));
}
return tmp;
}
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (((Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * Math.pow(((D_m * M_m) / (d * 2.0)), 2.0))))) <= Double.POSITIVE_INFINITY) {
tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * Math.pow(((D_m * (0.5 * M_m)) / d), 2.0)))));
} else {
tmp = (d * Math.sqrt((1.0 / (l * h)))) * (1.0 - (0.5 * Math.pow(((D_m * (0.5 * (M_m / d))) * (Math.sqrt(h) / Math.sqrt(l))), 2.0)));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if ((math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * math.pow(((D_m * M_m) / (d * 2.0)), 2.0))))) <= math.inf: tmp = math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * math.pow(((D_m * (0.5 * M_m)) / d), 2.0))))) else: tmp = (d * math.sqrt((1.0 / (l * h)))) * (1.0 - (0.5 * math.pow(((D_m * (0.5 * (M_m / d))) * (math.sqrt(h) / math.sqrt(l))), 2.0))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(D_m * M_m) / Float64(d * 2.0)) ^ 2.0))))) <= Inf) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(D_m * Float64(0.5 * M_m)) / d) ^ 2.0)))))); else tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(1.0 - Float64(0.5 * (Float64(Float64(D_m * Float64(0.5 * Float64(M_m / d))) * Float64(sqrt(h) / sqrt(l))) ^ 2.0)))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (((((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h / l) * (0.5 * (((D_m * M_m) / (d * 2.0)) ^ 2.0))))) <= Inf)
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * (((D_m * (0.5 * M_m)) / d) ^ 2.0)))));
else
tmp = (d * sqrt((1.0 / (l * h)))) * (1.0 - (0.5 * (((D_m * (0.5 * (M_m / d))) * (sqrt(h) / sqrt(l))) ^ 2.0)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(D$95$m * N[(0.5 * M$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[Power[N[(N[(D$95$m * N[(0.5 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[h], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{D\_m \cdot M\_m}{d \cdot 2}\right)}^{2}\right)\right) \leq \infty:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{D\_m \cdot \left(0.5 \cdot M\_m\right)}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - 0.5 \cdot {\left(\left(D\_m \cdot \left(0.5 \cdot \frac{M\_m}{d}\right)\right) \cdot \frac{\sqrt{h}}{\sqrt{\ell}}\right)}^{2}\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 88.2%
Simplified86.5%
associate-/l/86.5%
*-un-lft-identity86.5%
times-frac86.4%
associate-*l*86.3%
div-inv86.3%
*-commutative86.3%
associate-*r/88.2%
div-inv88.2%
metadata-eval88.2%
Applied egg-rr88.2%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 0.0%
Simplified0.0%
add-sqr-sqrt0.0%
pow20.0%
sqrt-prod0.0%
sqrt-pow14.5%
*-commutative4.5%
metadata-eval4.5%
pow14.5%
div-inv4.5%
associate-*l*2.5%
times-frac2.5%
*-commutative2.5%
times-frac2.5%
metadata-eval2.5%
Applied egg-rr2.5%
sqrt-div8.0%
Applied egg-rr8.0%
Taylor expanded in d around 0 31.2%
*-commutative31.2%
Simplified31.2%
Final simplification77.3%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (+ 1.0 (* (/ h l) (* -0.5 (pow (* D_m (/ (/ M_m 2.0) d)) 2.0)))))
(t_1 (sqrt (- d))))
(if (<= l -4e-147)
(* (* (/ t_1 (sqrt (- h))) t_0) (sqrt (/ d l)))
(if (<= l -5e-310)
(*
(/ t_1 (sqrt (- l)))
(*
(+ 1.0 (/ (* (* h -0.5) (pow (* D_m (* 0.5 (/ M_m d))) 2.0)) l))
(sqrt (/ d h))))
(* (/ (sqrt d) (sqrt l)) (* (/ (sqrt d) (sqrt h)) t_0))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = 1.0 + ((h / l) * (-0.5 * pow((D_m * ((M_m / 2.0) / d)), 2.0)));
double t_1 = sqrt(-d);
double tmp;
if (l <= -4e-147) {
tmp = ((t_1 / sqrt(-h)) * t_0) * sqrt((d / l));
} else if (l <= -5e-310) {
tmp = (t_1 / sqrt(-l)) * ((1.0 + (((h * -0.5) * pow((D_m * (0.5 * (M_m / d))), 2.0)) / l)) * sqrt((d / h)));
} else {
tmp = (sqrt(d) / sqrt(l)) * ((sqrt(d) / sqrt(h)) * t_0);
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 + ((h / l) * ((-0.5d0) * ((d_m * ((m_m / 2.0d0) / d)) ** 2.0d0)))
t_1 = sqrt(-d)
if (l <= (-4d-147)) then
tmp = ((t_1 / sqrt(-h)) * t_0) * sqrt((d / l))
else if (l <= (-5d-310)) then
tmp = (t_1 / sqrt(-l)) * ((1.0d0 + (((h * (-0.5d0)) * ((d_m * (0.5d0 * (m_m / d))) ** 2.0d0)) / l)) * sqrt((d / h)))
else
tmp = (sqrt(d) / sqrt(l)) * ((sqrt(d) / sqrt(h)) * t_0)
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = 1.0 + ((h / l) * (-0.5 * Math.pow((D_m * ((M_m / 2.0) / d)), 2.0)));
double t_1 = Math.sqrt(-d);
double tmp;
if (l <= -4e-147) {
tmp = ((t_1 / Math.sqrt(-h)) * t_0) * Math.sqrt((d / l));
} else if (l <= -5e-310) {
tmp = (t_1 / Math.sqrt(-l)) * ((1.0 + (((h * -0.5) * Math.pow((D_m * (0.5 * (M_m / d))), 2.0)) / l)) * Math.sqrt((d / h)));
} else {
tmp = (Math.sqrt(d) / Math.sqrt(l)) * ((Math.sqrt(d) / Math.sqrt(h)) * t_0);
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = 1.0 + ((h / l) * (-0.5 * math.pow((D_m * ((M_m / 2.0) / d)), 2.0))) t_1 = math.sqrt(-d) tmp = 0 if l <= -4e-147: tmp = ((t_1 / math.sqrt(-h)) * t_0) * math.sqrt((d / l)) elif l <= -5e-310: tmp = (t_1 / math.sqrt(-l)) * ((1.0 + (((h * -0.5) * math.pow((D_m * (0.5 * (M_m / d))), 2.0)) / l)) * math.sqrt((d / h))) else: tmp = (math.sqrt(d) / math.sqrt(l)) * ((math.sqrt(d) / math.sqrt(h)) * t_0) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(D_m * Float64(Float64(M_m / 2.0) / d)) ^ 2.0)))) t_1 = sqrt(Float64(-d)) tmp = 0.0 if (l <= -4e-147) tmp = Float64(Float64(Float64(t_1 / sqrt(Float64(-h))) * t_0) * sqrt(Float64(d / l))); elseif (l <= -5e-310) tmp = Float64(Float64(t_1 / sqrt(Float64(-l))) * Float64(Float64(1.0 + Float64(Float64(Float64(h * -0.5) * (Float64(D_m * Float64(0.5 * Float64(M_m / d))) ^ 2.0)) / l)) * sqrt(Float64(d / h)))); else tmp = Float64(Float64(sqrt(d) / sqrt(l)) * Float64(Float64(sqrt(d) / sqrt(h)) * t_0)); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = 1.0 + ((h / l) * (-0.5 * ((D_m * ((M_m / 2.0) / d)) ^ 2.0)));
t_1 = sqrt(-d);
tmp = 0.0;
if (l <= -4e-147)
tmp = ((t_1 / sqrt(-h)) * t_0) * sqrt((d / l));
elseif (l <= -5e-310)
tmp = (t_1 / sqrt(-l)) * ((1.0 + (((h * -0.5) * ((D_m * (0.5 * (M_m / d))) ^ 2.0)) / l)) * sqrt((d / h)));
else
tmp = (sqrt(d) / sqrt(l)) * ((sqrt(d) / sqrt(h)) * t_0);
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D$95$m * N[(N[(M$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[l, -4e-147], N[(N[(N[(t$95$1 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-310], N[(N[(t$95$1 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(N[(N[(h * -0.5), $MachinePrecision] * N[Power[N[(D$95$m * N[(0.5 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := 1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(D\_m \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2}\right)\\
t_1 := \sqrt{-d}\\
\mathbf{if}\;\ell \leq -4 \cdot 10^{-147}:\\
\;\;\;\;\left(\frac{t\_1}{\sqrt{-h}} \cdot t\_0\right) \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{t\_1}{\sqrt{-\ell}} \cdot \left(\left(1 + \frac{\left(h \cdot -0.5\right) \cdot {\left(D\_m \cdot \left(0.5 \cdot \frac{M\_m}{d}\right)\right)}^{2}}{\ell}\right) \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot t\_0\right)\\
\end{array}
\end{array}
if l < -3.9999999999999999e-147Initial program 78.3%
Simplified78.3%
frac-2neg76.7%
sqrt-div84.1%
Applied egg-rr85.7%
if -3.9999999999999999e-147 < l < -4.999999999999985e-310Initial program 69.4%
Simplified64.0%
associate-*l/73.1%
Applied egg-rr73.1%
frac-2neg73.0%
sqrt-div86.1%
Applied egg-rr86.2%
if -4.999999999999985e-310 < l Initial program 65.7%
Simplified64.2%
sqrt-div75.9%
div-inv75.9%
Applied egg-rr75.9%
associate-*r/75.9%
*-rgt-identity75.9%
Simplified75.9%
sqrt-div80.4%
div-inv80.3%
Applied egg-rr80.3%
associate-*r/80.4%
*-rgt-identity80.4%
Simplified80.4%
Final simplification83.4%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (- d))))
(if (<= l -5e-310)
(*
(/ t_0 (sqrt (- l)))
(*
(/ t_0 (sqrt (- h)))
(+ 1.0 (/ (* (* h -0.5) (pow (* D_m (* 0.5 (/ M_m d))) 2.0)) l))))
(*
(/ (sqrt d) (sqrt l))
(*
(/ (sqrt d) (sqrt h))
(+ 1.0 (* (/ h l) (* -0.5 (pow (* D_m (/ (/ M_m 2.0) d)) 2.0)))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt(-d);
double tmp;
if (l <= -5e-310) {
tmp = (t_0 / sqrt(-l)) * ((t_0 / sqrt(-h)) * (1.0 + (((h * -0.5) * pow((D_m * (0.5 * (M_m / d))), 2.0)) / l)));
} else {
tmp = (sqrt(d) / sqrt(l)) * ((sqrt(d) / sqrt(h)) * (1.0 + ((h / l) * (-0.5 * pow((D_m * ((M_m / 2.0) / d)), 2.0)))));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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_m
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(-d)
if (l <= (-5d-310)) then
tmp = (t_0 / sqrt(-l)) * ((t_0 / sqrt(-h)) * (1.0d0 + (((h * (-0.5d0)) * ((d_m * (0.5d0 * (m_m / d))) ** 2.0d0)) / l)))
else
tmp = (sqrt(d) / sqrt(l)) * ((sqrt(d) / sqrt(h)) * (1.0d0 + ((h / l) * ((-0.5d0) * ((d_m * ((m_m / 2.0d0) / d)) ** 2.0d0)))))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.sqrt(-d);
double tmp;
if (l <= -5e-310) {
tmp = (t_0 / Math.sqrt(-l)) * ((t_0 / Math.sqrt(-h)) * (1.0 + (((h * -0.5) * Math.pow((D_m * (0.5 * (M_m / d))), 2.0)) / l)));
} else {
tmp = (Math.sqrt(d) / Math.sqrt(l)) * ((Math.sqrt(d) / Math.sqrt(h)) * (1.0 + ((h / l) * (-0.5 * Math.pow((D_m * ((M_m / 2.0) / d)), 2.0)))));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.sqrt(-d) tmp = 0 if l <= -5e-310: tmp = (t_0 / math.sqrt(-l)) * ((t_0 / math.sqrt(-h)) * (1.0 + (((h * -0.5) * math.pow((D_m * (0.5 * (M_m / d))), 2.0)) / l))) else: tmp = (math.sqrt(d) / math.sqrt(l)) * ((math.sqrt(d) / math.sqrt(h)) * (1.0 + ((h / l) * (-0.5 * math.pow((D_m * ((M_m / 2.0) / d)), 2.0))))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(-d)) tmp = 0.0 if (l <= -5e-310) tmp = Float64(Float64(t_0 / sqrt(Float64(-l))) * Float64(Float64(t_0 / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(Float64(h * -0.5) * (Float64(D_m * Float64(0.5 * Float64(M_m / d))) ^ 2.0)) / l)))); else tmp = Float64(Float64(sqrt(d) / sqrt(l)) * Float64(Float64(sqrt(d) / sqrt(h)) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(D_m * Float64(Float64(M_m / 2.0) / d)) ^ 2.0)))))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = sqrt(-d);
tmp = 0.0;
if (l <= -5e-310)
tmp = (t_0 / sqrt(-l)) * ((t_0 / sqrt(-h)) * (1.0 + (((h * -0.5) * ((D_m * (0.5 * (M_m / d))) ^ 2.0)) / l)));
else
tmp = (sqrt(d) / sqrt(l)) * ((sqrt(d) / sqrt(h)) * (1.0 + ((h / l) * (-0.5 * ((D_m * ((M_m / 2.0) / d)) ^ 2.0)))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[l, -5e-310], N[(N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(N[(h * -0.5), $MachinePrecision] * N[Power[N[(D$95$m * N[(0.5 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D$95$m * N[(N[(M$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{t\_0}{\sqrt{-\ell}} \cdot \left(\frac{t\_0}{\sqrt{-h}} \cdot \left(1 + \frac{\left(h \cdot -0.5\right) \cdot {\left(D\_m \cdot \left(0.5 \cdot \frac{M\_m}{d}\right)\right)}^{2}}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(D\_m \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2}\right)\right)\right)\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 76.0%
Simplified74.6%
associate-*l/75.8%
Applied egg-rr75.8%
frac-2neg75.8%
sqrt-div81.3%
Applied egg-rr81.3%
frac-2neg81.3%
sqrt-div87.4%
Applied egg-rr87.4%
if -4.999999999999985e-310 < l Initial program 65.7%
Simplified64.2%
sqrt-div75.9%
div-inv75.9%
Applied egg-rr75.9%
associate-*r/75.9%
*-rgt-identity75.9%
Simplified75.9%
sqrt-div80.4%
div-inv80.3%
Applied egg-rr80.3%
associate-*r/80.4%
*-rgt-identity80.4%
Simplified80.4%
Final simplification84.2%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (- d))))
(if (<= l -1.25e-147)
(*
(*
(/ t_0 (sqrt (- h)))
(+ 1.0 (* (/ h l) (* -0.5 (pow (* D_m (/ (/ M_m 2.0) d)) 2.0)))))
(sqrt (/ d l)))
(if (<= l -5e-310)
(*
(/ t_0 (sqrt (- l)))
(*
(+ 1.0 (/ (* (* h -0.5) (pow (* D_m (* 0.5 (/ M_m d))) 2.0)) l))
(sqrt (/ d h))))
(*
(/ d (* (sqrt l) (sqrt h)))
(- 1.0 (* 0.5 (* (/ h l) (pow (/ (* M_m (* D_m 0.5)) d) 2.0)))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt(-d);
double tmp;
if (l <= -1.25e-147) {
tmp = ((t_0 / sqrt(-h)) * (1.0 + ((h / l) * (-0.5 * pow((D_m * ((M_m / 2.0) / d)), 2.0))))) * sqrt((d / l));
} else if (l <= -5e-310) {
tmp = (t_0 / sqrt(-l)) * ((1.0 + (((h * -0.5) * pow((D_m * (0.5 * (M_m / d))), 2.0)) / l)) * sqrt((d / h)));
} else {
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 - (0.5 * ((h / l) * pow(((M_m * (D_m * 0.5)) / d), 2.0))));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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_m
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(-d)
if (l <= (-1.25d-147)) then
tmp = ((t_0 / sqrt(-h)) * (1.0d0 + ((h / l) * ((-0.5d0) * ((d_m * ((m_m / 2.0d0) / d)) ** 2.0d0))))) * sqrt((d / l))
else if (l <= (-5d-310)) then
tmp = (t_0 / sqrt(-l)) * ((1.0d0 + (((h * (-0.5d0)) * ((d_m * (0.5d0 * (m_m / d))) ** 2.0d0)) / l)) * sqrt((d / h)))
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0d0 - (0.5d0 * ((h / l) * (((m_m * (d_m * 0.5d0)) / d) ** 2.0d0))))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.sqrt(-d);
double tmp;
if (l <= -1.25e-147) {
tmp = ((t_0 / Math.sqrt(-h)) * (1.0 + ((h / l) * (-0.5 * Math.pow((D_m * ((M_m / 2.0) / d)), 2.0))))) * Math.sqrt((d / l));
} else if (l <= -5e-310) {
tmp = (t_0 / Math.sqrt(-l)) * ((1.0 + (((h * -0.5) * Math.pow((D_m * (0.5 * (M_m / d))), 2.0)) / l)) * Math.sqrt((d / h)));
} else {
tmp = (d / (Math.sqrt(l) * Math.sqrt(h))) * (1.0 - (0.5 * ((h / l) * Math.pow(((M_m * (D_m * 0.5)) / d), 2.0))));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.sqrt(-d) tmp = 0 if l <= -1.25e-147: tmp = ((t_0 / math.sqrt(-h)) * (1.0 + ((h / l) * (-0.5 * math.pow((D_m * ((M_m / 2.0) / d)), 2.0))))) * math.sqrt((d / l)) elif l <= -5e-310: tmp = (t_0 / math.sqrt(-l)) * ((1.0 + (((h * -0.5) * math.pow((D_m * (0.5 * (M_m / d))), 2.0)) / l)) * math.sqrt((d / h))) else: tmp = (d / (math.sqrt(l) * math.sqrt(h))) * (1.0 - (0.5 * ((h / l) * math.pow(((M_m * (D_m * 0.5)) / d), 2.0)))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(-d)) tmp = 0.0 if (l <= -1.25e-147) tmp = Float64(Float64(Float64(t_0 / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(D_m * Float64(Float64(M_m / 2.0) / d)) ^ 2.0))))) * sqrt(Float64(d / l))); elseif (l <= -5e-310) tmp = Float64(Float64(t_0 / sqrt(Float64(-l))) * Float64(Float64(1.0 + Float64(Float64(Float64(h * -0.5) * (Float64(D_m * Float64(0.5 * Float64(M_m / d))) ^ 2.0)) / l)) * sqrt(Float64(d / h)))); else tmp = Float64(Float64(d / Float64(sqrt(l) * sqrt(h))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m * Float64(D_m * 0.5)) / d) ^ 2.0))))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = sqrt(-d);
tmp = 0.0;
if (l <= -1.25e-147)
tmp = ((t_0 / sqrt(-h)) * (1.0 + ((h / l) * (-0.5 * ((D_m * ((M_m / 2.0) / d)) ^ 2.0))))) * sqrt((d / l));
elseif (l <= -5e-310)
tmp = (t_0 / sqrt(-l)) * ((1.0 + (((h * -0.5) * ((D_m * (0.5 * (M_m / d))) ^ 2.0)) / l)) * sqrt((d / h)));
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 - (0.5 * ((h / l) * (((M_m * (D_m * 0.5)) / d) ^ 2.0))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[l, -1.25e-147], N[(N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D$95$m * N[(N[(M$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-310], N[(N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(N[(N[(h * -0.5), $MachinePrecision] * N[Power[N[(D$95$m * N[(0.5 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
\mathbf{if}\;\ell \leq -1.25 \cdot 10^{-147}:\\
\;\;\;\;\left(\frac{t\_0}{\sqrt{-h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(D\_m \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2}\right)\right)\right) \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{t\_0}{\sqrt{-\ell}} \cdot \left(\left(1 + \frac{\left(h \cdot -0.5\right) \cdot {\left(D\_m \cdot \left(0.5 \cdot \frac{M\_m}{d}\right)\right)}^{2}}{\ell}\right) \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m \cdot \left(D\_m \cdot 0.5\right)}{d}\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if l < -1.25000000000000003e-147Initial program 78.3%
Simplified78.3%
frac-2neg76.7%
sqrt-div84.1%
Applied egg-rr85.7%
if -1.25000000000000003e-147 < l < -4.999999999999985e-310Initial program 69.4%
Simplified64.0%
associate-*l/73.1%
Applied egg-rr73.1%
frac-2neg73.0%
sqrt-div86.1%
Applied egg-rr86.2%
if -4.999999999999985e-310 < l Initial program 65.7%
Simplified64.8%
*-commutative64.8%
sqrt-div67.6%
sqrt-div78.4%
frac-times78.3%
add-sqr-sqrt78.5%
Applied egg-rr78.5%
associate-*r/79.3%
div-inv79.3%
metadata-eval79.3%
associate-*l*79.3%
Applied egg-rr79.3%
Final simplification82.9%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* D_m (* 0.5 (/ M_m d)))))
(if (<= d -8.2e-292)
(*
(*
(/ (sqrt (- d)) (sqrt (- h)))
(+ 1.0 (/ (* (* h -0.5) (pow t_0 2.0)) l)))
(sqrt (/ d l)))
(if (<= d 4.6e-17)
(*
(* d (sqrt (/ 1.0 (* l h))))
(- 1.0 (* 0.5 (pow (* t_0 (/ (sqrt h) (sqrt l))) 2.0))))
(*
(* d (/ (sqrt (/ 1.0 l)) (sqrt h)))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D_m d)) 2.0)))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = D_m * (0.5 * (M_m / d));
double tmp;
if (d <= -8.2e-292) {
tmp = ((sqrt(-d) / sqrt(-h)) * (1.0 + (((h * -0.5) * pow(t_0, 2.0)) / l))) * sqrt((d / l));
} else if (d <= 4.6e-17) {
tmp = (d * sqrt((1.0 / (l * h)))) * (1.0 - (0.5 * pow((t_0 * (sqrt(h) / sqrt(l))), 2.0)));
} else {
tmp = (d * (sqrt((1.0 / l)) / sqrt(h))) * (1.0 - (0.5 * ((h / l) * pow(((M_m / 2.0) * (D_m / d)), 2.0))));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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_m
real(8) :: t_0
real(8) :: tmp
t_0 = d_m * (0.5d0 * (m_m / d))
if (d <= (-8.2d-292)) then
tmp = ((sqrt(-d) / sqrt(-h)) * (1.0d0 + (((h * (-0.5d0)) * (t_0 ** 2.0d0)) / l))) * sqrt((d / l))
else if (d <= 4.6d-17) then
tmp = (d * sqrt((1.0d0 / (l * h)))) * (1.0d0 - (0.5d0 * ((t_0 * (sqrt(h) / sqrt(l))) ** 2.0d0)))
else
tmp = (d * (sqrt((1.0d0 / l)) / sqrt(h))) * (1.0d0 - (0.5d0 * ((h / l) * (((m_m / 2.0d0) * (d_m / d)) ** 2.0d0))))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = D_m * (0.5 * (M_m / d));
double tmp;
if (d <= -8.2e-292) {
tmp = ((Math.sqrt(-d) / Math.sqrt(-h)) * (1.0 + (((h * -0.5) * Math.pow(t_0, 2.0)) / l))) * Math.sqrt((d / l));
} else if (d <= 4.6e-17) {
tmp = (d * Math.sqrt((1.0 / (l * h)))) * (1.0 - (0.5 * Math.pow((t_0 * (Math.sqrt(h) / Math.sqrt(l))), 2.0)));
} else {
tmp = (d * (Math.sqrt((1.0 / l)) / Math.sqrt(h))) * (1.0 - (0.5 * ((h / l) * Math.pow(((M_m / 2.0) * (D_m / d)), 2.0))));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = D_m * (0.5 * (M_m / d)) tmp = 0 if d <= -8.2e-292: tmp = ((math.sqrt(-d) / math.sqrt(-h)) * (1.0 + (((h * -0.5) * math.pow(t_0, 2.0)) / l))) * math.sqrt((d / l)) elif d <= 4.6e-17: tmp = (d * math.sqrt((1.0 / (l * h)))) * (1.0 - (0.5 * math.pow((t_0 * (math.sqrt(h) / math.sqrt(l))), 2.0))) else: tmp = (d * (math.sqrt((1.0 / l)) / math.sqrt(h))) * (1.0 - (0.5 * ((h / l) * math.pow(((M_m / 2.0) * (D_m / d)), 2.0)))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(D_m * Float64(0.5 * Float64(M_m / d))) tmp = 0.0 if (d <= -8.2e-292) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(Float64(h * -0.5) * (t_0 ^ 2.0)) / l))) * sqrt(Float64(d / l))); elseif (d <= 4.6e-17) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(1.0 - Float64(0.5 * (Float64(t_0 * Float64(sqrt(h) / sqrt(l))) ^ 2.0)))); else tmp = Float64(Float64(d * Float64(sqrt(Float64(1.0 / l)) / sqrt(h))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D_m / d)) ^ 2.0))))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = D_m * (0.5 * (M_m / d));
tmp = 0.0;
if (d <= -8.2e-292)
tmp = ((sqrt(-d) / sqrt(-h)) * (1.0 + (((h * -0.5) * (t_0 ^ 2.0)) / l))) * sqrt((d / l));
elseif (d <= 4.6e-17)
tmp = (d * sqrt((1.0 / (l * h)))) * (1.0 - (0.5 * ((t_0 * (sqrt(h) / sqrt(l))) ^ 2.0)));
else
tmp = (d * (sqrt((1.0 / l)) / sqrt(h))) * (1.0 - (0.5 * ((h / l) * (((M_m / 2.0) * (D_m / d)) ^ 2.0))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(D$95$m * N[(0.5 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -8.2e-292], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(N[(h * -0.5), $MachinePrecision] * N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 4.6e-17], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[Power[N[(t$95$0 * N[(N[Sqrt[h], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d * N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := D\_m \cdot \left(0.5 \cdot \frac{M\_m}{d}\right)\\
\mathbf{if}\;d \leq -8.2 \cdot 10^{-292}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(1 + \frac{\left(h \cdot -0.5\right) \cdot {t\_0}^{2}}{\ell}\right)\right) \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;d \leq 4.6 \cdot 10^{-17}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - 0.5 \cdot {\left(t\_0 \cdot \frac{\sqrt{h}}{\sqrt{\ell}}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\right) \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if d < -8.20000000000000087e-292Initial program 76.6%
Simplified75.1%
associate-*l/76.3%
Applied egg-rr76.3%
frac-2neg76.3%
sqrt-div81.9%
Applied egg-rr81.9%
if -8.20000000000000087e-292 < d < 4.60000000000000018e-17Initial program 53.1%
Simplified51.5%
add-sqr-sqrt51.5%
pow251.5%
sqrt-prod51.4%
sqrt-pow154.8%
*-commutative54.8%
metadata-eval54.8%
pow154.8%
div-inv54.8%
associate-*l*53.0%
times-frac53.0%
*-commutative53.0%
times-frac53.0%
metadata-eval53.0%
Applied egg-rr53.0%
sqrt-div55.6%
Applied egg-rr55.6%
Taylor expanded in d around 0 66.8%
*-commutative66.8%
Simplified66.8%
if 4.60000000000000018e-17 < d Initial program 78.7%
Simplified78.7%
Taylor expanded in d around 0 71.4%
*-commutative79.2%
Simplified71.4%
associate-/r*71.5%
sqrt-div90.6%
Applied egg-rr90.6%
Final simplification80.1%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (/ d l))))
(if (<= l -3.9e-152)
(*
(*
(/ (sqrt (- d)) (sqrt (- h)))
(+ 1.0 (* (/ h l) (* -0.5 (pow (* D_m (/ (/ M_m 2.0) d)) 2.0)))))
t_0)
(if (<= l 2e-308)
(*
t_0
(*
(sqrt (/ d h))
(+ 1.0 (/ (* (* h -0.5) (pow (* 0.5 (/ (* D_m M_m) d)) 2.0)) l))))
(*
(/ d (* (sqrt l) (sqrt h)))
(- 1.0 (* 0.5 (* (/ h l) (pow (/ (* M_m (* D_m 0.5)) d) 2.0)))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt((d / l));
double tmp;
if (l <= -3.9e-152) {
tmp = ((sqrt(-d) / sqrt(-h)) * (1.0 + ((h / l) * (-0.5 * pow((D_m * ((M_m / 2.0) / d)), 2.0))))) * t_0;
} else if (l <= 2e-308) {
tmp = t_0 * (sqrt((d / h)) * (1.0 + (((h * -0.5) * pow((0.5 * ((D_m * M_m) / d)), 2.0)) / l)));
} else {
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 - (0.5 * ((h / l) * pow(((M_m * (D_m * 0.5)) / d), 2.0))));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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_m
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((d / l))
if (l <= (-3.9d-152)) then
tmp = ((sqrt(-d) / sqrt(-h)) * (1.0d0 + ((h / l) * ((-0.5d0) * ((d_m * ((m_m / 2.0d0) / d)) ** 2.0d0))))) * t_0
else if (l <= 2d-308) then
tmp = t_0 * (sqrt((d / h)) * (1.0d0 + (((h * (-0.5d0)) * ((0.5d0 * ((d_m * m_m) / d)) ** 2.0d0)) / l)))
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0d0 - (0.5d0 * ((h / l) * (((m_m * (d_m * 0.5d0)) / d) ** 2.0d0))))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.sqrt((d / l));
double tmp;
if (l <= -3.9e-152) {
tmp = ((Math.sqrt(-d) / Math.sqrt(-h)) * (1.0 + ((h / l) * (-0.5 * Math.pow((D_m * ((M_m / 2.0) / d)), 2.0))))) * t_0;
} else if (l <= 2e-308) {
tmp = t_0 * (Math.sqrt((d / h)) * (1.0 + (((h * -0.5) * Math.pow((0.5 * ((D_m * M_m) / d)), 2.0)) / l)));
} else {
tmp = (d / (Math.sqrt(l) * Math.sqrt(h))) * (1.0 - (0.5 * ((h / l) * Math.pow(((M_m * (D_m * 0.5)) / d), 2.0))));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.sqrt((d / l)) tmp = 0 if l <= -3.9e-152: tmp = ((math.sqrt(-d) / math.sqrt(-h)) * (1.0 + ((h / l) * (-0.5 * math.pow((D_m * ((M_m / 2.0) / d)), 2.0))))) * t_0 elif l <= 2e-308: tmp = t_0 * (math.sqrt((d / h)) * (1.0 + (((h * -0.5) * math.pow((0.5 * ((D_m * M_m) / d)), 2.0)) / l))) else: tmp = (d / (math.sqrt(l) * math.sqrt(h))) * (1.0 - (0.5 * ((h / l) * math.pow(((M_m * (D_m * 0.5)) / d), 2.0)))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= -3.9e-152) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(D_m * Float64(Float64(M_m / 2.0) / d)) ^ 2.0))))) * t_0); elseif (l <= 2e-308) tmp = Float64(t_0 * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(Float64(h * -0.5) * (Float64(0.5 * Float64(Float64(D_m * M_m) / d)) ^ 2.0)) / l)))); else tmp = Float64(Float64(d / Float64(sqrt(l) * sqrt(h))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m * Float64(D_m * 0.5)) / d) ^ 2.0))))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = sqrt((d / l));
tmp = 0.0;
if (l <= -3.9e-152)
tmp = ((sqrt(-d) / sqrt(-h)) * (1.0 + ((h / l) * (-0.5 * ((D_m * ((M_m / 2.0) / d)) ^ 2.0))))) * t_0;
elseif (l <= 2e-308)
tmp = t_0 * (sqrt((d / h)) * (1.0 + (((h * -0.5) * ((0.5 * ((D_m * M_m) / d)) ^ 2.0)) / l)));
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 - (0.5 * ((h / l) * (((M_m * (D_m * 0.5)) / d) ^ 2.0))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -3.9e-152], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D$95$m * N[(N[(M$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[l, 2e-308], N[(t$95$0 * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(N[(h * -0.5), $MachinePrecision] * N[Power[N[(0.5 * N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -3.9 \cdot 10^{-152}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(D\_m \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2}\right)\right)\right) \cdot t\_0\\
\mathbf{elif}\;\ell \leq 2 \cdot 10^{-308}:\\
\;\;\;\;t\_0 \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left(h \cdot -0.5\right) \cdot {\left(0.5 \cdot \frac{D\_m \cdot M\_m}{d}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m \cdot \left(D\_m \cdot 0.5\right)}{d}\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if l < -3.9000000000000004e-152Initial program 78.3%
Simplified78.3%
frac-2neg76.7%
sqrt-div84.1%
Applied egg-rr85.7%
if -3.9000000000000004e-152 < l < 1.9999999999999998e-308Initial program 69.4%
Simplified64.0%
associate-*l/73.1%
Applied egg-rr73.1%
Taylor expanded in D around 0 78.5%
if 1.9999999999999998e-308 < l Initial program 65.7%
Simplified64.8%
*-commutative64.8%
sqrt-div67.6%
sqrt-div78.4%
frac-times78.3%
add-sqr-sqrt78.5%
Applied egg-rr78.5%
associate-*r/79.3%
div-inv79.3%
metadata-eval79.3%
associate-*l*79.3%
Applied egg-rr79.3%
Final simplification81.8%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= h -9.5e+176)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+ 1.0 (* (* h -0.5) (/ (pow (* M_m (* 0.5 (/ D_m d))) 2.0) l)))))
(if (<= h -1e-310)
(*
(* d (sqrt (/ (/ 1.0 l) h)))
(+ (* 0.5 (pow (* (* 0.5 (/ (* D_m M_m) d)) (sqrt (/ h l))) 2.0)) -1.0))
(*
(/ d (* (sqrt l) (sqrt h)))
(- 1.0 (* 0.5 (* (/ h l) (pow (/ (* M_m (* D_m 0.5)) d) 2.0))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (h <= -9.5e+176) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h * -0.5) * (pow((M_m * (0.5 * (D_m / d))), 2.0) / l))));
} else if (h <= -1e-310) {
tmp = (d * sqrt(((1.0 / l) / h))) * ((0.5 * pow(((0.5 * ((D_m * M_m) / d)) * sqrt((h / l))), 2.0)) + -1.0);
} else {
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 - (0.5 * ((h / l) * pow(((M_m * (D_m * 0.5)) / d), 2.0))));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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_m
real(8) :: tmp
if (h <= (-9.5d+176)) then
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 + ((h * (-0.5d0)) * (((m_m * (0.5d0 * (d_m / d))) ** 2.0d0) / l))))
else if (h <= (-1d-310)) then
tmp = (d * sqrt(((1.0d0 / l) / h))) * ((0.5d0 * (((0.5d0 * ((d_m * m_m) / d)) * sqrt((h / l))) ** 2.0d0)) + (-1.0d0))
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0d0 - (0.5d0 * ((h / l) * (((m_m * (d_m * 0.5d0)) / d) ** 2.0d0))))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (h <= -9.5e+176) {
tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + ((h * -0.5) * (Math.pow((M_m * (0.5 * (D_m / d))), 2.0) / l))));
} else if (h <= -1e-310) {
tmp = (d * Math.sqrt(((1.0 / l) / h))) * ((0.5 * Math.pow(((0.5 * ((D_m * M_m) / d)) * Math.sqrt((h / l))), 2.0)) + -1.0);
} else {
tmp = (d / (Math.sqrt(l) * Math.sqrt(h))) * (1.0 - (0.5 * ((h / l) * Math.pow(((M_m * (D_m * 0.5)) / d), 2.0))));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if h <= -9.5e+176: tmp = math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + ((h * -0.5) * (math.pow((M_m * (0.5 * (D_m / d))), 2.0) / l)))) elif h <= -1e-310: tmp = (d * math.sqrt(((1.0 / l) / h))) * ((0.5 * math.pow(((0.5 * ((D_m * M_m) / d)) * math.sqrt((h / l))), 2.0)) + -1.0) else: tmp = (d / (math.sqrt(l) * math.sqrt(h))) * (1.0 - (0.5 * ((h / l) * math.pow(((M_m * (D_m * 0.5)) / d), 2.0)))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (h <= -9.5e+176) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(h * -0.5) * Float64((Float64(M_m * Float64(0.5 * Float64(D_m / d))) ^ 2.0) / l))))); elseif (h <= -1e-310) tmp = Float64(Float64(d * sqrt(Float64(Float64(1.0 / l) / h))) * Float64(Float64(0.5 * (Float64(Float64(0.5 * Float64(Float64(D_m * M_m) / d)) * sqrt(Float64(h / l))) ^ 2.0)) + -1.0)); else tmp = Float64(Float64(d / Float64(sqrt(l) * sqrt(h))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m * Float64(D_m * 0.5)) / d) ^ 2.0))))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (h <= -9.5e+176)
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h * -0.5) * (((M_m * (0.5 * (D_m / d))) ^ 2.0) / l))));
elseif (h <= -1e-310)
tmp = (d * sqrt(((1.0 / l) / h))) * ((0.5 * (((0.5 * ((D_m * M_m) / d)) * sqrt((h / l))) ^ 2.0)) + -1.0);
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 - (0.5 * ((h / l) * (((M_m * (D_m * 0.5)) / d) ^ 2.0))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[h, -9.5e+176], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h * -0.5), $MachinePrecision] * N[(N[Power[N[(M$95$m * N[(0.5 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -1e-310], N[(N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(0.5 * N[Power[N[(N[(0.5 * N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -9.5 \cdot 10^{+176}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \left(h \cdot -0.5\right) \cdot \frac{{\left(M\_m \cdot \left(0.5 \cdot \frac{D\_m}{d}\right)\right)}^{2}}{\ell}\right)\right)\\
\mathbf{elif}\;h \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(0.5 \cdot {\left(\left(0.5 \cdot \frac{D\_m \cdot M\_m}{d}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2} + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m \cdot \left(D\_m \cdot 0.5\right)}{d}\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if h < -9.4999999999999995e176Initial program 63.7%
Simplified60.9%
associate-*l/62.2%
Applied egg-rr62.2%
associate-/l*69.7%
associate-*r/69.7%
*-commutative69.7%
associate-/l*72.6%
associate-*l/72.5%
*-commutative72.5%
associate-*l*72.5%
Simplified72.5%
if -9.4999999999999995e176 < h < -9.999999999999969e-311Initial program 80.3%
Simplified77.5%
add-sqr-sqrt77.5%
pow277.5%
sqrt-prod77.5%
sqrt-pow178.4%
*-commutative78.4%
metadata-eval78.4%
pow178.4%
div-inv78.4%
associate-*l*80.2%
times-frac80.2%
*-commutative80.2%
times-frac80.2%
metadata-eval80.2%
Applied egg-rr80.2%
Taylor expanded in D around 0 81.2%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt83.3%
neg-mul-183.3%
Simplified83.3%
if -9.999999999999969e-311 < h Initial program 65.7%
Simplified64.8%
*-commutative64.8%
sqrt-div67.6%
sqrt-div78.4%
frac-times78.3%
add-sqr-sqrt78.5%
Applied egg-rr78.5%
associate-*r/79.3%
div-inv79.3%
metadata-eval79.3%
associate-*l*79.3%
Applied egg-rr79.3%
Final simplification80.0%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= h -3.6e+183)
(*
(sqrt (* (/ d h) (/ d l)))
(+ 1.0 (* -0.5 (* (/ h l) (pow (* (/ M_m d) (* D_m 0.5)) 2.0)))))
(if (<= h -1e-310)
(*
(* d (sqrt (/ (/ 1.0 l) h)))
(+ (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D_m d)) 2.0))) -1.0))
(*
(/ d (* (sqrt l) (sqrt h)))
(- 1.0 (* 0.5 (* (/ h l) (pow (/ (* M_m (* D_m 0.5)) d) 2.0))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (h <= -3.6e+183) {
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * pow(((M_m / d) * (D_m * 0.5)), 2.0))));
} else if (h <= -1e-310) {
tmp = (d * sqrt(((1.0 / l) / h))) * ((0.5 * ((h / l) * pow(((M_m / 2.0) * (D_m / d)), 2.0))) + -1.0);
} else {
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 - (0.5 * ((h / l) * pow(((M_m * (D_m * 0.5)) / d), 2.0))));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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_m
real(8) :: tmp
if (h <= (-3.6d+183)) then
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 + ((-0.5d0) * ((h / l) * (((m_m / d) * (d_m * 0.5d0)) ** 2.0d0))))
else if (h <= (-1d-310)) then
tmp = (d * sqrt(((1.0d0 / l) / h))) * ((0.5d0 * ((h / l) * (((m_m / 2.0d0) * (d_m / d)) ** 2.0d0))) + (-1.0d0))
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0d0 - (0.5d0 * ((h / l) * (((m_m * (d_m * 0.5d0)) / d) ** 2.0d0))))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (h <= -3.6e+183) {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * Math.pow(((M_m / d) * (D_m * 0.5)), 2.0))));
} else if (h <= -1e-310) {
tmp = (d * Math.sqrt(((1.0 / l) / h))) * ((0.5 * ((h / l) * Math.pow(((M_m / 2.0) * (D_m / d)), 2.0))) + -1.0);
} else {
tmp = (d / (Math.sqrt(l) * Math.sqrt(h))) * (1.0 - (0.5 * ((h / l) * Math.pow(((M_m * (D_m * 0.5)) / d), 2.0))));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if h <= -3.6e+183: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * math.pow(((M_m / d) * (D_m * 0.5)), 2.0)))) elif h <= -1e-310: tmp = (d * math.sqrt(((1.0 / l) / h))) * ((0.5 * ((h / l) * math.pow(((M_m / 2.0) * (D_m / d)), 2.0))) + -1.0) else: tmp = (d / (math.sqrt(l) * math.sqrt(h))) * (1.0 - (0.5 * ((h / l) * math.pow(((M_m * (D_m * 0.5)) / d), 2.0)))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (h <= -3.6e+183) tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / d) * Float64(D_m * 0.5)) ^ 2.0))))); elseif (h <= -1e-310) tmp = Float64(Float64(d * sqrt(Float64(Float64(1.0 / l) / h))) * Float64(Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D_m / d)) ^ 2.0))) + -1.0)); else tmp = Float64(Float64(d / Float64(sqrt(l) * sqrt(h))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m * Float64(D_m * 0.5)) / d) ^ 2.0))))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (h <= -3.6e+183)
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * (((M_m / d) * (D_m * 0.5)) ^ 2.0))));
elseif (h <= -1e-310)
tmp = (d * sqrt(((1.0 / l) / h))) * ((0.5 * ((h / l) * (((M_m / 2.0) * (D_m / d)) ^ 2.0))) + -1.0);
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 - (0.5 * ((h / l) * (((M_m * (D_m * 0.5)) / d) ^ 2.0))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[h, -3.6e+183], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / d), $MachinePrecision] * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -1e-310], N[(N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -3.6 \cdot 10^{+183}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{d} \cdot \left(D\_m \cdot 0.5\right)\right)}^{2}\right)\right)\\
\mathbf{elif}\;h \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right) + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m \cdot \left(D\_m \cdot 0.5\right)}{d}\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if h < -3.60000000000000023e183Initial program 63.7%
Simplified63.7%
add-sqr-sqrt63.7%
pow263.7%
sqrt-prod63.7%
sqrt-pow163.7%
*-commutative63.7%
metadata-eval63.7%
pow163.7%
div-inv63.7%
associate-*l*61.2%
times-frac61.2%
*-commutative61.2%
times-frac61.2%
metadata-eval61.2%
Applied egg-rr61.2%
pow161.2%
sqrt-unprod51.8%
cancel-sign-sub-inv51.8%
metadata-eval51.8%
*-commutative51.8%
unpow-prod-down51.6%
pow251.6%
add-sqr-sqrt51.6%
associate-*r*51.6%
Applied egg-rr51.6%
unpow151.6%
*-lft-identity51.6%
*-lft-identity51.6%
*-commutative51.6%
Simplified51.6%
if -3.60000000000000023e183 < h < -9.999999999999969e-311Initial program 80.3%
Simplified77.5%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt83.3%
neg-mul-183.3%
Simplified81.4%
if -9.999999999999969e-311 < h Initial program 65.7%
Simplified64.8%
*-commutative64.8%
sqrt-div67.6%
sqrt-div78.4%
frac-times78.3%
add-sqr-sqrt78.5%
Applied egg-rr78.5%
associate-*r/79.3%
div-inv79.3%
metadata-eval79.3%
associate-*l*79.3%
Applied egg-rr79.3%
Final simplification76.2%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D_m d)) 2.0)))))
(if (<= h -6.2e+181)
(*
(sqrt (* (/ d h) (/ d l)))
(+ 1.0 (* -0.5 (* (/ h l) (pow (* (/ M_m d) (* D_m 0.5)) 2.0)))))
(if (<= h -1e-310)
(* (* d (sqrt (/ (/ 1.0 l) h))) (+ t_0 -1.0))
(* (/ d (* (sqrt l) (sqrt h))) (- 1.0 t_0))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = 0.5 * ((h / l) * pow(((M_m / 2.0) * (D_m / d)), 2.0));
double tmp;
if (h <= -6.2e+181) {
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * pow(((M_m / d) * (D_m * 0.5)), 2.0))));
} else if (h <= -1e-310) {
tmp = (d * sqrt(((1.0 / l) / h))) * (t_0 + -1.0);
} else {
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 - t_0);
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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_m
real(8) :: t_0
real(8) :: tmp
t_0 = 0.5d0 * ((h / l) * (((m_m / 2.0d0) * (d_m / d)) ** 2.0d0))
if (h <= (-6.2d+181)) then
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 + ((-0.5d0) * ((h / l) * (((m_m / d) * (d_m * 0.5d0)) ** 2.0d0))))
else if (h <= (-1d-310)) then
tmp = (d * sqrt(((1.0d0 / l) / h))) * (t_0 + (-1.0d0))
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0d0 - t_0)
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = 0.5 * ((h / l) * Math.pow(((M_m / 2.0) * (D_m / d)), 2.0));
double tmp;
if (h <= -6.2e+181) {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * Math.pow(((M_m / d) * (D_m * 0.5)), 2.0))));
} else if (h <= -1e-310) {
tmp = (d * Math.sqrt(((1.0 / l) / h))) * (t_0 + -1.0);
} else {
tmp = (d / (Math.sqrt(l) * Math.sqrt(h))) * (1.0 - t_0);
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = 0.5 * ((h / l) * math.pow(((M_m / 2.0) * (D_m / d)), 2.0)) tmp = 0 if h <= -6.2e+181: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * math.pow(((M_m / d) * (D_m * 0.5)), 2.0)))) elif h <= -1e-310: tmp = (d * math.sqrt(((1.0 / l) / h))) * (t_0 + -1.0) else: tmp = (d / (math.sqrt(l) * math.sqrt(h))) * (1.0 - t_0) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D_m / d)) ^ 2.0))) tmp = 0.0 if (h <= -6.2e+181) tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / d) * Float64(D_m * 0.5)) ^ 2.0))))); elseif (h <= -1e-310) tmp = Float64(Float64(d * sqrt(Float64(Float64(1.0 / l) / h))) * Float64(t_0 + -1.0)); else tmp = Float64(Float64(d / Float64(sqrt(l) * sqrt(h))) * Float64(1.0 - t_0)); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = 0.5 * ((h / l) * (((M_m / 2.0) * (D_m / d)) ^ 2.0));
tmp = 0.0;
if (h <= -6.2e+181)
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * (((M_m / d) * (D_m * 0.5)) ^ 2.0))));
elseif (h <= -1e-310)
tmp = (d * sqrt(((1.0 / l) / h))) * (t_0 + -1.0);
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 - t_0);
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -6.2e+181], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / d), $MachinePrecision] * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -1e-310], N[(N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right)\\
\mathbf{if}\;h \leq -6.2 \cdot 10^{+181}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{d} \cdot \left(D\_m \cdot 0.5\right)\right)}^{2}\right)\right)\\
\mathbf{elif}\;h \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(t\_0 + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(1 - t\_0\right)\\
\end{array}
\end{array}
if h < -6.19999999999999978e181Initial program 63.7%
Simplified63.7%
add-sqr-sqrt63.7%
pow263.7%
sqrt-prod63.7%
sqrt-pow163.7%
*-commutative63.7%
metadata-eval63.7%
pow163.7%
div-inv63.7%
associate-*l*61.2%
times-frac61.2%
*-commutative61.2%
times-frac61.2%
metadata-eval61.2%
Applied egg-rr61.2%
pow161.2%
sqrt-unprod51.8%
cancel-sign-sub-inv51.8%
metadata-eval51.8%
*-commutative51.8%
unpow-prod-down51.6%
pow251.6%
add-sqr-sqrt51.6%
associate-*r*51.6%
Applied egg-rr51.6%
unpow151.6%
*-lft-identity51.6%
*-lft-identity51.6%
*-commutative51.6%
Simplified51.6%
if -6.19999999999999978e181 < h < -9.999999999999969e-311Initial program 80.3%
Simplified77.5%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt83.3%
neg-mul-183.3%
Simplified81.4%
if -9.999999999999969e-311 < h Initial program 65.7%
Simplified64.8%
*-commutative64.8%
sqrt-div67.6%
sqrt-div78.4%
frac-times78.3%
add-sqr-sqrt78.5%
Applied egg-rr78.5%
Final simplification75.9%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= d -8.2e-292)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+ 1.0 (/ (* (* h -0.5) (pow (* 0.5 (/ (* D_m M_m) d)) 2.0)) l))))
(*
(/ d (* (sqrt l) (sqrt h)))
(- 1.0 (* 0.5 (* (/ h l) (pow (/ (* M_m (* D_m 0.5)) d) 2.0)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -8.2e-292) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + (((h * -0.5) * pow((0.5 * ((D_m * M_m) / d)), 2.0)) / l)));
} else {
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 - (0.5 * ((h / l) * pow(((M_m * (D_m * 0.5)) / d), 2.0))));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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_m
real(8) :: tmp
if (d <= (-8.2d-292)) then
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 + (((h * (-0.5d0)) * ((0.5d0 * ((d_m * m_m) / d)) ** 2.0d0)) / l)))
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0d0 - (0.5d0 * ((h / l) * (((m_m * (d_m * 0.5d0)) / d) ** 2.0d0))))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -8.2e-292) {
tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + (((h * -0.5) * Math.pow((0.5 * ((D_m * M_m) / d)), 2.0)) / l)));
} else {
tmp = (d / (Math.sqrt(l) * Math.sqrt(h))) * (1.0 - (0.5 * ((h / l) * Math.pow(((M_m * (D_m * 0.5)) / d), 2.0))));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if d <= -8.2e-292: tmp = math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + (((h * -0.5) * math.pow((0.5 * ((D_m * M_m) / d)), 2.0)) / l))) else: tmp = (d / (math.sqrt(l) * math.sqrt(h))) * (1.0 - (0.5 * ((h / l) * math.pow(((M_m * (D_m * 0.5)) / d), 2.0)))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= -8.2e-292) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(Float64(h * -0.5) * (Float64(0.5 * Float64(Float64(D_m * M_m) / d)) ^ 2.0)) / l)))); else tmp = Float64(Float64(d / Float64(sqrt(l) * sqrt(h))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m * Float64(D_m * 0.5)) / d) ^ 2.0))))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (d <= -8.2e-292)
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + (((h * -0.5) * ((0.5 * ((D_m * M_m) / d)) ^ 2.0)) / l)));
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 - (0.5 * ((h / l) * (((M_m * (D_m * 0.5)) / d) ^ 2.0))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, -8.2e-292], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(N[(h * -0.5), $MachinePrecision] * N[Power[N[(0.5 * N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -8.2 \cdot 10^{-292}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left(h \cdot -0.5\right) \cdot {\left(0.5 \cdot \frac{D\_m \cdot M\_m}{d}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m \cdot \left(D\_m \cdot 0.5\right)}{d}\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if d < -8.20000000000000087e-292Initial program 76.6%
Simplified75.1%
associate-*l/76.3%
Applied egg-rr76.3%
Taylor expanded in D around 0 77.7%
if -8.20000000000000087e-292 < d Initial program 65.1%
Simplified64.3%
*-commutative64.3%
sqrt-div67.0%
sqrt-div77.7%
frac-times77.7%
add-sqr-sqrt77.8%
Applied egg-rr77.8%
associate-*r/78.6%
div-inv78.6%
metadata-eval78.6%
associate-*l*78.6%
Applied egg-rr78.6%
Final simplification78.1%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= d -8.2e-292)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+ 1.0 (* (* h -0.5) (/ (pow (* M_m (* 0.5 (/ D_m d))) 2.0) l)))))
(*
(/ d (* (sqrt l) (sqrt h)))
(- 1.0 (* 0.5 (* (/ h l) (pow (/ (* M_m (* D_m 0.5)) d) 2.0)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -8.2e-292) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h * -0.5) * (pow((M_m * (0.5 * (D_m / d))), 2.0) / l))));
} else {
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 - (0.5 * ((h / l) * pow(((M_m * (D_m * 0.5)) / d), 2.0))));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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_m
real(8) :: tmp
if (d <= (-8.2d-292)) then
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 + ((h * (-0.5d0)) * (((m_m * (0.5d0 * (d_m / d))) ** 2.0d0) / l))))
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0d0 - (0.5d0 * ((h / l) * (((m_m * (d_m * 0.5d0)) / d) ** 2.0d0))))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -8.2e-292) {
tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + ((h * -0.5) * (Math.pow((M_m * (0.5 * (D_m / d))), 2.0) / l))));
} else {
tmp = (d / (Math.sqrt(l) * Math.sqrt(h))) * (1.0 - (0.5 * ((h / l) * Math.pow(((M_m * (D_m * 0.5)) / d), 2.0))));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if d <= -8.2e-292: tmp = math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + ((h * -0.5) * (math.pow((M_m * (0.5 * (D_m / d))), 2.0) / l)))) else: tmp = (d / (math.sqrt(l) * math.sqrt(h))) * (1.0 - (0.5 * ((h / l) * math.pow(((M_m * (D_m * 0.5)) / d), 2.0)))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= -8.2e-292) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(h * -0.5) * Float64((Float64(M_m * Float64(0.5 * Float64(D_m / d))) ^ 2.0) / l))))); else tmp = Float64(Float64(d / Float64(sqrt(l) * sqrt(h))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m * Float64(D_m * 0.5)) / d) ^ 2.0))))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (d <= -8.2e-292)
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h * -0.5) * (((M_m * (0.5 * (D_m / d))) ^ 2.0) / l))));
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 - (0.5 * ((h / l) * (((M_m * (D_m * 0.5)) / d) ^ 2.0))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, -8.2e-292], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h * -0.5), $MachinePrecision] * N[(N[Power[N[(M$95$m * N[(0.5 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -8.2 \cdot 10^{-292}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \left(h \cdot -0.5\right) \cdot \frac{{\left(M\_m \cdot \left(0.5 \cdot \frac{D\_m}{d}\right)\right)}^{2}}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m \cdot \left(D\_m \cdot 0.5\right)}{d}\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if d < -8.20000000000000087e-292Initial program 76.6%
Simplified75.1%
associate-*l/76.3%
Applied egg-rr76.3%
associate-/l*77.6%
associate-*r/77.6%
*-commutative77.6%
associate-/l*78.4%
associate-*l/76.9%
*-commutative76.9%
associate-*l*76.9%
Simplified76.9%
if -8.20000000000000087e-292 < d Initial program 65.1%
Simplified64.3%
*-commutative64.3%
sqrt-div67.0%
sqrt-div77.7%
frac-times77.7%
add-sqr-sqrt77.8%
Applied egg-rr77.8%
associate-*r/78.6%
div-inv78.6%
metadata-eval78.6%
associate-*l*78.6%
Applied egg-rr78.6%
Final simplification77.7%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l -4e+157)
(* (/ (sqrt (- d)) (sqrt (- h))) (sqrt (/ d l)))
(if (<= l -5e-310)
(*
(* d (sqrt (/ (/ 1.0 l) h)))
(+ (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D_m d)) 2.0))) -1.0))
(if (<= l 5.8e+126)
(*
(* d (sqrt (/ 1.0 (* l h))))
(+ 1.0 (* h (* -0.25 (* (pow (/ (* D_m M_m) d) 2.0) (/ 0.5 l))))))
(* (pow h -0.5) (/ d (sqrt l)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -4e+157) {
tmp = (sqrt(-d) / sqrt(-h)) * sqrt((d / l));
} else if (l <= -5e-310) {
tmp = (d * sqrt(((1.0 / l) / h))) * ((0.5 * ((h / l) * pow(((M_m / 2.0) * (D_m / d)), 2.0))) + -1.0);
} else if (l <= 5.8e+126) {
tmp = (d * sqrt((1.0 / (l * h)))) * (1.0 + (h * (-0.25 * (pow(((D_m * M_m) / d), 2.0) * (0.5 / l)))));
} else {
tmp = pow(h, -0.5) * (d / sqrt(l));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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_m
real(8) :: tmp
if (l <= (-4d+157)) then
tmp = (sqrt(-d) / sqrt(-h)) * sqrt((d / l))
else if (l <= (-5d-310)) then
tmp = (d * sqrt(((1.0d0 / l) / h))) * ((0.5d0 * ((h / l) * (((m_m / 2.0d0) * (d_m / d)) ** 2.0d0))) + (-1.0d0))
else if (l <= 5.8d+126) then
tmp = (d * sqrt((1.0d0 / (l * h)))) * (1.0d0 + (h * ((-0.25d0) * ((((d_m * m_m) / d) ** 2.0d0) * (0.5d0 / l)))))
else
tmp = (h ** (-0.5d0)) * (d / sqrt(l))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -4e+157) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * Math.sqrt((d / l));
} else if (l <= -5e-310) {
tmp = (d * Math.sqrt(((1.0 / l) / h))) * ((0.5 * ((h / l) * Math.pow(((M_m / 2.0) * (D_m / d)), 2.0))) + -1.0);
} else if (l <= 5.8e+126) {
tmp = (d * Math.sqrt((1.0 / (l * h)))) * (1.0 + (h * (-0.25 * (Math.pow(((D_m * M_m) / d), 2.0) * (0.5 / l)))));
} else {
tmp = Math.pow(h, -0.5) * (d / Math.sqrt(l));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= -4e+157: tmp = (math.sqrt(-d) / math.sqrt(-h)) * math.sqrt((d / l)) elif l <= -5e-310: tmp = (d * math.sqrt(((1.0 / l) / h))) * ((0.5 * ((h / l) * math.pow(((M_m / 2.0) * (D_m / d)), 2.0))) + -1.0) elif l <= 5.8e+126: tmp = (d * math.sqrt((1.0 / (l * h)))) * (1.0 + (h * (-0.25 * (math.pow(((D_m * M_m) / d), 2.0) * (0.5 / l))))) else: tmp = math.pow(h, -0.5) * (d / math.sqrt(l)) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -4e+157) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * sqrt(Float64(d / l))); elseif (l <= -5e-310) tmp = Float64(Float64(d * sqrt(Float64(Float64(1.0 / l) / h))) * Float64(Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D_m / d)) ^ 2.0))) + -1.0)); elseif (l <= 5.8e+126) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(1.0 + Float64(h * Float64(-0.25 * Float64((Float64(Float64(D_m * M_m) / d) ^ 2.0) * Float64(0.5 / l)))))); else tmp = Float64((h ^ -0.5) * Float64(d / sqrt(l))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= -4e+157)
tmp = (sqrt(-d) / sqrt(-h)) * sqrt((d / l));
elseif (l <= -5e-310)
tmp = (d * sqrt(((1.0 / l) / h))) * ((0.5 * ((h / l) * (((M_m / 2.0) * (D_m / d)) ^ 2.0))) + -1.0);
elseif (l <= 5.8e+126)
tmp = (d * sqrt((1.0 / (l * h)))) * (1.0 + (h * (-0.25 * ((((D_m * M_m) / d) ^ 2.0) * (0.5 / l)))));
else
tmp = (h ^ -0.5) * (d / sqrt(l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -4e+157], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-310], N[(N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.8e+126], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(h * N[(-0.25 * N[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[h, -0.5], $MachinePrecision] * N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4 \cdot 10^{+157}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right) + -1\right)\\
\mathbf{elif}\;\ell \leq 5.8 \cdot 10^{+126}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 + h \cdot \left(-0.25 \cdot \left({\left(\frac{D\_m \cdot M\_m}{d}\right)}^{2} \cdot \frac{0.5}{\ell}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;{h}^{-0.5} \cdot \frac{d}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -3.99999999999999993e157Initial program 70.8%
Simplified68.0%
add-sqr-sqrt68.0%
pow268.0%
sqrt-prod68.1%
sqrt-pow168.2%
*-commutative68.2%
metadata-eval68.2%
pow168.2%
div-inv68.2%
associate-*l*70.9%
times-frac70.9%
*-commutative70.9%
times-frac70.9%
metadata-eval70.9%
Applied egg-rr70.9%
Taylor expanded in D around 0 59.5%
frac-2neg68.4%
sqrt-div73.9%
Applied egg-rr65.1%
if -3.99999999999999993e157 < l < -4.999999999999985e-310Initial program 77.7%
Simplified75.9%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt77.0%
neg-mul-177.0%
Simplified75.9%
if -4.999999999999985e-310 < l < 5.79999999999999971e126Initial program 71.2%
Simplified70.1%
Taylor expanded in d around 0 78.4%
*-commutative86.0%
Simplified78.4%
add-sqr-sqrt78.4%
pow278.4%
*-commutative78.4%
sqrt-prod78.3%
*-commutative78.3%
sqrt-prod78.4%
sqrt-pow180.8%
metadata-eval80.8%
pow180.8%
associate-*r/80.8%
div-inv80.8%
metadata-eval80.8%
Applied egg-rr80.8%
Taylor expanded in h around inf 63.6%
sub-neg63.6%
distribute-lft-in63.6%
rgt-mult-inverse63.6%
distribute-lft-neg-in63.6%
metadata-eval63.6%
associate-*r*63.6%
unpow263.6%
rem-square-sqrt63.7%
times-frac62.8%
Simplified83.3%
if 5.79999999999999971e126 < l Initial program 52.2%
Simplified52.2%
add-sqr-sqrt52.2%
pow252.2%
sqrt-prod52.2%
sqrt-pow155.6%
*-commutative55.6%
metadata-eval55.6%
pow155.6%
div-inv55.6%
associate-*l*49.6%
times-frac49.6%
*-commutative49.6%
times-frac49.6%
metadata-eval49.6%
Applied egg-rr49.6%
Taylor expanded in d around inf 36.9%
unpow-136.9%
metadata-eval36.9%
pow-sqr36.9%
rem-sqrt-square36.9%
rem-square-sqrt36.8%
fabs-sqr36.8%
rem-square-sqrt36.9%
Simplified36.9%
Taylor expanded in d around 0 36.9%
*-commutative36.9%
unpow1/236.9%
rem-exp-log35.4%
rec-exp35.4%
exp-prod35.4%
distribute-lft-neg-out35.4%
exp-neg35.4%
exp-to-pow36.8%
unpow1/236.8%
associate-*l/36.8%
*-lft-identity36.8%
Simplified36.8%
*-un-lft-identity36.8%
sqrt-prod59.3%
times-frac59.3%
add-sqr-sqrt59.3%
sqrt-unprod25.2%
sqr-neg25.2%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
pow1/20.0%
pow-flip0.0%
add-sqr-sqrt0.0%
sqrt-unprod25.3%
sqr-neg25.3%
sqrt-unprod59.4%
add-sqr-sqrt59.7%
metadata-eval59.7%
Applied egg-rr59.7%
Final simplification74.7%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l -1.15e+151)
(/ (sqrt (/ d l)) (sqrt (/ h d)))
(if (<= l -5e-310)
(*
(* d (pow (* l h) -0.5))
(+ (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D_m d)) 2.0))) -1.0))
(if (<= l 2.55e+126)
(*
(* d (sqrt (/ 1.0 (* l h))))
(+ 1.0 (* h (* -0.25 (* (pow (/ (* D_m M_m) d) 2.0) (/ 0.5 l))))))
(* (pow h -0.5) (/ d (sqrt l)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -1.15e+151) {
tmp = sqrt((d / l)) / sqrt((h / d));
} else if (l <= -5e-310) {
tmp = (d * pow((l * h), -0.5)) * ((0.5 * ((h / l) * pow(((M_m / 2.0) * (D_m / d)), 2.0))) + -1.0);
} else if (l <= 2.55e+126) {
tmp = (d * sqrt((1.0 / (l * h)))) * (1.0 + (h * (-0.25 * (pow(((D_m * M_m) / d), 2.0) * (0.5 / l)))));
} else {
tmp = pow(h, -0.5) * (d / sqrt(l));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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_m
real(8) :: tmp
if (l <= (-1.15d+151)) then
tmp = sqrt((d / l)) / sqrt((h / d))
else if (l <= (-5d-310)) then
tmp = (d * ((l * h) ** (-0.5d0))) * ((0.5d0 * ((h / l) * (((m_m / 2.0d0) * (d_m / d)) ** 2.0d0))) + (-1.0d0))
else if (l <= 2.55d+126) then
tmp = (d * sqrt((1.0d0 / (l * h)))) * (1.0d0 + (h * ((-0.25d0) * ((((d_m * m_m) / d) ** 2.0d0) * (0.5d0 / l)))))
else
tmp = (h ** (-0.5d0)) * (d / sqrt(l))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -1.15e+151) {
tmp = Math.sqrt((d / l)) / Math.sqrt((h / d));
} else if (l <= -5e-310) {
tmp = (d * Math.pow((l * h), -0.5)) * ((0.5 * ((h / l) * Math.pow(((M_m / 2.0) * (D_m / d)), 2.0))) + -1.0);
} else if (l <= 2.55e+126) {
tmp = (d * Math.sqrt((1.0 / (l * h)))) * (1.0 + (h * (-0.25 * (Math.pow(((D_m * M_m) / d), 2.0) * (0.5 / l)))));
} else {
tmp = Math.pow(h, -0.5) * (d / Math.sqrt(l));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= -1.15e+151: tmp = math.sqrt((d / l)) / math.sqrt((h / d)) elif l <= -5e-310: tmp = (d * math.pow((l * h), -0.5)) * ((0.5 * ((h / l) * math.pow(((M_m / 2.0) * (D_m / d)), 2.0))) + -1.0) elif l <= 2.55e+126: tmp = (d * math.sqrt((1.0 / (l * h)))) * (1.0 + (h * (-0.25 * (math.pow(((D_m * M_m) / d), 2.0) * (0.5 / l))))) else: tmp = math.pow(h, -0.5) * (d / math.sqrt(l)) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -1.15e+151) tmp = Float64(sqrt(Float64(d / l)) / sqrt(Float64(h / d))); elseif (l <= -5e-310) tmp = Float64(Float64(d * (Float64(l * h) ^ -0.5)) * Float64(Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D_m / d)) ^ 2.0))) + -1.0)); elseif (l <= 2.55e+126) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(1.0 + Float64(h * Float64(-0.25 * Float64((Float64(Float64(D_m * M_m) / d) ^ 2.0) * Float64(0.5 / l)))))); else tmp = Float64((h ^ -0.5) * Float64(d / sqrt(l))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= -1.15e+151)
tmp = sqrt((d / l)) / sqrt((h / d));
elseif (l <= -5e-310)
tmp = (d * ((l * h) ^ -0.5)) * ((0.5 * ((h / l) * (((M_m / 2.0) * (D_m / d)) ^ 2.0))) + -1.0);
elseif (l <= 2.55e+126)
tmp = (d * sqrt((1.0 / (l * h)))) * (1.0 + (h * (-0.25 * ((((D_m * M_m) / d) ^ 2.0) * (0.5 / l)))));
else
tmp = (h ^ -0.5) * (d / sqrt(l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -1.15e+151], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-310], N[(N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] * N[(N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.55e+126], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(h * N[(-0.25 * N[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[h, -0.5], $MachinePrecision] * N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.15 \cdot 10^{+151}:\\
\;\;\;\;\frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\frac{h}{d}}}\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right) \cdot \left(0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right) + -1\right)\\
\mathbf{elif}\;\ell \leq 2.55 \cdot 10^{+126}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 + h \cdot \left(-0.25 \cdot \left({\left(\frac{D\_m \cdot M\_m}{d}\right)}^{2} \cdot \frac{0.5}{\ell}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;{h}^{-0.5} \cdot \frac{d}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -1.15e151Initial program 70.8%
Simplified68.0%
add-sqr-sqrt68.0%
pow268.0%
sqrt-prod68.1%
sqrt-pow168.2%
*-commutative68.2%
metadata-eval68.2%
pow168.2%
div-inv68.2%
associate-*l*70.9%
times-frac70.9%
*-commutative70.9%
times-frac70.9%
metadata-eval70.9%
Applied egg-rr70.9%
Taylor expanded in D around 0 59.5%
*-rgt-identity59.5%
*-commutative59.5%
frac-2neg59.5%
sqrt-undiv65.1%
clear-num65.0%
un-div-inv65.0%
sqrt-undiv61.6%
frac-2neg61.6%
Applied egg-rr61.6%
if -1.15e151 < l < -4.999999999999985e-310Initial program 77.7%
Simplified75.9%
Taylor expanded in d around 0 0.4%
*-commutative0.0%
Simplified0.4%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt75.0%
unpow-175.0%
metadata-eval75.0%
pow-sqr75.1%
rem-sqrt-square75.1%
rem-square-sqrt74.9%
fabs-sqr74.9%
rem-square-sqrt75.1%
Simplified75.1%
if -4.999999999999985e-310 < l < 2.5500000000000001e126Initial program 71.2%
Simplified70.1%
Taylor expanded in d around 0 78.4%
*-commutative86.0%
Simplified78.4%
add-sqr-sqrt78.4%
pow278.4%
*-commutative78.4%
sqrt-prod78.3%
*-commutative78.3%
sqrt-prod78.4%
sqrt-pow180.8%
metadata-eval80.8%
pow180.8%
associate-*r/80.8%
div-inv80.8%
metadata-eval80.8%
Applied egg-rr80.8%
Taylor expanded in h around inf 63.6%
sub-neg63.6%
distribute-lft-in63.6%
rgt-mult-inverse63.6%
distribute-lft-neg-in63.6%
metadata-eval63.6%
associate-*r*63.6%
unpow263.6%
rem-square-sqrt63.7%
times-frac62.8%
Simplified83.3%
if 2.5500000000000001e126 < l Initial program 52.2%
Simplified52.2%
add-sqr-sqrt52.2%
pow252.2%
sqrt-prod52.2%
sqrt-pow155.6%
*-commutative55.6%
metadata-eval55.6%
pow155.6%
div-inv55.6%
associate-*l*49.6%
times-frac49.6%
*-commutative49.6%
times-frac49.6%
metadata-eval49.6%
Applied egg-rr49.6%
Taylor expanded in d around inf 36.9%
unpow-136.9%
metadata-eval36.9%
pow-sqr36.9%
rem-sqrt-square36.9%
rem-square-sqrt36.8%
fabs-sqr36.8%
rem-square-sqrt36.9%
Simplified36.9%
Taylor expanded in d around 0 36.9%
*-commutative36.9%
unpow1/236.9%
rem-exp-log35.4%
rec-exp35.4%
exp-prod35.4%
distribute-lft-neg-out35.4%
exp-neg35.4%
exp-to-pow36.8%
unpow1/236.8%
associate-*l/36.8%
*-lft-identity36.8%
Simplified36.8%
*-un-lft-identity36.8%
sqrt-prod59.3%
times-frac59.3%
add-sqr-sqrt59.3%
sqrt-unprod25.2%
sqr-neg25.2%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
pow1/20.0%
pow-flip0.0%
add-sqr-sqrt0.0%
sqrt-unprod25.3%
sqr-neg25.3%
sqrt-unprod59.4%
add-sqr-sqrt59.7%
metadata-eval59.7%
Applied egg-rr59.7%
Final simplification73.9%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l -1e-181)
(/ (sqrt (/ d l)) (sqrt (/ h d)))
(if (<= l 8.4e-305)
(* d (cbrt (pow (/ (/ 1.0 h) l) 1.5)))
(if (<= l 1.52e+119)
(/
(* d (+ 1.0 (* -0.5 (* (/ h l) (pow (* (/ D_m d) (* 0.5 M_m)) 2.0)))))
(sqrt (* l h)))
(* (pow h -0.5) (/ d (sqrt l)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -1e-181) {
tmp = sqrt((d / l)) / sqrt((h / d));
} else if (l <= 8.4e-305) {
tmp = d * cbrt(pow(((1.0 / h) / l), 1.5));
} else if (l <= 1.52e+119) {
tmp = (d * (1.0 + (-0.5 * ((h / l) * pow(((D_m / d) * (0.5 * M_m)), 2.0))))) / sqrt((l * h));
} else {
tmp = pow(h, -0.5) * (d / sqrt(l));
}
return tmp;
}
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -1e-181) {
tmp = Math.sqrt((d / l)) / Math.sqrt((h / d));
} else if (l <= 8.4e-305) {
tmp = d * Math.cbrt(Math.pow(((1.0 / h) / l), 1.5));
} else if (l <= 1.52e+119) {
tmp = (d * (1.0 + (-0.5 * ((h / l) * Math.pow(((D_m / d) * (0.5 * M_m)), 2.0))))) / Math.sqrt((l * h));
} else {
tmp = Math.pow(h, -0.5) * (d / Math.sqrt(l));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -1e-181) tmp = Float64(sqrt(Float64(d / l)) / sqrt(Float64(h / d))); elseif (l <= 8.4e-305) tmp = Float64(d * cbrt((Float64(Float64(1.0 / h) / l) ^ 1.5))); elseif (l <= 1.52e+119) tmp = Float64(Float64(d * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(0.5 * M_m)) ^ 2.0))))) / sqrt(Float64(l * h))); else tmp = Float64((h ^ -0.5) * Float64(d / sqrt(l))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -1e-181], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 8.4e-305], N[(d * N[Power[N[Power[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.52e+119], N[(N[(d * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(0.5 * M$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Power[h, -0.5], $MachinePrecision] * N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1 \cdot 10^{-181}:\\
\;\;\;\;\frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\frac{h}{d}}}\\
\mathbf{elif}\;\ell \leq 8.4 \cdot 10^{-305}:\\
\;\;\;\;d \cdot \sqrt[3]{{\left(\frac{\frac{1}{h}}{\ell}\right)}^{1.5}}\\
\mathbf{elif}\;\ell \leq 1.52 \cdot 10^{+119}:\\
\;\;\;\;\frac{d \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \left(0.5 \cdot M\_m\right)\right)}^{2}\right)\right)}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;{h}^{-0.5} \cdot \frac{d}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -1.00000000000000005e-181Initial program 75.2%
Simplified73.4%
add-sqr-sqrt73.4%
pow273.4%
sqrt-prod73.4%
sqrt-pow174.3%
*-commutative74.3%
metadata-eval74.3%
pow174.3%
div-inv74.3%
associate-*l*76.1%
times-frac76.1%
*-commutative76.1%
times-frac76.1%
metadata-eval76.1%
Applied egg-rr76.1%
Taylor expanded in D around 0 45.8%
*-rgt-identity45.8%
*-commutative45.8%
frac-2neg45.8%
sqrt-undiv49.9%
clear-num49.8%
un-div-inv49.8%
sqrt-undiv46.9%
frac-2neg46.9%
Applied egg-rr46.9%
if -1.00000000000000005e-181 < l < 8.3999999999999999e-305Initial program 74.1%
Simplified71.2%
add-sqr-sqrt71.2%
pow271.2%
sqrt-prod71.2%
sqrt-pow171.2%
*-commutative71.2%
metadata-eval71.2%
pow171.2%
div-inv71.1%
associate-*l*67.9%
times-frac67.9%
*-commutative67.9%
times-frac67.9%
metadata-eval67.9%
Applied egg-rr67.9%
Taylor expanded in d around inf 31.1%
unpow-131.1%
metadata-eval31.1%
pow-sqr31.1%
rem-sqrt-square31.1%
rem-square-sqrt31.1%
fabs-sqr31.1%
rem-square-sqrt31.1%
Simplified31.1%
*-commutative31.1%
metadata-eval31.1%
pow-pow31.1%
inv-pow31.1%
pow1/231.1%
add-cbrt-cube37.4%
add-sqr-sqrt37.4%
pow137.4%
pow1/237.4%
pow-prod-up37.4%
*-commutative37.4%
metadata-eval37.4%
Applied egg-rr37.4%
associate-/r*37.4%
Simplified37.4%
if 8.3999999999999999e-305 < l < 1.52000000000000007e119Initial program 73.2%
Simplified71.9%
Taylor expanded in d around 0 79.6%
*-commutative86.3%
Simplified79.6%
add-sqr-sqrt79.6%
pow279.6%
*-commutative79.6%
sqrt-prod79.5%
*-commutative79.5%
sqrt-prod79.5%
sqrt-pow182.1%
metadata-eval82.1%
pow182.1%
associate-*r/82.1%
div-inv82.1%
metadata-eval82.1%
Applied egg-rr82.1%
Applied egg-rr80.9%
if 1.52000000000000007e119 < l Initial program 53.5%
Simplified53.5%
add-sqr-sqrt53.5%
pow253.5%
sqrt-prod53.5%
sqrt-pow156.6%
*-commutative56.6%
metadata-eval56.6%
pow156.6%
div-inv56.6%
associate-*l*51.1%
times-frac51.1%
*-commutative51.1%
times-frac51.1%
metadata-eval51.1%
Applied egg-rr51.1%
Taylor expanded in d around inf 39.4%
unpow-139.4%
metadata-eval39.4%
pow-sqr39.4%
rem-sqrt-square39.4%
rem-square-sqrt39.2%
fabs-sqr39.2%
rem-square-sqrt39.4%
Simplified39.4%
Taylor expanded in d around 0 39.4%
*-commutative39.4%
unpow1/239.4%
rem-exp-log37.5%
rec-exp37.5%
exp-prod37.5%
distribute-lft-neg-out37.5%
exp-neg37.5%
exp-to-pow39.2%
unpow1/239.2%
associate-*l/39.2%
*-lft-identity39.2%
Simplified39.2%
*-un-lft-identity39.2%
sqrt-prod59.9%
times-frac60.0%
add-sqr-sqrt60.0%
sqrt-unprod26.0%
sqr-neg26.0%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
pow1/20.0%
pow-flip0.0%
add-sqr-sqrt0.0%
sqrt-unprod26.1%
sqr-neg26.1%
sqrt-unprod60.1%
add-sqr-sqrt60.3%
metadata-eval60.3%
Applied egg-rr60.3%
Final simplification57.9%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= d -1.38e-142)
(/ (sqrt (/ d l)) (sqrt (/ h d)))
(if (<= d -4e-310)
(/ d (cbrt (pow (* l h) 1.5)))
(if (<= d 1.4e-23)
(*
(* d (sqrt (/ 1.0 (* l h))))
(* -0.25 (* (pow (/ (* D_m M_m) d) 2.0) (* h (/ 0.5 l)))))
(* d (* (pow h -0.5) (pow l -0.5)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -1.38e-142) {
tmp = sqrt((d / l)) / sqrt((h / d));
} else if (d <= -4e-310) {
tmp = d / cbrt(pow((l * h), 1.5));
} else if (d <= 1.4e-23) {
tmp = (d * sqrt((1.0 / (l * h)))) * (-0.25 * (pow(((D_m * M_m) / d), 2.0) * (h * (0.5 / l))));
} else {
tmp = d * (pow(h, -0.5) * pow(l, -0.5));
}
return tmp;
}
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -1.38e-142) {
tmp = Math.sqrt((d / l)) / Math.sqrt((h / d));
} else if (d <= -4e-310) {
tmp = d / Math.cbrt(Math.pow((l * h), 1.5));
} else if (d <= 1.4e-23) {
tmp = (d * Math.sqrt((1.0 / (l * h)))) * (-0.25 * (Math.pow(((D_m * M_m) / d), 2.0) * (h * (0.5 / l))));
} else {
tmp = d * (Math.pow(h, -0.5) * Math.pow(l, -0.5));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= -1.38e-142) tmp = Float64(sqrt(Float64(d / l)) / sqrt(Float64(h / d))); elseif (d <= -4e-310) tmp = Float64(d / cbrt((Float64(l * h) ^ 1.5))); elseif (d <= 1.4e-23) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(-0.25 * Float64((Float64(Float64(D_m * M_m) / d) ^ 2.0) * Float64(h * Float64(0.5 / l))))); else tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, -1.38e-142], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4e-310], N[(d / N[Power[N[Power[N[(l * h), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.4e-23], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-0.25 * N[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(h * N[(0.5 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.38 \cdot 10^{-142}:\\
\;\;\;\;\frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\frac{h}{d}}}\\
\mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt[3]{{\left(\ell \cdot h\right)}^{1.5}}}\\
\mathbf{elif}\;d \leq 1.4 \cdot 10^{-23}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(-0.25 \cdot \left({\left(\frac{D\_m \cdot M\_m}{d}\right)}^{2} \cdot \left(h \cdot \frac{0.5}{\ell}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\end{array}
\end{array}
if d < -1.37999999999999998e-142Initial program 80.2%
Simplified78.4%
add-sqr-sqrt78.4%
pow278.4%
sqrt-prod78.4%
sqrt-pow179.3%
*-commutative79.3%
metadata-eval79.3%
pow179.3%
div-inv79.3%
associate-*l*80.2%
times-frac80.2%
*-commutative80.2%
times-frac80.2%
metadata-eval80.2%
Applied egg-rr80.2%
Taylor expanded in D around 0 49.2%
*-rgt-identity49.2%
*-commutative49.2%
frac-2neg49.2%
sqrt-undiv53.6%
clear-num53.5%
un-div-inv53.5%
sqrt-undiv50.4%
frac-2neg50.4%
Applied egg-rr50.4%
if -1.37999999999999998e-142 < d < -3.999999999999988e-310Initial program 63.5%
Simplified60.7%
add-sqr-sqrt60.6%
pow260.6%
sqrt-prod60.6%
sqrt-pow160.6%
*-commutative60.6%
metadata-eval60.6%
pow160.6%
div-inv60.6%
associate-*l*60.8%
times-frac60.8%
*-commutative60.8%
times-frac60.8%
metadata-eval60.8%
Applied egg-rr60.8%
Taylor expanded in d around inf 24.9%
unpow-124.9%
metadata-eval24.9%
pow-sqr24.9%
rem-sqrt-square24.9%
rem-square-sqrt24.9%
fabs-sqr24.9%
rem-square-sqrt24.9%
Simplified24.9%
Taylor expanded in d around 0 24.9%
*-commutative24.9%
unpow1/224.9%
rem-exp-log24.9%
rec-exp24.9%
exp-prod24.9%
distribute-lft-neg-out24.9%
exp-neg24.9%
exp-to-pow24.9%
unpow1/224.9%
associate-*l/24.9%
*-lft-identity24.9%
Simplified24.9%
add-cbrt-cube30.5%
pow1/330.5%
add-sqr-sqrt30.5%
pow130.5%
pow1/230.5%
pow-prod-up30.5%
metadata-eval30.5%
Applied egg-rr30.5%
unpow1/330.5%
Simplified30.5%
if -3.999999999999988e-310 < d < 1.3999999999999999e-23Initial program 54.1%
Simplified52.4%
Taylor expanded in d around 0 61.7%
*-commutative66.8%
Simplified61.7%
add-sqr-sqrt61.7%
pow261.7%
*-commutative61.7%
sqrt-prod61.6%
*-commutative61.6%
sqrt-prod61.6%
sqrt-pow166.7%
metadata-eval66.7%
pow166.7%
associate-*r/68.4%
div-inv68.4%
metadata-eval68.4%
Applied egg-rr68.4%
Taylor expanded in h around inf 39.6%
*-commutative39.6%
associate-*r*38.0%
times-frac37.8%
associate-/l*36.2%
unpow236.2%
unpow236.2%
unpow236.2%
times-frac45.0%
swap-sqr51.7%
unpow251.7%
associate-*r/53.4%
unpow253.4%
rem-square-sqrt53.5%
associate-/l*53.5%
Simplified53.5%
if 1.3999999999999999e-23 < d Initial program 77.7%
Simplified77.7%
add-sqr-sqrt77.6%
pow277.6%
sqrt-prod77.7%
sqrt-pow179.5%
*-commutative79.5%
metadata-eval79.5%
pow179.5%
div-inv79.5%
associate-*l*78.4%
times-frac78.4%
*-commutative78.4%
times-frac78.4%
metadata-eval78.4%
Applied egg-rr78.4%
Taylor expanded in d around inf 53.2%
unpow-153.2%
metadata-eval53.2%
pow-sqr53.2%
rem-sqrt-square53.2%
rem-square-sqrt53.1%
fabs-sqr53.1%
rem-square-sqrt53.2%
Simplified53.2%
*-commutative53.2%
unpow-prod-down70.0%
Applied egg-rr70.0%
Final simplification52.7%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l -5e-310)
(*
(* d (sqrt (/ (/ 1.0 l) h)))
(+ (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D_m d)) 2.0))) -1.0))
(if (<= l 4.1e+125)
(*
(* d (sqrt (/ 1.0 (* l h))))
(+ 1.0 (* h (* -0.25 (* (pow (/ (* D_m M_m) d) 2.0) (/ 0.5 l))))))
(* (pow h -0.5) (/ d (sqrt l))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -5e-310) {
tmp = (d * sqrt(((1.0 / l) / h))) * ((0.5 * ((h / l) * pow(((M_m / 2.0) * (D_m / d)), 2.0))) + -1.0);
} else if (l <= 4.1e+125) {
tmp = (d * sqrt((1.0 / (l * h)))) * (1.0 + (h * (-0.25 * (pow(((D_m * M_m) / d), 2.0) * (0.5 / l)))));
} else {
tmp = pow(h, -0.5) * (d / sqrt(l));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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_m
real(8) :: tmp
if (l <= (-5d-310)) then
tmp = (d * sqrt(((1.0d0 / l) / h))) * ((0.5d0 * ((h / l) * (((m_m / 2.0d0) * (d_m / d)) ** 2.0d0))) + (-1.0d0))
else if (l <= 4.1d+125) then
tmp = (d * sqrt((1.0d0 / (l * h)))) * (1.0d0 + (h * ((-0.25d0) * ((((d_m * m_m) / d) ** 2.0d0) * (0.5d0 / l)))))
else
tmp = (h ** (-0.5d0)) * (d / sqrt(l))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -5e-310) {
tmp = (d * Math.sqrt(((1.0 / l) / h))) * ((0.5 * ((h / l) * Math.pow(((M_m / 2.0) * (D_m / d)), 2.0))) + -1.0);
} else if (l <= 4.1e+125) {
tmp = (d * Math.sqrt((1.0 / (l * h)))) * (1.0 + (h * (-0.25 * (Math.pow(((D_m * M_m) / d), 2.0) * (0.5 / l)))));
} else {
tmp = Math.pow(h, -0.5) * (d / Math.sqrt(l));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= -5e-310: tmp = (d * math.sqrt(((1.0 / l) / h))) * ((0.5 * ((h / l) * math.pow(((M_m / 2.0) * (D_m / d)), 2.0))) + -1.0) elif l <= 4.1e+125: tmp = (d * math.sqrt((1.0 / (l * h)))) * (1.0 + (h * (-0.25 * (math.pow(((D_m * M_m) / d), 2.0) * (0.5 / l))))) else: tmp = math.pow(h, -0.5) * (d / math.sqrt(l)) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -5e-310) tmp = Float64(Float64(d * sqrt(Float64(Float64(1.0 / l) / h))) * Float64(Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D_m / d)) ^ 2.0))) + -1.0)); elseif (l <= 4.1e+125) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(1.0 + Float64(h * Float64(-0.25 * Float64((Float64(Float64(D_m * M_m) / d) ^ 2.0) * Float64(0.5 / l)))))); else tmp = Float64((h ^ -0.5) * Float64(d / sqrt(l))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= -5e-310)
tmp = (d * sqrt(((1.0 / l) / h))) * ((0.5 * ((h / l) * (((M_m / 2.0) * (D_m / d)) ^ 2.0))) + -1.0);
elseif (l <= 4.1e+125)
tmp = (d * sqrt((1.0 / (l * h)))) * (1.0 + (h * (-0.25 * ((((D_m * M_m) / d) ^ 2.0) * (0.5 / l)))));
else
tmp = (h ^ -0.5) * (d / sqrt(l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -5e-310], N[(N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.1e+125], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(h * N[(-0.25 * N[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[h, -0.5], $MachinePrecision] * N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right) + -1\right)\\
\mathbf{elif}\;\ell \leq 4.1 \cdot 10^{+125}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 + h \cdot \left(-0.25 \cdot \left({\left(\frac{D\_m \cdot M\_m}{d}\right)}^{2} \cdot \frac{0.5}{\ell}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;{h}^{-0.5} \cdot \frac{d}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 76.0%
Simplified74.0%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt71.6%
neg-mul-171.6%
Simplified70.1%
if -4.999999999999985e-310 < l < 4.09999999999999992e125Initial program 71.2%
Simplified70.1%
Taylor expanded in d around 0 78.4%
*-commutative86.0%
Simplified78.4%
add-sqr-sqrt78.4%
pow278.4%
*-commutative78.4%
sqrt-prod78.3%
*-commutative78.3%
sqrt-prod78.4%
sqrt-pow180.8%
metadata-eval80.8%
pow180.8%
associate-*r/80.8%
div-inv80.8%
metadata-eval80.8%
Applied egg-rr80.8%
Taylor expanded in h around inf 63.6%
sub-neg63.6%
distribute-lft-in63.6%
rgt-mult-inverse63.6%
distribute-lft-neg-in63.6%
metadata-eval63.6%
associate-*r*63.6%
unpow263.6%
rem-square-sqrt63.7%
times-frac62.8%
Simplified83.3%
if 4.09999999999999992e125 < l Initial program 52.2%
Simplified52.2%
add-sqr-sqrt52.2%
pow252.2%
sqrt-prod52.2%
sqrt-pow155.6%
*-commutative55.6%
metadata-eval55.6%
pow155.6%
div-inv55.6%
associate-*l*49.6%
times-frac49.6%
*-commutative49.6%
times-frac49.6%
metadata-eval49.6%
Applied egg-rr49.6%
Taylor expanded in d around inf 36.9%
unpow-136.9%
metadata-eval36.9%
pow-sqr36.9%
rem-sqrt-square36.9%
rem-square-sqrt36.8%
fabs-sqr36.8%
rem-square-sqrt36.9%
Simplified36.9%
Taylor expanded in d around 0 36.9%
*-commutative36.9%
unpow1/236.9%
rem-exp-log35.4%
rec-exp35.4%
exp-prod35.4%
distribute-lft-neg-out35.4%
exp-neg35.4%
exp-to-pow36.8%
unpow1/236.8%
associate-*l/36.8%
*-lft-identity36.8%
Simplified36.8%
*-un-lft-identity36.8%
sqrt-prod59.3%
times-frac59.3%
add-sqr-sqrt59.3%
sqrt-unprod25.2%
sqr-neg25.2%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
pow1/20.0%
pow-flip0.0%
add-sqr-sqrt0.0%
sqrt-unprod25.3%
sqr-neg25.3%
sqrt-unprod59.4%
add-sqr-sqrt59.7%
metadata-eval59.7%
Applied egg-rr59.7%
Final simplification72.9%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l -5e-310)
(*
(sqrt (* (/ d h) (/ d l)))
(+ 1.0 (* -0.5 (* (/ h l) (pow (* (/ M_m d) (* D_m 0.5)) 2.0)))))
(if (<= l 5.5e+126)
(*
(* d (sqrt (/ 1.0 (* l h))))
(+ 1.0 (* h (* -0.25 (* (pow (/ (* D_m M_m) d) 2.0) (/ 0.5 l))))))
(* (pow h -0.5) (/ d (sqrt l))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -5e-310) {
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * pow(((M_m / d) * (D_m * 0.5)), 2.0))));
} else if (l <= 5.5e+126) {
tmp = (d * sqrt((1.0 / (l * h)))) * (1.0 + (h * (-0.25 * (pow(((D_m * M_m) / d), 2.0) * (0.5 / l)))));
} else {
tmp = pow(h, -0.5) * (d / sqrt(l));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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_m
real(8) :: tmp
if (l <= (-5d-310)) then
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 + ((-0.5d0) * ((h / l) * (((m_m / d) * (d_m * 0.5d0)) ** 2.0d0))))
else if (l <= 5.5d+126) then
tmp = (d * sqrt((1.0d0 / (l * h)))) * (1.0d0 + (h * ((-0.25d0) * ((((d_m * m_m) / d) ** 2.0d0) * (0.5d0 / l)))))
else
tmp = (h ** (-0.5d0)) * (d / sqrt(l))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -5e-310) {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * Math.pow(((M_m / d) * (D_m * 0.5)), 2.0))));
} else if (l <= 5.5e+126) {
tmp = (d * Math.sqrt((1.0 / (l * h)))) * (1.0 + (h * (-0.25 * (Math.pow(((D_m * M_m) / d), 2.0) * (0.5 / l)))));
} else {
tmp = Math.pow(h, -0.5) * (d / Math.sqrt(l));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= -5e-310: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * math.pow(((M_m / d) * (D_m * 0.5)), 2.0)))) elif l <= 5.5e+126: tmp = (d * math.sqrt((1.0 / (l * h)))) * (1.0 + (h * (-0.25 * (math.pow(((D_m * M_m) / d), 2.0) * (0.5 / l))))) else: tmp = math.pow(h, -0.5) * (d / math.sqrt(l)) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -5e-310) tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / d) * Float64(D_m * 0.5)) ^ 2.0))))); elseif (l <= 5.5e+126) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(1.0 + Float64(h * Float64(-0.25 * Float64((Float64(Float64(D_m * M_m) / d) ^ 2.0) * Float64(0.5 / l)))))); else tmp = Float64((h ^ -0.5) * Float64(d / sqrt(l))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= -5e-310)
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * (((M_m / d) * (D_m * 0.5)) ^ 2.0))));
elseif (l <= 5.5e+126)
tmp = (d * sqrt((1.0 / (l * h)))) * (1.0 + (h * (-0.25 * ((((D_m * M_m) / d) ^ 2.0) * (0.5 / l)))));
else
tmp = (h ^ -0.5) * (d / sqrt(l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -5e-310], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / d), $MachinePrecision] * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.5e+126], N[(N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(h * N[(-0.25 * N[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[h, -0.5], $MachinePrecision] * N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{d} \cdot \left(D\_m \cdot 0.5\right)\right)}^{2}\right)\right)\\
\mathbf{elif}\;\ell \leq 5.5 \cdot 10^{+126}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 + h \cdot \left(-0.25 \cdot \left({\left(\frac{D\_m \cdot M\_m}{d}\right)}^{2} \cdot \frac{0.5}{\ell}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;{h}^{-0.5} \cdot \frac{d}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 76.0%
Simplified74.0%
add-sqr-sqrt73.9%
pow273.9%
sqrt-prod74.0%
sqrt-pow174.6%
*-commutative74.6%
metadata-eval74.6%
pow174.6%
div-inv74.6%
associate-*l*75.4%
times-frac75.3%
*-commutative75.3%
times-frac75.3%
metadata-eval75.3%
Applied egg-rr75.3%
pow175.3%
sqrt-unprod63.3%
cancel-sign-sub-inv63.3%
metadata-eval63.3%
*-commutative63.3%
unpow-prod-down62.6%
pow262.6%
add-sqr-sqrt62.7%
associate-*r*62.7%
Applied egg-rr62.7%
unpow162.7%
*-lft-identity62.7%
*-lft-identity62.7%
*-commutative62.7%
Simplified62.7%
if -4.999999999999985e-310 < l < 5.5000000000000004e126Initial program 71.2%
Simplified70.1%
Taylor expanded in d around 0 78.4%
*-commutative86.0%
Simplified78.4%
add-sqr-sqrt78.4%
pow278.4%
*-commutative78.4%
sqrt-prod78.3%
*-commutative78.3%
sqrt-prod78.4%
sqrt-pow180.8%
metadata-eval80.8%
pow180.8%
associate-*r/80.8%
div-inv80.8%
metadata-eval80.8%
Applied egg-rr80.8%
Taylor expanded in h around inf 63.6%
sub-neg63.6%
distribute-lft-in63.6%
rgt-mult-inverse63.6%
distribute-lft-neg-in63.6%
metadata-eval63.6%
associate-*r*63.6%
unpow263.6%
rem-square-sqrt63.7%
times-frac62.8%
Simplified83.3%
if 5.5000000000000004e126 < l Initial program 52.2%
Simplified52.2%
add-sqr-sqrt52.2%
pow252.2%
sqrt-prod52.2%
sqrt-pow155.6%
*-commutative55.6%
metadata-eval55.6%
pow155.6%
div-inv55.6%
associate-*l*49.6%
times-frac49.6%
*-commutative49.6%
times-frac49.6%
metadata-eval49.6%
Applied egg-rr49.6%
Taylor expanded in d around inf 36.9%
unpow-136.9%
metadata-eval36.9%
pow-sqr36.9%
rem-sqrt-square36.9%
rem-square-sqrt36.8%
fabs-sqr36.8%
rem-square-sqrt36.9%
Simplified36.9%
Taylor expanded in d around 0 36.9%
*-commutative36.9%
unpow1/236.9%
rem-exp-log35.4%
rec-exp35.4%
exp-prod35.4%
distribute-lft-neg-out35.4%
exp-neg35.4%
exp-to-pow36.8%
unpow1/236.8%
associate-*l/36.8%
*-lft-identity36.8%
Simplified36.8%
*-un-lft-identity36.8%
sqrt-prod59.3%
times-frac59.3%
add-sqr-sqrt59.3%
sqrt-unprod25.2%
sqr-neg25.2%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
pow1/20.0%
pow-flip0.0%
add-sqr-sqrt0.0%
sqrt-unprod25.3%
sqr-neg25.3%
sqrt-unprod59.4%
add-sqr-sqrt59.7%
metadata-eval59.7%
Applied egg-rr59.7%
Final simplification68.9%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l -5e-310)
(*
(sqrt (* (/ d h) (/ d l)))
(+ 1.0 (* -0.5 (* (/ h l) (pow (* (/ M_m d) (* D_m 0.5)) 2.0)))))
(if (<= l 1.5e+116)
(/
(* d (+ 1.0 (* -0.5 (* (/ h l) (pow (* (/ D_m d) (* 0.5 M_m)) 2.0)))))
(sqrt (* l h)))
(* (pow h -0.5) (/ d (sqrt l))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -5e-310) {
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * pow(((M_m / d) * (D_m * 0.5)), 2.0))));
} else if (l <= 1.5e+116) {
tmp = (d * (1.0 + (-0.5 * ((h / l) * pow(((D_m / d) * (0.5 * M_m)), 2.0))))) / sqrt((l * h));
} else {
tmp = pow(h, -0.5) * (d / sqrt(l));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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_m
real(8) :: tmp
if (l <= (-5d-310)) then
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 + ((-0.5d0) * ((h / l) * (((m_m / d) * (d_m * 0.5d0)) ** 2.0d0))))
else if (l <= 1.5d+116) then
tmp = (d * (1.0d0 + ((-0.5d0) * ((h / l) * (((d_m / d) * (0.5d0 * m_m)) ** 2.0d0))))) / sqrt((l * h))
else
tmp = (h ** (-0.5d0)) * (d / sqrt(l))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -5e-310) {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * Math.pow(((M_m / d) * (D_m * 0.5)), 2.0))));
} else if (l <= 1.5e+116) {
tmp = (d * (1.0 + (-0.5 * ((h / l) * Math.pow(((D_m / d) * (0.5 * M_m)), 2.0))))) / Math.sqrt((l * h));
} else {
tmp = Math.pow(h, -0.5) * (d / Math.sqrt(l));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= -5e-310: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * math.pow(((M_m / d) * (D_m * 0.5)), 2.0)))) elif l <= 1.5e+116: tmp = (d * (1.0 + (-0.5 * ((h / l) * math.pow(((D_m / d) * (0.5 * M_m)), 2.0))))) / math.sqrt((l * h)) else: tmp = math.pow(h, -0.5) * (d / math.sqrt(l)) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -5e-310) tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / d) * Float64(D_m * 0.5)) ^ 2.0))))); elseif (l <= 1.5e+116) tmp = Float64(Float64(d * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(0.5 * M_m)) ^ 2.0))))) / sqrt(Float64(l * h))); else tmp = Float64((h ^ -0.5) * Float64(d / sqrt(l))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= -5e-310)
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * (((M_m / d) * (D_m * 0.5)) ^ 2.0))));
elseif (l <= 1.5e+116)
tmp = (d * (1.0 + (-0.5 * ((h / l) * (((D_m / d) * (0.5 * M_m)) ^ 2.0))))) / sqrt((l * h));
else
tmp = (h ^ -0.5) * (d / sqrt(l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -5e-310], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / d), $MachinePrecision] * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.5e+116], N[(N[(d * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(0.5 * M$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Power[h, -0.5], $MachinePrecision] * N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{d} \cdot \left(D\_m \cdot 0.5\right)\right)}^{2}\right)\right)\\
\mathbf{elif}\;\ell \leq 1.5 \cdot 10^{+116}:\\
\;\;\;\;\frac{d \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \left(0.5 \cdot M\_m\right)\right)}^{2}\right)\right)}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;{h}^{-0.5} \cdot \frac{d}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 76.0%
Simplified74.0%
add-sqr-sqrt73.9%
pow273.9%
sqrt-prod74.0%
sqrt-pow174.6%
*-commutative74.6%
metadata-eval74.6%
pow174.6%
div-inv74.6%
associate-*l*75.4%
times-frac75.3%
*-commutative75.3%
times-frac75.3%
metadata-eval75.3%
Applied egg-rr75.3%
pow175.3%
sqrt-unprod63.3%
cancel-sign-sub-inv63.3%
metadata-eval63.3%
*-commutative63.3%
unpow-prod-down62.6%
pow262.6%
add-sqr-sqrt62.7%
associate-*r*62.7%
Applied egg-rr62.7%
unpow162.7%
*-lft-identity62.7%
*-lft-identity62.7%
*-commutative62.7%
Simplified62.7%
if -4.999999999999985e-310 < l < 1.4999999999999999e116Initial program 71.4%
Simplified70.1%
Taylor expanded in d around 0 78.8%
*-commutative86.7%
Simplified78.8%
add-sqr-sqrt78.8%
pow278.8%
*-commutative78.8%
sqrt-prod78.7%
*-commutative78.7%
sqrt-prod78.7%
sqrt-pow181.3%
metadata-eval81.3%
pow181.3%
associate-*r/81.2%
div-inv81.2%
metadata-eval81.2%
Applied egg-rr81.2%
Applied egg-rr80.1%
if 1.4999999999999999e116 < l Initial program 53.5%
Simplified53.5%
add-sqr-sqrt53.5%
pow253.5%
sqrt-prod53.5%
sqrt-pow156.6%
*-commutative56.6%
metadata-eval56.6%
pow156.6%
div-inv56.6%
associate-*l*51.1%
times-frac51.1%
*-commutative51.1%
times-frac51.1%
metadata-eval51.1%
Applied egg-rr51.1%
Taylor expanded in d around inf 39.4%
unpow-139.4%
metadata-eval39.4%
pow-sqr39.4%
rem-sqrt-square39.4%
rem-square-sqrt39.2%
fabs-sqr39.2%
rem-square-sqrt39.4%
Simplified39.4%
Taylor expanded in d around 0 39.4%
*-commutative39.4%
unpow1/239.4%
rem-exp-log37.5%
rec-exp37.5%
exp-prod37.5%
distribute-lft-neg-out37.5%
exp-neg37.5%
exp-to-pow39.2%
unpow1/239.2%
associate-*l/39.2%
*-lft-identity39.2%
Simplified39.2%
*-un-lft-identity39.2%
sqrt-prod59.9%
times-frac60.0%
add-sqr-sqrt60.0%
sqrt-unprod26.0%
sqr-neg26.0%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
pow1/20.0%
pow-flip0.0%
add-sqr-sqrt0.0%
sqrt-unprod26.1%
sqr-neg26.1%
sqrt-unprod60.1%
add-sqr-sqrt60.3%
metadata-eval60.3%
Applied egg-rr60.3%
Final simplification67.7%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= d -9.8e-142)
(/ (sqrt (/ d l)) (sqrt (/ h d)))
(if (<= d -4e-310)
(/ d (cbrt (pow (* l h) 1.5)))
(* d (* (pow h -0.5) (pow l -0.5))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -9.8e-142) {
tmp = sqrt((d / l)) / sqrt((h / d));
} else if (d <= -4e-310) {
tmp = d / cbrt(pow((l * h), 1.5));
} else {
tmp = d * (pow(h, -0.5) * pow(l, -0.5));
}
return tmp;
}
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -9.8e-142) {
tmp = Math.sqrt((d / l)) / Math.sqrt((h / d));
} else if (d <= -4e-310) {
tmp = d / Math.cbrt(Math.pow((l * h), 1.5));
} else {
tmp = d * (Math.pow(h, -0.5) * Math.pow(l, -0.5));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= -9.8e-142) tmp = Float64(sqrt(Float64(d / l)) / sqrt(Float64(h / d))); elseif (d <= -4e-310) tmp = Float64(d / cbrt((Float64(l * h) ^ 1.5))); else tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, -9.8e-142], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4e-310], N[(d / N[Power[N[Power[N[(l * h), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -9.8 \cdot 10^{-142}:\\
\;\;\;\;\frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\frac{h}{d}}}\\
\mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt[3]{{\left(\ell \cdot h\right)}^{1.5}}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\end{array}
\end{array}
if d < -9.8000000000000007e-142Initial program 80.2%
Simplified78.4%
add-sqr-sqrt78.4%
pow278.4%
sqrt-prod78.4%
sqrt-pow179.3%
*-commutative79.3%
metadata-eval79.3%
pow179.3%
div-inv79.3%
associate-*l*80.2%
times-frac80.2%
*-commutative80.2%
times-frac80.2%
metadata-eval80.2%
Applied egg-rr80.2%
Taylor expanded in D around 0 49.2%
*-rgt-identity49.2%
*-commutative49.2%
frac-2neg49.2%
sqrt-undiv53.6%
clear-num53.5%
un-div-inv53.5%
sqrt-undiv50.4%
frac-2neg50.4%
Applied egg-rr50.4%
if -9.8000000000000007e-142 < d < -3.999999999999988e-310Initial program 63.5%
Simplified60.7%
add-sqr-sqrt60.6%
pow260.6%
sqrt-prod60.6%
sqrt-pow160.6%
*-commutative60.6%
metadata-eval60.6%
pow160.6%
div-inv60.6%
associate-*l*60.8%
times-frac60.8%
*-commutative60.8%
times-frac60.8%
metadata-eval60.8%
Applied egg-rr60.8%
Taylor expanded in d around inf 24.9%
unpow-124.9%
metadata-eval24.9%
pow-sqr24.9%
rem-sqrt-square24.9%
rem-square-sqrt24.9%
fabs-sqr24.9%
rem-square-sqrt24.9%
Simplified24.9%
Taylor expanded in d around 0 24.9%
*-commutative24.9%
unpow1/224.9%
rem-exp-log24.9%
rec-exp24.9%
exp-prod24.9%
distribute-lft-neg-out24.9%
exp-neg24.9%
exp-to-pow24.9%
unpow1/224.9%
associate-*l/24.9%
*-lft-identity24.9%
Simplified24.9%
add-cbrt-cube30.5%
pow1/330.5%
add-sqr-sqrt30.5%
pow130.5%
pow1/230.5%
pow-prod-up30.5%
metadata-eval30.5%
Applied egg-rr30.5%
unpow1/330.5%
Simplified30.5%
if -3.999999999999988e-310 < d Initial program 65.7%
Simplified64.8%
add-sqr-sqrt64.8%
pow264.8%
sqrt-prod64.8%
sqrt-pow167.5%
*-commutative67.5%
metadata-eval67.5%
pow167.5%
div-inv67.5%
associate-*l*66.0%
times-frac66.0%
*-commutative66.0%
times-frac66.0%
metadata-eval66.0%
Applied egg-rr66.0%
Taylor expanded in d around inf 34.8%
unpow-134.8%
metadata-eval34.8%
pow-sqr34.8%
rem-sqrt-square34.8%
rem-square-sqrt34.7%
fabs-sqr34.7%
rem-square-sqrt34.8%
Simplified34.8%
*-commutative34.8%
unpow-prod-down45.5%
Applied egg-rr45.5%
Final simplification45.5%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= d -8.2e-145)
(* (- d) (sqrt (/ (/ 1.0 l) h)))
(if (<= d -4e-310)
(/ d (cbrt (pow (* l h) 1.5)))
(* d (* (pow h -0.5) (pow l -0.5))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -8.2e-145) {
tmp = -d * sqrt(((1.0 / l) / h));
} else if (d <= -4e-310) {
tmp = d / cbrt(pow((l * h), 1.5));
} else {
tmp = d * (pow(h, -0.5) * pow(l, -0.5));
}
return tmp;
}
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -8.2e-145) {
tmp = -d * Math.sqrt(((1.0 / l) / h));
} else if (d <= -4e-310) {
tmp = d / Math.cbrt(Math.pow((l * h), 1.5));
} else {
tmp = d * (Math.pow(h, -0.5) * Math.pow(l, -0.5));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= -8.2e-145) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / l) / h))); elseif (d <= -4e-310) tmp = Float64(d / cbrt((Float64(l * h) ^ 1.5))); else tmp = Float64(d * Float64((h ^ -0.5) * (l ^ -0.5))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, -8.2e-145], N[((-d) * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4e-310], N[(d / N[Power[N[Power[N[(l * h), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -8.2 \cdot 10^{-145}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt[3]{{\left(\ell \cdot h\right)}^{1.5}}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({h}^{-0.5} \cdot {\ell}^{-0.5}\right)\\
\end{array}
\end{array}
if d < -8.1999999999999995e-145Initial program 79.4%
Simplified77.6%
add-sqr-sqrt77.6%
pow277.6%
sqrt-prod77.7%
sqrt-pow178.6%
*-commutative78.6%
metadata-eval78.6%
pow178.6%
div-inv78.6%
associate-*l*79.5%
times-frac79.4%
*-commutative79.4%
times-frac79.4%
metadata-eval79.4%
Applied egg-rr79.4%
Taylor expanded in D around 0 48.8%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt48.9%
neg-mul-148.9%
Simplified48.9%
if -8.1999999999999995e-145 < d < -3.999999999999988e-310Initial program 65.4%
Simplified62.5%
add-sqr-sqrt62.4%
pow262.4%
sqrt-prod62.4%
sqrt-pow162.4%
*-commutative62.4%
metadata-eval62.4%
pow162.4%
div-inv62.4%
associate-*l*62.5%
times-frac62.5%
*-commutative62.5%
times-frac62.5%
metadata-eval62.5%
Applied egg-rr62.5%
Taylor expanded in d around inf 25.5%
unpow-125.5%
metadata-eval25.5%
pow-sqr25.5%
rem-sqrt-square25.6%
rem-square-sqrt25.6%
fabs-sqr25.6%
rem-square-sqrt25.6%
Simplified25.6%
Taylor expanded in d around 0 25.5%
*-commutative25.5%
unpow1/225.5%
rem-exp-log25.5%
rec-exp25.5%
exp-prod25.6%
distribute-lft-neg-out25.6%
exp-neg25.6%
exp-to-pow25.6%
unpow1/225.6%
associate-*l/25.6%
*-lft-identity25.6%
Simplified25.6%
add-cbrt-cube31.3%
pow1/331.3%
add-sqr-sqrt31.3%
pow131.3%
pow1/231.3%
pow-prod-up31.3%
metadata-eval31.3%
Applied egg-rr31.3%
unpow1/331.3%
Simplified31.3%
if -3.999999999999988e-310 < d Initial program 65.7%
Simplified64.8%
add-sqr-sqrt64.8%
pow264.8%
sqrt-prod64.8%
sqrt-pow167.5%
*-commutative67.5%
metadata-eval67.5%
pow167.5%
div-inv67.5%
associate-*l*66.0%
times-frac66.0%
*-commutative66.0%
times-frac66.0%
metadata-eval66.0%
Applied egg-rr66.0%
Taylor expanded in d around inf 34.8%
unpow-134.8%
metadata-eval34.8%
pow-sqr34.8%
rem-sqrt-square34.8%
rem-square-sqrt34.7%
fabs-sqr34.7%
rem-square-sqrt34.8%
Simplified34.8%
*-commutative34.8%
unpow-prod-down45.5%
Applied egg-rr45.5%
Final simplification45.0%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= d -2.1e-146)
(* (- d) (sqrt (/ (/ 1.0 l) h)))
(if (<= d -4e-310)
(/ d (cbrt (pow (* l h) 1.5)))
(/ d (* (sqrt l) (sqrt h))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -2.1e-146) {
tmp = -d * sqrt(((1.0 / l) / h));
} else if (d <= -4e-310) {
tmp = d / cbrt(pow((l * h), 1.5));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -2.1e-146) {
tmp = -d * Math.sqrt(((1.0 / l) / h));
} else if (d <= -4e-310) {
tmp = d / Math.cbrt(Math.pow((l * h), 1.5));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= -2.1e-146) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / l) / h))); elseif (d <= -4e-310) tmp = Float64(d / cbrt((Float64(l * h) ^ 1.5))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, -2.1e-146], N[((-d) * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4e-310], N[(d / N[Power[N[Power[N[(l * h), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -2.1 \cdot 10^{-146}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt[3]{{\left(\ell \cdot h\right)}^{1.5}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -2.0999999999999999e-146Initial program 79.4%
Simplified77.6%
add-sqr-sqrt77.6%
pow277.6%
sqrt-prod77.7%
sqrt-pow178.6%
*-commutative78.6%
metadata-eval78.6%
pow178.6%
div-inv78.6%
associate-*l*79.5%
times-frac79.4%
*-commutative79.4%
times-frac79.4%
metadata-eval79.4%
Applied egg-rr79.4%
Taylor expanded in D around 0 48.8%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt48.9%
neg-mul-148.9%
Simplified48.9%
if -2.0999999999999999e-146 < d < -3.999999999999988e-310Initial program 65.4%
Simplified62.5%
add-sqr-sqrt62.4%
pow262.4%
sqrt-prod62.4%
sqrt-pow162.4%
*-commutative62.4%
metadata-eval62.4%
pow162.4%
div-inv62.4%
associate-*l*62.5%
times-frac62.5%
*-commutative62.5%
times-frac62.5%
metadata-eval62.5%
Applied egg-rr62.5%
Taylor expanded in d around inf 25.5%
unpow-125.5%
metadata-eval25.5%
pow-sqr25.5%
rem-sqrt-square25.6%
rem-square-sqrt25.6%
fabs-sqr25.6%
rem-square-sqrt25.6%
Simplified25.6%
Taylor expanded in d around 0 25.5%
*-commutative25.5%
unpow1/225.5%
rem-exp-log25.5%
rec-exp25.5%
exp-prod25.6%
distribute-lft-neg-out25.6%
exp-neg25.6%
exp-to-pow25.6%
unpow1/225.6%
associate-*l/25.6%
*-lft-identity25.6%
Simplified25.6%
add-cbrt-cube31.3%
pow1/331.3%
add-sqr-sqrt31.3%
pow131.3%
pow1/231.3%
pow-prod-up31.3%
metadata-eval31.3%
Applied egg-rr31.3%
unpow1/331.3%
Simplified31.3%
if -3.999999999999988e-310 < d Initial program 65.7%
Simplified64.8%
add-sqr-sqrt64.8%
pow264.8%
sqrt-prod64.8%
sqrt-pow167.5%
*-commutative67.5%
metadata-eval67.5%
pow167.5%
div-inv67.5%
associate-*l*66.0%
times-frac66.0%
*-commutative66.0%
times-frac66.0%
metadata-eval66.0%
Applied egg-rr66.0%
Taylor expanded in d around inf 34.8%
unpow-134.8%
metadata-eval34.8%
pow-sqr34.8%
rem-sqrt-square34.8%
rem-square-sqrt34.7%
fabs-sqr34.7%
rem-square-sqrt34.8%
Simplified34.8%
*-commutative34.8%
metadata-eval34.8%
pow-pow34.8%
inv-pow34.8%
pow1/234.8%
sqrt-div34.8%
metadata-eval34.8%
sqrt-unprod45.4%
div-inv45.4%
associate-/r*43.9%
Applied egg-rr43.9%
associate-/l/45.4%
Simplified45.4%
Final simplification45.0%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (if (<= d 4.5e-203) (* (- d) (sqrt (/ (/ 1.0 l) h))) (/ d (* (sqrt l) (sqrt h)))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= 4.5e-203) {
tmp = -d * sqrt(((1.0 / l) / h));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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_m
real(8) :: tmp
if (d <= 4.5d-203) then
tmp = -d * sqrt(((1.0d0 / l) / h))
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= 4.5e-203) {
tmp = -d * Math.sqrt(((1.0 / l) / h));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if d <= 4.5e-203: tmp = -d * math.sqrt(((1.0 / l) / h)) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= 4.5e-203) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / l) / h))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (d <= 4.5e-203)
tmp = -d * sqrt(((1.0 / l) / h));
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, 4.5e-203], N[((-d) * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 4.5 \cdot 10^{-203}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < 4.5000000000000002e-203Initial program 71.9%
Simplified70.1%
add-sqr-sqrt70.1%
pow270.1%
sqrt-prod70.1%
sqrt-pow170.7%
*-commutative70.7%
metadata-eval70.7%
pow170.7%
div-inv70.7%
associate-*l*70.7%
times-frac70.7%
*-commutative70.7%
times-frac70.7%
metadata-eval70.7%
Applied egg-rr70.7%
Taylor expanded in D around 0 35.6%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt38.1%
neg-mul-138.1%
Simplified38.1%
if 4.5000000000000002e-203 < d Initial program 70.3%
Simplified69.3%
add-sqr-sqrt69.3%
pow269.3%
sqrt-prod69.3%
sqrt-pow172.5%
*-commutative72.5%
metadata-eval72.5%
pow172.5%
div-inv72.5%
associate-*l*71.7%
times-frac71.7%
*-commutative71.7%
times-frac71.7%
metadata-eval71.7%
Applied egg-rr71.7%
Taylor expanded in d around inf 39.3%
unpow-139.3%
metadata-eval39.3%
pow-sqr39.3%
rem-sqrt-square39.3%
rem-square-sqrt39.2%
fabs-sqr39.2%
rem-square-sqrt39.3%
Simplified39.3%
*-commutative39.3%
metadata-eval39.3%
pow-pow39.3%
inv-pow39.3%
pow1/239.3%
sqrt-div39.3%
metadata-eval39.3%
sqrt-unprod52.4%
div-inv52.4%
associate-/r*50.5%
Applied egg-rr50.5%
associate-/l/52.4%
Simplified52.4%
Final simplification43.4%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (let* ((t_0 (sqrt (/ (/ 1.0 l) h)))) (if (<= d -9.8e-147) (* (- d) t_0) (* d t_0))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt(((1.0 / l) / h));
double tmp;
if (d <= -9.8e-147) {
tmp = -d * t_0;
} else {
tmp = d * t_0;
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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_m
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(((1.0d0 / l) / h))
if (d <= (-9.8d-147)) then
tmp = -d * t_0
else
tmp = d * t_0
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.sqrt(((1.0 / l) / h));
double tmp;
if (d <= -9.8e-147) {
tmp = -d * t_0;
} else {
tmp = d * t_0;
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.sqrt(((1.0 / l) / h)) tmp = 0 if d <= -9.8e-147: tmp = -d * t_0 else: tmp = d * t_0 return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(Float64(1.0 / l) / h)) tmp = 0.0 if (d <= -9.8e-147) tmp = Float64(Float64(-d) * t_0); else tmp = Float64(d * t_0); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = sqrt(((1.0 / l) / h));
tmp = 0.0;
if (d <= -9.8e-147)
tmp = -d * t_0;
else
tmp = d * t_0;
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -9.8e-147], N[((-d) * t$95$0), $MachinePrecision], N[(d * t$95$0), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\mathbf{if}\;d \leq -9.8 \cdot 10^{-147}:\\
\;\;\;\;\left(-d\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot t\_0\\
\end{array}
\end{array}
if d < -9.8000000000000001e-147Initial program 79.4%
Simplified77.6%
add-sqr-sqrt77.6%
pow277.6%
sqrt-prod77.7%
sqrt-pow178.6%
*-commutative78.6%
metadata-eval78.6%
pow178.6%
div-inv78.6%
associate-*l*79.5%
times-frac79.4%
*-commutative79.4%
times-frac79.4%
metadata-eval79.4%
Applied egg-rr79.4%
Taylor expanded in D around 0 48.8%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt48.9%
neg-mul-148.9%
Simplified48.9%
if -9.8000000000000001e-147 < d Initial program 65.6%
Simplified64.3%
add-sqr-sqrt64.3%
pow264.3%
sqrt-prod64.3%
sqrt-pow166.3%
*-commutative66.3%
metadata-eval66.3%
pow166.3%
div-inv66.3%
associate-*l*65.2%
times-frac65.2%
*-commutative65.2%
times-frac65.2%
metadata-eval65.2%
Applied egg-rr65.2%
Taylor expanded in d around inf 32.7%
unpow-132.7%
metadata-eval32.7%
pow-sqr32.7%
rem-sqrt-square32.7%
rem-square-sqrt32.6%
fabs-sqr32.6%
rem-square-sqrt32.7%
Simplified32.7%
Taylor expanded in d around 0 32.7%
*-commutative32.7%
unpow1/232.7%
rem-exp-log31.5%
rec-exp31.5%
exp-prod31.5%
distribute-lft-neg-out31.5%
exp-neg31.5%
exp-to-pow32.7%
unpow1/232.7%
associate-*l/32.7%
*-lft-identity32.7%
Simplified32.7%
Taylor expanded in d around 0 32.7%
*-commutative32.7%
associate-/r*32.7%
Simplified32.7%
Final simplification39.4%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (if (<= d -1.55e-143) (* d (- (pow (* l h) -0.5))) (* d (sqrt (/ (/ 1.0 l) h)))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -1.55e-143) {
tmp = d * -pow((l * h), -0.5);
} else {
tmp = d * sqrt(((1.0 / l) / h));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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_m
real(8) :: tmp
if (d <= (-1.55d-143)) then
tmp = d * -((l * h) ** (-0.5d0))
else
tmp = d * sqrt(((1.0d0 / l) / h))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -1.55e-143) {
tmp = d * -Math.pow((l * h), -0.5);
} else {
tmp = d * Math.sqrt(((1.0 / l) / h));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if d <= -1.55e-143: tmp = d * -math.pow((l * h), -0.5) else: tmp = d * math.sqrt(((1.0 / l) / h)) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= -1.55e-143) tmp = Float64(d * Float64(-(Float64(l * h) ^ -0.5))); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / l) / h))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (d <= -1.55e-143)
tmp = d * -((l * h) ^ -0.5);
else
tmp = d * sqrt(((1.0 / l) / h));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, -1.55e-143], N[(d * (-N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.55 \cdot 10^{-143}:\\
\;\;\;\;d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\end{array}
\end{array}
if d < -1.55000000000000004e-143Initial program 80.2%
Simplified78.4%
add-sqr-sqrt78.4%
pow278.4%
sqrt-prod78.4%
sqrt-pow179.3%
*-commutative79.3%
metadata-eval79.3%
pow179.3%
div-inv79.3%
associate-*l*80.2%
times-frac80.2%
*-commutative80.2%
times-frac80.2%
metadata-eval80.2%
Applied egg-rr80.2%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
unpow-10.0%
metadata-eval0.0%
pow-sqr0.0%
rem-sqrt-square0.0%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt48.2%
mul-1-neg48.2%
Simplified48.2%
if -1.55000000000000004e-143 < d Initial program 65.2%
Simplified63.9%
add-sqr-sqrt63.8%
pow263.8%
sqrt-prod63.8%
sqrt-pow165.9%
*-commutative65.9%
metadata-eval65.9%
pow165.9%
div-inv65.9%
associate-*l*64.8%
times-frac64.8%
*-commutative64.8%
times-frac64.8%
metadata-eval64.8%
Applied egg-rr64.8%
Taylor expanded in d around inf 32.5%
unpow-132.5%
metadata-eval32.5%
pow-sqr32.5%
rem-sqrt-square32.5%
rem-square-sqrt32.4%
fabs-sqr32.4%
rem-square-sqrt32.5%
Simplified32.5%
Taylor expanded in d around 0 32.5%
*-commutative32.5%
unpow1/232.5%
rem-exp-log31.3%
rec-exp31.3%
exp-prod31.3%
distribute-lft-neg-out31.3%
exp-neg31.3%
exp-to-pow32.5%
unpow1/232.5%
associate-*l/32.5%
*-lft-identity32.5%
Simplified32.5%
Taylor expanded in d around 0 32.5%
*-commutative32.5%
associate-/r*32.5%
Simplified32.5%
Final simplification39.0%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (if (<= d -1.76e-143) (/ d (- (sqrt (* l h)))) (* d (sqrt (/ (/ 1.0 l) h)))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -1.76e-143) {
tmp = d / -sqrt((l * h));
} else {
tmp = d * sqrt(((1.0 / l) / h));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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_m
real(8) :: tmp
if (d <= (-1.76d-143)) then
tmp = d / -sqrt((l * h))
else
tmp = d * sqrt(((1.0d0 / l) / h))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -1.76e-143) {
tmp = d / -Math.sqrt((l * h));
} else {
tmp = d * Math.sqrt(((1.0 / l) / h));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if d <= -1.76e-143: tmp = d / -math.sqrt((l * h)) else: tmp = d * math.sqrt(((1.0 / l) / h)) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= -1.76e-143) tmp = Float64(d / Float64(-sqrt(Float64(l * h)))); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / l) / h))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (d <= -1.76e-143)
tmp = d / -sqrt((l * h));
else
tmp = d * sqrt(((1.0 / l) / h));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, -1.76e-143], N[(d / (-N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.76 \cdot 10^{-143}:\\
\;\;\;\;\frac{d}{-\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\end{array}
\end{array}
if d < -1.76000000000000005e-143Initial program 80.2%
Simplified78.4%
add-sqr-sqrt78.4%
pow278.4%
sqrt-prod78.4%
sqrt-pow179.3%
*-commutative79.3%
metadata-eval79.3%
pow179.3%
div-inv79.3%
associate-*l*80.2%
times-frac80.2%
*-commutative80.2%
times-frac80.2%
metadata-eval80.2%
Applied egg-rr80.2%
Taylor expanded in d around inf 6.3%
unpow-16.3%
metadata-eval6.3%
pow-sqr6.3%
rem-sqrt-square6.3%
rem-square-sqrt6.3%
fabs-sqr6.3%
rem-square-sqrt6.3%
Simplified6.3%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt48.2%
mul-1-neg48.2%
distribute-rgt-neg-out48.2%
*-commutative48.2%
unpow1/248.2%
rem-exp-log45.3%
rec-exp45.3%
exp-prod45.3%
distribute-lft-neg-out45.3%
exp-neg45.3%
exp-to-pow48.1%
unpow1/248.1%
associate-*l/48.2%
*-lft-identity48.2%
distribute-frac-neg248.2%
Simplified48.2%
if -1.76000000000000005e-143 < d Initial program 65.2%
Simplified63.9%
add-sqr-sqrt63.8%
pow263.8%
sqrt-prod63.8%
sqrt-pow165.9%
*-commutative65.9%
metadata-eval65.9%
pow165.9%
div-inv65.9%
associate-*l*64.8%
times-frac64.8%
*-commutative64.8%
times-frac64.8%
metadata-eval64.8%
Applied egg-rr64.8%
Taylor expanded in d around inf 32.5%
unpow-132.5%
metadata-eval32.5%
pow-sqr32.5%
rem-sqrt-square32.5%
rem-square-sqrt32.4%
fabs-sqr32.4%
rem-square-sqrt32.5%
Simplified32.5%
Taylor expanded in d around 0 32.5%
*-commutative32.5%
unpow1/232.5%
rem-exp-log31.3%
rec-exp31.3%
exp-prod31.3%
distribute-lft-neg-out31.3%
exp-neg31.3%
exp-to-pow32.5%
unpow1/232.5%
associate-*l/32.5%
*-lft-identity32.5%
Simplified32.5%
Taylor expanded in d around 0 32.5%
*-commutative32.5%
associate-/r*32.5%
Simplified32.5%
Final simplification38.9%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (if (<= d -1.55e-143) (/ d (- (sqrt (* l h)))) (* d (sqrt (/ (/ 1.0 h) l)))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -1.55e-143) {
tmp = d / -sqrt((l * h));
} else {
tmp = d * sqrt(((1.0 / h) / l));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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_m
real(8) :: tmp
if (d <= (-1.55d-143)) then
tmp = d / -sqrt((l * h))
else
tmp = d * sqrt(((1.0d0 / h) / l))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -1.55e-143) {
tmp = d / -Math.sqrt((l * h));
} else {
tmp = d * Math.sqrt(((1.0 / h) / l));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if d <= -1.55e-143: tmp = d / -math.sqrt((l * h)) else: tmp = d * math.sqrt(((1.0 / h) / l)) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= -1.55e-143) tmp = Float64(d / Float64(-sqrt(Float64(l * h)))); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / h) / l))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (d <= -1.55e-143)
tmp = d / -sqrt((l * h));
else
tmp = d * sqrt(((1.0 / h) / l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, -1.55e-143], N[(d / (-N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.55 \cdot 10^{-143}:\\
\;\;\;\;\frac{d}{-\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\end{array}
\end{array}
if d < -1.55000000000000004e-143Initial program 80.2%
Simplified78.4%
add-sqr-sqrt78.4%
pow278.4%
sqrt-prod78.4%
sqrt-pow179.3%
*-commutative79.3%
metadata-eval79.3%
pow179.3%
div-inv79.3%
associate-*l*80.2%
times-frac80.2%
*-commutative80.2%
times-frac80.2%
metadata-eval80.2%
Applied egg-rr80.2%
Taylor expanded in d around inf 6.3%
unpow-16.3%
metadata-eval6.3%
pow-sqr6.3%
rem-sqrt-square6.3%
rem-square-sqrt6.3%
fabs-sqr6.3%
rem-square-sqrt6.3%
Simplified6.3%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt48.2%
mul-1-neg48.2%
distribute-rgt-neg-out48.2%
*-commutative48.2%
unpow1/248.2%
rem-exp-log45.3%
rec-exp45.3%
exp-prod45.3%
distribute-lft-neg-out45.3%
exp-neg45.3%
exp-to-pow48.1%
unpow1/248.1%
associate-*l/48.2%
*-lft-identity48.2%
distribute-frac-neg248.2%
Simplified48.2%
if -1.55000000000000004e-143 < d Initial program 65.2%
Simplified63.9%
add-sqr-sqrt63.8%
pow263.8%
sqrt-prod63.8%
sqrt-pow165.9%
*-commutative65.9%
metadata-eval65.9%
pow165.9%
div-inv65.9%
associate-*l*64.8%
times-frac64.8%
*-commutative64.8%
times-frac64.8%
metadata-eval64.8%
Applied egg-rr64.8%
Taylor expanded in d around inf 32.5%
unpow-132.5%
metadata-eval32.5%
pow-sqr32.5%
rem-sqrt-square32.5%
rem-square-sqrt32.4%
fabs-sqr32.4%
rem-square-sqrt32.5%
Simplified32.5%
Taylor expanded in d around 0 32.5%
associate-/r*32.5%
Simplified32.5%
Final simplification38.9%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (let* ((t_0 (sqrt (* l h)))) (if (<= d -1.55e-143) (/ d (- t_0)) (/ d t_0))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt((l * h));
double tmp;
if (d <= -1.55e-143) {
tmp = d / -t_0;
} else {
tmp = d / t_0;
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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_m
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((l * h))
if (d <= (-1.55d-143)) then
tmp = d / -t_0
else
tmp = d / t_0
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.sqrt((l * h));
double tmp;
if (d <= -1.55e-143) {
tmp = d / -t_0;
} else {
tmp = d / t_0;
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.sqrt((l * h)) tmp = 0 if d <= -1.55e-143: tmp = d / -t_0 else: tmp = d / t_0 return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(l * h)) tmp = 0.0 if (d <= -1.55e-143) tmp = Float64(d / Float64(-t_0)); else tmp = Float64(d / t_0); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = sqrt((l * h));
tmp = 0.0;
if (d <= -1.55e-143)
tmp = d / -t_0;
else
tmp = d / t_0;
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -1.55e-143], N[(d / (-t$95$0)), $MachinePrecision], N[(d / t$95$0), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\ell \cdot h}\\
\mathbf{if}\;d \leq -1.55 \cdot 10^{-143}:\\
\;\;\;\;\frac{d}{-t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{t\_0}\\
\end{array}
\end{array}
if d < -1.55000000000000004e-143Initial program 80.2%
Simplified78.4%
add-sqr-sqrt78.4%
pow278.4%
sqrt-prod78.4%
sqrt-pow179.3%
*-commutative79.3%
metadata-eval79.3%
pow179.3%
div-inv79.3%
associate-*l*80.2%
times-frac80.2%
*-commutative80.2%
times-frac80.2%
metadata-eval80.2%
Applied egg-rr80.2%
Taylor expanded in d around inf 6.3%
unpow-16.3%
metadata-eval6.3%
pow-sqr6.3%
rem-sqrt-square6.3%
rem-square-sqrt6.3%
fabs-sqr6.3%
rem-square-sqrt6.3%
Simplified6.3%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt48.2%
mul-1-neg48.2%
distribute-rgt-neg-out48.2%
*-commutative48.2%
unpow1/248.2%
rem-exp-log45.3%
rec-exp45.3%
exp-prod45.3%
distribute-lft-neg-out45.3%
exp-neg45.3%
exp-to-pow48.1%
unpow1/248.1%
associate-*l/48.2%
*-lft-identity48.2%
distribute-frac-neg248.2%
Simplified48.2%
if -1.55000000000000004e-143 < d Initial program 65.2%
Simplified63.9%
add-sqr-sqrt63.8%
pow263.8%
sqrt-prod63.8%
sqrt-pow165.9%
*-commutative65.9%
metadata-eval65.9%
pow165.9%
div-inv65.9%
associate-*l*64.8%
times-frac64.8%
*-commutative64.8%
times-frac64.8%
metadata-eval64.8%
Applied egg-rr64.8%
Taylor expanded in d around inf 32.5%
unpow-132.5%
metadata-eval32.5%
pow-sqr32.5%
rem-sqrt-square32.5%
rem-square-sqrt32.4%
fabs-sqr32.4%
rem-square-sqrt32.5%
Simplified32.5%
Taylor expanded in d around 0 32.5%
*-commutative32.5%
unpow1/232.5%
rem-exp-log31.3%
rec-exp31.3%
exp-prod31.3%
distribute-lft-neg-out31.3%
exp-neg31.3%
exp-to-pow32.5%
unpow1/232.5%
associate-*l/32.5%
*-lft-identity32.5%
Simplified32.5%
Final simplification38.9%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (/ d (sqrt (* l h))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
return d / sqrt((l * h));
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
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_m
code = d / sqrt((l * h))
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
return d / Math.sqrt((l * h));
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): return d / math.sqrt((l * h))
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) return Float64(d / sqrt(Float64(l * h))) end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp = code(d, h, l, M_m, D_m)
tmp = d / sqrt((l * h));
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\frac{d}{\sqrt{\ell \cdot h}}
\end{array}
Initial program 71.3%
Simplified69.8%
add-sqr-sqrt69.8%
pow269.8%
sqrt-prod69.8%
sqrt-pow171.4%
*-commutative71.4%
metadata-eval71.4%
pow171.4%
div-inv71.4%
associate-*l*71.1%
times-frac71.1%
*-commutative71.1%
times-frac71.1%
metadata-eval71.1%
Applied egg-rr71.1%
Taylor expanded in d around inf 21.7%
unpow-121.7%
metadata-eval21.7%
pow-sqr21.7%
rem-sqrt-square21.7%
rem-square-sqrt21.7%
fabs-sqr21.7%
rem-square-sqrt21.7%
Simplified21.7%
Taylor expanded in d around 0 21.7%
*-commutative21.7%
unpow1/221.7%
rem-exp-log21.0%
rec-exp21.1%
exp-prod21.1%
distribute-lft-neg-out21.1%
exp-neg21.1%
exp-to-pow21.7%
unpow1/221.7%
associate-*l/21.7%
*-lft-identity21.7%
Simplified21.7%
Final simplification21.7%
herbie shell --seed 2024150
(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)))))