
(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 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]
\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 (* (pow k m) a)))
(if (<= m -1.6e-39)
(/ t_0 (fma k (+ 10.0 k) 1.0))
(if (<= m 1.95e-14)
(/ (/ a (fma k (/ k (fma 10.0 k 1.0)) 1.0)) (fma 10.0 k 1.0))
t_0))))
double code(double a, double k, double m) {
double t_0 = pow(k, m) * a;
double tmp;
if (m <= -1.6e-39) {
tmp = t_0 / fma(k, (10.0 + k), 1.0);
} else if (m <= 1.95e-14) {
tmp = (a / fma(k, (k / fma(10.0, k, 1.0)), 1.0)) / fma(10.0, k, 1.0);
} else {
tmp = t_0;
}
return tmp;
}
function code(a, k, m) t_0 = Float64((k ^ m) * a) tmp = 0.0 if (m <= -1.6e-39) tmp = Float64(t_0 / fma(k, Float64(10.0 + k), 1.0)); elseif (m <= 1.95e-14) tmp = Float64(Float64(a / fma(k, Float64(k / fma(10.0, k, 1.0)), 1.0)) / fma(10.0, k, 1.0)); else tmp = t_0; end return tmp end
code[a_, k_, m_] := Block[{t$95$0 = N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[m, -1.6e-39], N[(t$95$0 / N[(k * N[(10.0 + k), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.95e-14], N[(N[(a / N[(k * N[(k / N[(10.0 * k + 1.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(10.0 * k + 1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {k}^{m} \cdot a\\
\mathbf{if}\;m \leq -1.6 \cdot 10^{-39}:\\
\;\;\;\;\frac{t\_0}{\mathsf{fma}\left(k, 10 + k, 1\right)}\\
\mathbf{elif}\;m \leq 1.95 \cdot 10^{-14}:\\
\;\;\;\;\frac{\frac{a}{\mathsf{fma}\left(k, \frac{k}{\mathsf{fma}\left(10, k, 1\right)}, 1\right)}}{\mathsf{fma}\left(10, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if m < -1.5999999999999999e-39Initial program 90.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.2
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
lower-fma.f64N/A
lower-+.f6490.3
Applied rewrites90.3%
if -1.5999999999999999e-39 < m < 1.9499999999999999e-14Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.5
Applied rewrites45.5%
lift-+.f64N/A
lift-fma.f64N/A
associate-+l+N/A
+-commutativeN/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
lower-fma.f64N/A
lift-pow.f64N/A
pow2N/A
lower-fma.f6445.5
Applied rewrites45.5%
lift-/.f64N/A
mult-flipN/A
lift-fma.f64N/A
lift-fma.f64N/A
associate-+r+N/A
*-commutativeN/A
pow2N/A
+-commutativeN/A
mult-flipN/A
pow2N/A
associate-+l+N/A
sum-to-multN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites45.7%
if 1.9499999999999999e-14 < m Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.5
Applied rewrites45.5%
lift-fma.f64N/A
lift-pow.f64N/A
pow2N/A
distribute-rgt-inN/A
lift-+.f64N/A
*-commutativeN/A
lift-+.f64N/A
flip-+N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
pow2N/A
lift-pow.f64N/A
lower--.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow2N/A
lower-*.f64N/A
lower--.f6445.8
Applied rewrites45.8%
Taylor expanded in k around 0
lower-*.f64N/A
lower-pow.f6482.4
Applied rewrites82.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6482.4
Applied rewrites82.4%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (* (pow k m) a)))
(if (<= m -3.2e+17)
t_0
(if (<= m 1.95e-14)
(/ (/ a (fma k (/ k (fma 10.0 k 1.0)) 1.0)) (fma 10.0 k 1.0))
t_0))))
double code(double a, double k, double m) {
double t_0 = pow(k, m) * a;
double tmp;
if (m <= -3.2e+17) {
tmp = t_0;
} else if (m <= 1.95e-14) {
tmp = (a / fma(k, (k / fma(10.0, k, 1.0)), 1.0)) / fma(10.0, k, 1.0);
} else {
tmp = t_0;
}
return tmp;
}
function code(a, k, m) t_0 = Float64((k ^ m) * a) tmp = 0.0 if (m <= -3.2e+17) tmp = t_0; elseif (m <= 1.95e-14) tmp = Float64(Float64(a / fma(k, Float64(k / fma(10.0, k, 1.0)), 1.0)) / fma(10.0, k, 1.0)); else tmp = t_0; end return tmp end
code[a_, k_, m_] := Block[{t$95$0 = N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[m, -3.2e+17], t$95$0, If[LessEqual[m, 1.95e-14], N[(N[(a / N[(k * N[(k / N[(10.0 * k + 1.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(10.0 * k + 1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {k}^{m} \cdot a\\
\mathbf{if}\;m \leq -3.2 \cdot 10^{+17}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;m \leq 1.95 \cdot 10^{-14}:\\
\;\;\;\;\frac{\frac{a}{\mathsf{fma}\left(k, \frac{k}{\mathsf{fma}\left(10, k, 1\right)}, 1\right)}}{\mathsf{fma}\left(10, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if m < -3.2e17 or 1.9499999999999999e-14 < m Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.5
Applied rewrites45.5%
lift-fma.f64N/A
lift-pow.f64N/A
pow2N/A
distribute-rgt-inN/A
lift-+.f64N/A
*-commutativeN/A
lift-+.f64N/A
flip-+N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
pow2N/A
lift-pow.f64N/A
lower--.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow2N/A
lower-*.f64N/A
lower--.f6445.8
Applied rewrites45.8%
Taylor expanded in k around 0
lower-*.f64N/A
lower-pow.f6482.4
Applied rewrites82.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6482.4
Applied rewrites82.4%
if -3.2e17 < m < 1.9499999999999999e-14Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.5
Applied rewrites45.5%
lift-+.f64N/A
lift-fma.f64N/A
associate-+l+N/A
+-commutativeN/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
lower-fma.f64N/A
lift-pow.f64N/A
pow2N/A
lower-fma.f6445.5
Applied rewrites45.5%
lift-/.f64N/A
mult-flipN/A
lift-fma.f64N/A
lift-fma.f64N/A
associate-+r+N/A
*-commutativeN/A
pow2N/A
+-commutativeN/A
mult-flipN/A
pow2N/A
associate-+l+N/A
sum-to-multN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites45.7%
(FPCore (a k m) :precision binary64 (if (<= m 1.95e-14) (* (/ a (fma k (/ k (fma 10.0 k 1.0)) 1.0)) (/ (pow k m) (fma 10.0 k 1.0))) (* (pow k m) a)))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.95e-14) {
tmp = (a / fma(k, (k / fma(10.0, k, 1.0)), 1.0)) * (pow(k, m) / fma(10.0, k, 1.0));
} else {
tmp = pow(k, m) * a;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= 1.95e-14) tmp = Float64(Float64(a / fma(k, Float64(k / fma(10.0, k, 1.0)), 1.0)) * Float64((k ^ m) / fma(10.0, k, 1.0))); else tmp = Float64((k ^ m) * a); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, 1.95e-14], N[(N[(a / N[(k * N[(k / N[(10.0 * k + 1.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * N[(N[Power[k, m], $MachinePrecision] / N[(10.0 * k + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.95 \cdot 10^{-14}:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(k, \frac{k}{\mathsf{fma}\left(10, k, 1\right)}, 1\right)} \cdot \frac{{k}^{m}}{\mathsf{fma}\left(10, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;{k}^{m} \cdot a\\
\end{array}
\end{array}
if m < 1.9499999999999999e-14Initial program 90.2%
lift-/.f64N/A
lift-*.f64N/A
lift-+.f64N/A
sum-to-multN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lift-*.f64N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lower-/.f6496.3
lift-+.f64N/A
Applied rewrites96.3%
if 1.9499999999999999e-14 < m Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.5
Applied rewrites45.5%
lift-fma.f64N/A
lift-pow.f64N/A
pow2N/A
distribute-rgt-inN/A
lift-+.f64N/A
*-commutativeN/A
lift-+.f64N/A
flip-+N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
pow2N/A
lift-pow.f64N/A
lower--.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow2N/A
lower-*.f64N/A
lower--.f6445.8
Applied rewrites45.8%
Taylor expanded in k around 0
lower-*.f64N/A
lower-pow.f6482.4
Applied rewrites82.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6482.4
Applied rewrites82.4%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (* (pow k m) a)))
(if (<= m -3.2e+17)
t_0
(if (<= m 1.95e-14)
(/ (/ a (- (/ k (- 10.0 (/ -1.0 k))) -1.0)) (fma 10.0 k 1.0))
t_0))))
double code(double a, double k, double m) {
double t_0 = pow(k, m) * a;
double tmp;
if (m <= -3.2e+17) {
tmp = t_0;
} else if (m <= 1.95e-14) {
tmp = (a / ((k / (10.0 - (-1.0 / k))) - -1.0)) / fma(10.0, k, 1.0);
} else {
tmp = t_0;
}
return tmp;
}
function code(a, k, m) t_0 = Float64((k ^ m) * a) tmp = 0.0 if (m <= -3.2e+17) tmp = t_0; elseif (m <= 1.95e-14) tmp = Float64(Float64(a / Float64(Float64(k / Float64(10.0 - Float64(-1.0 / k))) - -1.0)) / fma(10.0, k, 1.0)); else tmp = t_0; end return tmp end
code[a_, k_, m_] := Block[{t$95$0 = N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[m, -3.2e+17], t$95$0, If[LessEqual[m, 1.95e-14], N[(N[(a / N[(N[(k / N[(10.0 - N[(-1.0 / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] / N[(10.0 * k + 1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {k}^{m} \cdot a\\
\mathbf{if}\;m \leq -3.2 \cdot 10^{+17}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;m \leq 1.95 \cdot 10^{-14}:\\
\;\;\;\;\frac{\frac{a}{\frac{k}{10 - \frac{-1}{k}} - -1}}{\mathsf{fma}\left(10, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if m < -3.2e17 or 1.9499999999999999e-14 < m Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.5
Applied rewrites45.5%
lift-fma.f64N/A
lift-pow.f64N/A
pow2N/A
distribute-rgt-inN/A
lift-+.f64N/A
*-commutativeN/A
lift-+.f64N/A
flip-+N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
pow2N/A
lift-pow.f64N/A
lower--.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow2N/A
lower-*.f64N/A
lower--.f6445.8
Applied rewrites45.8%
Taylor expanded in k around 0
lower-*.f64N/A
lower-pow.f6482.4
Applied rewrites82.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6482.4
Applied rewrites82.4%
if -3.2e17 < m < 1.9499999999999999e-14Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.5
Applied rewrites45.5%
lift-/.f64N/A
lift-+.f64N/A
lift-fma.f64N/A
associate-+l+N/A
sum-to-multN/A
lift-pow.f64N/A
pow2N/A
+-commutativeN/A
lift-fma.f64N/A
associate-*r/N/A
lift-/.f64N/A
+-commutativeN/A
lift-fma.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f64N/A
Applied rewrites45.7%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (* (pow k m) a)))
(if (<= m -3.2e+17)
t_0
(if (<= m 1.95e-14) (* (/ (/ 1.0 (+ k (- 10.0 (/ -1.0 k)))) k) a) t_0))))
double code(double a, double k, double m) {
double t_0 = pow(k, m) * a;
double tmp;
if (m <= -3.2e+17) {
tmp = t_0;
} else if (m <= 1.95e-14) {
tmp = ((1.0 / (k + (10.0 - (-1.0 / k)))) / k) * a;
} else {
tmp = t_0;
}
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 = (k ** m) * a
if (m <= (-3.2d+17)) then
tmp = t_0
else if (m <= 1.95d-14) then
tmp = ((1.0d0 / (k + (10.0d0 - ((-1.0d0) / k)))) / k) * a
else
tmp = t_0
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = Math.pow(k, m) * a;
double tmp;
if (m <= -3.2e+17) {
tmp = t_0;
} else if (m <= 1.95e-14) {
tmp = ((1.0 / (k + (10.0 - (-1.0 / k)))) / k) * a;
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = math.pow(k, m) * a tmp = 0 if m <= -3.2e+17: tmp = t_0 elif m <= 1.95e-14: tmp = ((1.0 / (k + (10.0 - (-1.0 / k)))) / k) * a else: tmp = t_0 return tmp
function code(a, k, m) t_0 = Float64((k ^ m) * a) tmp = 0.0 if (m <= -3.2e+17) tmp = t_0; elseif (m <= 1.95e-14) tmp = Float64(Float64(Float64(1.0 / Float64(k + Float64(10.0 - Float64(-1.0 / k)))) / k) * a); else tmp = t_0; end return tmp end
function tmp_2 = code(a, k, m) t_0 = (k ^ m) * a; tmp = 0.0; if (m <= -3.2e+17) tmp = t_0; elseif (m <= 1.95e-14) tmp = ((1.0 / (k + (10.0 - (-1.0 / k)))) / k) * a; else tmp = t_0; end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[m, -3.2e+17], t$95$0, If[LessEqual[m, 1.95e-14], N[(N[(N[(1.0 / N[(k + N[(10.0 - N[(-1.0 / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision] * a), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {k}^{m} \cdot a\\
\mathbf{if}\;m \leq -3.2 \cdot 10^{+17}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;m \leq 1.95 \cdot 10^{-14}:\\
\;\;\;\;\frac{\frac{1}{k + \left(10 - \frac{-1}{k}\right)}}{k} \cdot a\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if m < -3.2e17 or 1.9499999999999999e-14 < m Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.5
Applied rewrites45.5%
lift-fma.f64N/A
lift-pow.f64N/A
pow2N/A
distribute-rgt-inN/A
lift-+.f64N/A
*-commutativeN/A
lift-+.f64N/A
flip-+N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
pow2N/A
lift-pow.f64N/A
lower--.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow2N/A
lower-*.f64N/A
lower--.f6445.8
Applied rewrites45.8%
Taylor expanded in k around 0
lower-*.f64N/A
lower-pow.f6482.4
Applied rewrites82.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6482.4
Applied rewrites82.4%
if -3.2e17 < m < 1.9499999999999999e-14Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.5
Applied rewrites45.5%
lift-/.f64N/A
div-flipN/A
lift-+.f64N/A
lift-fma.f64N/A
lift-pow.f64N/A
pow2N/A
distribute-rgt-inN/A
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f6445.5
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6445.5
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
metadata-eval45.5
Applied rewrites45.5%
Applied rewrites45.5%
(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 (+ k (- 10.0 (/ -1.0 k)))) k)
(if (<= t_0 4e+236)
(/ a (fma (- k -10.0) k 1.0))
(if (<= t_0 INFINITY)
(* (/ 1.0 (* k k)) a)
(* (+ 1.0 (* k (- (* 99.0 k) 10.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 / (k + (10.0 - (-1.0 / k)))) / k;
} else if (t_0 <= 4e+236) {
tmp = a / fma((k - -10.0), k, 1.0);
} else if (t_0 <= ((double) INFINITY)) {
tmp = (1.0 / (k * k)) * a;
} else {
tmp = (1.0 + (k * ((99.0 * k) - 10.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(Float64(a / Float64(k + Float64(10.0 - Float64(-1.0 / k)))) / k); elseif (t_0 <= 4e+236) tmp = Float64(a / fma(Float64(k - -10.0), k, 1.0)); elseif (t_0 <= Inf) tmp = Float64(Float64(1.0 / Float64(k * k)) * a); else tmp = Float64(Float64(1.0 + Float64(k * Float64(Float64(99.0 * k) - 10.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[(N[(a / N[(k + N[(10.0 - N[(-1.0 / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision], If[LessEqual[t$95$0, 4e+236], N[(a / N[(N[(k - -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[(1.0 / N[(k * k), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], N[(N[(1.0 + N[(k * N[(N[(99.0 * k), $MachinePrecision] - 10.0), $MachinePrecision]), $MachinePrecision]), $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{\frac{a}{k + \left(10 - \frac{-1}{k}\right)}}{k}\\
\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+236}:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(k - -10, k, 1\right)}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{1}{k \cdot k} \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(1 + k \cdot \left(99 \cdot k - 10\right)\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 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.5
Applied rewrites45.5%
lift-fma.f64N/A
lift-pow.f64N/A
pow2N/A
distribute-rgt-inN/A
lift-+.f64N/A
*-commutativeN/A
lift-+.f64N/A
flip-+N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
pow2N/A
lift-pow.f64N/A
lower--.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow2N/A
lower-*.f64N/A
lower--.f6445.8
Applied rewrites45.8%
Applied rewrites44.9%
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))) < 4.00000000000000021e236Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.5
Applied rewrites45.5%
lift-+.f64N/A
lift-fma.f64N/A
lift-pow.f64N/A
pow2N/A
distribute-rgt-inN/A
lift-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6445.5
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
metadata-eval45.5
Applied rewrites45.5%
if 4.00000000000000021e236 < (/.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.2%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.5
Applied rewrites45.5%
Taylor expanded in k around inf
lower-/.f64N/A
lower-pow.f6435.8
Applied rewrites35.8%
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
div-flipN/A
associate-/r/N/A
metadata-evalN/A
lift-*.f64N/A
frac-timesN/A
lift-/.f64N/A
lift-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
metadata-evalN/A
lift-*.f64N/A
lower-/.f6435.9
Applied rewrites35.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 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.5
Applied rewrites45.5%
lift-/.f64N/A
div-flipN/A
lift-+.f64N/A
lift-fma.f64N/A
lift-pow.f64N/A
pow2N/A
distribute-rgt-inN/A
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f6445.5
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6445.5
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
metadata-eval45.5
Applied rewrites45.5%
Taylor expanded in k around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6429.2
Applied rewrites29.2%
(FPCore (a k m)
:precision binary64
(if (<= m -3.2e+17)
(* (/ 1.0 (* k k)) a)
(if (<= m 9.5)
(/ a (fma (- k -10.0) k 1.0))
(* (+ 1.0 (* k (- (* 99.0 k) 10.0))) a))))
double code(double a, double k, double m) {
double tmp;
if (m <= -3.2e+17) {
tmp = (1.0 / (k * k)) * a;
} else if (m <= 9.5) {
tmp = a / fma((k - -10.0), k, 1.0);
} else {
tmp = (1.0 + (k * ((99.0 * k) - 10.0))) * a;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= -3.2e+17) tmp = Float64(Float64(1.0 / Float64(k * k)) * a); elseif (m <= 9.5) tmp = Float64(a / fma(Float64(k - -10.0), k, 1.0)); else tmp = Float64(Float64(1.0 + Float64(k * Float64(Float64(99.0 * k) - 10.0))) * a); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, -3.2e+17], N[(N[(1.0 / N[(k * k), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[m, 9.5], N[(a / N[(N[(k - -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(k * N[(N[(99.0 * k), $MachinePrecision] - 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -3.2 \cdot 10^{+17}:\\
\;\;\;\;\frac{1}{k \cdot k} \cdot a\\
\mathbf{elif}\;m \leq 9.5:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(k - -10, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + k \cdot \left(99 \cdot k - 10\right)\right) \cdot a\\
\end{array}
\end{array}
if m < -3.2e17Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.5
Applied rewrites45.5%
Taylor expanded in k around inf
lower-/.f64N/A
lower-pow.f6435.8
Applied rewrites35.8%
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
div-flipN/A
associate-/r/N/A
metadata-evalN/A
lift-*.f64N/A
frac-timesN/A
lift-/.f64N/A
lift-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
metadata-evalN/A
lift-*.f64N/A
lower-/.f6435.9
Applied rewrites35.9%
if -3.2e17 < m < 9.5Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.5
Applied rewrites45.5%
lift-+.f64N/A
lift-fma.f64N/A
lift-pow.f64N/A
pow2N/A
distribute-rgt-inN/A
lift-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6445.5
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
metadata-eval45.5
Applied rewrites45.5%
if 9.5 < m Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.5
Applied rewrites45.5%
lift-/.f64N/A
div-flipN/A
lift-+.f64N/A
lift-fma.f64N/A
lift-pow.f64N/A
pow2N/A
distribute-rgt-inN/A
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f6445.5
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f6445.5
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
metadata-eval45.5
Applied rewrites45.5%
Taylor expanded in k around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6429.2
Applied rewrites29.2%
(FPCore (a k m) :precision binary64 (if (<= m -1.26e+20) (* (/ 1.0 (* k k)) a) (if (<= m 1.92) (/ a (fma (- k -10.0) k 1.0)) (* -10.0 (* a k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.26e+20) {
tmp = (1.0 / (k * k)) * a;
} else if (m <= 1.92) {
tmp = a / fma((k - -10.0), k, 1.0);
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= -1.26e+20) tmp = Float64(Float64(1.0 / Float64(k * k)) * a); elseif (m <= 1.92) tmp = Float64(a / fma(Float64(k - -10.0), k, 1.0)); else tmp = Float64(-10.0 * Float64(a * k)); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, -1.26e+20], N[(N[(1.0 / N[(k * k), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[m, 1.92], N[(a / N[(N[(k - -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.26 \cdot 10^{+20}:\\
\;\;\;\;\frac{1}{k \cdot k} \cdot a\\
\mathbf{elif}\;m \leq 1.92:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(k - -10, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -1.26e20Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.5
Applied rewrites45.5%
Taylor expanded in k around inf
lower-/.f64N/A
lower-pow.f6435.8
Applied rewrites35.8%
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
div-flipN/A
associate-/r/N/A
metadata-evalN/A
lift-*.f64N/A
frac-timesN/A
lift-/.f64N/A
lift-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
metadata-evalN/A
lift-*.f64N/A
lower-/.f6435.9
Applied rewrites35.9%
if -1.26e20 < m < 1.9199999999999999Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.5
Applied rewrites45.5%
lift-+.f64N/A
lift-fma.f64N/A
lift-pow.f64N/A
pow2N/A
distribute-rgt-inN/A
lift-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6445.5
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
metadata-eval45.5
Applied rewrites45.5%
if 1.9199999999999999 < m Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.5
Applied rewrites45.5%
Taylor expanded in k around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6421.3
Applied rewrites21.3%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6421.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.3
Applied rewrites21.3%
Taylor expanded in k around inf
lower-*.f64N/A
lower-*.f647.7
Applied rewrites7.7%
(FPCore (a k m)
:precision binary64
(if (<= m -4.8e-51)
(/ a (* k k))
(if (<= m 9.8e-80)
(/ a 1.0)
(if (<= m 1.95e-14) (/ (/ a k) k) (* -10.0 (* a k))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -4.8e-51) {
tmp = a / (k * k);
} else if (m <= 9.8e-80) {
tmp = a / 1.0;
} else if (m <= 1.95e-14) {
tmp = (a / k) / k;
} 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 <= (-4.8d-51)) then
tmp = a / (k * k)
else if (m <= 9.8d-80) then
tmp = a / 1.0d0
else if (m <= 1.95d-14) then
tmp = (a / k) / k
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 <= -4.8e-51) {
tmp = a / (k * k);
} else if (m <= 9.8e-80) {
tmp = a / 1.0;
} else if (m <= 1.95e-14) {
tmp = (a / k) / k;
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -4.8e-51: tmp = a / (k * k) elif m <= 9.8e-80: tmp = a / 1.0 elif m <= 1.95e-14: tmp = (a / k) / k else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -4.8e-51) tmp = Float64(a / Float64(k * k)); elseif (m <= 9.8e-80) tmp = Float64(a / 1.0); elseif (m <= 1.95e-14) tmp = Float64(Float64(a / k) / k); else tmp = Float64(-10.0 * Float64(a * k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -4.8e-51) tmp = a / (k * k); elseif (m <= 9.8e-80) tmp = a / 1.0; elseif (m <= 1.95e-14) tmp = (a / k) / k; else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -4.8e-51], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 9.8e-80], N[(a / 1.0), $MachinePrecision], If[LessEqual[m, 1.95e-14], N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -4.8 \cdot 10^{-51}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 9.8 \cdot 10^{-80}:\\
\;\;\;\;\frac{a}{1}\\
\mathbf{elif}\;m \leq 1.95 \cdot 10^{-14}:\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -4.8e-51Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.5
Applied rewrites45.5%
Taylor expanded in k around inf
lower-/.f64N/A
lower-pow.f6435.8
Applied rewrites35.8%
lift-pow.f64N/A
pow2N/A
lift-*.f6435.8
Applied rewrites35.8%
if -4.8e-51 < m < 9.79999999999999981e-80Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.5
Applied rewrites45.5%
lift-fma.f64N/A
lift-pow.f64N/A
pow2N/A
distribute-rgt-inN/A
lift-+.f64N/A
*-commutativeN/A
lift-+.f64N/A
flip-+N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
pow2N/A
lift-pow.f64N/A
lower--.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow2N/A
lower-*.f64N/A
lower--.f6445.8
Applied rewrites45.8%
Taylor expanded in k around 0
Applied rewrites20.5%
if 9.79999999999999981e-80 < m < 1.9499999999999999e-14Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.5
Applied rewrites45.5%
Taylor expanded in k around inf
lower-/.f64N/A
lower-pow.f6435.8
Applied rewrites35.8%
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6434.5
Applied rewrites34.5%
if 1.9499999999999999e-14 < m Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.5
Applied rewrites45.5%
Taylor expanded in k around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6421.3
Applied rewrites21.3%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6421.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.3
Applied rewrites21.3%
Taylor expanded in k around inf
lower-*.f64N/A
lower-*.f647.7
Applied rewrites7.7%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (/ a (* k k))))
(if (<= m -4.8e-51)
t_0
(if (<= m 2.95e-78)
(/ a 1.0)
(if (<= m 1.95e-14) t_0 (* -10.0 (* a k)))))))
double code(double a, double k, double m) {
double t_0 = a / (k * k);
double tmp;
if (m <= -4.8e-51) {
tmp = t_0;
} else if (m <= 2.95e-78) {
tmp = a / 1.0;
} else if (m <= 1.95e-14) {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = a / (k * k)
if (m <= (-4.8d-51)) then
tmp = t_0
else if (m <= 2.95d-78) then
tmp = a / 1.0d0
else if (m <= 1.95d-14) then
tmp = t_0
else
tmp = (-10.0d0) * (a * k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = a / (k * k);
double tmp;
if (m <= -4.8e-51) {
tmp = t_0;
} else if (m <= 2.95e-78) {
tmp = a / 1.0;
} else if (m <= 1.95e-14) {
tmp = t_0;
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): t_0 = a / (k * k) tmp = 0 if m <= -4.8e-51: tmp = t_0 elif m <= 2.95e-78: tmp = a / 1.0 elif m <= 1.95e-14: tmp = t_0 else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) t_0 = Float64(a / Float64(k * k)) tmp = 0.0 if (m <= -4.8e-51) tmp = t_0; elseif (m <= 2.95e-78) tmp = Float64(a / 1.0); elseif (m <= 1.95e-14) tmp = t_0; else tmp = Float64(-10.0 * Float64(a * k)); end return tmp end
function tmp_2 = code(a, k, m) t_0 = a / (k * k); tmp = 0.0; if (m <= -4.8e-51) tmp = t_0; elseif (m <= 2.95e-78) tmp = a / 1.0; elseif (m <= 1.95e-14) tmp = t_0; else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[m, -4.8e-51], t$95$0, If[LessEqual[m, 2.95e-78], N[(a / 1.0), $MachinePrecision], If[LessEqual[m, 1.95e-14], t$95$0, N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{a}{k \cdot k}\\
\mathbf{if}\;m \leq -4.8 \cdot 10^{-51}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;m \leq 2.95 \cdot 10^{-78}:\\
\;\;\;\;\frac{a}{1}\\
\mathbf{elif}\;m \leq 1.95 \cdot 10^{-14}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -4.8e-51 or 2.9500000000000002e-78 < m < 1.9499999999999999e-14Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.5
Applied rewrites45.5%
Taylor expanded in k around inf
lower-/.f64N/A
lower-pow.f6435.8
Applied rewrites35.8%
lift-pow.f64N/A
pow2N/A
lift-*.f6435.8
Applied rewrites35.8%
if -4.8e-51 < m < 2.9500000000000002e-78Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.5
Applied rewrites45.5%
lift-fma.f64N/A
lift-pow.f64N/A
pow2N/A
distribute-rgt-inN/A
lift-+.f64N/A
*-commutativeN/A
lift-+.f64N/A
flip-+N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
pow2N/A
lift-pow.f64N/A
lower--.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow2N/A
lower-*.f64N/A
lower--.f6445.8
Applied rewrites45.8%
Taylor expanded in k around 0
Applied rewrites20.5%
if 1.9499999999999999e-14 < m Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.5
Applied rewrites45.5%
Taylor expanded in k around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6421.3
Applied rewrites21.3%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6421.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.3
Applied rewrites21.3%
Taylor expanded in k around inf
lower-*.f64N/A
lower-*.f647.7
Applied rewrites7.7%
(FPCore (a k m) :precision binary64 (if (<= m -1.62e-50) (* (/ 1.0 (* k k)) a) (if (<= m 1.92) (/ a (+ 1.0 (* 10.0 k))) (* -10.0 (* a k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.62e-50) {
tmp = (1.0 / (k * k)) * a;
} else if (m <= 1.92) {
tmp = a / (1.0 + (10.0 * k));
} 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 <= (-1.62d-50)) then
tmp = (1.0d0 / (k * k)) * a
else if (m <= 1.92d0) then
tmp = a / (1.0d0 + (10.0d0 * k))
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 <= -1.62e-50) {
tmp = (1.0 / (k * k)) * a;
} else if (m <= 1.92) {
tmp = a / (1.0 + (10.0 * k));
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -1.62e-50: tmp = (1.0 / (k * k)) * a elif m <= 1.92: tmp = a / (1.0 + (10.0 * k)) else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -1.62e-50) tmp = Float64(Float64(1.0 / Float64(k * k)) * a); elseif (m <= 1.92) tmp = Float64(a / Float64(1.0 + Float64(10.0 * k))); else tmp = Float64(-10.0 * Float64(a * k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -1.62e-50) tmp = (1.0 / (k * k)) * a; elseif (m <= 1.92) tmp = a / (1.0 + (10.0 * k)); else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -1.62e-50], N[(N[(1.0 / N[(k * k), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[m, 1.92], N[(a / N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.62 \cdot 10^{-50}:\\
\;\;\;\;\frac{1}{k \cdot k} \cdot a\\
\mathbf{elif}\;m \leq 1.92:\\
\;\;\;\;\frac{a}{1 + 10 \cdot k}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -1.6200000000000001e-50Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.5
Applied rewrites45.5%
Taylor expanded in k around inf
lower-/.f64N/A
lower-pow.f6435.8
Applied rewrites35.8%
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
div-flipN/A
associate-/r/N/A
metadata-evalN/A
lift-*.f64N/A
frac-timesN/A
lift-/.f64N/A
lift-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
metadata-evalN/A
lift-*.f64N/A
lower-/.f6435.9
Applied rewrites35.9%
if -1.6200000000000001e-50 < m < 1.9199999999999999Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.5
Applied rewrites45.5%
Taylor expanded in k around 0
lower-*.f6428.9
Applied rewrites28.9%
if 1.9199999999999999 < m Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.5
Applied rewrites45.5%
Taylor expanded in k around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6421.3
Applied rewrites21.3%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6421.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.3
Applied rewrites21.3%
Taylor expanded in k around inf
lower-*.f64N/A
lower-*.f647.7
Applied rewrites7.7%
(FPCore (a k m) :precision binary64 (if (<= m -1.62e-50) (/ a (* k k)) (if (<= m 1.92) (/ a (+ 1.0 (* 10.0 k))) (* -10.0 (* a k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.62e-50) {
tmp = a / (k * k);
} else if (m <= 1.92) {
tmp = a / (1.0 + (10.0 * k));
} 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 <= (-1.62d-50)) then
tmp = a / (k * k)
else if (m <= 1.92d0) then
tmp = a / (1.0d0 + (10.0d0 * k))
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 <= -1.62e-50) {
tmp = a / (k * k);
} else if (m <= 1.92) {
tmp = a / (1.0 + (10.0 * k));
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -1.62e-50: tmp = a / (k * k) elif m <= 1.92: tmp = a / (1.0 + (10.0 * k)) else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -1.62e-50) tmp = Float64(a / Float64(k * k)); elseif (m <= 1.92) tmp = Float64(a / Float64(1.0 + Float64(10.0 * k))); else tmp = Float64(-10.0 * Float64(a * k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -1.62e-50) tmp = a / (k * k); elseif (m <= 1.92) tmp = a / (1.0 + (10.0 * k)); else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -1.62e-50], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.92], N[(a / N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.62 \cdot 10^{-50}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 1.92:\\
\;\;\;\;\frac{a}{1 + 10 \cdot k}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -1.6200000000000001e-50Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.5
Applied rewrites45.5%
Taylor expanded in k around inf
lower-/.f64N/A
lower-pow.f6435.8
Applied rewrites35.8%
lift-pow.f64N/A
pow2N/A
lift-*.f6435.8
Applied rewrites35.8%
if -1.6200000000000001e-50 < m < 1.9199999999999999Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.5
Applied rewrites45.5%
Taylor expanded in k around 0
lower-*.f6428.9
Applied rewrites28.9%
if 1.9199999999999999 < m Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.5
Applied rewrites45.5%
Taylor expanded in k around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6421.3
Applied rewrites21.3%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6421.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.3
Applied rewrites21.3%
Taylor expanded in k around inf
lower-*.f64N/A
lower-*.f647.7
Applied rewrites7.7%
(FPCore (a k m) :precision binary64 (if (<= m 1.92) (/ a 1.0) (* -10.0 (* a k))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.92) {
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 <= 1.92d0) 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 <= 1.92) {
tmp = a / 1.0;
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.92: tmp = a / 1.0 else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.92) tmp = Float64(a / 1.0); else tmp = Float64(-10.0 * Float64(a * k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 1.92) tmp = a / 1.0; else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.92], N[(a / 1.0), $MachinePrecision], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.92:\\
\;\;\;\;\frac{a}{1}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < 1.9199999999999999Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.5
Applied rewrites45.5%
lift-fma.f64N/A
lift-pow.f64N/A
pow2N/A
distribute-rgt-inN/A
lift-+.f64N/A
*-commutativeN/A
lift-+.f64N/A
flip-+N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
pow2N/A
lift-pow.f64N/A
lower--.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow2N/A
lower-*.f64N/A
lower--.f6445.8
Applied rewrites45.8%
Taylor expanded in k around 0
Applied rewrites20.5%
if 1.9199999999999999 < m Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.5
Applied rewrites45.5%
Taylor expanded in k around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6421.3
Applied rewrites21.3%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6421.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6421.3
Applied rewrites21.3%
Taylor expanded in k around inf
lower-*.f64N/A
lower-*.f647.7
Applied rewrites7.7%
(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]
\begin{array}{l}
\\
\frac{a}{1}
\end{array}
Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
lower-pow.f6445.5
Applied rewrites45.5%
lift-fma.f64N/A
lift-pow.f64N/A
pow2N/A
distribute-rgt-inN/A
lift-+.f64N/A
*-commutativeN/A
lift-+.f64N/A
flip-+N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
pow2N/A
lift-pow.f64N/A
lower--.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow2N/A
lower-*.f64N/A
lower--.f6445.8
Applied rewrites45.8%
Taylor expanded in k around 0
Applied rewrites20.5%
herbie shell --seed 2025142
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))