
(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));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, k, m)
use fmin_fmax_functions
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}
Herbie found 12 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));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, k, m)
use fmin_fmax_functions
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 (<= (/ (* a_m (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))) 4e+286)
(/ 1.0 (/ (fma (/ (- k -10.0) a_m) k (/ 1.0 a_m)) (pow k m)))
(* (pow k m) a_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 (((a_m * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))) <= 4e+286) {
tmp = 1.0 / (fma(((k - -10.0) / a_m), k, (1.0 / a_m)) / pow(k, m));
} else {
tmp = pow(k, m) * a_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 (Float64(Float64(a_m * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) <= 4e+286) tmp = Float64(1.0 / Float64(fma(Float64(Float64(k - -10.0) / a_m), k, Float64(1.0 / a_m)) / (k ^ m))); else tmp = Float64((k ^ m) * a_m); 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[N[(N[(a$95$m * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 4e+286], N[(1.0 / N[(N[(N[(N[(k - -10.0), $MachinePrecision] / a$95$m), $MachinePrecision] * k + N[(1.0 / a$95$m), $MachinePrecision]), $MachinePrecision] / N[Power[k, m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[k, m], $MachinePrecision] * a$95$m), $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}\;\frac{a\_m \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \leq 4 \cdot 10^{+286}:\\
\;\;\;\;\frac{1}{\frac{\mathsf{fma}\left(\frac{k - -10}{a\_m}, k, \frac{1}{a\_m}\right)}{{k}^{m}}}\\
\mathbf{else}:\\
\;\;\;\;{k}^{m} \cdot a\_m\\
\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))) < 4.00000000000000013e286Initial program 90.3%
lift-/.f64N/A
div-flipN/A
lower-special-/.f64N/A
lower-special-/.f6490.2
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
metadata-eval90.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.2
Applied rewrites90.2%
lift-/.f64N/A
lift-fma.f64N/A
div-addN/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lift-*.f64N/A
*-commutativeN/A
times-fracN/A
associate-*r/N/A
div-add-revN/A
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6491.9
Applied rewrites91.9%
if 4.00000000000000013e286 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) Initial program 90.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6490.3
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
metadata-eval90.3
Applied rewrites90.3%
Taylor expanded in k around 0
lower-pow.f6482.5
Applied rewrites82.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 (<= (/ (* a_m (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))) 1e+105)
(/ 1.0 (/ (fma (/ k a_m) k (/ 1.0 a_m)) (pow k m)))
(* (pow k m) a_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 (((a_m * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))) <= 1e+105) {
tmp = 1.0 / (fma((k / a_m), k, (1.0 / a_m)) / pow(k, m));
} else {
tmp = pow(k, m) * a_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 (Float64(Float64(a_m * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) <= 1e+105) tmp = Float64(1.0 / Float64(fma(Float64(k / a_m), k, Float64(1.0 / a_m)) / (k ^ m))); else tmp = Float64((k ^ m) * a_m); 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[N[(N[(a$95$m * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e+105], N[(1.0 / N[(N[(N[(k / a$95$m), $MachinePrecision] * k + N[(1.0 / a$95$m), $MachinePrecision]), $MachinePrecision] / N[Power[k, m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[k, m], $MachinePrecision] * a$95$m), $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}\;\frac{a\_m \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \leq 10^{+105}:\\
\;\;\;\;\frac{1}{\frac{\mathsf{fma}\left(\frac{k}{a\_m}, k, \frac{1}{a\_m}\right)}{{k}^{m}}}\\
\mathbf{else}:\\
\;\;\;\;{k}^{m} \cdot a\_m\\
\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))) < 9.9999999999999994e104Initial program 90.3%
lift-/.f64N/A
div-flipN/A
lower-special-/.f64N/A
lower-special-/.f6490.2
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
metadata-eval90.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.2
Applied rewrites90.2%
lift-/.f64N/A
lift-fma.f64N/A
div-addN/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lift-*.f64N/A
*-commutativeN/A
times-fracN/A
associate-*r/N/A
div-add-revN/A
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f6491.9
Applied rewrites91.9%
Taylor expanded in k around inf
lower-/.f6491.0
Applied rewrites91.0%
if 9.9999999999999994e104 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) Initial program 90.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6490.3
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
metadata-eval90.3
Applied rewrites90.3%
Taylor expanded in k around 0
lower-pow.f6482.5
Applied rewrites82.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 (<= (/ (* a_m (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))) 4e+286)
(* (/ (pow k m) (fma (- k -10.0) k 1.0)) a_m)
(* (pow k m) a_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 (((a_m * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))) <= 4e+286) {
tmp = (pow(k, m) / fma((k - -10.0), k, 1.0)) * a_m;
} else {
tmp = pow(k, m) * a_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 (Float64(Float64(a_m * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) <= 4e+286) tmp = Float64(Float64((k ^ m) / fma(Float64(k - -10.0), k, 1.0)) * a_m); else tmp = Float64((k ^ m) * a_m); 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[N[(N[(a$95$m * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 4e+286], N[(N[(N[Power[k, m], $MachinePrecision] / N[(N[(k - -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision] * a$95$m), $MachinePrecision], N[(N[Power[k, m], $MachinePrecision] * a$95$m), $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}\;\frac{a\_m \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \leq 4 \cdot 10^{+286}:\\
\;\;\;\;\frac{{k}^{m}}{\mathsf{fma}\left(k - -10, k, 1\right)} \cdot a\_m\\
\mathbf{else}:\\
\;\;\;\;{k}^{m} \cdot a\_m\\
\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))) < 4.00000000000000013e286Initial program 90.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6490.3
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
metadata-eval90.3
Applied rewrites90.3%
if 4.00000000000000013e286 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) Initial program 90.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6490.3
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
metadata-eval90.3
Applied rewrites90.3%
Taylor expanded in k around 0
lower-pow.f6482.5
Applied rewrites82.5%
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 (* (pow k m) a_m)))
(*
a_s
(if (<= m -1.2e-11)
t_0
(if (<= m 0.58) (/ a_m (fma k 10.0 (fma k k 1.0))) 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 = pow(k, m) * a_m;
double tmp;
if (m <= -1.2e-11) {
tmp = t_0;
} else if (m <= 0.58) {
tmp = a_m / fma(k, 10.0, fma(k, k, 1.0));
} 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((k ^ m) * a_m) tmp = 0.0 if (m <= -1.2e-11) tmp = t_0; elseif (m <= 0.58) tmp = Float64(a_m / fma(k, 10.0, fma(k, k, 1.0))); else tmp = t_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_] := Block[{t$95$0 = N[(N[Power[k, m], $MachinePrecision] * a$95$m), $MachinePrecision]}, N[(a$95$s * If[LessEqual[m, -1.2e-11], t$95$0, If[LessEqual[m, 0.58], N[(a$95$m / N[(k * 10.0 + N[(k * k + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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 := {k}^{m} \cdot a\_m\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;m \leq -1.2 \cdot 10^{-11}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;m \leq 0.58:\\
\;\;\;\;\frac{a\_m}{\mathsf{fma}\left(k, 10, \mathsf{fma}\left(k, k, 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if m < -1.2000000000000001e-11 or 0.57999999999999996 < m Initial program 90.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6490.3
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
metadata-eval90.3
Applied rewrites90.3%
Taylor expanded in k around 0
lower-pow.f6482.5
Applied rewrites82.5%
if -1.2000000000000001e-11 < m < 0.57999999999999996Initial program 90.3%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6444.6
Applied rewrites44.6%
lift-fma.f64N/A
+-commutativeN/A
lift-pow.f64N/A
pow2N/A
distribute-rgt-outN/A
metadata-evalN/A
sub-flipN/A
lift--.f64N/A
*-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lift-fma.f6444.6
Applied rewrites44.6%
lift-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
metadata-evalN/A
distribute-rgt-outN/A
lift-*.f64N/A
+-commutativeN/A
add-flipN/A
associate--l+N/A
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
add-flip-revN/A
+-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
lower-fma.f6444.6
Applied rewrites44.6%
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)) (+ (+ 1.0 (* 10.0 k)) (* k k)))))
(*
a_s
(if (<= t_0 0.0)
(/ (* a_m (/ a_m (fma (- k -10.0) k 1.0))) a_m)
(if (<= t_0 4e+291)
(/ a_m (fma k 10.0 (fma k k 1.0)))
(if (<= t_0 INFINITY)
(* k (fma -10.0 a_m (/ a_m k)))
(/ (- (* k (+ 10.0 (* -99.0 k))) 1.0) (/ -1.0 a_m))))))))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)) / ((1.0 + (10.0 * k)) + (k * k));
double tmp;
if (t_0 <= 0.0) {
tmp = (a_m * (a_m / fma((k - -10.0), k, 1.0))) / a_m;
} else if (t_0 <= 4e+291) {
tmp = a_m / fma(k, 10.0, fma(k, k, 1.0));
} else if (t_0 <= ((double) INFINITY)) {
tmp = k * fma(-10.0, a_m, (a_m / k));
} else {
tmp = ((k * (10.0 + (-99.0 * k))) - 1.0) / (-1.0 / a_m);
}
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(Float64(a_m * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(Float64(a_m * Float64(a_m / fma(Float64(k - -10.0), k, 1.0))) / a_m); elseif (t_0 <= 4e+291) tmp = Float64(a_m / fma(k, 10.0, fma(k, k, 1.0))); elseif (t_0 <= Inf) tmp = Float64(k * fma(-10.0, a_m, Float64(a_m / k))); else tmp = Float64(Float64(Float64(k * Float64(10.0 + Float64(-99.0 * k))) - 1.0) / Float64(-1.0 / a_m)); 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_] := Block[{t$95$0 = N[(N[(a$95$m * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[t$95$0, 0.0], N[(N[(a$95$m * N[(a$95$m / N[(N[(k - -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision], If[LessEqual[t$95$0, 4e+291], N[(a$95$m / N[(k * 10.0 + N[(k * k + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(k * N[(-10.0 * a$95$m + N[(a$95$m / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(k * N[(10.0 + N[(-99.0 * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision] / N[(-1.0 / a$95$m), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
\begin{array}{l}
t_0 := \frac{a\_m \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;\frac{a\_m \cdot \frac{a\_m}{\mathsf{fma}\left(k - -10, k, 1\right)}}{a\_m}\\
\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+291}:\\
\;\;\;\;\frac{a\_m}{\mathsf{fma}\left(k, 10, \mathsf{fma}\left(k, k, 1\right)\right)}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;k \cdot \mathsf{fma}\left(-10, a\_m, \frac{a\_m}{k}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{k \cdot \left(10 + -99 \cdot k\right) - 1}{\frac{-1}{a\_m}}\\
\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))) < 0.0Initial program 90.3%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6444.6
Applied rewrites44.6%
lift-fma.f64N/A
+-commutativeN/A
lift-pow.f64N/A
pow2N/A
distribute-rgt-outN/A
metadata-evalN/A
sub-flipN/A
lift--.f64N/A
*-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lift-fma.f6444.6
Applied rewrites44.6%
Applied rewrites39.1%
Applied rewrites43.5%
if 0.0 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) < 3.9999999999999998e291Initial program 90.3%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6444.6
Applied rewrites44.6%
lift-fma.f64N/A
+-commutativeN/A
lift-pow.f64N/A
pow2N/A
distribute-rgt-outN/A
metadata-evalN/A
sub-flipN/A
lift--.f64N/A
*-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lift-fma.f6444.6
Applied rewrites44.6%
lift-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
metadata-evalN/A
distribute-rgt-outN/A
lift-*.f64N/A
+-commutativeN/A
add-flipN/A
associate--l+N/A
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
add-flip-revN/A
+-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
lower-fma.f6444.6
Applied rewrites44.6%
if 3.9999999999999998e291 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) < +inf.0Initial program 90.3%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6444.6
Applied rewrites44.6%
Taylor expanded in k around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6420.6
Applied rewrites20.6%
Taylor expanded in k around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f6419.7
Applied rewrites19.7%
if +inf.0 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) Initial program 90.3%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6444.6
Applied rewrites44.6%
lift-fma.f64N/A
+-commutativeN/A
lift-pow.f64N/A
pow2N/A
distribute-rgt-outN/A
metadata-evalN/A
sub-flipN/A
lift--.f64N/A
*-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lift-fma.f6444.6
Applied rewrites44.6%
Applied rewrites44.5%
Taylor expanded in k around 0
lower--.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6428.4
Applied rewrites28.4%
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.46)
(/ (* a_m (/ a_m (fma (- k -10.0) k 1.0))) a_m)
(if (<= m 2.9) (/ a_m (fma k 10.0 (fma k k 1.0))) (* -10.0 (* a_m k))))))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.46) {
tmp = (a_m * (a_m / fma((k - -10.0), k, 1.0))) / a_m;
} else if (m <= 2.9) {
tmp = a_m / fma(k, 10.0, fma(k, k, 1.0));
} else {
tmp = -10.0 * (a_m * k);
}
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.46) tmp = Float64(Float64(a_m * Float64(a_m / fma(Float64(k - -10.0), k, 1.0))) / a_m); elseif (m <= 2.9) tmp = Float64(a_m / fma(k, 10.0, fma(k, k, 1.0))); else tmp = Float64(-10.0 * Float64(a_m * k)); 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[m, -0.46], N[(N[(a$95$m * N[(a$95$m / N[(N[(k - -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision], If[LessEqual[m, 2.9], N[(a$95$m / N[(k * 10.0 + N[(k * k + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a$95$m * k), $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.46:\\
\;\;\;\;\frac{a\_m \cdot \frac{a\_m}{\mathsf{fma}\left(k - -10, k, 1\right)}}{a\_m}\\
\mathbf{elif}\;m \leq 2.9:\\
\;\;\;\;\frac{a\_m}{\mathsf{fma}\left(k, 10, \mathsf{fma}\left(k, k, 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a\_m \cdot k\right)\\
\end{array}
\end{array}
if m < -0.46000000000000002Initial program 90.3%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6444.6
Applied rewrites44.6%
lift-fma.f64N/A
+-commutativeN/A
lift-pow.f64N/A
pow2N/A
distribute-rgt-outN/A
metadata-evalN/A
sub-flipN/A
lift--.f64N/A
*-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lift-fma.f6444.6
Applied rewrites44.6%
Applied rewrites39.1%
Applied rewrites43.5%
if -0.46000000000000002 < m < 2.89999999999999991Initial program 90.3%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6444.6
Applied rewrites44.6%
lift-fma.f64N/A
+-commutativeN/A
lift-pow.f64N/A
pow2N/A
distribute-rgt-outN/A
metadata-evalN/A
sub-flipN/A
lift--.f64N/A
*-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lift-fma.f6444.6
Applied rewrites44.6%
lift-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
metadata-evalN/A
distribute-rgt-outN/A
lift-*.f64N/A
+-commutativeN/A
add-flipN/A
associate--l+N/A
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
add-flip-revN/A
+-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
lower-fma.f6444.6
Applied rewrites44.6%
if 2.89999999999999991 < m Initial program 90.3%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6444.6
Applied rewrites44.6%
Taylor expanded in k around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6420.6
Applied rewrites20.6%
Taylor expanded in k around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f6419.7
Applied rewrites19.7%
Taylor expanded in k around inf
lower-*.f64N/A
lower-*.f648.2
Applied rewrites8.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 -0.74)
(/ (* a_m a_m) (* (fma (- k -10.0) k 1.0) a_m))
(if (<= m 2.9) (/ a_m (fma k 10.0 (fma k k 1.0))) (* -10.0 (* a_m k))))))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.74) {
tmp = (a_m * a_m) / (fma((k - -10.0), k, 1.0) * a_m);
} else if (m <= 2.9) {
tmp = a_m / fma(k, 10.0, fma(k, k, 1.0));
} else {
tmp = -10.0 * (a_m * k);
}
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.74) tmp = Float64(Float64(a_m * a_m) / Float64(fma(Float64(k - -10.0), k, 1.0) * a_m)); elseif (m <= 2.9) tmp = Float64(a_m / fma(k, 10.0, fma(k, k, 1.0))); else tmp = Float64(-10.0 * Float64(a_m * k)); 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[m, -0.74], N[(N[(a$95$m * a$95$m), $MachinePrecision] / N[(N[(N[(k - -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision] * a$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 2.9], N[(a$95$m / N[(k * 10.0 + N[(k * k + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a$95$m * k), $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.74:\\
\;\;\;\;\frac{a\_m \cdot a\_m}{\mathsf{fma}\left(k - -10, k, 1\right) \cdot a\_m}\\
\mathbf{elif}\;m \leq 2.9:\\
\;\;\;\;\frac{a\_m}{\mathsf{fma}\left(k, 10, \mathsf{fma}\left(k, k, 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a\_m \cdot k\right)\\
\end{array}
\end{array}
if m < -0.73999999999999999Initial program 90.3%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6444.6
Applied rewrites44.6%
lift-fma.f64N/A
+-commutativeN/A
lift-pow.f64N/A
pow2N/A
distribute-rgt-outN/A
metadata-evalN/A
sub-flipN/A
lift--.f64N/A
*-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lift-fma.f6444.6
Applied rewrites44.6%
Applied rewrites39.1%
if -0.73999999999999999 < m < 2.89999999999999991Initial program 90.3%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6444.6
Applied rewrites44.6%
lift-fma.f64N/A
+-commutativeN/A
lift-pow.f64N/A
pow2N/A
distribute-rgt-outN/A
metadata-evalN/A
sub-flipN/A
lift--.f64N/A
*-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lift-fma.f6444.6
Applied rewrites44.6%
lift-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
metadata-evalN/A
distribute-rgt-outN/A
lift-*.f64N/A
+-commutativeN/A
add-flipN/A
associate--l+N/A
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
add-flip-revN/A
+-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
lower-fma.f6444.6
Applied rewrites44.6%
if 2.89999999999999991 < m Initial program 90.3%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6444.6
Applied rewrites44.6%
Taylor expanded in k around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6420.6
Applied rewrites20.6%
Taylor expanded in k around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f6419.7
Applied rewrites19.7%
Taylor expanded in k around inf
lower-*.f64N/A
lower-*.f648.2
Applied rewrites8.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 2.9) (/ a_m (fma k 10.0 (fma k k 1.0))) (* -10.0 (* a_m k)))))
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 <= 2.9) {
tmp = a_m / fma(k, 10.0, fma(k, k, 1.0));
} else {
tmp = -10.0 * (a_m * k);
}
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 <= 2.9) tmp = Float64(a_m / fma(k, 10.0, fma(k, k, 1.0))); else tmp = Float64(-10.0 * Float64(a_m * k)); 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[m, 2.9], N[(a$95$m / N[(k * 10.0 + N[(k * k + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a$95$m * k), $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 2.9:\\
\;\;\;\;\frac{a\_m}{\mathsf{fma}\left(k, 10, \mathsf{fma}\left(k, k, 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a\_m \cdot k\right)\\
\end{array}
\end{array}
if m < 2.89999999999999991Initial program 90.3%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6444.6
Applied rewrites44.6%
lift-fma.f64N/A
+-commutativeN/A
lift-pow.f64N/A
pow2N/A
distribute-rgt-outN/A
metadata-evalN/A
sub-flipN/A
lift--.f64N/A
*-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lift-fma.f6444.6
Applied rewrites44.6%
lift-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
metadata-evalN/A
distribute-rgt-outN/A
lift-*.f64N/A
+-commutativeN/A
add-flipN/A
associate--l+N/A
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
add-flip-revN/A
+-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
lower-fma.f6444.6
Applied rewrites44.6%
if 2.89999999999999991 < m Initial program 90.3%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6444.6
Applied rewrites44.6%
Taylor expanded in k around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6420.6
Applied rewrites20.6%
Taylor expanded in k around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f6419.7
Applied rewrites19.7%
Taylor expanded in k around inf
lower-*.f64N/A
lower-*.f648.2
Applied rewrites8.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 2.9) (/ a_m (fma (- k -10.0) k 1.0)) (* -10.0 (* a_m k)))))
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 <= 2.9) {
tmp = a_m / fma((k - -10.0), k, 1.0);
} else {
tmp = -10.0 * (a_m * k);
}
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 <= 2.9) tmp = Float64(a_m / fma(Float64(k - -10.0), k, 1.0)); else tmp = Float64(-10.0 * Float64(a_m * k)); 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[m, 2.9], N[(a$95$m / N[(N[(k - -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a$95$m * k), $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 2.9:\\
\;\;\;\;\frac{a\_m}{\mathsf{fma}\left(k - -10, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a\_m \cdot k\right)\\
\end{array}
\end{array}
if m < 2.89999999999999991Initial program 90.3%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6444.6
Applied rewrites44.6%
lift-fma.f64N/A
+-commutativeN/A
lift-pow.f64N/A
pow2N/A
distribute-rgt-outN/A
metadata-evalN/A
sub-flipN/A
lift--.f64N/A
*-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lift-fma.f6444.6
Applied rewrites44.6%
if 2.89999999999999991 < m Initial program 90.3%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6444.6
Applied rewrites44.6%
Taylor expanded in k around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6420.6
Applied rewrites20.6%
Taylor expanded in k around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f6419.7
Applied rewrites19.7%
Taylor expanded in k around inf
lower-*.f64N/A
lower-*.f648.2
Applied rewrites8.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 2.9) (/ a_m (fma 10.0 k 1.0)) (* -10.0 (* a_m k)))))
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 <= 2.9) {
tmp = a_m / fma(10.0, k, 1.0);
} else {
tmp = -10.0 * (a_m * k);
}
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 <= 2.9) tmp = Float64(a_m / fma(10.0, k, 1.0)); else tmp = Float64(-10.0 * Float64(a_m * k)); 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[m, 2.9], N[(a$95$m / N[(10.0 * k + 1.0), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a$95$m * k), $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 2.9:\\
\;\;\;\;\frac{a\_m}{\mathsf{fma}\left(10, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a\_m \cdot k\right)\\
\end{array}
\end{array}
if m < 2.89999999999999991Initial program 90.3%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6444.6
Applied rewrites44.6%
lift-fma.f64N/A
+-commutativeN/A
lift-pow.f64N/A
pow2N/A
distribute-rgt-outN/A
metadata-evalN/A
sub-flipN/A
lift--.f64N/A
*-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lift-fma.f6444.6
Applied rewrites44.6%
Taylor expanded in k around 0
Applied rewrites27.9%
if 2.89999999999999991 < m Initial program 90.3%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6444.6
Applied rewrites44.6%
Taylor expanded in k around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6420.6
Applied rewrites20.6%
Taylor expanded in k around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f6419.7
Applied rewrites19.7%
Taylor expanded in k around inf
lower-*.f64N/A
lower-*.f648.2
Applied rewrites8.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 2.9) (/ a_m 1.0) (* -10.0 (* a_m k)))))
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 <= 2.9) {
tmp = a_m / 1.0;
} else {
tmp = -10.0 * (a_m * k);
}
return a_s * tmp;
}
a\_m = private
a\_s = private
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a_s, a_m, k, m)
use fmin_fmax_functions
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 <= 2.9d0) then
tmp = a_m / 1.0d0
else
tmp = (-10.0d0) * (a_m * k)
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 <= 2.9) {
tmp = a_m / 1.0;
} else {
tmp = -10.0 * (a_m * k);
}
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 <= 2.9: tmp = a_m / 1.0 else: tmp = -10.0 * (a_m * k) 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 <= 2.9) tmp = Float64(a_m / 1.0); else tmp = Float64(-10.0 * Float64(a_m * k)); 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 <= 2.9) tmp = a_m / 1.0; else tmp = -10.0 * (a_m * k); 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, 2.9], N[(a$95$m / 1.0), $MachinePrecision], N[(-10.0 * N[(a$95$m * k), $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 2.9:\\
\;\;\;\;\frac{a\_m}{1}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a\_m \cdot k\right)\\
\end{array}
\end{array}
if m < 2.89999999999999991Initial program 90.3%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6444.6
Applied rewrites44.6%
lift-fma.f64N/A
+-commutativeN/A
lift-pow.f64N/A
pow2N/A
distribute-rgt-outN/A
metadata-evalN/A
sub-flipN/A
lift--.f64N/A
*-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lift-fma.f6444.6
Applied rewrites44.6%
Taylor expanded in k around 0
Applied rewrites19.6%
if 2.89999999999999991 < m Initial program 90.3%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6444.6
Applied rewrites44.6%
Taylor expanded in k around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6420.6
Applied rewrites20.6%
Taylor expanded in k around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f6419.7
Applied rewrites19.7%
Taylor expanded in k around inf
lower-*.f64N/A
lower-*.f648.2
Applied rewrites8.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 (/ a_m 1.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);
}
a\_m = private
a\_s = private
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a_s, a_m, k, m)
use fmin_fmax_functions
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)
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);
}
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)
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 / 1.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); 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 / 1.0), $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}
\end{array}
Initial program 90.3%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6444.6
Applied rewrites44.6%
lift-fma.f64N/A
+-commutativeN/A
lift-pow.f64N/A
pow2N/A
distribute-rgt-outN/A
metadata-evalN/A
sub-flipN/A
lift--.f64N/A
*-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lift-fma.f6444.6
Applied rewrites44.6%
Taylor expanded in k around 0
Applied rewrites19.6%
herbie shell --seed 2025150
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))