
(FPCore (x y z t a b) :precision binary64 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
double code(double x, double y, double z, double t, double a, double b) {
return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
}
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)
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
code = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
}
def code(x, y, z, t, a, b): return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y)) end
function tmp = code(x, y, z, t, a, b) tmp = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}
\end{array}
Herbie found 21 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
double code(double x, double y, double z, double t, double a, double b) {
return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
}
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)
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
code = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
}
def code(x, y, z, t, a, b): return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y)) end
function tmp = code(x, y, z, t, a, b) tmp = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}
\end{array}
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
(t_2 (+ (+ y x) t))
(t_3
(fma (/ (+ y x) t_2) z (- (/ (+ t y) (/ t_2 a)) (* (/ y t_2) b)))))
(if (<= t_1 (- INFINITY))
t_3
(if (<= t_1 20000000000.0)
(fma (/ (+ t y) t_2) a (/ (- (* (+ y x) z) (* b y)) t_2))
t_3))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
double t_2 = (y + x) + t;
double t_3 = fma(((y + x) / t_2), z, (((t + y) / (t_2 / a)) - ((y / t_2) * b)));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = t_3;
} else if (t_1 <= 20000000000.0) {
tmp = fma(((t + y) / t_2), a, ((((y + x) * z) - (b * y)) / t_2));
} else {
tmp = t_3;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y)) t_2 = Float64(Float64(y + x) + t) t_3 = fma(Float64(Float64(y + x) / t_2), z, Float64(Float64(Float64(t + y) / Float64(t_2 / a)) - Float64(Float64(y / t_2) * b))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = t_3; elseif (t_1 <= 20000000000.0) tmp = fma(Float64(Float64(t + y) / t_2), a, Float64(Float64(Float64(Float64(y + x) * z) - Float64(b * y)) / t_2)); else tmp = t_3; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y + x), $MachinePrecision] + t), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(y + x), $MachinePrecision] / t$95$2), $MachinePrecision] * z + N[(N[(N[(t + y), $MachinePrecision] / N[(t$95$2 / a), $MachinePrecision]), $MachinePrecision] - N[(N[(y / t$95$2), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], t$95$3, If[LessEqual[t$95$1, 20000000000.0], N[(N[(N[(t + y), $MachinePrecision] / t$95$2), $MachinePrecision] * a + N[(N[(N[(N[(y + x), $MachinePrecision] * z), $MachinePrecision] - N[(b * y), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision], t$95$3]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\\
t_2 := \left(y + x\right) + t\\
t_3 := \mathsf{fma}\left(\frac{y + x}{t\_2}, z, \frac{t + y}{\frac{t\_2}{a}} - \frac{y}{t\_2} \cdot b\right)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_1 \leq 20000000000:\\
\;\;\;\;\mathsf{fma}\left(\frac{t + y}{t\_2}, a, \frac{\left(y + x\right) \cdot z - b \cdot y}{t\_2}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -inf.0 or 2e10 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 60.0%
Taylor expanded in a around 0
lower--.f64N/A
Applied rewrites71.1%
lift--.f64N/A
lift-fma.f64N/A
+-commutativeN/A
associate--l+N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites94.4%
lift-*.f64N/A
lift-/.f64N/A
div-flipN/A
mult-flip-revN/A
lower-/.f64N/A
lower-/.f6494.2
Applied rewrites94.2%
if -inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 2e10Initial program 60.0%
Taylor expanded in a around 0
lower--.f64N/A
Applied rewrites71.1%
lift--.f64N/A
lift-fma.f64N/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites71.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
(t_2 (+ (+ y x) t))
(t_3
(fma (/ (+ y x) t_2) z (- (* (+ t y) (/ a t_2)) (* (/ y t_2) b)))))
(if (<= t_1 (- INFINITY))
t_3
(if (<= t_1 1e+217)
(fma (/ (+ t y) t_2) a (/ (- (* (+ y x) z) (* b y)) t_2))
t_3))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
double t_2 = (y + x) + t;
double t_3 = fma(((y + x) / t_2), z, (((t + y) * (a / t_2)) - ((y / t_2) * b)));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = t_3;
} else if (t_1 <= 1e+217) {
tmp = fma(((t + y) / t_2), a, ((((y + x) * z) - (b * y)) / t_2));
} else {
tmp = t_3;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y)) t_2 = Float64(Float64(y + x) + t) t_3 = fma(Float64(Float64(y + x) / t_2), z, Float64(Float64(Float64(t + y) * Float64(a / t_2)) - Float64(Float64(y / t_2) * b))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = t_3; elseif (t_1 <= 1e+217) tmp = fma(Float64(Float64(t + y) / t_2), a, Float64(Float64(Float64(Float64(y + x) * z) - Float64(b * y)) / t_2)); else tmp = t_3; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y + x), $MachinePrecision] + t), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(y + x), $MachinePrecision] / t$95$2), $MachinePrecision] * z + N[(N[(N[(t + y), $MachinePrecision] * N[(a / t$95$2), $MachinePrecision]), $MachinePrecision] - N[(N[(y / t$95$2), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], t$95$3, If[LessEqual[t$95$1, 1e+217], N[(N[(N[(t + y), $MachinePrecision] / t$95$2), $MachinePrecision] * a + N[(N[(N[(N[(y + x), $MachinePrecision] * z), $MachinePrecision] - N[(b * y), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision], t$95$3]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\\
t_2 := \left(y + x\right) + t\\
t_3 := \mathsf{fma}\left(\frac{y + x}{t\_2}, z, \left(t + y\right) \cdot \frac{a}{t\_2} - \frac{y}{t\_2} \cdot b\right)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_1 \leq 10^{+217}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t + y}{t\_2}, a, \frac{\left(y + x\right) \cdot z - b \cdot y}{t\_2}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -inf.0 or 9.9999999999999996e216 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 60.0%
Taylor expanded in a around 0
lower--.f64N/A
Applied rewrites71.1%
lift--.f64N/A
lift-fma.f64N/A
+-commutativeN/A
associate--l+N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites94.4%
if -inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 9.9999999999999996e216Initial program 60.0%
Taylor expanded in a around 0
lower--.f64N/A
Applied rewrites71.1%
lift--.f64N/A
lift-fma.f64N/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites71.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
(t_2 (+ (+ y x) t))
(t_3 (* (/ y t_2) b)))
(if (<= t_1 (- INFINITY))
(fma (/ (+ y x) t_2) z (- a t_3))
(if (<= t_1 1e+217)
(fma (/ (+ t y) t_2) a (/ (- (* (+ y x) z) (* b y)) t_2))
(fma 1.0 z (- (/ (+ t y) (/ t_2 a)) t_3))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
double t_2 = (y + x) + t;
double t_3 = (y / t_2) * b;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = fma(((y + x) / t_2), z, (a - t_3));
} else if (t_1 <= 1e+217) {
tmp = fma(((t + y) / t_2), a, ((((y + x) * z) - (b * y)) / t_2));
} else {
tmp = fma(1.0, z, (((t + y) / (t_2 / a)) - t_3));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y)) t_2 = Float64(Float64(y + x) + t) t_3 = Float64(Float64(y / t_2) * b) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = fma(Float64(Float64(y + x) / t_2), z, Float64(a - t_3)); elseif (t_1 <= 1e+217) tmp = fma(Float64(Float64(t + y) / t_2), a, Float64(Float64(Float64(Float64(y + x) * z) - Float64(b * y)) / t_2)); else tmp = fma(1.0, z, Float64(Float64(Float64(t + y) / Float64(t_2 / a)) - t_3)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y + x), $MachinePrecision] + t), $MachinePrecision]}, Block[{t$95$3 = N[(N[(y / t$95$2), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(N[(y + x), $MachinePrecision] / t$95$2), $MachinePrecision] * z + N[(a - t$95$3), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+217], N[(N[(N[(t + y), $MachinePrecision] / t$95$2), $MachinePrecision] * a + N[(N[(N[(N[(y + x), $MachinePrecision] * z), $MachinePrecision] - N[(b * y), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision], N[(1.0 * z + N[(N[(N[(t + y), $MachinePrecision] / N[(t$95$2 / a), $MachinePrecision]), $MachinePrecision] - t$95$3), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\\
t_2 := \left(y + x\right) + t\\
t_3 := \frac{y}{t\_2} \cdot b\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(\frac{y + x}{t\_2}, z, a - t\_3\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+217}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t + y}{t\_2}, a, \frac{\left(y + x\right) \cdot z - b \cdot y}{t\_2}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1, z, \frac{t + y}{\frac{t\_2}{a}} - t\_3\right)\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -inf.0Initial program 60.0%
Taylor expanded in a around 0
lower--.f64N/A
Applied rewrites71.1%
lift--.f64N/A
lift-fma.f64N/A
+-commutativeN/A
associate--l+N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites94.4%
Taylor expanded in x around 0
Applied rewrites84.0%
if -inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 9.9999999999999996e216Initial program 60.0%
Taylor expanded in a around 0
lower--.f64N/A
Applied rewrites71.1%
lift--.f64N/A
lift-fma.f64N/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites71.1%
if 9.9999999999999996e216 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 60.0%
Taylor expanded in a around 0
lower--.f64N/A
Applied rewrites71.1%
lift--.f64N/A
lift-fma.f64N/A
+-commutativeN/A
associate--l+N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites94.4%
lift-*.f64N/A
lift-/.f64N/A
div-flipN/A
mult-flip-revN/A
lower-/.f64N/A
lower-/.f6494.2
Applied rewrites94.2%
Taylor expanded in x around inf
Applied rewrites81.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (+ x t) y))
(t_2 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) t_1))
(t_3 (+ (+ y x) t))
(t_4 (* (/ y t_3) b)))
(if (<= t_2 (- INFINITY))
(fma (/ (+ y x) t_3) z (- a t_4))
(if (<= t_2 1e+217)
(/ (fma a t (fma x z (* y (- (+ a z) b)))) t_1)
(fma 1.0 z (- (/ (+ t y) (/ t_3 a)) t_4))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + t) + y;
double t_2 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / t_1;
double t_3 = (y + x) + t;
double t_4 = (y / t_3) * b;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = fma(((y + x) / t_3), z, (a - t_4));
} else if (t_2 <= 1e+217) {
tmp = fma(a, t, fma(x, z, (y * ((a + z) - b)))) / t_1;
} else {
tmp = fma(1.0, z, (((t + y) / (t_3 / a)) - t_4));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + t) + y) t_2 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / t_1) t_3 = Float64(Float64(y + x) + t) t_4 = Float64(Float64(y / t_3) * b) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = fma(Float64(Float64(y + x) / t_3), z, Float64(a - t_4)); elseif (t_2 <= 1e+217) tmp = Float64(fma(a, t, fma(x, z, Float64(y * Float64(Float64(a + z) - b)))) / t_1); else tmp = fma(1.0, z, Float64(Float64(Float64(t + y) / Float64(t_3 / a)) - t_4)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(y + x), $MachinePrecision] + t), $MachinePrecision]}, Block[{t$95$4 = N[(N[(y / t$95$3), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(N[(N[(y + x), $MachinePrecision] / t$95$3), $MachinePrecision] * z + N[(a - t$95$4), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+217], N[(N[(a * t + N[(x * z + N[(y * N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], N[(1.0 * z + N[(N[(N[(t + y), $MachinePrecision] / N[(t$95$3 / a), $MachinePrecision]), $MachinePrecision] - t$95$4), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{t\_1}\\
t_3 := \left(y + x\right) + t\\
t_4 := \frac{y}{t\_3} \cdot b\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(\frac{y + x}{t\_3}, z, a - t\_4\right)\\
\mathbf{elif}\;t\_2 \leq 10^{+217}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, \mathsf{fma}\left(x, z, y \cdot \left(\left(a + z\right) - b\right)\right)\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1, z, \frac{t + y}{\frac{t\_3}{a}} - t\_4\right)\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -inf.0Initial program 60.0%
Taylor expanded in a around 0
lower--.f64N/A
Applied rewrites71.1%
lift--.f64N/A
lift-fma.f64N/A
+-commutativeN/A
associate--l+N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites94.4%
Taylor expanded in x around 0
Applied rewrites84.0%
if -inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 9.9999999999999996e216Initial program 60.0%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6460.3
Applied rewrites60.3%
if 9.9999999999999996e216 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 60.0%
Taylor expanded in a around 0
lower--.f64N/A
Applied rewrites71.1%
lift--.f64N/A
lift-fma.f64N/A
+-commutativeN/A
associate--l+N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites94.4%
lift-*.f64N/A
lift-/.f64N/A
div-flipN/A
mult-flip-revN/A
lower-/.f64N/A
lower-/.f6494.2
Applied rewrites94.2%
Taylor expanded in x around inf
Applied rewrites81.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (+ x t) y))
(t_2 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) t_1))
(t_3 (+ (+ y x) t))
(t_4 (* (/ y t_3) b)))
(if (<= t_2 (- INFINITY))
(fma (/ (+ y x) t_3) z (- a t_4))
(if (<= t_2 1e+217)
(/ (fma a t (fma x z (* y (- (+ a z) b)))) t_1)
(fma 1.0 z (- (* (+ t y) (/ a t_3)) t_4))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + t) + y;
double t_2 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / t_1;
double t_3 = (y + x) + t;
double t_4 = (y / t_3) * b;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = fma(((y + x) / t_3), z, (a - t_4));
} else if (t_2 <= 1e+217) {
tmp = fma(a, t, fma(x, z, (y * ((a + z) - b)))) / t_1;
} else {
tmp = fma(1.0, z, (((t + y) * (a / t_3)) - t_4));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + t) + y) t_2 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / t_1) t_3 = Float64(Float64(y + x) + t) t_4 = Float64(Float64(y / t_3) * b) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = fma(Float64(Float64(y + x) / t_3), z, Float64(a - t_4)); elseif (t_2 <= 1e+217) tmp = Float64(fma(a, t, fma(x, z, Float64(y * Float64(Float64(a + z) - b)))) / t_1); else tmp = fma(1.0, z, Float64(Float64(Float64(t + y) * Float64(a / t_3)) - t_4)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(y + x), $MachinePrecision] + t), $MachinePrecision]}, Block[{t$95$4 = N[(N[(y / t$95$3), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(N[(N[(y + x), $MachinePrecision] / t$95$3), $MachinePrecision] * z + N[(a - t$95$4), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+217], N[(N[(a * t + N[(x * z + N[(y * N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], N[(1.0 * z + N[(N[(N[(t + y), $MachinePrecision] * N[(a / t$95$3), $MachinePrecision]), $MachinePrecision] - t$95$4), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{t\_1}\\
t_3 := \left(y + x\right) + t\\
t_4 := \frac{y}{t\_3} \cdot b\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(\frac{y + x}{t\_3}, z, a - t\_4\right)\\
\mathbf{elif}\;t\_2 \leq 10^{+217}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, \mathsf{fma}\left(x, z, y \cdot \left(\left(a + z\right) - b\right)\right)\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1, z, \left(t + y\right) \cdot \frac{a}{t\_3} - t\_4\right)\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -inf.0Initial program 60.0%
Taylor expanded in a around 0
lower--.f64N/A
Applied rewrites71.1%
lift--.f64N/A
lift-fma.f64N/A
+-commutativeN/A
associate--l+N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites94.4%
Taylor expanded in x around 0
Applied rewrites84.0%
if -inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 9.9999999999999996e216Initial program 60.0%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6460.3
Applied rewrites60.3%
if 9.9999999999999996e216 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 60.0%
Taylor expanded in a around 0
lower--.f64N/A
Applied rewrites71.1%
lift--.f64N/A
lift-fma.f64N/A
+-commutativeN/A
associate--l+N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites94.4%
Taylor expanded in x around inf
Applied rewrites81.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (+ x t) y))
(t_2 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) t_1))
(t_3 (+ (+ y x) t))
(t_4 (fma (/ (+ y x) t_3) z (- a (* (/ y t_3) b)))))
(if (<= t_2 (- INFINITY))
t_4
(if (<= t_2 1e+217)
(/ (fma a t (fma x z (* y (- (+ a z) b)))) t_1)
t_4))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + t) + y;
double t_2 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / t_1;
double t_3 = (y + x) + t;
double t_4 = fma(((y + x) / t_3), z, (a - ((y / t_3) * b)));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_4;
} else if (t_2 <= 1e+217) {
tmp = fma(a, t, fma(x, z, (y * ((a + z) - b)))) / t_1;
} else {
tmp = t_4;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + t) + y) t_2 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / t_1) t_3 = Float64(Float64(y + x) + t) t_4 = fma(Float64(Float64(y + x) / t_3), z, Float64(a - Float64(Float64(y / t_3) * b))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_4; elseif (t_2 <= 1e+217) tmp = Float64(fma(a, t, fma(x, z, Float64(y * Float64(Float64(a + z) - b)))) / t_1); else tmp = t_4; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(y + x), $MachinePrecision] + t), $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[(y + x), $MachinePrecision] / t$95$3), $MachinePrecision] * z + N[(a - N[(N[(y / t$95$3), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$4, If[LessEqual[t$95$2, 1e+217], N[(N[(a * t + N[(x * z + N[(y * N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], t$95$4]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{t\_1}\\
t_3 := \left(y + x\right) + t\\
t_4 := \mathsf{fma}\left(\frac{y + x}{t\_3}, z, a - \frac{y}{t\_3} \cdot b\right)\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_2 \leq 10^{+217}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, \mathsf{fma}\left(x, z, y \cdot \left(\left(a + z\right) - b\right)\right)\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;t\_4\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -inf.0 or 9.9999999999999996e216 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 60.0%
Taylor expanded in a around 0
lower--.f64N/A
Applied rewrites71.1%
lift--.f64N/A
lift-fma.f64N/A
+-commutativeN/A
associate--l+N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites94.4%
Taylor expanded in x around 0
Applied rewrites84.0%
if -inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 9.9999999999999996e216Initial program 60.0%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6460.3
Applied rewrites60.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (+ x t) y))
(t_2 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) t_1))
(t_3 (- (+ a z) b)))
(if (<= t_2 (- INFINITY))
t_3
(if (<= t_2 2e+240) (/ (fma a t (fma x z (* y t_3))) t_1) t_3))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + t) + y;
double t_2 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / t_1;
double t_3 = (a + z) - b;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_3;
} else if (t_2 <= 2e+240) {
tmp = fma(a, t, fma(x, z, (y * t_3))) / t_1;
} else {
tmp = t_3;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + t) + y) t_2 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / t_1) t_3 = Float64(Float64(a + z) - b) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_3; elseif (t_2 <= 2e+240) tmp = Float64(fma(a, t, fma(x, z, Float64(y * t_3))) / t_1); else tmp = t_3; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$3, If[LessEqual[t$95$2, 2e+240], N[(N[(a * t + N[(x * z + N[(y * t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], t$95$3]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{t\_1}\\
t_3 := \left(a + z\right) - b\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+240}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, \mathsf{fma}\left(x, z, y \cdot t\_3\right)\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -inf.0 or 2.00000000000000003e240 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 60.0%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6455.5
Applied rewrites55.5%
if -inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 2.00000000000000003e240Initial program 60.0%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6460.3
Applied rewrites60.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (+ x t) y))
(t_2 (- (+ a z) b))
(t_3 (* (+ x y) z))
(t_4 (/ (- (+ t_3 (* (+ t y) a)) (* y b)) t_1)))
(if (<= t_4 -5e+251)
t_2
(if (<= t_4 2e+240) (/ (- (+ t_3 (* a t)) (* y b)) t_1) t_2))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + t) + y;
double t_2 = (a + z) - b;
double t_3 = (x + y) * z;
double t_4 = ((t_3 + ((t + y) * a)) - (y * b)) / t_1;
double tmp;
if (t_4 <= -5e+251) {
tmp = t_2;
} else if (t_4 <= 2e+240) {
tmp = ((t_3 + (a * t)) - (y * b)) / t_1;
} else {
tmp = t_2;
}
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)
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) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = (x + t) + y
t_2 = (a + z) - b
t_3 = (x + y) * z
t_4 = ((t_3 + ((t + y) * a)) - (y * b)) / t_1
if (t_4 <= (-5d+251)) then
tmp = t_2
else if (t_4 <= 2d+240) then
tmp = ((t_3 + (a * t)) - (y * b)) / t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + t) + y;
double t_2 = (a + z) - b;
double t_3 = (x + y) * z;
double t_4 = ((t_3 + ((t + y) * a)) - (y * b)) / t_1;
double tmp;
if (t_4 <= -5e+251) {
tmp = t_2;
} else if (t_4 <= 2e+240) {
tmp = ((t_3 + (a * t)) - (y * b)) / t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (x + t) + y t_2 = (a + z) - b t_3 = (x + y) * z t_4 = ((t_3 + ((t + y) * a)) - (y * b)) / t_1 tmp = 0 if t_4 <= -5e+251: tmp = t_2 elif t_4 <= 2e+240: tmp = ((t_3 + (a * t)) - (y * b)) / t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + t) + y) t_2 = Float64(Float64(a + z) - b) t_3 = Float64(Float64(x + y) * z) t_4 = Float64(Float64(Float64(t_3 + Float64(Float64(t + y) * a)) - Float64(y * b)) / t_1) tmp = 0.0 if (t_4 <= -5e+251) tmp = t_2; elseif (t_4 <= 2e+240) tmp = Float64(Float64(Float64(t_3 + Float64(a * t)) - Float64(y * b)) / t_1); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (x + t) + y; t_2 = (a + z) - b; t_3 = (x + y) * z; t_4 = ((t_3 + ((t + y) * a)) - (y * b)) / t_1; tmp = 0.0; if (t_4 <= -5e+251) tmp = t_2; elseif (t_4 <= 2e+240) tmp = ((t_3 + (a * t)) - (y * b)) / t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[(t$95$3 + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[LessEqual[t$95$4, -5e+251], t$95$2, If[LessEqual[t$95$4, 2e+240], N[(N[(N[(t$95$3 + N[(a * t), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \left(a + z\right) - b\\
t_3 := \left(x + y\right) \cdot z\\
t_4 := \frac{\left(t\_3 + \left(t + y\right) \cdot a\right) - y \cdot b}{t\_1}\\
\mathbf{if}\;t\_4 \leq -5 \cdot 10^{+251}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_4 \leq 2 \cdot 10^{+240}:\\
\;\;\;\;\frac{\left(t\_3 + a \cdot t\right) - y \cdot b}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -5.0000000000000005e251 or 2.00000000000000003e240 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 60.0%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6455.5
Applied rewrites55.5%
if -5.0000000000000005e251 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 2.00000000000000003e240Initial program 60.0%
Taylor expanded in y around 0
lower-*.f6452.6
Applied rewrites52.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (+ x t) y))
(t_2 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) t_1))
(t_3 (- (+ a z) b)))
(if (<= t_2 (- INFINITY))
t_3
(if (<= t_2 -1e+75)
(/ (fma a t (* y t_3)) t_1)
(if (<= t_2 2e+240) (/ (fma a t (fma x z (* y (- a b)))) t_1) t_3)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + t) + y;
double t_2 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / t_1;
double t_3 = (a + z) - b;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_3;
} else if (t_2 <= -1e+75) {
tmp = fma(a, t, (y * t_3)) / t_1;
} else if (t_2 <= 2e+240) {
tmp = fma(a, t, fma(x, z, (y * (a - b)))) / t_1;
} else {
tmp = t_3;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + t) + y) t_2 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / t_1) t_3 = Float64(Float64(a + z) - b) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_3; elseif (t_2 <= -1e+75) tmp = Float64(fma(a, t, Float64(y * t_3)) / t_1); elseif (t_2 <= 2e+240) tmp = Float64(fma(a, t, fma(x, z, Float64(y * Float64(a - b)))) / t_1); else tmp = t_3; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$3, If[LessEqual[t$95$2, -1e+75], N[(N[(a * t + N[(y * t$95$3), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[t$95$2, 2e+240], N[(N[(a * t + N[(x * z + N[(y * N[(a - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], t$95$3]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{t\_1}\\
t_3 := \left(a + z\right) - b\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{+75}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, y \cdot t\_3\right)}{t\_1}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+240}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, \mathsf{fma}\left(x, z, y \cdot \left(a - b\right)\right)\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -inf.0 or 2.00000000000000003e240 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 60.0%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6455.5
Applied rewrites55.5%
if -inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -9.99999999999999927e74Initial program 60.0%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6460.3
Applied rewrites60.3%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f64N/A
lower-+.f6445.0
Applied rewrites45.0%
if -9.99999999999999927e74 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 2.00000000000000003e240Initial program 60.0%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6460.3
Applied rewrites60.3%
Taylor expanded in z around 0
Applied rewrites52.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (+ x t) y))
(t_2 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) t_1))
(t_3 (- (+ a z) b)))
(if (<= t_2 (- INFINITY))
t_3
(if (<= t_2 -1e-40)
(/ (fma a t (* y t_3)) t_1)
(if (<= t_2 2e+240)
(/ (fma a (+ t y) (* z (+ x y))) (+ t (+ x y)))
t_3)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + t) + y;
double t_2 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / t_1;
double t_3 = (a + z) - b;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_3;
} else if (t_2 <= -1e-40) {
tmp = fma(a, t, (y * t_3)) / t_1;
} else if (t_2 <= 2e+240) {
tmp = fma(a, (t + y), (z * (x + y))) / (t + (x + y));
} else {
tmp = t_3;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + t) + y) t_2 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / t_1) t_3 = Float64(Float64(a + z) - b) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_3; elseif (t_2 <= -1e-40) tmp = Float64(fma(a, t, Float64(y * t_3)) / t_1); elseif (t_2 <= 2e+240) tmp = Float64(fma(a, Float64(t + y), Float64(z * Float64(x + y))) / Float64(t + Float64(x + y))); else tmp = t_3; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$3, If[LessEqual[t$95$2, -1e-40], N[(N[(a * t + N[(y * t$95$3), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[t$95$2, 2e+240], N[(N[(a * N[(t + y), $MachinePrecision] + N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$3]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{t\_1}\\
t_3 := \left(a + z\right) - b\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{-40}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, y \cdot t\_3\right)}{t\_1}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+240}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t + y, z \cdot \left(x + y\right)\right)}{t + \left(x + y\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -inf.0 or 2.00000000000000003e240 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 60.0%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6455.5
Applied rewrites55.5%
if -inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -9.9999999999999993e-41Initial program 60.0%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6460.3
Applied rewrites60.3%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f64N/A
lower-+.f6445.0
Applied rewrites45.0%
if -9.9999999999999993e-41 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 2.00000000000000003e240Initial program 60.0%
Taylor expanded in b around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-+.f6447.5
Applied rewrites47.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (+ x t) y))
(t_2 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) t_1))
(t_3 (- (+ a z) b))
(t_4 (/ (fma a t (* y t_3)) t_1)))
(if (<= t_2 (- INFINITY))
t_3
(if (<= t_2 1e-79)
t_4
(if (<= t_2 5e-7)
(/ (fma x z (* y (- z b))) t_1)
(if (<= t_2 2e+240) t_4 t_3))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + t) + y;
double t_2 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / t_1;
double t_3 = (a + z) - b;
double t_4 = fma(a, t, (y * t_3)) / t_1;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_3;
} else if (t_2 <= 1e-79) {
tmp = t_4;
} else if (t_2 <= 5e-7) {
tmp = fma(x, z, (y * (z - b))) / t_1;
} else if (t_2 <= 2e+240) {
tmp = t_4;
} else {
tmp = t_3;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + t) + y) t_2 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / t_1) t_3 = Float64(Float64(a + z) - b) t_4 = Float64(fma(a, t, Float64(y * t_3)) / t_1) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_3; elseif (t_2 <= 1e-79) tmp = t_4; elseif (t_2 <= 5e-7) tmp = Float64(fma(x, z, Float64(y * Float64(z - b))) / t_1); elseif (t_2 <= 2e+240) tmp = t_4; else tmp = t_3; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]}, Block[{t$95$4 = N[(N[(a * t + N[(y * t$95$3), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$3, If[LessEqual[t$95$2, 1e-79], t$95$4, If[LessEqual[t$95$2, 5e-7], N[(N[(x * z + N[(y * N[(z - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[t$95$2, 2e+240], t$95$4, t$95$3]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{t\_1}\\
t_3 := \left(a + z\right) - b\\
t_4 := \frac{\mathsf{fma}\left(a, t, y \cdot t\_3\right)}{t\_1}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 10^{-79}:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{-7}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, z, y \cdot \left(z - b\right)\right)}{t\_1}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+240}:\\
\;\;\;\;t\_4\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -inf.0 or 2.00000000000000003e240 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 60.0%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6455.5
Applied rewrites55.5%
if -inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 1e-79 or 4.99999999999999977e-7 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 2.00000000000000003e240Initial program 60.0%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6460.3
Applied rewrites60.3%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f64N/A
lower-+.f6445.0
Applied rewrites45.0%
if 1e-79 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 4.99999999999999977e-7Initial program 60.0%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6460.3
Applied rewrites60.3%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-*.f64N/A
lower--.f6438.0
Applied rewrites38.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (- (+ a z) b)))
(if (<= y -5.7e+119)
t_1
(if (<= y -1.6e-161)
(fma z (/ y (+ t y)) a)
(if (<= y 1e-92)
(+ (/ (* a t) (+ t x)) (/ (* x z) (+ t x)))
(if (<= y 1.6e-7) (/ (* y t_1) (+ (+ x t) y)) t_1))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a + z) - b;
double tmp;
if (y <= -5.7e+119) {
tmp = t_1;
} else if (y <= -1.6e-161) {
tmp = fma(z, (y / (t + y)), a);
} else if (y <= 1e-92) {
tmp = ((a * t) / (t + x)) + ((x * z) / (t + x));
} else if (y <= 1.6e-7) {
tmp = (y * t_1) / ((x + t) + y);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a + z) - b) tmp = 0.0 if (y <= -5.7e+119) tmp = t_1; elseif (y <= -1.6e-161) tmp = fma(z, Float64(y / Float64(t + y)), a); elseif (y <= 1e-92) tmp = Float64(Float64(Float64(a * t) / Float64(t + x)) + Float64(Float64(x * z) / Float64(t + x))); elseif (y <= 1.6e-7) tmp = Float64(Float64(y * t_1) / Float64(Float64(x + t) + y)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[y, -5.7e+119], t$95$1, If[LessEqual[y, -1.6e-161], N[(z * N[(y / N[(t + y), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision], If[LessEqual[y, 1e-92], N[(N[(N[(a * t), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision] + N[(N[(x * z), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.6e-7], N[(N[(y * t$95$1), $MachinePrecision] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a + z\right) - b\\
\mathbf{if}\;y \leq -5.7 \cdot 10^{+119}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -1.6 \cdot 10^{-161}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{y}{t + y}, a\right)\\
\mathbf{elif}\;y \leq 10^{-92}:\\
\;\;\;\;\frac{a \cdot t}{t + x} + \frac{x \cdot z}{t + x}\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{-7}:\\
\;\;\;\;\frac{y \cdot t\_1}{\left(x + t\right) + y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -5.7000000000000002e119 or 1.6e-7 < y Initial program 60.0%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6455.5
Applied rewrites55.5%
if -5.7000000000000002e119 < y < -1.59999999999999993e-161Initial program 60.0%
Taylor expanded in b around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-+.f6447.5
Applied rewrites47.5%
Taylor expanded in x around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6431.9
Applied rewrites31.9%
lift-/.f64N/A
lift-fma.f64N/A
add-to-fraction-revN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6452.5
Applied rewrites52.5%
if -1.59999999999999993e-161 < y < 9.99999999999999988e-93Initial program 60.0%
Taylor expanded in a around 0
lower--.f64N/A
Applied rewrites71.1%
Taylor expanded in y around 0
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6440.0
Applied rewrites40.0%
if 9.99999999999999988e-93 < y < 1.6e-7Initial program 60.0%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-+.f6430.2
Applied rewrites30.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (- (+ a z) b)))
(if (<= y -5.7e+119)
t_1
(if (<= y -1.6e-161)
(fma z (/ y (+ t y)) a)
(if (<= y 1e-92)
(/ (fma a t (* x z)) (+ t x))
(if (<= y 1.6e-7) (/ (* y t_1) (+ (+ x t) y)) t_1))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a + z) - b;
double tmp;
if (y <= -5.7e+119) {
tmp = t_1;
} else if (y <= -1.6e-161) {
tmp = fma(z, (y / (t + y)), a);
} else if (y <= 1e-92) {
tmp = fma(a, t, (x * z)) / (t + x);
} else if (y <= 1.6e-7) {
tmp = (y * t_1) / ((x + t) + y);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a + z) - b) tmp = 0.0 if (y <= -5.7e+119) tmp = t_1; elseif (y <= -1.6e-161) tmp = fma(z, Float64(y / Float64(t + y)), a); elseif (y <= 1e-92) tmp = Float64(fma(a, t, Float64(x * z)) / Float64(t + x)); elseif (y <= 1.6e-7) tmp = Float64(Float64(y * t_1) / Float64(Float64(x + t) + y)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[y, -5.7e+119], t$95$1, If[LessEqual[y, -1.6e-161], N[(z * N[(y / N[(t + y), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision], If[LessEqual[y, 1e-92], N[(N[(a * t + N[(x * z), $MachinePrecision]), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.6e-7], N[(N[(y * t$95$1), $MachinePrecision] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a + z\right) - b\\
\mathbf{if}\;y \leq -5.7 \cdot 10^{+119}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -1.6 \cdot 10^{-161}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{y}{t + y}, a\right)\\
\mathbf{elif}\;y \leq 10^{-92}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, x \cdot z\right)}{t + x}\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{-7}:\\
\;\;\;\;\frac{y \cdot t\_1}{\left(x + t\right) + y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -5.7000000000000002e119 or 1.6e-7 < y Initial program 60.0%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6455.5
Applied rewrites55.5%
if -5.7000000000000002e119 < y < -1.59999999999999993e-161Initial program 60.0%
Taylor expanded in b around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-+.f6447.5
Applied rewrites47.5%
Taylor expanded in x around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6431.9
Applied rewrites31.9%
lift-/.f64N/A
lift-fma.f64N/A
add-to-fraction-revN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6452.5
Applied rewrites52.5%
if -1.59999999999999993e-161 < y < 9.99999999999999988e-93Initial program 60.0%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-+.f6440.0
Applied rewrites40.0%
if 9.99999999999999988e-93 < y < 1.6e-7Initial program 60.0%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-+.f6430.2
Applied rewrites30.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma z (/ y (+ t y)) a)) (t_2 (- (+ a z) b)))
(if (<= y -5.7e+119)
t_2
(if (<= y -1.6e-161)
t_1
(if (<= y 6.4e-103)
(/ (fma a t (* x z)) (+ t x))
(if (<= y 4.3e+76) t_1 t_2))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(z, (y / (t + y)), a);
double t_2 = (a + z) - b;
double tmp;
if (y <= -5.7e+119) {
tmp = t_2;
} else if (y <= -1.6e-161) {
tmp = t_1;
} else if (y <= 6.4e-103) {
tmp = fma(a, t, (x * z)) / (t + x);
} else if (y <= 4.3e+76) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(z, Float64(y / Float64(t + y)), a) t_2 = Float64(Float64(a + z) - b) tmp = 0.0 if (y <= -5.7e+119) tmp = t_2; elseif (y <= -1.6e-161) tmp = t_1; elseif (y <= 6.4e-103) tmp = Float64(fma(a, t, Float64(x * z)) / Float64(t + x)); elseif (y <= 4.3e+76) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z * N[(y / N[(t + y), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision]}, Block[{t$95$2 = N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[y, -5.7e+119], t$95$2, If[LessEqual[y, -1.6e-161], t$95$1, If[LessEqual[y, 6.4e-103], N[(N[(a * t + N[(x * z), $MachinePrecision]), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.3e+76], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z, \frac{y}{t + y}, a\right)\\
t_2 := \left(a + z\right) - b\\
\mathbf{if}\;y \leq -5.7 \cdot 10^{+119}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq -1.6 \cdot 10^{-161}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 6.4 \cdot 10^{-103}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, x \cdot z\right)}{t + x}\\
\mathbf{elif}\;y \leq 4.3 \cdot 10^{+76}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if y < -5.7000000000000002e119 or 4.29999999999999978e76 < y Initial program 60.0%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6455.5
Applied rewrites55.5%
if -5.7000000000000002e119 < y < -1.59999999999999993e-161 or 6.39999999999999953e-103 < y < 4.29999999999999978e76Initial program 60.0%
Taylor expanded in b around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-+.f6447.5
Applied rewrites47.5%
Taylor expanded in x around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6431.9
Applied rewrites31.9%
lift-/.f64N/A
lift-fma.f64N/A
add-to-fraction-revN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6452.5
Applied rewrites52.5%
if -1.59999999999999993e-161 < y < 6.39999999999999953e-103Initial program 60.0%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-+.f6440.0
Applied rewrites40.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (- (+ a z) b)))
(if (<= y -6.6e+49)
t_1
(if (<= y -2.1e-236)
(+ a z)
(if (<= y 5.4e-103)
(/ (* x z) (+ t x))
(if (<= y 9.4e+21) (+ a (/ (* y z) t)) t_1))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a + z) - b;
double tmp;
if (y <= -6.6e+49) {
tmp = t_1;
} else if (y <= -2.1e-236) {
tmp = a + z;
} else if (y <= 5.4e-103) {
tmp = (x * z) / (t + x);
} else if (y <= 9.4e+21) {
tmp = a + ((y * z) / t);
} else {
tmp = t_1;
}
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)
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) :: t_1
real(8) :: tmp
t_1 = (a + z) - b
if (y <= (-6.6d+49)) then
tmp = t_1
else if (y <= (-2.1d-236)) then
tmp = a + z
else if (y <= 5.4d-103) then
tmp = (x * z) / (t + x)
else if (y <= 9.4d+21) then
tmp = a + ((y * z) / t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a + z) - b;
double tmp;
if (y <= -6.6e+49) {
tmp = t_1;
} else if (y <= -2.1e-236) {
tmp = a + z;
} else if (y <= 5.4e-103) {
tmp = (x * z) / (t + x);
} else if (y <= 9.4e+21) {
tmp = a + ((y * z) / t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (a + z) - b tmp = 0 if y <= -6.6e+49: tmp = t_1 elif y <= -2.1e-236: tmp = a + z elif y <= 5.4e-103: tmp = (x * z) / (t + x) elif y <= 9.4e+21: tmp = a + ((y * z) / t) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a + z) - b) tmp = 0.0 if (y <= -6.6e+49) tmp = t_1; elseif (y <= -2.1e-236) tmp = Float64(a + z); elseif (y <= 5.4e-103) tmp = Float64(Float64(x * z) / Float64(t + x)); elseif (y <= 9.4e+21) tmp = Float64(a + Float64(Float64(y * z) / t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (a + z) - b; tmp = 0.0; if (y <= -6.6e+49) tmp = t_1; elseif (y <= -2.1e-236) tmp = a + z; elseif (y <= 5.4e-103) tmp = (x * z) / (t + x); elseif (y <= 9.4e+21) tmp = a + ((y * z) / t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[y, -6.6e+49], t$95$1, If[LessEqual[y, -2.1e-236], N[(a + z), $MachinePrecision], If[LessEqual[y, 5.4e-103], N[(N[(x * z), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9.4e+21], N[(a + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a + z\right) - b\\
\mathbf{if}\;y \leq -6.6 \cdot 10^{+49}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -2.1 \cdot 10^{-236}:\\
\;\;\;\;a + z\\
\mathbf{elif}\;y \leq 5.4 \cdot 10^{-103}:\\
\;\;\;\;\frac{x \cdot z}{t + x}\\
\mathbf{elif}\;y \leq 9.4 \cdot 10^{+21}:\\
\;\;\;\;a + \frac{y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -6.5999999999999997e49 or 9.4e21 < y Initial program 60.0%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6455.5
Applied rewrites55.5%
if -6.5999999999999997e49 < y < -2.09999999999999979e-236Initial program 60.0%
Taylor expanded in b around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-+.f6447.5
Applied rewrites47.5%
Taylor expanded in y around inf
lower-+.f6451.2
Applied rewrites51.2%
if -2.09999999999999979e-236 < y < 5.40000000000000019e-103Initial program 60.0%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-+.f6425.4
Applied rewrites25.4%
Taylor expanded in y around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6421.8
Applied rewrites21.8%
if 5.40000000000000019e-103 < y < 9.4e21Initial program 60.0%
Taylor expanded in b around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-+.f6447.5
Applied rewrites47.5%
Taylor expanded in x around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6431.9
Applied rewrites31.9%
Taylor expanded in y around 0
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6428.4
Applied rewrites28.4%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (fma y (/ z (+ t y)) a))) (if (<= t -1.4e+47) t_1 (if (<= t 1.25e+69) (- (+ a z) b) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(y, (z / (t + y)), a);
double tmp;
if (t <= -1.4e+47) {
tmp = t_1;
} else if (t <= 1.25e+69) {
tmp = (a + z) - b;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(y, Float64(z / Float64(t + y)), a) tmp = 0.0 if (t <= -1.4e+47) tmp = t_1; elseif (t <= 1.25e+69) tmp = Float64(Float64(a + z) - b); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(y * N[(z / N[(t + y), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision]}, If[LessEqual[t, -1.4e+47], t$95$1, If[LessEqual[t, 1.25e+69], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{z}{t + y}, a\right)\\
\mathbf{if}\;t \leq -1.4 \cdot 10^{+47}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.25 \cdot 10^{+69}:\\
\;\;\;\;\left(a + z\right) - b\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.39999999999999994e47 or 1.25000000000000009e69 < t Initial program 60.0%
Taylor expanded in b around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-+.f6447.5
Applied rewrites47.5%
Taylor expanded in x around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6431.9
Applied rewrites31.9%
lift-/.f64N/A
lift-fma.f64N/A
add-to-fraction-revN/A
+-commutativeN/A
lift-*.f64N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6449.9
Applied rewrites49.9%
if -1.39999999999999994e47 < t < 1.25000000000000009e69Initial program 60.0%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6455.5
Applied rewrites55.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (- (+ a z) b)))
(if (<= y -6.6e+49)
t_1
(if (<= y -2.1e-236)
(+ a z)
(if (<= y 5.4e-103) (/ (* x z) (+ t x)) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a + z) - b;
double tmp;
if (y <= -6.6e+49) {
tmp = t_1;
} else if (y <= -2.1e-236) {
tmp = a + z;
} else if (y <= 5.4e-103) {
tmp = (x * z) / (t + x);
} else {
tmp = t_1;
}
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)
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) :: t_1
real(8) :: tmp
t_1 = (a + z) - b
if (y <= (-6.6d+49)) then
tmp = t_1
else if (y <= (-2.1d-236)) then
tmp = a + z
else if (y <= 5.4d-103) then
tmp = (x * z) / (t + x)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a + z) - b;
double tmp;
if (y <= -6.6e+49) {
tmp = t_1;
} else if (y <= -2.1e-236) {
tmp = a + z;
} else if (y <= 5.4e-103) {
tmp = (x * z) / (t + x);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (a + z) - b tmp = 0 if y <= -6.6e+49: tmp = t_1 elif y <= -2.1e-236: tmp = a + z elif y <= 5.4e-103: tmp = (x * z) / (t + x) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a + z) - b) tmp = 0.0 if (y <= -6.6e+49) tmp = t_1; elseif (y <= -2.1e-236) tmp = Float64(a + z); elseif (y <= 5.4e-103) tmp = Float64(Float64(x * z) / Float64(t + x)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (a + z) - b; tmp = 0.0; if (y <= -6.6e+49) tmp = t_1; elseif (y <= -2.1e-236) tmp = a + z; elseif (y <= 5.4e-103) tmp = (x * z) / (t + x); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[y, -6.6e+49], t$95$1, If[LessEqual[y, -2.1e-236], N[(a + z), $MachinePrecision], If[LessEqual[y, 5.4e-103], N[(N[(x * z), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a + z\right) - b\\
\mathbf{if}\;y \leq -6.6 \cdot 10^{+49}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -2.1 \cdot 10^{-236}:\\
\;\;\;\;a + z\\
\mathbf{elif}\;y \leq 5.4 \cdot 10^{-103}:\\
\;\;\;\;\frac{x \cdot z}{t + x}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -6.5999999999999997e49 or 5.40000000000000019e-103 < y Initial program 60.0%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6455.5
Applied rewrites55.5%
if -6.5999999999999997e49 < y < -2.09999999999999979e-236Initial program 60.0%
Taylor expanded in b around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-+.f6447.5
Applied rewrites47.5%
Taylor expanded in y around inf
lower-+.f6451.2
Applied rewrites51.2%
if -2.09999999999999979e-236 < y < 5.40000000000000019e-103Initial program 60.0%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-+.f6425.4
Applied rewrites25.4%
Taylor expanded in y around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6421.8
Applied rewrites21.8%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (- (+ a z) b))) (if (<= y -6.6e+49) t_1 (if (<= y 4.7e-85) (+ a z) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a + z) - b;
double tmp;
if (y <= -6.6e+49) {
tmp = t_1;
} else if (y <= 4.7e-85) {
tmp = a + z;
} else {
tmp = t_1;
}
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)
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) :: t_1
real(8) :: tmp
t_1 = (a + z) - b
if (y <= (-6.6d+49)) then
tmp = t_1
else if (y <= 4.7d-85) then
tmp = a + z
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a + z) - b;
double tmp;
if (y <= -6.6e+49) {
tmp = t_1;
} else if (y <= 4.7e-85) {
tmp = a + z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (a + z) - b tmp = 0 if y <= -6.6e+49: tmp = t_1 elif y <= 4.7e-85: tmp = a + z else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a + z) - b) tmp = 0.0 if (y <= -6.6e+49) tmp = t_1; elseif (y <= 4.7e-85) tmp = Float64(a + z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (a + z) - b; tmp = 0.0; if (y <= -6.6e+49) tmp = t_1; elseif (y <= 4.7e-85) tmp = a + z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[y, -6.6e+49], t$95$1, If[LessEqual[y, 4.7e-85], N[(a + z), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a + z\right) - b\\
\mathbf{if}\;y \leq -6.6 \cdot 10^{+49}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 4.7 \cdot 10^{-85}:\\
\;\;\;\;a + z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -6.5999999999999997e49 or 4.70000000000000009e-85 < y Initial program 60.0%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6455.5
Applied rewrites55.5%
if -6.5999999999999997e49 < y < 4.70000000000000009e-85Initial program 60.0%
Taylor expanded in b around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-+.f6447.5
Applied rewrites47.5%
Taylor expanded in y around inf
lower-+.f6451.2
Applied rewrites51.2%
(FPCore (x y z t a b) :precision binary64 (if (<= t 6.8e+69) (+ a z) a))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= 6.8e+69) {
tmp = a + z;
} else {
tmp = 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)
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) :: tmp
if (t <= 6.8d+69) then
tmp = a + z
else
tmp = a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= 6.8e+69) {
tmp = a + z;
} else {
tmp = a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= 6.8e+69: tmp = a + z else: tmp = a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= 6.8e+69) tmp = Float64(a + z); else tmp = a; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= 6.8e+69) tmp = a + z; else tmp = a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, 6.8e+69], N[(a + z), $MachinePrecision], a]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 6.8 \cdot 10^{+69}:\\
\;\;\;\;a + z\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if t < 6.79999999999999973e69Initial program 60.0%
Taylor expanded in b around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-+.f6447.5
Applied rewrites47.5%
Taylor expanded in y around inf
lower-+.f6451.2
Applied rewrites51.2%
if 6.79999999999999973e69 < t Initial program 60.0%
Taylor expanded in t around inf
Applied rewrites31.1%
(FPCore (x y z t a b) :precision binary64 (if (<= a -4.8e-11) a (if (<= a 8.5e-135) z a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -4.8e-11) {
tmp = a;
} else if (a <= 8.5e-135) {
tmp = z;
} else {
tmp = 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)
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) :: tmp
if (a <= (-4.8d-11)) then
tmp = a
else if (a <= 8.5d-135) then
tmp = z
else
tmp = a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -4.8e-11) {
tmp = a;
} else if (a <= 8.5e-135) {
tmp = z;
} else {
tmp = a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= -4.8e-11: tmp = a elif a <= 8.5e-135: tmp = z else: tmp = a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -4.8e-11) tmp = a; elseif (a <= 8.5e-135) tmp = z; else tmp = a; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (a <= -4.8e-11) tmp = a; elseif (a <= 8.5e-135) tmp = z; else tmp = a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -4.8e-11], a, If[LessEqual[a, 8.5e-135], z, a]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.8 \cdot 10^{-11}:\\
\;\;\;\;a\\
\mathbf{elif}\;a \leq 8.5 \cdot 10^{-135}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if a < -4.8000000000000002e-11 or 8.49999999999999942e-135 < a Initial program 60.0%
Taylor expanded in t around inf
Applied rewrites31.1%
if -4.8000000000000002e-11 < a < 8.49999999999999942e-135Initial program 60.0%
Taylor expanded in x around inf
Applied rewrites33.4%
(FPCore (x y z t a b) :precision binary64 a)
double code(double x, double y, double z, double t, double a, double b) {
return 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)
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
code = a
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return a;
}
def code(x, y, z, t, a, b): return a
function code(x, y, z, t, a, b) return a end
function tmp = code(x, y, z, t, a, b) tmp = a; end
code[x_, y_, z_, t_, a_, b_] := a
\begin{array}{l}
\\
a
\end{array}
Initial program 60.0%
Taylor expanded in t around inf
Applied rewrites31.1%
herbie shell --seed 2025150
(FPCore (x y z t a b)
:name "AI.Clustering.Hierarchical.Internal:ward from clustering-0.2.1"
:precision binary64
(/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))