
(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}
Sampling outcomes in binary64 precision:
Herbie found 15 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}
(FPCore (a k m) :precision binary64 (let* ((t_0 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))) (if (<= t_0 2e+212) t_0 (* (pow k m) a))))
double code(double a, double k, double m) {
double t_0 = (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
double tmp;
if (t_0 <= 2e+212) {
tmp = t_0;
} else {
tmp = pow(k, m) * a;
}
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) :: t_0
real(8) :: tmp
t_0 = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
if (t_0 <= 2d+212) then
tmp = t_0
else
tmp = (k ** m) * a
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
double tmp;
if (t_0 <= 2e+212) {
tmp = t_0;
} else {
tmp = Math.pow(k, m) * a;
}
return tmp;
}
def code(a, k, m): t_0 = (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k)) tmp = 0 if t_0 <= 2e+212: tmp = t_0 else: tmp = math.pow(k, m) * a return tmp
function code(a, k, m) t_0 = Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) tmp = 0.0 if (t_0 <= 2e+212) tmp = t_0; else tmp = Float64((k ^ m) * a); end return tmp end
function tmp_2 = code(a, k, m) t_0 = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k)); tmp = 0.0; if (t_0 <= 2e+212) tmp = t_0; else tmp = (k ^ m) * a; end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = 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]}, If[LessEqual[t$95$0, 2e+212], t$95$0, N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}\\
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{+212}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;{k}^{m} \cdot a\\
\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.9999999999999998e212Initial program 95.7%
if 1.9999999999999998e212 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) Initial program 56.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6456.5
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6460.9
Applied rewrites60.9%
Taylor expanded in k around 0
lower-pow.f64100.0
Applied rewrites100.0%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k)))))
(if (<= t_0 0.0)
(/ a (* (* (+ (/ (fma 10.0 k 1.0) (* k k)) 1.0) k) k))
(if (<= t_0 5e+307)
(/ a (fma (+ 10.0 k) k 1.0))
(if (<= t_0 INFINITY)
(* (/ (+ (/ (+ (/ 99.0 k) -10.0) k) 1.0) (* k k)) a)
(* (fma (- (* 99.0 k) 10.0) k 1.0) a))))))
double code(double a, double k, double m) {
double t_0 = (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
double tmp;
if (t_0 <= 0.0) {
tmp = a / ((((fma(10.0, k, 1.0) / (k * k)) + 1.0) * k) * k);
} else if (t_0 <= 5e+307) {
tmp = a / fma((10.0 + k), k, 1.0);
} else if (t_0 <= ((double) INFINITY)) {
tmp = (((((99.0 / k) + -10.0) / k) + 1.0) / (k * k)) * a;
} else {
tmp = fma(((99.0 * k) - 10.0), k, 1.0) * a;
}
return tmp;
}
function code(a, k, m) t_0 = Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(a / Float64(Float64(Float64(Float64(fma(10.0, k, 1.0) / Float64(k * k)) + 1.0) * k) * k)); elseif (t_0 <= 5e+307) tmp = Float64(a / fma(Float64(10.0 + k), k, 1.0)); elseif (t_0 <= Inf) tmp = Float64(Float64(Float64(Float64(Float64(Float64(99.0 / k) + -10.0) / k) + 1.0) / Float64(k * k)) * a); else tmp = Float64(fma(Float64(Float64(99.0 * k) - 10.0), k, 1.0) * a); end return tmp end
code[a_, k_, m_] := Block[{t$95$0 = 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]}, If[LessEqual[t$95$0, 0.0], N[(a / N[(N[(N[(N[(N[(10.0 * k + 1.0), $MachinePrecision] / N[(k * k), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * k), $MachinePrecision] * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+307], N[(a / N[(N[(10.0 + k), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[(N[(N[(N[(N[(99.0 / k), $MachinePrecision] + -10.0), $MachinePrecision] / k), $MachinePrecision] + 1.0), $MachinePrecision] / N[(k * k), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], N[(N[(N[(N[(99.0 * k), $MachinePrecision] - 10.0), $MachinePrecision] * k + 1.0), $MachinePrecision] * a), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;\frac{a}{\left(\left(\frac{\mathsf{fma}\left(10, k, 1\right)}{k \cdot k} + 1\right) \cdot k\right) \cdot k}\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+307}:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{\frac{\frac{99}{k} + -10}{k} + 1}{k \cdot k} \cdot a\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(99 \cdot k - 10, k, 1\right) \cdot a\\
\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 94.9%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6447.3
Applied rewrites47.3%
Taylor expanded in k around inf
Applied rewrites53.8%
Applied rewrites53.8%
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))) < 5e307Initial program 99.9%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64100.0
Applied rewrites100.0%
if 5e307 < (/.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 100.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64100.0
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in m around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f643.0
Applied rewrites3.0%
Taylor expanded in k around inf
Applied rewrites43.6%
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 0.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f640.0
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6410.0
Applied rewrites10.0%
Taylor expanded in m around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6411.4
Applied rewrites11.4%
Taylor expanded in k around 0
Applied rewrites90.2%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k)))))
(if (<= t_0 0.0)
(/ a (* (* (+ (/ (fma 10.0 k 1.0) (* k k)) 1.0) k) k))
(if (<= t_0 5e+307)
(/ a (fma (+ 10.0 k) k 1.0))
(if (<= t_0 INFINITY)
(/ (- a (/ (* (/ a k) -99.0) k)) (* k k))
(* (fma (- (* 99.0 k) 10.0) k 1.0) a))))))
double code(double a, double k, double m) {
double t_0 = (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
double tmp;
if (t_0 <= 0.0) {
tmp = a / ((((fma(10.0, k, 1.0) / (k * k)) + 1.0) * k) * k);
} else if (t_0 <= 5e+307) {
tmp = a / fma((10.0 + k), k, 1.0);
} else if (t_0 <= ((double) INFINITY)) {
tmp = (a - (((a / k) * -99.0) / k)) / (k * k);
} else {
tmp = fma(((99.0 * k) - 10.0), k, 1.0) * a;
}
return tmp;
}
function code(a, k, m) t_0 = Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(a / Float64(Float64(Float64(Float64(fma(10.0, k, 1.0) / Float64(k * k)) + 1.0) * k) * k)); elseif (t_0 <= 5e+307) tmp = Float64(a / fma(Float64(10.0 + k), k, 1.0)); elseif (t_0 <= Inf) tmp = Float64(Float64(a - Float64(Float64(Float64(a / k) * -99.0) / k)) / Float64(k * k)); else tmp = Float64(fma(Float64(Float64(99.0 * k) - 10.0), k, 1.0) * a); end return tmp end
code[a_, k_, m_] := Block[{t$95$0 = 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]}, If[LessEqual[t$95$0, 0.0], N[(a / N[(N[(N[(N[(N[(10.0 * k + 1.0), $MachinePrecision] / N[(k * k), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * k), $MachinePrecision] * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+307], N[(a / N[(N[(10.0 + k), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[(a - N[(N[(N[(a / k), $MachinePrecision] * -99.0), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision] / N[(k * k), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(99.0 * k), $MachinePrecision] - 10.0), $MachinePrecision] * k + 1.0), $MachinePrecision] * a), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;\frac{a}{\left(\left(\frac{\mathsf{fma}\left(10, k, 1\right)}{k \cdot k} + 1\right) \cdot k\right) \cdot k}\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+307}:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{a - \frac{\frac{a}{k} \cdot -99}{k}}{k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(99 \cdot k - 10, k, 1\right) \cdot a\\
\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 94.9%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6447.3
Applied rewrites47.3%
Taylor expanded in k around inf
Applied rewrites53.8%
Applied rewrites53.8%
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))) < 5e307Initial program 99.9%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64100.0
Applied rewrites100.0%
if 5e307 < (/.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 100.0%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f643.0
Applied rewrites3.0%
Taylor expanded in k around inf
Applied rewrites39.7%
Taylor expanded in k around 0
Applied rewrites39.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 0.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f640.0
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6410.0
Applied rewrites10.0%
Taylor expanded in m around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6411.4
Applied rewrites11.4%
Taylor expanded in k around 0
Applied rewrites90.2%
(FPCore (a k m) :precision binary64 (if (<= (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))) 2e+212) (* (/ (pow k m) (fma (+ k 10.0) k 1.0)) a) (* (pow k m) a)))
double code(double a, double k, double m) {
double tmp;
if (((a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))) <= 2e+212) {
tmp = (pow(k, m) / fma((k + 10.0), k, 1.0)) * a;
} else {
tmp = pow(k, m) * a;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) <= 2e+212) tmp = Float64(Float64((k ^ m) / fma(Float64(k + 10.0), k, 1.0)) * a); else tmp = Float64((k ^ m) * a); end return tmp end
code[a_, k_, m_] := If[LessEqual[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], 2e+212], N[(N[(N[Power[k, m], $MachinePrecision] / N[(N[(k + 10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \leq 2 \cdot 10^{+212}:\\
\;\;\;\;\frac{{k}^{m}}{\mathsf{fma}\left(k + 10, k, 1\right)} \cdot a\\
\mathbf{else}:\\
\;\;\;\;{k}^{m} \cdot a\\
\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.9999999999999998e212Initial program 95.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6495.6
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6495.7
Applied rewrites95.7%
if 1.9999999999999998e212 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) Initial program 56.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6456.5
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6460.9
Applied rewrites60.9%
Taylor expanded in k around 0
lower-pow.f64100.0
Applied rewrites100.0%
(FPCore (a k m) :precision binary64 (if (<= m -1.22e-5) (/ (* a (pow k m)) (* k k)) (if (<= m 5.5e-5) (/ a (fma (+ 10.0 k) k 1.0)) (* (pow k m) a))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.22e-5) {
tmp = (a * pow(k, m)) / (k * k);
} else if (m <= 5.5e-5) {
tmp = a / fma((10.0 + k), k, 1.0);
} else {
tmp = pow(k, m) * a;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= -1.22e-5) tmp = Float64(Float64(a * (k ^ m)) / Float64(k * k)); elseif (m <= 5.5e-5) tmp = Float64(a / fma(Float64(10.0 + k), k, 1.0)); else tmp = Float64((k ^ m) * a); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, -1.22e-5], N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 5.5e-5], N[(a / N[(N[(10.0 + k), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.22 \cdot 10^{-5}:\\
\;\;\;\;\frac{a \cdot {k}^{m}}{k \cdot k}\\
\mathbf{elif}\;m \leq 5.5 \cdot 10^{-5}:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;{k}^{m} \cdot a\\
\end{array}
\end{array}
if m < -1.22000000000000001e-5Initial program 97.2%
Taylor expanded in k around inf
unpow2N/A
lower-*.f6499.2
Applied rewrites99.2%
if -1.22000000000000001e-5 < m < 5.5000000000000002e-5Initial program 91.5%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6490.7
Applied rewrites90.7%
if 5.5000000000000002e-5 < m Initial program 77.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6477.2
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6477.2
Applied rewrites77.2%
Taylor expanded in k around 0
lower-pow.f64100.0
Applied rewrites100.0%
Final simplification95.9%
(FPCore (a k m) :precision binary64 (if (or (<= m -5.8e-13) (not (<= m 5.5e-5))) (* (pow k m) a) (/ a (fma (+ 10.0 k) k 1.0))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -5.8e-13) || !(m <= 5.5e-5)) {
tmp = pow(k, m) * a;
} else {
tmp = a / fma((10.0 + k), k, 1.0);
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if ((m <= -5.8e-13) || !(m <= 5.5e-5)) tmp = Float64((k ^ m) * a); else tmp = Float64(a / fma(Float64(10.0 + k), k, 1.0)); end return tmp end
code[a_, k_, m_] := If[Or[LessEqual[m, -5.8e-13], N[Not[LessEqual[m, 5.5e-5]], $MachinePrecision]], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision], N[(a / N[(N[(10.0 + k), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -5.8 \cdot 10^{-13} \lor \neg \left(m \leq 5.5 \cdot 10^{-5}\right):\\
\;\;\;\;{k}^{m} \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}\\
\end{array}
\end{array}
if m < -5.7999999999999995e-13 or 5.5000000000000002e-5 < m Initial program 86.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6486.8
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6488.2
Applied rewrites88.2%
Taylor expanded in k around 0
lower-pow.f6498.8
Applied rewrites98.8%
if -5.7999999999999995e-13 < m < 5.5000000000000002e-5Initial program 91.4%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6491.4
Applied rewrites91.4%
Final simplification95.8%
(FPCore (a k m)
:precision binary64
(if (<= m -3.4e+16)
(/ (- a (/ (* (/ a k) -99.0) k)) (* k k))
(if (<= m 1.85)
(/ a (fma (+ 10.0 k) k 1.0))
(* (fma (- (* 99.0 k) 10.0) k 1.0) a))))
double code(double a, double k, double m) {
double tmp;
if (m <= -3.4e+16) {
tmp = (a - (((a / k) * -99.0) / k)) / (k * k);
} else if (m <= 1.85) {
tmp = a / fma((10.0 + k), k, 1.0);
} else {
tmp = fma(((99.0 * k) - 10.0), k, 1.0) * a;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= -3.4e+16) tmp = Float64(Float64(a - Float64(Float64(Float64(a / k) * -99.0) / k)) / Float64(k * k)); elseif (m <= 1.85) tmp = Float64(a / fma(Float64(10.0 + k), k, 1.0)); else tmp = Float64(fma(Float64(Float64(99.0 * k) - 10.0), k, 1.0) * a); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, -3.4e+16], N[(N[(a - N[(N[(N[(a / k), $MachinePrecision] * -99.0), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision] / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.85], N[(a / N[(N[(10.0 + k), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(99.0 * k), $MachinePrecision] - 10.0), $MachinePrecision] * k + 1.0), $MachinePrecision] * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -3.4 \cdot 10^{+16}:\\
\;\;\;\;\frac{a - \frac{\frac{a}{k} \cdot -99}{k}}{k \cdot k}\\
\mathbf{elif}\;m \leq 1.85:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(99 \cdot k - 10, k, 1\right) \cdot a\\
\end{array}
\end{array}
if m < -3.4e16Initial program 97.1%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6433.2
Applied rewrites33.2%
Taylor expanded in k around inf
Applied rewrites64.7%
Taylor expanded in k around 0
Applied rewrites64.7%
if -3.4e16 < m < 1.8500000000000001Initial program 91.7%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6489.4
Applied rewrites89.4%
if 1.8500000000000001 < m Initial program 77.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6477.2
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6477.2
Applied rewrites77.2%
Taylor expanded in m around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f642.8
Applied rewrites2.8%
Taylor expanded in k around 0
Applied rewrites29.5%
(FPCore (a k m)
:precision binary64
(if (<= m -3.4e+16)
(/ a (* k k))
(if (<= m 1.85)
(/ a (fma (+ 10.0 k) k 1.0))
(* (fma (- (* 99.0 k) 10.0) k 1.0) a))))
double code(double a, double k, double m) {
double tmp;
if (m <= -3.4e+16) {
tmp = a / (k * k);
} else if (m <= 1.85) {
tmp = a / fma((10.0 + k), k, 1.0);
} else {
tmp = fma(((99.0 * k) - 10.0), k, 1.0) * a;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= -3.4e+16) tmp = Float64(a / Float64(k * k)); elseif (m <= 1.85) tmp = Float64(a / fma(Float64(10.0 + k), k, 1.0)); else tmp = Float64(fma(Float64(Float64(99.0 * k) - 10.0), k, 1.0) * a); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, -3.4e+16], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.85], N[(a / N[(N[(10.0 + k), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(99.0 * k), $MachinePrecision] - 10.0), $MachinePrecision] * k + 1.0), $MachinePrecision] * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -3.4 \cdot 10^{+16}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 1.85:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(99 \cdot k - 10, k, 1\right) \cdot a\\
\end{array}
\end{array}
if m < -3.4e16Initial program 97.1%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6433.2
Applied rewrites33.2%
Taylor expanded in k around inf
Applied rewrites60.2%
if -3.4e16 < m < 1.8500000000000001Initial program 91.7%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6489.4
Applied rewrites89.4%
if 1.8500000000000001 < m Initial program 77.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6477.2
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6477.2
Applied rewrites77.2%
Taylor expanded in m around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f642.8
Applied rewrites2.8%
Taylor expanded in k around 0
Applied rewrites29.5%
(FPCore (a k m) :precision binary64 (if (or (<= k 5.5e-248) (not (<= k 0.33))) (/ a (* k k)) (* (fma (- (* 99.0 k) 10.0) k 1.0) a)))
double code(double a, double k, double m) {
double tmp;
if ((k <= 5.5e-248) || !(k <= 0.33)) {
tmp = a / (k * k);
} else {
tmp = fma(((99.0 * k) - 10.0), k, 1.0) * a;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if ((k <= 5.5e-248) || !(k <= 0.33)) tmp = Float64(a / Float64(k * k)); else tmp = Float64(fma(Float64(Float64(99.0 * k) - 10.0), k, 1.0) * a); end return tmp end
code[a_, k_, m_] := If[Or[LessEqual[k, 5.5e-248], N[Not[LessEqual[k, 0.33]], $MachinePrecision]], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(99.0 * k), $MachinePrecision] - 10.0), $MachinePrecision] * k + 1.0), $MachinePrecision] * a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 5.5 \cdot 10^{-248} \lor \neg \left(k \leq 0.33\right):\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(99 \cdot k - 10, k, 1\right) \cdot a\\
\end{array}
\end{array}
if k < 5.49999999999999979e-248 or 0.330000000000000016 < k Initial program 84.5%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6444.9
Applied rewrites44.9%
Taylor expanded in k around inf
Applied rewrites47.4%
if 5.49999999999999979e-248 < k < 0.330000000000000016Initial program 100.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64100.0
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in m around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6455.5
Applied rewrites55.5%
Taylor expanded in k around 0
Applied rewrites53.8%
Final simplification49.1%
(FPCore (a k m) :precision binary64 (if (or (<= k 5.5e-248) (not (<= k 10.2))) (/ a (* k k)) (/ a (fma 10.0 k 1.0))))
double code(double a, double k, double m) {
double tmp;
if ((k <= 5.5e-248) || !(k <= 10.2)) {
tmp = a / (k * k);
} else {
tmp = a / fma(10.0, k, 1.0);
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if ((k <= 5.5e-248) || !(k <= 10.2)) tmp = Float64(a / Float64(k * k)); else tmp = Float64(a / fma(10.0, k, 1.0)); end return tmp end
code[a_, k_, m_] := If[Or[LessEqual[k, 5.5e-248], N[Not[LessEqual[k, 10.2]], $MachinePrecision]], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], N[(a / N[(10.0 * k + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 5.5 \cdot 10^{-248} \lor \neg \left(k \leq 10.2\right):\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(10, k, 1\right)}\\
\end{array}
\end{array}
if k < 5.49999999999999979e-248 or 10.199999999999999 < k Initial program 84.4%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6444.6
Applied rewrites44.6%
Taylor expanded in k around inf
Applied rewrites47.6%
if 5.49999999999999979e-248 < k < 10.199999999999999Initial program 100.0%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6456.1
Applied rewrites56.1%
Taylor expanded in k around 0
Applied rewrites53.3%
Final simplification49.1%
(FPCore (a k m) :precision binary64 (if (or (<= k 5.5e-248) (not (<= k 0.1))) (/ a (* k k)) (fma (* -10.0 k) a a)))
double code(double a, double k, double m) {
double tmp;
if ((k <= 5.5e-248) || !(k <= 0.1)) {
tmp = a / (k * k);
} else {
tmp = fma((-10.0 * k), a, a);
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if ((k <= 5.5e-248) || !(k <= 0.1)) tmp = Float64(a / Float64(k * k)); else tmp = fma(Float64(-10.0 * k), a, a); end return tmp end
code[a_, k_, m_] := If[Or[LessEqual[k, 5.5e-248], N[Not[LessEqual[k, 0.1]], $MachinePrecision]], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], N[(N[(-10.0 * k), $MachinePrecision] * a + a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 5.5 \cdot 10^{-248} \lor \neg \left(k \leq 0.1\right):\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-10 \cdot k, a, a\right)\\
\end{array}
\end{array}
if k < 5.49999999999999979e-248 or 0.10000000000000001 < k Initial program 84.5%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6444.9
Applied rewrites44.9%
Taylor expanded in k around inf
Applied rewrites47.4%
if 5.49999999999999979e-248 < k < 0.10000000000000001Initial program 100.0%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6455.5
Applied rewrites55.5%
Taylor expanded in k around 0
Applied rewrites53.2%
Applied rewrites53.2%
Final simplification49.0%
(FPCore (a k m) :precision binary64 (if (<= m 2200.0) (/ a 1.0) (* (* -10.0 a) k)))
double code(double a, double k, double m) {
double tmp;
if (m <= 2200.0) {
tmp = a / 1.0;
} else {
tmp = (-10.0 * a) * 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 (m <= 2200.0d0) then
tmp = a / 1.0d0
else
tmp = ((-10.0d0) * a) * k
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 2200.0) {
tmp = a / 1.0;
} else {
tmp = (-10.0 * a) * k;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2200.0: tmp = a / 1.0 else: tmp = (-10.0 * a) * k return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2200.0) tmp = Float64(a / 1.0); else tmp = Float64(Float64(-10.0 * a) * k); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2200.0) tmp = a / 1.0; else tmp = (-10.0 * a) * k; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2200.0], N[(a / 1.0), $MachinePrecision], N[(N[(-10.0 * a), $MachinePrecision] * k), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2200:\\
\;\;\;\;\frac{a}{1}\\
\mathbf{else}:\\
\;\;\;\;\left(-10 \cdot a\right) \cdot k\\
\end{array}
\end{array}
if m < 2200Initial program 93.3%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6467.1
Applied rewrites67.1%
Taylor expanded in k around 0
Applied rewrites25.1%
if 2200 < m Initial program 77.9%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f642.8
Applied rewrites2.8%
Taylor expanded in k around 0
Applied rewrites6.6%
Taylor expanded in k around inf
Applied rewrites18.1%
(FPCore (a k m) :precision binary64 (if (<= m 5.2e-29) (fma (* k a) -10.0 a) (* (* -10.0 k) a)))
double code(double a, double k, double m) {
double tmp;
if (m <= 5.2e-29) {
tmp = fma((k * a), -10.0, a);
} else {
tmp = (-10.0 * k) * a;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= 5.2e-29) tmp = fma(Float64(k * a), -10.0, a); else tmp = Float64(Float64(-10.0 * k) * a); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, 5.2e-29], N[(N[(k * a), $MachinePrecision] * -10.0 + a), $MachinePrecision], N[(N[(-10.0 * k), $MachinePrecision] * a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 5.2 \cdot 10^{-29}:\\
\;\;\;\;\mathsf{fma}\left(k \cdot a, -10, a\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-10 \cdot k\right) \cdot a\\
\end{array}
\end{array}
if m < 5.2000000000000004e-29Initial program 93.6%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6466.7
Applied rewrites66.7%
Taylor expanded in k around 0
Applied rewrites25.0%
if 5.2000000000000004e-29 < m Initial program 78.8%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f649.6
Applied rewrites9.6%
Taylor expanded in k around 0
Applied rewrites6.2%
Taylor expanded in k around inf
Applied rewrites16.6%
Applied rewrites16.6%
(FPCore (a k m) :precision binary64 (if (<= m 3.35e-51) (fma (* -10.0 k) a a) (* (* -10.0 k) a)))
double code(double a, double k, double m) {
double tmp;
if (m <= 3.35e-51) {
tmp = fma((-10.0 * k), a, a);
} else {
tmp = (-10.0 * k) * a;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= 3.35e-51) tmp = fma(Float64(-10.0 * k), a, a); else tmp = Float64(Float64(-10.0 * k) * a); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, 3.35e-51], N[(N[(-10.0 * k), $MachinePrecision] * a + a), $MachinePrecision], N[(N[(-10.0 * k), $MachinePrecision] * a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 3.35 \cdot 10^{-51}:\\
\;\;\;\;\mathsf{fma}\left(-10 \cdot k, a, a\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-10 \cdot k\right) \cdot a\\
\end{array}
\end{array}
if m < 3.34999999999999988e-51Initial program 93.5%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6466.3
Applied rewrites66.3%
Taylor expanded in k around 0
Applied rewrites25.2%
Applied rewrites25.2%
if 3.34999999999999988e-51 < m Initial program 79.3%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6411.7
Applied rewrites11.7%
Taylor expanded in k around 0
Applied rewrites6.1%
Taylor expanded in k around inf
Applied rewrites16.2%
Applied rewrites16.2%
(FPCore (a k m) :precision binary64 (* (* -10.0 a) k))
double code(double a, double k, double m) {
return (-10.0 * a) * 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 = ((-10.0d0) * a) * k
end function
public static double code(double a, double k, double m) {
return (-10.0 * a) * k;
}
def code(a, k, m): return (-10.0 * a) * k
function code(a, k, m) return Float64(Float64(-10.0 * a) * k) end
function tmp = code(a, k, m) tmp = (-10.0 * a) * k; end
code[a_, k_, m_] := N[(N[(-10.0 * a), $MachinePrecision] * k), $MachinePrecision]
\begin{array}{l}
\\
\left(-10 \cdot a\right) \cdot k
\end{array}
Initial program 88.7%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6447.7
Applied rewrites47.7%
Taylor expanded in k around 0
Applied rewrites18.7%
Taylor expanded in k around inf
Applied rewrites7.0%
herbie shell --seed 2024363
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))