
(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 (if (<= (+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)) INFINITY) (fma i c (fma b a (fma t z (* y x)))) (fma i c (fma b a (* z t)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((((x * y) + (z * t)) + (a * b)) + (c * i)) <= ((double) INFINITY)) {
tmp = fma(i, c, fma(b, a, fma(t, z, (y * x))));
} else {
tmp = fma(i, c, fma(b, a, (z * t)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) + Float64(c * i)) <= Inf) tmp = fma(i, c, fma(b, a, fma(t, z, Float64(y * x)))); else tmp = fma(i, c, fma(b, a, Float64(z * t))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], Infinity], N[(i * c + N[(b * a + N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(i * c + N[(b * a + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(i, c, \mathsf{fma}\left(b, a, \mathsf{fma}\left(t, z, y \cdot x\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(i, c, \mathsf{fma}\left(b, a, z \cdot t\right)\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) (*.f64 c i)) < +inf.0Initial program 100.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-*.f64100.0
Applied rewrites100.0%
if +inf.0 < (+.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) (*.f64 c i)) Initial program 0.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-*.f6446.3
Applied rewrites46.3%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f6449.4
Applied rewrites49.4%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* x y) -5e+188)
(* y x)
(if (<= (* x y) -2e+42)
(* b a)
(if (<= (* x y) 5e-150)
(* i c)
(if (<= (* x y) 2e+96) (* 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+188) {
tmp = y * x;
} else if ((x * y) <= -2e+42) {
tmp = b * a;
} else if ((x * y) <= 5e-150) {
tmp = i * c;
} else if ((x * y) <= 2e+96) {
tmp = t * z;
} 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) <= (-5d+188)) then
tmp = y * x
else if ((x * y) <= (-2d+42)) then
tmp = b * a
else if ((x * y) <= 5d-150) then
tmp = i * c
else if ((x * y) <= 2d+96) then
tmp = t * z
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) <= -5e+188) {
tmp = y * x;
} else if ((x * y) <= -2e+42) {
tmp = b * a;
} else if ((x * y) <= 5e-150) {
tmp = i * c;
} else if ((x * y) <= 2e+96) {
tmp = t * z;
} else {
tmp = y * x;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (x * y) <= -5e+188: tmp = y * x elif (x * y) <= -2e+42: tmp = b * a elif (x * y) <= 5e-150: tmp = i * c elif (x * y) <= 2e+96: tmp = 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+188) tmp = Float64(y * x); elseif (Float64(x * y) <= -2e+42) tmp = Float64(b * a); elseif (Float64(x * y) <= 5e-150) tmp = Float64(i * c); elseif (Float64(x * y) <= 2e+96) tmp = Float64(t * z); 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) <= -5e+188) tmp = y * x; elseif ((x * y) <= -2e+42) tmp = b * a; elseif ((x * y) <= 5e-150) tmp = i * c; elseif ((x * y) <= 2e+96) tmp = t * z; else tmp = y * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(x * y), $MachinePrecision], -5e+188], N[(y * x), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -2e+42], N[(b * a), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e-150], N[(i * c), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+96], N[(t * z), $MachinePrecision], N[(y * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+188}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;x \cdot y \leq -2 \cdot 10^{+42}:\\
\;\;\;\;b \cdot a\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-150}:\\
\;\;\;\;i \cdot c\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+96}:\\
\;\;\;\;t \cdot z\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\end{array}
if (*.f64 x y) < -5.0000000000000001e188 or 2.0000000000000001e96 < (*.f64 x y) Initial program 91.3%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6465.4
Applied rewrites65.4%
if -5.0000000000000001e188 < (*.f64 x y) < -2.00000000000000009e42Initial program 98.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6424.9
Applied rewrites24.9%
if -2.00000000000000009e42 < (*.f64 x y) < 4.9999999999999999e-150Initial program 97.2%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f6435.3
Applied rewrites35.3%
if 4.9999999999999999e-150 < (*.f64 x y) < 2.0000000000000001e96Initial program 97.7%
Taylor expanded in z around inf
lower-*.f6431.1
Applied rewrites31.1%
(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 -2e+158) t_1 (if (<= t_2 2e+129) (fma i c (* a b)) 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 <= -2e+158) {
tmp = t_1;
} else if (t_2 <= 2e+129) {
tmp = fma(i, c, (a * b));
} 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 <= -2e+158) tmp = t_1; elseif (t_2 <= 2e+129) tmp = fma(i, c, Float64(a * b)); 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, -2e+158], t$95$1, If[LessEqual[t$95$2, 2e+129], N[(i * c + N[(a * b), $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 -2 \cdot 10^{+158}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+129}:\\
\;\;\;\;\mathsf{fma}\left(i, c, a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (*.f64 x y) (*.f64 z t)) < -1.99999999999999991e158 or 2e129 < (+.f64 (*.f64 x y) (*.f64 z t)) Initial program 92.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-*.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.3
Applied rewrites87.3%
Taylor expanded in z around inf
lower-*.f6477.2
Applied rewrites77.2%
if -1.99999999999999991e158 < (+.f64 (*.f64 x y) (*.f64 z t)) < 2e129Initial program 99.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6476.3
Applied rewrites76.3%
lift-+.f64N/A
lift-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6476.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6476.8
Applied rewrites76.8%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma x y (fma z t (* a b)))))
(if (<= (* a b) -2e+116)
t_1
(if (<= (* a b) 5e-10) (fma i c (fma x y (* z t))) 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 ((a * b) <= -2e+116) {
tmp = t_1;
} else if ((a * b) <= 5e-10) {
tmp = fma(i, c, fma(x, y, (z * t)));
} 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(a * b) <= -2e+116) tmp = t_1; elseif (Float64(a * b) <= 5e-10) tmp = fma(i, c, fma(x, y, Float64(z * t))); 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[(a * b), $MachinePrecision], -2e+116], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 5e-10], N[(i * c + N[(x * y + N[(z * t), $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}\;a \cdot b \leq -2 \cdot 10^{+116}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{-10}:\\
\;\;\;\;\mathsf{fma}\left(i, c, \mathsf{fma}\left(x, y, z \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 a b) < -2.00000000000000003e116 or 5.00000000000000031e-10 < (*.f64 a b) Initial program 92.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-*.f6496.3
Applied rewrites96.3%
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-*.f6483.6
Applied rewrites83.6%
if -2.00000000000000003e116 < (*.f64 a b) < 5.00000000000000031e-10Initial 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.7
Applied rewrites98.7%
Taylor expanded in a around 0
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6492.7
Applied rewrites92.7%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma x y (fma z t (* a b)))))
(if (<= (* a b) -2e+116)
t_1
(if (<= (* a b) 5e-10) (fma i c (fma t z (* 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(x, y, fma(z, t, (a * b)));
double tmp;
if ((a * b) <= -2e+116) {
tmp = t_1;
} else if ((a * b) <= 5e-10) {
tmp = fma(i, c, fma(t, z, (y * x)));
} 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(a * b) <= -2e+116) tmp = t_1; elseif (Float64(a * b) <= 5e-10) tmp = fma(i, c, fma(t, z, 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[(x * y + N[(z * t + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -2e+116], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 5e-10], N[(i * c + N[(t * z + N[(y * x), $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}\;a \cdot b \leq -2 \cdot 10^{+116}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{-10}:\\
\;\;\;\;\mathsf{fma}\left(i, c, \mathsf{fma}\left(t, z, y \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 a b) < -2.00000000000000003e116 or 5.00000000000000031e-10 < (*.f64 a b) Initial program 92.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-*.f6496.3
Applied rewrites96.3%
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-*.f6483.6
Applied rewrites83.6%
if -2.00000000000000003e116 < (*.f64 a b) < 5.00000000000000031e-10Initial program 97.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-*.f6492.7
Applied rewrites92.7%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma t z (* y x))))
(if (<= (* a b) -1e+238)
(fma b a (* t z))
(if (<= (* a b) 5e-10) (fma i c t_1) (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 ((a * b) <= -1e+238) {
tmp = fma(b, a, (t * z));
} else if ((a * b) <= 5e-10) {
tmp = fma(i, c, t_1);
} 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(a * b) <= -1e+238) tmp = fma(b, a, Float64(t * z)); elseif (Float64(a * b) <= 5e-10) tmp = fma(i, c, t_1); 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[(a * b), $MachinePrecision], -1e+238], N[(b * a + N[(t * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 5e-10], N[(i * c + t$95$1), $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}\;a \cdot b \leq -1 \cdot 10^{+238}:\\
\;\;\;\;\mathsf{fma}\left(b, a, t \cdot z\right)\\
\mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{-10}:\\
\;\;\;\;\mathsf{fma}\left(i, c, t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b, a, t\_1\right)\\
\end{array}
\end{array}
if (*.f64 a b) < -1e238Initial program 86.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-*.f6492.5
Applied rewrites92.5%
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-*.f6491.1
Applied rewrites91.1%
Taylor expanded in x around 0
associate-+r+N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6486.3
Applied rewrites86.3%
if -1e238 < (*.f64 a b) < 5.00000000000000031e-10Initial program 97.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-*.f6488.8
Applied rewrites88.8%
if 5.00000000000000031e-10 < (*.f64 a b) Initial program 94.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-*.f6481.1
Applied rewrites81.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) -2e-17)
t_1
(if (<= (* x y) 1e+32) (fma b a (fma i c (* t z))) 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) <= -2e-17) {
tmp = t_1;
} else if ((x * y) <= 1e+32) {
tmp = fma(b, a, fma(i, c, (t * z)));
} 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) <= -2e-17) tmp = t_1; elseif (Float64(x * y) <= 1e+32) tmp = fma(b, a, fma(i, c, Float64(t * z))); 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], -2e-17], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 1e+32], N[(b * a + N[(i * c + N[(t * z), $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 -2 \cdot 10^{-17}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 10^{+32}:\\
\;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, t \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 x y) < -2.00000000000000014e-17 or 1.00000000000000005e32 < (*.f64 x y) Initial program 93.8%
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-*.f6481.9
Applied rewrites81.9%
if -2.00000000000000014e-17 < (*.f64 x y) < 1.00000000000000005e32Initial program 97.3%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6495.0
Applied rewrites95.0%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma x y (* t z))))
(if (<= (* x y) -5e+188)
t_1
(if (<= (* x y) 2e+158) (fma b a (fma i c (* t z))) 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 tmp;
if ((x * y) <= -5e+188) {
tmp = t_1;
} else if ((x * y) <= 2e+158) {
tmp = fma(b, a, fma(i, c, (t * z)));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(x, y, Float64(t * z)) tmp = 0.0 if (Float64(x * y) <= -5e+188) tmp = t_1; elseif (Float64(x * y) <= 2e+158) tmp = fma(b, a, fma(i, c, Float64(t * z))); 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]}, If[LessEqual[N[(x * y), $MachinePrecision], -5e+188], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 2e+158], N[(b * a + N[(i * c + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(x, y, t \cdot z\right)\\
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+188}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+158}:\\
\;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, t \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 x y) < -5.0000000000000001e188 or 1.99999999999999991e158 < (*.f64 x y) Initial program 90.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-*.f6494.7
Applied rewrites94.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-*.f6488.9
Applied rewrites88.9%
Taylor expanded in z around inf
lower-*.f6480.1
Applied rewrites80.1%
if -5.0000000000000001e188 < (*.f64 x y) < 1.99999999999999991e158Initial program 97.4%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6488.7
Applied rewrites88.7%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* z t) -5e+113) (* t z) (if (<= (* z t) 0.0) (* b a) (if (<= (* z t) 1e+95) (* 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) <= -5e+113) {
tmp = t * z;
} else if ((z * t) <= 0.0) {
tmp = b * a;
} else if ((z * t) <= 1e+95) {
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) <= (-5d+113)) then
tmp = t * z
else if ((z * t) <= 0.0d0) then
tmp = b * a
else if ((z * t) <= 1d+95) 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) <= -5e+113) {
tmp = t * z;
} else if ((z * t) <= 0.0) {
tmp = b * a;
} else if ((z * t) <= 1e+95) {
tmp = i * c;
} else {
tmp = t * z;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (z * t) <= -5e+113: tmp = t * z elif (z * t) <= 0.0: tmp = b * a elif (z * t) <= 1e+95: 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) <= -5e+113) tmp = Float64(t * z); elseif (Float64(z * t) <= 0.0) tmp = Float64(b * a); elseif (Float64(z * t) <= 1e+95) 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) <= -5e+113) tmp = t * z; elseif ((z * t) <= 0.0) tmp = b * a; elseif ((z * t) <= 1e+95) 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], -5e+113], N[(t * z), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 0.0], N[(b * a), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1e+95], N[(i * c), $MachinePrecision], N[(t * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+113}:\\
\;\;\;\;t \cdot z\\
\mathbf{elif}\;z \cdot t \leq 0:\\
\;\;\;\;b \cdot a\\
\mathbf{elif}\;z \cdot t \leq 10^{+95}:\\
\;\;\;\;i \cdot c\\
\mathbf{else}:\\
\;\;\;\;t \cdot z\\
\end{array}
\end{array}
if (*.f64 z t) < -5e113 or 1.00000000000000002e95 < (*.f64 z t) Initial program 91.8%
Taylor expanded in z around inf
lower-*.f6463.0
Applied rewrites63.0%
if -5e113 < (*.f64 z t) < -0.0Initial program 97.7%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6434.4
Applied rewrites34.4%
if -0.0 < (*.f64 z t) < 1.00000000000000002e95Initial program 97.6%
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 (<= (* z t) -2e+126) (fma x y (* t z)) (if (<= (* z t) 1e+95) (fma x y (* b a)) (fma b a (* 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) <= -2e+126) {
tmp = fma(x, y, (t * z));
} else if ((z * t) <= 1e+95) {
tmp = fma(x, y, (b * a));
} else {
tmp = fma(b, a, (t * z));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(z * t) <= -2e+126) tmp = fma(x, y, Float64(t * z)); elseif (Float64(z * t) <= 1e+95) tmp = fma(x, y, Float64(b * a)); else tmp = fma(b, a, Float64(t * z)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(z * t), $MachinePrecision], -2e+126], N[(x * y + N[(t * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1e+95], N[(x * y + N[(b * a), $MachinePrecision]), $MachinePrecision], N[(b * a + N[(t * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+126}:\\
\;\;\;\;\mathsf{fma}\left(x, y, t \cdot z\right)\\
\mathbf{elif}\;z \cdot t \leq 10^{+95}:\\
\;\;\;\;\mathsf{fma}\left(x, y, b \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b, a, t \cdot z\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -1.99999999999999985e126Initial program 93.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-*.f6496.5
Applied rewrites96.5%
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.4
Applied rewrites86.4%
Taylor expanded in z around inf
lower-*.f6477.7
Applied rewrites77.7%
if -1.99999999999999985e126 < (*.f64 z t) < 1.00000000000000002e95Initial 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.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.9
Applied rewrites68.9%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f6462.2
Applied rewrites62.2%
if 1.00000000000000002e95 < (*.f64 z t) Initial program 90.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-*.f6494.6
Applied rewrites94.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.2
Applied rewrites85.2%
Taylor expanded in x around 0
associate-+r+N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6473.5
Applied rewrites73.5%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma b a (* t z))))
(if (<= (* z t) -2e+126)
t_1
(if (<= (* z t) 1e+95) (fma x y (* 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(b, a, (t * z));
double tmp;
if ((z * t) <= -2e+126) {
tmp = t_1;
} else if ((z * t) <= 1e+95) {
tmp = fma(x, y, (b * a));
} 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) <= -2e+126) tmp = t_1; elseif (Float64(z * t) <= 1e+95) tmp = fma(x, y, Float64(b * a)); 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], -2e+126], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 1e+95], N[(x * y + N[(b * a), $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 -2 \cdot 10^{+126}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq 10^{+95}:\\
\;\;\;\;\mathsf{fma}\left(x, y, b \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -1.99999999999999985e126 or 1.00000000000000002e95 < (*.f64 z t) Initial program 91.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-*.f6495.5
Applied rewrites95.5%
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.8
Applied rewrites85.8%
Taylor expanded in x around 0
associate-+r+N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6474.9
Applied rewrites74.9%
if -1.99999999999999985e126 < (*.f64 z t) < 1.00000000000000002e95Initial 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.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.9
Applied rewrites68.9%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f6462.2
Applied rewrites62.2%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* x y) -5e+206) (* y x) (if (<= (* x y) 1e+137) (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+206) {
tmp = y * x;
} else if ((x * y) <= 1e+137) {
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+206) tmp = Float64(y * x); elseif (Float64(x * y) <= 1e+137) 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+206], N[(y * x), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+137], 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^{+206}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;x \cdot y \leq 10^{+137}:\\
\;\;\;\;\mathsf{fma}\left(b, a, t \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\end{array}
if (*.f64 x y) < -5.0000000000000002e206 or 1e137 < (*.f64 x y) Initial program 90.3%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6470.0
Applied rewrites70.0%
if -5.0000000000000002e206 < (*.f64 x y) < 1e137Initial program 97.5%
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.6
Applied rewrites98.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-*.f6469.7
Applied rewrites69.7%
Taylor expanded in x around 0
associate-+r+N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6460.3
Applied rewrites60.3%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* a b) -2e+116) (* b a) (if (<= (* a b) 10.0) (* 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+116) {
tmp = b * a;
} else if ((a * b) <= 10.0) {
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+116)) then
tmp = b * a
else if ((a * b) <= 10.0d0) 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+116) {
tmp = b * a;
} else if ((a * b) <= 10.0) {
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+116: tmp = b * a elif (a * b) <= 10.0: 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+116) tmp = Float64(b * a); elseif (Float64(a * b) <= 10.0) 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+116) tmp = b * a; elseif ((a * b) <= 10.0) 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+116], N[(b * a), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 10.0], N[(i * c), $MachinePrecision], N[(b * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -2 \cdot 10^{+116}:\\
\;\;\;\;b \cdot a\\
\mathbf{elif}\;a \cdot b \leq 10:\\
\;\;\;\;i \cdot c\\
\mathbf{else}:\\
\;\;\;\;b \cdot a\\
\end{array}
\end{array}
if (*.f64 a b) < -2.00000000000000003e116 or 10 < (*.f64 a b) Initial program 92.8%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6456.0
Applied rewrites56.0%
if -2.00000000000000003e116 < (*.f64 a b) < 10Initial program 97.6%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f6434.1
Applied rewrites34.1%
(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.9
Applied rewrites27.9%
herbie shell --seed 2025091
(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)))