
(FPCore (x y z t a b c i) :precision binary64 (+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
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(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
code = (((x * y) + (z * t)) + (a * b)) + (c * i)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
def code(x, y, z, t, a, b, c, i): return (((x * y) + (z * t)) + (a * b)) + (c * i)
function code(x, y, z, t, a, b, c, i) return Float64(Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) + Float64(c * i)) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = (((x * y) + (z * t)) + (a * b)) + (c * i); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i
\end{array}
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c i) :precision binary64 (+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
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(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
code = (((x * y) + (z * t)) + (a * b)) + (c * i)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
def code(x, y, z, t, a, b, c, i): return (((x * y) + (z * t)) + (a * b)) + (c * i)
function code(x, y, z, t, a, b, c, i) return Float64(Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) + Float64(c * i)) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = (((x * y) + (z * t)) + (a * b)) + (c * i); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i
\end{array}
(FPCore (x y z t a b c i) :precision binary64 (+ (fma y x (fma b a (* t z))) (* c i)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return fma(y, x, fma(b, a, (t * z))) + (c * i);
}
function code(x, y, z, t, a, b, c, i) return Float64(fma(y, x, fma(b, a, Float64(t * z))) + Float64(c * i)) end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(y * x + N[(b * a + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, x, \mathsf{fma}\left(b, a, t \cdot z\right)\right) + c \cdot i
\end{array}
Initial program 95.4%
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
associate-+l+N/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6496.5
Applied rewrites96.5%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma b a (fma t z (* y x)))))
(if (<= (* z t) -1e+32)
t_1
(if (<= (* z t) 1e+122) (fma b a (fma i c (* y x))) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(b, a, fma(t, z, (y * x)));
double tmp;
if ((z * t) <= -1e+32) {
tmp = t_1;
} else if ((z * t) <= 1e+122) {
tmp = fma(b, a, fma(i, c, (y * x)));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(b, a, fma(t, z, Float64(y * x))) tmp = 0.0 if (Float64(z * t) <= -1e+32) tmp = t_1; elseif (Float64(z * t) <= 1e+122) tmp = fma(b, a, fma(i, c, Float64(y * x))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(b * a + N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -1e+32], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 1e+122], N[(b * a + N[(i * c + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(b, a, \mathsf{fma}\left(t, z, y \cdot x\right)\right)\\
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+32}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq 10^{+122}:\\
\;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, y \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -1.00000000000000005e32 or 1.00000000000000001e122 < (*.f64 z t) Initial program 92.1%
Taylor expanded in c around 0
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6484.6
Applied rewrites84.6%
if -1.00000000000000005e32 < (*.f64 z t) < 1.00000000000000001e122Initial program 97.4%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6492.2
Applied rewrites92.2%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* z t) -5e+143) (fma b a (* t z)) (if (<= (* z t) 4e+145) (fma b a (fma i c (* y x))) (fma x y (* t z)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((z * t) <= -5e+143) {
tmp = fma(b, a, (t * z));
} else if ((z * t) <= 4e+145) {
tmp = fma(b, a, fma(i, c, (y * x)));
} else {
tmp = fma(x, y, (t * z));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(z * t) <= -5e+143) tmp = fma(b, a, Float64(t * z)); elseif (Float64(z * t) <= 4e+145) tmp = fma(b, a, fma(i, c, Float64(y * x))); else tmp = fma(x, y, Float64(t * z)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(z * t), $MachinePrecision], -5e+143], N[(b * a + N[(t * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 4e+145], N[(b * a + N[(i * c + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * y + N[(t * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+143}:\\
\;\;\;\;\mathsf{fma}\left(b, a, t \cdot z\right)\\
\mathbf{elif}\;z \cdot t \leq 4 \cdot 10^{+145}:\\
\;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, y \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, y, t \cdot z\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -5.00000000000000012e143Initial program 89.6%
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
associate-+l+N/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6492.8
Applied rewrites92.8%
Taylor expanded in c around 0
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
associate-+l+N/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6484.5
Applied rewrites84.5%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6475.3
Applied rewrites75.3%
if -5.00000000000000012e143 < (*.f64 z t) < 4e145Initial program 97.4%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6489.3
Applied rewrites89.3%
if 4e145 < (*.f64 z t) Initial program 91.6%
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
associate-+l+N/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6494.1
Applied rewrites94.1%
Taylor expanded in c around 0
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
associate-+l+N/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6487.3
Applied rewrites87.3%
Taylor expanded in z around inf
lower-*.f6477.4
Applied rewrites77.4%
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (fma x y (* t z))) (t_2 (+ (* x y) (* z t)))) (if (<= t_2 -5e+143) t_1 (if (<= t_2 5e+151) (fma b a (* i c)) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(x, y, (t * z));
double t_2 = (x * y) + (z * t);
double tmp;
if (t_2 <= -5e+143) {
tmp = t_1;
} else if (t_2 <= 5e+151) {
tmp = fma(b, a, (i * c));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(x, y, Float64(t * z)) t_2 = Float64(Float64(x * y) + Float64(z * t)) tmp = 0.0 if (t_2 <= -5e+143) tmp = t_1; elseif (t_2 <= 5e+151) tmp = fma(b, a, Float64(i * c)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(x * y + N[(t * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+143], t$95$1, If[LessEqual[t$95$2, 5e+151], N[(b * a + N[(i * c), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(x, y, t \cdot z\right)\\
t_2 := x \cdot y + z \cdot t\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+143}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+151}:\\
\;\;\;\;\mathsf{fma}\left(b, a, i \cdot c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (*.f64 x y) (*.f64 z t)) < -5.00000000000000012e143 or 5.0000000000000002e151 < (+.f64 (*.f64 x y) (*.f64 z t)) Initial program 91.8%
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
associate-+l+N/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6494.1
Applied rewrites94.1%
Taylor expanded in c around 0
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
associate-+l+N/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6486.5
Applied rewrites86.5%
Taylor expanded in z around inf
lower-*.f6476.2
Applied rewrites76.2%
if -5.00000000000000012e143 < (+.f64 (*.f64 x y) (*.f64 z t)) < 5.0000000000000002e151Initial program 98.9%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6486.1
Applied rewrites86.1%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f6473.2
Applied rewrites73.2%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma b a (* i c))) (t_2 (fma b a (* t z))))
(if (<= (* z t) -1e+32)
t_2
(if (<= (* z t) -5e-140)
t_1
(if (<= (* z t) -1e-319)
(fma x y (* b a))
(if (<= (* z t) 2e-128)
(fma i c (* x y))
(if (<= (* z t) 1e+111) t_1 t_2)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(b, a, (i * c));
double t_2 = fma(b, a, (t * z));
double tmp;
if ((z * t) <= -1e+32) {
tmp = t_2;
} else if ((z * t) <= -5e-140) {
tmp = t_1;
} else if ((z * t) <= -1e-319) {
tmp = fma(x, y, (b * a));
} else if ((z * t) <= 2e-128) {
tmp = fma(i, c, (x * y));
} else if ((z * t) <= 1e+111) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(b, a, Float64(i * c)) t_2 = fma(b, a, Float64(t * z)) tmp = 0.0 if (Float64(z * t) <= -1e+32) tmp = t_2; elseif (Float64(z * t) <= -5e-140) tmp = t_1; elseif (Float64(z * t) <= -1e-319) tmp = fma(x, y, Float64(b * a)); elseif (Float64(z * t) <= 2e-128) tmp = fma(i, c, Float64(x * y)); elseif (Float64(z * t) <= 1e+111) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(b * a + N[(i * c), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(b * a + N[(t * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -1e+32], t$95$2, If[LessEqual[N[(z * t), $MachinePrecision], -5e-140], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], -1e-319], N[(x * y + N[(b * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e-128], N[(i * c + N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1e+111], t$95$1, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(b, a, i \cdot c\right)\\
t_2 := \mathsf{fma}\left(b, a, t \cdot z\right)\\
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+32}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{-140}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq -1 \cdot 10^{-319}:\\
\;\;\;\;\mathsf{fma}\left(x, y, b \cdot a\right)\\
\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{-128}:\\
\;\;\;\;\mathsf{fma}\left(i, c, x \cdot y\right)\\
\mathbf{elif}\;z \cdot t \leq 10^{+111}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 z t) < -1.00000000000000005e32 or 9.99999999999999957e110 < (*.f64 z t) Initial program 92.3%
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
associate-+l+N/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6494.6
Applied rewrites94.6%
Taylor expanded in c around 0
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
associate-+l+N/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6483.9
Applied rewrites83.9%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6471.2
Applied rewrites71.2%
if -1.00000000000000005e32 < (*.f64 z t) < -5.00000000000000015e-140 or 2.00000000000000011e-128 < (*.f64 z t) < 9.99999999999999957e110Initial program 97.0%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6486.9
Applied rewrites86.9%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f6458.8
Applied rewrites58.8%
if -5.00000000000000015e-140 < (*.f64 z t) < -9.99989e-320Initial program 97.5%
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
associate-+l+N/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6498.0
Applied rewrites98.0%
Taylor expanded in c around 0
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
associate-+l+N/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6468.0
Applied rewrites68.0%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f6466.9
Applied rewrites66.9%
if -9.99989e-320 < (*.f64 z t) < 2.00000000000000011e-128Initial program 97.9%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6498.0
Applied rewrites98.0%
Taylor expanded in a around 0
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6465.2
Applied rewrites65.2%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma b a (* i c))) (t_2 (fma b a (* t z))))
(if (<= (* z t) -1e+32)
t_2
(if (<= (* z t) -1e-200)
t_1
(if (<= (* z t) -1e-319)
(fma b a (* x y))
(if (<= (* z t) 2e-128)
(fma i c (* x y))
(if (<= (* z t) 1e+111) t_1 t_2)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(b, a, (i * c));
double t_2 = fma(b, a, (t * z));
double tmp;
if ((z * t) <= -1e+32) {
tmp = t_2;
} else if ((z * t) <= -1e-200) {
tmp = t_1;
} else if ((z * t) <= -1e-319) {
tmp = fma(b, a, (x * y));
} else if ((z * t) <= 2e-128) {
tmp = fma(i, c, (x * y));
} else if ((z * t) <= 1e+111) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(b, a, Float64(i * c)) t_2 = fma(b, a, Float64(t * z)) tmp = 0.0 if (Float64(z * t) <= -1e+32) tmp = t_2; elseif (Float64(z * t) <= -1e-200) tmp = t_1; elseif (Float64(z * t) <= -1e-319) tmp = fma(b, a, Float64(x * y)); elseif (Float64(z * t) <= 2e-128) tmp = fma(i, c, Float64(x * y)); elseif (Float64(z * t) <= 1e+111) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(b * a + N[(i * c), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(b * a + N[(t * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -1e+32], t$95$2, If[LessEqual[N[(z * t), $MachinePrecision], -1e-200], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], -1e-319], N[(b * a + N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e-128], N[(i * c + N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1e+111], t$95$1, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(b, a, i \cdot c\right)\\
t_2 := \mathsf{fma}\left(b, a, t \cdot z\right)\\
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+32}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \cdot t \leq -1 \cdot 10^{-200}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq -1 \cdot 10^{-319}:\\
\;\;\;\;\mathsf{fma}\left(b, a, x \cdot y\right)\\
\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{-128}:\\
\;\;\;\;\mathsf{fma}\left(i, c, x \cdot y\right)\\
\mathbf{elif}\;z \cdot t \leq 10^{+111}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 z t) < -1.00000000000000005e32 or 9.99999999999999957e110 < (*.f64 z t) Initial program 92.3%
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
associate-+l+N/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6494.6
Applied rewrites94.6%
Taylor expanded in c around 0
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
associate-+l+N/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6483.9
Applied rewrites83.9%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6471.2
Applied rewrites71.2%
if -1.00000000000000005e32 < (*.f64 z t) < -9.9999999999999998e-201 or 2.00000000000000011e-128 < (*.f64 z t) < 9.99999999999999957e110Initial program 97.0%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6487.8
Applied rewrites87.8%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f6459.6
Applied rewrites59.6%
if -9.9999999999999998e-201 < (*.f64 z t) < -9.99989e-320Initial program 97.8%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6498.1
Applied rewrites98.1%
Taylor expanded in x around inf
lower-*.f6464.4
Applied rewrites64.4%
if -9.99989e-320 < (*.f64 z t) < 2.00000000000000011e-128Initial program 97.9%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6498.0
Applied rewrites98.0%
Taylor expanded in a around 0
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6465.2
Applied rewrites65.2%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma b a (* i c))) (t_2 (fma b a (* t z))))
(if (<= (* z t) -1e+32)
t_2
(if (<= (* z t) -1e-319)
t_1
(if (<= (* z t) 2e-128)
(fma i c (* x y))
(if (<= (* z t) 1e+111) t_1 t_2))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(b, a, (i * c));
double t_2 = fma(b, a, (t * z));
double tmp;
if ((z * t) <= -1e+32) {
tmp = t_2;
} else if ((z * t) <= -1e-319) {
tmp = t_1;
} else if ((z * t) <= 2e-128) {
tmp = fma(i, c, (x * y));
} else if ((z * t) <= 1e+111) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(b, a, Float64(i * c)) t_2 = fma(b, a, Float64(t * z)) tmp = 0.0 if (Float64(z * t) <= -1e+32) tmp = t_2; elseif (Float64(z * t) <= -1e-319) tmp = t_1; elseif (Float64(z * t) <= 2e-128) tmp = fma(i, c, Float64(x * y)); elseif (Float64(z * t) <= 1e+111) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(b * a + N[(i * c), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(b * a + N[(t * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -1e+32], t$95$2, If[LessEqual[N[(z * t), $MachinePrecision], -1e-319], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 2e-128], N[(i * c + N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1e+111], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(b, a, i \cdot c\right)\\
t_2 := \mathsf{fma}\left(b, a, t \cdot z\right)\\
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+32}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \cdot t \leq -1 \cdot 10^{-319}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{-128}:\\
\;\;\;\;\mathsf{fma}\left(i, c, x \cdot y\right)\\
\mathbf{elif}\;z \cdot t \leq 10^{+111}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 z t) < -1.00000000000000005e32 or 9.99999999999999957e110 < (*.f64 z t) Initial program 92.3%
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
associate-+l+N/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6494.6
Applied rewrites94.6%
Taylor expanded in c around 0
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
associate-+l+N/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6483.9
Applied rewrites83.9%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6471.2
Applied rewrites71.2%
if -1.00000000000000005e32 < (*.f64 z t) < -9.99989e-320 or 2.00000000000000011e-128 < (*.f64 z t) < 9.99999999999999957e110Initial program 97.1%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6489.2
Applied rewrites89.2%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f6460.3
Applied rewrites60.3%
if -9.99989e-320 < (*.f64 z t) < 2.00000000000000011e-128Initial program 97.9%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6498.0
Applied rewrites98.0%
Taylor expanded in a around 0
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6465.2
Applied rewrites65.2%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma b a (* t z))))
(if (<= (* z t) -20000000.0)
t_1
(if (<= (* z t) 4e+117) (fma i c (* x y)) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(b, a, (t * z));
double tmp;
if ((z * t) <= -20000000.0) {
tmp = t_1;
} else if ((z * t) <= 4e+117) {
tmp = fma(i, c, (x * y));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(b, a, Float64(t * z)) tmp = 0.0 if (Float64(z * t) <= -20000000.0) tmp = t_1; elseif (Float64(z * t) <= 4e+117) tmp = fma(i, c, Float64(x * y)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(b * a + N[(t * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -20000000.0], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 4e+117], N[(i * c + N[(x * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(b, a, t \cdot z\right)\\
\mathbf{if}\;z \cdot t \leq -20000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq 4 \cdot 10^{+117}:\\
\;\;\;\;\mathsf{fma}\left(i, c, x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -2e7 or 4.0000000000000002e117 < (*.f64 z t) Initial program 92.4%
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
associate-+l+N/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6494.7
Applied rewrites94.7%
Taylor expanded in c around 0
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
associate-+l+N/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6483.5
Applied rewrites83.5%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6470.3
Applied rewrites70.3%
if -2e7 < (*.f64 z t) < 4.0000000000000002e117Initial program 97.4%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6492.5
Applied rewrites92.5%
Taylor expanded in a around 0
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6462.6
Applied rewrites62.6%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* z t) -5e+104) (* t z) (if (<= (* z t) 1e+122) (fma i c (* x y)) (* t z))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((z * t) <= -5e+104) {
tmp = t * z;
} else if ((z * t) <= 1e+122) {
tmp = fma(i, c, (x * y));
} else {
tmp = t * z;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(z * t) <= -5e+104) tmp = Float64(t * z); elseif (Float64(z * t) <= 1e+122) tmp = fma(i, c, Float64(x * y)); else tmp = Float64(t * z); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(z * t), $MachinePrecision], -5e+104], N[(t * z), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1e+122], N[(i * c + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(t * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+104}:\\
\;\;\;\;t \cdot z\\
\mathbf{elif}\;z \cdot t \leq 10^{+122}:\\
\;\;\;\;\mathsf{fma}\left(i, c, x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot z\\
\end{array}
\end{array}
if (*.f64 z t) < -4.9999999999999997e104 or 1.00000000000000001e122 < (*.f64 z t) Initial program 91.4%
Taylor expanded in z around inf
lower-*.f6461.7
Applied rewrites61.7%
if -4.9999999999999997e104 < (*.f64 z t) < 1.00000000000000001e122Initial program 97.3%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6490.8
Applied rewrites90.8%
Taylor expanded in a around 0
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6461.4
Applied rewrites61.4%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* z t) -1e+62) (* t z) (if (<= (* z t) -1e-319) (* b a) (if (<= (* z t) 1e+111) (* i c) (* t z)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((z * t) <= -1e+62) {
tmp = t * z;
} else if ((z * t) <= -1e-319) {
tmp = b * a;
} else if ((z * t) <= 1e+111) {
tmp = i * c;
} else {
tmp = t * z;
}
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(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if ((z * t) <= (-1d+62)) then
tmp = t * z
else if ((z * t) <= (-1d-319)) then
tmp = b * a
else if ((z * t) <= 1d+111) then
tmp = i * c
else
tmp = t * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((z * t) <= -1e+62) {
tmp = t * z;
} else if ((z * t) <= -1e-319) {
tmp = b * a;
} else if ((z * t) <= 1e+111) {
tmp = i * c;
} else {
tmp = t * z;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (z * t) <= -1e+62: tmp = t * z elif (z * t) <= -1e-319: tmp = b * a elif (z * t) <= 1e+111: tmp = i * c else: tmp = t * z return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(z * t) <= -1e+62) tmp = Float64(t * z); elseif (Float64(z * t) <= -1e-319) tmp = Float64(b * a); elseif (Float64(z * t) <= 1e+111) tmp = Float64(i * c); else tmp = Float64(t * z); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((z * t) <= -1e+62) tmp = t * z; elseif ((z * t) <= -1e-319) tmp = b * a; elseif ((z * t) <= 1e+111) tmp = i * c; else tmp = t * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(z * t), $MachinePrecision], -1e+62], N[(t * z), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], -1e-319], N[(b * a), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1e+111], N[(i * c), $MachinePrecision], N[(t * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+62}:\\
\;\;\;\;t \cdot z\\
\mathbf{elif}\;z \cdot t \leq -1 \cdot 10^{-319}:\\
\;\;\;\;b \cdot a\\
\mathbf{elif}\;z \cdot t \leq 10^{+111}:\\
\;\;\;\;i \cdot c\\
\mathbf{else}:\\
\;\;\;\;t \cdot z\\
\end{array}
\end{array}
if (*.f64 z t) < -1.00000000000000004e62 or 9.99999999999999957e110 < (*.f64 z t) Initial program 92.0%
Taylor expanded in z around inf
lower-*.f6458.3
Applied rewrites58.3%
if -1.00000000000000004e62 < (*.f64 z t) < -9.99989e-320Initial program 97.3%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6433.4
Applied rewrites33.4%
if -9.99989e-320 < (*.f64 z t) < 9.99999999999999957e110Initial program 97.4%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f6431.3
Applied rewrites31.3%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* a b) -2e+179) (* b a) (if (<= (* a b) 5e+153) (* i c) (* b a))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((a * b) <= -2e+179) {
tmp = b * a;
} else if ((a * b) <= 5e+153) {
tmp = i * c;
} else {
tmp = b * 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(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if ((a * b) <= (-2d+179)) then
tmp = b * a
else if ((a * b) <= 5d+153) then
tmp = i * c
else
tmp = b * a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((a * b) <= -2e+179) {
tmp = b * a;
} else if ((a * b) <= 5e+153) {
tmp = i * c;
} else {
tmp = b * a;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (a * b) <= -2e+179: tmp = b * a elif (a * b) <= 5e+153: tmp = i * c else: tmp = b * a return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(a * b) <= -2e+179) tmp = Float64(b * a); elseif (Float64(a * b) <= 5e+153) tmp = Float64(i * c); else tmp = Float64(b * a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((a * b) <= -2e+179) tmp = b * a; elseif ((a * b) <= 5e+153) tmp = i * c; else tmp = b * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(a * b), $MachinePrecision], -2e+179], N[(b * a), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 5e+153], N[(i * c), $MachinePrecision], N[(b * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -2 \cdot 10^{+179}:\\
\;\;\;\;b \cdot a\\
\mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{+153}:\\
\;\;\;\;i \cdot c\\
\mathbf{else}:\\
\;\;\;\;b \cdot a\\
\end{array}
\end{array}
if (*.f64 a b) < -1.99999999999999996e179 or 5.00000000000000018e153 < (*.f64 a b) Initial program 89.9%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6471.5
Applied rewrites71.5%
if -1.99999999999999996e179 < (*.f64 a b) < 5.00000000000000018e153Initial program 97.4%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f6431.0
Applied rewrites31.0%
(FPCore (x y z t a b c i) :precision binary64 (* b a))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return b * a;
}
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(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
code = b * a
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return b * a;
}
def code(x, y, z, t, a, b, c, i): return b * a
function code(x, y, z, t, a, b, c, i) return Float64(b * a) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = b * a; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(b * a), $MachinePrecision]
\begin{array}{l}
\\
b \cdot a
\end{array}
Initial program 95.4%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6428.3
Applied rewrites28.3%
herbie shell --seed 2025120
(FPCore (x y z t a b c i)
:name "Linear.V4:$cdot from linear-1.19.1.3, C"
:precision binary64
(+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))