
(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 12 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 (if (<= (fmax z t) 4e+217) (fma y x (fma i c (fma b a (* (fmax z t) (fmin z t))))) (fma (fmin z t) (fmax 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) {
double tmp;
if (fmax(z, t) <= 4e+217) {
tmp = fma(y, x, fma(i, c, fma(b, a, (fmax(z, t) * fmin(z, t)))));
} else {
tmp = fma(fmin(z, t), fmax(z, t), fma(i, c, fma(b, a, (y * x))));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (fmax(z, t) <= 4e+217) tmp = fma(y, x, fma(i, c, fma(b, a, Float64(fmax(z, t) * fmin(z, t))))); else tmp = fma(fmin(z, t), fmax(z, t), fma(i, c, fma(b, a, Float64(y * x)))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[Max[z, t], $MachinePrecision], 4e+217], N[(y * x + N[(i * c + N[(b * a + N[(N[Max[z, t], $MachinePrecision] * N[Min[z, t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Min[z, t], $MachinePrecision] * N[Max[z, t], $MachinePrecision] + N[(i * c + N[(b * a + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\mathsf{max}\left(z, t\right) \leq 4 \cdot 10^{+217}:\\
\;\;\;\;\mathsf{fma}\left(y, x, \mathsf{fma}\left(i, c, \mathsf{fma}\left(b, a, \mathsf{max}\left(z, t\right) \cdot \mathsf{min}\left(z, t\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{min}\left(z, t\right), \mathsf{max}\left(z, t\right), \mathsf{fma}\left(i, c, \mathsf{fma}\left(b, a, y \cdot x\right)\right)\right)\\
\end{array}
if t < 3.9999999999999998e217Initial program 96.2%
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.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.3%
Applied rewrites98.3%
if 3.9999999999999998e217 < t Initial program 96.2%
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.f6498.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.1%
Applied rewrites98.1%
(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 96.2%
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.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.3%
Applied rewrites98.3%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* a b) -2e+73)
(fma y x (fma a b (* c i)))
(if (<= (* a b) 1e+49)
(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) <= -2e+73) {
tmp = fma(y, x, fma(a, b, (c * i)));
} else if ((a * b) <= 1e+49) {
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) <= -2e+73) tmp = fma(y, x, fma(a, b, Float64(c * i))); elseif (Float64(a * b) <= 1e+49) 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], -2e+73], N[(y * x + N[(a * b + N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1e+49], 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 -2 \cdot 10^{+73}:\\
\;\;\;\;\mathsf{fma}\left(y, x, \mathsf{fma}\left(a, b, c \cdot i\right)\right)\\
\mathbf{elif}\;a \cdot b \leq 10^{+49}:\\
\;\;\;\;\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) < -2e73Initial program 96.2%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6476.1%
Applied rewrites76.1%
lift-fma.f64N/A
lift-fma.f64N/A
associate-+r+N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6476.1%
Applied rewrites76.1%
if -2e73 < (*.f64 a b) < 9.9999999999999995e48Initial program 96.2%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.2%
Applied rewrites75.2%
if 9.9999999999999995e48 < (*.f64 a b) Initial program 96.2%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6474.5%
Applied rewrites74.5%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* a b) -2e+73)
(fma a b (fma c i (* x y)))
(if (<= (* a b) 1e+49)
(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) <= -2e+73) {
tmp = fma(a, b, fma(c, i, (x * y)));
} else if ((a * b) <= 1e+49) {
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) <= -2e+73) tmp = fma(a, b, fma(c, i, Float64(x * y))); elseif (Float64(a * b) <= 1e+49) 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], -2e+73], N[(a * b + N[(c * i + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1e+49], 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 -2 \cdot 10^{+73}:\\
\;\;\;\;\mathsf{fma}\left(a, b, \mathsf{fma}\left(c, i, x \cdot y\right)\right)\\
\mathbf{elif}\;a \cdot b \leq 10^{+49}:\\
\;\;\;\;\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) < -2e73Initial program 96.2%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6476.1%
Applied rewrites76.1%
if -2e73 < (*.f64 a b) < 9.9999999999999995e48Initial program 96.2%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.2%
Applied rewrites75.2%
if 9.9999999999999995e48 < (*.f64 a b) Initial program 96.2%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6474.5%
Applied rewrites74.5%
(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) -2.4e+53)
t_1
(if (<= (* x y) 2.25e-76) (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) <= -2.4e+53) {
tmp = t_1;
} else if ((x * y) <= 2.25e-76) {
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) <= -2.4e+53) tmp = t_1; elseif (Float64(x * y) <= 2.25e-76) 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], -2.4e+53], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 2.25e-76], 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.4 \cdot 10^{+53}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 2.25 \cdot 10^{-76}:\\
\;\;\;\;\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) < -2.4e53 or 2.25e-76 < (*.f64 x y) Initial program 96.2%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6476.1%
Applied rewrites76.1%
if -2.4e53 < (*.f64 x y) < 2.25e-76Initial program 96.2%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6474.5%
Applied rewrites74.5%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* x y) -6.6e+99) (* x y) (if (<= (* x y) 2.3e+261) (fma a b (fma c i (* 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) <= -6.6e+99) {
tmp = x * y;
} else if ((x * y) <= 2.3e+261) {
tmp = fma(a, b, fma(c, i, (t * z)));
} else {
tmp = x * y;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(x * y) <= -6.6e+99) tmp = Float64(x * y); elseif (Float64(x * y) <= 2.3e+261) tmp = fma(a, b, fma(c, i, Float64(t * z))); else tmp = Float64(x * y); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(x * y), $MachinePrecision], -6.6e+99], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2.3e+261], N[(a * b + N[(c * i + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * y), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -6.6 \cdot 10^{+99}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \cdot y \leq 2.3 \cdot 10^{+261}:\\
\;\;\;\;\mathsf{fma}\left(a, b, \mathsf{fma}\left(c, i, t \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
if (*.f64 x y) < -6.5999999999999998e99 or 2.3000000000000001e261 < (*.f64 x y) Initial program 96.2%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6476.1%
Applied rewrites76.1%
lift-fma.f64N/A
lift-fma.f64N/A
associate-+r+N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6476.1%
Applied rewrites76.1%
Taylor expanded in x around inf
lower-*.f6428.1%
Applied rewrites28.1%
if -6.5999999999999998e99 < (*.f64 x y) < 2.3000000000000001e261Initial program 96.2%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6474.5%
Applied rewrites74.5%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (fmin x y) (fmax x y))))
(if (<= (fmin x y) -9.2e+63)
t_1
(if (<= (fmin x y) -6e-217)
(fma c i (* t z))
(if (<= (fmin x y) 2.2e-47) (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 = fmin(x, y) * fmax(x, y);
double tmp;
if (fmin(x, y) <= -9.2e+63) {
tmp = t_1;
} else if (fmin(x, y) <= -6e-217) {
tmp = fma(c, i, (t * z));
} else if (fmin(x, y) <= 2.2e-47) {
tmp = fma(a, b, (c * i));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(fmin(x, y) * fmax(x, y)) tmp = 0.0 if (fmin(x, y) <= -9.2e+63) tmp = t_1; elseif (fmin(x, y) <= -6e-217) tmp = fma(c, i, Float64(t * z)); elseif (fmin(x, y) <= 2.2e-47) 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[(N[Min[x, y], $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Min[x, y], $MachinePrecision], -9.2e+63], t$95$1, If[LessEqual[N[Min[x, y], $MachinePrecision], -6e-217], N[(c * i + N[(t * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Min[x, y], $MachinePrecision], 2.2e-47], N[(a * b + N[(c * i), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_1 := \mathsf{min}\left(x, y\right) \cdot \mathsf{max}\left(x, y\right)\\
\mathbf{if}\;\mathsf{min}\left(x, y\right) \leq -9.2 \cdot 10^{+63}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\mathsf{min}\left(x, y\right) \leq -6 \cdot 10^{-217}:\\
\;\;\;\;\mathsf{fma}\left(c, i, t \cdot z\right)\\
\mathbf{elif}\;\mathsf{min}\left(x, y\right) \leq 2.2 \cdot 10^{-47}:\\
\;\;\;\;\mathsf{fma}\left(a, b, c \cdot i\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if x < -9.1999999999999997e63 or 2.2000000000000002e-47 < x Initial program 96.2%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6476.1%
Applied rewrites76.1%
lift-fma.f64N/A
lift-fma.f64N/A
associate-+r+N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6476.1%
Applied rewrites76.1%
Taylor expanded in x around inf
lower-*.f6428.1%
Applied rewrites28.1%
if -9.1999999999999997e63 < x < -6.0000000000000001e-217Initial program 96.2%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.2%
Applied rewrites75.2%
Taylor expanded in x around 0
lower-*.f6451.1%
Applied rewrites51.1%
if -6.0000000000000001e-217 < x < 2.2000000000000002e-47Initial program 96.2%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6476.1%
Applied rewrites76.1%
Taylor expanded in x around 0
lower-*.f6451.9%
Applied rewrites51.9%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* x y) -6.6e+99) (* x y) (if (<= (* x y) 9.2e+148) (fma a b (* 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) <= -6.6e+99) {
tmp = x * y;
} else if ((x * y) <= 9.2e+148) {
tmp = fma(a, b, (c * i));
} else {
tmp = x * y;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(x * y) <= -6.6e+99) tmp = Float64(x * y); elseif (Float64(x * y) <= 9.2e+148) tmp = fma(a, b, Float64(c * i)); else tmp = Float64(x * y); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(x * y), $MachinePrecision], -6.6e+99], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 9.2e+148], N[(a * b + N[(c * i), $MachinePrecision]), $MachinePrecision], N[(x * y), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -6.6 \cdot 10^{+99}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \cdot y \leq 9.2 \cdot 10^{+148}:\\
\;\;\;\;\mathsf{fma}\left(a, b, c \cdot i\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
if (*.f64 x y) < -6.5999999999999998e99 or 9.2000000000000002e148 < (*.f64 x y) Initial program 96.2%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6476.1%
Applied rewrites76.1%
lift-fma.f64N/A
lift-fma.f64N/A
associate-+r+N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6476.1%
Applied rewrites76.1%
Taylor expanded in x around inf
lower-*.f6428.1%
Applied rewrites28.1%
if -6.5999999999999998e99 < (*.f64 x y) < 9.2000000000000002e148Initial program 96.2%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6476.1%
Applied rewrites76.1%
Taylor expanded in x around 0
lower-*.f6451.9%
Applied rewrites51.9%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* c i) -1.52e+227)
(* c i)
(if (<= (* c i) -1.45e-167)
(* a b)
(if (<= (* c i) 1.95e+129) (* 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.52e+227) {
tmp = c * i;
} else if ((c * i) <= -1.45e-167) {
tmp = a * b;
} else if ((c * i) <= 1.95e+129) {
tmp = x * y;
} 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.52d+227)) then
tmp = c * i
else if ((c * i) <= (-1.45d-167)) then
tmp = a * b
else if ((c * i) <= 1.95d+129) then
tmp = x * y
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.52e+227) {
tmp = c * i;
} else if ((c * i) <= -1.45e-167) {
tmp = a * b;
} else if ((c * i) <= 1.95e+129) {
tmp = x * y;
} else {
tmp = c * i;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (c * i) <= -1.52e+227: tmp = c * i elif (c * i) <= -1.45e-167: tmp = a * b elif (c * i) <= 1.95e+129: tmp = 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.52e+227) tmp = Float64(c * i); elseif (Float64(c * i) <= -1.45e-167) tmp = Float64(a * b); elseif (Float64(c * i) <= 1.95e+129) tmp = Float64(x * y); 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.52e+227) tmp = c * i; elseif ((c * i) <= -1.45e-167) tmp = a * b; elseif ((c * i) <= 1.95e+129) tmp = x * y; 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.52e+227], N[(c * i), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], -1.45e-167], N[(a * b), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 1.95e+129], N[(x * y), $MachinePrecision], N[(c * i), $MachinePrecision]]]]
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -1.52 \cdot 10^{+227}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;c \cdot i \leq -1.45 \cdot 10^{-167}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;c \cdot i \leq 1.95 \cdot 10^{+129}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
if (*.f64 c i) < -1.5199999999999999e227 or 1.9499999999999999e129 < (*.f64 c i) Initial program 96.2%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6476.1%
Applied rewrites76.1%
lift-fma.f64N/A
lift-fma.f64N/A
associate-+r+N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6476.1%
Applied rewrites76.1%
Taylor expanded in x around inf
lower-*.f6428.1%
Applied rewrites28.1%
Taylor expanded in c around inf
lower-*.f6427.7%
Applied rewrites27.7%
if -1.5199999999999999e227 < (*.f64 c i) < -1.45e-167Initial program 96.2%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6476.1%
Applied rewrites76.1%
lift-fma.f64N/A
lift-fma.f64N/A
associate-+r+N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6476.1%
Applied rewrites76.1%
Taylor expanded in x around inf
lower-*.f6428.1%
Applied rewrites28.1%
Taylor expanded in a around inf
lower-*.f6427.5%
Applied rewrites27.5%
if -1.45e-167 < (*.f64 c i) < 1.9499999999999999e129Initial program 96.2%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6476.1%
Applied rewrites76.1%
lift-fma.f64N/A
lift-fma.f64N/A
associate-+r+N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6476.1%
Applied rewrites76.1%
Taylor expanded in x around inf
lower-*.f6428.1%
Applied rewrites28.1%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* a b) -7.8e+113) (* a b) (if (<= (* a b) 0.0) (* c i) (if (<= (* a b) 5.8e+84) (* t z) (* 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.8e+113) {
tmp = a * b;
} else if ((a * b) <= 0.0) {
tmp = c * i;
} else if ((a * b) <= 5.8e+84) {
tmp = t * z;
} 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.8d+113)) then
tmp = a * b
else if ((a * b) <= 0.0d0) then
tmp = c * i
else if ((a * b) <= 5.8d+84) then
tmp = t * z
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.8e+113) {
tmp = a * b;
} else if ((a * b) <= 0.0) {
tmp = c * i;
} else if ((a * b) <= 5.8e+84) {
tmp = t * z;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (a * b) <= -7.8e+113: tmp = a * b elif (a * b) <= 0.0: tmp = c * i elif (a * b) <= 5.8e+84: tmp = t * z else: tmp = a * b return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(a * b) <= -7.8e+113) tmp = Float64(a * b); elseif (Float64(a * b) <= 0.0) tmp = Float64(c * i); elseif (Float64(a * b) <= 5.8e+84) tmp = Float64(t * z); 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.8e+113) tmp = a * b; elseif ((a * b) <= 0.0) tmp = c * i; elseif ((a * b) <= 5.8e+84) tmp = t * z; 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.8e+113], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 0.0], N[(c * i), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 5.8e+84], N[(t * z), $MachinePrecision], N[(a * b), $MachinePrecision]]]]
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -7.8 \cdot 10^{+113}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 0:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;a \cdot b \leq 5.8 \cdot 10^{+84}:\\
\;\;\;\;t \cdot z\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
if (*.f64 a b) < -7.8000000000000004e113 or 5.7999999999999998e84 < (*.f64 a b) Initial program 96.2%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6476.1%
Applied rewrites76.1%
lift-fma.f64N/A
lift-fma.f64N/A
associate-+r+N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6476.1%
Applied rewrites76.1%
Taylor expanded in x around inf
lower-*.f6428.1%
Applied rewrites28.1%
Taylor expanded in a around inf
lower-*.f6427.5%
Applied rewrites27.5%
if -7.8000000000000004e113 < (*.f64 a b) < 0.0Initial program 96.2%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6476.1%
Applied rewrites76.1%
lift-fma.f64N/A
lift-fma.f64N/A
associate-+r+N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6476.1%
Applied rewrites76.1%
Taylor expanded in x around inf
lower-*.f6428.1%
Applied rewrites28.1%
Taylor expanded in c around inf
lower-*.f6427.7%
Applied rewrites27.7%
if 0.0 < (*.f64 a b) < 5.7999999999999998e84Initial program 96.2%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6476.1%
Applied rewrites76.1%
lift-fma.f64N/A
lift-fma.f64N/A
associate-+r+N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6476.1%
Applied rewrites76.1%
Taylor expanded in x around inf
lower-*.f6428.1%
Applied rewrites28.1%
Taylor expanded in z around inf
lower-*.f6426.7%
Applied rewrites26.7%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* a b) -7.8e+113) (* a b) (if (<= (* a b) 1.7e+83) (* 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.8e+113) {
tmp = a * b;
} else if ((a * b) <= 1.7e+83) {
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.8d+113)) then
tmp = a * b
else if ((a * b) <= 1.7d+83) 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.8e+113) {
tmp = a * b;
} else if ((a * b) <= 1.7e+83) {
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.8e+113: tmp = a * b elif (a * b) <= 1.7e+83: 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.8e+113) tmp = Float64(a * b); elseif (Float64(a * b) <= 1.7e+83) 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.8e+113) tmp = a * b; elseif ((a * b) <= 1.7e+83) 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.8e+113], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1.7e+83], N[(c * i), $MachinePrecision], N[(a * b), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -7.8 \cdot 10^{+113}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 1.7 \cdot 10^{+83}:\\
\;\;\;\;c \cdot i\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
if (*.f64 a b) < -7.8000000000000004e113 or 1.6999999999999999e83 < (*.f64 a b) Initial program 96.2%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6476.1%
Applied rewrites76.1%
lift-fma.f64N/A
lift-fma.f64N/A
associate-+r+N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6476.1%
Applied rewrites76.1%
Taylor expanded in x around inf
lower-*.f6428.1%
Applied rewrites28.1%
Taylor expanded in a around inf
lower-*.f6427.5%
Applied rewrites27.5%
if -7.8000000000000004e113 < (*.f64 a b) < 1.6999999999999999e83Initial program 96.2%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6476.1%
Applied rewrites76.1%
lift-fma.f64N/A
lift-fma.f64N/A
associate-+r+N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6476.1%
Applied rewrites76.1%
Taylor expanded in x around inf
lower-*.f6428.1%
Applied rewrites28.1%
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 96.2%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6476.1%
Applied rewrites76.1%
lift-fma.f64N/A
lift-fma.f64N/A
associate-+r+N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6476.1%
Applied rewrites76.1%
Taylor expanded in x around inf
lower-*.f6428.1%
Applied rewrites28.1%
Taylor expanded in a around inf
lower-*.f6427.5%
Applied rewrites27.5%
herbie shell --seed 2025202
(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)))