
(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 20 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 (sqrt (- d))) (t_1 (* D_m (* 0.5 (/ M_m d)))))
(if (<= h -5e-310)
(*
(/ t_0 (sqrt (- h)))
(*
(/ t_0 (sqrt (- l)))
(+ 1.0 (* h (/ (pow (* D_m (* M_m (/ 0.5 d))) 2.0) (/ l -0.5))))))
(*
(/ (sqrt d) (sqrt h))
(* (sqrt (/ d l)) (+ 1.0 (* h (/ t_1 (/ (* l -2.0) t_1)))))))))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 t_1 = D_m * (0.5 * (M_m / d));
double tmp;
if (h <= -5e-310) {
tmp = (t_0 / sqrt(-h)) * ((t_0 / sqrt(-l)) * (1.0 + (h * (pow((D_m * (M_m * (0.5 / d))), 2.0) / (l / -0.5)))));
} else {
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * (1.0 + (h * (t_1 / ((l * -2.0) / t_1)))));
}
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 = sqrt(-d)
t_1 = d_m * (0.5d0 * (m_m / d))
if (h <= (-5d-310)) then
tmp = (t_0 / sqrt(-h)) * ((t_0 / sqrt(-l)) * (1.0d0 + (h * (((d_m * (m_m * (0.5d0 / d))) ** 2.0d0) / (l / (-0.5d0))))))
else
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * (1.0d0 + (h * (t_1 / ((l * (-2.0d0)) / t_1)))))
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 t_1 = D_m * (0.5 * (M_m / d));
double tmp;
if (h <= -5e-310) {
tmp = (t_0 / Math.sqrt(-h)) * ((t_0 / Math.sqrt(-l)) * (1.0 + (h * (Math.pow((D_m * (M_m * (0.5 / d))), 2.0) / (l / -0.5)))));
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * (Math.sqrt((d / l)) * (1.0 + (h * (t_1 / ((l * -2.0) / t_1)))));
}
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) t_1 = D_m * (0.5 * (M_m / d)) tmp = 0 if h <= -5e-310: tmp = (t_0 / math.sqrt(-h)) * ((t_0 / math.sqrt(-l)) * (1.0 + (h * (math.pow((D_m * (M_m * (0.5 / d))), 2.0) / (l / -0.5))))) else: tmp = (math.sqrt(d) / math.sqrt(h)) * (math.sqrt((d / l)) * (1.0 + (h * (t_1 / ((l * -2.0) / t_1))))) 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)) t_1 = Float64(D_m * Float64(0.5 * Float64(M_m / d))) tmp = 0.0 if (h <= -5e-310) tmp = Float64(Float64(t_0 / sqrt(Float64(-h))) * Float64(Float64(t_0 / sqrt(Float64(-l))) * Float64(1.0 + Float64(h * Float64((Float64(D_m * Float64(M_m * Float64(0.5 / d))) ^ 2.0) / Float64(l / -0.5)))))); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(h * Float64(t_1 / Float64(Float64(l * -2.0) / t_1)))))); 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);
t_1 = D_m * (0.5 * (M_m / d));
tmp = 0.0;
if (h <= -5e-310)
tmp = (t_0 / sqrt(-h)) * ((t_0 / sqrt(-l)) * (1.0 + (h * (((D_m * (M_m * (0.5 / d))) ^ 2.0) / (l / -0.5)))));
else
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * (1.0 + (h * (t_1 / ((l * -2.0) / t_1)))));
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]}, Block[{t$95$1 = N[(D$95$m * N[(0.5 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -5e-310], N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(h * N[(N[Power[N[(D$95$m * N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / N[(l / -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(h * N[(t$95$1 / N[(N[(l * -2.0), $MachinePrecision] / t$95$1), $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}\\
t_1 := D_m \cdot \left(0.5 \cdot \frac{M_m}{d}\right)\\
\mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{t_0}{\sqrt{-h}} \cdot \left(\frac{t_0}{\sqrt{-\ell}} \cdot \left(1 + h \cdot \frac{{\left(D_m \cdot \left(M_m \cdot \frac{0.5}{d}\right)\right)}^{2}}{\frac{\ell}{-0.5}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{t_1}{\frac{\ell \cdot -2}{t_1}}\right)\right)\\
\end{array}
\end{array}
if h < -4.999999999999985e-310Initial program 67.5%
Simplified66.8%
Applied egg-rr38.5%
expm1-def38.5%
expm1-log1p66.8%
*-commutative66.8%
associate-*r/69.9%
associate-*l/70.6%
*-commutative70.6%
associate-/l*70.6%
associate-*r*70.6%
*-commutative70.6%
associate-*l/71.3%
associate-*r/71.2%
associate-*r/71.2%
Simplified71.2%
frac-2neg71.2%
sqrt-div84.4%
Applied egg-rr84.4%
frac-2neg84.4%
sqrt-div87.4%
Applied egg-rr87.4%
if -4.999999999999985e-310 < h Initial program 63.8%
Simplified63.8%
Applied egg-rr37.5%
expm1-def37.5%
expm1-log1p63.8%
*-commutative63.8%
associate-*r/66.0%
associate-*l/67.3%
*-commutative67.3%
associate-/l*67.3%
associate-*r*67.3%
*-commutative67.3%
associate-*l/67.3%
associate-*r/67.3%
associate-*r/67.3%
Simplified67.3%
expm1-log1p-u42.4%
expm1-udef39.3%
associate-/r/39.3%
add-sqr-sqrt39.3%
pow239.3%
sqrt-pow139.3%
metadata-eval39.3%
pow139.3%
associate-*r/39.3%
Applied egg-rr39.3%
expm1-def42.4%
expm1-log1p67.3%
metadata-eval67.3%
times-frac67.3%
associate-*r/67.3%
*-commutative67.3%
associate-/l*66.5%
associate-/r/67.3%
*-commutative67.3%
associate-/r*67.3%
metadata-eval67.3%
Simplified67.3%
*-commutative67.3%
clear-num67.3%
div-inv67.3%
unpow267.3%
associate-/l*71.3%
*-commutative71.3%
associate-*l/71.3%
*-un-lft-identity71.3%
times-frac71.3%
metadata-eval71.3%
div-inv71.3%
metadata-eval71.3%
*-commutative71.3%
associate-*l/71.3%
*-un-lft-identity71.3%
times-frac71.3%
metadata-eval71.3%
Applied egg-rr71.3%
sqrt-div82.8%
div-inv82.8%
Applied egg-rr82.8%
associate-*r/82.8%
*-rgt-identity82.8%
Simplified82.8%
Final simplification85.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 l)))
(t_1 (* D_m (* 0.5 (/ M_m d))))
(t_2
(*
(* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
(- 1.0 (* (* 0.5 (pow (/ (* D_m M_m) (* d 2.0)) 2.0)) (/ h l)))))
(t_3 (sqrt (* h l))))
(if (<= t_2 -2e-122)
(* (* t_0 (+ 1.0 (* h (/ t_1 (/ (* l -2.0) t_1))))) (sqrt (/ d h)))
(if (<= t_2 0.0)
(*
d
(/ (fma -0.5 (* (/ h l) (pow (* D_m (* M_m (/ 0.5 d))) 2.0)) 1.0) t_3))
(if (<= t_2 INFINITY)
(*
(/ 1.0 (sqrt (/ h d)))
(*
t_0
(+ 1.0 (* (/ h l) (* -0.5 (pow (* (/ M_m 2.0) (/ D_m d)) 2.0))))))
(*
(/ d t_3)
(+
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 t_1 = D_m * (0.5 * (M_m / d));
double t_2 = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((0.5 * pow(((D_m * M_m) / (d * 2.0)), 2.0)) * (h / l)));
double t_3 = sqrt((h * l));
double tmp;
if (t_2 <= -2e-122) {
tmp = (t_0 * (1.0 + (h * (t_1 / ((l * -2.0) / t_1))))) * sqrt((d / h));
} else if (t_2 <= 0.0) {
tmp = d * (fma(-0.5, ((h / l) * pow((D_m * (M_m * (0.5 / d))), 2.0)), 1.0) / t_3);
} else if (t_2 <= ((double) INFINITY)) {
tmp = (1.0 / sqrt((h / d))) * (t_0 * (1.0 + ((h / l) * (-0.5 * pow(((M_m / 2.0) * (D_m / d)), 2.0)))));
} else {
tmp = (d / t_3) * (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) 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)) t_1 = Float64(D_m * Float64(0.5 * Float64(M_m / d))) t_2 = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(0.5 * (Float64(Float64(D_m * M_m) / Float64(d * 2.0)) ^ 2.0)) * Float64(h / l)))) t_3 = sqrt(Float64(h * l)) tmp = 0.0 if (t_2 <= -2e-122) tmp = Float64(Float64(t_0 * Float64(1.0 + Float64(h * Float64(t_1 / Float64(Float64(l * -2.0) / t_1))))) * sqrt(Float64(d / h))); elseif (t_2 <= 0.0) tmp = Float64(d * Float64(fma(-0.5, Float64(Float64(h / l) * (Float64(D_m * Float64(M_m * Float64(0.5 / d))) ^ 2.0)), 1.0) / t_3)); elseif (t_2 <= Inf) tmp = Float64(Float64(1.0 / sqrt(Float64(h / d))) * Float64(t_0 * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(M_m / 2.0) * Float64(D_m / d)) ^ 2.0)))))); else tmp = Float64(Float64(d / t_3) * Float64(1.0 + Float64(-0.5 * Float64(h / Float64(l / (Float64(M_m * Float64(Float64(D_m * 0.5) / d)) ^ 2.0)))))); 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_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(D$95$m * N[(0.5 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(0.5 * N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$2, -2e-122], N[(N[(t$95$0 * N[(1.0 + N[(h * N[(t$95$1 / N[(N[(l * -2.0), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0], N[(d * N[(N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D$95$m * N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / t$95$3), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[(N[(1.0 / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / t$95$3), $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(h / N[(l / N[Power[N[(M$95$m * N[(N[(D$95$m * 0.5), $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{\frac{d}{\ell}}\\
t_1 := D_m \cdot \left(0.5 \cdot \frac{M_m}{d}\right)\\
t_2 := \left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \left(0.5 \cdot {\left(\frac{D_m \cdot M_m}{d \cdot 2}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_3 := \sqrt{h \cdot \ell}\\
\mathbf{if}\;t_2 \leq -2 \cdot 10^{-122}:\\
\;\;\;\;\left(t_0 \cdot \left(1 + h \cdot \frac{t_1}{\frac{\ell \cdot -2}{t_1}}\right)\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;t_2 \leq 0:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(-0.5, \frac{h}{\ell} \cdot {\left(D_m \cdot \left(M_m \cdot \frac{0.5}{d}\right)\right)}^{2}, 1\right)}{t_3}\\
\mathbf{elif}\;t_2 \leq \infty:\\
\;\;\;\;\frac{1}{\sqrt{\frac{h}{d}}} \cdot \left(t_0 \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{M_m}{2} \cdot \frac{D_m}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{t_3} \cdot \left(1 + -0.5 \cdot \frac{h}{\frac{\ell}{{\left(M_m \cdot \frac{D_m \cdot 0.5}{d}\right)}^{2}}}\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < -2.00000000000000012e-122Initial program 85.3%
Simplified84.2%
Applied egg-rr0.1%
expm1-def0.1%
expm1-log1p84.2%
*-commutative84.2%
associate-*r/82.4%
associate-*l/85.4%
*-commutative85.4%
associate-/l*85.4%
associate-*r*85.4%
*-commutative85.4%
associate-*l/86.4%
associate-*r/86.6%
associate-*r/86.5%
Simplified86.5%
expm1-log1p-u51.9%
expm1-udef44.1%
associate-/r/44.1%
add-sqr-sqrt44.1%
pow244.1%
sqrt-pow144.1%
metadata-eval44.1%
pow144.1%
associate-*r/44.1%
Applied egg-rr44.1%
expm1-def51.9%
expm1-log1p86.6%
metadata-eval86.6%
times-frac86.6%
associate-*r/86.6%
*-commutative86.6%
associate-/l*85.3%
associate-/r/86.5%
*-commutative86.5%
associate-/r*86.5%
metadata-eval86.5%
Simplified86.5%
*-commutative86.5%
clear-num86.5%
div-inv86.5%
unpow286.5%
associate-/l*92.3%
*-commutative92.3%
associate-*l/92.4%
*-un-lft-identity92.4%
times-frac92.4%
metadata-eval92.4%
div-inv92.4%
metadata-eval92.4%
*-commutative92.4%
associate-*l/92.4%
*-un-lft-identity92.4%
times-frac92.4%
metadata-eval92.4%
Applied egg-rr92.4%
if -2.00000000000000012e-122 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < 0.0Initial program 50.6%
Simplified50.4%
*-commutative50.4%
associate-*l/50.4%
div-inv50.4%
associate-*l*50.4%
metadata-eval50.4%
Applied egg-rr50.4%
Applied egg-rr50.4%
expm1-def66.4%
expm1-log1p66.5%
associate-*l/72.0%
*-lft-identity72.0%
times-frac72.0%
rem-square-sqrt35.3%
associate-*r/35.3%
/-rgt-identity35.3%
rem-square-sqrt72.0%
Simplified77.3%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < +inf.0Initial program 85.5%
Simplified85.5%
clear-num85.3%
sqrt-div86.9%
metadata-eval86.9%
Applied egg-rr86.9%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) Initial program 0.0%
Simplified0.1%
*-commutative0.1%
associate-*l/16.1%
div-inv16.1%
associate-*l*16.1%
metadata-eval16.1%
Applied egg-rr16.1%
pow116.1%
Applied egg-rr31.2%
Final simplification76.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
(let* ((t_0 (* D_m (* 0.5 (/ M_m d))))
(t_1 (+ 1.0 (* h (/ t_0 (/ (* l -2.0) t_0))))))
(if (<= h -5e-310)
(* (sqrt (/ d h)) (* (/ (sqrt (- d)) (sqrt (- l))) t_1))
(* (/ (sqrt d) (sqrt h)) (* (sqrt (/ d l)) t_1)))))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 t_1 = 1.0 + (h * (t_0 / ((l * -2.0) / t_0)));
double tmp;
if (h <= -5e-310) {
tmp = sqrt((d / h)) * ((sqrt(-d) / sqrt(-l)) * t_1);
} else {
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * t_1);
}
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 = d_m * (0.5d0 * (m_m / d))
t_1 = 1.0d0 + (h * (t_0 / ((l * (-2.0d0)) / t_0)))
if (h <= (-5d-310)) then
tmp = sqrt((d / h)) * ((sqrt(-d) / sqrt(-l)) * t_1)
else
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * t_1)
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 t_1 = 1.0 + (h * (t_0 / ((l * -2.0) / t_0)));
double tmp;
if (h <= -5e-310) {
tmp = Math.sqrt((d / h)) * ((Math.sqrt(-d) / Math.sqrt(-l)) * t_1);
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * (Math.sqrt((d / l)) * t_1);
}
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)) t_1 = 1.0 + (h * (t_0 / ((l * -2.0) / t_0))) tmp = 0 if h <= -5e-310: tmp = math.sqrt((d / h)) * ((math.sqrt(-d) / math.sqrt(-l)) * t_1) else: tmp = (math.sqrt(d) / math.sqrt(h)) * (math.sqrt((d / l)) * t_1) 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))) t_1 = Float64(1.0 + Float64(h * Float64(t_0 / Float64(Float64(l * -2.0) / t_0)))) tmp = 0.0 if (h <= -5e-310) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * t_1)); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(sqrt(Float64(d / l)) * t_1)); 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));
t_1 = 1.0 + (h * (t_0 / ((l * -2.0) / t_0)));
tmp = 0.0;
if (h <= -5e-310)
tmp = sqrt((d / h)) * ((sqrt(-d) / sqrt(-l)) * t_1);
else
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * t_1);
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]}, Block[{t$95$1 = N[(1.0 + N[(h * N[(t$95$0 / N[(N[(l * -2.0), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -5e-310], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * t$95$1), $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)\\
t_1 := 1 + h \cdot \frac{t_0}{\frac{\ell \cdot -2}{t_0}}\\
\mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot t_1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot t_1\right)\\
\end{array}
\end{array}
if h < -4.999999999999985e-310Initial program 67.5%
Simplified66.8%
Applied egg-rr38.5%
expm1-def38.5%
expm1-log1p66.8%
*-commutative66.8%
associate-*r/69.9%
associate-*l/70.6%
*-commutative70.6%
associate-/l*70.6%
associate-*r*70.6%
*-commutative70.6%
associate-*l/71.3%
associate-*r/71.2%
associate-*r/71.2%
Simplified71.2%
expm1-log1p-u71.0%
expm1-udef68.1%
associate-/r/68.1%
add-sqr-sqrt68.1%
pow268.1%
sqrt-pow168.1%
metadata-eval68.1%
pow168.1%
associate-*r/68.1%
Applied egg-rr68.1%
expm1-def71.0%
expm1-log1p71.2%
metadata-eval71.2%
times-frac71.2%
associate-*r/71.2%
*-commutative71.2%
associate-/l*71.2%
associate-/r/71.2%
*-commutative71.2%
associate-/r*71.2%
metadata-eval71.2%
Simplified71.2%
*-commutative71.2%
clear-num71.2%
div-inv71.2%
unpow271.2%
associate-/l*73.1%
*-commutative73.1%
associate-*l/73.1%
*-un-lft-identity73.1%
times-frac73.1%
metadata-eval73.1%
div-inv73.1%
metadata-eval73.1%
*-commutative73.1%
associate-*l/73.1%
*-un-lft-identity73.1%
times-frac73.1%
metadata-eval73.1%
Applied egg-rr73.1%
frac-2neg84.4%
sqrt-div87.4%
Applied egg-rr76.3%
if -4.999999999999985e-310 < h Initial program 63.8%
Simplified63.8%
Applied egg-rr37.5%
expm1-def37.5%
expm1-log1p63.8%
*-commutative63.8%
associate-*r/66.0%
associate-*l/67.3%
*-commutative67.3%
associate-/l*67.3%
associate-*r*67.3%
*-commutative67.3%
associate-*l/67.3%
associate-*r/67.3%
associate-*r/67.3%
Simplified67.3%
expm1-log1p-u42.4%
expm1-udef39.3%
associate-/r/39.3%
add-sqr-sqrt39.3%
pow239.3%
sqrt-pow139.3%
metadata-eval39.3%
pow139.3%
associate-*r/39.3%
Applied egg-rr39.3%
expm1-def42.4%
expm1-log1p67.3%
metadata-eval67.3%
times-frac67.3%
associate-*r/67.3%
*-commutative67.3%
associate-/l*66.5%
associate-/r/67.3%
*-commutative67.3%
associate-/r*67.3%
metadata-eval67.3%
Simplified67.3%
*-commutative67.3%
clear-num67.3%
div-inv67.3%
unpow267.3%
associate-/l*71.3%
*-commutative71.3%
associate-*l/71.3%
*-un-lft-identity71.3%
times-frac71.3%
metadata-eval71.3%
div-inv71.3%
metadata-eval71.3%
*-commutative71.3%
associate-*l/71.3%
*-un-lft-identity71.3%
times-frac71.3%
metadata-eval71.3%
Applied egg-rr71.3%
sqrt-div82.8%
div-inv82.8%
Applied egg-rr82.8%
associate-*r/82.8%
*-rgt-identity82.8%
Simplified82.8%
Final simplification79.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 (* D_m (* 0.5 (/ M_m d))))
(t_1 (* (sqrt (/ d l)) (+ 1.0 (* h (/ t_0 (/ (* l -2.0) t_0)))))))
(if (<= l -2e-310)
(* (/ (sqrt (- d)) (sqrt (- h))) t_1)
(* (/ (sqrt d) (sqrt h)) t_1))))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 t_1 = sqrt((d / l)) * (1.0 + (h * (t_0 / ((l * -2.0) / t_0))));
double tmp;
if (l <= -2e-310) {
tmp = (sqrt(-d) / sqrt(-h)) * t_1;
} else {
tmp = (sqrt(d) / sqrt(h)) * t_1;
}
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 = d_m * (0.5d0 * (m_m / d))
t_1 = sqrt((d / l)) * (1.0d0 + (h * (t_0 / ((l * (-2.0d0)) / t_0))))
if (l <= (-2d-310)) then
tmp = (sqrt(-d) / sqrt(-h)) * t_1
else
tmp = (sqrt(d) / sqrt(h)) * t_1
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 t_1 = Math.sqrt((d / l)) * (1.0 + (h * (t_0 / ((l * -2.0) / t_0))));
double tmp;
if (l <= -2e-310) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * t_1;
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * t_1;
}
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)) t_1 = math.sqrt((d / l)) * (1.0 + (h * (t_0 / ((l * -2.0) / t_0)))) tmp = 0 if l <= -2e-310: tmp = (math.sqrt(-d) / math.sqrt(-h)) * t_1 else: tmp = (math.sqrt(d) / math.sqrt(h)) * t_1 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))) t_1 = Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(h * Float64(t_0 / Float64(Float64(l * -2.0) / t_0))))) tmp = 0.0 if (l <= -2e-310) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_1); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * t_1); 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));
t_1 = sqrt((d / l)) * (1.0 + (h * (t_0 / ((l * -2.0) / t_0))));
tmp = 0.0;
if (l <= -2e-310)
tmp = (sqrt(-d) / sqrt(-h)) * t_1;
else
tmp = (sqrt(d) / sqrt(h)) * t_1;
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]}, Block[{t$95$1 = N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(h * N[(t$95$0 / N[(N[(l * -2.0), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -2e-310], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * t$95$1), $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)\\
t_1 := \sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{t_0}{\frac{\ell \cdot -2}{t_0}}\right)\\
\mathbf{if}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot t_1\\
\end{array}
\end{array}
if l < -1.999999999999994e-310Initial program 67.5%
Simplified66.8%
Applied egg-rr38.5%
expm1-def38.5%
expm1-log1p66.8%
*-commutative66.8%
associate-*r/69.9%
associate-*l/70.6%
*-commutative70.6%
associate-/l*70.6%
associate-*r*70.6%
*-commutative70.6%
associate-*l/71.3%
associate-*r/71.2%
associate-*r/71.2%
Simplified71.2%
expm1-log1p-u71.0%
expm1-udef68.1%
associate-/r/68.1%
add-sqr-sqrt68.1%
pow268.1%
sqrt-pow168.1%
metadata-eval68.1%
pow168.1%
associate-*r/68.1%
Applied egg-rr68.1%
expm1-def71.0%
expm1-log1p71.2%
metadata-eval71.2%
times-frac71.2%
associate-*r/71.2%
*-commutative71.2%
associate-/l*71.2%
associate-/r/71.2%
*-commutative71.2%
associate-/r*71.2%
metadata-eval71.2%
Simplified71.2%
*-commutative71.2%
clear-num71.2%
div-inv71.2%
unpow271.2%
associate-/l*73.1%
*-commutative73.1%
associate-*l/73.1%
*-un-lft-identity73.1%
times-frac73.1%
metadata-eval73.1%
div-inv73.1%
metadata-eval73.1%
*-commutative73.1%
associate-*l/73.1%
*-un-lft-identity73.1%
times-frac73.1%
metadata-eval73.1%
Applied egg-rr73.1%
frac-2neg71.2%
sqrt-div84.4%
Applied egg-rr86.3%
if -1.999999999999994e-310 < l Initial program 63.8%
Simplified63.8%
Applied egg-rr37.5%
expm1-def37.5%
expm1-log1p63.8%
*-commutative63.8%
associate-*r/66.0%
associate-*l/67.3%
*-commutative67.3%
associate-/l*67.3%
associate-*r*67.3%
*-commutative67.3%
associate-*l/67.3%
associate-*r/67.3%
associate-*r/67.3%
Simplified67.3%
expm1-log1p-u42.4%
expm1-udef39.3%
associate-/r/39.3%
add-sqr-sqrt39.3%
pow239.3%
sqrt-pow139.3%
metadata-eval39.3%
pow139.3%
associate-*r/39.3%
Applied egg-rr39.3%
expm1-def42.4%
expm1-log1p67.3%
metadata-eval67.3%
times-frac67.3%
associate-*r/67.3%
*-commutative67.3%
associate-/l*66.5%
associate-/r/67.3%
*-commutative67.3%
associate-/r*67.3%
metadata-eval67.3%
Simplified67.3%
*-commutative67.3%
clear-num67.3%
div-inv67.3%
unpow267.3%
associate-/l*71.3%
*-commutative71.3%
associate-*l/71.3%
*-un-lft-identity71.3%
times-frac71.3%
metadata-eval71.3%
div-inv71.3%
metadata-eval71.3%
*-commutative71.3%
associate-*l/71.3%
*-un-lft-identity71.3%
times-frac71.3%
metadata-eval71.3%
Applied egg-rr71.3%
sqrt-div82.8%
div-inv82.8%
Applied egg-rr82.8%
associate-*r/82.8%
*-rgt-identity82.8%
Simplified82.8%
Final simplification84.6%
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))))
(t_1 (sqrt (/ d h)))
(t_2 (+ 1.0 (* h (/ t_0 (/ (* l -2.0) t_0))))))
(if (<= l 1.1e-308)
(* (* (sqrt (/ d l)) t_2) t_1)
(if (<= l 3.75e+15)
(*
(/ d (sqrt (* h l)))
(+ 1.0 (* -0.5 (/ h (/ l (pow (* M_m (/ (* D_m 0.5) d)) 2.0))))))
(* t_1 (* t_2 (/ (sqrt 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 t_0 = D_m * (0.5 * (M_m / d));
double t_1 = sqrt((d / h));
double t_2 = 1.0 + (h * (t_0 / ((l * -2.0) / t_0)));
double tmp;
if (l <= 1.1e-308) {
tmp = (sqrt((d / l)) * t_2) * t_1;
} else if (l <= 3.75e+15) {
tmp = (d / sqrt((h * l))) * (1.0 + (-0.5 * (h / (l / pow((M_m * ((D_m * 0.5) / d)), 2.0)))));
} else {
tmp = t_1 * (t_2 * (sqrt(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) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = d_m * (0.5d0 * (m_m / d))
t_1 = sqrt((d / h))
t_2 = 1.0d0 + (h * (t_0 / ((l * (-2.0d0)) / t_0)))
if (l <= 1.1d-308) then
tmp = (sqrt((d / l)) * t_2) * t_1
else if (l <= 3.75d+15) then
tmp = (d / sqrt((h * l))) * (1.0d0 + ((-0.5d0) * (h / (l / ((m_m * ((d_m * 0.5d0) / d)) ** 2.0d0)))))
else
tmp = t_1 * (t_2 * (sqrt(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 t_0 = D_m * (0.5 * (M_m / d));
double t_1 = Math.sqrt((d / h));
double t_2 = 1.0 + (h * (t_0 / ((l * -2.0) / t_0)));
double tmp;
if (l <= 1.1e-308) {
tmp = (Math.sqrt((d / l)) * t_2) * t_1;
} else if (l <= 3.75e+15) {
tmp = (d / Math.sqrt((h * l))) * (1.0 + (-0.5 * (h / (l / Math.pow((M_m * ((D_m * 0.5) / d)), 2.0)))));
} else {
tmp = t_1 * (t_2 * (Math.sqrt(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): t_0 = D_m * (0.5 * (M_m / d)) t_1 = math.sqrt((d / h)) t_2 = 1.0 + (h * (t_0 / ((l * -2.0) / t_0))) tmp = 0 if l <= 1.1e-308: tmp = (math.sqrt((d / l)) * t_2) * t_1 elif l <= 3.75e+15: tmp = (d / math.sqrt((h * l))) * (1.0 + (-0.5 * (h / (l / math.pow((M_m * ((D_m * 0.5) / d)), 2.0))))) else: tmp = t_1 * (t_2 * (math.sqrt(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) t_0 = Float64(D_m * Float64(0.5 * Float64(M_m / d))) t_1 = sqrt(Float64(d / h)) t_2 = Float64(1.0 + Float64(h * Float64(t_0 / Float64(Float64(l * -2.0) / t_0)))) tmp = 0.0 if (l <= 1.1e-308) tmp = Float64(Float64(sqrt(Float64(d / l)) * t_2) * t_1); elseif (l <= 3.75e+15) tmp = Float64(Float64(d / sqrt(Float64(h * l))) * Float64(1.0 + Float64(-0.5 * Float64(h / Float64(l / (Float64(M_m * Float64(Float64(D_m * 0.5) / d)) ^ 2.0)))))); else tmp = Float64(t_1 * Float64(t_2 * Float64(sqrt(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)
t_0 = D_m * (0.5 * (M_m / d));
t_1 = sqrt((d / h));
t_2 = 1.0 + (h * (t_0 / ((l * -2.0) / t_0)));
tmp = 0.0;
if (l <= 1.1e-308)
tmp = (sqrt((d / l)) * t_2) * t_1;
elseif (l <= 3.75e+15)
tmp = (d / sqrt((h * l))) * (1.0 + (-0.5 * (h / (l / ((M_m * ((D_m * 0.5) / d)) ^ 2.0)))));
else
tmp = t_1 * (t_2 * (sqrt(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_] := Block[{t$95$0 = N[(D$95$m * N[(0.5 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(1.0 + N[(h * N[(t$95$0 / N[(N[(l * -2.0), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, 1.1e-308], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * t$95$2), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[l, 3.75e+15], N[(N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(h / N[(l / N[Power[N[(M$95$m * N[(N[(D$95$m * 0.5), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(t$95$2 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_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)\\
t_1 := \sqrt{\frac{d}{h}}\\
t_2 := 1 + h \cdot \frac{t_0}{\frac{\ell \cdot -2}{t_0}}\\
\mathbf{if}\;\ell \leq 1.1 \cdot 10^{-308}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot t_2\right) \cdot t_1\\
\mathbf{elif}\;\ell \leq 3.75 \cdot 10^{+15}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + -0.5 \cdot \frac{h}{\frac{\ell}{{\left(M_m \cdot \frac{D_m \cdot 0.5}{d}\right)}^{2}}}\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(t_2 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\
\end{array}
\end{array}
if l < 1.1000000000000001e-308Initial program 67.5%
Simplified66.8%
Applied egg-rr38.5%
expm1-def38.5%
expm1-log1p66.8%
*-commutative66.8%
associate-*r/69.9%
associate-*l/70.6%
*-commutative70.6%
associate-/l*70.6%
associate-*r*70.6%
*-commutative70.6%
associate-*l/71.3%
associate-*r/71.2%
associate-*r/71.2%
Simplified71.2%
expm1-log1p-u71.0%
expm1-udef68.1%
associate-/r/68.1%
add-sqr-sqrt68.1%
pow268.1%
sqrt-pow168.1%
metadata-eval68.1%
pow168.1%
associate-*r/68.1%
Applied egg-rr68.1%
expm1-def71.0%
expm1-log1p71.2%
metadata-eval71.2%
times-frac71.2%
associate-*r/71.2%
*-commutative71.2%
associate-/l*71.2%
associate-/r/71.2%
*-commutative71.2%
associate-/r*71.2%
metadata-eval71.2%
Simplified71.2%
*-commutative71.2%
clear-num71.2%
div-inv71.2%
unpow271.2%
associate-/l*73.1%
*-commutative73.1%
associate-*l/73.1%
*-un-lft-identity73.1%
times-frac73.1%
metadata-eval73.1%
div-inv73.1%
metadata-eval73.1%
*-commutative73.1%
associate-*l/73.1%
*-un-lft-identity73.1%
times-frac73.1%
metadata-eval73.1%
Applied egg-rr73.1%
if 1.1000000000000001e-308 < l < 3.75e15Initial program 72.8%
Simplified72.8%
*-commutative72.8%
associate-*l/78.7%
div-inv78.7%
associate-*l*78.7%
metadata-eval78.7%
Applied egg-rr78.7%
pow178.7%
Applied egg-rr90.1%
if 3.75e15 < l Initial program 52.0%
Simplified52.0%
Applied egg-rr35.2%
expm1-def35.2%
expm1-log1p52.0%
*-commutative52.0%
associate-*r/51.0%
associate-*l/53.9%
*-commutative53.9%
associate-/l*53.9%
associate-*r*53.9%
*-commutative53.9%
associate-*l/53.9%
associate-*r/54.0%
associate-*r/54.0%
Simplified54.0%
expm1-log1p-u42.2%
expm1-udef36.7%
associate-/r/36.7%
add-sqr-sqrt36.7%
pow236.7%
sqrt-pow136.7%
metadata-eval36.7%
pow136.7%
associate-*r/36.7%
Applied egg-rr36.7%
expm1-def42.2%
expm1-log1p54.0%
metadata-eval54.0%
times-frac54.0%
associate-*r/54.0%
*-commutative54.0%
associate-/l*54.0%
associate-/r/54.0%
*-commutative54.0%
associate-/r*54.0%
metadata-eval54.0%
Simplified54.0%
*-commutative54.0%
clear-num54.0%
div-inv54.0%
unpow254.0%
associate-/l*61.3%
*-commutative61.3%
associate-*l/61.4%
*-un-lft-identity61.4%
times-frac61.4%
metadata-eval61.4%
div-inv61.4%
metadata-eval61.4%
*-commutative61.4%
associate-*l/61.3%
*-un-lft-identity61.3%
times-frac61.3%
metadata-eval61.3%
Applied egg-rr61.3%
sqrt-div74.5%
div-inv74.5%
Applied egg-rr74.5%
associate-*r/74.5%
*-rgt-identity74.5%
Simplified74.5%
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
(let* ((t_0 (* D_m (* 0.5 (/ M_m d))))
(t_1 (* (sqrt (/ d l)) (+ 1.0 (* h (/ t_0 (/ (* l -2.0) t_0)))))))
(if (<= l 3.6e-255) (* t_1 (sqrt (/ d h))) (* (/ (sqrt d) (sqrt h)) t_1))))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 t_1 = sqrt((d / l)) * (1.0 + (h * (t_0 / ((l * -2.0) / t_0))));
double tmp;
if (l <= 3.6e-255) {
tmp = t_1 * sqrt((d / h));
} else {
tmp = (sqrt(d) / sqrt(h)) * t_1;
}
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 = d_m * (0.5d0 * (m_m / d))
t_1 = sqrt((d / l)) * (1.0d0 + (h * (t_0 / ((l * (-2.0d0)) / t_0))))
if (l <= 3.6d-255) then
tmp = t_1 * sqrt((d / h))
else
tmp = (sqrt(d) / sqrt(h)) * t_1
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 t_1 = Math.sqrt((d / l)) * (1.0 + (h * (t_0 / ((l * -2.0) / t_0))));
double tmp;
if (l <= 3.6e-255) {
tmp = t_1 * Math.sqrt((d / h));
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * t_1;
}
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)) t_1 = math.sqrt((d / l)) * (1.0 + (h * (t_0 / ((l * -2.0) / t_0)))) tmp = 0 if l <= 3.6e-255: tmp = t_1 * math.sqrt((d / h)) else: tmp = (math.sqrt(d) / math.sqrt(h)) * t_1 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))) t_1 = Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(h * Float64(t_0 / Float64(Float64(l * -2.0) / t_0))))) tmp = 0.0 if (l <= 3.6e-255) tmp = Float64(t_1 * sqrt(Float64(d / h))); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * t_1); 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));
t_1 = sqrt((d / l)) * (1.0 + (h * (t_0 / ((l * -2.0) / t_0))));
tmp = 0.0;
if (l <= 3.6e-255)
tmp = t_1 * sqrt((d / h));
else
tmp = (sqrt(d) / sqrt(h)) * t_1;
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]}, Block[{t$95$1 = N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(h * N[(t$95$0 / N[(N[(l * -2.0), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, 3.6e-255], N[(t$95$1 * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * t$95$1), $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)\\
t_1 := \sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{t_0}{\frac{\ell \cdot -2}{t_0}}\right)\\
\mathbf{if}\;\ell \leq 3.6 \cdot 10^{-255}:\\
\;\;\;\;t_1 \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot t_1\\
\end{array}
\end{array}
if l < 3.6000000000000002e-255Initial program 66.1%
Simplified65.5%
Applied egg-rr36.8%
expm1-def36.8%
expm1-log1p65.5%
*-commutative65.5%
associate-*r/69.1%
associate-*l/69.8%
*-commutative69.8%
associate-/l*69.8%
associate-*r*69.8%
*-commutative69.8%
associate-*l/70.4%
associate-*r/70.3%
associate-*r/70.3%
Simplified70.3%
expm1-log1p-u67.4%
expm1-udef64.7%
associate-/r/64.7%
add-sqr-sqrt64.7%
pow264.7%
sqrt-pow164.7%
metadata-eval64.7%
pow164.7%
associate-*r/64.7%
Applied egg-rr64.7%
expm1-def67.4%
expm1-log1p70.3%
metadata-eval70.3%
times-frac70.3%
associate-*r/70.3%
*-commutative70.3%
associate-/l*69.6%
associate-/r/70.3%
*-commutative70.3%
associate-/r*70.3%
metadata-eval70.3%
Simplified70.3%
*-commutative70.3%
clear-num70.3%
div-inv70.3%
unpow270.3%
associate-/l*72.7%
*-commutative72.7%
associate-*l/72.7%
*-un-lft-identity72.7%
times-frac72.7%
metadata-eval72.7%
div-inv72.7%
metadata-eval72.7%
*-commutative72.7%
associate-*l/72.7%
*-un-lft-identity72.7%
times-frac72.7%
metadata-eval72.7%
Applied egg-rr72.7%
if 3.6000000000000002e-255 < l Initial program 65.3%
Simplified65.3%
Applied egg-rr39.7%
expm1-def39.7%
expm1-log1p65.3%
*-commutative65.3%
associate-*r/66.6%
associate-*l/68.0%
*-commutative68.0%
associate-/l*68.0%
associate-*r*68.0%
*-commutative68.0%
associate-*l/68.0%
associate-*r/68.1%
associate-*r/68.0%
Simplified68.0%
expm1-log1p-u44.1%
expm1-udef40.6%
associate-/r/40.6%
add-sqr-sqrt40.6%
pow240.6%
sqrt-pow140.6%
metadata-eval40.6%
pow140.6%
associate-*r/40.6%
Applied egg-rr40.6%
expm1-def44.1%
expm1-log1p68.1%
metadata-eval68.1%
times-frac68.1%
associate-*r/68.1%
*-commutative68.1%
associate-/l*68.1%
associate-/r/68.1%
*-commutative68.1%
associate-/r*68.1%
metadata-eval68.1%
Simplified68.1%
*-commutative68.1%
clear-num68.1%
div-inv68.0%
unpow268.0%
associate-/l*71.5%
*-commutative71.5%
associate-*l/71.6%
*-un-lft-identity71.6%
times-frac71.6%
metadata-eval71.6%
div-inv71.6%
metadata-eval71.6%
*-commutative71.6%
associate-*l/71.6%
*-un-lft-identity71.6%
times-frac71.6%
metadata-eval71.6%
Applied egg-rr71.6%
sqrt-div84.4%
div-inv84.4%
Applied egg-rr84.4%
associate-*r/84.4%
*-rgt-identity84.4%
Simplified84.4%
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
(let* ((t_0 (* D_m (* 0.5 (/ M_m d))))
(t_1
(*
(* (sqrt (/ d l)) (+ 1.0 (* h (/ t_0 (/ (* l -2.0) t_0)))))
(sqrt (/ d h)))))
(if (<= l -1e-306)
t_1
(if (<= l 2.6e+213)
(*
(/ d (sqrt (* h l)))
(+ 1.0 (* -0.5 (/ h (/ l (pow (* M_m (/ (* D_m 0.5) d)) 2.0))))))
(if (<= l 7.5e+275) t_1 (/ d (* (sqrt h) (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 t_0 = D_m * (0.5 * (M_m / d));
double t_1 = (sqrt((d / l)) * (1.0 + (h * (t_0 / ((l * -2.0) / t_0))))) * sqrt((d / h));
double tmp;
if (l <= -1e-306) {
tmp = t_1;
} else if (l <= 2.6e+213) {
tmp = (d / sqrt((h * l))) * (1.0 + (-0.5 * (h / (l / pow((M_m * ((D_m * 0.5) / d)), 2.0)))));
} else if (l <= 7.5e+275) {
tmp = t_1;
} else {
tmp = d / (sqrt(h) * 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d_m * (0.5d0 * (m_m / d))
t_1 = (sqrt((d / l)) * (1.0d0 + (h * (t_0 / ((l * (-2.0d0)) / t_0))))) * sqrt((d / h))
if (l <= (-1d-306)) then
tmp = t_1
else if (l <= 2.6d+213) then
tmp = (d / sqrt((h * l))) * (1.0d0 + ((-0.5d0) * (h / (l / ((m_m * ((d_m * 0.5d0) / d)) ** 2.0d0)))))
else if (l <= 7.5d+275) then
tmp = t_1
else
tmp = d / (sqrt(h) * 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 t_0 = D_m * (0.5 * (M_m / d));
double t_1 = (Math.sqrt((d / l)) * (1.0 + (h * (t_0 / ((l * -2.0) / t_0))))) * Math.sqrt((d / h));
double tmp;
if (l <= -1e-306) {
tmp = t_1;
} else if (l <= 2.6e+213) {
tmp = (d / Math.sqrt((h * l))) * (1.0 + (-0.5 * (h / (l / Math.pow((M_m * ((D_m * 0.5) / d)), 2.0)))));
} else if (l <= 7.5e+275) {
tmp = t_1;
} else {
tmp = d / (Math.sqrt(h) * 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): t_0 = D_m * (0.5 * (M_m / d)) t_1 = (math.sqrt((d / l)) * (1.0 + (h * (t_0 / ((l * -2.0) / t_0))))) * math.sqrt((d / h)) tmp = 0 if l <= -1e-306: tmp = t_1 elif l <= 2.6e+213: tmp = (d / math.sqrt((h * l))) * (1.0 + (-0.5 * (h / (l / math.pow((M_m * ((D_m * 0.5) / d)), 2.0))))) elif l <= 7.5e+275: tmp = t_1 else: tmp = d / (math.sqrt(h) * 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) t_0 = Float64(D_m * Float64(0.5 * Float64(M_m / d))) t_1 = Float64(Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(h * Float64(t_0 / Float64(Float64(l * -2.0) / t_0))))) * sqrt(Float64(d / h))) tmp = 0.0 if (l <= -1e-306) tmp = t_1; elseif (l <= 2.6e+213) tmp = Float64(Float64(d / sqrt(Float64(h * l))) * Float64(1.0 + Float64(-0.5 * Float64(h / Float64(l / (Float64(M_m * Float64(Float64(D_m * 0.5) / d)) ^ 2.0)))))); elseif (l <= 7.5e+275) tmp = t_1; else tmp = Float64(d / Float64(sqrt(h) * 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)
t_0 = D_m * (0.5 * (M_m / d));
t_1 = (sqrt((d / l)) * (1.0 + (h * (t_0 / ((l * -2.0) / t_0))))) * sqrt((d / h));
tmp = 0.0;
if (l <= -1e-306)
tmp = t_1;
elseif (l <= 2.6e+213)
tmp = (d / sqrt((h * l))) * (1.0 + (-0.5 * (h / (l / ((M_m * ((D_m * 0.5) / d)) ^ 2.0)))));
elseif (l <= 7.5e+275)
tmp = t_1;
else
tmp = d / (sqrt(h) * 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_] := Block[{t$95$0 = N[(D$95$m * N[(0.5 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(h * N[(t$95$0 / N[(N[(l * -2.0), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1e-306], t$95$1, If[LessEqual[l, 2.6e+213], N[(N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(h / N[(l / N[Power[N[(M$95$m * N[(N[(D$95$m * 0.5), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 7.5e+275], t$95$1, N[(d / N[(N[Sqrt[h], $MachinePrecision] * 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}
t_0 := D_m \cdot \left(0.5 \cdot \frac{M_m}{d}\right)\\
t_1 := \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{t_0}{\frac{\ell \cdot -2}{t_0}}\right)\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{if}\;\ell \leq -1 \cdot 10^{-306}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq 2.6 \cdot 10^{+213}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + -0.5 \cdot \frac{h}{\frac{\ell}{{\left(M_m \cdot \frac{D_m \cdot 0.5}{d}\right)}^{2}}}\right)\\
\mathbf{elif}\;\ell \leq 7.5 \cdot 10^{+275}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -1.00000000000000003e-306 or 2.59999999999999999e213 < l < 7.49999999999999978e275Initial program 65.5%
Simplified64.8%
Applied egg-rr38.5%
expm1-def38.5%
expm1-log1p64.8%
*-commutative64.8%
associate-*r/67.2%
associate-*l/68.3%
*-commutative68.3%
associate-/l*68.3%
associate-*r*68.3%
*-commutative68.3%
associate-*l/68.9%
associate-*r/68.8%
associate-*r/68.8%
Simplified68.8%
expm1-log1p-u68.6%
expm1-udef65.5%
associate-/r/65.5%
add-sqr-sqrt65.5%
pow265.5%
sqrt-pow165.5%
metadata-eval65.5%
pow165.5%
associate-*r/65.5%
Applied egg-rr65.5%
expm1-def68.6%
expm1-log1p68.8%
metadata-eval68.8%
times-frac68.8%
associate-*r/68.8%
*-commutative68.8%
associate-/l*68.8%
associate-/r/68.8%
*-commutative68.8%
associate-/r*68.8%
metadata-eval68.8%
Simplified68.8%
*-commutative68.8%
clear-num68.8%
div-inv68.8%
unpow268.8%
associate-/l*72.5%
*-commutative72.5%
associate-*l/72.5%
*-un-lft-identity72.5%
times-frac72.5%
metadata-eval72.5%
div-inv72.5%
metadata-eval72.5%
*-commutative72.5%
associate-*l/72.5%
*-un-lft-identity72.5%
times-frac72.5%
metadata-eval72.5%
Applied egg-rr72.5%
if -1.00000000000000003e-306 < l < 2.59999999999999999e213Initial program 69.1%
Simplified69.1%
*-commutative69.1%
associate-*l/74.3%
div-inv74.3%
associate-*l*74.3%
metadata-eval74.3%
Applied egg-rr74.3%
pow174.3%
Applied egg-rr84.2%
if 7.49999999999999978e275 < l Initial program 34.3%
Simplified34.4%
frac-2neg34.8%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in d around inf 56.8%
*-commutative56.8%
Simplified56.8%
expm1-log1p-u53.9%
expm1-udef32.7%
sqrt-div32.7%
metadata-eval32.7%
un-div-inv32.7%
Applied egg-rr32.7%
expm1-def53.9%
expm1-log1p56.8%
Simplified56.8%
sqrt-prod67.4%
Applied egg-rr67.4%
Final simplification76.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
(let* ((t_0 (* D_m (* 0.5 (/ M_m d)))))
(*
(* (sqrt (/ d l)) (+ 1.0 (* h (/ t_0 (/ (* l -2.0) t_0)))))
(sqrt (/ d 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 t_0 = D_m * (0.5 * (M_m / d));
return (sqrt((d / l)) * (1.0 + (h * (t_0 / ((l * -2.0) / t_0))))) * sqrt((d / 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
real(8) :: t_0
t_0 = d_m * (0.5d0 * (m_m / d))
code = (sqrt((d / l)) * (1.0d0 + (h * (t_0 / ((l * (-2.0d0)) / t_0))))) * sqrt((d / 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) {
double t_0 = D_m * (0.5 * (M_m / d));
return (Math.sqrt((d / l)) * (1.0 + (h * (t_0 / ((l * -2.0) / t_0))))) * Math.sqrt((d / 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): t_0 = D_m * (0.5 * (M_m / d)) return (math.sqrt((d / l)) * (1.0 + (h * (t_0 / ((l * -2.0) / t_0))))) * math.sqrt((d / 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) t_0 = Float64(D_m * Float64(0.5 * Float64(M_m / d))) return Float64(Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(h * Float64(t_0 / Float64(Float64(l * -2.0) / t_0))))) * sqrt(Float64(d / 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)
t_0 = D_m * (0.5 * (M_m / d));
tmp = (sqrt((d / l)) * (1.0 + (h * (t_0 / ((l * -2.0) / t_0))))) * sqrt((d / 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_] := Block[{t$95$0 = N[(D$95$m * N[(0.5 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(h * N[(t$95$0 / N[(N[(l * -2.0), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / 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}
t_0 := D_m \cdot \left(0.5 \cdot \frac{M_m}{d}\right)\\
\left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{t_0}{\frac{\ell \cdot -2}{t_0}}\right)\right) \cdot \sqrt{\frac{d}{h}}
\end{array}
\end{array}
Initial program 65.8%
Simplified65.4%
Applied egg-rr38.1%
expm1-def38.1%
expm1-log1p65.4%
*-commutative65.4%
associate-*r/68.1%
associate-*l/69.0%
*-commutative69.0%
associate-/l*69.0%
associate-*r*69.0%
*-commutative69.0%
associate-*l/69.4%
associate-*r/69.4%
associate-*r/69.4%
Simplified69.4%
expm1-log1p-u57.5%
expm1-udef54.5%
associate-/r/54.5%
add-sqr-sqrt54.5%
pow254.5%
sqrt-pow154.5%
metadata-eval54.5%
pow154.5%
associate-*r/54.5%
Applied egg-rr54.5%
expm1-def57.5%
expm1-log1p69.4%
metadata-eval69.4%
times-frac69.4%
associate-*r/69.4%
*-commutative69.4%
associate-/l*69.0%
associate-/r/69.4%
*-commutative69.4%
associate-/r*69.4%
metadata-eval69.4%
Simplified69.4%
*-commutative69.4%
clear-num69.4%
div-inv69.4%
unpow269.4%
associate-/l*72.2%
*-commutative72.2%
associate-*l/72.2%
*-un-lft-identity72.2%
times-frac72.2%
metadata-eval72.2%
div-inv72.2%
metadata-eval72.2%
*-commutative72.2%
associate-*l/72.2%
*-un-lft-identity72.2%
times-frac72.2%
metadata-eval72.2%
Applied egg-rr72.2%
Final simplification72.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
(*
(sqrt (/ d h))
(*
(sqrt (/ d l))
(+
1.0
(* h (/ (* D_m (* 0.5 (/ M_m d))) (* (/ -4.0 M_m) (* d (/ l D_m)))))))))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 sqrt((d / h)) * (sqrt((d / l)) * (1.0 + (h * ((D_m * (0.5 * (M_m / d))) / ((-4.0 / M_m) * (d * (l / D_m)))))));
}
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 = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 + (h * ((d_m * (0.5d0 * (m_m / d))) / (((-4.0d0) / m_m) * (d * (l / d_m)))))))
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 Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 + (h * ((D_m * (0.5 * (M_m / d))) / ((-4.0 / M_m) * (d * (l / D_m)))))));
}
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 math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 + (h * ((D_m * (0.5 * (M_m / d))) / ((-4.0 / M_m) * (d * (l / D_m)))))))
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(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(h * Float64(Float64(D_m * Float64(0.5 * Float64(M_m / d))) / Float64(Float64(-4.0 / M_m) * Float64(d * Float64(l / D_m)))))))) 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 = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + (h * ((D_m * (0.5 * (M_m / d))) / ((-4.0 / M_m) * (d * (l / D_m)))))));
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[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(h * N[(N[(D$95$m * N[(0.5 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(-4.0 / M$95$m), $MachinePrecision] * N[(d * N[(l / D$95$m), $MachinePrecision]), $MachinePrecision]), $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])\\
\\
\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \frac{D_m \cdot \left(0.5 \cdot \frac{M_m}{d}\right)}{\frac{-4}{M_m} \cdot \left(d \cdot \frac{\ell}{D_m}\right)}\right)\right)
\end{array}
Initial program 65.8%
Simplified65.4%
Applied egg-rr38.1%
expm1-def38.1%
expm1-log1p65.4%
*-commutative65.4%
associate-*r/68.1%
associate-*l/69.0%
*-commutative69.0%
associate-/l*69.0%
associate-*r*69.0%
*-commutative69.0%
associate-*l/69.4%
associate-*r/69.4%
associate-*r/69.4%
Simplified69.4%
expm1-log1p-u57.5%
expm1-udef54.5%
associate-/r/54.5%
add-sqr-sqrt54.5%
pow254.5%
sqrt-pow154.5%
metadata-eval54.5%
pow154.5%
associate-*r/54.5%
Applied egg-rr54.5%
expm1-def57.5%
expm1-log1p69.4%
metadata-eval69.4%
times-frac69.4%
associate-*r/69.4%
*-commutative69.4%
associate-/l*69.0%
associate-/r/69.4%
*-commutative69.4%
associate-/r*69.4%
metadata-eval69.4%
Simplified69.4%
*-commutative69.4%
clear-num69.4%
div-inv69.4%
unpow269.4%
associate-/l*72.2%
*-commutative72.2%
associate-*l/72.2%
*-un-lft-identity72.2%
times-frac72.2%
metadata-eval72.2%
div-inv72.2%
metadata-eval72.2%
*-commutative72.2%
associate-*l/72.2%
*-un-lft-identity72.2%
times-frac72.2%
metadata-eval72.2%
Applied egg-rr72.2%
Taylor expanded in l around 0 68.1%
associate-*r/68.1%
times-frac67.2%
metadata-eval67.2%
associate-/r*67.2%
*-commutative67.2%
*-commutative67.2%
associate-*l/69.6%
associate-/r/70.6%
associate-*r/71.0%
associate-*l/71.0%
*-commutative71.0%
rem-square-sqrt38.2%
associate-*l/38.2%
associate-/r/38.2%
Simplified70.0%
Final simplification70.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 (<= l -3.2e-186)
(* d (- (sqrt (/ 1.0 (* h l)))))
(if (<= l 5.8e-290)
(/ d (cbrt (pow (* h l) 1.5)))
(*
(/ d (sqrt (* h l)))
(+ 1.0 (* -0.5 (* (/ h l) (pow (* M_m (/ 0.5 (/ d D_m))) 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 (l <= -3.2e-186) {
tmp = d * -sqrt((1.0 / (h * l)));
} else if (l <= 5.8e-290) {
tmp = d / cbrt(pow((h * l), 1.5));
} else {
tmp = (d / sqrt((h * l))) * (1.0 + (-0.5 * ((h / l) * pow((M_m * (0.5 / (d / D_m))), 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 (l <= -3.2e-186) {
tmp = d * -Math.sqrt((1.0 / (h * l)));
} else if (l <= 5.8e-290) {
tmp = d / Math.cbrt(Math.pow((h * l), 1.5));
} else {
tmp = (d / Math.sqrt((h * l))) * (1.0 + (-0.5 * ((h / l) * Math.pow((M_m * (0.5 / (d / D_m))), 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 (l <= -3.2e-186) tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(h * l))))); elseif (l <= 5.8e-290) tmp = Float64(d / cbrt((Float64(h * l) ^ 1.5))); else tmp = Float64(Float64(d / sqrt(Float64(h * l))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(M_m * Float64(0.5 / Float64(d / D_m))) ^ 2.0))))); 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, -3.2e-186], N[(d * (-N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, 5.8e-290], N[(d / N[Power[N[Power[N[(h * l), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(M$95$m * N[(0.5 / N[(d / D$95$m), $MachinePrecision]), $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}
\mathbf{if}\;\ell \leq -3.2 \cdot 10^{-186}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\
\mathbf{elif}\;\ell \leq 5.8 \cdot 10^{-290}:\\
\;\;\;\;\frac{d}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M_m \cdot \frac{0.5}{\frac{d}{D_m}}\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if l < -3.2e-186Initial program 66.2%
Simplified65.5%
frac-2neg69.6%
sqrt-div83.0%
Applied egg-rr78.0%
Taylor expanded in d around -inf 48.0%
mul-1-neg48.0%
*-commutative48.0%
distribute-rgt-neg-in48.0%
*-commutative48.0%
Simplified48.0%
if -3.2e-186 < l < 5.79999999999999989e-290Initial program 66.6%
Simplified66.6%
frac-2neg76.4%
sqrt-div76.1%
Applied egg-rr71.4%
Taylor expanded in d around inf 43.9%
*-commutative43.9%
Simplified43.9%
expm1-log1p-u9.6%
expm1-udef9.4%
sqrt-div9.4%
metadata-eval9.4%
un-div-inv9.4%
Applied egg-rr9.4%
expm1-def9.6%
expm1-log1p44.0%
Simplified44.0%
add-cbrt-cube57.6%
pow1/357.1%
add-sqr-sqrt57.1%
pow157.1%
pow1/257.1%
pow-prod-up57.1%
metadata-eval57.1%
Applied egg-rr57.1%
unpow1/357.6%
Simplified57.6%
if 5.79999999999999989e-290 < l Initial program 65.2%
Simplified65.2%
*-commutative65.2%
associate-*l/67.3%
div-inv67.3%
associate-*l*67.3%
metadata-eval67.3%
Applied egg-rr67.3%
Applied egg-rr32.2%
expm1-def42.2%
expm1-log1p75.8%
associate-/r/69.9%
associate-/l*70.0%
Simplified70.0%
Final simplification58.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 -2.25e-122)
(*
(sqrt (* (/ d l) (/ d h)))
(+ 1.0 (* -0.5 (* (/ h l) (pow (* (/ D_m d) (* M_m 0.5)) 2.0)))))
(if (<= h -5e-310)
(* d (- (sqrt (/ 1.0 (* h l)))))
(*
(/ d (sqrt (* h l)))
(+ 1.0 (* -0.5 (* (/ h l) (pow (* M_m (/ 0.5 (/ d D_m))) 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 <= -2.25e-122) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h / l) * pow(((D_m / d) * (M_m * 0.5)), 2.0))));
} else if (h <= -5e-310) {
tmp = d * -sqrt((1.0 / (h * l)));
} else {
tmp = (d / sqrt((h * l))) * (1.0 + (-0.5 * ((h / l) * pow((M_m * (0.5 / (d / D_m))), 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 <= (-2.25d-122)) then
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 + ((-0.5d0) * ((h / l) * (((d_m / d) * (m_m * 0.5d0)) ** 2.0d0))))
else if (h <= (-5d-310)) then
tmp = d * -sqrt((1.0d0 / (h * l)))
else
tmp = (d / sqrt((h * l))) * (1.0d0 + ((-0.5d0) * ((h / l) * ((m_m * (0.5d0 / (d / d_m))) ** 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 <= -2.25e-122) {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h / l) * Math.pow(((D_m / d) * (M_m * 0.5)), 2.0))));
} else if (h <= -5e-310) {
tmp = d * -Math.sqrt((1.0 / (h * l)));
} else {
tmp = (d / Math.sqrt((h * l))) * (1.0 + (-0.5 * ((h / l) * Math.pow((M_m * (0.5 / (d / D_m))), 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 <= -2.25e-122: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h / l) * math.pow(((D_m / d) * (M_m * 0.5)), 2.0)))) elif h <= -5e-310: tmp = d * -math.sqrt((1.0 / (h * l))) else: tmp = (d / math.sqrt((h * l))) * (1.0 + (-0.5 * ((h / l) * math.pow((M_m * (0.5 / (d / D_m))), 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 <= -2.25e-122) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(M_m * 0.5)) ^ 2.0))))); elseif (h <= -5e-310) tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(h * l))))); else tmp = Float64(Float64(d / sqrt(Float64(h * l))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(M_m * Float64(0.5 / Float64(d / D_m))) ^ 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 <= -2.25e-122)
tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h / l) * (((D_m / d) * (M_m * 0.5)) ^ 2.0))));
elseif (h <= -5e-310)
tmp = d * -sqrt((1.0 / (h * l)));
else
tmp = (d / sqrt((h * l))) * (1.0 + (-0.5 * ((h / l) * ((M_m * (0.5 / (d / D_m))) ^ 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, -2.25e-122], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / 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$95$m * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -5e-310], N[(d * (-N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(M$95$m * N[(0.5 / N[(d / D$95$m), $MachinePrecision]), $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}
\mathbf{if}\;h \leq -2.25 \cdot 10^{-122}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D_m}{d} \cdot \left(M_m \cdot 0.5\right)\right)}^{2}\right)\right)\\
\mathbf{elif}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M_m \cdot \frac{0.5}{\frac{d}{D_m}}\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if h < -2.2499999999999999e-122Initial program 68.4%
Simplified68.5%
frac-2neg71.8%
sqrt-div83.9%
Applied egg-rr79.4%
expm1-log1p-u37.6%
expm1-udef27.0%
Applied egg-rr24.1%
expm1-def31.6%
expm1-log1p59.3%
*-commutative59.3%
Simplified59.3%
if -2.2499999999999999e-122 < h < -4.999999999999985e-310Initial program 65.8%
Simplified63.8%
frac-2neg70.0%
sqrt-div85.2%
Applied egg-rr79.0%
Taylor expanded in d around -inf 60.7%
mul-1-neg60.7%
*-commutative60.7%
distribute-rgt-neg-in60.7%
*-commutative60.7%
Simplified60.7%
if -4.999999999999985e-310 < h Initial program 63.8%
Simplified63.8%
*-commutative63.8%
associate-*l/66.8%
div-inv66.8%
associate-*l*66.8%
metadata-eval66.8%
Applied egg-rr66.8%
Applied egg-rr32.7%
expm1-def42.4%
expm1-log1p75.8%
associate-/r/68.5%
associate-/l*68.5%
Simplified68.5%
Final simplification63.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 -3e-190)
(* d (- (sqrt (/ 1.0 (* h l)))))
(if (<= l -2e-310)
(/ d (cbrt (pow (* h l) 1.5)))
(* d (* (pow l -0.5) (pow h -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 (l <= -3e-190) {
tmp = d * -sqrt((1.0 / (h * l)));
} else if (l <= -2e-310) {
tmp = d / cbrt(pow((h * l), 1.5));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -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 (l <= -3e-190) {
tmp = d * -Math.sqrt((1.0 / (h * l)));
} else if (l <= -2e-310) {
tmp = d / Math.cbrt(Math.pow((h * l), 1.5));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -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 (l <= -3e-190) tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(h * l))))); elseif (l <= -2e-310) tmp = Float64(d / cbrt((Float64(h * l) ^ 1.5))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -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[l, -3e-190], N[(d * (-N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, -2e-310], N[(d / N[Power[N[Power[N[(h * l), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_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 -3 \cdot 10^{-190}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -2.9999999999999998e-190Initial program 66.2%
Simplified65.5%
frac-2neg69.6%
sqrt-div83.0%
Applied egg-rr78.0%
Taylor expanded in d around -inf 48.0%
mul-1-neg48.0%
*-commutative48.0%
distribute-rgt-neg-in48.0%
*-commutative48.0%
Simplified48.0%
if -2.9999999999999998e-190 < l < -1.999999999999994e-310Initial program 76.4%
Simplified76.4%
frac-2neg82.3%
sqrt-div94.0%
Applied egg-rr88.1%
Taylor expanded in d around inf 42.5%
*-commutative42.5%
Simplified42.5%
expm1-log1p-u0.7%
expm1-udef0.5%
sqrt-div0.5%
metadata-eval0.5%
un-div-inv0.5%
Applied egg-rr0.5%
expm1-def0.7%
expm1-log1p42.5%
Simplified42.5%
add-cbrt-cube59.4%
pow1/359.4%
add-sqr-sqrt59.4%
pow159.4%
pow1/259.4%
pow-prod-up59.4%
metadata-eval59.4%
Applied egg-rr59.4%
unpow1/359.4%
Simplified59.4%
if -1.999999999999994e-310 < l Initial program 63.8%
Simplified63.8%
frac-2neg67.3%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in d around inf 45.4%
*-commutative45.4%
Simplified45.4%
add-log-exp13.3%
inv-pow13.3%
sqrt-pow113.3%
metadata-eval13.3%
Applied egg-rr13.3%
rem-log-exp45.4%
unpow-prod-down52.1%
Applied egg-rr52.1%
Final simplification50.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 -2.4e-190)
(* d (- (sqrt (/ 1.0 (* h l)))))
(if (<= l -2e-310)
(/ d (cbrt (pow (* h l) 1.5)))
(/ d (* (sqrt h) (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 <= -2.4e-190) {
tmp = d * -sqrt((1.0 / (h * l)));
} else if (l <= -2e-310) {
tmp = d / cbrt(pow((h * l), 1.5));
} else {
tmp = d / (sqrt(h) * 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 <= -2.4e-190) {
tmp = d * -Math.sqrt((1.0 / (h * l)));
} else if (l <= -2e-310) {
tmp = d / Math.cbrt(Math.pow((h * l), 1.5));
} else {
tmp = d / (Math.sqrt(h) * 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 <= -2.4e-190) tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(h * l))))); elseif (l <= -2e-310) tmp = Float64(d / cbrt((Float64(h * l) ^ 1.5))); else tmp = Float64(d / Float64(sqrt(h) * 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, -2.4e-190], N[(d * (-N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, -2e-310], N[(d / N[Power[N[Power[N[(h * l), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * 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 -2.4 \cdot 10^{-190}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -2.4e-190Initial program 66.2%
Simplified65.5%
frac-2neg69.6%
sqrt-div83.0%
Applied egg-rr78.0%
Taylor expanded in d around -inf 48.0%
mul-1-neg48.0%
*-commutative48.0%
distribute-rgt-neg-in48.0%
*-commutative48.0%
Simplified48.0%
if -2.4e-190 < l < -1.999999999999994e-310Initial program 76.4%
Simplified76.4%
frac-2neg82.3%
sqrt-div94.0%
Applied egg-rr88.1%
Taylor expanded in d around inf 42.5%
*-commutative42.5%
Simplified42.5%
expm1-log1p-u0.7%
expm1-udef0.5%
sqrt-div0.5%
metadata-eval0.5%
un-div-inv0.5%
Applied egg-rr0.5%
expm1-def0.7%
expm1-log1p42.5%
Simplified42.5%
add-cbrt-cube59.4%
pow1/359.4%
add-sqr-sqrt59.4%
pow159.4%
pow1/259.4%
pow-prod-up59.4%
metadata-eval59.4%
Applied egg-rr59.4%
unpow1/359.4%
Simplified59.4%
if -1.999999999999994e-310 < l Initial program 63.8%
Simplified63.8%
frac-2neg67.3%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in d around inf 45.4%
*-commutative45.4%
Simplified45.4%
expm1-log1p-u43.7%
expm1-udef33.3%
sqrt-div33.3%
metadata-eval33.3%
un-div-inv33.3%
Applied egg-rr33.3%
expm1-def43.7%
expm1-log1p45.4%
Simplified45.4%
sqrt-prod52.1%
Applied egg-rr52.1%
Final simplification50.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-238) (* d (- (sqrt (/ 1.0 (* h l))))) (if (<= l -2e-310) (/ d (sqrt (* h l))) (/ d (* (sqrt h) (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-238) {
tmp = d * -sqrt((1.0 / (h * l)));
} else if (l <= -2e-310) {
tmp = d / sqrt((h * l));
} else {
tmp = d / (sqrt(h) * 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-238)) then
tmp = d * -sqrt((1.0d0 / (h * l)))
else if (l <= (-2d-310)) then
tmp = d / sqrt((h * l))
else
tmp = d / (sqrt(h) * 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-238) {
tmp = d * -Math.sqrt((1.0 / (h * l)));
} else if (l <= -2e-310) {
tmp = d / Math.sqrt((h * l));
} else {
tmp = d / (Math.sqrt(h) * 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-238: tmp = d * -math.sqrt((1.0 / (h * l))) elif l <= -2e-310: tmp = d / math.sqrt((h * l)) else: tmp = d / (math.sqrt(h) * 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-238) tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(h * l))))); elseif (l <= -2e-310) tmp = Float64(d / sqrt(Float64(h * l))); else tmp = Float64(d / Float64(sqrt(h) * 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-238)
tmp = d * -sqrt((1.0 / (h * l)));
elseif (l <= -2e-310)
tmp = d / sqrt((h * l));
else
tmp = d / (sqrt(h) * 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-238], N[(d * (-N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, -2e-310], N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * 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^{-238}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -1.15000000000000002e-238Initial program 67.3%
Simplified66.6%
frac-2neg70.5%
sqrt-div83.9%
Applied egg-rr79.2%
Taylor expanded in d around -inf 46.9%
mul-1-neg46.9%
*-commutative46.9%
distribute-rgt-neg-in46.9%
*-commutative46.9%
Simplified46.9%
if -1.15000000000000002e-238 < l < -1.999999999999994e-310Initial program 70.0%
Simplified70.0%
frac-2neg80.0%
sqrt-div90.0%
Applied egg-rr80.0%
Taylor expanded in d around inf 70.4%
*-commutative70.4%
Simplified70.4%
expm1-log1p-u0.2%
expm1-udef0.2%
sqrt-div0.2%
metadata-eval0.2%
un-div-inv0.2%
Applied egg-rr0.2%
expm1-def0.2%
expm1-log1p70.4%
Simplified70.4%
if -1.999999999999994e-310 < l Initial program 63.8%
Simplified63.8%
frac-2neg67.3%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in d around inf 45.4%
*-commutative45.4%
Simplified45.4%
expm1-log1p-u43.7%
expm1-udef33.3%
sqrt-div33.3%
metadata-eval33.3%
un-div-inv33.3%
Applied egg-rr33.3%
expm1-def43.7%
expm1-log1p45.4%
Simplified45.4%
sqrt-prod52.1%
Applied egg-rr52.1%
Final simplification50.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 (if (<= l -4.4e-258) (* d (- (sqrt (/ 1.0 (* h l))))) (if (<= l 4.3e-297) (/ d (sqrt (* h l))) (/ (/ d (sqrt h)) (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 <= -4.4e-258) {
tmp = d * -sqrt((1.0 / (h * l)));
} else if (l <= 4.3e-297) {
tmp = d / sqrt((h * l));
} else {
tmp = (d / sqrt(h)) / 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 <= (-4.4d-258)) then
tmp = d * -sqrt((1.0d0 / (h * l)))
else if (l <= 4.3d-297) then
tmp = d / sqrt((h * l))
else
tmp = (d / sqrt(h)) / 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 <= -4.4e-258) {
tmp = d * -Math.sqrt((1.0 / (h * l)));
} else if (l <= 4.3e-297) {
tmp = d / Math.sqrt((h * l));
} else {
tmp = (d / Math.sqrt(h)) / 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 <= -4.4e-258: tmp = d * -math.sqrt((1.0 / (h * l))) elif l <= 4.3e-297: tmp = d / math.sqrt((h * l)) else: tmp = (d / math.sqrt(h)) / 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 <= -4.4e-258) tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(h * l))))); elseif (l <= 4.3e-297) tmp = Float64(d / sqrt(Float64(h * l))); else tmp = Float64(Float64(d / sqrt(h)) / 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 <= -4.4e-258)
tmp = d * -sqrt((1.0 / (h * l)));
elseif (l <= 4.3e-297)
tmp = d / sqrt((h * l));
else
tmp = (d / sqrt(h)) / 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, -4.4e-258], N[(d * (-N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, 4.3e-297], N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $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.4 \cdot 10^{-258}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\
\mathbf{elif}\;\ell \leq 4.3 \cdot 10^{-297}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -4.40000000000000031e-258Initial program 67.3%
Simplified66.6%
frac-2neg70.5%
sqrt-div83.9%
Applied egg-rr79.2%
Taylor expanded in d around -inf 46.9%
mul-1-neg46.9%
*-commutative46.9%
distribute-rgt-neg-in46.9%
*-commutative46.9%
Simplified46.9%
if -4.40000000000000031e-258 < l < 4.3000000000000003e-297Initial program 63.6%
Simplified63.6%
frac-2neg73.2%
sqrt-div81.8%
Applied egg-rr72.7%
Taylor expanded in d around inf 72.9%
*-commutative72.9%
Simplified72.9%
expm1-log1p-u8.3%
expm1-udef8.2%
sqrt-div8.2%
metadata-eval8.2%
un-div-inv8.2%
Applied egg-rr8.2%
expm1-def8.3%
expm1-log1p73.1%
Simplified73.1%
if 4.3000000000000003e-297 < l Initial program 64.4%
Simplified64.4%
frac-2neg67.8%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in d around inf 45.0%
*-commutative45.0%
Simplified45.0%
expm1-log1p-u43.3%
expm1-udef32.8%
sqrt-div32.8%
metadata-eval32.8%
un-div-inv32.8%
Applied egg-rr32.8%
expm1-def43.3%
expm1-log1p45.0%
Simplified45.0%
*-un-lft-identity45.0%
sqrt-prod51.7%
times-frac51.7%
Applied egg-rr51.7%
associate-*l/51.7%
*-lft-identity51.7%
Simplified51.7%
Final simplification50.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 (if (<= d 2.3e-250) (* d (- (sqrt (/ 1.0 (* h l))))) (* d (sqrt (* (/ 1.0 l) (/ 1.0 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.3e-250) {
tmp = d * -sqrt((1.0 / (h * l)));
} else {
tmp = d * sqrt(((1.0 / l) * (1.0 / 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 <= 2.3d-250) then
tmp = d * -sqrt((1.0d0 / (h * l)))
else
tmp = d * sqrt(((1.0d0 / l) * (1.0d0 / 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 <= 2.3e-250) {
tmp = d * -Math.sqrt((1.0 / (h * l)));
} else {
tmp = d * Math.sqrt(((1.0 / l) * (1.0 / 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 <= 2.3e-250: tmp = d * -math.sqrt((1.0 / (h * l))) else: tmp = d * math.sqrt(((1.0 / l) * (1.0 / 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.3e-250) tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(h * l))))); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / l) * Float64(1.0 / 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 <= 2.3e-250)
tmp = d * -sqrt((1.0 / (h * l)));
else
tmp = d * sqrt(((1.0 / l) * (1.0 / 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, 2.3e-250], N[(d * (-N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] * N[(1.0 / h), $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 2.3 \cdot 10^{-250}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{\ell} \cdot \frac{1}{h}}\\
\end{array}
\end{array}
if d < 2.2999999999999999e-250Initial program 64.2%
Simplified63.6%
frac-2neg67.5%
sqrt-div75.9%
Applied egg-rr71.3%
Taylor expanded in d around -inf 43.3%
mul-1-neg43.3%
*-commutative43.3%
distribute-rgt-neg-in43.3%
*-commutative43.3%
Simplified43.3%
if 2.2999999999999999e-250 < d Initial program 68.0%
Simplified68.0%
frac-2neg72.0%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in d around inf 48.8%
*-commutative48.8%
Simplified48.8%
associate-/r*49.2%
div-inv49.2%
Applied egg-rr49.2%
Final simplification45.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 (<= d 1.6e-246) (* d (- (sqrt (/ 1.0 (* h l))))) (/ 1.0 (/ (sqrt (* h l)) d))))
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.6e-246) {
tmp = d * -sqrt((1.0 / (h * l)));
} else {
tmp = 1.0 / (sqrt((h * l)) / d);
}
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.6d-246) then
tmp = d * -sqrt((1.0d0 / (h * l)))
else
tmp = 1.0d0 / (sqrt((h * l)) / d)
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.6e-246) {
tmp = d * -Math.sqrt((1.0 / (h * l)));
} else {
tmp = 1.0 / (Math.sqrt((h * l)) / d);
}
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.6e-246: tmp = d * -math.sqrt((1.0 / (h * l))) else: tmp = 1.0 / (math.sqrt((h * l)) / d) 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.6e-246) tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(h * l))))); else tmp = Float64(1.0 / Float64(sqrt(Float64(h * l)) / d)); 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.6e-246)
tmp = d * -sqrt((1.0 / (h * l)));
else
tmp = 1.0 / (sqrt((h * l)) / d);
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.6e-246], N[(d * (-N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision] / d), $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.6 \cdot 10^{-246}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\sqrt{h \cdot \ell}}{d}}\\
\end{array}
\end{array}
if d < 1.6e-246Initial program 64.2%
Simplified63.6%
frac-2neg67.5%
sqrt-div75.9%
Applied egg-rr71.3%
Taylor expanded in d around -inf 43.3%
mul-1-neg43.3%
*-commutative43.3%
distribute-rgt-neg-in43.3%
*-commutative43.3%
Simplified43.3%
if 1.6e-246 < d Initial program 68.0%
Simplified68.0%
frac-2neg72.0%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in d around inf 48.8%
*-commutative48.8%
Simplified48.8%
add-log-exp13.0%
inv-pow13.0%
sqrt-pow113.0%
metadata-eval13.0%
Applied egg-rr13.0%
rem-log-exp48.8%
metadata-eval48.8%
pow-flip48.8%
pow1/248.8%
div-inv48.8%
clear-num48.9%
Applied egg-rr48.9%
Final simplification45.6%
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-238) (sqrt (* (/ d l) (/ d h))) (/ d (sqrt (* 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 (l <= -5e-238) {
tmp = sqrt(((d / l) * (d / h)));
} else {
tmp = d / sqrt((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 (l <= (-5d-238)) then
tmp = sqrt(((d / l) * (d / h)))
else
tmp = d / sqrt((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 (l <= -5e-238) {
tmp = Math.sqrt(((d / l) * (d / h)));
} else {
tmp = d / Math.sqrt((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 l <= -5e-238: tmp = math.sqrt(((d / l) * (d / h))) else: tmp = d / math.sqrt((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 (l <= -5e-238) tmp = sqrt(Float64(Float64(d / l) * Float64(d / h))); else tmp = Float64(d / sqrt(Float64(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 (l <= -5e-238)
tmp = sqrt(((d / l) * (d / h)));
else
tmp = d / sqrt((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[l, -5e-238], N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(d / N[Sqrt[N[(h * 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^{-238}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\
\end{array}
\end{array}
if l < -5e-238Initial program 67.3%
Simplified66.6%
frac-2neg70.5%
sqrt-div83.9%
Applied egg-rr79.2%
Taylor expanded in d around inf 10.5%
*-commutative10.5%
Simplified10.5%
expm1-log1p-u6.5%
expm1-udef6.5%
sqrt-div6.5%
metadata-eval6.5%
un-div-inv6.5%
Applied egg-rr6.5%
expm1-def6.5%
expm1-log1p9.8%
Simplified9.8%
add-sqr-sqrt0.0%
sqrt-prod0.0%
frac-times0.0%
sqrt-div0.0%
sqrt-div42.2%
sqrt-unprod34.3%
Applied egg-rr34.3%
if -5e-238 < l Initial program 64.3%
Simplified64.3%
frac-2neg68.3%
sqrt-div6.9%
Applied egg-rr6.1%
Taylor expanded in d around inf 47.3%
*-commutative47.3%
Simplified47.3%
expm1-log1p-u40.4%
expm1-udef30.8%
sqrt-div30.8%
metadata-eval30.8%
un-div-inv30.8%
Applied egg-rr30.8%
expm1-def40.4%
expm1-log1p47.3%
Simplified47.3%
Final simplification41.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 (<= l -3e-237) (sqrt (* (/ d l) (/ d h))) (/ 1.0 (/ (sqrt (* h l)) d))))
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 <= -3e-237) {
tmp = sqrt(((d / l) * (d / h)));
} else {
tmp = 1.0 / (sqrt((h * l)) / d);
}
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 <= (-3d-237)) then
tmp = sqrt(((d / l) * (d / h)))
else
tmp = 1.0d0 / (sqrt((h * l)) / d)
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 <= -3e-237) {
tmp = Math.sqrt(((d / l) * (d / h)));
} else {
tmp = 1.0 / (Math.sqrt((h * l)) / d);
}
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 <= -3e-237: tmp = math.sqrt(((d / l) * (d / h))) else: tmp = 1.0 / (math.sqrt((h * l)) / d) 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 <= -3e-237) tmp = sqrt(Float64(Float64(d / l) * Float64(d / h))); else tmp = Float64(1.0 / Float64(sqrt(Float64(h * l)) / d)); 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 <= -3e-237)
tmp = sqrt(((d / l) * (d / h)));
else
tmp = 1.0 / (sqrt((h * l)) / d);
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, -3e-237], N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision] / d), $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 -3 \cdot 10^{-237}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\sqrt{h \cdot \ell}}{d}}\\
\end{array}
\end{array}
if l < -3.00000000000000024e-237Initial program 67.3%
Simplified66.6%
frac-2neg70.5%
sqrt-div83.9%
Applied egg-rr79.2%
Taylor expanded in d around inf 10.5%
*-commutative10.5%
Simplified10.5%
expm1-log1p-u6.5%
expm1-udef6.5%
sqrt-div6.5%
metadata-eval6.5%
un-div-inv6.5%
Applied egg-rr6.5%
expm1-def6.5%
expm1-log1p9.8%
Simplified9.8%
add-sqr-sqrt0.0%
sqrt-prod0.0%
frac-times0.0%
sqrt-div0.0%
sqrt-div42.2%
sqrt-unprod34.3%
Applied egg-rr34.3%
if -3.00000000000000024e-237 < l Initial program 64.3%
Simplified64.3%
frac-2neg68.3%
sqrt-div6.9%
Applied egg-rr6.1%
Taylor expanded in d around inf 47.3%
*-commutative47.3%
Simplified47.3%
add-log-exp17.6%
inv-pow17.6%
sqrt-pow117.6%
metadata-eval17.6%
Applied egg-rr17.6%
rem-log-exp47.3%
metadata-eval47.3%
pow-flip47.3%
pow1/247.3%
div-inv47.3%
clear-num47.4%
Applied egg-rr47.4%
Final simplification41.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 (/ d (sqrt (* 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) {
return d / sqrt((h * l));
}
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((h * l))
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((h * l));
}
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((h * l))
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(h * l))) 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((h * l));
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[(h * 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])\\
\\
\frac{d}{\sqrt{h \cdot \ell}}
\end{array}
Initial program 65.8%
Simplified65.4%
frac-2neg69.4%
sqrt-div44.5%
Applied egg-rr41.8%
Taylor expanded in d around inf 29.4%
*-commutative29.4%
Simplified29.4%
expm1-log1p-u23.8%
expm1-udef18.9%
sqrt-div18.9%
metadata-eval18.9%
un-div-inv18.9%
Applied egg-rr18.9%
expm1-def23.8%
expm1-log1p29.0%
Simplified29.0%
Final simplification29.0%
herbie shell --seed 2024011
(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)))))