
(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 (let* ((t_1 (+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))) (if (<= t_1 INFINITY) t_1 (fma i c (* t z)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (((x * y) + (z * t)) + (a * b)) + (c * i);
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = fma(i, c, (t * z));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) + Float64(c * i)) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = fma(i, c, Float64(t * z)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(i * c + N[(t * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(i, c, t \cdot z\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%
if +inf.0 < (+.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) (*.f64 c i)) Initial program 0.0%
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-*.f6448.4
Applied rewrites48.4%
Taylor expanded in x around 0
lower-*.f6445.1
Applied rewrites45.1%
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (fma t z (* y x))) (t_2 (fma b a t_1))) (if (<= (* a b) -1.0) t_2 (if (<= (* a b) 5e+64) (fma i c t_1) t_2))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(t, z, (y * x));
double t_2 = fma(b, a, t_1);
double tmp;
if ((a * b) <= -1.0) {
tmp = t_2;
} else if ((a * b) <= 5e+64) {
tmp = fma(i, c, t_1);
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(t, z, Float64(y * x)) t_2 = fma(b, a, t_1) tmp = 0.0 if (Float64(a * b) <= -1.0) tmp = t_2; elseif (Float64(a * b) <= 5e+64) tmp = fma(i, c, t_1); else tmp = t_2; 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]}, Block[{t$95$2 = N[(b * a + t$95$1), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -1.0], t$95$2, If[LessEqual[N[(a * b), $MachinePrecision], 5e+64], N[(i * c + t$95$1), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t, z, y \cdot x\right)\\
t_2 := \mathsf{fma}\left(b, a, t\_1\right)\\
\mathbf{if}\;a \cdot b \leq -1:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{+64}:\\
\;\;\;\;\mathsf{fma}\left(i, c, t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 a b) < -1 or 5e64 < (*.f64 a b) Initial program 93.3%
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.3
Applied rewrites83.3%
if -1 < (*.f64 a b) < 5e64Initial program 97.9%
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-*.f6493.7
Applied rewrites93.7%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma b a (fma i c (* y x)))))
(if (<= (* c i) -1e+90)
t_1
(if (<= (* c i) 2e+81) (fma b a (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(b, a, fma(i, c, (y * x)));
double tmp;
if ((c * i) <= -1e+90) {
tmp = t_1;
} else if ((c * i) <= 2e+81) {
tmp = fma(b, a, fma(t, z, (y * x)));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(b, a, fma(i, c, Float64(y * x))) tmp = 0.0 if (Float64(c * i) <= -1e+90) tmp = t_1; elseif (Float64(c * i) <= 2e+81) tmp = fma(b, a, 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[(b * a + N[(i * c + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(c * i), $MachinePrecision], -1e+90], t$95$1, If[LessEqual[N[(c * i), $MachinePrecision], 2e+81], N[(b * a + N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, y \cdot x\right)\right)\\
\mathbf{if}\;c \cdot i \leq -1 \cdot 10^{+90}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;c \cdot i \leq 2 \cdot 10^{+81}:\\
\;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(t, z, y \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 c i) < -9.99999999999999966e89 or 1.99999999999999984e81 < (*.f64 c i) Initial program 92.4%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6485.4
Applied rewrites85.4%
if -9.99999999999999966e89 < (*.f64 c i) < 1.99999999999999984e81Initial program 97.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-*.f6492.4
Applied rewrites92.4%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma i c (* t z))))
(if (<= (* z t) -2e+188)
t_1
(if (<= (* z t) 5e+165) (fma b a (fma i c (* y x))) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(i, c, (t * z));
double tmp;
if ((z * t) <= -2e+188) {
tmp = t_1;
} else if ((z * t) <= 5e+165) {
tmp = fma(b, a, fma(i, c, (y * x)));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(i, c, Float64(t * z)) tmp = 0.0 if (Float64(z * t) <= -2e+188) tmp = t_1; elseif (Float64(z * t) <= 5e+165) tmp = fma(b, a, fma(i, c, Float64(y * x))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(i * c + N[(t * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -2e+188], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 5e+165], N[(b * a + N[(i * c + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(i, c, t \cdot z\right)\\
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+188}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+165}:\\
\;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, y \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -2e188 or 4.9999999999999997e165 < (*.f64 z t) Initial program 89.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-*.f6486.7
Applied rewrites86.7%
Taylor expanded in x around 0
lower-*.f6479.5
Applied rewrites79.5%
if -2e188 < (*.f64 z t) < 4.9999999999999997e165Initial program 97.9%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6488.3
Applied rewrites88.3%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* z t) -1e+34)
(fma b a (* t z))
(if (<= (* z t) -1e-223)
(fma i c (* y x))
(if (<= (* z t) 5e+165) (fma b a (* y x)) (fma i c (* t z))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((z * t) <= -1e+34) {
tmp = fma(b, a, (t * z));
} else if ((z * t) <= -1e-223) {
tmp = fma(i, c, (y * x));
} else if ((z * t) <= 5e+165) {
tmp = fma(b, a, (y * x));
} else {
tmp = fma(i, c, (t * z));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(z * t) <= -1e+34) tmp = fma(b, a, Float64(t * z)); elseif (Float64(z * t) <= -1e-223) tmp = fma(i, c, Float64(y * x)); elseif (Float64(z * t) <= 5e+165) tmp = fma(b, a, Float64(y * x)); else tmp = fma(i, c, Float64(t * z)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(z * t), $MachinePrecision], -1e+34], N[(b * a + N[(t * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], -1e-223], N[(i * c + N[(y * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e+165], N[(b * a + N[(y * x), $MachinePrecision]), $MachinePrecision], N[(i * c + N[(t * z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+34}:\\
\;\;\;\;\mathsf{fma}\left(b, a, t \cdot z\right)\\
\mathbf{elif}\;z \cdot t \leq -1 \cdot 10^{-223}:\\
\;\;\;\;\mathsf{fma}\left(i, c, y \cdot x\right)\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+165}:\\
\;\;\;\;\mathsf{fma}\left(b, a, y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(i, c, t \cdot z\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -9.99999999999999946e33Initial program 93.4%
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-*.f6480.6
Applied rewrites80.6%
Taylor expanded in x around 0
lift-*.f6466.4
Applied rewrites66.4%
if -9.99999999999999946e33 < (*.f64 z t) < -9.9999999999999997e-224Initial program 98.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6458.1
Applied rewrites58.1%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6458.5
Applied rewrites58.5%
if -9.9999999999999997e-224 < (*.f64 z t) < 4.9999999999999997e165Initial program 97.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-*.f6469.7
Applied rewrites69.7%
Taylor expanded in x around inf
*-commutativeN/A
lift-*.f6461.9
Applied rewrites61.9%
if 4.9999999999999997e165 < (*.f64 z t) Initial program 89.9%
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-*.f6487.2
Applied rewrites87.2%
Taylor expanded in x around 0
lower-*.f6478.8
Applied rewrites78.8%
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (fma t z (* y x))) (t_2 (+ (* x y) (* z t)))) (if (<= t_2 -1e+96) t_1 (if (<= t_2 1e+102) (fma i c (* 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 t_2 = (x * y) + (z * t);
double tmp;
if (t_2 <= -1e+96) {
tmp = t_1;
} else if (t_2 <= 1e+102) {
tmp = fma(i, c, (b * a));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(t, z, Float64(y * x)) t_2 = Float64(Float64(x * y) + Float64(z * t)) tmp = 0.0 if (t_2 <= -1e+96) tmp = t_1; elseif (t_2 <= 1e+102) tmp = fma(i, c, 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[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+96], t$95$1, If[LessEqual[t$95$2, 1e+102], N[(i * c + N[(b * a), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t, z, y \cdot x\right)\\
t_2 := x \cdot y + z \cdot t\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+96}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+102}:\\
\;\;\;\;\mathsf{fma}\left(i, c, b \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (*.f64 x y) (*.f64 z t)) < -1.00000000000000005e96 or 9.99999999999999977e101 < (+.f64 (*.f64 x y) (*.f64 z t)) Initial program 93.3%
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-*.f6485.1
Applied rewrites85.1%
Taylor expanded in a around 0
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-*.f6473.0
Applied rewrites73.0%
if -1.00000000000000005e96 < (+.f64 (*.f64 x y) (*.f64 z t)) < 9.99999999999999977e101Initial program 99.1%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6478.8
Applied rewrites78.8%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6479.1
Applied rewrites79.1%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma i c (* t z))))
(if (<= (* z t) -4e+142)
t_1
(if (<= (* z t) 5e+165) (fma b a (* 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(i, c, (t * z));
double tmp;
if ((z * t) <= -4e+142) {
tmp = t_1;
} else if ((z * t) <= 5e+165) {
tmp = fma(b, a, (y * x));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(i, c, Float64(t * z)) tmp = 0.0 if (Float64(z * t) <= -4e+142) tmp = t_1; elseif (Float64(z * t) <= 5e+165) tmp = fma(b, a, 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[(i * c + N[(t * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -4e+142], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 5e+165], N[(b * a + N[(y * x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(i, c, t \cdot z\right)\\
\mathbf{if}\;z \cdot t \leq -4 \cdot 10^{+142}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+165}:\\
\;\;\;\;\mathsf{fma}\left(b, a, y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -4.0000000000000002e142 or 4.9999999999999997e165 < (*.f64 z t) Initial program 90.4%
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-*.f6486.2
Applied rewrites86.2%
Taylor expanded in x around 0
lower-*.f6477.5
Applied rewrites77.5%
if -4.0000000000000002e142 < (*.f64 z t) < 4.9999999999999997e165Initial program 97.9%
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-*.f6470.7
Applied rewrites70.7%
Taylor expanded in x around inf
*-commutativeN/A
lift-*.f6461.3
Applied rewrites61.3%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* x y) -2e+100) (fma b a (* y x)) (if (<= (* x y) 4e+56) (fma b a (* t z)) (fma 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) <= -2e+100) {
tmp = fma(b, a, (y * x));
} else if ((x * y) <= 4e+56) {
tmp = fma(b, a, (t * z));
} else {
tmp = fma(t, z, (y * x));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(x * y) <= -2e+100) tmp = fma(b, a, Float64(y * x)); elseif (Float64(x * y) <= 4e+56) tmp = fma(b, a, Float64(t * z)); else tmp = fma(t, z, Float64(y * x)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(x * y), $MachinePrecision], -2e+100], N[(b * a + N[(y * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 4e+56], N[(b * a + N[(t * z), $MachinePrecision]), $MachinePrecision], N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+100}:\\
\;\;\;\;\mathsf{fma}\left(b, a, y \cdot x\right)\\
\mathbf{elif}\;x \cdot y \leq 4 \cdot 10^{+56}:\\
\;\;\;\;\mathsf{fma}\left(b, a, t \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t, z, y \cdot x\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -2.00000000000000003e100Initial program 91.5%
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-*.f6485.7
Applied rewrites85.7%
Taylor expanded in x around inf
*-commutativeN/A
lift-*.f6474.5
Applied rewrites74.5%
if -2.00000000000000003e100 < (*.f64 x y) < 4.00000000000000037e56Initial program 97.6%
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-*.f6469.4
Applied rewrites69.4%
Taylor expanded in x around 0
lift-*.f6463.8
Applied rewrites63.8%
if 4.00000000000000037e56 < (*.f64 x y) Initial program 93.9%
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.1
Applied rewrites84.1%
Taylor expanded in a around 0
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-*.f6472.4
Applied rewrites72.4%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma b a (* t z))))
(if (<= (* a b) -5e+90)
t_1
(if (<= (* a b) 5e+139) (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(b, a, (t * z));
double tmp;
if ((a * b) <= -5e+90) {
tmp = t_1;
} else if ((a * b) <= 5e+139) {
tmp = fma(t, z, (y * x));
} 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(a * b) <= -5e+90) tmp = t_1; elseif (Float64(a * b) <= 5e+139) tmp = 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[(b * a + N[(t * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -5e+90], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 5e+139], N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(b, a, t \cdot z\right)\\
\mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+90}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{+139}:\\
\;\;\;\;\mathsf{fma}\left(t, z, y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 a b) < -5.0000000000000004e90 or 5.0000000000000003e139 < (*.f64 a b) Initial program 91.9%
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-*.f6485.7
Applied rewrites85.7%
Taylor expanded in x around 0
lift-*.f6475.2
Applied rewrites75.2%
if -5.0000000000000004e90 < (*.f64 a b) < 5.0000000000000003e139Initial program 97.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-*.f6469.8
Applied rewrites69.8%
Taylor expanded in a around 0
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-*.f6461.9
Applied rewrites61.9%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* a b) -2e+205) (* b a) (if (<= (* a b) 1e+140) (fma t z (* y x)) (* 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+205) {
tmp = b * a;
} else if ((a * b) <= 1e+140) {
tmp = fma(t, z, (y * x));
} else {
tmp = b * a;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(a * b) <= -2e+205) tmp = Float64(b * a); elseif (Float64(a * b) <= 1e+140) tmp = fma(t, z, Float64(y * x)); else tmp = Float64(b * a); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(a * b), $MachinePrecision], -2e+205], N[(b * a), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1e+140], N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision], N[(b * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -2 \cdot 10^{+205}:\\
\;\;\;\;b \cdot a\\
\mathbf{elif}\;a \cdot b \leq 10^{+140}:\\
\;\;\;\;\mathsf{fma}\left(t, z, y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot a\\
\end{array}
\end{array}
if (*.f64 a b) < -2.00000000000000003e205 or 1.00000000000000006e140 < (*.f64 a b) Initial program 90.3%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6471.5
Applied rewrites71.5%
if -2.00000000000000003e205 < (*.f64 a b) < 1.00000000000000006e140Initial program 97.7%
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-*.f6470.7
Applied rewrites70.7%
Taylor expanded in a around 0
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-*.f6459.9
Applied rewrites59.9%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* z t) -1e+34)
(* t z)
(if (<= (* z t) -5e-115)
(* i c)
(if (<= (* z t) -1e-223)
(* y x)
(if (<= (* z t) 5e+120) (* 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) <= -1e+34) {
tmp = t * z;
} else if ((z * t) <= -5e-115) {
tmp = i * c;
} else if ((z * t) <= -1e-223) {
tmp = y * x;
} else if ((z * t) <= 5e+120) {
tmp = b * a;
} else {
tmp = t * z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if ((z * t) <= (-1d+34)) then
tmp = t * z
else if ((z * t) <= (-5d-115)) then
tmp = i * c
else if ((z * t) <= (-1d-223)) then
tmp = y * x
else if ((z * t) <= 5d+120) then
tmp = b * a
else
tmp = t * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((z * t) <= -1e+34) {
tmp = t * z;
} else if ((z * t) <= -5e-115) {
tmp = i * c;
} else if ((z * t) <= -1e-223) {
tmp = y * x;
} else if ((z * t) <= 5e+120) {
tmp = b * a;
} else {
tmp = t * z;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (z * t) <= -1e+34: tmp = t * z elif (z * t) <= -5e-115: tmp = i * c elif (z * t) <= -1e-223: tmp = y * x elif (z * t) <= 5e+120: tmp = b * a else: tmp = t * z return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(z * t) <= -1e+34) tmp = Float64(t * z); elseif (Float64(z * t) <= -5e-115) tmp = Float64(i * c); elseif (Float64(z * t) <= -1e-223) tmp = Float64(y * x); elseif (Float64(z * t) <= 5e+120) tmp = Float64(b * a); else tmp = Float64(t * z); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((z * t) <= -1e+34) tmp = t * z; elseif ((z * t) <= -5e-115) tmp = i * c; elseif ((z * t) <= -1e-223) tmp = y * x; elseif ((z * t) <= 5e+120) tmp = b * a; else tmp = t * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(z * t), $MachinePrecision], -1e+34], N[(t * z), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], -5e-115], N[(i * c), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], -1e-223], N[(y * x), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e+120], N[(b * a), $MachinePrecision], N[(t * z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+34}:\\
\;\;\;\;t \cdot z\\
\mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{-115}:\\
\;\;\;\;i \cdot c\\
\mathbf{elif}\;z \cdot t \leq -1 \cdot 10^{-223}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+120}:\\
\;\;\;\;b \cdot a\\
\mathbf{else}:\\
\;\;\;\;t \cdot z\\
\end{array}
\end{array}
if (*.f64 z t) < -9.99999999999999946e33 or 5.00000000000000019e120 < (*.f64 z t) Initial program 92.5%
Taylor expanded in z around inf
lower-*.f6457.2
Applied rewrites57.2%
if -9.99999999999999946e33 < (*.f64 z t) < -5.0000000000000003e-115Initial program 97.9%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f6428.4
Applied rewrites28.4%
if -5.0000000000000003e-115 < (*.f64 z t) < -9.9999999999999997e-224Initial program 98.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6436.1
Applied rewrites36.1%
if -9.9999999999999997e-224 < (*.f64 z t) < 5.00000000000000019e120Initial program 97.8%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6433.3
Applied rewrites33.3%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* z t) -1e+34) (* t z) (if (<= (* z t) -1e-223) (* i c) (if (<= (* z t) 5e+120) (* 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) <= -1e+34) {
tmp = t * z;
} else if ((z * t) <= -1e-223) {
tmp = i * c;
} else if ((z * t) <= 5e+120) {
tmp = b * a;
} else {
tmp = t * z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if ((z * t) <= (-1d+34)) then
tmp = t * z
else if ((z * t) <= (-1d-223)) then
tmp = i * c
else if ((z * t) <= 5d+120) then
tmp = b * a
else
tmp = t * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((z * t) <= -1e+34) {
tmp = t * z;
} else if ((z * t) <= -1e-223) {
tmp = i * c;
} else if ((z * t) <= 5e+120) {
tmp = b * a;
} else {
tmp = t * z;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (z * t) <= -1e+34: tmp = t * z elif (z * t) <= -1e-223: tmp = i * c elif (z * t) <= 5e+120: tmp = b * a else: tmp = t * z return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(z * t) <= -1e+34) tmp = Float64(t * z); elseif (Float64(z * t) <= -1e-223) tmp = Float64(i * c); elseif (Float64(z * t) <= 5e+120) tmp = Float64(b * a); else tmp = Float64(t * z); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((z * t) <= -1e+34) tmp = t * z; elseif ((z * t) <= -1e-223) tmp = i * c; elseif ((z * t) <= 5e+120) tmp = b * a; else tmp = t * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(z * t), $MachinePrecision], -1e+34], N[(t * z), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], -1e-223], N[(i * c), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e+120], N[(b * a), $MachinePrecision], N[(t * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+34}:\\
\;\;\;\;t \cdot z\\
\mathbf{elif}\;z \cdot t \leq -1 \cdot 10^{-223}:\\
\;\;\;\;i \cdot c\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+120}:\\
\;\;\;\;b \cdot a\\
\mathbf{else}:\\
\;\;\;\;t \cdot z\\
\end{array}
\end{array}
if (*.f64 z t) < -9.99999999999999946e33 or 5.00000000000000019e120 < (*.f64 z t) Initial program 92.5%
Taylor expanded in z around inf
lower-*.f6457.2
Applied rewrites57.2%
if -9.99999999999999946e33 < (*.f64 z t) < -9.9999999999999997e-224Initial program 98.0%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f6429.5
Applied rewrites29.5%
if -9.9999999999999997e-224 < (*.f64 z t) < 5.00000000000000019e120Initial program 97.8%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6433.3
Applied rewrites33.3%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* a b) -1.0) (* b a) (if (<= (* a b) 1e+66) (* 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) <= -1.0) {
tmp = b * a;
} else if ((a * b) <= 1e+66) {
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) <= (-1.0d0)) then
tmp = b * a
else if ((a * b) <= 1d+66) 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) <= -1.0) {
tmp = b * a;
} else if ((a * b) <= 1e+66) {
tmp = i * c;
} else {
tmp = b * a;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (a * b) <= -1.0: tmp = b * a elif (a * b) <= 1e+66: 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) <= -1.0) tmp = Float64(b * a); elseif (Float64(a * b) <= 1e+66) 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) <= -1.0) tmp = b * a; elseif ((a * b) <= 1e+66) 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], -1.0], N[(b * a), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1e+66], N[(i * c), $MachinePrecision], N[(b * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1:\\
\;\;\;\;b \cdot a\\
\mathbf{elif}\;a \cdot b \leq 10^{+66}:\\
\;\;\;\;i \cdot c\\
\mathbf{else}:\\
\;\;\;\;b \cdot a\\
\end{array}
\end{array}
if (*.f64 a b) < -1 or 9.99999999999999945e65 < (*.f64 a b) Initial program 93.3%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6453.9
Applied rewrites53.9%
if -1 < (*.f64 a b) < 9.99999999999999945e65Initial program 97.9%
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.8%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6428.1
Applied rewrites28.1%
herbie shell --seed 2025115
(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)))