
(FPCore (a k m) :precision binary64 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))
double code(double a, double k, double m) {
return (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
end function
public static double code(double a, double k, double m) {
return (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
def code(a, k, m): return (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))
function code(a, k, m) return Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) end
function tmp = code(a, k, m) tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k)); end
code[a_, k_, m_] := N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a k m) :precision binary64 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))
double code(double a, double k, double m) {
return (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
end function
public static double code(double a, double k, double m) {
return (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
def code(a, k, m): return (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))
function code(a, k, m) return Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) end
function tmp = code(a, k, m) tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k)); end
code[a_, k_, m_] := N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}
\end{array}
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
(FPCore (a_s a_m k m)
:precision binary64
(*
a_s
(if (<= k 10.0)
(* a_m (sqrt (pow (/ (pow k m) (fma k 10.0 1.0)) 2.0)))
(pow (/ (sqrt (* a_m (pow k m))) k) 2.0))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double tmp;
if (k <= 10.0) {
tmp = a_m * sqrt(pow((pow(k, m) / fma(k, 10.0, 1.0)), 2.0));
} else {
tmp = pow((sqrt((a_m * pow(k, m))) / k), 2.0);
}
return a_s * tmp;
}
a\_m = abs(a) a\_s = copysign(1.0, a) function code(a_s, a_m, k, m) tmp = 0.0 if (k <= 10.0) tmp = Float64(a_m * sqrt((Float64((k ^ m) / fma(k, 10.0, 1.0)) ^ 2.0))); else tmp = Float64(sqrt(Float64(a_m * (k ^ m))) / k) ^ 2.0; end return Float64(a_s * tmp) end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := N[(a$95$s * If[LessEqual[k, 10.0], N[(a$95$m * N[Sqrt[N[Power[N[(N[Power[k, m], $MachinePrecision] / N[(k * 10.0 + 1.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Power[N[(N[Sqrt[N[(a$95$m * N[Power[k, m], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / k), $MachinePrecision], 2.0], $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;k \leq 10:\\
\;\;\;\;a\_m \cdot \sqrt{{\left(\frac{{k}^{m}}{\mathsf{fma}\left(k, 10, 1\right)}\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;{\left(\frac{\sqrt{a\_m \cdot {k}^{m}}}{k}\right)}^{2}\\
\end{array}
\end{array}
if k < 10Initial program 96.7%
associate-/l*96.7%
remove-double-neg96.7%
distribute-frac-neg296.7%
distribute-neg-frac296.7%
remove-double-neg96.7%
sqr-neg96.7%
associate-+l+96.7%
sqr-neg96.7%
distribute-rgt-out96.7%
Simplified96.7%
Taylor expanded in k around 0 93.0%
*-commutative93.0%
Simplified93.0%
add-sqr-sqrt92.4%
sqrt-unprod99.1%
pow299.1%
+-commutative99.1%
fma-define99.1%
Applied egg-rr99.1%
if 10 < k Initial program 74.8%
associate-/l*74.8%
remove-double-neg74.8%
distribute-frac-neg274.8%
distribute-neg-frac274.8%
remove-double-neg74.8%
sqr-neg74.8%
associate-+l+74.8%
sqr-neg74.8%
distribute-rgt-out74.8%
Simplified74.8%
add-sqr-sqrt57.7%
pow257.7%
distribute-lft-in57.7%
associate-+l+57.7%
associate-*r/57.7%
*-commutative57.7%
associate-/l*57.7%
associate-+l+57.7%
distribute-lft-in57.7%
+-commutative57.7%
fma-define57.7%
+-commutative57.7%
Applied egg-rr57.7%
Taylor expanded in k around inf 59.3%
associate-*r/59.4%
*-rgt-identity59.4%
associate-*r*59.4%
log-rec59.4%
distribute-rgt-neg-out59.4%
mul-1-neg59.4%
Simplified59.4%
div-inv59.3%
Applied egg-rr59.3%
associate-*r/59.4%
*-rgt-identity59.4%
Simplified59.4%
Final simplification87.3%
a\_m = (fabs.f64 a) a\_s = (copysign.f64 #s(literal 1 binary64) a) (FPCore (a_s a_m k m) :precision binary64 (let* ((t_0 (* a_m (pow k m)))) (* a_s (if (<= k 1.0) t_0 (pow (/ (sqrt t_0) k) 2.0)))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double t_0 = a_m * pow(k, m);
double tmp;
if (k <= 1.0) {
tmp = t_0;
} else {
tmp = pow((sqrt(t_0) / k), 2.0);
}
return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: tmp
t_0 = a_m * (k ** m)
if (k <= 1.0d0) then
tmp = t_0
else
tmp = (sqrt(t_0) / k) ** 2.0d0
end if
code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double t_0 = a_m * Math.pow(k, m);
double tmp;
if (k <= 1.0) {
tmp = t_0;
} else {
tmp = Math.pow((Math.sqrt(t_0) / k), 2.0);
}
return a_s * tmp;
}
a\_m = math.fabs(a) a\_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): t_0 = a_m * math.pow(k, m) tmp = 0 if k <= 1.0: tmp = t_0 else: tmp = math.pow((math.sqrt(t_0) / k), 2.0) return a_s * tmp
a\_m = abs(a) a\_s = copysign(1.0, a) function code(a_s, a_m, k, m) t_0 = Float64(a_m * (k ^ m)) tmp = 0.0 if (k <= 1.0) tmp = t_0; else tmp = Float64(sqrt(t_0) / k) ^ 2.0; end return Float64(a_s * tmp) end
a\_m = abs(a); a\_s = sign(a) * abs(1.0); function tmp_2 = code(a_s, a_m, k, m) t_0 = a_m * (k ^ m); tmp = 0.0; if (k <= 1.0) tmp = t_0; else tmp = (sqrt(t_0) / k) ^ 2.0; end tmp_2 = a_s * tmp; end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := Block[{t$95$0 = N[(a$95$m * N[Power[k, m], $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[k, 1.0], t$95$0, N[Power[N[(N[Sqrt[t$95$0], $MachinePrecision] / k), $MachinePrecision], 2.0], $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
\begin{array}{l}
t_0 := a\_m \cdot {k}^{m}\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;k \leq 1:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;{\left(\frac{\sqrt{t\_0}}{k}\right)}^{2}\\
\end{array}
\end{array}
\end{array}
if k < 1Initial program 96.7%
associate-/l*96.7%
remove-double-neg96.7%
distribute-frac-neg296.7%
distribute-neg-frac296.7%
remove-double-neg96.7%
sqr-neg96.7%
associate-+l+96.7%
sqr-neg96.7%
distribute-rgt-out96.7%
Simplified96.7%
Taylor expanded in k around 0 98.8%
*-commutative98.8%
Simplified98.8%
if 1 < k Initial program 74.8%
associate-/l*74.8%
remove-double-neg74.8%
distribute-frac-neg274.8%
distribute-neg-frac274.8%
remove-double-neg74.8%
sqr-neg74.8%
associate-+l+74.8%
sqr-neg74.8%
distribute-rgt-out74.8%
Simplified74.8%
add-sqr-sqrt57.7%
pow257.7%
distribute-lft-in57.7%
associate-+l+57.7%
associate-*r/57.7%
*-commutative57.7%
associate-/l*57.7%
associate-+l+57.7%
distribute-lft-in57.7%
+-commutative57.7%
fma-define57.7%
+-commutative57.7%
Applied egg-rr57.7%
Taylor expanded in k around inf 59.3%
associate-*r/59.4%
*-rgt-identity59.4%
associate-*r*59.4%
log-rec59.4%
distribute-rgt-neg-out59.4%
mul-1-neg59.4%
Simplified59.4%
div-inv59.3%
Applied egg-rr59.3%
associate-*r/59.4%
*-rgt-identity59.4%
Simplified59.4%
Final simplification87.1%
a\_m = (fabs.f64 a) a\_s = (copysign.f64 #s(literal 1 binary64) a) (FPCore (a_s a_m k m) :precision binary64 (let* ((t_0 (* a_m (pow k m))) (t_1 (/ t_0 (+ (+ 1.0 (* k 10.0)) (* k k))))) (* a_s (if (<= t_1 2e+283) t_1 t_0))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double t_0 = a_m * pow(k, m);
double t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k));
double tmp;
if (t_1 <= 2e+283) {
tmp = t_1;
} else {
tmp = t_0;
}
return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = a_m * (k ** m)
t_1 = t_0 / ((1.0d0 + (k * 10.0d0)) + (k * k))
if (t_1 <= 2d+283) then
tmp = t_1
else
tmp = t_0
end if
code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double t_0 = a_m * Math.pow(k, m);
double t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k));
double tmp;
if (t_1 <= 2e+283) {
tmp = t_1;
} else {
tmp = t_0;
}
return a_s * tmp;
}
a\_m = math.fabs(a) a\_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): t_0 = a_m * math.pow(k, m) t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k)) tmp = 0 if t_1 <= 2e+283: tmp = t_1 else: tmp = t_0 return a_s * tmp
a\_m = abs(a) a\_s = copysign(1.0, a) function code(a_s, a_m, k, m) t_0 = Float64(a_m * (k ^ m)) t_1 = Float64(t_0 / Float64(Float64(1.0 + Float64(k * 10.0)) + Float64(k * k))) tmp = 0.0 if (t_1 <= 2e+283) tmp = t_1; else tmp = t_0; end return Float64(a_s * tmp) end
a\_m = abs(a); a\_s = sign(a) * abs(1.0); function tmp_2 = code(a_s, a_m, k, m) t_0 = a_m * (k ^ m); t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k)); tmp = 0.0; if (t_1 <= 2e+283) tmp = t_1; else tmp = t_0; end tmp_2 = a_s * tmp; end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := Block[{t$95$0 = N[(a$95$m * N[Power[k, m], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[t$95$1, 2e+283], t$95$1, t$95$0]), $MachinePrecision]]]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
\begin{array}{l}
t_0 := a\_m \cdot {k}^{m}\\
t_1 := \frac{t\_0}{\left(1 + k \cdot 10\right) + k \cdot k}\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{+283}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) < 1.99999999999999991e283Initial program 94.7%
if 1.99999999999999991e283 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) Initial program 68.2%
associate-/l*68.2%
remove-double-neg68.2%
distribute-frac-neg268.2%
distribute-neg-frac268.2%
remove-double-neg68.2%
sqr-neg68.2%
associate-+l+68.2%
sqr-neg68.2%
distribute-rgt-out68.2%
Simplified68.2%
Taylor expanded in k around 0 97.7%
*-commutative97.7%
Simplified97.7%
Final simplification95.3%
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
(FPCore (a_s a_m k m)
:precision binary64
(*
a_s
(if (<= m 0.0145)
(* a_m (/ (pow k m) (+ 1.0 (* k (+ k 10.0)))))
(* a_m (pow k m)))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= 0.0145) {
tmp = a_m * (pow(k, m) / (1.0 + (k * (k + 10.0))));
} else {
tmp = a_m * pow(k, m);
}
return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 0.0145d0) then
tmp = a_m * ((k ** m) / (1.0d0 + (k * (k + 10.0d0))))
else
tmp = a_m * (k ** m)
end if
code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= 0.0145) {
tmp = a_m * (Math.pow(k, m) / (1.0 + (k * (k + 10.0))));
} else {
tmp = a_m * Math.pow(k, m);
}
return a_s * tmp;
}
a\_m = math.fabs(a) a\_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): tmp = 0 if m <= 0.0145: tmp = a_m * (math.pow(k, m) / (1.0 + (k * (k + 10.0)))) else: tmp = a_m * math.pow(k, m) return a_s * tmp
a\_m = abs(a) a\_s = copysign(1.0, a) function code(a_s, a_m, k, m) tmp = 0.0 if (m <= 0.0145) tmp = Float64(a_m * Float64((k ^ m) / Float64(1.0 + Float64(k * Float64(k + 10.0))))); else tmp = Float64(a_m * (k ^ m)); end return Float64(a_s * tmp) end
a\_m = abs(a); a\_s = sign(a) * abs(1.0); function tmp_2 = code(a_s, a_m, k, m) tmp = 0.0; if (m <= 0.0145) tmp = a_m * ((k ^ m) / (1.0 + (k * (k + 10.0)))); else tmp = a_m * (k ^ m); end tmp_2 = a_s * tmp; end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := N[(a$95$s * If[LessEqual[m, 0.0145], N[(a$95$m * N[(N[Power[k, m], $MachinePrecision] / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a$95$m * N[Power[k, m], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;m \leq 0.0145:\\
\;\;\;\;a\_m \cdot \frac{{k}^{m}}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a\_m \cdot {k}^{m}\\
\end{array}
\end{array}
if m < 0.0145000000000000007Initial program 93.7%
associate-/l*93.7%
remove-double-neg93.7%
distribute-frac-neg293.7%
distribute-neg-frac293.7%
remove-double-neg93.7%
sqr-neg93.7%
associate-+l+93.7%
sqr-neg93.7%
distribute-rgt-out93.7%
Simplified93.7%
if 0.0145000000000000007 < m Initial program 82.3%
associate-/l*82.3%
remove-double-neg82.3%
distribute-frac-neg282.3%
distribute-neg-frac282.3%
remove-double-neg82.3%
sqr-neg82.3%
associate-+l+82.3%
sqr-neg82.3%
distribute-rgt-out82.3%
Simplified82.3%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification95.6%
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
(FPCore (a_s a_m k m)
:precision binary64
(*
a_s
(if (<= m -6.5e-18)
(* a_m (/ (pow k m) (+ 1.0 (* k 10.0))))
(if (<= m 0.00082) (/ a_m (+ 1.0 (* k (+ k 10.0)))) (* a_m (pow k m))))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= -6.5e-18) {
tmp = a_m * (pow(k, m) / (1.0 + (k * 10.0)));
} else if (m <= 0.00082) {
tmp = a_m / (1.0 + (k * (k + 10.0)));
} else {
tmp = a_m * pow(k, m);
}
return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-6.5d-18)) then
tmp = a_m * ((k ** m) / (1.0d0 + (k * 10.0d0)))
else if (m <= 0.00082d0) then
tmp = a_m / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a_m * (k ** m)
end if
code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= -6.5e-18) {
tmp = a_m * (Math.pow(k, m) / (1.0 + (k * 10.0)));
} else if (m <= 0.00082) {
tmp = a_m / (1.0 + (k * (k + 10.0)));
} else {
tmp = a_m * Math.pow(k, m);
}
return a_s * tmp;
}
a\_m = math.fabs(a) a\_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): tmp = 0 if m <= -6.5e-18: tmp = a_m * (math.pow(k, m) / (1.0 + (k * 10.0))) elif m <= 0.00082: tmp = a_m / (1.0 + (k * (k + 10.0))) else: tmp = a_m * math.pow(k, m) return a_s * tmp
a\_m = abs(a) a\_s = copysign(1.0, a) function code(a_s, a_m, k, m) tmp = 0.0 if (m <= -6.5e-18) tmp = Float64(a_m * Float64((k ^ m) / Float64(1.0 + Float64(k * 10.0)))); elseif (m <= 0.00082) tmp = Float64(a_m / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a_m * (k ^ m)); end return Float64(a_s * tmp) end
a\_m = abs(a); a\_s = sign(a) * abs(1.0); function tmp_2 = code(a_s, a_m, k, m) tmp = 0.0; if (m <= -6.5e-18) tmp = a_m * ((k ^ m) / (1.0 + (k * 10.0))); elseif (m <= 0.00082) tmp = a_m / (1.0 + (k * (k + 10.0))); else tmp = a_m * (k ^ m); end tmp_2 = a_s * tmp; end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := N[(a$95$s * If[LessEqual[m, -6.5e-18], N[(a$95$m * N[(N[Power[k, m], $MachinePrecision] / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.00082], N[(a$95$m / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a$95$m * N[Power[k, m], $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;m \leq -6.5 \cdot 10^{-18}:\\
\;\;\;\;a\_m \cdot \frac{{k}^{m}}{1 + k \cdot 10}\\
\mathbf{elif}\;m \leq 0.00082:\\
\;\;\;\;\frac{a\_m}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a\_m \cdot {k}^{m}\\
\end{array}
\end{array}
if m < -6.50000000000000008e-18Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
distribute-frac-neg2100.0%
distribute-neg-frac2100.0%
remove-double-neg100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
if -6.50000000000000008e-18 < m < 8.1999999999999998e-4Initial program 85.9%
associate-/l*85.8%
remove-double-neg85.8%
distribute-frac-neg285.8%
distribute-neg-frac285.8%
remove-double-neg85.8%
sqr-neg85.8%
associate-+l+85.8%
sqr-neg85.8%
distribute-rgt-out85.9%
Simplified85.9%
Taylor expanded in m around 0 85.9%
if 8.1999999999999998e-4 < m Initial program 82.3%
associate-/l*82.3%
remove-double-neg82.3%
distribute-frac-neg282.3%
distribute-neg-frac282.3%
remove-double-neg82.3%
sqr-neg82.3%
associate-+l+82.3%
sqr-neg82.3%
distribute-rgt-out82.3%
Simplified82.3%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification95.7%
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
(FPCore (a_s a_m k m)
:precision binary64
(*
a_s
(if (or (<= m -6.5e-18) (not (<= m 0.00013)))
(* a_m (pow k m))
(/ a_m (+ 1.0 (* k (+ k 10.0)))))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double tmp;
if ((m <= -6.5e-18) || !(m <= 0.00013)) {
tmp = a_m * pow(k, m);
} else {
tmp = a_m / (1.0 + (k * (k + 10.0)));
}
return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if ((m <= (-6.5d-18)) .or. (.not. (m <= 0.00013d0))) then
tmp = a_m * (k ** m)
else
tmp = a_m / (1.0d0 + (k * (k + 10.0d0)))
end if
code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double tmp;
if ((m <= -6.5e-18) || !(m <= 0.00013)) {
tmp = a_m * Math.pow(k, m);
} else {
tmp = a_m / (1.0 + (k * (k + 10.0)));
}
return a_s * tmp;
}
a\_m = math.fabs(a) a\_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): tmp = 0 if (m <= -6.5e-18) or not (m <= 0.00013): tmp = a_m * math.pow(k, m) else: tmp = a_m / (1.0 + (k * (k + 10.0))) return a_s * tmp
a\_m = abs(a) a\_s = copysign(1.0, a) function code(a_s, a_m, k, m) tmp = 0.0 if ((m <= -6.5e-18) || !(m <= 0.00013)) tmp = Float64(a_m * (k ^ m)); else tmp = Float64(a_m / Float64(1.0 + Float64(k * Float64(k + 10.0)))); end return Float64(a_s * tmp) end
a\_m = abs(a); a\_s = sign(a) * abs(1.0); function tmp_2 = code(a_s, a_m, k, m) tmp = 0.0; if ((m <= -6.5e-18) || ~((m <= 0.00013))) tmp = a_m * (k ^ m); else tmp = a_m / (1.0 + (k * (k + 10.0))); end tmp_2 = a_s * tmp; end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := N[(a$95$s * If[Or[LessEqual[m, -6.5e-18], N[Not[LessEqual[m, 0.00013]], $MachinePrecision]], N[(a$95$m * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(a$95$m / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;m \leq -6.5 \cdot 10^{-18} \lor \neg \left(m \leq 0.00013\right):\\
\;\;\;\;a\_m \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a\_m}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -6.50000000000000008e-18 or 1.29999999999999989e-4 < m Initial program 92.1%
associate-/l*92.1%
remove-double-neg92.1%
distribute-frac-neg292.1%
distribute-neg-frac292.1%
remove-double-neg92.1%
sqr-neg92.1%
associate-+l+92.1%
sqr-neg92.1%
distribute-rgt-out92.1%
Simplified92.1%
Taylor expanded in k around 0 99.4%
*-commutative99.4%
Simplified99.4%
if -6.50000000000000008e-18 < m < 1.29999999999999989e-4Initial program 85.9%
associate-/l*85.8%
remove-double-neg85.8%
distribute-frac-neg285.8%
distribute-neg-frac285.8%
remove-double-neg85.8%
sqr-neg85.8%
associate-+l+85.8%
sqr-neg85.8%
distribute-rgt-out85.9%
Simplified85.9%
Taylor expanded in m around 0 85.9%
Final simplification95.3%
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
(FPCore (a_s a_m k m)
:precision binary64
(*
a_s
(if (<= m 0.0145)
(/ a_m (+ 1.0 (* k (+ k 10.0))))
(* a_m (+ 1.0 (* k (- (* k 99.0) 10.0)))))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= 0.0145) {
tmp = a_m / (1.0 + (k * (k + 10.0)));
} else {
tmp = a_m * (1.0 + (k * ((k * 99.0) - 10.0)));
}
return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 0.0145d0) then
tmp = a_m / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a_m * (1.0d0 + (k * ((k * 99.0d0) - 10.0d0)))
end if
code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= 0.0145) {
tmp = a_m / (1.0 + (k * (k + 10.0)));
} else {
tmp = a_m * (1.0 + (k * ((k * 99.0) - 10.0)));
}
return a_s * tmp;
}
a\_m = math.fabs(a) a\_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): tmp = 0 if m <= 0.0145: tmp = a_m / (1.0 + (k * (k + 10.0))) else: tmp = a_m * (1.0 + (k * ((k * 99.0) - 10.0))) return a_s * tmp
a\_m = abs(a) a\_s = copysign(1.0, a) function code(a_s, a_m, k, m) tmp = 0.0 if (m <= 0.0145) tmp = Float64(a_m / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a_m * Float64(1.0 + Float64(k * Float64(Float64(k * 99.0) - 10.0)))); end return Float64(a_s * tmp) end
a\_m = abs(a); a\_s = sign(a) * abs(1.0); function tmp_2 = code(a_s, a_m, k, m) tmp = 0.0; if (m <= 0.0145) tmp = a_m / (1.0 + (k * (k + 10.0))); else tmp = a_m * (1.0 + (k * ((k * 99.0) - 10.0))); end tmp_2 = a_s * tmp; end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := N[(a$95$s * If[LessEqual[m, 0.0145], N[(a$95$m / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a$95$m * N[(1.0 + N[(k * N[(N[(k * 99.0), $MachinePrecision] - 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;m \leq 0.0145:\\
\;\;\;\;\frac{a\_m}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a\_m \cdot \left(1 + k \cdot \left(k \cdot 99 - 10\right)\right)\\
\end{array}
\end{array}
if m < 0.0145000000000000007Initial program 93.7%
associate-/l*93.7%
remove-double-neg93.7%
distribute-frac-neg293.7%
distribute-neg-frac293.7%
remove-double-neg93.7%
sqr-neg93.7%
associate-+l+93.7%
sqr-neg93.7%
distribute-rgt-out93.7%
Simplified93.7%
Taylor expanded in m around 0 59.1%
if 0.0145000000000000007 < m Initial program 82.3%
associate-/l*82.3%
remove-double-neg82.3%
distribute-frac-neg282.3%
distribute-neg-frac282.3%
remove-double-neg82.3%
sqr-neg82.3%
associate-+l+82.3%
sqr-neg82.3%
distribute-rgt-out82.3%
Simplified82.3%
Taylor expanded in m around 0 3.5%
Taylor expanded in k around 0 24.8%
Final simplification48.5%
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
(FPCore (a_s a_m k m)
:precision binary64
(*
a_s
(if (<= m 0.0145)
(/ a_m (+ 1.0 (* k 10.0)))
(* a_m (+ 1.0 (* k (* k 99.0)))))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= 0.0145) {
tmp = a_m / (1.0 + (k * 10.0));
} else {
tmp = a_m * (1.0 + (k * (k * 99.0)));
}
return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 0.0145d0) then
tmp = a_m / (1.0d0 + (k * 10.0d0))
else
tmp = a_m * (1.0d0 + (k * (k * 99.0d0)))
end if
code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= 0.0145) {
tmp = a_m / (1.0 + (k * 10.0));
} else {
tmp = a_m * (1.0 + (k * (k * 99.0)));
}
return a_s * tmp;
}
a\_m = math.fabs(a) a\_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): tmp = 0 if m <= 0.0145: tmp = a_m / (1.0 + (k * 10.0)) else: tmp = a_m * (1.0 + (k * (k * 99.0))) return a_s * tmp
a\_m = abs(a) a\_s = copysign(1.0, a) function code(a_s, a_m, k, m) tmp = 0.0 if (m <= 0.0145) tmp = Float64(a_m / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(a_m * Float64(1.0 + Float64(k * Float64(k * 99.0)))); end return Float64(a_s * tmp) end
a\_m = abs(a); a\_s = sign(a) * abs(1.0); function tmp_2 = code(a_s, a_m, k, m) tmp = 0.0; if (m <= 0.0145) tmp = a_m / (1.0 + (k * 10.0)); else tmp = a_m * (1.0 + (k * (k * 99.0))); end tmp_2 = a_s * tmp; end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := N[(a$95$s * If[LessEqual[m, 0.0145], N[(a$95$m / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a$95$m * N[(1.0 + N[(k * N[(k * 99.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;m \leq 0.0145:\\
\;\;\;\;\frac{a\_m}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;a\_m \cdot \left(1 + k \cdot \left(k \cdot 99\right)\right)\\
\end{array}
\end{array}
if m < 0.0145000000000000007Initial program 93.7%
associate-/l*93.7%
remove-double-neg93.7%
distribute-frac-neg293.7%
distribute-neg-frac293.7%
remove-double-neg93.7%
sqr-neg93.7%
associate-+l+93.7%
sqr-neg93.7%
distribute-rgt-out93.7%
Simplified93.7%
Taylor expanded in m around 0 59.1%
Taylor expanded in k around 0 39.9%
*-commutative83.1%
Simplified39.9%
if 0.0145000000000000007 < m Initial program 82.3%
associate-/l*82.3%
remove-double-neg82.3%
distribute-frac-neg282.3%
distribute-neg-frac282.3%
remove-double-neg82.3%
sqr-neg82.3%
associate-+l+82.3%
sqr-neg82.3%
distribute-rgt-out82.3%
Simplified82.3%
Taylor expanded in m around 0 3.5%
Taylor expanded in k around 0 24.8%
Taylor expanded in k around inf 24.8%
*-commutative24.8%
Simplified24.8%
Final simplification35.2%
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
(FPCore (a_s a_m k m)
:precision binary64
(*
a_s
(if (<= m 40000000000.0)
(/ a_m (+ 1.0 (* k (+ k 10.0))))
(* a_m (+ 1.0 (* k (* k 99.0)))))))a\_m = fabs(a);
a\_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= 40000000000.0) {
tmp = a_m / (1.0 + (k * (k + 10.0)));
} else {
tmp = a_m * (1.0 + (k * (k * 99.0)));
}
return a_s * tmp;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 40000000000.0d0) then
tmp = a_m / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a_m * (1.0d0 + (k * (k * 99.0d0)))
end if
code = a_s * tmp
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= 40000000000.0) {
tmp = a_m / (1.0 + (k * (k + 10.0)));
} else {
tmp = a_m * (1.0 + (k * (k * 99.0)));
}
return a_s * tmp;
}
a\_m = math.fabs(a) a\_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): tmp = 0 if m <= 40000000000.0: tmp = a_m / (1.0 + (k * (k + 10.0))) else: tmp = a_m * (1.0 + (k * (k * 99.0))) return a_s * tmp
a\_m = abs(a) a\_s = copysign(1.0, a) function code(a_s, a_m, k, m) tmp = 0.0 if (m <= 40000000000.0) tmp = Float64(a_m / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a_m * Float64(1.0 + Float64(k * Float64(k * 99.0)))); end return Float64(a_s * tmp) end
a\_m = abs(a); a\_s = sign(a) * abs(1.0); function tmp_2 = code(a_s, a_m, k, m) tmp = 0.0; if (m <= 40000000000.0) tmp = a_m / (1.0 + (k * (k + 10.0))); else tmp = a_m * (1.0 + (k * (k * 99.0))); end tmp_2 = a_s * tmp; end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := N[(a$95$s * If[LessEqual[m, 40000000000.0], N[(a$95$m / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a$95$m * N[(1.0 + N[(k * N[(k * 99.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;m \leq 40000000000:\\
\;\;\;\;\frac{a\_m}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a\_m \cdot \left(1 + k \cdot \left(k \cdot 99\right)\right)\\
\end{array}
\end{array}
if m < 4e10Initial program 93.8%
associate-/l*93.8%
remove-double-neg93.8%
distribute-frac-neg293.8%
distribute-neg-frac293.8%
remove-double-neg93.8%
sqr-neg93.8%
associate-+l+93.8%
sqr-neg93.8%
distribute-rgt-out93.8%
Simplified93.8%
Taylor expanded in m around 0 58.2%
if 4e10 < m Initial program 81.6%
associate-/l*81.6%
remove-double-neg81.6%
distribute-frac-neg281.6%
distribute-neg-frac281.6%
remove-double-neg81.6%
sqr-neg81.6%
associate-+l+81.6%
sqr-neg81.6%
distribute-rgt-out81.6%
Simplified81.6%
Taylor expanded in m around 0 3.3%
Taylor expanded in k around 0 25.6%
Taylor expanded in k around inf 25.6%
*-commutative25.6%
Simplified25.6%
Final simplification48.5%
a\_m = (fabs.f64 a) a\_s = (copysign.f64 #s(literal 1 binary64) a) (FPCore (a_s a_m k m) :precision binary64 (* a_s (/ a_m (+ 1.0 (* k 10.0)))))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
return a_s * (a_m / (1.0 + (k * 10.0)));
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
code = a_s * (a_m / (1.0d0 + (k * 10.0d0)))
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
return a_s * (a_m / (1.0 + (k * 10.0)));
}
a\_m = math.fabs(a) a\_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): return a_s * (a_m / (1.0 + (k * 10.0)))
a\_m = abs(a) a\_s = copysign(1.0, a) function code(a_s, a_m, k, m) return Float64(a_s * Float64(a_m / Float64(1.0 + Float64(k * 10.0)))) end
a\_m = abs(a); a\_s = sign(a) * abs(1.0); function tmp = code(a_s, a_m, k, m) tmp = a_s * (a_m / (1.0 + (k * 10.0))); end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := N[(a$95$s * N[(a$95$m / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
a\_s \cdot \frac{a\_m}{1 + k \cdot 10}
\end{array}
Initial program 90.2%
associate-/l*90.2%
remove-double-neg90.2%
distribute-frac-neg290.2%
distribute-neg-frac290.2%
remove-double-neg90.2%
sqr-neg90.2%
associate-+l+90.2%
sqr-neg90.2%
distribute-rgt-out90.2%
Simplified90.2%
Taylor expanded in m around 0 41.9%
Taylor expanded in k around 0 28.6%
*-commutative83.6%
Simplified28.6%
Final simplification28.6%
a\_m = (fabs.f64 a) a\_s = (copysign.f64 #s(literal 1 binary64) a) (FPCore (a_s a_m k m) :precision binary64 (* a_s a_m))
a\_m = fabs(a);
a\_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
return a_s * a_m;
}
a\_m = abs(a)
a\_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
code = a_s * a_m
end function
a\_m = Math.abs(a);
a\_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
return a_s * a_m;
}
a\_m = math.fabs(a) a\_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): return a_s * a_m
a\_m = abs(a) a\_s = copysign(1.0, a) function code(a_s, a_m, k, m) return Float64(a_s * a_m) end
a\_m = abs(a); a\_s = sign(a) * abs(1.0); function tmp = code(a_s, a_m, k, m) tmp = a_s * a_m; end
a\_m = N[Abs[a], $MachinePrecision]
a\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := N[(a$95$s * a$95$m), $MachinePrecision]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
a\_s \cdot a\_m
\end{array}
Initial program 90.2%
associate-/l*90.2%
remove-double-neg90.2%
distribute-frac-neg290.2%
distribute-neg-frac290.2%
remove-double-neg90.2%
sqr-neg90.2%
associate-+l+90.2%
sqr-neg90.2%
distribute-rgt-out90.2%
Simplified90.2%
Taylor expanded in m around 0 41.9%
Taylor expanded in k around 0 24.6%
Taylor expanded in k around 0 18.8%
Final simplification18.8%
herbie shell --seed 2024079
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))