
(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 13 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 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.8%
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.f6498.0%
Applied rewrites98.0%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* a b) -1e+181)
(fma a b (* c i))
(if (<= (* a b) 4e+129)
(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) <= -1e+181) {
tmp = fma(a, b, (c * i));
} else if ((a * b) <= 4e+129) {
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) <= -1e+181) tmp = fma(a, b, Float64(c * i)); elseif (Float64(a * b) <= 4e+129) 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], -1e+181], N[(a * b + N[(c * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 4e+129], 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 -1 \cdot 10^{+181}:\\
\;\;\;\;\mathsf{fma}\left(a, b, c \cdot i\right)\\
\mathbf{elif}\;a \cdot b \leq 4 \cdot 10^{+129}:\\
\;\;\;\;\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) < -9.9999999999999992e180Initial program 95.8%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.6%
Applied rewrites75.6%
Taylor expanded in x around 0
lower-*.f6451.9%
Applied rewrites51.9%
if -9.9999999999999992e180 < (*.f64 a b) < 4e129Initial program 95.8%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6474.9%
Applied rewrites74.9%
if 4e129 < (*.f64 a b) Initial program 95.8%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6474.9%
Applied rewrites74.9%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* c i) -2e+52)
(fma a b (fma c i (* x y)))
(if (<= (* c i) 2e+58)
(fma a b (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 ((c * i) <= -2e+52) {
tmp = fma(a, b, fma(c, i, (x * y)));
} else if ((c * i) <= 2e+58) {
tmp = fma(a, b, 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(c * i) <= -2e+52) tmp = fma(a, b, fma(c, i, Float64(x * y))); elseif (Float64(c * i) <= 2e+58) tmp = fma(a, b, 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[(c * i), $MachinePrecision], -2e+52], N[(a * b + N[(c * i + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 2e+58], N[(a * b + 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}\;c \cdot i \leq -2 \cdot 10^{+52}:\\
\;\;\;\;\mathsf{fma}\left(a, b, \mathsf{fma}\left(c, i, x \cdot y\right)\right)\\
\mathbf{elif}\;c \cdot i \leq 2 \cdot 10^{+58}:\\
\;\;\;\;\mathsf{fma}\left(a, b, \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 c i) < -2e52Initial program 95.8%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.6%
Applied rewrites75.6%
if -2e52 < (*.f64 c i) < 1.99999999999999989e58Initial program 95.8%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6474.9%
Applied rewrites74.9%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.4%
Applied rewrites75.4%
if 1.99999999999999989e58 < (*.f64 c i) Initial program 95.8%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6474.9%
Applied rewrites74.9%
(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) -1.7e+67)
t_1
(if (<= (* x y) 1.6e+160) (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) <= -1.7e+67) {
tmp = t_1;
} else if ((x * y) <= 1.6e+160) {
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) <= -1.7e+67) tmp = t_1; elseif (Float64(x * y) <= 1.6e+160) 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], -1.7e+67], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 1.6e+160], 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 -1.7 \cdot 10^{+67}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 1.6 \cdot 10^{+160}:\\
\;\;\;\;\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.7000000000000001e67 or 1.5999999999999999e160 < (*.f64 x y) Initial program 95.8%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.6%
Applied rewrites75.6%
if -1.7000000000000001e67 < (*.f64 x y) < 1.5999999999999999e160Initial program 95.8%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6474.9%
Applied rewrites74.9%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* x y) -8e+84) (fma a b (* x y)) (if (<= (* x y) 1.55e+160) (fma a b (fma c i (* t z))) (fma t z (* 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) <= -8e+84) {
tmp = fma(a, b, (x * y));
} else if ((x * y) <= 1.55e+160) {
tmp = fma(a, b, fma(c, i, (t * z)));
} else {
tmp = fma(t, z, (x * y));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(x * y) <= -8e+84) tmp = fma(a, b, Float64(x * y)); elseif (Float64(x * y) <= 1.55e+160) tmp = fma(a, b, fma(c, i, Float64(t * z))); else tmp = fma(t, z, Float64(x * y)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(x * y), $MachinePrecision], -8e+84], N[(a * b + N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1.55e+160], N[(a * b + N[(c * i + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -8 \cdot 10^{+84}:\\
\;\;\;\;\mathsf{fma}\left(a, b, x \cdot y\right)\\
\mathbf{elif}\;x \cdot y \leq 1.55 \cdot 10^{+160}:\\
\;\;\;\;\mathsf{fma}\left(a, b, \mathsf{fma}\left(c, i, t \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t, z, x \cdot y\right)\\
\end{array}
if (*.f64 x y) < -8.00000000000000046e84Initial program 95.8%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.6%
Applied rewrites75.6%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-*.f6452.6%
Applied rewrites52.6%
if -8.00000000000000046e84 < (*.f64 x y) < 1.5499999999999999e160Initial program 95.8%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6474.9%
Applied rewrites74.9%
if 1.5499999999999999e160 < (*.f64 x y) Initial program 95.8%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6474.9%
Applied rewrites74.9%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.4%
Applied rewrites75.4%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-*.f6451.7%
Applied rewrites51.7%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-*.f6451.6%
Applied rewrites51.6%
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (fma t z (* x y))) (t_2 (+ (* x y) (* z t)))) (if (<= t_2 -2e+107) t_1 (if (<= t_2 5e+169) (fma a b (* c i)) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(t, z, (x * y));
double t_2 = (x * y) + (z * t);
double tmp;
if (t_2 <= -2e+107) {
tmp = t_1;
} else if (t_2 <= 5e+169) {
tmp = fma(a, b, (c * i));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(t, z, Float64(x * y)) t_2 = Float64(Float64(x * y) + Float64(z * t)) tmp = 0.0 if (t_2 <= -2e+107) tmp = t_1; elseif (t_2 <= 5e+169) tmp = fma(a, b, Float64(c * i)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+107], t$95$1, If[LessEqual[t$95$2, 5e+169], N[(a * b + N[(c * i), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_1 := \mathsf{fma}\left(t, z, x \cdot y\right)\\
t_2 := x \cdot y + z \cdot t\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+107}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+169}:\\
\;\;\;\;\mathsf{fma}\left(a, b, c \cdot i\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (+.f64 (*.f64 x y) (*.f64 z t)) < -1.9999999999999999e107 or 5.00000000000000017e169 < (+.f64 (*.f64 x y) (*.f64 z t)) Initial program 95.8%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6474.9%
Applied rewrites74.9%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.4%
Applied rewrites75.4%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-*.f6451.7%
Applied rewrites51.7%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-*.f6451.6%
Applied rewrites51.6%
if -1.9999999999999999e107 < (+.f64 (*.f64 x y) (*.f64 z t)) < 5.00000000000000017e169Initial program 95.8%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.6%
Applied rewrites75.6%
Taylor expanded in x around 0
lower-*.f6451.9%
Applied rewrites51.9%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* a b) -1e+181)
(* a b)
(if (<= (* a b) -5.0)
(fma t z (* x y))
(if (<= (* a b) 2e+72) (fma c i (* x y)) (fma a b (* 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) <= -1e+181) {
tmp = a * b;
} else if ((a * b) <= -5.0) {
tmp = fma(t, z, (x * y));
} else if ((a * b) <= 2e+72) {
tmp = fma(c, i, (x * y));
} else {
tmp = fma(a, b, (t * z));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(a * b) <= -1e+181) tmp = Float64(a * b); elseif (Float64(a * b) <= -5.0) tmp = fma(t, z, Float64(x * y)); elseif (Float64(a * b) <= 2e+72) tmp = fma(c, i, Float64(x * y)); else tmp = fma(a, b, Float64(t * z)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(a * b), $MachinePrecision], -1e+181], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -5.0], N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 2e+72], N[(c * i + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(a * b + N[(t * z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+181}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq -5:\\
\;\;\;\;\mathsf{fma}\left(t, z, x \cdot y\right)\\
\mathbf{elif}\;a \cdot b \leq 2 \cdot 10^{+72}:\\
\;\;\;\;\mathsf{fma}\left(c, i, x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, b, t \cdot z\right)\\
\end{array}
if (*.f64 a b) < -9.9999999999999992e180Initial program 95.8%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.6%
Applied rewrites75.6%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-*.f6452.6%
Applied rewrites52.6%
Taylor expanded in x around 0
lower-*.f6428.0%
Applied rewrites28.0%
if -9.9999999999999992e180 < (*.f64 a b) < -5Initial program 95.8%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6474.9%
Applied rewrites74.9%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.4%
Applied rewrites75.4%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-*.f6451.7%
Applied rewrites51.7%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-*.f6451.6%
Applied rewrites51.6%
if -5 < (*.f64 a b) < 1.99999999999999989e72Initial program 95.8%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.6%
Applied rewrites75.6%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-*.f6452.6%
Applied rewrites52.6%
Taylor expanded in x around 0
lower-*.f6428.0%
Applied rewrites28.0%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-*.f6451.8%
Applied rewrites51.8%
if 1.99999999999999989e72 < (*.f64 a b) Initial program 95.8%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6474.9%
Applied rewrites74.9%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.4%
Applied rewrites75.4%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-*.f6451.7%
Applied rewrites51.7%
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (fma a b (* t z)))) (if (<= (* a b) -4e+85) t_1 (if (<= (* a b) 2e+72) (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, (t * z));
double tmp;
if ((a * b) <= -4e+85) {
tmp = t_1;
} else if ((a * b) <= 2e+72) {
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(t * z)) tmp = 0.0 if (Float64(a * b) <= -4e+85) tmp = t_1; elseif (Float64(a * b) <= 2e+72) 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[(t * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -4e+85], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 2e+72], N[(c * i + N[(x * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, b, t \cdot z\right)\\
\mathbf{if}\;a \cdot b \leq -4 \cdot 10^{+85}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \cdot b \leq 2 \cdot 10^{+72}:\\
\;\;\;\;\mathsf{fma}\left(c, i, x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (*.f64 a b) < -4.0000000000000001e85 or 1.99999999999999989e72 < (*.f64 a b) Initial program 95.8%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6474.9%
Applied rewrites74.9%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.4%
Applied rewrites75.4%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-*.f6451.7%
Applied rewrites51.7%
if -4.0000000000000001e85 < (*.f64 a b) < 1.99999999999999989e72Initial program 95.8%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.6%
Applied rewrites75.6%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-*.f6452.6%
Applied rewrites52.6%
Taylor expanded in x around 0
lower-*.f6428.0%
Applied rewrites28.0%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-*.f6451.8%
Applied rewrites51.8%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* a b) -1e+181) (* a b) (if (<= (* a b) 0.02) (fma c i (* x y)) (fma a b (* x y)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((a * b) <= -1e+181) {
tmp = a * b;
} else if ((a * b) <= 0.02) {
tmp = fma(c, i, (x * y));
} else {
tmp = fma(a, b, (x * y));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(a * b) <= -1e+181) tmp = Float64(a * b); elseif (Float64(a * b) <= 0.02) tmp = fma(c, i, Float64(x * y)); else tmp = fma(a, b, Float64(x * y)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(a * b), $MachinePrecision], -1e+181], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 0.02], N[(c * i + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(a * b + N[(x * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+181}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 0.02:\\
\;\;\;\;\mathsf{fma}\left(c, i, x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, b, x \cdot y\right)\\
\end{array}
if (*.f64 a b) < -9.9999999999999992e180Initial program 95.8%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.6%
Applied rewrites75.6%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-*.f6452.6%
Applied rewrites52.6%
Taylor expanded in x around 0
lower-*.f6428.0%
Applied rewrites28.0%
if -9.9999999999999992e180 < (*.f64 a b) < 0.0200000000000000004Initial program 95.8%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.6%
Applied rewrites75.6%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-*.f6452.6%
Applied rewrites52.6%
Taylor expanded in x around 0
lower-*.f6428.0%
Applied rewrites28.0%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-*.f6451.8%
Applied rewrites51.8%
if 0.0200000000000000004 < (*.f64 a b) Initial program 95.8%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.6%
Applied rewrites75.6%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-*.f6452.6%
Applied rewrites52.6%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* c i) -1.55e+158) (* c i) (if (<= (* c i) 2.1e+102) (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.55e+158) {
tmp = c * i;
} else if ((c * i) <= 2.1e+102) {
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.55e+158) tmp = Float64(c * i); elseif (Float64(c * i) <= 2.1e+102) 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.55e+158], N[(c * i), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 2.1e+102], N[(a * b + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(c * i), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -1.55 \cdot 10^{+158}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;c \cdot i \leq 2.1 \cdot 10^{+102}:\\
\;\;\;\;\mathsf{fma}\left(a, b, x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
if (*.f64 c i) < -1.5500000000000001e158 or 2.10000000000000001e102 < (*.f64 c i) Initial program 95.8%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.6%
Applied rewrites75.6%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-*.f6452.6%
Applied rewrites52.6%
Taylor expanded in x around 0
lower-*.f6428.0%
Applied rewrites28.0%
Taylor expanded in c around inf
lower-*.f6427.2%
Applied rewrites27.2%
if -1.5500000000000001e158 < (*.f64 c i) < 2.10000000000000001e102Initial program 95.8%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.6%
Applied rewrites75.6%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-*.f6452.6%
Applied rewrites52.6%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* a b) -1.7e+181)
(* a b)
(if (<= (* a b) -1.2e-145)
(* x y)
(if (<= (* a b) 5.2e+54) (* 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) <= -1.7e+181) {
tmp = a * b;
} else if ((a * b) <= -1.2e-145) {
tmp = x * y;
} else if ((a * b) <= 5.2e+54) {
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) <= (-1.7d+181)) then
tmp = a * b
else if ((a * b) <= (-1.2d-145)) then
tmp = x * y
else if ((a * b) <= 5.2d+54) 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) <= -1.7e+181) {
tmp = a * b;
} else if ((a * b) <= -1.2e-145) {
tmp = x * y;
} else if ((a * b) <= 5.2e+54) {
tmp = c * i;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (a * b) <= -1.7e+181: tmp = a * b elif (a * b) <= -1.2e-145: tmp = x * y elif (a * b) <= 5.2e+54: 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) <= -1.7e+181) tmp = Float64(a * b); elseif (Float64(a * b) <= -1.2e-145) tmp = Float64(x * y); elseif (Float64(a * b) <= 5.2e+54) 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) <= -1.7e+181) tmp = a * b; elseif ((a * b) <= -1.2e-145) tmp = x * y; elseif ((a * b) <= 5.2e+54) 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], -1.7e+181], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -1.2e-145], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 5.2e+54], N[(c * i), $MachinePrecision], N[(a * b), $MachinePrecision]]]]
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1.7 \cdot 10^{+181}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq -1.2 \cdot 10^{-145}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 5.2 \cdot 10^{+54}:\\
\;\;\;\;c \cdot i\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
if (*.f64 a b) < -1.70000000000000015e181 or 5.20000000000000013e54 < (*.f64 a b) Initial program 95.8%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.6%
Applied rewrites75.6%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-*.f6452.6%
Applied rewrites52.6%
Taylor expanded in x around 0
lower-*.f6428.0%
Applied rewrites28.0%
if -1.70000000000000015e181 < (*.f64 a b) < -1.20000000000000008e-145Initial program 95.8%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.6%
Applied rewrites75.6%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-*.f6452.6%
Applied rewrites52.6%
Taylor expanded in x around 0
lower-*.f6428.0%
Applied rewrites28.0%
Taylor expanded in x around inf
lower-*.f6427.9%
Applied rewrites27.9%
if -1.20000000000000008e-145 < (*.f64 a b) < 5.20000000000000013e54Initial program 95.8%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.6%
Applied rewrites75.6%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-*.f6452.6%
Applied rewrites52.6%
Taylor expanded in x around 0
lower-*.f6428.0%
Applied rewrites28.0%
Taylor expanded in c around inf
lower-*.f6427.2%
Applied rewrites27.2%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* a b) -1.35e+175) (* a b) (if (<= (* a b) 5.2e+54) (* 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) <= -1.35e+175) {
tmp = a * b;
} else if ((a * b) <= 5.2e+54) {
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) <= (-1.35d+175)) then
tmp = a * b
else if ((a * b) <= 5.2d+54) 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) <= -1.35e+175) {
tmp = a * b;
} else if ((a * b) <= 5.2e+54) {
tmp = c * i;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (a * b) <= -1.35e+175: tmp = a * b elif (a * b) <= 5.2e+54: 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) <= -1.35e+175) tmp = Float64(a * b); elseif (Float64(a * b) <= 5.2e+54) 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) <= -1.35e+175) tmp = a * b; elseif ((a * b) <= 5.2e+54) 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], -1.35e+175], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 5.2e+54], N[(c * i), $MachinePrecision], N[(a * b), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1.35 \cdot 10^{+175}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 5.2 \cdot 10^{+54}:\\
\;\;\;\;c \cdot i\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
if (*.f64 a b) < -1.35e175 or 5.20000000000000013e54 < (*.f64 a b) Initial program 95.8%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.6%
Applied rewrites75.6%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-*.f6452.6%
Applied rewrites52.6%
Taylor expanded in x around 0
lower-*.f6428.0%
Applied rewrites28.0%
if -1.35e175 < (*.f64 a b) < 5.20000000000000013e54Initial program 95.8%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.6%
Applied rewrites75.6%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-*.f6452.6%
Applied rewrites52.6%
Taylor expanded in x around 0
lower-*.f6428.0%
Applied rewrites28.0%
Taylor expanded in c around inf
lower-*.f6427.2%
Applied rewrites27.2%
(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.8%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.6%
Applied rewrites75.6%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-*.f6452.6%
Applied rewrites52.6%
Taylor expanded in x around 0
lower-*.f6428.0%
Applied rewrites28.0%
herbie shell --seed 2025179
(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)))