
(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}
Sampling outcomes in binary64 precision:
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 b a (fma z t (* i c))))))
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(b, a, fma(z, t, (i * c)));
}
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(b, a, fma(z, t, Float64(i * c))); 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[(b * a + N[(z * t + N[(i * c), $MachinePrecision]), $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(b, a, \mathsf{fma}\left(z, t, i \cdot c\right)\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) (*.f64 c i)) < +inf.0Initial program 100.0%
if +inf.0 < (+.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) (*.f64 c i)) Initial program 0.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6475.0
Applied rewrites75.0%
lift-*.f64N/A
lift-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6483.3
Applied rewrites83.3%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* x y) -5e+36)
(* y x)
(if (<= (* x y) 5e-133)
(* i c)
(if (<= (* x y) 2e-54) (* t z) (if (<= (* x y) 1e+92) (* 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) <= -5e+36) {
tmp = y * x;
} else if ((x * y) <= 5e-133) {
tmp = i * c;
} else if ((x * y) <= 2e-54) {
tmp = t * z;
} else if ((x * y) <= 1e+92) {
tmp = b * a;
} 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) <= (-5d+36)) then
tmp = y * x
else if ((x * y) <= 5d-133) then
tmp = i * c
else if ((x * y) <= 2d-54) then
tmp = t * z
else if ((x * y) <= 1d+92) then
tmp = b * a
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) <= -5e+36) {
tmp = y * x;
} else if ((x * y) <= 5e-133) {
tmp = i * c;
} else if ((x * y) <= 2e-54) {
tmp = t * z;
} else if ((x * y) <= 1e+92) {
tmp = b * a;
} else {
tmp = y * x;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (x * y) <= -5e+36: tmp = y * x elif (x * y) <= 5e-133: tmp = i * c elif (x * y) <= 2e-54: tmp = t * z elif (x * y) <= 1e+92: tmp = b * a else: tmp = y * x return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(x * y) <= -5e+36) tmp = Float64(y * x); elseif (Float64(x * y) <= 5e-133) tmp = Float64(i * c); elseif (Float64(x * y) <= 2e-54) tmp = Float64(t * z); elseif (Float64(x * y) <= 1e+92) tmp = Float64(b * a); 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) <= -5e+36) tmp = y * x; elseif ((x * y) <= 5e-133) tmp = i * c; elseif ((x * y) <= 2e-54) tmp = t * z; elseif ((x * y) <= 1e+92) tmp = b * a; else tmp = y * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(x * y), $MachinePrecision], -5e+36], N[(y * x), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e-133], N[(i * c), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e-54], N[(t * z), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+92], N[(b * a), $MachinePrecision], N[(y * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+36}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-133}:\\
\;\;\;\;i \cdot c\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-54}:\\
\;\;\;\;t \cdot z\\
\mathbf{elif}\;x \cdot y \leq 10^{+92}:\\
\;\;\;\;b \cdot a\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\end{array}
if (*.f64 x y) < -4.99999999999999977e36 or 1e92 < (*.f64 x y) Initial program 93.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6463.4
Applied rewrites63.4%
if -4.99999999999999977e36 < (*.f64 x y) < 4.9999999999999999e-133Initial program 96.5%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f6442.9
Applied rewrites42.9%
if 4.9999999999999999e-133 < (*.f64 x y) < 2.0000000000000001e-54Initial program 92.9%
Taylor expanded in z around inf
lower-*.f6469.0
Applied rewrites69.0%
if 2.0000000000000001e-54 < (*.f64 x y) < 1e92Initial program 96.3%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6460.4
Applied rewrites60.4%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ (* x y) (* z t))))
(if (or (<= t_1 -2e+54) (not (<= t_1 2e+155)))
(fma t z (* y x))
(fma i c (* b a)))))
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);
double tmp;
if ((t_1 <= -2e+54) || !(t_1 <= 2e+155)) {
tmp = fma(t, z, (y * x));
} else {
tmp = fma(i, c, (b * a));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(x * y) + Float64(z * t)) tmp = 0.0 if ((t_1 <= -2e+54) || !(t_1 <= 2e+155)) tmp = fma(t, z, Float64(y * x)); else tmp = fma(i, c, Float64(b * a)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -2e+54], N[Not[LessEqual[t$95$1, 2e+155]], $MachinePrecision]], N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision], N[(i * c + N[(b * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot y + z \cdot t\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+54} \lor \neg \left(t\_1 \leq 2 \cdot 10^{+155}\right):\\
\;\;\;\;\mathsf{fma}\left(t, z, y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(i, c, b \cdot a\right)\\
\end{array}
\end{array}
if (+.f64 (*.f64 x y) (*.f64 z t)) < -2.0000000000000002e54 or 2.00000000000000001e155 < (+.f64 (*.f64 x y) (*.f64 z t)) Initial program 92.9%
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-*.f6486.9
Applied rewrites86.9%
Taylor expanded in a around 0
lower-fma.f64N/A
*-commutativeN/A
lift-*.f6477.8
Applied rewrites77.8%
if -2.0000000000000002e54 < (+.f64 (*.f64 x y) (*.f64 z t)) < 2.00000000000000001e155Initial program 98.2%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6481.7
Applied rewrites81.7%
lift-+.f64N/A
lift-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6481.7
Applied rewrites81.7%
Final simplification79.5%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma t z (* y x))))
(if (<= (* x y) -5e+36)
t_1
(if (<= (* x y) 1e-322)
(fma i c (* t z))
(if (<= (* x y) 1e+92) (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(t, z, (y * x));
double tmp;
if ((x * y) <= -5e+36) {
tmp = t_1;
} else if ((x * y) <= 1e-322) {
tmp = fma(i, c, (t * z));
} else if ((x * y) <= 1e+92) {
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(t, z, Float64(y * x)) tmp = 0.0 if (Float64(x * y) <= -5e+36) tmp = t_1; elseif (Float64(x * y) <= 1e-322) tmp = fma(i, c, Float64(t * z)); elseif (Float64(x * y) <= 1e+92) 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[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -5e+36], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 1e-322], N[(i * c + N[(t * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+92], N[(b * a + N[(t * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t, z, y \cdot x\right)\\
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+36}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 10^{-322}:\\
\;\;\;\;\mathsf{fma}\left(i, c, t \cdot z\right)\\
\mathbf{elif}\;x \cdot y \leq 10^{+92}:\\
\;\;\;\;\mathsf{fma}\left(b, a, t \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 x y) < -4.99999999999999977e36 or 1e92 < (*.f64 x y) Initial program 93.9%
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-*.f6487.3
Applied rewrites87.3%
Taylor expanded in a around 0
lower-fma.f64N/A
*-commutativeN/A
lift-*.f6477.8
Applied rewrites77.8%
if -4.99999999999999977e36 < (*.f64 x y) < 9.88131e-323Initial program 95.8%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6494.9
Applied rewrites94.9%
Taylor expanded in a around 0
*-commutativeN/A
lift-fma.f64N/A
lift-*.f6470.0
Applied rewrites70.0%
if 9.88131e-323 < (*.f64 x y) < 1e92Initial program 96.7%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6498.5
Applied rewrites98.5%
Taylor expanded in z around inf
lift-*.f6475.4
Applied rewrites75.4%
Final simplification74.3%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma t z (* y x))))
(if (<= (* x y) -5e+36)
t_1
(if (<= (* x y) 5e-41)
(fma i c (* t z))
(if (<= (* x y) 2e+84) (* b a) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(t, z, (y * x));
double tmp;
if ((x * y) <= -5e+36) {
tmp = t_1;
} else if ((x * y) <= 5e-41) {
tmp = fma(i, c, (t * z));
} else if ((x * y) <= 2e+84) {
tmp = b * a;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(t, z, Float64(y * x)) tmp = 0.0 if (Float64(x * y) <= -5e+36) tmp = t_1; elseif (Float64(x * y) <= 5e-41) tmp = fma(i, c, Float64(t * z)); elseif (Float64(x * y) <= 2e+84) tmp = Float64(b * a); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -5e+36], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 5e-41], N[(i * c + N[(t * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+84], N[(b * a), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t, z, y \cdot x\right)\\
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+36}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-41}:\\
\;\;\;\;\mathsf{fma}\left(i, c, t \cdot z\right)\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+84}:\\
\;\;\;\;b \cdot a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 x y) < -4.99999999999999977e36 or 2.00000000000000012e84 < (*.f64 x y) Initial program 93.1%
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-*.f6487.6
Applied rewrites87.6%
Taylor expanded in a around 0
lower-fma.f64N/A
*-commutativeN/A
lift-*.f6477.3
Applied rewrites77.3%
if -4.99999999999999977e36 < (*.f64 x y) < 4.9999999999999996e-41Initial program 96.2%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6496.4
Applied rewrites96.4%
Taylor expanded in a around 0
*-commutativeN/A
lift-fma.f64N/A
lift-*.f6468.7
Applied rewrites68.7%
if 4.9999999999999996e-41 < (*.f64 x y) < 2.00000000000000012e84Initial program 100.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6464.8
Applied rewrites64.8%
Final simplification71.8%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* x y) -1e+62) (not (<= (* x y) 2e+23))) (fma b a (fma t z (* y x))) (fma b a (fma z t (* i c)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((x * y) <= -1e+62) || !((x * y) <= 2e+23)) {
tmp = fma(b, a, fma(t, z, (y * x)));
} else {
tmp = fma(b, a, fma(z, t, (i * c)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(x * y) <= -1e+62) || !(Float64(x * y) <= 2e+23)) tmp = fma(b, a, fma(t, z, Float64(y * x))); else tmp = fma(b, a, fma(z, t, Float64(i * c))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -1e+62], N[Not[LessEqual[N[(x * y), $MachinePrecision], 2e+23]], $MachinePrecision]], N[(b * a + N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(b * a + N[(z * t + N[(i * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+62} \lor \neg \left(x \cdot y \leq 2 \cdot 10^{+23}\right):\\
\;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(t, z, y \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(z, t, i \cdot c\right)\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -1.00000000000000004e62 or 1.9999999999999998e23 < (*.f64 x y) Initial program 93.5%
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-*.f6488.4
Applied rewrites88.4%
if -1.00000000000000004e62 < (*.f64 x y) < 1.9999999999999998e23Initial program 96.6%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6496.1
Applied rewrites96.1%
lift-*.f64N/A
lift-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6496.8
Applied rewrites96.8%
Final simplification93.2%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* x y) -1e+62) (not (<= (* x y) 2e+23))) (fma b a (fma t z (* y x))) (fma b a (fma 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 (((x * y) <= -1e+62) || !((x * y) <= 2e+23)) {
tmp = fma(b, a, fma(t, z, (y * x)));
} else {
tmp = fma(b, a, fma(i, c, (t * z)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(x * y) <= -1e+62) || !(Float64(x * y) <= 2e+23)) tmp = fma(b, a, fma(t, z, Float64(y * x))); else tmp = fma(b, a, fma(i, c, Float64(t * z))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -1e+62], N[Not[LessEqual[N[(x * y), $MachinePrecision], 2e+23]], $MachinePrecision]], N[(b * a + N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(b * a + N[(i * c + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+62} \lor \neg \left(x \cdot y \leq 2 \cdot 10^{+23}\right):\\
\;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(t, z, y \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, t \cdot z\right)\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -1.00000000000000004e62 or 1.9999999999999998e23 < (*.f64 x y) Initial program 93.5%
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-*.f6488.4
Applied rewrites88.4%
if -1.00000000000000004e62 < (*.f64 x y) < 1.9999999999999998e23Initial program 96.6%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6496.1
Applied rewrites96.1%
Final simplification92.8%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* x y) -1e+62) (not (<= (* x y) 1e+92))) (fma t z (* y x)) (fma b a (fma 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 (((x * y) <= -1e+62) || !((x * y) <= 1e+92)) {
tmp = fma(t, z, (y * x));
} else {
tmp = fma(b, a, fma(i, c, (t * z)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(x * y) <= -1e+62) || !(Float64(x * y) <= 1e+92)) tmp = fma(t, z, Float64(y * x)); else tmp = fma(b, a, fma(i, c, Float64(t * z))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -1e+62], N[Not[LessEqual[N[(x * y), $MachinePrecision], 1e+92]], $MachinePrecision]], N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision], N[(b * a + N[(i * c + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+62} \lor \neg \left(x \cdot y \leq 10^{+92}\right):\\
\;\;\;\;\mathsf{fma}\left(t, z, y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, t \cdot z\right)\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -1.00000000000000004e62 or 1e92 < (*.f64 x y) Initial program 93.8%
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-*.f6486.9
Applied rewrites86.9%
Taylor expanded in a around 0
lower-fma.f64N/A
*-commutativeN/A
lift-*.f6479.1
Applied rewrites79.1%
if -1.00000000000000004e62 < (*.f64 x y) < 1e92Initial program 96.2%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6496.4
Applied rewrites96.4%
Final simplification89.9%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* a b) -1e+49) (* b a) (if (<= (* a b) 2e-184) (* i c) (if (<= (* a b) 5e+65) (* t z) (* 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+49) {
tmp = b * a;
} else if ((a * b) <= 2e-184) {
tmp = i * c;
} else if ((a * b) <= 5e+65) {
tmp = t * z;
} 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+49)) then
tmp = b * a
else if ((a * b) <= 2d-184) then
tmp = i * c
else if ((a * b) <= 5d+65) then
tmp = t * z
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+49) {
tmp = b * a;
} else if ((a * b) <= 2e-184) {
tmp = i * c;
} else if ((a * b) <= 5e+65) {
tmp = t * z;
} else {
tmp = b * a;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (a * b) <= -1e+49: tmp = b * a elif (a * b) <= 2e-184: tmp = i * c elif (a * b) <= 5e+65: tmp = t * z else: tmp = b * a return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(a * b) <= -1e+49) tmp = Float64(b * a); elseif (Float64(a * b) <= 2e-184) tmp = Float64(i * c); elseif (Float64(a * b) <= 5e+65) tmp = Float64(t * z); 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+49) tmp = b * a; elseif ((a * b) <= 2e-184) tmp = i * c; elseif ((a * b) <= 5e+65) tmp = t * z; 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+49], N[(b * a), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 2e-184], N[(i * c), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 5e+65], N[(t * z), $MachinePrecision], N[(b * a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+49}:\\
\;\;\;\;b \cdot a\\
\mathbf{elif}\;a \cdot b \leq 2 \cdot 10^{-184}:\\
\;\;\;\;i \cdot c\\
\mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{+65}:\\
\;\;\;\;t \cdot z\\
\mathbf{else}:\\
\;\;\;\;b \cdot a\\
\end{array}
\end{array}
if (*.f64 a b) < -9.99999999999999946e48 or 4.99999999999999973e65 < (*.f64 a b) Initial program 91.8%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6458.8
Applied rewrites58.8%
if -9.99999999999999946e48 < (*.f64 a b) < 2.0000000000000001e-184Initial program 96.5%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f6441.0
Applied rewrites41.0%
if 2.0000000000000001e-184 < (*.f64 a b) < 4.99999999999999973e65Initial program 100.0%
Taylor expanded in z around inf
lower-*.f6441.3
Applied rewrites41.3%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* x y) -1e+70) (not (<= (* x y) 2e+169))) (* y x) (fma 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 (((x * y) <= -1e+70) || !((x * y) <= 2e+169)) {
tmp = y * x;
} else {
tmp = fma(i, c, (t * z));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(x * y) <= -1e+70) || !(Float64(x * y) <= 2e+169)) tmp = Float64(y * x); else tmp = fma(i, c, Float64(t * z)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -1e+70], N[Not[LessEqual[N[(x * y), $MachinePrecision], 2e+169]], $MachinePrecision]], N[(y * x), $MachinePrecision], N[(i * c + N[(t * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+70} \lor \neg \left(x \cdot y \leq 2 \cdot 10^{+169}\right):\\
\;\;\;\;y \cdot x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(i, c, t \cdot z\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -1.00000000000000007e70 or 1.99999999999999987e169 < (*.f64 x y) Initial program 92.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6469.0
Applied rewrites69.0%
if -1.00000000000000007e70 < (*.f64 x y) < 1.99999999999999987e169Initial program 96.5%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6493.9
Applied rewrites93.9%
Taylor expanded in a around 0
*-commutativeN/A
lift-fma.f64N/A
lift-*.f6463.1
Applied rewrites63.1%
Final simplification65.0%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* a b) -1e+49) (not (<= (* a b) 50000000.0))) (* b a) (* i c)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((a * b) <= -1e+49) || !((a * b) <= 50000000.0)) {
tmp = b * a;
} 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 (((a * b) <= (-1d+49)) .or. (.not. ((a * b) <= 50000000.0d0))) then
tmp = b * a
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 (((a * b) <= -1e+49) || !((a * b) <= 50000000.0)) {
tmp = b * a;
} else {
tmp = i * c;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((a * b) <= -1e+49) or not ((a * b) <= 50000000.0): tmp = b * a else: tmp = i * c return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(a * b) <= -1e+49) || !(Float64(a * b) <= 50000000.0)) tmp = Float64(b * a); 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 (((a * b) <= -1e+49) || ~(((a * b) <= 50000000.0))) tmp = b * a; else tmp = i * c; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(a * b), $MachinePrecision], -1e+49], N[Not[LessEqual[N[(a * b), $MachinePrecision], 50000000.0]], $MachinePrecision]], N[(b * a), $MachinePrecision], N[(i * c), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+49} \lor \neg \left(a \cdot b \leq 50000000\right):\\
\;\;\;\;b \cdot a\\
\mathbf{else}:\\
\;\;\;\;i \cdot c\\
\end{array}
\end{array}
if (*.f64 a b) < -9.99999999999999946e48 or 5e7 < (*.f64 a b) Initial program 92.9%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6454.0
Applied rewrites54.0%
if -9.99999999999999946e48 < (*.f64 a b) < 5e7Initial program 97.2%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f6438.2
Applied rewrites38.2%
Final simplification45.1%
(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.3%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f6426.6
Applied rewrites26.6%
herbie shell --seed 2025064
(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)))