
(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 15 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}
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (- 1.0 (* h (* 0.125 (/ (pow (* M (/ D_m d)) 2.0) l)))))
(t_1 (sqrt (- d))))
(if (<= l -2.6e-234)
(* (/ t_1 (sqrt (- h))) (* (sqrt (/ d l)) t_0))
(if (<= l -5e-310)
(* (sqrt (/ d h)) (* t_0 (/ t_1 (sqrt (- l)))))
(*
(/ (sqrt d) (sqrt l))
(*
(/ (sqrt d) (sqrt h))
(+ 1.0 (* (/ h l) (* (pow (* D_m (/ (/ M 2.0) d)) 2.0) -0.5)))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = 1.0 - (h * (0.125 * (pow((M * (D_m / d)), 2.0) / l)));
double t_1 = sqrt(-d);
double tmp;
if (l <= -2.6e-234) {
tmp = (t_1 / sqrt(-h)) * (sqrt((d / l)) * t_0);
} else if (l <= -5e-310) {
tmp = sqrt((d / h)) * (t_0 * (t_1 / sqrt(-l)));
} else {
tmp = (sqrt(d) / sqrt(l)) * ((sqrt(d) / sqrt(h)) * (1.0 + ((h / l) * (pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5))));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 - (h * (0.125d0 * (((m * (d_m / d)) ** 2.0d0) / l)))
t_1 = sqrt(-d)
if (l <= (-2.6d-234)) then
tmp = (t_1 / sqrt(-h)) * (sqrt((d / l)) * t_0)
else if (l <= (-5d-310)) then
tmp = sqrt((d / h)) * (t_0 * (t_1 / sqrt(-l)))
else
tmp = (sqrt(d) / sqrt(l)) * ((sqrt(d) / sqrt(h)) * (1.0d0 + ((h / l) * (((d_m * ((m / 2.0d0) / d)) ** 2.0d0) * (-0.5d0)))))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = 1.0 - (h * (0.125 * (Math.pow((M * (D_m / d)), 2.0) / l)));
double t_1 = Math.sqrt(-d);
double tmp;
if (l <= -2.6e-234) {
tmp = (t_1 / Math.sqrt(-h)) * (Math.sqrt((d / l)) * t_0);
} else if (l <= -5e-310) {
tmp = Math.sqrt((d / h)) * (t_0 * (t_1 / Math.sqrt(-l)));
} else {
tmp = (Math.sqrt(d) / Math.sqrt(l)) * ((Math.sqrt(d) / Math.sqrt(h)) * (1.0 + ((h / l) * (Math.pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5))));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = 1.0 - (h * (0.125 * (math.pow((M * (D_m / d)), 2.0) / l))) t_1 = math.sqrt(-d) tmp = 0 if l <= -2.6e-234: tmp = (t_1 / math.sqrt(-h)) * (math.sqrt((d / l)) * t_0) elif l <= -5e-310: tmp = math.sqrt((d / h)) * (t_0 * (t_1 / math.sqrt(-l))) else: tmp = (math.sqrt(d) / math.sqrt(l)) * ((math.sqrt(d) / math.sqrt(h)) * (1.0 + ((h / l) * (math.pow((D_m * ((M / 2.0) / d)), 2.0) * -0.5)))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(1.0 - Float64(h * Float64(0.125 * Float64((Float64(M * Float64(D_m / d)) ^ 2.0) / l)))) t_1 = sqrt(Float64(-d)) tmp = 0.0 if (l <= -2.6e-234) tmp = Float64(Float64(t_1 / sqrt(Float64(-h))) * Float64(sqrt(Float64(d / l)) * t_0)); elseif (l <= -5e-310) tmp = Float64(sqrt(Float64(d / h)) * Float64(t_0 * Float64(t_1 / sqrt(Float64(-l))))); else tmp = Float64(Float64(sqrt(d) / sqrt(l)) * Float64(Float64(sqrt(d) / sqrt(h)) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D_m * Float64(Float64(M / 2.0) / d)) ^ 2.0) * -0.5))))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = 1.0 - (h * (0.125 * (((M * (D_m / d)) ^ 2.0) / l)));
t_1 = sqrt(-d);
tmp = 0.0;
if (l <= -2.6e-234)
tmp = (t_1 / sqrt(-h)) * (sqrt((d / l)) * t_0);
elseif (l <= -5e-310)
tmp = sqrt((d / h)) * (t_0 * (t_1 / sqrt(-l)));
else
tmp = (sqrt(d) / sqrt(l)) * ((sqrt(d) / sqrt(h)) * (1.0 + ((h / l) * (((D_m * ((M / 2.0) / d)) ^ 2.0) * -0.5))));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(1.0 - N[(h * N[(0.125 * N[(N[Power[N[(M * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[l, -2.6e-234], N[(N[(t$95$1 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-310], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * N[(t$95$1 / N[Sqrt[(-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[(N[Power[N[(D$95$m * N[(N[(M / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := 1 - h \cdot \left(0.125 \cdot \frac{{\left(M \cdot \frac{D\_m}{d}\right)}^{2}}{\ell}\right)\\
t_1 := \sqrt{-d}\\
\mathbf{if}\;\ell \leq -2.6 \cdot 10^{-234}:\\
\;\;\;\;\frac{t\_1}{\sqrt{-h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot t\_0\right)\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t\_0 \cdot \frac{t\_1}{\sqrt{-\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(D\_m \cdot \frac{\frac{M}{2}}{d}\right)}^{2} \cdot -0.5\right)\right)\right)\\
\end{array}
\end{array}
if l < -2.59999999999999989e-234Initial program 68.3%
Simplified67.4%
Taylor expanded in h around -inf 42.6%
associate-*r*42.6%
neg-mul-142.6%
sub-neg42.6%
distribute-lft-in42.6%
Simplified70.3%
frac-2neg70.3%
sqrt-div82.2%
Applied egg-rr82.2%
if -2.59999999999999989e-234 < l < -4.999999999999985e-310Initial program 67.7%
Simplified61.0%
Taylor expanded in h around -inf 41.5%
associate-*r*41.5%
neg-mul-141.5%
sub-neg41.5%
distribute-lft-in41.5%
Simplified62.0%
frac-2neg62.0%
sqrt-div93.1%
Applied egg-rr93.1%
if -4.999999999999985e-310 < l Initial program 60.7%
Simplified61.8%
sqrt-div71.3%
Applied egg-rr71.3%
sqrt-div84.4%
Applied egg-rr84.4%
Final simplification84.0%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
(- 1.0 (* (/ h l) (* 0.5 (pow (/ (* M D_m) (* d 2.0)) 2.0))))))
(t_1 (pow (* D_m (/ M d)) 2.0)))
(if (<= t_0 4e+201)
(* (sqrt (/ d h)) (* (sqrt (/ d l)) (- 1.0 (* h (* 0.125 (/ t_1 l))))))
(if (<= t_0 INFINITY)
(* d (+ (/ (+ h (sqrt (/ h l))) h) -1.0))
(* d (/ (* t_1 (* (/ h l) -0.125)) (sqrt (* l h))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * pow(((M * D_m) / (d * 2.0)), 2.0))));
double t_1 = pow((D_m * (M / d)), 2.0);
double tmp;
if (t_0 <= 4e+201) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (h * (0.125 * (t_1 / l)))));
} else if (t_0 <= ((double) INFINITY)) {
tmp = d * (((h + sqrt((h / l))) / h) + -1.0);
} else {
tmp = d * ((t_1 * ((h / l) * -0.125)) / sqrt((l * h)));
}
return tmp;
}
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = (Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * Math.pow(((M * D_m) / (d * 2.0)), 2.0))));
double t_1 = Math.pow((D_m * (M / d)), 2.0);
double tmp;
if (t_0 <= 4e+201) {
tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 - (h * (0.125 * (t_1 / l)))));
} else if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = d * (((h + Math.sqrt((h / l))) / h) + -1.0);
} else {
tmp = d * ((t_1 * ((h / l) * -0.125)) / Math.sqrt((l * h)));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = (math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * math.pow(((M * D_m) / (d * 2.0)), 2.0)))) t_1 = math.pow((D_m * (M / d)), 2.0) tmp = 0 if t_0 <= 4e+201: tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 - (h * (0.125 * (t_1 / l))))) elif t_0 <= math.inf: tmp = d * (((h + math.sqrt((h / l))) / h) + -1.0) else: tmp = d * ((t_1 * ((h / l) * -0.125)) / math.sqrt((l * h))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(M * D_m) / Float64(d * 2.0)) ^ 2.0))))) t_1 = Float64(D_m * Float64(M / d)) ^ 2.0 tmp = 0.0 if (t_0 <= 4e+201) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(h * Float64(0.125 * Float64(t_1 / l)))))); elseif (t_0 <= Inf) tmp = Float64(d * Float64(Float64(Float64(h + sqrt(Float64(h / l))) / h) + -1.0)); else tmp = Float64(d * Float64(Float64(t_1 * Float64(Float64(h / l) * -0.125)) / sqrt(Float64(l * h)))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = (((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h / l) * (0.5 * (((M * D_m) / (d * 2.0)) ^ 2.0))));
t_1 = (D_m * (M / d)) ^ 2.0;
tmp = 0.0;
if (t_0 <= 4e+201)
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (h * (0.125 * (t_1 / l)))));
elseif (t_0 <= Inf)
tmp = d * (((h + sqrt((h / l))) / h) + -1.0);
else
tmp = d * ((t_1 * ((h / l) * -0.125)) / sqrt((l * h)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = 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[(M * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(D$95$m * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[t$95$0, 4e+201], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(h * N[(0.125 * N[(t$95$1 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(d * N[(N[(N[(h + N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(t$95$1 * N[(N[(h / l), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \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{M \cdot D\_m}{d \cdot 2}\right)}^{2}\right)\right)\\
t_1 := {\left(D\_m \cdot \frac{M}{d}\right)}^{2}\\
\mathbf{if}\;t\_0 \leq 4 \cdot 10^{+201}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - h \cdot \left(0.125 \cdot \frac{t\_1}{\ell}\right)\right)\right)\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;d \cdot \left(\frac{h + \sqrt{\frac{h}{\ell}}}{h} + -1\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{t\_1 \cdot \left(\frac{h}{\ell} \cdot -0.125\right)}{\sqrt{\ell \cdot h}}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 4.00000000000000015e201Initial program 86.7%
Simplified86.5%
Taylor expanded in h around -inf 54.1%
associate-*r*54.1%
neg-mul-154.1%
sub-neg54.1%
distribute-lft-in54.1%
Simplified87.1%
Taylor expanded in M around 0 86.7%
associate-/l*87.1%
Simplified87.1%
if 4.00000000000000015e201 < (*.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 64.8%
Simplified64.8%
Taylor expanded in d around inf 57.1%
expm1-log1p-u55.8%
expm1-undefine51.9%
inv-pow51.9%
sqrt-pow151.9%
metadata-eval51.9%
Applied egg-rr51.9%
Taylor expanded in h around 0 86.0%
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%
Taylor expanded in M around inf 5.3%
associate-*r*5.4%
times-frac0.0%
*-commutative0.0%
associate-/l*0.0%
unpow20.0%
unpow20.0%
unpow20.0%
times-frac0.0%
swap-sqr0.0%
unpow20.0%
Simplified0.0%
pow10.0%
associate-*r*0.0%
pow1/20.0%
pow1/20.0%
pow-prod-down0.0%
Applied egg-rr0.0%
unpow10.0%
unpow1/20.0%
Simplified0.0%
sqrt-prod0.0%
frac-2neg0.0%
sqrt-undiv0.2%
associate-*r*0.2%
sqrt-div0.0%
associate-*l/0.0%
frac-times0.0%
Applied egg-rr19.7%
associate-*r*19.7%
rem-square-sqrt19.7%
associate-/l*19.7%
*-commutative19.7%
associate-*r/19.7%
*-commutative19.7%
associate-*r/19.7%
associate-*l*19.7%
Simplified19.7%
Final simplification71.9%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (sqrt (/ d l)))
(t_1 (- 1.0 (* h (* 0.125 (/ (pow (* M (/ D_m d)) 2.0) l))))))
(if (<= h -5e-310)
(* (/ (sqrt (- d)) (sqrt (- h))) (* t_0 t_1))
(if (<= h 5.3e+73)
(* (sqrt (/ d h)) (* t_1 (/ (sqrt d) (sqrt l))))
(*
(* t_0 (/ (sqrt d) (sqrt h)))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D_m d) (/ M 2.0)) 2.0)))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = sqrt((d / l));
double t_1 = 1.0 - (h * (0.125 * (pow((M * (D_m / d)), 2.0) / l)));
double tmp;
if (h <= -5e-310) {
tmp = (sqrt(-d) / sqrt(-h)) * (t_0 * t_1);
} else if (h <= 5.3e+73) {
tmp = sqrt((d / h)) * (t_1 * (sqrt(d) / sqrt(l)));
} else {
tmp = (t_0 * (sqrt(d) / sqrt(h))) * (1.0 - (0.5 * ((h / l) * pow(((D_m / d) * (M / 2.0)), 2.0))));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt((d / l))
t_1 = 1.0d0 - (h * (0.125d0 * (((m * (d_m / d)) ** 2.0d0) / l)))
if (h <= (-5d-310)) then
tmp = (sqrt(-d) / sqrt(-h)) * (t_0 * t_1)
else if (h <= 5.3d+73) then
tmp = sqrt((d / h)) * (t_1 * (sqrt(d) / sqrt(l)))
else
tmp = (t_0 * (sqrt(d) / sqrt(h))) * (1.0d0 - (0.5d0 * ((h / l) * (((d_m / d) * (m / 2.0d0)) ** 2.0d0))))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = Math.sqrt((d / l));
double t_1 = 1.0 - (h * (0.125 * (Math.pow((M * (D_m / d)), 2.0) / l)));
double tmp;
if (h <= -5e-310) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * (t_0 * t_1);
} else if (h <= 5.3e+73) {
tmp = Math.sqrt((d / h)) * (t_1 * (Math.sqrt(d) / Math.sqrt(l)));
} else {
tmp = (t_0 * (Math.sqrt(d) / Math.sqrt(h))) * (1.0 - (0.5 * ((h / l) * Math.pow(((D_m / d) * (M / 2.0)), 2.0))));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = math.sqrt((d / l)) t_1 = 1.0 - (h * (0.125 * (math.pow((M * (D_m / d)), 2.0) / l))) tmp = 0 if h <= -5e-310: tmp = (math.sqrt(-d) / math.sqrt(-h)) * (t_0 * t_1) elif h <= 5.3e+73: tmp = math.sqrt((d / h)) * (t_1 * (math.sqrt(d) / math.sqrt(l))) else: tmp = (t_0 * (math.sqrt(d) / math.sqrt(h))) * (1.0 - (0.5 * ((h / l) * math.pow(((D_m / d) * (M / 2.0)), 2.0)))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = sqrt(Float64(d / l)) t_1 = Float64(1.0 - Float64(h * Float64(0.125 * Float64((Float64(M * Float64(D_m / d)) ^ 2.0) / l)))) tmp = 0.0 if (h <= -5e-310) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(t_0 * t_1)); elseif (h <= 5.3e+73) tmp = Float64(sqrt(Float64(d / h)) * Float64(t_1 * Float64(sqrt(d) / sqrt(l)))); else tmp = Float64(Float64(t_0 * Float64(sqrt(d) / sqrt(h))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(M / 2.0)) ^ 2.0))))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = sqrt((d / l));
t_1 = 1.0 - (h * (0.125 * (((M * (D_m / d)) ^ 2.0) / l)));
tmp = 0.0;
if (h <= -5e-310)
tmp = (sqrt(-d) / sqrt(-h)) * (t_0 * t_1);
elseif (h <= 5.3e+73)
tmp = sqrt((d / h)) * (t_1 * (sqrt(d) / sqrt(l)));
else
tmp = (t_0 * (sqrt(d) / sqrt(h))) * (1.0 - (0.5 * ((h / l) * (((D_m / d) * (M / 2.0)) ^ 2.0))));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[(h * N[(0.125 * N[(N[Power[N[(M * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -5e-310], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 5.3e+73], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$1 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := 1 - h \cdot \left(0.125 \cdot \frac{{\left(M \cdot \frac{D\_m}{d}\right)}^{2}}{\ell}\right)\\
\mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(t\_0 \cdot t\_1\right)\\
\mathbf{elif}\;h \leq 5.3 \cdot 10^{+73}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t\_1 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 \cdot \frac{\sqrt{d}}{\sqrt{h}}\right) \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if h < -4.999999999999985e-310Initial program 68.2%
Simplified66.6%
Taylor expanded in h around -inf 42.5%
associate-*r*42.5%
neg-mul-142.5%
sub-neg42.5%
distribute-lft-in42.5%
Simplified69.3%
frac-2neg69.3%
sqrt-div79.7%
Applied egg-rr79.7%
if -4.999999999999985e-310 < h < 5.29999999999999996e73Initial program 67.3%
Simplified68.1%
Taylor expanded in h around -inf 51.7%
associate-*r*51.7%
neg-mul-151.7%
sub-neg51.7%
distribute-lft-in51.7%
Simplified70.5%
sqrt-div81.9%
Applied egg-rr84.3%
if 5.29999999999999996e73 < h Initial program 48.6%
Simplified50.4%
sqrt-div77.6%
Applied egg-rr67.5%
Final simplification79.0%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (sqrt (/ d h)))
(t_1 (- 1.0 (* h (* 0.125 (/ (pow (* M (/ D_m d)) 2.0) l))))))
(if (<= d -4.8e-213)
(* t_0 (* t_1 (/ (sqrt (- d)) (sqrt (- l)))))
(if (<= d -5e-310)
(*
d
(fabs
(* (* (/ h l) (pow (* D_m (/ M d)) 2.0)) (/ -0.125 (sqrt (* l h))))))
(* t_0 (* t_1 (/ (sqrt d) (sqrt l))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = sqrt((d / h));
double t_1 = 1.0 - (h * (0.125 * (pow((M * (D_m / d)), 2.0) / l)));
double tmp;
if (d <= -4.8e-213) {
tmp = t_0 * (t_1 * (sqrt(-d) / sqrt(-l)));
} else if (d <= -5e-310) {
tmp = d * fabs((((h / l) * pow((D_m * (M / d)), 2.0)) * (-0.125 / sqrt((l * h)))));
} else {
tmp = t_0 * (t_1 * (sqrt(d) / sqrt(l)));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt((d / h))
t_1 = 1.0d0 - (h * (0.125d0 * (((m * (d_m / d)) ** 2.0d0) / l)))
if (d <= (-4.8d-213)) then
tmp = t_0 * (t_1 * (sqrt(-d) / sqrt(-l)))
else if (d <= (-5d-310)) then
tmp = d * abs((((h / l) * ((d_m * (m / d)) ** 2.0d0)) * ((-0.125d0) / sqrt((l * h)))))
else
tmp = t_0 * (t_1 * (sqrt(d) / sqrt(l)))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = Math.sqrt((d / h));
double t_1 = 1.0 - (h * (0.125 * (Math.pow((M * (D_m / d)), 2.0) / l)));
double tmp;
if (d <= -4.8e-213) {
tmp = t_0 * (t_1 * (Math.sqrt(-d) / Math.sqrt(-l)));
} else if (d <= -5e-310) {
tmp = d * Math.abs((((h / l) * Math.pow((D_m * (M / d)), 2.0)) * (-0.125 / Math.sqrt((l * h)))));
} else {
tmp = t_0 * (t_1 * (Math.sqrt(d) / Math.sqrt(l)));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = math.sqrt((d / h)) t_1 = 1.0 - (h * (0.125 * (math.pow((M * (D_m / d)), 2.0) / l))) tmp = 0 if d <= -4.8e-213: tmp = t_0 * (t_1 * (math.sqrt(-d) / math.sqrt(-l))) elif d <= -5e-310: tmp = d * math.fabs((((h / l) * math.pow((D_m * (M / d)), 2.0)) * (-0.125 / math.sqrt((l * h))))) else: tmp = t_0 * (t_1 * (math.sqrt(d) / math.sqrt(l))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = sqrt(Float64(d / h)) t_1 = Float64(1.0 - Float64(h * Float64(0.125 * Float64((Float64(M * Float64(D_m / d)) ^ 2.0) / l)))) tmp = 0.0 if (d <= -4.8e-213) tmp = Float64(t_0 * Float64(t_1 * Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))))); elseif (d <= -5e-310) tmp = Float64(d * abs(Float64(Float64(Float64(h / l) * (Float64(D_m * Float64(M / d)) ^ 2.0)) * Float64(-0.125 / sqrt(Float64(l * h)))))); else tmp = Float64(t_0 * Float64(t_1 * Float64(sqrt(d) / sqrt(l)))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = sqrt((d / h));
t_1 = 1.0 - (h * (0.125 * (((M * (D_m / d)) ^ 2.0) / l)));
tmp = 0.0;
if (d <= -4.8e-213)
tmp = t_0 * (t_1 * (sqrt(-d) / sqrt(-l)));
elseif (d <= -5e-310)
tmp = d * abs((((h / l) * ((D_m * (M / d)) ^ 2.0)) * (-0.125 / sqrt((l * h)))));
else
tmp = t_0 * (t_1 * (sqrt(d) / sqrt(l)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[(h * N[(0.125 * N[(N[Power[N[(M * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -4.8e-213], N[(t$95$0 * N[(t$95$1 * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-310], N[(d * N[Abs[N[(N[(N[(h / l), $MachinePrecision] * N[Power[N[(D$95$m * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(-0.125 / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(t$95$1 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := 1 - h \cdot \left(0.125 \cdot \frac{{\left(M \cdot \frac{D\_m}{d}\right)}^{2}}{\ell}\right)\\
\mathbf{if}\;d \leq -4.8 \cdot 10^{-213}:\\
\;\;\;\;t\_0 \cdot \left(t\_1 \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right)\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \left|\left(\frac{h}{\ell} \cdot {\left(D\_m \cdot \frac{M}{d}\right)}^{2}\right) \cdot \frac{-0.125}{\sqrt{\ell \cdot h}}\right|\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(t\_1 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\
\end{array}
\end{array}
if d < -4.79999999999999991e-213Initial program 76.1%
Simplified74.2%
Taylor expanded in h around -inf 48.9%
associate-*r*48.9%
neg-mul-148.9%
sub-neg48.9%
distribute-lft-in48.9%
Simplified76.4%
frac-2neg76.4%
sqrt-div83.7%
Applied egg-rr83.7%
if -4.79999999999999991e-213 < d < -4.999999999999985e-310Initial program 22.7%
Simplified22.7%
Taylor expanded in M around inf 0.3%
associate-*r*5.9%
times-frac5.9%
*-commutative5.9%
associate-/l*6.0%
unpow26.0%
unpow26.0%
unpow26.0%
times-frac22.3%
swap-sqr22.7%
unpow222.7%
Simplified22.7%
pow122.7%
associate-*r*22.7%
pow1/222.7%
pow1/222.7%
pow-prod-down6.5%
Applied egg-rr6.5%
unpow16.5%
unpow1/26.5%
Simplified6.5%
add-cube-cbrt6.5%
pow36.5%
frac-times6.5%
sqrt-div6.5%
sqrt-unprod0.0%
add-sqr-sqrt6.6%
Applied egg-rr6.6%
rem-cube-cbrt6.6%
add-sqr-sqrt6.6%
sqrt-unprod6.6%
pow26.6%
*-commutative6.6%
Applied egg-rr6.6%
unpow26.6%
rem-sqrt-square6.6%
associate-*r/6.6%
associate-*l/6.6%
*-commutative6.6%
fabs-mul6.6%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt62.4%
*-commutative62.4%
associate-/l*62.4%
Simplified57.1%
if -4.999999999999985e-310 < d Initial program 60.7%
Simplified61.8%
Taylor expanded in h around -inf 43.8%
associate-*r*43.8%
neg-mul-143.8%
sub-neg43.8%
distribute-lft-in43.8%
Simplified64.9%
sqrt-div71.3%
Applied egg-rr74.5%
Final simplification77.0%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (sqrt (/ d h)))
(t_1 (- 1.0 (* h (* 0.125 (/ (pow (* M (/ D_m d)) 2.0) l))))))
(if (<= d -2.9e-197)
(* (* (sqrt (/ d l)) t_1) t_0)
(if (<= d -5e-310)
(*
d
(fabs
(* (* (/ h l) (pow (* D_m (/ M d)) 2.0)) (/ -0.125 (sqrt (* l h))))))
(* t_0 (* t_1 (/ (sqrt d) (sqrt l))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = sqrt((d / h));
double t_1 = 1.0 - (h * (0.125 * (pow((M * (D_m / d)), 2.0) / l)));
double tmp;
if (d <= -2.9e-197) {
tmp = (sqrt((d / l)) * t_1) * t_0;
} else if (d <= -5e-310) {
tmp = d * fabs((((h / l) * pow((D_m * (M / d)), 2.0)) * (-0.125 / sqrt((l * h)))));
} else {
tmp = t_0 * (t_1 * (sqrt(d) / sqrt(l)));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt((d / h))
t_1 = 1.0d0 - (h * (0.125d0 * (((m * (d_m / d)) ** 2.0d0) / l)))
if (d <= (-2.9d-197)) then
tmp = (sqrt((d / l)) * t_1) * t_0
else if (d <= (-5d-310)) then
tmp = d * abs((((h / l) * ((d_m * (m / d)) ** 2.0d0)) * ((-0.125d0) / sqrt((l * h)))))
else
tmp = t_0 * (t_1 * (sqrt(d) / sqrt(l)))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = Math.sqrt((d / h));
double t_1 = 1.0 - (h * (0.125 * (Math.pow((M * (D_m / d)), 2.0) / l)));
double tmp;
if (d <= -2.9e-197) {
tmp = (Math.sqrt((d / l)) * t_1) * t_0;
} else if (d <= -5e-310) {
tmp = d * Math.abs((((h / l) * Math.pow((D_m * (M / d)), 2.0)) * (-0.125 / Math.sqrt((l * h)))));
} else {
tmp = t_0 * (t_1 * (Math.sqrt(d) / Math.sqrt(l)));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = math.sqrt((d / h)) t_1 = 1.0 - (h * (0.125 * (math.pow((M * (D_m / d)), 2.0) / l))) tmp = 0 if d <= -2.9e-197: tmp = (math.sqrt((d / l)) * t_1) * t_0 elif d <= -5e-310: tmp = d * math.fabs((((h / l) * math.pow((D_m * (M / d)), 2.0)) * (-0.125 / math.sqrt((l * h))))) else: tmp = t_0 * (t_1 * (math.sqrt(d) / math.sqrt(l))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = sqrt(Float64(d / h)) t_1 = Float64(1.0 - Float64(h * Float64(0.125 * Float64((Float64(M * Float64(D_m / d)) ^ 2.0) / l)))) tmp = 0.0 if (d <= -2.9e-197) tmp = Float64(Float64(sqrt(Float64(d / l)) * t_1) * t_0); elseif (d <= -5e-310) tmp = Float64(d * abs(Float64(Float64(Float64(h / l) * (Float64(D_m * Float64(M / d)) ^ 2.0)) * Float64(-0.125 / sqrt(Float64(l * h)))))); else tmp = Float64(t_0 * Float64(t_1 * Float64(sqrt(d) / sqrt(l)))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = sqrt((d / h));
t_1 = 1.0 - (h * (0.125 * (((M * (D_m / d)) ^ 2.0) / l)));
tmp = 0.0;
if (d <= -2.9e-197)
tmp = (sqrt((d / l)) * t_1) * t_0;
elseif (d <= -5e-310)
tmp = d * abs((((h / l) * ((D_m * (M / d)) ^ 2.0)) * (-0.125 / sqrt((l * h)))));
else
tmp = t_0 * (t_1 * (sqrt(d) / sqrt(l)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[(h * N[(0.125 * N[(N[Power[N[(M * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -2.9e-197], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[d, -5e-310], N[(d * N[Abs[N[(N[(N[(h / l), $MachinePrecision] * N[Power[N[(D$95$m * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(-0.125 / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(t$95$1 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := 1 - h \cdot \left(0.125 \cdot \frac{{\left(M \cdot \frac{D\_m}{d}\right)}^{2}}{\ell}\right)\\
\mathbf{if}\;d \leq -2.9 \cdot 10^{-197}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot t\_1\right) \cdot t\_0\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \left|\left(\frac{h}{\ell} \cdot {\left(D\_m \cdot \frac{M}{d}\right)}^{2}\right) \cdot \frac{-0.125}{\sqrt{\ell \cdot h}}\right|\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(t\_1 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\
\end{array}
\end{array}
if d < -2.90000000000000023e-197Initial program 77.9%
Simplified75.9%
Taylor expanded in h around -inf 50.3%
associate-*r*50.3%
neg-mul-150.3%
sub-neg50.3%
distribute-lft-in50.3%
Simplified78.2%
if -2.90000000000000023e-197 < d < -4.999999999999985e-310Initial program 27.0%
Simplified26.9%
Taylor expanded in M around inf 4.6%
associate-*r*8.9%
times-frac8.9%
*-commutative8.9%
associate-/l*9.0%
unpow29.0%
unpow29.0%
unpow29.0%
times-frac22.6%
swap-sqr22.9%
unpow222.9%
Simplified22.9%
pow122.9%
associate-*r*22.9%
pow1/222.9%
pow1/222.9%
pow-prod-down5.9%
Applied egg-rr5.9%
unpow15.9%
unpow1/25.9%
Simplified5.9%
add-cube-cbrt5.9%
pow35.9%
frac-times5.9%
sqrt-div5.9%
sqrt-unprod0.0%
add-sqr-sqrt5.9%
Applied egg-rr5.9%
rem-cube-cbrt5.9%
add-sqr-sqrt5.9%
sqrt-unprod6.0%
pow26.0%
*-commutative6.0%
Applied egg-rr6.0%
unpow26.0%
rem-sqrt-square5.9%
associate-*r/6.0%
associate-*l/6.0%
*-commutative6.0%
fabs-mul6.0%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt58.3%
*-commutative58.3%
associate-/l*58.3%
Simplified54.1%
if -4.999999999999985e-310 < d Initial program 60.7%
Simplified61.8%
Taylor expanded in h around -inf 43.8%
associate-*r*43.8%
neg-mul-143.8%
sub-neg43.8%
distribute-lft-in43.8%
Simplified64.9%
sqrt-div71.3%
Applied egg-rr74.5%
Final simplification74.1%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (pow (* D_m (/ M d)) 2.0)) (t_1 (sqrt (* l h))))
(if (<= d -3.1e-181)
(*
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D_m d) (/ M 2.0)) 2.0))))
(sqrt (* (/ d l) (/ d h))))
(if (<= d -5e-310)
(* d (fabs (* (* (/ h l) t_0) (/ -0.125 t_1))))
(if (<= d 1.1e-132)
(* d (/ (* t_0 (* (/ h l) -0.125)) t_1))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = pow((D_m * (M / d)), 2.0);
double t_1 = sqrt((l * h));
double tmp;
if (d <= -3.1e-181) {
tmp = (1.0 - (0.5 * ((h / l) * pow(((D_m / d) * (M / 2.0)), 2.0)))) * sqrt(((d / l) * (d / h)));
} else if (d <= -5e-310) {
tmp = d * fabs((((h / l) * t_0) * (-0.125 / t_1)));
} else if (d <= 1.1e-132) {
tmp = d * ((t_0 * ((h / l) * -0.125)) / t_1);
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (d_m * (m / d)) ** 2.0d0
t_1 = sqrt((l * h))
if (d <= (-3.1d-181)) then
tmp = (1.0d0 - (0.5d0 * ((h / l) * (((d_m / d) * (m / 2.0d0)) ** 2.0d0)))) * sqrt(((d / l) * (d / h)))
else if (d <= (-5d-310)) then
tmp = d * abs((((h / l) * t_0) * ((-0.125d0) / t_1)))
else if (d <= 1.1d-132) then
tmp = d * ((t_0 * ((h / l) * (-0.125d0))) / t_1)
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(l))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = Math.pow((D_m * (M / d)), 2.0);
double t_1 = Math.sqrt((l * h));
double tmp;
if (d <= -3.1e-181) {
tmp = (1.0 - (0.5 * ((h / l) * Math.pow(((D_m / d) * (M / 2.0)), 2.0)))) * Math.sqrt(((d / l) * (d / h)));
} else if (d <= -5e-310) {
tmp = d * Math.abs((((h / l) * t_0) * (-0.125 / t_1)));
} else if (d <= 1.1e-132) {
tmp = d * ((t_0 * ((h / l) * -0.125)) / t_1);
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = math.pow((D_m * (M / d)), 2.0) t_1 = math.sqrt((l * h)) tmp = 0 if d <= -3.1e-181: tmp = (1.0 - (0.5 * ((h / l) * math.pow(((D_m / d) * (M / 2.0)), 2.0)))) * math.sqrt(((d / l) * (d / h))) elif d <= -5e-310: tmp = d * math.fabs((((h / l) * t_0) * (-0.125 / t_1))) elif d <= 1.1e-132: tmp = d * ((t_0 * ((h / l) * -0.125)) / t_1) else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(D_m * Float64(M / d)) ^ 2.0 t_1 = sqrt(Float64(l * h)) tmp = 0.0 if (d <= -3.1e-181) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(M / 2.0)) ^ 2.0)))) * sqrt(Float64(Float64(d / l) * Float64(d / h)))); elseif (d <= -5e-310) tmp = Float64(d * abs(Float64(Float64(Float64(h / l) * t_0) * Float64(-0.125 / t_1)))); elseif (d <= 1.1e-132) tmp = Float64(d * Float64(Float64(t_0 * Float64(Float64(h / l) * -0.125)) / t_1)); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = (D_m * (M / d)) ^ 2.0;
t_1 = sqrt((l * h));
tmp = 0.0;
if (d <= -3.1e-181)
tmp = (1.0 - (0.5 * ((h / l) * (((D_m / d) * (M / 2.0)) ^ 2.0)))) * sqrt(((d / l) * (d / h)));
elseif (d <= -5e-310)
tmp = d * abs((((h / l) * t_0) * (-0.125 / t_1)));
elseif (d <= 1.1e-132)
tmp = d * ((t_0 * ((h / l) * -0.125)) / t_1);
else
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Power[N[(D$95$m * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -3.1e-181], N[(N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-310], N[(d * N[Abs[N[(N[(N[(h / l), $MachinePrecision] * t$95$0), $MachinePrecision] * N[(-0.125 / t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.1e-132], N[(d * N[(N[(t$95$0 * N[(N[(h / l), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := {\left(D\_m \cdot \frac{M}{d}\right)}^{2}\\
t_1 := \sqrt{\ell \cdot h}\\
\mathbf{if}\;d \leq -3.1 \cdot 10^{-181}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \left|\left(\frac{h}{\ell} \cdot t\_0\right) \cdot \frac{-0.125}{t\_1}\right|\\
\mathbf{elif}\;d \leq 1.1 \cdot 10^{-132}:\\
\;\;\;\;d \cdot \frac{t\_0 \cdot \left(\frac{h}{\ell} \cdot -0.125\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -3.10000000000000021e-181Initial program 78.2%
Simplified77.1%
pow177.1%
sqrt-unprod69.4%
Applied egg-rr69.4%
unpow169.4%
Simplified69.4%
if -3.10000000000000021e-181 < d < -4.999999999999985e-310Initial program 31.5%
Simplified31.5%
Taylor expanded in M around inf 11.8%
associate-*r*15.6%
times-frac11.8%
*-commutative11.8%
associate-/l*11.8%
unpow211.8%
unpow211.8%
unpow211.8%
times-frac23.8%
swap-sqr24.2%
unpow224.2%
Simplified24.2%
pow124.2%
associate-*r*24.2%
pow1/224.2%
pow1/224.2%
pow-prod-down5.3%
Applied egg-rr5.3%
unpow15.3%
unpow1/25.3%
Simplified5.3%
add-cube-cbrt5.3%
pow35.3%
frac-times5.4%
sqrt-div5.4%
sqrt-unprod0.0%
add-sqr-sqrt5.5%
Applied egg-rr5.5%
rem-cube-cbrt5.5%
add-sqr-sqrt5.5%
sqrt-unprod5.4%
pow25.4%
*-commutative5.4%
Applied egg-rr5.4%
unpow25.4%
rem-sqrt-square5.5%
associate-*r/5.5%
associate-*l/5.5%
*-commutative5.5%
fabs-mul5.5%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt55.5%
*-commutative55.5%
associate-/l*55.5%
Simplified51.9%
if -4.999999999999985e-310 < d < 1.09999999999999995e-132Initial program 40.5%
Simplified42.0%
Taylor expanded in M around inf 20.1%
associate-*r*20.1%
times-frac20.1%
*-commutative20.1%
associate-/l*19.5%
unpow219.5%
unpow219.5%
unpow219.5%
times-frac26.6%
swap-sqr31.8%
unpow231.8%
Simplified31.8%
pow131.8%
associate-*r*31.8%
pow1/231.8%
pow1/231.8%
pow-prod-down24.7%
Applied egg-rr24.7%
unpow124.7%
unpow1/224.7%
Simplified24.7%
sqrt-prod31.8%
frac-2neg31.8%
sqrt-undiv0.0%
associate-*r*0.0%
sqrt-div0.0%
associate-*l/0.0%
frac-times0.0%
Applied egg-rr54.9%
associate-*r*54.9%
rem-square-sqrt54.8%
associate-/l*54.8%
*-commutative54.8%
associate-*r/54.8%
*-commutative54.8%
associate-*r/54.7%
associate-*l*54.7%
Simplified54.7%
if 1.09999999999999995e-132 < d Initial program 71.5%
Simplified72.4%
Taylor expanded in d around inf 60.9%
associate-/r*60.9%
sqrt-div72.6%
Applied egg-rr72.6%
Final simplification66.0%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (sqrt (* l h))))
(if (<= d -5e-156)
(*
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D_m d) (/ M 2.0)) 2.0))))
(sqrt (* (/ d l) (/ d h))))
(if (<= d -5e-310)
(* (/ d t_0) (* -0.125 (* (pow (* M (/ D_m d)) 2.0) (/ h (- l)))))
(if (<= d 1.28e-142)
(* d (/ (* (pow (* D_m (/ M d)) 2.0) (* (/ h l) -0.125)) t_0))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = sqrt((l * h));
double tmp;
if (d <= -5e-156) {
tmp = (1.0 - (0.5 * ((h / l) * pow(((D_m / d) * (M / 2.0)), 2.0)))) * sqrt(((d / l) * (d / h)));
} else if (d <= -5e-310) {
tmp = (d / t_0) * (-0.125 * (pow((M * (D_m / d)), 2.0) * (h / -l)));
} else if (d <= 1.28e-142) {
tmp = d * ((pow((D_m * (M / d)), 2.0) * ((h / l) * -0.125)) / t_0);
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((l * h))
if (d <= (-5d-156)) then
tmp = (1.0d0 - (0.5d0 * ((h / l) * (((d_m / d) * (m / 2.0d0)) ** 2.0d0)))) * sqrt(((d / l) * (d / h)))
else if (d <= (-5d-310)) then
tmp = (d / t_0) * ((-0.125d0) * (((m * (d_m / d)) ** 2.0d0) * (h / -l)))
else if (d <= 1.28d-142) then
tmp = d * ((((d_m * (m / d)) ** 2.0d0) * ((h / l) * (-0.125d0))) / t_0)
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(l))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = Math.sqrt((l * h));
double tmp;
if (d <= -5e-156) {
tmp = (1.0 - (0.5 * ((h / l) * Math.pow(((D_m / d) * (M / 2.0)), 2.0)))) * Math.sqrt(((d / l) * (d / h)));
} else if (d <= -5e-310) {
tmp = (d / t_0) * (-0.125 * (Math.pow((M * (D_m / d)), 2.0) * (h / -l)));
} else if (d <= 1.28e-142) {
tmp = d * ((Math.pow((D_m * (M / d)), 2.0) * ((h / l) * -0.125)) / t_0);
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = math.sqrt((l * h)) tmp = 0 if d <= -5e-156: tmp = (1.0 - (0.5 * ((h / l) * math.pow(((D_m / d) * (M / 2.0)), 2.0)))) * math.sqrt(((d / l) * (d / h))) elif d <= -5e-310: tmp = (d / t_0) * (-0.125 * (math.pow((M * (D_m / d)), 2.0) * (h / -l))) elif d <= 1.28e-142: tmp = d * ((math.pow((D_m * (M / d)), 2.0) * ((h / l) * -0.125)) / t_0) else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = sqrt(Float64(l * h)) tmp = 0.0 if (d <= -5e-156) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(M / 2.0)) ^ 2.0)))) * sqrt(Float64(Float64(d / l) * Float64(d / h)))); elseif (d <= -5e-310) tmp = Float64(Float64(d / t_0) * Float64(-0.125 * Float64((Float64(M * Float64(D_m / d)) ^ 2.0) * Float64(h / Float64(-l))))); elseif (d <= 1.28e-142) tmp = Float64(d * Float64(Float64((Float64(D_m * Float64(M / d)) ^ 2.0) * Float64(Float64(h / l) * -0.125)) / t_0)); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = sqrt((l * h));
tmp = 0.0;
if (d <= -5e-156)
tmp = (1.0 - (0.5 * ((h / l) * (((D_m / d) * (M / 2.0)) ^ 2.0)))) * sqrt(((d / l) * (d / h)));
elseif (d <= -5e-310)
tmp = (d / t_0) * (-0.125 * (((M * (D_m / d)) ^ 2.0) * (h / -l)));
elseif (d <= 1.28e-142)
tmp = d * ((((D_m * (M / d)) ^ 2.0) * ((h / l) * -0.125)) / t_0);
else
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -5e-156], N[(N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-310], N[(N[(d / t$95$0), $MachinePrecision] * N[(-0.125 * N[(N[Power[N[(M * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / (-l)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.28e-142], N[(d * N[(N[(N[Power[N[(D$95$m * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\ell \cdot h}\\
\mathbf{if}\;d \leq -5 \cdot 10^{-156}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{t\_0} \cdot \left(-0.125 \cdot \left({\left(M \cdot \frac{D\_m}{d}\right)}^{2} \cdot \frac{h}{-\ell}\right)\right)\\
\mathbf{elif}\;d \leq 1.28 \cdot 10^{-142}:\\
\;\;\;\;d \cdot \frac{{\left(D\_m \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.125\right)}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -5.00000000000000007e-156Initial program 77.9%
Simplified76.8%
pow176.8%
sqrt-unprod69.6%
Applied egg-rr69.6%
unpow169.6%
Simplified69.6%
if -5.00000000000000007e-156 < d < -4.999999999999985e-310Initial program 41.2%
Simplified41.1%
Taylor expanded in M around inf 12.7%
associate-*r*15.8%
times-frac12.7%
*-commutative12.7%
associate-/l*12.7%
unpow212.7%
unpow212.7%
unpow212.7%
times-frac25.8%
swap-sqr32.2%
unpow232.2%
Simplified32.2%
pow132.2%
associate-*r*32.2%
pow1/232.2%
pow1/232.2%
pow-prod-down16.9%
Applied egg-rr16.9%
unpow116.9%
unpow1/216.9%
Simplified16.9%
add-cube-cbrt16.8%
pow316.8%
frac-times4.7%
sqrt-div4.7%
sqrt-unprod0.0%
add-sqr-sqrt4.7%
Applied egg-rr4.7%
rem-cube-cbrt4.7%
div-inv4.7%
pow1/24.7%
pow-flip4.7%
metadata-eval4.7%
add-sqr-sqrt3.1%
sqrt-unprod20.0%
sqr-neg20.0%
distribute-rgt-neg-out20.0%
distribute-rgt-neg-out20.0%
sqrt-unprod48.3%
add-sqr-sqrt48.3%
distribute-rgt-neg-out48.3%
neg-mul-148.3%
metadata-eval48.3%
pow-flip48.3%
pow1/248.3%
div-inv48.3%
Applied egg-rr48.3%
if -4.999999999999985e-310 < d < 1.2799999999999999e-142Initial program 40.5%
Simplified42.0%
Taylor expanded in M around inf 20.1%
associate-*r*20.1%
times-frac20.1%
*-commutative20.1%
associate-/l*19.5%
unpow219.5%
unpow219.5%
unpow219.5%
times-frac26.6%
swap-sqr31.8%
unpow231.8%
Simplified31.8%
pow131.8%
associate-*r*31.8%
pow1/231.8%
pow1/231.8%
pow-prod-down24.7%
Applied egg-rr24.7%
unpow124.7%
unpow1/224.7%
Simplified24.7%
sqrt-prod31.8%
frac-2neg31.8%
sqrt-undiv0.0%
associate-*r*0.0%
sqrt-div0.0%
associate-*l/0.0%
frac-times0.0%
Applied egg-rr54.9%
associate-*r*54.9%
rem-square-sqrt54.8%
associate-/l*54.8%
*-commutative54.8%
associate-*r/54.8%
*-commutative54.8%
associate-*r/54.7%
associate-*l*54.7%
Simplified54.7%
if 1.2799999999999999e-142 < d Initial program 71.5%
Simplified72.4%
Taylor expanded in d around inf 60.9%
associate-/r*60.9%
sqrt-div72.6%
Applied egg-rr72.6%
Final simplification65.2%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (sqrt (* l h))))
(if (<= d -1.46e-61)
(/ d (- t_0))
(if (<= d -5e-310)
(* (/ d t_0) (* -0.125 (* (pow (* M (/ D_m d)) 2.0) (/ h (- l)))))
(if (<= d 1.85e-139)
(* d (/ (* (pow (* D_m (/ M d)) 2.0) (* (/ h l) -0.125)) t_0))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = sqrt((l * h));
double tmp;
if (d <= -1.46e-61) {
tmp = d / -t_0;
} else if (d <= -5e-310) {
tmp = (d / t_0) * (-0.125 * (pow((M * (D_m / d)), 2.0) * (h / -l)));
} else if (d <= 1.85e-139) {
tmp = d * ((pow((D_m * (M / d)), 2.0) * ((h / l) * -0.125)) / t_0);
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((l * h))
if (d <= (-1.46d-61)) then
tmp = d / -t_0
else if (d <= (-5d-310)) then
tmp = (d / t_0) * ((-0.125d0) * (((m * (d_m / d)) ** 2.0d0) * (h / -l)))
else if (d <= 1.85d-139) then
tmp = d * ((((d_m * (m / d)) ** 2.0d0) * ((h / l) * (-0.125d0))) / t_0)
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(l))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = Math.sqrt((l * h));
double tmp;
if (d <= -1.46e-61) {
tmp = d / -t_0;
} else if (d <= -5e-310) {
tmp = (d / t_0) * (-0.125 * (Math.pow((M * (D_m / d)), 2.0) * (h / -l)));
} else if (d <= 1.85e-139) {
tmp = d * ((Math.pow((D_m * (M / d)), 2.0) * ((h / l) * -0.125)) / t_0);
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = math.sqrt((l * h)) tmp = 0 if d <= -1.46e-61: tmp = d / -t_0 elif d <= -5e-310: tmp = (d / t_0) * (-0.125 * (math.pow((M * (D_m / d)), 2.0) * (h / -l))) elif d <= 1.85e-139: tmp = d * ((math.pow((D_m * (M / d)), 2.0) * ((h / l) * -0.125)) / t_0) else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = sqrt(Float64(l * h)) tmp = 0.0 if (d <= -1.46e-61) tmp = Float64(d / Float64(-t_0)); elseif (d <= -5e-310) tmp = Float64(Float64(d / t_0) * Float64(-0.125 * Float64((Float64(M * Float64(D_m / d)) ^ 2.0) * Float64(h / Float64(-l))))); elseif (d <= 1.85e-139) tmp = Float64(d * Float64(Float64((Float64(D_m * Float64(M / d)) ^ 2.0) * Float64(Float64(h / l) * -0.125)) / t_0)); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = sqrt((l * h));
tmp = 0.0;
if (d <= -1.46e-61)
tmp = d / -t_0;
elseif (d <= -5e-310)
tmp = (d / t_0) * (-0.125 * (((M * (D_m / d)) ^ 2.0) * (h / -l)));
elseif (d <= 1.85e-139)
tmp = d * ((((D_m * (M / d)) ^ 2.0) * ((h / l) * -0.125)) / t_0);
else
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -1.46e-61], N[(d / (-t$95$0)), $MachinePrecision], If[LessEqual[d, -5e-310], N[(N[(d / t$95$0), $MachinePrecision] * N[(-0.125 * N[(N[Power[N[(M * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / (-l)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.85e-139], N[(d * N[(N[(N[Power[N[(D$95$m * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\ell \cdot h}\\
\mathbf{if}\;d \leq -1.46 \cdot 10^{-61}:\\
\;\;\;\;\frac{d}{-t\_0}\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{t\_0} \cdot \left(-0.125 \cdot \left({\left(M \cdot \frac{D\_m}{d}\right)}^{2} \cdot \frac{h}{-\ell}\right)\right)\\
\mathbf{elif}\;d \leq 1.85 \cdot 10^{-139}:\\
\;\;\;\;d \cdot \frac{{\left(D\_m \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.125\right)}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.46e-61Initial program 79.4%
Simplified76.7%
Taylor expanded in d around inf 6.5%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt54.1%
unpow-154.1%
metadata-eval54.1%
pow-sqr54.1%
rem-sqrt-square54.1%
rem-square-sqrt53.7%
fabs-sqr53.7%
rem-square-sqrt54.1%
mul-1-neg54.1%
Simplified54.1%
Taylor expanded in d around 0 54.1%
mul-1-neg54.1%
distribute-rgt-neg-in54.1%
unpow1/254.1%
rem-exp-log51.1%
exp-neg51.1%
exp-prod51.1%
distribute-lft-neg-out51.1%
rec-exp51.1%
exp-to-pow54.1%
unpow1/254.1%
unpow-154.1%
metadata-eval54.1%
pow-sqr53.7%
pow-sqr54.1%
metadata-eval54.1%
unpow-154.1%
distribute-frac-neg254.1%
Simplified54.2%
if -1.46e-61 < d < -4.999999999999985e-310Initial program 52.3%
Simplified52.2%
Taylor expanded in M around inf 22.3%
associate-*r*24.3%
times-frac20.5%
*-commutative20.5%
associate-/l*20.5%
unpow220.5%
unpow220.5%
unpow220.5%
times-frac28.8%
swap-sqr34.9%
unpow234.9%
Simplified34.9%
pow134.9%
associate-*r*34.9%
pow1/234.9%
pow1/234.9%
pow-prod-down23.2%
Applied egg-rr23.2%
unpow123.2%
unpow1/223.2%
Simplified23.2%
add-cube-cbrt23.1%
pow323.1%
frac-times15.4%
sqrt-div19.3%
sqrt-unprod0.0%
add-sqr-sqrt3.6%
Applied egg-rr3.6%
rem-cube-cbrt3.6%
div-inv3.6%
pow1/23.6%
pow-flip3.6%
metadata-eval3.6%
add-sqr-sqrt2.0%
sqrt-unprod25.2%
sqr-neg25.2%
distribute-rgt-neg-out25.2%
distribute-rgt-neg-out25.2%
sqrt-unprod47.2%
add-sqr-sqrt47.2%
distribute-rgt-neg-out47.2%
neg-mul-147.2%
metadata-eval47.2%
pow-flip47.2%
pow1/247.2%
div-inv47.2%
Applied egg-rr47.2%
if -4.999999999999985e-310 < d < 1.85000000000000003e-139Initial program 40.5%
Simplified42.0%
Taylor expanded in M around inf 20.1%
associate-*r*20.1%
times-frac20.1%
*-commutative20.1%
associate-/l*19.5%
unpow219.5%
unpow219.5%
unpow219.5%
times-frac26.6%
swap-sqr31.8%
unpow231.8%
Simplified31.8%
pow131.8%
associate-*r*31.8%
pow1/231.8%
pow1/231.8%
pow-prod-down24.7%
Applied egg-rr24.7%
unpow124.7%
unpow1/224.7%
Simplified24.7%
sqrt-prod31.8%
frac-2neg31.8%
sqrt-undiv0.0%
associate-*r*0.0%
sqrt-div0.0%
associate-*l/0.0%
frac-times0.0%
Applied egg-rr54.9%
associate-*r*54.9%
rem-square-sqrt54.8%
associate-/l*54.8%
*-commutative54.8%
associate-*r/54.8%
*-commutative54.8%
associate-*r/54.7%
associate-*l*54.7%
Simplified54.7%
if 1.85000000000000003e-139 < d Initial program 71.5%
Simplified72.4%
Taylor expanded in d around inf 60.9%
associate-/r*60.9%
sqrt-div72.6%
Applied egg-rr72.6%
Final simplification59.2%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= d -6.6e-131)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= d -5e-310)
(* d (pow (+ -1.0 (fma h l 1.0)) -0.5))
(if (<= d 1.5e-137)
(*
d
(/ (* (pow (* D_m (/ M d)) 2.0) (* (/ h l) -0.125)) (sqrt (* l h))))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l)))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (d <= -6.6e-131) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (d <= -5e-310) {
tmp = d * pow((-1.0 + fma(h, l, 1.0)), -0.5);
} else if (d <= 1.5e-137) {
tmp = d * ((pow((D_m * (M / d)), 2.0) * ((h / l) * -0.125)) / sqrt((l * h)));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (d <= -6.6e-131) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (d <= -5e-310) tmp = Float64(d * (Float64(-1.0 + fma(h, l, 1.0)) ^ -0.5)); elseif (d <= 1.5e-137) tmp = Float64(d * Float64(Float64((Float64(D_m * Float64(M / d)) ^ 2.0) * Float64(Float64(h / l) * -0.125)) / sqrt(Float64(l * h)))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[d, -6.6e-131], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-310], N[(d * N[Power[N[(-1.0 + N[(h * l + 1.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.5e-137], N[(d * N[(N[(N[Power[N[(D$95$m * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -6.6 \cdot 10^{-131}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot {\left(-1 + \mathsf{fma}\left(h, \ell, 1\right)\right)}^{-0.5}\\
\mathbf{elif}\;d \leq 1.5 \cdot 10^{-137}:\\
\;\;\;\;d \cdot \frac{{\left(D\_m \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.125\right)}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -6.6000000000000004e-131Initial program 78.7%
Simplified76.4%
Taylor expanded in d around inf 51.3%
if -6.6000000000000004e-131 < d < -4.999999999999985e-310Initial program 45.2%
Simplified45.1%
Taylor expanded in d around inf 8.6%
pow18.6%
inv-pow8.6%
sqrt-pow18.6%
metadata-eval8.6%
Applied egg-rr8.6%
unpow18.6%
Simplified8.6%
expm1-log1p-u8.6%
expm1-undefine31.3%
Applied egg-rr31.3%
sub-neg31.3%
metadata-eval31.3%
+-commutative31.3%
log1p-undefine31.3%
rem-exp-log31.3%
+-commutative31.3%
fma-define31.3%
Simplified31.3%
if -4.999999999999985e-310 < d < 1.4999999999999999e-137Initial program 40.5%
Simplified42.0%
Taylor expanded in M around inf 20.1%
associate-*r*20.1%
times-frac20.1%
*-commutative20.1%
associate-/l*19.5%
unpow219.5%
unpow219.5%
unpow219.5%
times-frac26.6%
swap-sqr31.8%
unpow231.8%
Simplified31.8%
pow131.8%
associate-*r*31.8%
pow1/231.8%
pow1/231.8%
pow-prod-down24.7%
Applied egg-rr24.7%
unpow124.7%
unpow1/224.7%
Simplified24.7%
sqrt-prod31.8%
frac-2neg31.8%
sqrt-undiv0.0%
associate-*r*0.0%
sqrt-div0.0%
associate-*l/0.0%
frac-times0.0%
Applied egg-rr54.9%
associate-*r*54.9%
rem-square-sqrt54.8%
associate-/l*54.8%
*-commutative54.8%
associate-*r/54.8%
*-commutative54.8%
associate-*r/54.7%
associate-*l*54.7%
Simplified54.7%
if 1.4999999999999999e-137 < d Initial program 71.5%
Simplified72.4%
Taylor expanded in d around inf 60.9%
associate-/r*60.9%
sqrt-div72.6%
Applied egg-rr72.6%
Final simplification56.3%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= d -7.2e-130)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= d 1.46e-307)
(* d (pow (+ -1.0 (fma h l 1.0)) -0.5))
(if (<= d 2.7e-132)
(*
-0.125
(* (/ h l) (* (pow (* D_m (/ M d)) 2.0) (/ d (sqrt (* l h))))))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l)))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (d <= -7.2e-130) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (d <= 1.46e-307) {
tmp = d * pow((-1.0 + fma(h, l, 1.0)), -0.5);
} else if (d <= 2.7e-132) {
tmp = -0.125 * ((h / l) * (pow((D_m * (M / d)), 2.0) * (d / sqrt((l * h)))));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (d <= -7.2e-130) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (d <= 1.46e-307) tmp = Float64(d * (Float64(-1.0 + fma(h, l, 1.0)) ^ -0.5)); elseif (d <= 2.7e-132) tmp = Float64(-0.125 * Float64(Float64(h / l) * Float64((Float64(D_m * Float64(M / d)) ^ 2.0) * Float64(d / sqrt(Float64(l * h)))))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[d, -7.2e-130], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.46e-307], N[(d * N[Power[N[(-1.0 + N[(h * l + 1.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.7e-132], N[(-0.125 * N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D$95$m * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -7.2 \cdot 10^{-130}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;d \leq 1.46 \cdot 10^{-307}:\\
\;\;\;\;d \cdot {\left(-1 + \mathsf{fma}\left(h, \ell, 1\right)\right)}^{-0.5}\\
\mathbf{elif}\;d \leq 2.7 \cdot 10^{-132}:\\
\;\;\;\;-0.125 \cdot \left(\frac{h}{\ell} \cdot \left({\left(D\_m \cdot \frac{M}{d}\right)}^{2} \cdot \frac{d}{\sqrt{\ell \cdot h}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -7.2000000000000003e-130Initial program 78.7%
Simplified76.4%
Taylor expanded in d around inf 51.3%
if -7.2000000000000003e-130 < d < 1.4600000000000001e-307Initial program 45.2%
Simplified45.1%
Taylor expanded in d around inf 8.6%
pow18.6%
inv-pow8.6%
sqrt-pow18.6%
metadata-eval8.6%
Applied egg-rr8.6%
unpow18.6%
Simplified8.6%
expm1-log1p-u8.6%
expm1-undefine31.3%
Applied egg-rr31.3%
sub-neg31.3%
metadata-eval31.3%
+-commutative31.3%
log1p-undefine31.3%
rem-exp-log31.3%
+-commutative31.3%
fma-define31.3%
Simplified31.3%
if 1.4600000000000001e-307 < d < 2.6999999999999999e-132Initial program 40.5%
Simplified42.0%
Taylor expanded in M around inf 20.1%
associate-*r*20.1%
times-frac20.1%
*-commutative20.1%
associate-/l*19.5%
unpow219.5%
unpow219.5%
unpow219.5%
times-frac26.6%
swap-sqr31.8%
unpow231.8%
Simplified31.8%
pow131.8%
associate-*r*31.8%
pow1/231.8%
pow1/231.8%
pow-prod-down24.7%
Applied egg-rr24.7%
unpow124.7%
unpow1/224.7%
Simplified24.7%
add-cube-cbrt24.7%
pow324.7%
frac-times3.6%
sqrt-div10.0%
sqrt-unprod46.3%
add-sqr-sqrt46.3%
Applied egg-rr46.3%
rem-cube-cbrt46.3%
*-commutative46.3%
clear-num46.3%
un-div-inv46.3%
Applied egg-rr46.3%
associate-/r/54.8%
associate-*l/54.8%
associate-*r/46.3%
associate-*l*46.3%
*-commutative46.3%
associate-*l*48.3%
associate-*r/48.3%
*-commutative48.3%
associate-/l*48.1%
Simplified48.1%
if 2.6999999999999999e-132 < d Initial program 71.5%
Simplified72.4%
Taylor expanded in d around inf 60.9%
associate-/r*60.9%
sqrt-div72.6%
Applied egg-rr72.6%
Final simplification55.1%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= d -6e-128)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= d -5e-310)
(* d (pow (+ -1.0 (fma h l 1.0)) -0.5))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (d <= -6e-128) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (d <= -5e-310) {
tmp = d * pow((-1.0 + fma(h, l, 1.0)), -0.5);
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (d <= -6e-128) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (d <= -5e-310) tmp = Float64(d * (Float64(-1.0 + fma(h, l, 1.0)) ^ -0.5)); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[d, -6e-128], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-310], N[(d * N[Power[N[(-1.0 + N[(h * l + 1.0), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -6 \cdot 10^{-128}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot {\left(-1 + \mathsf{fma}\left(h, \ell, 1\right)\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -5.99999999999999956e-128Initial program 78.7%
Simplified76.4%
Taylor expanded in d around inf 51.3%
if -5.99999999999999956e-128 < d < -4.999999999999985e-310Initial program 45.2%
Simplified45.1%
Taylor expanded in d around inf 8.6%
pow18.6%
inv-pow8.6%
sqrt-pow18.6%
metadata-eval8.6%
Applied egg-rr8.6%
unpow18.6%
Simplified8.6%
expm1-log1p-u8.6%
expm1-undefine31.3%
Applied egg-rr31.3%
sub-neg31.3%
metadata-eval31.3%
+-commutative31.3%
log1p-undefine31.3%
rem-exp-log31.3%
+-commutative31.3%
fma-define31.3%
Simplified31.3%
if -4.999999999999985e-310 < d Initial program 60.7%
Simplified61.8%
Taylor expanded in d around inf 48.3%
associate-/r*48.2%
sqrt-div56.1%
Applied egg-rr56.1%
Final simplification50.8%
D_m = (fabs.f64 D) NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M D_m) :precision binary64 (if (<= l 2.8e-300) (/ d (- (sqrt (* l h)))) (* d (/ (sqrt (/ 1.0 h)) (sqrt l)))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= 2.8e-300) {
tmp = d / -sqrt((l * h));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: tmp
if (l <= 2.8d-300) then
tmp = d / -sqrt((l * h))
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(l))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= 2.8e-300) {
tmp = d / -Math.sqrt((l * h));
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if l <= 2.8e-300: tmp = d / -math.sqrt((l * h)) else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (l <= 2.8e-300) tmp = Float64(d / Float64(-sqrt(Float64(l * h)))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (l <= 2.8e-300)
tmp = d / -sqrt((l * h));
else
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, 2.8e-300], N[(d / (-N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 2.8 \cdot 10^{-300}:\\
\;\;\;\;\frac{d}{-\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < 2.79999999999999994e-300Initial program 68.7%
Simplified67.1%
Taylor expanded in d around inf 6.6%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt40.3%
unpow-140.3%
metadata-eval40.3%
pow-sqr40.3%
rem-sqrt-square40.3%
rem-square-sqrt40.0%
fabs-sqr40.0%
rem-square-sqrt40.3%
mul-1-neg40.3%
Simplified40.3%
Taylor expanded in d around 0 40.3%
mul-1-neg40.3%
distribute-rgt-neg-in40.3%
unpow1/240.3%
rem-exp-log38.1%
exp-neg38.1%
exp-prod38.1%
distribute-lft-neg-out38.1%
rec-exp38.1%
exp-to-pow40.3%
unpow1/240.3%
unpow-140.3%
metadata-eval40.3%
pow-sqr40.0%
pow-sqr40.3%
metadata-eval40.3%
unpow-140.3%
distribute-frac-neg240.3%
Simplified40.3%
if 2.79999999999999994e-300 < l Initial program 60.1%
Simplified61.3%
Taylor expanded in d around inf 49.0%
associate-/r*48.9%
sqrt-div56.9%
Applied egg-rr56.9%
Final simplification48.9%
D_m = (fabs.f64 D) NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M D_m) :precision binary64 (if (<= l -9.5e-294) (/ d (- (sqrt (* l h)))) (* d (pow (* l h) -0.5))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= -9.5e-294) {
tmp = d / -sqrt((l * h));
} else {
tmp = d * pow((l * h), -0.5);
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: tmp
if (l <= (-9.5d-294)) then
tmp = d / -sqrt((l * h))
else
tmp = d * ((l * h) ** (-0.5d0))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= -9.5e-294) {
tmp = d / -Math.sqrt((l * h));
} else {
tmp = d * Math.pow((l * h), -0.5);
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if l <= -9.5e-294: tmp = d / -math.sqrt((l * h)) else: tmp = d * math.pow((l * h), -0.5) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (l <= -9.5e-294) tmp = Float64(d / Float64(-sqrt(Float64(l * h)))); else tmp = Float64(d * (Float64(l * h) ^ -0.5)); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (l <= -9.5e-294)
tmp = d / -sqrt((l * h));
else
tmp = d * ((l * h) ^ -0.5);
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, -9.5e-294], N[(d / (-N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -9.5 \cdot 10^{-294}:\\
\;\;\;\;\frac{d}{-\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\end{array}
\end{array}
if l < -9.499999999999999e-294Initial program 67.4%
Simplified66.6%
Taylor expanded in d around inf 4.3%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt41.1%
unpow-141.1%
metadata-eval41.1%
pow-sqr41.1%
rem-sqrt-square41.1%
rem-square-sqrt40.9%
fabs-sqr40.9%
rem-square-sqrt41.1%
mul-1-neg41.1%
Simplified41.1%
Taylor expanded in d around 0 41.1%
mul-1-neg41.1%
distribute-rgt-neg-in41.1%
unpow1/241.1%
rem-exp-log38.9%
exp-neg38.9%
exp-prod38.9%
distribute-lft-neg-out38.9%
rec-exp38.9%
exp-to-pow41.1%
unpow1/241.1%
unpow-141.1%
metadata-eval41.1%
pow-sqr40.9%
pow-sqr41.1%
metadata-eval41.1%
unpow-141.1%
distribute-frac-neg241.1%
Simplified41.2%
if -9.499999999999999e-294 < l Initial program 61.5%
Simplified61.9%
Taylor expanded in d around inf 49.4%
pow149.4%
inv-pow49.4%
sqrt-pow149.4%
metadata-eval49.4%
Applied egg-rr49.4%
unpow149.4%
Simplified49.4%
Final simplification45.6%
D_m = (fabs.f64 D) NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M D_m) :precision binary64 (* d (pow (* l h) -0.5)))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
return d * pow((l * h), -0.5);
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
code = d * ((l * h) ** (-0.5d0))
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
return d * Math.pow((l * h), -0.5);
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): return d * math.pow((l * h), -0.5)
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) return Float64(d * (Float64(l * h) ^ -0.5)) end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp = code(d, h, l, M, D_m)
tmp = d * ((l * h) ^ -0.5);
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
d \cdot {\left(\ell \cdot h\right)}^{-0.5}
\end{array}
Initial program 64.2%
Simplified64.1%
Taylor expanded in d around inf 28.6%
pow128.6%
inv-pow28.6%
sqrt-pow128.6%
metadata-eval28.6%
Applied egg-rr28.6%
unpow128.6%
Simplified28.6%
Final simplification28.6%
D_m = (fabs.f64 D) NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M D_m) :precision binary64 (/ d (sqrt (* l h))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
return d / sqrt((l * h));
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
code = d / sqrt((l * h))
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
return d / Math.sqrt((l * h));
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): return d / math.sqrt((l * h))
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) return Float64(d / sqrt(Float64(l * h))) end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp = code(d, h, l, M, D_m)
tmp = d / sqrt((l * h));
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\frac{d}{\sqrt{\ell \cdot h}}
\end{array}
Initial program 64.2%
Simplified64.1%
Taylor expanded in d around inf 28.6%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt21.7%
unpow-121.7%
metadata-eval21.7%
pow-sqr21.7%
rem-sqrt-square21.7%
rem-square-sqrt21.6%
fabs-sqr21.6%
rem-square-sqrt21.7%
mul-1-neg21.7%
Simplified21.7%
Taylor expanded in d around 0 21.7%
mul-1-neg21.7%
distribute-lft-neg-in21.7%
unpow1/221.7%
rem-exp-log20.7%
exp-neg20.7%
exp-prod20.7%
distribute-lft-neg-out20.7%
rec-exp20.7%
exp-to-pow21.7%
metadata-eval21.7%
pow-sqr21.7%
fabs-sqr21.7%
pow-sqr21.7%
metadata-eval21.7%
unpow1/221.7%
fabs-neg21.7%
neg-mul-121.7%
rem-square-sqrt0.0%
unpow1/20.0%
metadata-eval0.0%
pow-sqr0.0%
unswap-sqr0.0%
Simplified28.6%
Final simplification28.6%
herbie shell --seed 2024165
(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)))))