
(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]
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}
Herbie found 14 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]
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}
(FPCore (a k m) :precision binary64 (if (<= k 5.6e-17) (* a (pow k m)) (/ (/ a (* (+ (+ 10.0 (/ 1.0 k)) k) (pow k (- m)))) k)))
double code(double a, double k, double m) {
double tmp;
if (k <= 5.6e-17) {
tmp = a * pow(k, m);
} else {
tmp = (a / (((10.0 + (1.0 / k)) + k) * pow(k, -m))) / k;
}
return tmp;
}
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
real(8) :: tmp
if (k <= 5.6d-17) then
tmp = a * (k ** m)
else
tmp = (a / (((10.0d0 + (1.0d0 / k)) + k) * (k ** -m))) / k
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 5.6e-17) {
tmp = a * Math.pow(k, m);
} else {
tmp = (a / (((10.0 + (1.0 / k)) + k) * Math.pow(k, -m))) / k;
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 5.6e-17: tmp = a * math.pow(k, m) else: tmp = (a / (((10.0 + (1.0 / k)) + k) * math.pow(k, -m))) / k return tmp
function code(a, k, m) tmp = 0.0 if (k <= 5.6e-17) tmp = Float64(a * (k ^ m)); else tmp = Float64(Float64(a / Float64(Float64(Float64(10.0 + Float64(1.0 / k)) + k) * (k ^ Float64(-m)))) / k); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 5.6e-17) tmp = a * (k ^ m); else tmp = (a / (((10.0 + (1.0 / k)) + k) * (k ^ -m))) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 5.6e-17], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(N[(a / N[(N[(N[(10.0 + N[(1.0 / k), $MachinePrecision]), $MachinePrecision] + k), $MachinePrecision] * N[Power[k, (-m)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;k \leq 5.6 \cdot 10^{-17}:\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a}{\left(\left(10 + \frac{1}{k}\right) + k\right) \cdot {k}^{\left(-m\right)}}}{k}\\
\end{array}
if k < 5.5999999999999998e-17Initial program 89.8%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.2%
Applied rewrites45.2%
lift-/.f64N/A
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow-divN/A
lift-pow.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
associate-+l+N/A
lift-+.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
unpow1N/A
add-to-fractionN/A
associate-/r/N/A
lift-pow.f64N/A
unpow-1N/A
frac-2negN/A
metadata-evalN/A
Applied rewrites45.2%
Taylor expanded in k around 0
Applied rewrites20.7%
Taylor expanded in k around 0
lower-*.f64N/A
lower-pow.f6482.7%
Applied rewrites82.7%
if 5.5999999999999998e-17 < k Initial program 89.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6489.8%
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
metadata-evalN/A
associate-+r+N/A
+-commutativeN/A
+-lft-identityN/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-eval89.8%
Applied rewrites89.8%
Applied rewrites95.8%
lift-/.f64N/A
mult-flipN/A
lift-/.f64N/A
associate-*l/N/A
mult-flipN/A
lower-/.f64N/A
Applied rewrites96.1%
(FPCore (a k m) :precision binary64 (if (<= m 1.5e-10) (/ (* (pow k m) a) (fma (- k -10.0) k 1.0)) (* a (pow k m))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.5e-10) {
tmp = (pow(k, m) * a) / fma((k - -10.0), k, 1.0);
} else {
tmp = a * pow(k, m);
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= 1.5e-10) tmp = Float64(Float64((k ^ m) * a) / fma(Float64(k - -10.0), k, 1.0)); else tmp = Float64(a * (k ^ m)); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, 1.5e-10], N[(N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision] / N[(N[(k - -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;m \leq 1.5 \cdot 10^{-10}:\\
\;\;\;\;\frac{{k}^{m} \cdot a}{\mathsf{fma}\left(k - -10, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{m}\\
\end{array}
if m < 1.5e-10Initial program 89.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6489.8%
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
metadata-evalN/A
associate-+r+N/A
+-commutativeN/A
+-lft-identityN/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-eval89.8%
Applied rewrites89.8%
if 1.5e-10 < m Initial program 89.8%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.2%
Applied rewrites45.2%
lift-/.f64N/A
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow-divN/A
lift-pow.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
associate-+l+N/A
lift-+.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
unpow1N/A
add-to-fractionN/A
associate-/r/N/A
lift-pow.f64N/A
unpow-1N/A
frac-2negN/A
metadata-evalN/A
Applied rewrites45.2%
Taylor expanded in k around 0
Applied rewrites20.7%
Taylor expanded in k around 0
lower-*.f64N/A
lower-pow.f6482.7%
Applied rewrites82.7%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (* a (pow k m))))
(if (<= m -0.00016)
t_0
(if (<= m 1.5e-10)
(* (fma (log k) m 1.0) (/ a (fma (- k -10.0) k 1.0)))
t_0))))double code(double a, double k, double m) {
double t_0 = a * pow(k, m);
double tmp;
if (m <= -0.00016) {
tmp = t_0;
} else if (m <= 1.5e-10) {
tmp = fma(log(k), m, 1.0) * (a / fma((k - -10.0), k, 1.0));
} else {
tmp = t_0;
}
return tmp;
}
function code(a, k, m) t_0 = Float64(a * (k ^ m)) tmp = 0.0 if (m <= -0.00016) tmp = t_0; elseif (m <= 1.5e-10) tmp = Float64(fma(log(k), m, 1.0) * Float64(a / fma(Float64(k - -10.0), k, 1.0))); else tmp = t_0; end return tmp end
code[a_, k_, m_] := Block[{t$95$0 = N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[m, -0.00016], t$95$0, If[LessEqual[m, 1.5e-10], N[(N[(N[Log[k], $MachinePrecision] * m + 1.0), $MachinePrecision] * N[(a / N[(N[(k - -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
\mathbf{if}\;m \leq -0.00016:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;m \leq 1.5 \cdot 10^{-10}:\\
\;\;\;\;\mathsf{fma}\left(\log k, m, 1\right) \cdot \frac{a}{\mathsf{fma}\left(k - -10, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if m < -1.6000000000000001e-4 or 1.5e-10 < m Initial program 89.8%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.2%
Applied rewrites45.2%
lift-/.f64N/A
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow-divN/A
lift-pow.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
associate-+l+N/A
lift-+.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
unpow1N/A
add-to-fractionN/A
associate-/r/N/A
lift-pow.f64N/A
unpow-1N/A
frac-2negN/A
metadata-evalN/A
Applied rewrites45.2%
Taylor expanded in k around 0
Applied rewrites20.7%
Taylor expanded in k around 0
lower-*.f64N/A
lower-pow.f6482.7%
Applied rewrites82.7%
if -1.6000000000000001e-4 < m < 1.5e-10Initial program 89.8%
Taylor expanded in m around 0
lower-+.f64N/A
lower-*.f64N/A
lower-log.f6440.7%
Applied rewrites40.7%
Applied rewrites41.6%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (* a (pow k m))))
(if (<= m -0.00016)
t_0
(if (<= m 1.5e-10) (/ a (fma (- k -10.0) k 1.0)) t_0))))double code(double a, double k, double m) {
double t_0 = a * pow(k, m);
double tmp;
if (m <= -0.00016) {
tmp = t_0;
} else if (m <= 1.5e-10) {
tmp = a / fma((k - -10.0), k, 1.0);
} else {
tmp = t_0;
}
return tmp;
}
function code(a, k, m) t_0 = Float64(a * (k ^ m)) tmp = 0.0 if (m <= -0.00016) tmp = t_0; elseif (m <= 1.5e-10) tmp = Float64(a / fma(Float64(k - -10.0), k, 1.0)); else tmp = t_0; end return tmp end
code[a_, k_, m_] := Block[{t$95$0 = N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[m, -0.00016], t$95$0, If[LessEqual[m, 1.5e-10], N[(a / N[(N[(k - -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
\mathbf{if}\;m \leq -0.00016:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;m \leq 1.5 \cdot 10^{-10}:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(k - -10, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if m < -1.6000000000000001e-4 or 1.5e-10 < m Initial program 89.8%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.2%
Applied rewrites45.2%
lift-/.f64N/A
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow-divN/A
lift-pow.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
associate-+l+N/A
lift-+.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
unpow1N/A
add-to-fractionN/A
associate-/r/N/A
lift-pow.f64N/A
unpow-1N/A
frac-2negN/A
metadata-evalN/A
Applied rewrites45.2%
Taylor expanded in k around 0
Applied rewrites20.7%
Taylor expanded in k around 0
lower-*.f64N/A
lower-pow.f6482.7%
Applied rewrites82.7%
if -1.6000000000000001e-4 < m < 1.5e-10Initial program 89.8%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.2%
Applied rewrites45.2%
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow-divN/A
lift-pow.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-divN/A
metadata-evalN/A
pow2N/A
lift-*.f64N/A
distribute-rgt-outN/A
metadata-evalN/A
sub-flipN/A
lift--.f64N/A
*-commutativeN/A
+-commutativeN/A
lift-fma.f6445.2%
Applied rewrites45.2%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (* a (pow k m))))
(if (<= (/ t_0 (+ (+ 1.0 (* 10.0 k)) (* k k))) INFINITY)
(/ t_0 (+ 1.0 (* k k)))
(+ a (* a (* k (- (* 99.0 k) 10.0)))))))double code(double a, double k, double m) {
double t_0 = a * pow(k, m);
double tmp;
if ((t_0 / ((1.0 + (10.0 * k)) + (k * k))) <= ((double) INFINITY)) {
tmp = t_0 / (1.0 + (k * k));
} else {
tmp = a + (a * (k * ((99.0 * k) - 10.0)));
}
return tmp;
}
public static double code(double a, double k, double m) {
double t_0 = a * Math.pow(k, m);
double tmp;
if ((t_0 / ((1.0 + (10.0 * k)) + (k * k))) <= Double.POSITIVE_INFINITY) {
tmp = t_0 / (1.0 + (k * k));
} else {
tmp = a + (a * (k * ((99.0 * k) - 10.0)));
}
return tmp;
}
def code(a, k, m): t_0 = a * math.pow(k, m) tmp = 0 if (t_0 / ((1.0 + (10.0 * k)) + (k * k))) <= math.inf: tmp = t_0 / (1.0 + (k * k)) else: tmp = a + (a * (k * ((99.0 * k) - 10.0))) return tmp
function code(a, k, m) t_0 = Float64(a * (k ^ m)) tmp = 0.0 if (Float64(t_0 / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) <= Inf) tmp = Float64(t_0 / Float64(1.0 + Float64(k * k))); else tmp = Float64(a + Float64(a * Float64(k * Float64(Float64(99.0 * k) - 10.0)))); end return tmp end
function tmp_2 = code(a, k, m) t_0 = a * (k ^ m); tmp = 0.0; if ((t_0 / ((1.0 + (10.0 * k)) + (k * k))) <= Inf) tmp = t_0 / (1.0 + (k * k)); else tmp = a + (a * (k * ((99.0 * k) - 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$0 / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(t$95$0 / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(a * N[(k * N[(N[(99.0 * k), $MachinePrecision] - 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
\mathbf{if}\;\frac{t\_0}{\left(1 + 10 \cdot k\right) + k \cdot k} \leq \infty:\\
\;\;\;\;\frac{t\_0}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a + a \cdot \left(k \cdot \left(99 \cdot k - 10\right)\right)\\
\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))) < +inf.0Initial program 89.8%
Taylor expanded in k around 0
Applied rewrites88.9%
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 89.8%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.2%
Applied rewrites45.2%
Taylor expanded in k around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6428.2%
Applied rewrites28.2%
Taylor expanded in a around 0
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6429.9%
Applied rewrites29.9%
(FPCore (a k m)
:precision binary64
(let* ((t_0
(/ (* (fabs a) (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k)))))
(*
(copysign 1.0 a)
(if (<= t_0 0.0)
(/ (/ (fabs a) (+ (+ 10.0 (/ 1.0 k)) k)) k)
(if (<= t_0 1e+275)
(/ (fabs a) (fma (- k -10.0) k 1.0))
(if (<= t_0 INFINITY)
(* k (fma -10.0 (fabs a) (/ (fabs a) k)))
(+ (fabs a) (* (fabs a) (* k (- (* 99.0 k) 10.0))))))))))double code(double a, double k, double m) {
double t_0 = (fabs(a) * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
double tmp;
if (t_0 <= 0.0) {
tmp = (fabs(a) / ((10.0 + (1.0 / k)) + k)) / k;
} else if (t_0 <= 1e+275) {
tmp = fabs(a) / fma((k - -10.0), k, 1.0);
} else if (t_0 <= ((double) INFINITY)) {
tmp = k * fma(-10.0, fabs(a), (fabs(a) / k));
} else {
tmp = fabs(a) + (fabs(a) * (k * ((99.0 * k) - 10.0)));
}
return copysign(1.0, a) * tmp;
}
function code(a, k, m) t_0 = Float64(Float64(abs(a) * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(Float64(abs(a) / Float64(Float64(10.0 + Float64(1.0 / k)) + k)) / k); elseif (t_0 <= 1e+275) tmp = Float64(abs(a) / fma(Float64(k - -10.0), k, 1.0)); elseif (t_0 <= Inf) tmp = Float64(k * fma(-10.0, abs(a), Float64(abs(a) / k))); else tmp = Float64(abs(a) + Float64(abs(a) * Float64(k * Float64(Float64(99.0 * k) - 10.0)))); end return Float64(copysign(1.0, a) * tmp) end
code[a_, k_, m_] := Block[{t$95$0 = N[(N[(N[Abs[a], $MachinePrecision] * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$0, 0.0], N[(N[(N[Abs[a], $MachinePrecision] / N[(N[(10.0 + N[(1.0 / k), $MachinePrecision]), $MachinePrecision] + k), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision], If[LessEqual[t$95$0, 1e+275], N[(N[Abs[a], $MachinePrecision] / N[(N[(k - -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(k * N[(-10.0 * N[Abs[a], $MachinePrecision] + N[(N[Abs[a], $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Abs[a], $MachinePrecision] + N[(N[Abs[a], $MachinePrecision] * N[(k * N[(N[(99.0 * k), $MachinePrecision] - 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]]
\begin{array}{l}
t_0 := \frac{\left|a\right| \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}\\
\mathsf{copysign}\left(1, a\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;\frac{\frac{\left|a\right|}{\left(10 + \frac{1}{k}\right) + k}}{k}\\
\mathbf{elif}\;t\_0 \leq 10^{+275}:\\
\;\;\;\;\frac{\left|a\right|}{\mathsf{fma}\left(k - -10, k, 1\right)}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;k \cdot \mathsf{fma}\left(-10, \left|a\right|, \frac{\left|a\right|}{k}\right)\\
\mathbf{else}:\\
\;\;\;\;\left|a\right| + \left|a\right| \cdot \left(k \cdot \left(99 \cdot k - 10\right)\right)\\
\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 89.8%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.2%
Applied rewrites45.2%
lift-/.f64N/A
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow-divN/A
lift-pow.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
associate-+l+N/A
lift-+.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
unpow1N/A
add-to-fractionN/A
associate-/r/N/A
lift-pow.f64N/A
unpow-1N/A
frac-2negN/A
metadata-evalN/A
Applied rewrites45.2%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
metadata-evalN/A
lift-neg.f64N/A
frac-2negN/A
mult-flip-revN/A
lower-/.f64N/A
lower-/.f6445.3%
lift-/.f64N/A
lift-fma.f64N/A
add-to-fraction-revN/A
lift-/.f64N/A
lower-+.f6445.3%
Applied rewrites45.3%
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))) < 9.9999999999999996e274Initial program 89.8%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.2%
Applied rewrites45.2%
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow-divN/A
lift-pow.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-divN/A
metadata-evalN/A
pow2N/A
lift-*.f64N/A
distribute-rgt-outN/A
metadata-evalN/A
sub-flipN/A
lift--.f64N/A
*-commutativeN/A
+-commutativeN/A
lift-fma.f6445.2%
Applied rewrites45.2%
if 9.9999999999999996e274 < (/.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 89.8%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.2%
Applied rewrites45.2%
Taylor expanded in k around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6421.6%
Applied rewrites21.6%
Taylor expanded in k around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f6420.0%
Applied rewrites20.0%
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 89.8%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.2%
Applied rewrites45.2%
Taylor expanded in k around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6428.2%
Applied rewrites28.2%
Taylor expanded in a around 0
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6429.9%
Applied rewrites29.9%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (fma (- k -10.0) k 1.0)))
(if (<= m -4e+19)
(* (/ (/ a k) t_0) k)
(if (<= m 112000.0)
(/ a t_0)
(+ a (* a (* k (- (* 99.0 k) 10.0))))))))double code(double a, double k, double m) {
double t_0 = fma((k - -10.0), k, 1.0);
double tmp;
if (m <= -4e+19) {
tmp = ((a / k) / t_0) * k;
} else if (m <= 112000.0) {
tmp = a / t_0;
} else {
tmp = a + (a * (k * ((99.0 * k) - 10.0)));
}
return tmp;
}
function code(a, k, m) t_0 = fma(Float64(k - -10.0), k, 1.0) tmp = 0.0 if (m <= -4e+19) tmp = Float64(Float64(Float64(a / k) / t_0) * k); elseif (m <= 112000.0) tmp = Float64(a / t_0); else tmp = Float64(a + Float64(a * Float64(k * Float64(Float64(99.0 * k) - 10.0)))); end return tmp end
code[a_, k_, m_] := Block[{t$95$0 = N[(N[(k - -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]}, If[LessEqual[m, -4e+19], N[(N[(N[(a / k), $MachinePrecision] / t$95$0), $MachinePrecision] * k), $MachinePrecision], If[LessEqual[m, 112000.0], N[(a / t$95$0), $MachinePrecision], N[(a + N[(a * N[(k * N[(N[(99.0 * k), $MachinePrecision] - 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \mathsf{fma}\left(k - -10, k, 1\right)\\
\mathbf{if}\;m \leq -4 \cdot 10^{+19}:\\
\;\;\;\;\frac{\frac{a}{k}}{t\_0} \cdot k\\
\mathbf{elif}\;m \leq 112000:\\
\;\;\;\;\frac{a}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;a + a \cdot \left(k \cdot \left(99 \cdot k - 10\right)\right)\\
\end{array}
if m < -4e19Initial program 89.8%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.2%
Applied rewrites45.2%
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow-divN/A
lift-pow.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-divN/A
metadata-evalN/A
pow2N/A
lift-*.f64N/A
distribute-rgt-outN/A
metadata-evalN/A
sub-flipN/A
lift--.f64N/A
*-commutativeN/A
+-commutativeN/A
lift-fma.f6445.2%
Applied rewrites45.2%
Applied rewrites43.9%
if -4e19 < m < 112000Initial program 89.8%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.2%
Applied rewrites45.2%
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow-divN/A
lift-pow.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-divN/A
metadata-evalN/A
pow2N/A
lift-*.f64N/A
distribute-rgt-outN/A
metadata-evalN/A
sub-flipN/A
lift--.f64N/A
*-commutativeN/A
+-commutativeN/A
lift-fma.f6445.2%
Applied rewrites45.2%
if 112000 < m Initial program 89.8%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.2%
Applied rewrites45.2%
Taylor expanded in k around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6428.2%
Applied rewrites28.2%
Taylor expanded in a around 0
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6429.9%
Applied rewrites29.9%
(FPCore (a k m)
:precision binary64
(let* ((t_0
(/ (* (fabs a) (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k)))))
(*
(copysign 1.0 a)
(if (<= t_0 1e+275)
(/ (fabs a) (fma (- k -10.0) k 1.0))
(if (<= t_0 INFINITY)
(* k (fma -10.0 (fabs a) (/ (fabs a) k)))
(+ (fabs a) (* (fabs a) (* k (- (* 99.0 k) 10.0)))))))))double code(double a, double k, double m) {
double t_0 = (fabs(a) * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
double tmp;
if (t_0 <= 1e+275) {
tmp = fabs(a) / fma((k - -10.0), k, 1.0);
} else if (t_0 <= ((double) INFINITY)) {
tmp = k * fma(-10.0, fabs(a), (fabs(a) / k));
} else {
tmp = fabs(a) + (fabs(a) * (k * ((99.0 * k) - 10.0)));
}
return copysign(1.0, a) * tmp;
}
function code(a, k, m) t_0 = Float64(Float64(abs(a) * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) tmp = 0.0 if (t_0 <= 1e+275) tmp = Float64(abs(a) / fma(Float64(k - -10.0), k, 1.0)); elseif (t_0 <= Inf) tmp = Float64(k * fma(-10.0, abs(a), Float64(abs(a) / k))); else tmp = Float64(abs(a) + Float64(abs(a) * Float64(k * Float64(Float64(99.0 * k) - 10.0)))); end return Float64(copysign(1.0, a) * tmp) end
code[a_, k_, m_] := Block[{t$95$0 = N[(N[(N[Abs[a], $MachinePrecision] * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$0, 1e+275], N[(N[Abs[a], $MachinePrecision] / N[(N[(k - -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(k * N[(-10.0 * N[Abs[a], $MachinePrecision] + N[(N[Abs[a], $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Abs[a], $MachinePrecision] + N[(N[Abs[a], $MachinePrecision] * N[(k * N[(N[(99.0 * k), $MachinePrecision] - 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
t_0 := \frac{\left|a\right| \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}\\
\mathsf{copysign}\left(1, a\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 10^{+275}:\\
\;\;\;\;\frac{\left|a\right|}{\mathsf{fma}\left(k - -10, k, 1\right)}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;k \cdot \mathsf{fma}\left(-10, \left|a\right|, \frac{\left|a\right|}{k}\right)\\
\mathbf{else}:\\
\;\;\;\;\left|a\right| + \left|a\right| \cdot \left(k \cdot \left(99 \cdot k - 10\right)\right)\\
\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.9999999999999996e274Initial program 89.8%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.2%
Applied rewrites45.2%
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow-divN/A
lift-pow.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-divN/A
metadata-evalN/A
pow2N/A
lift-*.f64N/A
distribute-rgt-outN/A
metadata-evalN/A
sub-flipN/A
lift--.f64N/A
*-commutativeN/A
+-commutativeN/A
lift-fma.f6445.2%
Applied rewrites45.2%
if 9.9999999999999996e274 < (/.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 89.8%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.2%
Applied rewrites45.2%
Taylor expanded in k around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6421.6%
Applied rewrites21.6%
Taylor expanded in k around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f6420.0%
Applied rewrites20.0%
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 89.8%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.2%
Applied rewrites45.2%
Taylor expanded in k around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6428.2%
Applied rewrites28.2%
Taylor expanded in a around 0
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6429.9%
Applied rewrites29.9%
(FPCore (a k m)
:precision binary64
(*
(copysign 1.0 a)
(if (<=
(/ (* (fabs a) (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k)))
1e+275)
(/ (fabs a) (fma (- k -10.0) k 1.0))
(* k (fma -10.0 (fabs a) (/ (fabs a) k))))))double code(double a, double k, double m) {
double tmp;
if (((fabs(a) * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))) <= 1e+275) {
tmp = fabs(a) / fma((k - -10.0), k, 1.0);
} else {
tmp = k * fma(-10.0, fabs(a), (fabs(a) / k));
}
return copysign(1.0, a) * tmp;
}
function code(a, k, m) tmp = 0.0 if (Float64(Float64(abs(a) * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) <= 1e+275) tmp = Float64(abs(a) / fma(Float64(k - -10.0), k, 1.0)); else tmp = Float64(k * fma(-10.0, abs(a), Float64(abs(a) / k))); end return Float64(copysign(1.0, a) * tmp) end
code[a_, k_, m_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(N[(N[Abs[a], $MachinePrecision] * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e+275], N[(N[Abs[a], $MachinePrecision] / N[(N[(k - -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], N[(k * N[(-10.0 * N[Abs[a], $MachinePrecision] + N[(N[Abs[a], $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, a\right) \cdot \begin{array}{l}
\mathbf{if}\;\frac{\left|a\right| \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \leq 10^{+275}:\\
\;\;\;\;\frac{\left|a\right|}{\mathsf{fma}\left(k - -10, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;k \cdot \mathsf{fma}\left(-10, \left|a\right|, \frac{\left|a\right|}{k}\right)\\
\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.9999999999999996e274Initial program 89.8%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.2%
Applied rewrites45.2%
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow-divN/A
lift-pow.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-divN/A
metadata-evalN/A
pow2N/A
lift-*.f64N/A
distribute-rgt-outN/A
metadata-evalN/A
sub-flipN/A
lift--.f64N/A
*-commutativeN/A
+-commutativeN/A
lift-fma.f6445.2%
Applied rewrites45.2%
if 9.9999999999999996e274 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) Initial program 89.8%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.2%
Applied rewrites45.2%
Taylor expanded in k around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6421.6%
Applied rewrites21.6%
Taylor expanded in k around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f6420.0%
Applied rewrites20.0%
(FPCore (a k m) :precision binary64 (if (<= m 112000.0) (/ a (fma (- k -10.0) k 1.0)) (* a (+ 1.0 (* -10.0 k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= 112000.0) {
tmp = a / fma((k - -10.0), k, 1.0);
} else {
tmp = a * (1.0 + (-10.0 * k));
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= 112000.0) tmp = Float64(a / fma(Float64(k - -10.0), k, 1.0)); else tmp = Float64(a * Float64(1.0 + Float64(-10.0 * k))); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, 112000.0], N[(a / N[(N[(k - -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], N[(a * N[(1.0 + N[(-10.0 * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;m \leq 112000:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(k - -10, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(1 + -10 \cdot k\right)\\
\end{array}
if m < 112000Initial program 89.8%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.2%
Applied rewrites45.2%
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow-divN/A
lift-pow.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-divN/A
metadata-evalN/A
pow2N/A
lift-*.f64N/A
distribute-rgt-outN/A
metadata-evalN/A
sub-flipN/A
lift--.f64N/A
*-commutativeN/A
+-commutativeN/A
lift-fma.f6445.2%
Applied rewrites45.2%
if 112000 < m Initial program 89.8%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.2%
Applied rewrites45.2%
Taylor expanded in k around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6421.6%
Applied rewrites21.6%
Taylor expanded in a around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6421.6%
Applied rewrites21.6%
(FPCore (a k m) :precision binary64 (if (<= m 46.0) (/ a (fma 10.0 k 1.0)) (* a (+ 1.0 (* -10.0 k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= 46.0) {
tmp = a / fma(10.0, k, 1.0);
} else {
tmp = a * (1.0 + (-10.0 * k));
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= 46.0) tmp = Float64(a / fma(10.0, k, 1.0)); else tmp = Float64(a * Float64(1.0 + Float64(-10.0 * k))); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, 46.0], N[(a / N[(10.0 * k + 1.0), $MachinePrecision]), $MachinePrecision], N[(a * N[(1.0 + N[(-10.0 * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;m \leq 46:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(10, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(1 + -10 \cdot k\right)\\
\end{array}
if m < 46Initial program 89.8%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.2%
Applied rewrites45.2%
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow-divN/A
lift-pow.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-divN/A
metadata-evalN/A
pow2N/A
lift-*.f64N/A
distribute-rgt-outN/A
metadata-evalN/A
sub-flipN/A
lift--.f64N/A
*-commutativeN/A
+-commutativeN/A
lift-fma.f6445.2%
Applied rewrites45.2%
Taylor expanded in k around 0
Applied rewrites29.2%
if 46 < m Initial program 89.8%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.2%
Applied rewrites45.2%
Taylor expanded in k around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6421.6%
Applied rewrites21.6%
Taylor expanded in a around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6421.6%
Applied rewrites21.6%
(FPCore (a k m) :precision binary64 (* a (+ 1.0 (* -10.0 k))))
double code(double a, double k, double m) {
return a * (1.0 + (-10.0 * 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 * (1.0d0 + ((-10.0d0) * k))
end function
public static double code(double a, double k, double m) {
return a * (1.0 + (-10.0 * k));
}
def code(a, k, m): return a * (1.0 + (-10.0 * k))
function code(a, k, m) return Float64(a * Float64(1.0 + Float64(-10.0 * k))) end
function tmp = code(a, k, m) tmp = a * (1.0 + (-10.0 * k)); end
code[a_, k_, m_] := N[(a * N[(1.0 + N[(-10.0 * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
a \cdot \left(1 + -10 \cdot k\right)
Initial program 89.8%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.2%
Applied rewrites45.2%
Taylor expanded in k around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6421.6%
Applied rewrites21.6%
Taylor expanded in a around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6421.6%
Applied rewrites21.6%
(FPCore (a k m) :precision binary64 (fma (* -10.0 k) a a))
double code(double a, double k, double m) {
return fma((-10.0 * k), a, a);
}
function code(a, k, m) return fma(Float64(-10.0 * k), a, a) end
code[a_, k_, m_] := N[(N[(-10.0 * k), $MachinePrecision] * a + a), $MachinePrecision]
\mathsf{fma}\left(-10 \cdot k, a, a\right)
Initial program 89.8%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.2%
Applied rewrites45.2%
Taylor expanded in k around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6421.6%
Applied rewrites21.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
distribute-lft-neg-outN/A
lower-fma.f64N/A
distribute-lft-neg-outN/A
metadata-evalN/A
lower-*.f6421.6%
Applied rewrites21.6%
(FPCore (a k m) :precision binary64 (/ a 1.0))
double code(double a, double k, double m) {
return a / 1.0;
}
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 / 1.0d0
end function
public static double code(double a, double k, double m) {
return a / 1.0;
}
def code(a, k, m): return a / 1.0
function code(a, k, m) return Float64(a / 1.0) end
function tmp = code(a, k, m) tmp = a / 1.0; end
code[a_, k_, m_] := N[(a / 1.0), $MachinePrecision]
\frac{a}{1}
Initial program 89.8%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.2%
Applied rewrites45.2%
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow-divN/A
lift-pow.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-divN/A
metadata-evalN/A
pow2N/A
lift-*.f64N/A
distribute-rgt-outN/A
metadata-evalN/A
sub-flipN/A
lift--.f64N/A
*-commutativeN/A
+-commutativeN/A
lift-fma.f6445.2%
Applied rewrites45.2%
Taylor expanded in k around 0
Applied rewrites20.7%
herbie shell --seed 2025212
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))