
(FPCore (x y z t a b c i) :precision binary64 (+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
code = (((x * y) + (z * t)) + (a * b)) + (c * i)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
def code(x, y, z, t, a, b, c, i): return (((x * y) + (z * t)) + (a * b)) + (c * i)
function code(x, y, z, t, a, b, c, i) return Float64(Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) + Float64(c * i)) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = (((x * y) + (z * t)) + (a * b)) + (c * i); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i
\end{array}
Herbie found 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]
\begin{array}{l}
\\
\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i
\end{array}
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))) (if (<= t_1 INFINITY) t_1 (fma i c (* y x)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (((x * y) + (z * t)) + (a * b)) + (c * i);
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = fma(i, c, (y * x));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) + Float64(c * i)) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = fma(i, c, Float64(y * x)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(i * c + N[(y * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(i, c, y \cdot x\right)\\
\end{array}
\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 x around inf
*-commutativeN/A
lower-*.f6452.1
Applied rewrites52.1%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6452.6
Applied rewrites52.6%
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (fma t z (* y x))) (t_2 (fma b a t_1))) (if (<= (* a b) -1e+32) t_2 (if (<= (* a b) 1e+145) (fma i c t_1) t_2))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(t, z, (y * x));
double t_2 = fma(b, a, t_1);
double tmp;
if ((a * b) <= -1e+32) {
tmp = t_2;
} else if ((a * b) <= 1e+145) {
tmp = fma(i, c, t_1);
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(t, z, Float64(y * x)) t_2 = fma(b, a, t_1) tmp = 0.0 if (Float64(a * b) <= -1e+32) tmp = t_2; elseif (Float64(a * b) <= 1e+145) tmp = fma(i, c, t_1); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(b * a + t$95$1), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -1e+32], t$95$2, If[LessEqual[N[(a * b), $MachinePrecision], 1e+145], N[(i * c + t$95$1), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t, z, y \cdot x\right)\\
t_2 := \mathsf{fma}\left(b, a, t\_1\right)\\
\mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+32}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;a \cdot b \leq 10^{+145}:\\
\;\;\;\;\mathsf{fma}\left(i, c, t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 a b) < -1.00000000000000005e32 or 9.9999999999999999e144 < (*.f64 a b) Initial program 95.6%
Taylor expanded in c around 0
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6474.3
Applied rewrites74.3%
if -1.00000000000000005e32 < (*.f64 a b) < 9.9999999999999999e144Initial program 95.6%
Taylor expanded in a around 0
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6476.0
Applied rewrites76.0%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* c i) -1e+180) (fma i c (* y x)) (if (<= (* c i) 2e+228) (fma b a (fma t z (* y x))) (+ (* t z) (* 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) <= -1e+180) {
tmp = fma(i, c, (y * x));
} else if ((c * i) <= 2e+228) {
tmp = fma(b, a, fma(t, z, (y * x)));
} else {
tmp = (t * z) + (c * i);
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(c * i) <= -1e+180) tmp = fma(i, c, Float64(y * x)); elseif (Float64(c * i) <= 2e+228) tmp = fma(b, a, fma(t, z, Float64(y * x))); else tmp = Float64(Float64(t * z) + Float64(c * i)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(c * i), $MachinePrecision], -1e+180], N[(i * c + N[(y * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 2e+228], N[(b * a + N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t * z), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -1 \cdot 10^{+180}:\\
\;\;\;\;\mathsf{fma}\left(i, c, y \cdot x\right)\\
\mathbf{elif}\;c \cdot i \leq 2 \cdot 10^{+228}:\\
\;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(t, z, y \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot z + c \cdot i\\
\end{array}
\end{array}
if (*.f64 c i) < -1e180Initial program 95.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6452.1
Applied rewrites52.1%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6452.6
Applied rewrites52.6%
if -1e180 < (*.f64 c i) < 1.9999999999999998e228Initial program 95.6%
Taylor expanded in c around 0
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6474.3
Applied rewrites74.3%
if 1.9999999999999998e228 < (*.f64 c i) Initial program 95.6%
Taylor expanded in z around inf
lower-*.f6451.9
Applied rewrites51.9%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* x y) -1e+69)
(fma i c (* y x))
(if (<= (* x y) -5e-57)
(fma b a (* t z))
(if (<= (* x y) 2e+89) (fma i c (* t z)) (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 ((x * y) <= -1e+69) {
tmp = fma(i, c, (y * x));
} else if ((x * y) <= -5e-57) {
tmp = fma(b, a, (t * z));
} else if ((x * y) <= 2e+89) {
tmp = fma(i, c, (t * z));
} else {
tmp = fma(b, a, (y * x));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(x * y) <= -1e+69) tmp = fma(i, c, Float64(y * x)); elseif (Float64(x * y) <= -5e-57) tmp = fma(b, a, Float64(t * z)); elseif (Float64(x * y) <= 2e+89) tmp = fma(i, c, Float64(t * z)); else tmp = fma(b, a, Float64(y * x)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(x * y), $MachinePrecision], -1e+69], N[(i * c + N[(y * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -5e-57], N[(b * a + N[(t * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+89], N[(i * c + N[(t * z), $MachinePrecision]), $MachinePrecision], N[(b * a + N[(y * x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+69}:\\
\;\;\;\;\mathsf{fma}\left(i, c, y \cdot x\right)\\
\mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{-57}:\\
\;\;\;\;\mathsf{fma}\left(b, a, t \cdot z\right)\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+89}:\\
\;\;\;\;\mathsf{fma}\left(i, c, t \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b, a, y \cdot x\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -1.0000000000000001e69Initial program 95.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6452.1
Applied rewrites52.1%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6452.6
Applied rewrites52.6%
if -1.0000000000000001e69 < (*.f64 x y) < -5.0000000000000002e-57Initial program 95.6%
Taylor expanded in c around 0
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6474.3
Applied rewrites74.3%
Taylor expanded in x around 0
lift-*.f6450.6
Applied rewrites50.6%
if -5.0000000000000002e-57 < (*.f64 x y) < 1.99999999999999999e89Initial program 95.6%
Taylor expanded in z around inf
lower-*.f6451.9
Applied rewrites51.9%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6452.4
+-commutative52.4
*-commutative52.4
+-commutative52.4
associate-+r+52.4
*-commutative52.4
*-commutative52.4
associate-+r+52.4
Applied rewrites52.4%
if 1.99999999999999999e89 < (*.f64 x y) Initial program 95.6%
Taylor expanded in c around 0
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6474.3
Applied rewrites74.3%
Taylor expanded in x around inf
*-commutativeN/A
lift-*.f6450.8
Applied rewrites50.8%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* a b) -1e+32)
(fma b a (* y x))
(if (<= (* a b) -2e-105)
(fma i c (* t z))
(if (<= (* a b) 8e+144) (fma t z (* y x)) (fma b a (* t z))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((a * b) <= -1e+32) {
tmp = fma(b, a, (y * x));
} else if ((a * b) <= -2e-105) {
tmp = fma(i, c, (t * z));
} else if ((a * b) <= 8e+144) {
tmp = fma(t, z, (y * x));
} else {
tmp = fma(b, a, (t * z));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(a * b) <= -1e+32) tmp = fma(b, a, Float64(y * x)); elseif (Float64(a * b) <= -2e-105) tmp = fma(i, c, Float64(t * z)); elseif (Float64(a * b) <= 8e+144) tmp = fma(t, z, Float64(y * x)); else tmp = fma(b, a, Float64(t * z)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(a * b), $MachinePrecision], -1e+32], N[(b * a + N[(y * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -2e-105], N[(i * c + N[(t * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 8e+144], N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision], N[(b * a + N[(t * z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+32}:\\
\;\;\;\;\mathsf{fma}\left(b, a, y \cdot x\right)\\
\mathbf{elif}\;a \cdot b \leq -2 \cdot 10^{-105}:\\
\;\;\;\;\mathsf{fma}\left(i, c, t \cdot z\right)\\
\mathbf{elif}\;a \cdot b \leq 8 \cdot 10^{+144}:\\
\;\;\;\;\mathsf{fma}\left(t, z, y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b, a, t \cdot z\right)\\
\end{array}
\end{array}
if (*.f64 a b) < -1.00000000000000005e32Initial program 95.6%
Taylor expanded in c around 0
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6474.3
Applied rewrites74.3%
Taylor expanded in x around inf
*-commutativeN/A
lift-*.f6450.8
Applied rewrites50.8%
if -1.00000000000000005e32 < (*.f64 a b) < -1.99999999999999993e-105Initial program 95.6%
Taylor expanded in z around inf
lower-*.f6451.9
Applied rewrites51.9%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6452.4
+-commutative52.4
*-commutative52.4
+-commutative52.4
associate-+r+52.4
*-commutative52.4
*-commutative52.4
associate-+r+52.4
Applied rewrites52.4%
if -1.99999999999999993e-105 < (*.f64 a b) < 8.00000000000000019e144Initial program 95.6%
Taylor expanded in c around 0
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6474.3
Applied rewrites74.3%
Taylor expanded in x around 0
lift-*.f6450.6
Applied rewrites50.6%
Taylor expanded in a around 0
lower-fma.f64N/A
*-commutativeN/A
lift-*.f6451.9
Applied rewrites51.9%
if 8.00000000000000019e144 < (*.f64 a b) Initial program 95.6%
Taylor expanded in c around 0
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6474.3
Applied rewrites74.3%
Taylor expanded in x around 0
lift-*.f6450.6
Applied rewrites50.6%
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (fma b a (* y x)))) (if (<= (* x y) -1e+69) t_1 (if (<= (* x y) 1e+78) (fma b a (* 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(b, a, (y * x));
double tmp;
if ((x * y) <= -1e+69) {
tmp = t_1;
} else if ((x * y) <= 1e+78) {
tmp = fma(b, a, (t * z));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(b, a, Float64(y * x)) tmp = 0.0 if (Float64(x * y) <= -1e+69) tmp = t_1; elseif (Float64(x * y) <= 1e+78) tmp = fma(b, a, 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[(b * a + N[(y * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -1e+69], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 1e+78], N[(b * a + N[(t * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(b, a, y \cdot x\right)\\
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+69}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 10^{+78}:\\
\;\;\;\;\mathsf{fma}\left(b, a, t \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 x y) < -1.0000000000000001e69 or 1.00000000000000001e78 < (*.f64 x y) Initial program 95.6%
Taylor expanded in c around 0
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6474.3
Applied rewrites74.3%
Taylor expanded in x around inf
*-commutativeN/A
lift-*.f6450.8
Applied rewrites50.8%
if -1.0000000000000001e69 < (*.f64 x y) < 1.00000000000000001e78Initial program 95.6%
Taylor expanded in c around 0
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6474.3
Applied rewrites74.3%
Taylor expanded in x around 0
lift-*.f6450.6
Applied rewrites50.6%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma b a (* t z))))
(if (<= (* a b) -5e+94)
t_1
(if (<= (* a b) 8e+144) (fma t z (* y x)) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(b, a, (t * z));
double tmp;
if ((a * b) <= -5e+94) {
tmp = t_1;
} else if ((a * b) <= 8e+144) {
tmp = fma(t, z, (y * x));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(b, a, Float64(t * z)) tmp = 0.0 if (Float64(a * b) <= -5e+94) tmp = t_1; elseif (Float64(a * b) <= 8e+144) tmp = fma(t, z, Float64(y * x)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(b * a + N[(t * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -5e+94], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 8e+144], N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(b, a, t \cdot z\right)\\
\mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+94}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \cdot b \leq 8 \cdot 10^{+144}:\\
\;\;\;\;\mathsf{fma}\left(t, z, y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 a b) < -5.0000000000000001e94 or 8.00000000000000019e144 < (*.f64 a b) Initial program 95.6%
Taylor expanded in c around 0
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6474.3
Applied rewrites74.3%
Taylor expanded in x around 0
lift-*.f6450.6
Applied rewrites50.6%
if -5.0000000000000001e94 < (*.f64 a b) < 8.00000000000000019e144Initial program 95.6%
Taylor expanded in c around 0
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6474.3
Applied rewrites74.3%
Taylor expanded in x around 0
lift-*.f6450.6
Applied rewrites50.6%
Taylor expanded in a around 0
lower-fma.f64N/A
*-commutativeN/A
lift-*.f6451.9
Applied rewrites51.9%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* c i) -1e+180) (* i c) (if (<= (* c i) 2e+227) (fma t z (* y x)) (* i c))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((c * i) <= -1e+180) {
tmp = i * c;
} else if ((c * i) <= 2e+227) {
tmp = fma(t, z, (y * x));
} else {
tmp = i * c;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(c * i) <= -1e+180) tmp = Float64(i * c); elseif (Float64(c * i) <= 2e+227) tmp = fma(t, z, Float64(y * x)); else tmp = Float64(i * c); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(c * i), $MachinePrecision], -1e+180], N[(i * c), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 2e+227], N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision], N[(i * c), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -1 \cdot 10^{+180}:\\
\;\;\;\;i \cdot c\\
\mathbf{elif}\;c \cdot i \leq 2 \cdot 10^{+227}:\\
\;\;\;\;\mathsf{fma}\left(t, z, y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;i \cdot c\\
\end{array}
\end{array}
if (*.f64 c i) < -1e180 or 2.0000000000000002e227 < (*.f64 c i) Initial program 95.6%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f6428.0
Applied rewrites28.0%
if -1e180 < (*.f64 c i) < 2.0000000000000002e227Initial program 95.6%
Taylor expanded in c around 0
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6474.3
Applied rewrites74.3%
Taylor expanded in x around 0
lift-*.f6450.6
Applied rewrites50.6%
Taylor expanded in a around 0
lower-fma.f64N/A
*-commutativeN/A
lift-*.f6451.9
Applied rewrites51.9%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* x y) -1e+69) (* y x) (if (<= (* x y) -6e-80) (* b a) (if (<= (* x y) 2e+136) (* t z) (* y x)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((x * y) <= -1e+69) {
tmp = y * x;
} else if ((x * y) <= -6e-80) {
tmp = b * a;
} else if ((x * y) <= 2e+136) {
tmp = t * z;
} else {
tmp = y * x;
}
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 ((x * y) <= (-1d+69)) then
tmp = y * x
else if ((x * y) <= (-6d-80)) then
tmp = b * a
else if ((x * y) <= 2d+136) then
tmp = t * z
else
tmp = y * x
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 ((x * y) <= -1e+69) {
tmp = y * x;
} else if ((x * y) <= -6e-80) {
tmp = b * a;
} else if ((x * y) <= 2e+136) {
tmp = t * z;
} else {
tmp = y * x;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (x * y) <= -1e+69: tmp = y * x elif (x * y) <= -6e-80: tmp = b * a elif (x * y) <= 2e+136: tmp = t * z else: tmp = y * x return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(x * y) <= -1e+69) tmp = Float64(y * x); elseif (Float64(x * y) <= -6e-80) tmp = Float64(b * a); elseif (Float64(x * y) <= 2e+136) tmp = Float64(t * z); else tmp = Float64(y * x); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((x * y) <= -1e+69) tmp = y * x; elseif ((x * y) <= -6e-80) tmp = b * a; elseif ((x * y) <= 2e+136) tmp = t * z; else tmp = y * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(x * y), $MachinePrecision], -1e+69], N[(y * x), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -6e-80], N[(b * a), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+136], N[(t * z), $MachinePrecision], N[(y * x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+69}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;x \cdot y \leq -6 \cdot 10^{-80}:\\
\;\;\;\;b \cdot a\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+136}:\\
\;\;\;\;t \cdot z\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\end{array}
if (*.f64 x y) < -1.0000000000000001e69 or 2.00000000000000012e136 < (*.f64 x y) Initial program 95.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6427.7
Applied rewrites27.7%
if -1.0000000000000001e69 < (*.f64 x y) < -6.00000000000000014e-80Initial program 95.6%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6426.1
Applied rewrites26.1%
if -6.00000000000000014e-80 < (*.f64 x y) < 2.00000000000000012e136Initial program 95.6%
Taylor expanded in z around inf
lower-*.f6427.5
Applied rewrites27.5%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* c i) -1e+180) (* i c) (if (<= (* c i) 1e+97) (* t z) (* i c))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((c * i) <= -1e+180) {
tmp = i * c;
} else if ((c * i) <= 1e+97) {
tmp = t * z;
} else {
tmp = i * c;
}
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) <= (-1d+180)) then
tmp = i * c
else if ((c * i) <= 1d+97) then
tmp = t * z
else
tmp = i * c
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) <= -1e+180) {
tmp = i * c;
} else if ((c * i) <= 1e+97) {
tmp = t * z;
} else {
tmp = i * c;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (c * i) <= -1e+180: tmp = i * c elif (c * i) <= 1e+97: tmp = t * z else: tmp = i * c return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(c * i) <= -1e+180) tmp = Float64(i * c); elseif (Float64(c * i) <= 1e+97) tmp = Float64(t * z); else tmp = Float64(i * c); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((c * i) <= -1e+180) tmp = i * c; elseif ((c * i) <= 1e+97) tmp = t * z; else tmp = i * c; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(c * i), $MachinePrecision], -1e+180], N[(i * c), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 1e+97], N[(t * z), $MachinePrecision], N[(i * c), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -1 \cdot 10^{+180}:\\
\;\;\;\;i \cdot c\\
\mathbf{elif}\;c \cdot i \leq 10^{+97}:\\
\;\;\;\;t \cdot z\\
\mathbf{else}:\\
\;\;\;\;i \cdot c\\
\end{array}
\end{array}
if (*.f64 c i) < -1e180 or 1.0000000000000001e97 < (*.f64 c i) Initial program 95.6%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f6428.0
Applied rewrites28.0%
if -1e180 < (*.f64 c i) < 1.0000000000000001e97Initial program 95.6%
Taylor expanded in z around inf
lower-*.f6427.5
Applied rewrites27.5%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* a b) -1e+32) (* b a) (if (<= (* a b) 1e+145) (* i c) (* b a))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((a * b) <= -1e+32) {
tmp = b * a;
} else if ((a * b) <= 1e+145) {
tmp = i * c;
} else {
tmp = b * a;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if ((a * b) <= (-1d+32)) then
tmp = b * a
else if ((a * b) <= 1d+145) then
tmp = i * c
else
tmp = b * a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((a * b) <= -1e+32) {
tmp = b * a;
} else if ((a * b) <= 1e+145) {
tmp = i * c;
} else {
tmp = b * a;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (a * b) <= -1e+32: tmp = b * a elif (a * b) <= 1e+145: tmp = i * c else: tmp = b * a return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(a * b) <= -1e+32) tmp = Float64(b * a); elseif (Float64(a * b) <= 1e+145) tmp = Float64(i * c); else tmp = Float64(b * a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((a * b) <= -1e+32) tmp = b * a; elseif ((a * b) <= 1e+145) tmp = i * c; else tmp = b * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(a * b), $MachinePrecision], -1e+32], N[(b * a), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1e+145], N[(i * c), $MachinePrecision], N[(b * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+32}:\\
\;\;\;\;b \cdot a\\
\mathbf{elif}\;a \cdot b \leq 10^{+145}:\\
\;\;\;\;i \cdot c\\
\mathbf{else}:\\
\;\;\;\;b \cdot a\\
\end{array}
\end{array}
if (*.f64 a b) < -1.00000000000000005e32 or 9.9999999999999999e144 < (*.f64 a b) Initial program 95.6%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6426.1
Applied rewrites26.1%
if -1.00000000000000005e32 < (*.f64 a b) < 9.9999999999999999e144Initial program 95.6%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f6428.0
Applied rewrites28.0%
(FPCore (x y z t a b c i) :precision binary64 (* b a))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return b * a;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b, c, i)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
code = b * a
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return b * a;
}
def code(x, y, z, t, a, b, c, i): return b * a
function code(x, y, z, t, a, b, c, i) return Float64(b * a) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = b * a; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(b * a), $MachinePrecision]
\begin{array}{l}
\\
b \cdot a
\end{array}
Initial program 95.6%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6426.1
Applied rewrites26.1%
herbie shell --seed 2025123
(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)))