
(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 (let* ((t_1 (+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))) (if (<= t_1 INFINITY) t_1 (fma a b (fma c i (* x y))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (((x * y) + (z * t)) + (a * b)) + (c * i);
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = fma(a, b, fma(c, i, (x * y)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) + Float64(c * i)) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = fma(a, b, fma(c, i, Float64(x * y))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(a * b + N[(c * i + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_1 := \left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, b, \mathsf{fma}\left(c, i, x \cdot y\right)\right)\\
\end{array}
if (+.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) (*.f64 c i)) < +inf.0Initial program 95.6%
if +inf.0 < (+.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) (*.f64 c i)) Initial program 95.6%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.0%
Applied rewrites75.0%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* a b) -2e+79)
(fma a b (fma c i (* x y)))
(if (<= (* a b) 4e+113)
(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+79) {
tmp = fma(a, b, fma(c, i, (x * y)));
} else if ((a * b) <= 4e+113) {
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+79) tmp = fma(a, b, fma(c, i, Float64(x * y))); elseif (Float64(a * b) <= 4e+113) 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+79], N[(a * b + N[(c * i + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 4e+113], 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^{+79}:\\
\;\;\;\;\mathsf{fma}\left(a, b, \mathsf{fma}\left(c, i, x \cdot y\right)\right)\\
\mathbf{elif}\;a \cdot b \leq 4 \cdot 10^{+113}:\\
\;\;\;\;\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) < -1.9999999999999999e79Initial program 95.6%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.0%
Applied rewrites75.0%
if -1.9999999999999999e79 < (*.f64 a b) < 4.0000000000000001e113Initial program 95.6%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6474.7%
Applied rewrites74.7%
if 4.0000000000000001e113 < (*.f64 a b) Initial program 95.6%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.2%
Applied rewrites75.2%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma a b (fma c i (* t z)))))
(if (<= (* z t) -5000000000000.0)
t_1
(if (<= (* z t) 5e+22) (fma a b (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, fma(c, i, (t * z)));
double tmp;
if ((z * t) <= -5000000000000.0) {
tmp = t_1;
} else if ((z * t) <= 5e+22) {
tmp = fma(a, b, 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, fma(c, i, Float64(t * z))) tmp = 0.0 if (Float64(z * t) <= -5000000000000.0) tmp = t_1; elseif (Float64(z * t) <= 5e+22) tmp = fma(a, b, 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 + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -5000000000000.0], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 5e+22], N[(a * b + N[(c * i + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, b, \mathsf{fma}\left(c, i, t \cdot z\right)\right)\\
\mathbf{if}\;z \cdot t \leq -5000000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+22}:\\
\;\;\;\;\mathsf{fma}\left(a, b, \mathsf{fma}\left(c, i, x \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (*.f64 z t) < -5e12 or 4.9999999999999996e22 < (*.f64 z t) Initial program 95.6%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.2%
Applied rewrites75.2%
if -5e12 < (*.f64 z t) < 4.9999999999999996e22Initial program 95.6%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.0%
Applied rewrites75.0%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma t z (* x y))))
(if (<= (* x y) -2e+164)
t_1
(if (<= (* x y) 4e+188) (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(t, z, (x * y));
double tmp;
if ((x * y) <= -2e+164) {
tmp = t_1;
} else if ((x * y) <= 4e+188) {
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(t, z, Float64(x * y)) tmp = 0.0 if (Float64(x * y) <= -2e+164) tmp = t_1; elseif (Float64(x * y) <= 4e+188) 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[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -2e+164], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 4e+188], N[(a * b + N[(c * i + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \mathsf{fma}\left(t, z, x \cdot y\right)\\
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+164}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 4 \cdot 10^{+188}:\\
\;\;\;\;\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) < -2e164 or 4.0000000000000001e188 < (*.f64 x y) Initial program 95.6%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6474.7%
Applied rewrites74.7%
Taylor expanded in i around inf
lower-*.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6465.4%
Applied rewrites65.4%
Taylor expanded in c around 0
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6442.0%
Applied rewrites42.0%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-*.f6451.3%
Applied rewrites51.3%
if -2e164 < (*.f64 x y) < 4.0000000000000001e188Initial program 95.6%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.2%
Applied rewrites75.2%
(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+164)
t_1
(if (<= t_2 1e+196) (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+164) {
tmp = t_1;
} else if (t_2 <= 1e+196) {
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+164) tmp = t_1; elseif (t_2 <= 1e+196) 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+164], t$95$1, If[LessEqual[t$95$2, 1e+196], 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^{+164}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+196}:\\
\;\;\;\;\mathsf{fma}\left(a, b, c \cdot i\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (+.f64 (*.f64 x y) (*.f64 z t)) < -2e164 or 9.9999999999999995e195 < (+.f64 (*.f64 x y) (*.f64 z t)) Initial program 95.6%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6474.7%
Applied rewrites74.7%
Taylor expanded in i around inf
lower-*.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6465.4%
Applied rewrites65.4%
Taylor expanded in c around 0
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6442.0%
Applied rewrites42.0%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-*.f6451.3%
Applied rewrites51.3%
if -2e164 < (+.f64 (*.f64 x y) (*.f64 z t)) < 9.9999999999999995e195Initial program 95.6%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.0%
Applied rewrites75.0%
Taylor expanded in x around 0
lower-*.f6451.9%
Applied rewrites51.9%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma a b (* x y))))
(if (<= (* a b) -5e+190)
t_1
(if (<= (* a b) -5e-123)
(fma c i (* x y))
(if (<= (* a b) 1e+22) (fma t z (* 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, (x * y));
double tmp;
if ((a * b) <= -5e+190) {
tmp = t_1;
} else if ((a * b) <= -5e-123) {
tmp = fma(c, i, (x * y));
} else if ((a * b) <= 1e+22) {
tmp = fma(t, z, (x * y));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(a, b, Float64(x * y)) tmp = 0.0 if (Float64(a * b) <= -5e+190) tmp = t_1; elseif (Float64(a * b) <= -5e-123) tmp = fma(c, i, Float64(x * y)); elseif (Float64(a * b) <= 1e+22) tmp = fma(t, z, 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[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -5e+190], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], -5e-123], N[(c * i + N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1e+22], N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, b, x \cdot y\right)\\
\mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+190}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \cdot b \leq -5 \cdot 10^{-123}:\\
\;\;\;\;\mathsf{fma}\left(c, i, x \cdot y\right)\\
\mathbf{elif}\;a \cdot b \leq 10^{+22}:\\
\;\;\;\;\mathsf{fma}\left(t, z, x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (*.f64 a b) < -5.0000000000000004e190 or 1e22 < (*.f64 a b) Initial program 95.6%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.0%
Applied rewrites75.0%
Taylor expanded in x around 0
lower-*.f6451.9%
Applied rewrites51.9%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-*.f6451.5%
Applied rewrites51.5%
if -5.0000000000000004e190 < (*.f64 a b) < -5.0000000000000003e-123Initial program 95.6%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6474.7%
Applied rewrites74.7%
Taylor expanded in i around inf
lower-*.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6465.4%
Applied rewrites65.4%
Taylor expanded in z around 0
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6448.0%
Applied rewrites48.0%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-*.f6451.4%
Applied rewrites51.4%
if -5.0000000000000003e-123 < (*.f64 a b) < 1e22Initial program 95.6%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6474.7%
Applied rewrites74.7%
Taylor expanded in i around inf
lower-*.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6465.4%
Applied rewrites65.4%
Taylor expanded in c around 0
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6442.0%
Applied rewrites42.0%
Taylor expanded in x 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 t z (* x y))))
(if (<= (* z t) -1e+228)
t_1
(if (<= (* z t) 4.5e+44) (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(t, z, (x * y));
double tmp;
if ((z * t) <= -1e+228) {
tmp = t_1;
} else if ((z * t) <= 4.5e+44) {
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(t, z, Float64(x * y)) tmp = 0.0 if (Float64(z * t) <= -1e+228) tmp = t_1; elseif (Float64(z * t) <= 4.5e+44) 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[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -1e+228], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 4.5e+44], N[(a * b + N[(x * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \mathsf{fma}\left(t, z, x \cdot y\right)\\
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+228}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq 4.5 \cdot 10^{+44}:\\
\;\;\;\;\mathsf{fma}\left(a, b, x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (*.f64 z t) < -9.9999999999999992e227 or 4.5e44 < (*.f64 z t) Initial program 95.6%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6474.7%
Applied rewrites74.7%
Taylor expanded in i around inf
lower-*.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6465.4%
Applied rewrites65.4%
Taylor expanded in c around 0
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6442.0%
Applied rewrites42.0%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-*.f6451.3%
Applied rewrites51.3%
if -9.9999999999999992e227 < (*.f64 z t) < 4.5e44Initial program 95.6%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.0%
Applied rewrites75.0%
Taylor expanded in x around 0
lower-*.f6451.9%
Applied rewrites51.9%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-*.f6451.5%
Applied rewrites51.5%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* z t) -1e+228) (* t z) (if (<= (* z t) 1e+47) (fma a b (* x y)) (* t z))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((z * t) <= -1e+228) {
tmp = t * z;
} else if ((z * t) <= 1e+47) {
tmp = fma(a, b, (x * y));
} else {
tmp = t * z;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(z * t) <= -1e+228) tmp = Float64(t * z); elseif (Float64(z * t) <= 1e+47) tmp = fma(a, b, Float64(x * y)); else tmp = Float64(t * z); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(z * t), $MachinePrecision], -1e+228], N[(t * z), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1e+47], N[(a * b + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(t * z), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+228}:\\
\;\;\;\;t \cdot z\\
\mathbf{elif}\;z \cdot t \leq 10^{+47}:\\
\;\;\;\;\mathsf{fma}\left(a, b, x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot z\\
\end{array}
if (*.f64 z t) < -9.9999999999999992e227 or 1e47 < (*.f64 z t) Initial program 95.6%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6474.7%
Applied rewrites74.7%
Taylor expanded in i around inf
lower-*.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6465.4%
Applied rewrites65.4%
Taylor expanded in c around 0
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6442.0%
Applied rewrites42.0%
Taylor expanded in x around 0
lower-*.f6427.4%
Applied rewrites27.4%
if -9.9999999999999992e227 < (*.f64 z t) < 1e47Initial program 95.6%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.0%
Applied rewrites75.0%
Taylor expanded in x around 0
lower-*.f6451.9%
Applied rewrites51.9%
Taylor expanded in c around 0
lower-fma.f64N/A
lower-*.f6451.5%
Applied rewrites51.5%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (- (* (- y) x))))
(if (<= (* a b) -9.2e+273)
(* a b)
(if (<= (* a b) -1.16e+64)
t_1
(if (<= (* a b) 1.9e-175)
(* i c)
(if (<= (* a b) 7.5e+126) t_1 (* a b)))))))double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = -(-y * x);
double tmp;
if ((a * b) <= -9.2e+273) {
tmp = a * b;
} else if ((a * b) <= -1.16e+64) {
tmp = t_1;
} else if ((a * b) <= 1.9e-175) {
tmp = i * c;
} else if ((a * b) <= 7.5e+126) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = -(-y * x)
if ((a * b) <= (-9.2d+273)) then
tmp = a * b
else if ((a * b) <= (-1.16d+64)) then
tmp = t_1
else if ((a * b) <= 1.9d-175) then
tmp = i * c
else if ((a * b) <= 7.5d+126) then
tmp = t_1
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 t_1 = -(-y * x);
double tmp;
if ((a * b) <= -9.2e+273) {
tmp = a * b;
} else if ((a * b) <= -1.16e+64) {
tmp = t_1;
} else if ((a * b) <= 1.9e-175) {
tmp = i * c;
} else if ((a * b) <= 7.5e+126) {
tmp = t_1;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = -(-y * x) tmp = 0 if (a * b) <= -9.2e+273: tmp = a * b elif (a * b) <= -1.16e+64: tmp = t_1 elif (a * b) <= 1.9e-175: tmp = i * c elif (a * b) <= 7.5e+126: tmp = t_1 else: tmp = a * b return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(-Float64(Float64(-y) * x)) tmp = 0.0 if (Float64(a * b) <= -9.2e+273) tmp = Float64(a * b); elseif (Float64(a * b) <= -1.16e+64) tmp = t_1; elseif (Float64(a * b) <= 1.9e-175) tmp = Float64(i * c); elseif (Float64(a * b) <= 7.5e+126) tmp = t_1; else tmp = Float64(a * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = -(-y * x); tmp = 0.0; if ((a * b) <= -9.2e+273) tmp = a * b; elseif ((a * b) <= -1.16e+64) tmp = t_1; elseif ((a * b) <= 1.9e-175) tmp = i * c; elseif ((a * b) <= 7.5e+126) tmp = t_1; else tmp = a * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = (-N[((-y) * x), $MachinePrecision])}, If[LessEqual[N[(a * b), $MachinePrecision], -9.2e+273], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -1.16e+64], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 1.9e-175], N[(i * c), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 7.5e+126], t$95$1, N[(a * b), $MachinePrecision]]]]]]
\begin{array}{l}
t_1 := -\left(-y\right) \cdot x\\
\mathbf{if}\;a \cdot b \leq -9.2 \cdot 10^{+273}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq -1.16 \cdot 10^{+64}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \cdot b \leq 1.9 \cdot 10^{-175}:\\
\;\;\;\;i \cdot c\\
\mathbf{elif}\;a \cdot b \leq 7.5 \cdot 10^{+126}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
if (*.f64 a b) < -9.2000000000000001e273 or 7.5000000000000006e126 < (*.f64 a b) Initial program 95.6%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6474.7%
Applied rewrites74.7%
Taylor expanded in i around inf
lower-*.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6465.4%
Applied rewrites65.4%
Taylor expanded in a around inf
lower-*.f6427.6%
Applied rewrites27.6%
if -9.2000000000000001e273 < (*.f64 a b) < -1.16e64 or 1.9e-175 < (*.f64 a b) < 7.5000000000000006e126Initial program 95.6%
Taylor expanded in c around -inf
lower-*.f64N/A
lower-*.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6484.4%
Applied rewrites84.4%
Taylor expanded in x around inf
lower-*.f64N/A
lower-*.f6427.1%
Applied rewrites27.1%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6427.1%
lift-*.f64N/A
lift-*.f64N/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f6427.1%
Applied rewrites27.1%
if -1.16e64 < (*.f64 a b) < 1.9e-175Initial program 95.6%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6474.7%
Applied rewrites74.7%
Taylor expanded in i around inf
lower-*.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6465.4%
Applied rewrites65.4%
Taylor expanded in z around 0
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6448.0%
Applied rewrites48.0%
Taylor expanded in x around 0
Applied rewrites27.5%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* a b) -7.8e+197)
(* a b)
(if (<= (* a b) -6.5e-123)
(* i c)
(if (<= (* a b) 2.05e-10) (* 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+197) {
tmp = a * b;
} else if ((a * b) <= -6.5e-123) {
tmp = i * c;
} else if ((a * b) <= 2.05e-10) {
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+197)) then
tmp = a * b
else if ((a * b) <= (-6.5d-123)) then
tmp = i * c
else if ((a * b) <= 2.05d-10) 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+197) {
tmp = a * b;
} else if ((a * b) <= -6.5e-123) {
tmp = i * c;
} else if ((a * b) <= 2.05e-10) {
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+197: tmp = a * b elif (a * b) <= -6.5e-123: tmp = i * c elif (a * b) <= 2.05e-10: 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+197) tmp = Float64(a * b); elseif (Float64(a * b) <= -6.5e-123) tmp = Float64(i * c); elseif (Float64(a * b) <= 2.05e-10) 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+197) tmp = a * b; elseif ((a * b) <= -6.5e-123) tmp = i * c; elseif ((a * b) <= 2.05e-10) 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+197], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -6.5e-123], N[(i * c), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 2.05e-10], N[(t * z), $MachinePrecision], N[(a * b), $MachinePrecision]]]]
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -7.8 \cdot 10^{+197}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq -6.5 \cdot 10^{-123}:\\
\;\;\;\;i \cdot c\\
\mathbf{elif}\;a \cdot b \leq 2.05 \cdot 10^{-10}:\\
\;\;\;\;t \cdot z\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
if (*.f64 a b) < -7.8e197 or 2.0499999999999999e-10 < (*.f64 a b) Initial program 95.6%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6474.7%
Applied rewrites74.7%
Taylor expanded in i around inf
lower-*.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6465.4%
Applied rewrites65.4%
Taylor expanded in a around inf
lower-*.f6427.6%
Applied rewrites27.6%
if -7.8e197 < (*.f64 a b) < -6.4999999999999994e-123Initial program 95.6%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6474.7%
Applied rewrites74.7%
Taylor expanded in i around inf
lower-*.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6465.4%
Applied rewrites65.4%
Taylor expanded in z around 0
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6448.0%
Applied rewrites48.0%
Taylor expanded in x around 0
Applied rewrites27.5%
if -6.4999999999999994e-123 < (*.f64 a b) < 2.0499999999999999e-10Initial program 95.6%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6474.7%
Applied rewrites74.7%
Taylor expanded in i around inf
lower-*.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6465.4%
Applied rewrites65.4%
Taylor expanded in c around 0
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6442.0%
Applied rewrites42.0%
Taylor expanded in x around 0
lower-*.f6427.4%
Applied rewrites27.4%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* z t) -1e+193) (* t z) (if (<= (* z t) 2e+184) (* i c) (* t z))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((z * t) <= -1e+193) {
tmp = t * z;
} else if ((z * t) <= 2e+184) {
tmp = i * c;
} else {
tmp = t * z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if ((z * t) <= (-1d+193)) then
tmp = t * z
else if ((z * t) <= 2d+184) then
tmp = i * c
else
tmp = t * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((z * t) <= -1e+193) {
tmp = t * z;
} else if ((z * t) <= 2e+184) {
tmp = i * c;
} else {
tmp = t * z;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (z * t) <= -1e+193: tmp = t * z elif (z * t) <= 2e+184: tmp = i * c else: tmp = t * z return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(z * t) <= -1e+193) tmp = Float64(t * z); elseif (Float64(z * t) <= 2e+184) tmp = Float64(i * c); else tmp = Float64(t * z); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((z * t) <= -1e+193) tmp = t * z; elseif ((z * t) <= 2e+184) tmp = i * c; else tmp = t * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(z * t), $MachinePrecision], -1e+193], N[(t * z), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e+184], N[(i * c), $MachinePrecision], N[(t * z), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+193}:\\
\;\;\;\;t \cdot z\\
\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+184}:\\
\;\;\;\;i \cdot c\\
\mathbf{else}:\\
\;\;\;\;t \cdot z\\
\end{array}
if (*.f64 z t) < -1.0000000000000001e193 or 2e184 < (*.f64 z t) Initial program 95.6%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6474.7%
Applied rewrites74.7%
Taylor expanded in i around inf
lower-*.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6465.4%
Applied rewrites65.4%
Taylor expanded in c around 0
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6442.0%
Applied rewrites42.0%
Taylor expanded in x around 0
lower-*.f6427.4%
Applied rewrites27.4%
if -1.0000000000000001e193 < (*.f64 z t) < 2e184Initial program 95.6%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6474.7%
Applied rewrites74.7%
Taylor expanded in i around inf
lower-*.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6465.4%
Applied rewrites65.4%
Taylor expanded in z around 0
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6448.0%
Applied rewrites48.0%
Taylor expanded in x around 0
Applied rewrites27.5%
(FPCore (x y z t a b c i) :precision binary64 (* t z))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return t * z;
}
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 = t * z
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return t * z;
}
def code(x, y, z, t, a, b, c, i): return t * z
function code(x, y, z, t, a, b, c, i) return Float64(t * z) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = t * z; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(t * z), $MachinePrecision]
t \cdot z
Initial program 95.6%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6474.7%
Applied rewrites74.7%
Taylor expanded in i around inf
lower-*.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6465.4%
Applied rewrites65.4%
Taylor expanded in c around 0
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6442.0%
Applied rewrites42.0%
Taylor expanded in x around 0
lower-*.f6427.4%
Applied rewrites27.4%
herbie shell --seed 2025223
(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)))