
(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 14 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 i c (fma b a (fma t z (* y x)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return fma(i, c, fma(b, a, fma(t, z, (y * x))));
}
function code(x, y, z, t, a, b, c, i) return fma(i, c, fma(b, a, fma(t, z, Float64(y * x)))) end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(i * c + N[(b * a + N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(i, c, \mathsf{fma}\left(b, a, \mathsf{fma}\left(t, z, y \cdot x\right)\right)\right)
\end{array}
Initial program 95.6%
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6497.7
Applied rewrites97.7%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma x y (fma z t (* a b)))))
(if (<= (* x y) -1e+118)
t_1
(if (<= (* x y) 6e+23) (fma a b (fma z t (* c i))) 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, fma(z, t, (a * b)));
double tmp;
if ((x * y) <= -1e+118) {
tmp = t_1;
} else if ((x * y) <= 6e+23) {
tmp = fma(a, b, fma(z, t, (c * i)));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(x, y, fma(z, t, Float64(a * b))) tmp = 0.0 if (Float64(x * y) <= -1e+118) tmp = t_1; elseif (Float64(x * y) <= 6e+23) tmp = fma(a, b, fma(z, t, Float64(c * i))); 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[(z * t + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -1e+118], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 6e+23], N[(a * b + N[(z * t + N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(x, y, \mathsf{fma}\left(z, t, a \cdot b\right)\right)\\
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+118}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 6 \cdot 10^{+23}:\\
\;\;\;\;\mathsf{fma}\left(a, b, \mathsf{fma}\left(z, t, c \cdot i\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 x y) < -9.99999999999999967e117 or 6.0000000000000002e23 < (*.f64 x y) Initial program 92.1%
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6495.6
Applied rewrites95.6%
Taylor expanded in c around 0
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6485.0
Applied rewrites85.0%
if -9.99999999999999967e117 < (*.f64 x y) < 6.0000000000000002e23Initial program 97.7%
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6498.9
Applied rewrites98.9%
Taylor expanded in x around 0
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f6492.5
Applied rewrites92.5%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma t z (* y x))))
(if (<= (* x y) -2e+95)
(fma i c t_1)
(if (<= (* x y) 6e+23) (fma a b (fma z t (* c i))) (fma b a t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(t, z, (y * x));
double tmp;
if ((x * y) <= -2e+95) {
tmp = fma(i, c, t_1);
} else if ((x * y) <= 6e+23) {
tmp = fma(a, b, fma(z, t, (c * i)));
} else {
tmp = fma(b, a, t_1);
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(t, z, Float64(y * x)) tmp = 0.0 if (Float64(x * y) <= -2e+95) tmp = fma(i, c, t_1); elseif (Float64(x * y) <= 6e+23) tmp = fma(a, b, fma(z, t, Float64(c * i))); else tmp = fma(b, a, t_1); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -2e+95], N[(i * c + t$95$1), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 6e+23], N[(a * b + N[(z * t + N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(b * a + t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t, z, y \cdot x\right)\\
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+95}:\\
\;\;\;\;\mathsf{fma}\left(i, c, t\_1\right)\\
\mathbf{elif}\;x \cdot y \leq 6 \cdot 10^{+23}:\\
\;\;\;\;\mathsf{fma}\left(a, b, \mathsf{fma}\left(z, t, c \cdot i\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b, a, t\_1\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -2.00000000000000004e95Initial program 91.6%
Taylor expanded in a around 0
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6485.3
Applied rewrites85.3%
if -2.00000000000000004e95 < (*.f64 x y) < 6.0000000000000002e23Initial program 97.7%
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6498.9
Applied rewrites98.9%
Taylor expanded in x around 0
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f6493.2
Applied rewrites93.2%
if 6.0000000000000002e23 < (*.f64 x y) Initial program 93.0%
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-*.f6483.1
Applied rewrites83.1%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma b a (fma t z (* y x)))))
(if (<= (* x y) -1e+118)
t_1
(if (<= (* x y) 6e+23) (fma a b (fma z t (* c i))) 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 ((x * y) <= -1e+118) {
tmp = t_1;
} else if ((x * y) <= 6e+23) {
tmp = fma(a, b, fma(z, t, (c * i)));
} 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(x * y) <= -1e+118) tmp = t_1; elseif (Float64(x * y) <= 6e+23) tmp = fma(a, b, fma(z, t, Float64(c * i))); 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[(x * y), $MachinePrecision], -1e+118], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 6e+23], N[(a * b + N[(z * t + N[(c * i), $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}\;x \cdot y \leq -1 \cdot 10^{+118}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 6 \cdot 10^{+23}:\\
\;\;\;\;\mathsf{fma}\left(a, b, \mathsf{fma}\left(z, t, c \cdot i\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 x y) < -9.99999999999999967e117 or 6.0000000000000002e23 < (*.f64 x y) 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.2
Applied rewrites84.2%
if -9.99999999999999967e117 < (*.f64 x y) < 6.0000000000000002e23Initial program 97.7%
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6498.9
Applied rewrites98.9%
Taylor expanded in x around 0
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f6492.5
Applied rewrites92.5%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* x y) -1e+118) (fma x y (* b a)) (if (<= (* x y) 2e+124) (fma a b (fma z t (* c i))) (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 ((x * y) <= -1e+118) {
tmp = fma(x, y, (b * a));
} else if ((x * y) <= 2e+124) {
tmp = fma(a, b, fma(z, t, (c * i)));
} else {
tmp = fma(x, y, (t * z));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(x * y) <= -1e+118) tmp = fma(x, y, Float64(b * a)); elseif (Float64(x * y) <= 2e+124) tmp = fma(a, b, fma(z, t, Float64(c * i))); else tmp = fma(x, y, Float64(t * z)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(x * y), $MachinePrecision], -1e+118], N[(x * y + N[(b * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+124], N[(a * b + N[(z * t + N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * y + N[(t * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+118}:\\
\;\;\;\;\mathsf{fma}\left(x, y, b \cdot a\right)\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+124}:\\
\;\;\;\;\mathsf{fma}\left(a, b, \mathsf{fma}\left(z, t, c \cdot i\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, y, t \cdot z\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -9.99999999999999967e117Initial program 90.8%
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6495.0
Applied rewrites95.0%
Taylor expanded in c around 0
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6486.9
Applied rewrites86.9%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f6476.3
Applied rewrites76.3%
if -9.99999999999999967e117 < (*.f64 x y) < 1.9999999999999999e124Initial program 97.7%
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6498.8
Applied rewrites98.8%
Taylor expanded in x around 0
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f6490.7
Applied rewrites90.7%
if 1.9999999999999999e124 < (*.f64 x y) Initial program 91.0%
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6495.0
Applied rewrites95.0%
Taylor expanded in c around 0
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6486.8
Applied rewrites86.8%
Taylor expanded in z around inf
lower-*.f6473.6
Applied rewrites73.6%
(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 -1e+159) t_1 (if (<= t_2 5e+125) (fma a b (* 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 <= -1e+159) {
tmp = t_1;
} else if (t_2 <= 5e+125) {
tmp = fma(a, b, (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 <= -1e+159) tmp = t_1; elseif (t_2 <= 5e+125) tmp = fma(a, b, 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, -1e+159], t$95$1, If[LessEqual[t$95$2, 5e+125], N[(a * b + 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 -1 \cdot 10^{+159}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+125}:\\
\;\;\;\;\mathsf{fma}\left(a, b, i \cdot c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (*.f64 x y) (*.f64 z t)) < -9.9999999999999993e158 or 4.99999999999999962e125 < (+.f64 (*.f64 x y) (*.f64 z t)) Initial program 91.9%
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6495.7
Applied rewrites95.7%
Taylor expanded in c around 0
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6487.9
Applied rewrites87.9%
Taylor expanded in z around inf
lower-*.f6477.3
Applied rewrites77.3%
if -9.9999999999999993e158 < (+.f64 (*.f64 x y) (*.f64 z t)) < 4.99999999999999962e125Initial program 99.2%
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6499.6
Applied rewrites99.6%
Taylor expanded in x around 0
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f6486.9
Applied rewrites86.9%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f6475.0
Applied rewrites75.0%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma x y (* b a))))
(if (<= (* x y) -1e+85)
t_1
(if (<= (* x y) 5e-216)
(fma z t (* b a))
(if (<= (* x y) 6e+23) (fma a b (* 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, (b * a));
double tmp;
if ((x * y) <= -1e+85) {
tmp = t_1;
} else if ((x * y) <= 5e-216) {
tmp = fma(z, t, (b * a));
} else if ((x * y) <= 6e+23) {
tmp = fma(a, b, (i * c));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(x, y, Float64(b * a)) tmp = 0.0 if (Float64(x * y) <= -1e+85) tmp = t_1; elseif (Float64(x * y) <= 5e-216) tmp = fma(z, t, Float64(b * a)); elseif (Float64(x * y) <= 6e+23) tmp = fma(a, b, 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[(b * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -1e+85], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 5e-216], N[(z * t + N[(b * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 6e+23], N[(a * b + N[(i * c), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(x, y, b \cdot a\right)\\
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+85}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-216}:\\
\;\;\;\;\mathsf{fma}\left(z, t, b \cdot a\right)\\
\mathbf{elif}\;x \cdot y \leq 6 \cdot 10^{+23}:\\
\;\;\;\;\mathsf{fma}\left(a, b, i \cdot c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 x y) < -1e85 or 6.0000000000000002e23 < (*.f64 x y) Initial program 92.4%
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6495.7
Applied rewrites95.7%
Taylor expanded in c around 0
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6484.5
Applied rewrites84.5%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f6471.8
Applied rewrites71.8%
if -1e85 < (*.f64 x y) < 5.00000000000000021e-216Initial program 97.6%
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6498.9
Applied rewrites98.9%
Taylor expanded in c around 0
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6469.4
Applied rewrites69.4%
Taylor expanded in x around 0
associate-+r+N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6464.7
Applied rewrites64.7%
lift-*.f64N/A
lift-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-*.f6464.8
Applied rewrites64.8%
if 5.00000000000000021e-216 < (*.f64 x y) < 6.0000000000000002e23Initial program 98.2%
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6499.2
Applied rewrites99.2%
Taylor expanded in x around 0
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f6492.0
Applied rewrites92.0%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f6461.4
Applied rewrites61.4%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma a b (* i c))))
(if (<= (* x y) -1e+159)
(* y x)
(if (<= (* x y) -5e-281)
t_1
(if (<= (* x y) 5e-216)
(fma b a (* t z))
(if (<= (* x y) 2e+124) t_1 (* y x)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(a, b, (i * c));
double tmp;
if ((x * y) <= -1e+159) {
tmp = y * x;
} else if ((x * y) <= -5e-281) {
tmp = t_1;
} else if ((x * y) <= 5e-216) {
tmp = fma(b, a, (t * z));
} else if ((x * y) <= 2e+124) {
tmp = t_1;
} else {
tmp = y * x;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(a, b, Float64(i * c)) tmp = 0.0 if (Float64(x * y) <= -1e+159) tmp = Float64(y * x); elseif (Float64(x * y) <= -5e-281) tmp = t_1; elseif (Float64(x * y) <= 5e-216) tmp = fma(b, a, Float64(t * z)); elseif (Float64(x * y) <= 2e+124) tmp = t_1; else tmp = Float64(y * x); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(a * b + N[(i * c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -1e+159], N[(y * x), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -5e-281], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 5e-216], N[(b * a + N[(t * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+124], t$95$1, N[(y * x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, b, i \cdot c\right)\\
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+159}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{-281}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-216}:\\
\;\;\;\;\mathsf{fma}\left(b, a, t \cdot z\right)\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+124}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\end{array}
if (*.f64 x y) < -9.9999999999999993e158 or 1.9999999999999999e124 < (*.f64 x y) Initial program 90.3%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6467.2
Applied rewrites67.2%
if -9.9999999999999993e158 < (*.f64 x y) < -4.9999999999999998e-281 or 5.00000000000000021e-216 < (*.f64 x y) < 1.9999999999999999e124Initial program 97.9%
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6498.9
Applied rewrites98.9%
Taylor expanded in x around 0
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f6487.0
Applied rewrites87.0%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f6459.7
Applied rewrites59.7%
if -4.9999999999999998e-281 < (*.f64 x y) < 5.00000000000000021e-216Initial program 97.3%
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6498.8
Applied rewrites98.8%
Taylor expanded in c around 0
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6468.2
Applied rewrites68.2%
Taylor expanded in x around 0
associate-+r+N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6467.8
Applied rewrites67.8%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* x y) -5e+195) (* y x) (if (<= (* x y) 2e+124) (fma z t (* b a)) (* y x))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((x * y) <= -5e+195) {
tmp = y * x;
} else if ((x * y) <= 2e+124) {
tmp = fma(z, t, (b * a));
} else {
tmp = y * x;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(x * y) <= -5e+195) tmp = Float64(y * x); elseif (Float64(x * y) <= 2e+124) tmp = fma(z, t, Float64(b * a)); else tmp = Float64(y * x); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(x * y), $MachinePrecision], -5e+195], N[(y * x), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+124], N[(z * t + N[(b * a), $MachinePrecision]), $MachinePrecision], N[(y * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+195}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+124}:\\
\;\;\;\;\mathsf{fma}\left(z, t, b \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\end{array}
if (*.f64 x y) < -4.9999999999999998e195 or 1.9999999999999999e124 < (*.f64 x y) Initial program 89.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6468.7
Applied rewrites68.7%
if -4.9999999999999998e195 < (*.f64 x y) < 1.9999999999999999e124Initial program 97.7%
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6498.8
Applied rewrites98.8%
Taylor expanded in c around 0
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6470.8
Applied rewrites70.8%
Taylor expanded in x around 0
associate-+r+N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6461.2
Applied rewrites61.2%
lift-*.f64N/A
lift-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-*.f6461.3
Applied rewrites61.3%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* x y) -5e+195) (* y x) (if (<= (* x y) 2e+124) (fma b a (* t z)) (* y x))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((x * y) <= -5e+195) {
tmp = y * x;
} else if ((x * y) <= 2e+124) {
tmp = fma(b, a, (t * z));
} else {
tmp = y * x;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(x * y) <= -5e+195) tmp = Float64(y * x); elseif (Float64(x * y) <= 2e+124) tmp = fma(b, a, Float64(t * z)); else tmp = Float64(y * x); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(x * y), $MachinePrecision], -5e+195], N[(y * x), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+124], N[(b * a + N[(t * z), $MachinePrecision]), $MachinePrecision], N[(y * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+195}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+124}:\\
\;\;\;\;\mathsf{fma}\left(b, a, t \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\end{array}
if (*.f64 x y) < -4.9999999999999998e195 or 1.9999999999999999e124 < (*.f64 x y) Initial program 89.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6468.7
Applied rewrites68.7%
if -4.9999999999999998e195 < (*.f64 x y) < 1.9999999999999999e124Initial program 97.7%
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6498.8
Applied rewrites98.8%
Taylor expanded in c around 0
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6470.8
Applied rewrites70.8%
Taylor expanded in x around 0
associate-+r+N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6461.2
Applied rewrites61.2%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* x y) -1e+85)
(* y x)
(if (<= (* x y) -5e-25)
(* t z)
(if (<= (* x y) -5e-177)
(* b a)
(if (<= (* x y) -5e-281)
(* i c)
(if (<= (* x y) 1e-196)
(* t z)
(if (<= (* x y) 2e+124) (* b a) (* y x))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((x * y) <= -1e+85) {
tmp = y * x;
} else if ((x * y) <= -5e-25) {
tmp = t * z;
} else if ((x * y) <= -5e-177) {
tmp = b * a;
} else if ((x * y) <= -5e-281) {
tmp = i * c;
} else if ((x * y) <= 1e-196) {
tmp = t * z;
} else if ((x * y) <= 2e+124) {
tmp = b * a;
} else {
tmp = y * x;
}
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 ((x * y) <= (-1d+85)) then
tmp = y * x
else if ((x * y) <= (-5d-25)) then
tmp = t * z
else if ((x * y) <= (-5d-177)) then
tmp = b * a
else if ((x * y) <= (-5d-281)) then
tmp = i * c
else if ((x * y) <= 1d-196) then
tmp = t * z
else if ((x * y) <= 2d+124) then
tmp = b * a
else
tmp = y * x
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 ((x * y) <= -1e+85) {
tmp = y * x;
} else if ((x * y) <= -5e-25) {
tmp = t * z;
} else if ((x * y) <= -5e-177) {
tmp = b * a;
} else if ((x * y) <= -5e-281) {
tmp = i * c;
} else if ((x * y) <= 1e-196) {
tmp = t * z;
} else if ((x * y) <= 2e+124) {
tmp = b * a;
} else {
tmp = y * x;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (x * y) <= -1e+85: tmp = y * x elif (x * y) <= -5e-25: tmp = t * z elif (x * y) <= -5e-177: tmp = b * a elif (x * y) <= -5e-281: tmp = i * c elif (x * y) <= 1e-196: tmp = t * z elif (x * y) <= 2e+124: tmp = b * a else: tmp = y * x return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(x * y) <= -1e+85) tmp = Float64(y * x); elseif (Float64(x * y) <= -5e-25) tmp = Float64(t * z); elseif (Float64(x * y) <= -5e-177) tmp = Float64(b * a); elseif (Float64(x * y) <= -5e-281) tmp = Float64(i * c); elseif (Float64(x * y) <= 1e-196) tmp = Float64(t * z); elseif (Float64(x * y) <= 2e+124) tmp = Float64(b * a); else tmp = Float64(y * x); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((x * y) <= -1e+85) tmp = y * x; elseif ((x * y) <= -5e-25) tmp = t * z; elseif ((x * y) <= -5e-177) tmp = b * a; elseif ((x * y) <= -5e-281) tmp = i * c; elseif ((x * y) <= 1e-196) tmp = t * z; elseif ((x * y) <= 2e+124) tmp = b * a; else tmp = y * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(x * y), $MachinePrecision], -1e+85], N[(y * x), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -5e-25], N[(t * z), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -5e-177], N[(b * a), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -5e-281], N[(i * c), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e-196], N[(t * z), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+124], N[(b * a), $MachinePrecision], N[(y * x), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+85}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{-25}:\\
\;\;\;\;t \cdot z\\
\mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{-177}:\\
\;\;\;\;b \cdot a\\
\mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{-281}:\\
\;\;\;\;i \cdot c\\
\mathbf{elif}\;x \cdot y \leq 10^{-196}:\\
\;\;\;\;t \cdot z\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+124}:\\
\;\;\;\;b \cdot a\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\end{array}
if (*.f64 x y) < -1e85 or 1.9999999999999999e124 < (*.f64 x y) Initial program 91.4%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6462.0
Applied rewrites62.0%
if -1e85 < (*.f64 x y) < -4.99999999999999962e-25 or -4.9999999999999998e-281 < (*.f64 x y) < 1e-196Initial program 97.6%
Taylor expanded in z around inf
lower-*.f6434.1
Applied rewrites34.1%
if -4.99999999999999962e-25 < (*.f64 x y) < -5e-177 or 1e-196 < (*.f64 x y) < 1.9999999999999999e124Initial program 97.9%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6430.9
Applied rewrites30.9%
if -5e-177 < (*.f64 x y) < -4.9999999999999998e-281Initial program 97.2%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f6434.0
Applied rewrites34.0%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* a b) -2e+114)
(* b a)
(if (<= (* a b) -5e-320)
(* t z)
(if (<= (* a b) 2e-42) (* i c) (if (<= (* a b) 1e+73) (* t z) (* 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+114) {
tmp = b * a;
} else if ((a * b) <= -5e-320) {
tmp = t * z;
} else if ((a * b) <= 2e-42) {
tmp = i * c;
} else if ((a * b) <= 1e+73) {
tmp = t * z;
} 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+114)) then
tmp = b * a
else if ((a * b) <= (-5d-320)) then
tmp = t * z
else if ((a * b) <= 2d-42) then
tmp = i * c
else if ((a * b) <= 1d+73) then
tmp = t * z
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+114) {
tmp = b * a;
} else if ((a * b) <= -5e-320) {
tmp = t * z;
} else if ((a * b) <= 2e-42) {
tmp = i * c;
} else if ((a * b) <= 1e+73) {
tmp = t * z;
} else {
tmp = b * a;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (a * b) <= -2e+114: tmp = b * a elif (a * b) <= -5e-320: tmp = t * z elif (a * b) <= 2e-42: tmp = i * c elif (a * b) <= 1e+73: tmp = t * z else: tmp = b * a return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(a * b) <= -2e+114) tmp = Float64(b * a); elseif (Float64(a * b) <= -5e-320) tmp = Float64(t * z); elseif (Float64(a * b) <= 2e-42) tmp = Float64(i * c); elseif (Float64(a * b) <= 1e+73) tmp = Float64(t * z); 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+114) tmp = b * a; elseif ((a * b) <= -5e-320) tmp = t * z; elseif ((a * b) <= 2e-42) tmp = i * c; elseif ((a * b) <= 1e+73) tmp = t * z; 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+114], N[(b * a), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -5e-320], N[(t * z), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 2e-42], N[(i * c), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1e+73], N[(t * z), $MachinePrecision], N[(b * a), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -2 \cdot 10^{+114}:\\
\;\;\;\;b \cdot a\\
\mathbf{elif}\;a \cdot b \leq -5 \cdot 10^{-320}:\\
\;\;\;\;t \cdot z\\
\mathbf{elif}\;a \cdot b \leq 2 \cdot 10^{-42}:\\
\;\;\;\;i \cdot c\\
\mathbf{elif}\;a \cdot b \leq 10^{+73}:\\
\;\;\;\;t \cdot z\\
\mathbf{else}:\\
\;\;\;\;b \cdot a\\
\end{array}
\end{array}
if (*.f64 a b) < -2e114 or 9.99999999999999983e72 < (*.f64 a b) Initial program 92.1%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6461.9
Applied rewrites61.9%
if -2e114 < (*.f64 a b) < -4.99994e-320 or 2.00000000000000008e-42 < (*.f64 a b) < 9.99999999999999983e72Initial program 97.7%
Taylor expanded in z around inf
lower-*.f6433.4
Applied rewrites33.4%
if -4.99994e-320 < (*.f64 a b) < 2.00000000000000008e-42Initial program 97.3%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f6433.7
Applied rewrites33.7%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* a b) -1e+106) (* b a) (if (<= (* a b) 1e+51) (* 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) <= -1e+106) {
tmp = b * a;
} else if ((a * b) <= 1e+51) {
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) <= (-1d+106)) then
tmp = b * a
else if ((a * b) <= 1d+51) 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) <= -1e+106) {
tmp = b * a;
} else if ((a * b) <= 1e+51) {
tmp = i * c;
} else {
tmp = b * a;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (a * b) <= -1e+106: tmp = b * a elif (a * b) <= 1e+51: 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) <= -1e+106) tmp = Float64(b * a); elseif (Float64(a * b) <= 1e+51) 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) <= -1e+106) tmp = b * a; elseif ((a * b) <= 1e+51) 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], -1e+106], N[(b * a), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1e+51], N[(i * c), $MachinePrecision], N[(b * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+106}:\\
\;\;\;\;b \cdot a\\
\mathbf{elif}\;a \cdot b \leq 10^{+51}:\\
\;\;\;\;i \cdot c\\
\mathbf{else}:\\
\;\;\;\;b \cdot a\\
\end{array}
\end{array}
if (*.f64 a b) < -1.00000000000000009e106 or 1e51 < (*.f64 a b) Initial program 92.4%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6459.6
Applied rewrites59.6%
if -1.00000000000000009e106 < (*.f64 a b) < 1e51Initial program 97.5%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f6432.8
Applied rewrites32.8%
(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.6%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6427.7
Applied rewrites27.7%
herbie shell --seed 2025117
(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)))