
(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]
\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i
Herbie found 15 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]
\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i
(FPCore (x y z t a b c i) :precision binary64 (fma z t (fma i c (fma b a (* y x)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return fma(z, t, fma(i, c, fma(b, a, (y * x))));
}
function code(x, y, z, t, a, b, c, i) return fma(z, t, fma(i, c, fma(b, a, Float64(y * x)))) end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(z * t + N[(i * c + N[(b * a + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\mathsf{fma}\left(z, t, \mathsf{fma}\left(i, c, \mathsf{fma}\left(b, a, y \cdot x\right)\right)\right)
Initial program 95.7%
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
lower-fma.f64N/A
+-commutativeN/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
add-flipN/A
sub-flipN/A
lift-*.f64N/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f6497.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6497.8%
Applied rewrites97.8%
(FPCore (x y z t a b c i) :precision binary64 (fma y x (fma i c (fma b a (* t z)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return fma(y, x, fma(i, c, fma(b, a, (t * z))));
}
function code(x, y, z, t, a, b, c, i) return fma(y, x, fma(i, c, fma(b, a, Float64(t * z)))) end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(y * x + N[(i * c + N[(b * a + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\mathsf{fma}\left(y, x, \mathsf{fma}\left(i, c, \mathsf{fma}\left(b, a, t \cdot z\right)\right)\right)
Initial program 95.7%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
associate--l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
fp-cancel-sign-sub-invN/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6497.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6497.9%
Applied rewrites97.9%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* a b) -5e+74)
(fma x y (fma a b (* c i)))
(if (<= (* a b) 1e+86)
(fma c i (fma t z (* x y)))
(fma a b (fma c i (* t z))))))double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((a * b) <= -5e+74) {
tmp = fma(x, y, fma(a, b, (c * i)));
} else if ((a * b) <= 1e+86) {
tmp = fma(c, i, fma(t, z, (x * y)));
} else {
tmp = fma(a, b, fma(c, i, (t * z)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(a * b) <= -5e+74) tmp = fma(x, y, fma(a, b, Float64(c * i))); elseif (Float64(a * b) <= 1e+86) tmp = fma(c, i, fma(t, z, Float64(x * y))); else tmp = fma(a, b, fma(c, i, Float64(t * z))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(a * b), $MachinePrecision], -5e+74], N[(x * y + N[(a * b + N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1e+86], N[(c * i + N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * b + N[(c * i + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+74}:\\
\;\;\;\;\mathsf{fma}\left(x, y, \mathsf{fma}\left(a, b, c \cdot i\right)\right)\\
\mathbf{elif}\;a \cdot b \leq 10^{+86}:\\
\;\;\;\;\mathsf{fma}\left(c, i, \mathsf{fma}\left(t, z, x \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, b, \mathsf{fma}\left(c, i, t \cdot z\right)\right)\\
\end{array}
if (*.f64 a b) < -4.9999999999999996e74Initial program 95.7%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.1%
Applied rewrites75.1%
lift-fma.f64N/A
lift-fma.f64N/A
associate-+r+N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.0%
Applied rewrites75.0%
if -4.9999999999999996e74 < (*.f64 a b) < 1e86Initial program 95.7%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6474.9%
Applied rewrites74.9%
if 1e86 < (*.f64 a b) Initial program 95.7%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.7%
Applied rewrites75.7%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* a b) -5e+74)
(fma a b (fma c i (* x y)))
(if (<= (* a b) 1e+86)
(fma c i (fma t z (* x y)))
(fma a b (fma c i (* t z))))))double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((a * b) <= -5e+74) {
tmp = fma(a, b, fma(c, i, (x * y)));
} else if ((a * b) <= 1e+86) {
tmp = fma(c, i, fma(t, z, (x * y)));
} else {
tmp = fma(a, b, fma(c, i, (t * z)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(a * b) <= -5e+74) tmp = fma(a, b, fma(c, i, Float64(x * y))); elseif (Float64(a * b) <= 1e+86) tmp = fma(c, i, fma(t, z, Float64(x * y))); else tmp = fma(a, b, fma(c, i, Float64(t * z))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(a * b), $MachinePrecision], -5e+74], N[(a * b + N[(c * i + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1e+86], N[(c * i + N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * b + N[(c * i + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+74}:\\
\;\;\;\;\mathsf{fma}\left(a, b, \mathsf{fma}\left(c, i, x \cdot y\right)\right)\\
\mathbf{elif}\;a \cdot b \leq 10^{+86}:\\
\;\;\;\;\mathsf{fma}\left(c, i, \mathsf{fma}\left(t, z, x \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, b, \mathsf{fma}\left(c, i, t \cdot z\right)\right)\\
\end{array}
if (*.f64 a b) < -4.9999999999999996e74Initial program 95.7%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.1%
Applied rewrites75.1%
if -4.9999999999999996e74 < (*.f64 a b) < 1e86Initial program 95.7%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6474.9%
Applied rewrites74.9%
if 1e86 < (*.f64 a b) Initial program 95.7%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.7%
Applied rewrites75.7%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma a b (fma c i (* x y)))))
(if (<= (* x y) -2e+171)
t_1
(if (<= (* x y) 2e+133) (fma a b (fma c i (* 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(a, b, fma(c, i, (x * y)));
double tmp;
if ((x * y) <= -2e+171) {
tmp = t_1;
} else if ((x * y) <= 2e+133) {
tmp = fma(a, b, fma(c, i, (t * z)));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(a, b, fma(c, i, Float64(x * y))) tmp = 0.0 if (Float64(x * y) <= -2e+171) tmp = t_1; elseif (Float64(x * y) <= 2e+133) tmp = fma(a, b, fma(c, i, 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[(a * b + N[(c * i + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -2e+171], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 2e+133], N[(a * b + N[(c * i + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, b, \mathsf{fma}\left(c, i, x \cdot y\right)\right)\\
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+171}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+133}:\\
\;\;\;\;\mathsf{fma}\left(a, b, \mathsf{fma}\left(c, i, t \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (*.f64 x y) < -1.9999999999999999e171 or 2e133 < (*.f64 x y) Initial program 95.7%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.1%
Applied rewrites75.1%
if -1.9999999999999999e171 < (*.f64 x y) < 2e133Initial program 95.7%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.7%
Applied rewrites75.7%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* x y) -2e+210) (fma a b (* x y)) (if (<= (* x y) 1e+169) (fma a b (fma c i (* t z))) (fma c i (* x y)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((x * y) <= -2e+210) {
tmp = fma(a, b, (x * y));
} else if ((x * y) <= 1e+169) {
tmp = fma(a, b, fma(c, i, (t * z)));
} else {
tmp = fma(c, i, (x * y));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(x * y) <= -2e+210) tmp = fma(a, b, Float64(x * y)); elseif (Float64(x * y) <= 1e+169) tmp = fma(a, b, fma(c, i, Float64(t * z))); else tmp = fma(c, i, Float64(x * y)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(x * y), $MachinePrecision], -2e+210], N[(a * b + N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+169], N[(a * b + N[(c * i + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c * i + N[(x * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+210}:\\
\;\;\;\;\mathsf{fma}\left(a, b, x \cdot y\right)\\
\mathbf{elif}\;x \cdot y \leq 10^{+169}:\\
\;\;\;\;\mathsf{fma}\left(a, b, \mathsf{fma}\left(c, i, t \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(c, i, x \cdot y\right)\\
\end{array}
if (*.f64 x y) < -1.9999999999999999e210Initial program 95.7%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.1%
Applied rewrites75.1%
Taylor expanded in x around 0
lower-*.f6452.2%
Applied rewrites52.2%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-*.f6451.6%
Applied rewrites51.6%
if -1.9999999999999999e210 < (*.f64 x y) < 9.9999999999999993e168Initial program 95.7%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.7%
Applied rewrites75.7%
if 9.9999999999999993e168 < (*.f64 x y) Initial program 95.7%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.1%
Applied rewrites75.1%
Taylor expanded in x around 0
lower-*.f6452.2%
Applied rewrites52.2%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-*.f6451.6%
Applied rewrites51.6%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-*.f6451.3%
Applied rewrites51.3%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma c i (* x y))) (t_2 (fma a b (* c i))))
(if (<= (* a b) -5e+74)
t_2
(if (<= (* a b) -4e-251)
t_1
(if (<= (* a b) 4.6e-24)
(fma c i (* t z))
(if (<= (* a b) 1e+86) 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(c, i, (x * y));
double t_2 = fma(a, b, (c * i));
double tmp;
if ((a * b) <= -5e+74) {
tmp = t_2;
} else if ((a * b) <= -4e-251) {
tmp = t_1;
} else if ((a * b) <= 4.6e-24) {
tmp = fma(c, i, (t * z));
} else if ((a * b) <= 1e+86) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(c, i, Float64(x * y)) t_2 = fma(a, b, Float64(c * i)) tmp = 0.0 if (Float64(a * b) <= -5e+74) tmp = t_2; elseif (Float64(a * b) <= -4e-251) tmp = t_1; elseif (Float64(a * b) <= 4.6e-24) tmp = fma(c, i, Float64(t * z)); elseif (Float64(a * b) <= 1e+86) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(c * i + N[(x * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(a * b + N[(c * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -5e+74], t$95$2, If[LessEqual[N[(a * b), $MachinePrecision], -4e-251], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 4.6e-24], N[(c * i + N[(t * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1e+86], t$95$1, t$95$2]]]]]]
\begin{array}{l}
t_1 := \mathsf{fma}\left(c, i, x \cdot y\right)\\
t_2 := \mathsf{fma}\left(a, b, c \cdot i\right)\\
\mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+74}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;a \cdot b \leq -4 \cdot 10^{-251}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \cdot b \leq 4.6 \cdot 10^{-24}:\\
\;\;\;\;\mathsf{fma}\left(c, i, t \cdot z\right)\\
\mathbf{elif}\;a \cdot b \leq 10^{+86}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if (*.f64 a b) < -4.9999999999999996e74 or 1e86 < (*.f64 a b) Initial program 95.7%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.1%
Applied rewrites75.1%
Taylor expanded in x around 0
lower-*.f6452.2%
Applied rewrites52.2%
if -4.9999999999999996e74 < (*.f64 a b) < -4.0000000000000001e-251 or 4.6000000000000002e-24 < (*.f64 a b) < 1e86Initial program 95.7%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.1%
Applied rewrites75.1%
Taylor expanded in x around 0
lower-*.f6452.2%
Applied rewrites52.2%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-*.f6451.6%
Applied rewrites51.6%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-*.f6451.3%
Applied rewrites51.3%
if -4.0000000000000001e-251 < (*.f64 a b) < 4.6000000000000002e-24Initial program 95.7%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6474.9%
Applied rewrites74.9%
Taylor expanded in x around 0
lower-*.f6452.2%
Applied rewrites52.2%
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (fma a b (* c i)))) (if (<= (* a b) -5e+74) t_1 (if (<= (* a b) 1e+86) (fma c i (* x y)) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(a, b, (c * i));
double tmp;
if ((a * b) <= -5e+74) {
tmp = t_1;
} else if ((a * b) <= 1e+86) {
tmp = fma(c, i, (x * y));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(a, b, Float64(c * i)) tmp = 0.0 if (Float64(a * b) <= -5e+74) tmp = t_1; elseif (Float64(a * b) <= 1e+86) tmp = fma(c, i, Float64(x * y)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(a * b + N[(c * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -5e+74], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 1e+86], N[(c * i + N[(x * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, b, c \cdot i\right)\\
\mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+74}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \cdot b \leq 10^{+86}:\\
\;\;\;\;\mathsf{fma}\left(c, i, x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (*.f64 a b) < -4.9999999999999996e74 or 1e86 < (*.f64 a b) Initial program 95.7%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.1%
Applied rewrites75.1%
Taylor expanded in x around 0
lower-*.f6452.2%
Applied rewrites52.2%
if -4.9999999999999996e74 < (*.f64 a b) < 1e86Initial program 95.7%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.1%
Applied rewrites75.1%
Taylor expanded in x around 0
lower-*.f6452.2%
Applied rewrites52.2%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-*.f6451.6%
Applied rewrites51.6%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-*.f6451.3%
Applied rewrites51.3%
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (fma c i (* x y)))) (if (<= (* c i) -5e+16) t_1 (if (<= (* c i) 1e+86) (fma y x (* 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(c, i, (x * y));
double tmp;
if ((c * i) <= -5e+16) {
tmp = t_1;
} else if ((c * i) <= 1e+86) {
tmp = fma(y, x, (b * a));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(c, i, Float64(x * y)) tmp = 0.0 if (Float64(c * i) <= -5e+16) tmp = t_1; elseif (Float64(c * i) <= 1e+86) tmp = fma(y, x, 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[(c * i + N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(c * i), $MachinePrecision], -5e+16], t$95$1, If[LessEqual[N[(c * i), $MachinePrecision], 1e+86], N[(y * x + N[(b * a), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \mathsf{fma}\left(c, i, x \cdot y\right)\\
\mathbf{if}\;c \cdot i \leq -5 \cdot 10^{+16}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;c \cdot i \leq 10^{+86}:\\
\;\;\;\;\mathsf{fma}\left(y, x, b \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (*.f64 c i) < -5e16 or 1e86 < (*.f64 c i) Initial program 95.7%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.1%
Applied rewrites75.1%
Taylor expanded in x around 0
lower-*.f6452.2%
Applied rewrites52.2%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-*.f6451.6%
Applied rewrites51.6%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-*.f6451.3%
Applied rewrites51.3%
if -5e16 < (*.f64 c i) < 1e86Initial program 95.7%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.1%
Applied rewrites75.1%
Taylor expanded in x around 0
lower-*.f6452.2%
Applied rewrites52.2%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-*.f6451.6%
Applied rewrites51.6%
lift-fma.f64N/A
+-commutativeN/A
fp-cancel-sign-sub-invN/A
sub-flipN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-outN/A
remove-double-negN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6451.6%
Applied rewrites51.6%
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (fma c i (* x y)))) (if (<= (* c i) -5e+16) t_1 (if (<= (* c i) 1e+86) (fma a b (* x y)) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(c, i, (x * y));
double tmp;
if ((c * i) <= -5e+16) {
tmp = t_1;
} else if ((c * i) <= 1e+86) {
tmp = fma(a, b, (x * y));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(c, i, Float64(x * y)) tmp = 0.0 if (Float64(c * i) <= -5e+16) tmp = t_1; elseif (Float64(c * i) <= 1e+86) tmp = fma(a, b, Float64(x * y)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(c * i + N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(c * i), $MachinePrecision], -5e+16], t$95$1, If[LessEqual[N[(c * i), $MachinePrecision], 1e+86], N[(a * b + N[(x * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \mathsf{fma}\left(c, i, x \cdot y\right)\\
\mathbf{if}\;c \cdot i \leq -5 \cdot 10^{+16}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;c \cdot i \leq 10^{+86}:\\
\;\;\;\;\mathsf{fma}\left(a, b, x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (*.f64 c i) < -5e16 or 1e86 < (*.f64 c i) Initial program 95.7%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.1%
Applied rewrites75.1%
Taylor expanded in x around 0
lower-*.f6452.2%
Applied rewrites52.2%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-*.f6451.6%
Applied rewrites51.6%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-*.f6451.3%
Applied rewrites51.3%
if -5e16 < (*.f64 c i) < 1e86Initial program 95.7%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.1%
Applied rewrites75.1%
Taylor expanded in x around 0
lower-*.f6452.2%
Applied rewrites52.2%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-*.f6451.6%
Applied rewrites51.6%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* c i) -1.1e+144) (* c i) (if (<= (* c i) 5.8e+90) (fma a b (* x y)) (* c i))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((c * i) <= -1.1e+144) {
tmp = c * i;
} else if ((c * i) <= 5.8e+90) {
tmp = fma(a, b, (x * y));
} else {
tmp = c * i;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(c * i) <= -1.1e+144) tmp = Float64(c * i); elseif (Float64(c * i) <= 5.8e+90) tmp = fma(a, b, Float64(x * y)); else tmp = Float64(c * i); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(c * i), $MachinePrecision], -1.1e+144], N[(c * i), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 5.8e+90], N[(a * b + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(c * i), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -1.1 \cdot 10^{+144}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;c \cdot i \leq 5.8 \cdot 10^{+90}:\\
\;\;\;\;\mathsf{fma}\left(a, b, x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
if (*.f64 c i) < -1.0999999999999999e144 or 5.8000000000000003e90 < (*.f64 c i) Initial program 95.7%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.1%
Applied rewrites75.1%
Taylor expanded in x around 0
lower-*.f6452.2%
Applied rewrites52.2%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-*.f6451.6%
Applied rewrites51.6%
Taylor expanded in c around inf
lower-*.f6427.7%
Applied rewrites27.7%
if -1.0999999999999999e144 < (*.f64 c i) < 5.8000000000000003e90Initial program 95.7%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.1%
Applied rewrites75.1%
Taylor expanded in x around 0
lower-*.f6452.2%
Applied rewrites52.2%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-*.f6451.6%
Applied rewrites51.6%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* c i) -1.1e+144)
(* c i)
(if (<= (* c i) -5e-321)
(* t z)
(if (<= (* c i) 1.6e-217)
(* x y)
(if (<= (* c i) 5.8e+90) (* a b) (* c i))))))double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((c * i) <= -1.1e+144) {
tmp = c * i;
} else if ((c * i) <= -5e-321) {
tmp = t * z;
} else if ((c * i) <= 1.6e-217) {
tmp = x * y;
} else if ((c * i) <= 5.8e+90) {
tmp = a * b;
} else {
tmp = c * i;
}
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 ((c * i) <= (-1.1d+144)) then
tmp = c * i
else if ((c * i) <= (-5d-321)) then
tmp = t * z
else if ((c * i) <= 1.6d-217) then
tmp = x * y
else if ((c * i) <= 5.8d+90) then
tmp = a * b
else
tmp = c * i
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 ((c * i) <= -1.1e+144) {
tmp = c * i;
} else if ((c * i) <= -5e-321) {
tmp = t * z;
} else if ((c * i) <= 1.6e-217) {
tmp = x * y;
} else if ((c * i) <= 5.8e+90) {
tmp = a * b;
} else {
tmp = c * i;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (c * i) <= -1.1e+144: tmp = c * i elif (c * i) <= -5e-321: tmp = t * z elif (c * i) <= 1.6e-217: tmp = x * y elif (c * i) <= 5.8e+90: tmp = a * b else: tmp = c * i return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(c * i) <= -1.1e+144) tmp = Float64(c * i); elseif (Float64(c * i) <= -5e-321) tmp = Float64(t * z); elseif (Float64(c * i) <= 1.6e-217) tmp = Float64(x * y); elseif (Float64(c * i) <= 5.8e+90) tmp = Float64(a * b); else tmp = Float64(c * i); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((c * i) <= -1.1e+144) tmp = c * i; elseif ((c * i) <= -5e-321) tmp = t * z; elseif ((c * i) <= 1.6e-217) tmp = x * y; elseif ((c * i) <= 5.8e+90) tmp = a * b; else tmp = c * i; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(c * i), $MachinePrecision], -1.1e+144], N[(c * i), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], -5e-321], N[(t * z), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 1.6e-217], N[(x * y), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 5.8e+90], N[(a * b), $MachinePrecision], N[(c * i), $MachinePrecision]]]]]
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -1.1 \cdot 10^{+144}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;c \cdot i \leq -5 \cdot 10^{-321}:\\
\;\;\;\;t \cdot z\\
\mathbf{elif}\;c \cdot i \leq 1.6 \cdot 10^{-217}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;c \cdot i \leq 5.8 \cdot 10^{+90}:\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
if (*.f64 c i) < -1.0999999999999999e144 or 5.8000000000000003e90 < (*.f64 c i) Initial program 95.7%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.1%
Applied rewrites75.1%
Taylor expanded in x around 0
lower-*.f6452.2%
Applied rewrites52.2%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-*.f6451.6%
Applied rewrites51.6%
Taylor expanded in c around inf
lower-*.f6427.7%
Applied rewrites27.7%
if -1.0999999999999999e144 < (*.f64 c i) < -4.999944335913415e-321Initial program 95.7%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.1%
Applied rewrites75.1%
Taylor expanded in x around 0
lower-*.f6452.2%
Applied rewrites52.2%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-*.f6451.6%
Applied rewrites51.6%
Taylor expanded in z around inf
lower-*.f6427.6%
Applied rewrites27.6%
if -4.999944335913415e-321 < (*.f64 c i) < 1.6000000000000001e-217Initial program 95.7%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.1%
Applied rewrites75.1%
Taylor expanded in x around 0
lower-*.f6452.2%
Applied rewrites52.2%
Taylor expanded in x around inf
lower-*.f6426.9%
Applied rewrites26.9%
if 1.6000000000000001e-217 < (*.f64 c i) < 5.8000000000000003e90Initial program 95.7%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.1%
Applied rewrites75.1%
Taylor expanded in x around 0
lower-*.f6452.2%
Applied rewrites52.2%
Taylor expanded in a around inf
lower-*.f6427.9%
Applied rewrites27.9%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* c i) -1.1e+144) (* c i) (if (<= (* c i) 2e-218) (* t z) (if (<= (* c i) 5.8e+90) (* a b) (* c i)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((c * i) <= -1.1e+144) {
tmp = c * i;
} else if ((c * i) <= 2e-218) {
tmp = t * z;
} else if ((c * i) <= 5.8e+90) {
tmp = a * b;
} else {
tmp = c * i;
}
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 ((c * i) <= (-1.1d+144)) then
tmp = c * i
else if ((c * i) <= 2d-218) then
tmp = t * z
else if ((c * i) <= 5.8d+90) then
tmp = a * b
else
tmp = c * i
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 ((c * i) <= -1.1e+144) {
tmp = c * i;
} else if ((c * i) <= 2e-218) {
tmp = t * z;
} else if ((c * i) <= 5.8e+90) {
tmp = a * b;
} else {
tmp = c * i;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (c * i) <= -1.1e+144: tmp = c * i elif (c * i) <= 2e-218: tmp = t * z elif (c * i) <= 5.8e+90: tmp = a * b else: tmp = c * i return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(c * i) <= -1.1e+144) tmp = Float64(c * i); elseif (Float64(c * i) <= 2e-218) tmp = Float64(t * z); elseif (Float64(c * i) <= 5.8e+90) tmp = Float64(a * b); else tmp = Float64(c * i); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((c * i) <= -1.1e+144) tmp = c * i; elseif ((c * i) <= 2e-218) tmp = t * z; elseif ((c * i) <= 5.8e+90) tmp = a * b; else tmp = c * i; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(c * i), $MachinePrecision], -1.1e+144], N[(c * i), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 2e-218], N[(t * z), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 5.8e+90], N[(a * b), $MachinePrecision], N[(c * i), $MachinePrecision]]]]
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -1.1 \cdot 10^{+144}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;c \cdot i \leq 2 \cdot 10^{-218}:\\
\;\;\;\;t \cdot z\\
\mathbf{elif}\;c \cdot i \leq 5.8 \cdot 10^{+90}:\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
if (*.f64 c i) < -1.0999999999999999e144 or 5.8000000000000003e90 < (*.f64 c i) Initial program 95.7%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.1%
Applied rewrites75.1%
Taylor expanded in x around 0
lower-*.f6452.2%
Applied rewrites52.2%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-*.f6451.6%
Applied rewrites51.6%
Taylor expanded in c around inf
lower-*.f6427.7%
Applied rewrites27.7%
if -1.0999999999999999e144 < (*.f64 c i) < 2.0000000000000001e-218Initial program 95.7%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.1%
Applied rewrites75.1%
Taylor expanded in x around 0
lower-*.f6452.2%
Applied rewrites52.2%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-*.f6451.6%
Applied rewrites51.6%
Taylor expanded in z around inf
lower-*.f6427.6%
Applied rewrites27.6%
if 2.0000000000000001e-218 < (*.f64 c i) < 5.8000000000000003e90Initial program 95.7%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.1%
Applied rewrites75.1%
Taylor expanded in x around 0
lower-*.f6452.2%
Applied rewrites52.2%
Taylor expanded in a around inf
lower-*.f6427.9%
Applied rewrites27.9%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* a b) -7.5e+155) (* a b) (if (<= (* a b) 2e+91) (* c i) (* a b))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((a * b) <= -7.5e+155) {
tmp = a * b;
} else if ((a * b) <= 2e+91) {
tmp = c * i;
} else {
tmp = a * b;
}
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) <= (-7.5d+155)) then
tmp = a * b
else if ((a * b) <= 2d+91) then
tmp = c * i
else
tmp = a * b
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) <= -7.5e+155) {
tmp = a * b;
} else if ((a * b) <= 2e+91) {
tmp = c * i;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (a * b) <= -7.5e+155: tmp = a * b elif (a * b) <= 2e+91: tmp = c * i else: tmp = a * b return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(a * b) <= -7.5e+155) tmp = Float64(a * b); elseif (Float64(a * b) <= 2e+91) tmp = Float64(c * i); else tmp = Float64(a * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((a * b) <= -7.5e+155) tmp = a * b; elseif ((a * b) <= 2e+91) tmp = c * i; else tmp = a * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(a * b), $MachinePrecision], -7.5e+155], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 2e+91], N[(c * i), $MachinePrecision], N[(a * b), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -7.5 \cdot 10^{+155}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 2 \cdot 10^{+91}:\\
\;\;\;\;c \cdot i\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
if (*.f64 a b) < -7.4999999999999999e155 or 2.0000000000000002e91 < (*.f64 a b) Initial program 95.7%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.1%
Applied rewrites75.1%
Taylor expanded in x around 0
lower-*.f6452.2%
Applied rewrites52.2%
Taylor expanded in a around inf
lower-*.f6427.9%
Applied rewrites27.9%
if -7.4999999999999999e155 < (*.f64 a b) < 2.0000000000000002e91Initial program 95.7%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.1%
Applied rewrites75.1%
Taylor expanded in x around 0
lower-*.f6452.2%
Applied rewrites52.2%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-*.f6451.6%
Applied rewrites51.6%
Taylor expanded in c around inf
lower-*.f6427.7%
Applied rewrites27.7%
(FPCore (x y z t a b c i) :precision binary64 (* a b))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return a * b;
}
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 = a * b
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return a * b;
}
def code(x, y, z, t, a, b, c, i): return a * b
function code(x, y, z, t, a, b, c, i) return Float64(a * b) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = a * b; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(a * b), $MachinePrecision]
a \cdot b
Initial program 95.7%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.1%
Applied rewrites75.1%
Taylor expanded in x around 0
lower-*.f6452.2%
Applied rewrites52.2%
Taylor expanded in a around inf
lower-*.f6427.9%
Applied rewrites27.9%
herbie shell --seed 2025192
(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)))