
(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 16 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 (+ t (+ x y)))
(t_2 (* z (/ (+ x y) t_1)))
(t_3 (+ (+ y x) t))
(t_4 (/ (+ t y) t_3)))
(if (<= y -9e+70)
(fma t_4 a (fma -1.0 b t_2))
(if (<= y 4.2e+163)
(fma t_4 a (fma -1.0 (/ (* b y) t_1) t_2))
(- (+ a z) (* b (/ y t_3)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = t + (x + y);
double t_2 = z * ((x + y) / t_1);
double t_3 = (y + x) + t;
double t_4 = (t + y) / t_3;
double tmp;
if (y <= -9e+70) {
tmp = fma(t_4, a, fma(-1.0, b, t_2));
} else if (y <= 4.2e+163) {
tmp = fma(t_4, a, fma(-1.0, ((b * y) / t_1), t_2));
} else {
tmp = (a + z) - (b * (y / t_3));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(t + Float64(x + y)) t_2 = Float64(z * Float64(Float64(x + y) / t_1)) t_3 = Float64(Float64(y + x) + t) t_4 = Float64(Float64(t + y) / t_3) tmp = 0.0 if (y <= -9e+70) tmp = fma(t_4, a, fma(-1.0, b, t_2)); elseif (y <= 4.2e+163) tmp = fma(t_4, a, fma(-1.0, Float64(Float64(b * y) / t_1), t_2)); else tmp = Float64(Float64(a + z) - Float64(b * Float64(y / t_3))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(z * N[(N[(x + y), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(y + x), $MachinePrecision] + t), $MachinePrecision]}, Block[{t$95$4 = N[(N[(t + y), $MachinePrecision] / t$95$3), $MachinePrecision]}, If[LessEqual[y, -9e+70], N[(t$95$4 * a + N[(-1.0 * b + t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.2e+163], N[(t$95$4 * a + N[(-1.0 * N[(N[(b * y), $MachinePrecision] / t$95$1), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision], N[(N[(a + z), $MachinePrecision] - N[(b * N[(y / t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t + \left(x + y\right)\\
t_2 := z \cdot \frac{x + y}{t\_1}\\
t_3 := \left(y + x\right) + t\\
t_4 := \frac{t + y}{t\_3}\\
\mathbf{if}\;y \leq -9 \cdot 10^{+70}:\\
\;\;\;\;\mathsf{fma}\left(t\_4, a, \mathsf{fma}\left(-1, b, t\_2\right)\right)\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{+163}:\\
\;\;\;\;\mathsf{fma}\left(t\_4, a, \mathsf{fma}\left(-1, \frac{b \cdot y}{t\_1}, t\_2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(a + z\right) - b \cdot \frac{y}{t\_3}\\
\end{array}
\end{array}
if y < -8.9999999999999999e70Initial program 59.6%
Applied rewrites71.1%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-/.f64N/A
lift-*.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-+.f6486.5
Applied rewrites86.5%
Taylor expanded in y around inf
Applied rewrites72.4%
if -8.9999999999999999e70 < y < 4.2000000000000001e163Initial program 59.6%
Applied rewrites71.1%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-/.f64N/A
lift-*.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-+.f6486.5
Applied rewrites86.5%
if 4.2000000000000001e163 < y Initial program 59.6%
Applied rewrites64.5%
Taylor expanded in y around inf
lower-*.f64N/A
lower-+.f6435.0
Applied rewrites35.0%
Taylor expanded in y around inf
lift-+.f6471.2
Applied rewrites71.2%
(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 (/ (+ t y) t_2))
(t_4 (fma t_3 a (fma -1.0 b (* z (/ (+ x y) (+ t (+ x y))))))))
(if (<= t_1 -5e+266)
t_4
(if (<= t_1 5e+140) (fma t_3 a (/ (- (* (+ y x) z) (* b y)) t_2)) t_4))))
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 = (t + y) / t_2;
double t_4 = fma(t_3, a, fma(-1.0, b, (z * ((x + y) / (t + (x + y))))));
double tmp;
if (t_1 <= -5e+266) {
tmp = t_4;
} else if (t_1 <= 5e+140) {
tmp = fma(t_3, a, ((((y + x) * z) - (b * y)) / t_2));
} else {
tmp = t_4;
}
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(t + y) / t_2) t_4 = fma(t_3, a, fma(-1.0, b, Float64(z * Float64(Float64(x + y) / Float64(t + Float64(x + y)))))) tmp = 0.0 if (t_1 <= -5e+266) tmp = t_4; elseif (t_1 <= 5e+140) tmp = fma(t_3, a, Float64(Float64(Float64(Float64(y + x) * z) - Float64(b * y)) / t_2)); else tmp = t_4; 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[(t + y), $MachinePrecision] / t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 * a + N[(-1.0 * b + N[(z * N[(N[(x + y), $MachinePrecision] / N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+266], t$95$4, If[LessEqual[t$95$1, 5e+140], N[(t$95$3 * a + N[(N[(N[(N[(y + x), $MachinePrecision] * z), $MachinePrecision] - N[(b * y), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision], t$95$4]]]]]]
\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{t + y}{t\_2}\\
t_4 := \mathsf{fma}\left(t\_3, a, \mathsf{fma}\left(-1, b, z \cdot \frac{x + y}{t + \left(x + y\right)}\right)\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+266}:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+140}:\\
\;\;\;\;\mathsf{fma}\left(t\_3, a, \frac{\left(y + x\right) \cdot z - b \cdot y}{t\_2}\right)\\
\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)) < -4.9999999999999999e266 or 5.00000000000000008e140 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 59.6%
Applied rewrites71.1%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-/.f64N/A
lift-*.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-+.f6486.5
Applied rewrites86.5%
Taylor expanded in y around inf
Applied rewrites72.4%
if -4.9999999999999999e266 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 5.00000000000000008e140Initial program 59.6%
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
(fma
(/ (+ t y) (+ (+ y x) t))
a
(fma -1.0 b (* z (/ (+ x y) (+ t (+ x y))))))))
(if (<= t_1 -5e+266) t_2 (if (<= t_1 5e+140) t_1 t_2))))
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 = fma(((t + y) / ((y + x) + t)), a, fma(-1.0, b, (z * ((x + y) / (t + (x + y))))));
double tmp;
if (t_1 <= -5e+266) {
tmp = t_2;
} else if (t_1 <= 5e+140) {
tmp = t_1;
} else {
tmp = t_2;
}
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 = fma(Float64(Float64(t + y) / Float64(Float64(y + x) + t)), a, fma(-1.0, b, Float64(z * Float64(Float64(x + y) / Float64(t + Float64(x + y)))))) tmp = 0.0 if (t_1 <= -5e+266) tmp = t_2; elseif (t_1 <= 5e+140) tmp = t_1; else tmp = t_2; 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[(N[(t + y), $MachinePrecision] / N[(N[(y + x), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] * a + N[(-1.0 * b + N[(z * N[(N[(x + y), $MachinePrecision] / N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+266], t$95$2, If[LessEqual[t$95$1, 5e+140], t$95$1, t$95$2]]]]
\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 := \mathsf{fma}\left(\frac{t + y}{\left(y + x\right) + t}, a, \mathsf{fma}\left(-1, b, z \cdot \frac{x + y}{t + \left(x + y\right)}\right)\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+266}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+140}:\\
\;\;\;\;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)) < -4.9999999999999999e266 or 5.00000000000000008e140 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 59.6%
Applied rewrites71.1%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-/.f64N/A
lift-*.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-+.f6486.5
Applied rewrites86.5%
Taylor expanded in y around inf
Applied rewrites72.4%
if -4.9999999999999999e266 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 5.00000000000000008e140Initial program 59.6%
(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 (- (+ a z) (* b (/ y (+ (+ y x) t))))))
(if (<= t_1 (- INFINITY)) t_2 (if (<= t_1 2e+246) t_1 t_2))))
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 = (a + z) - (b * (y / ((y + x) + t)));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = t_2;
} else if (t_1 <= 2e+246) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
public static 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 = (a + z) - (b * (y / ((y + x) + t)));
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = t_2;
} else if (t_1 <= 2e+246) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y) t_2 = (a + z) - (b * (y / ((y + x) + t))) tmp = 0 if t_1 <= -math.inf: tmp = t_2 elif t_1 <= 2e+246: tmp = t_1 else: tmp = t_2 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(a + z) - Float64(b * Float64(y / Float64(Float64(y + x) + t)))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = t_2; elseif (t_1 <= 2e+246) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y); t_2 = (a + z) - (b * (y / ((y + x) + t))); tmp = 0.0; if (t_1 <= -Inf) tmp = t_2; elseif (t_1 <= 2e+246) tmp = t_1; else tmp = t_2; end tmp_2 = 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[(a + z), $MachinePrecision] - N[(b * N[(y / N[(N[(y + x), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], t$95$2, If[LessEqual[t$95$1, 2e+246], t$95$1, t$95$2]]]]
\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(a + z\right) - b \cdot \frac{y}{\left(y + x\right) + t}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+246}:\\
\;\;\;\;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)) < -inf.0 or 2.00000000000000014e246 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 59.6%
Applied rewrites64.5%
Taylor expanded in y around inf
lower-*.f64N/A
lower-+.f6435.0
Applied rewrites35.0%
Taylor expanded in y around inf
lift-+.f6471.2
Applied rewrites71.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)) < 2.00000000000000014e246Initial program 59.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 (/ y (+ (+ y x) t))))))
(if (<= t_2 (- INFINITY))
t_3
(if (<= t_2 2e+246)
(/ (fma a t (fma (- (+ a z) b) y (* z x))) 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 * (y / ((y + x) + t)));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_3;
} else if (t_2 <= 2e+246) {
tmp = fma(a, t, fma(((a + z) - b), y, (z * x))) / 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) - Float64(b * Float64(y / Float64(Float64(y + x) + t)))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_3; elseif (t_2 <= 2e+246) tmp = Float64(fma(a, t, fma(Float64(Float64(a + z) - b), y, Float64(z * x))) / 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] - N[(b * N[(y / N[(N[(y + x), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$3, If[LessEqual[t$95$2, 2e+246], N[(N[(a * t + N[(N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision] * y + N[(z * x), $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 \cdot \frac{y}{\left(y + x\right) + t}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+246}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, \mathsf{fma}\left(\left(a + z\right) - b, y, z \cdot x\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.00000000000000014e246 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 59.6%
Applied rewrites64.5%
Taylor expanded in y around inf
lower-*.f64N/A
lower-+.f6435.0
Applied rewrites35.0%
Taylor expanded in y around inf
lift-+.f6471.2
Applied rewrites71.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)) < 2.00000000000000014e246Initial program 59.6%
Taylor expanded in y around 0
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6459.9
Applied rewrites59.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (+ t y) a))
(t_2 (+ (+ x t) y))
(t_3 (/ (- (+ (* (+ x y) z) t_1) (* y b)) t_2))
(t_4 (+ (+ y x) t)))
(if (<= t_3 -5e+144)
(fma (/ (+ t y) t_4) a (- z b))
(if (<= t_3 4e-35) (/ (- t_1 (* y b)) t_2) (- (+ a z) (* b (/ y t_4)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t + y) * a;
double t_2 = (x + t) + y;
double t_3 = ((((x + y) * z) + t_1) - (y * b)) / t_2;
double t_4 = (y + x) + t;
double tmp;
if (t_3 <= -5e+144) {
tmp = fma(((t + y) / t_4), a, (z - b));
} else if (t_3 <= 4e-35) {
tmp = (t_1 - (y * b)) / t_2;
} else {
tmp = (a + z) - (b * (y / t_4));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t + y) * a) t_2 = Float64(Float64(x + t) + y) t_3 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + t_1) - Float64(y * b)) / t_2) t_4 = Float64(Float64(y + x) + t) tmp = 0.0 if (t_3 <= -5e+144) tmp = fma(Float64(Float64(t + y) / t_4), a, Float64(z - b)); elseif (t_3 <= 4e-35) tmp = Float64(Float64(t_1 - Float64(y * b)) / t_2); else tmp = Float64(Float64(a + z) - Float64(b * Float64(y / t_4))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + t$95$1), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(N[(y + x), $MachinePrecision] + t), $MachinePrecision]}, If[LessEqual[t$95$3, -5e+144], N[(N[(N[(t + y), $MachinePrecision] / t$95$4), $MachinePrecision] * a + N[(z - b), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 4e-35], N[(N[(t$95$1 - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision], N[(N[(a + z), $MachinePrecision] - N[(b * N[(y / t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t + y\right) \cdot a\\
t_2 := \left(x + t\right) + y\\
t_3 := \frac{\left(\left(x + y\right) \cdot z + t\_1\right) - y \cdot b}{t\_2}\\
t_4 := \left(y + x\right) + t\\
\mathbf{if}\;t\_3 \leq -5 \cdot 10^{+144}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t + y}{t\_4}, a, z - b\right)\\
\mathbf{elif}\;t\_3 \leq 4 \cdot 10^{-35}:\\
\;\;\;\;\frac{t\_1 - y \cdot b}{t\_2}\\
\mathbf{else}:\\
\;\;\;\;\left(a + z\right) - b \cdot \frac{y}{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)) < -4.9999999999999999e144Initial program 59.6%
Applied rewrites71.1%
Taylor expanded in y around inf
lower--.f6464.2
Applied rewrites64.2%
if -4.9999999999999999e144 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 4.00000000000000003e-35Initial program 59.6%
Taylor expanded in z around 0
*-commutativeN/A
lift-+.f64N/A
lift-*.f6437.8
Applied rewrites37.8%
if 4.00000000000000003e-35 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 59.6%
Applied rewrites64.5%
Taylor expanded in y around inf
lower-*.f64N/A
lower-+.f6435.0
Applied rewrites35.0%
Taylor expanded in y around inf
lift-+.f6471.2
Applied rewrites71.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (+ y x) t)) (t_2 (fma (/ (+ t y) t_1) a (- z b))))
(if (<= a -4e+112)
t_2
(if (<= a 1.45e-23)
(- (+ a z) (* b (/ y t_1)))
(if (<= a 2.3e+61) (/ (fma a t (* z x)) (+ t x)) t_2)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (y + x) + t;
double t_2 = fma(((t + y) / t_1), a, (z - b));
double tmp;
if (a <= -4e+112) {
tmp = t_2;
} else if (a <= 1.45e-23) {
tmp = (a + z) - (b * (y / t_1));
} else if (a <= 2.3e+61) {
tmp = fma(a, t, (z * x)) / (t + x);
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(y + x) + t) t_2 = fma(Float64(Float64(t + y) / t_1), a, Float64(z - b)) tmp = 0.0 if (a <= -4e+112) tmp = t_2; elseif (a <= 1.45e-23) tmp = Float64(Float64(a + z) - Float64(b * Float64(y / t_1))); elseif (a <= 2.3e+61) tmp = Float64(fma(a, t, Float64(z * x)) / Float64(t + x)); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(y + x), $MachinePrecision] + t), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(t + y), $MachinePrecision] / t$95$1), $MachinePrecision] * a + N[(z - b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -4e+112], t$95$2, If[LessEqual[a, 1.45e-23], N[(N[(a + z), $MachinePrecision] - N[(b * N[(y / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2.3e+61], N[(N[(a * t + N[(z * x), $MachinePrecision]), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y + x\right) + t\\
t_2 := \mathsf{fma}\left(\frac{t + y}{t\_1}, a, z - b\right)\\
\mathbf{if}\;a \leq -4 \cdot 10^{+112}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;a \leq 1.45 \cdot 10^{-23}:\\
\;\;\;\;\left(a + z\right) - b \cdot \frac{y}{t\_1}\\
\mathbf{elif}\;a \leq 2.3 \cdot 10^{+61}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, z \cdot x\right)}{t + x}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if a < -3.9999999999999997e112 or 2.3e61 < a Initial program 59.6%
Applied rewrites71.1%
Taylor expanded in y around inf
lower--.f6464.2
Applied rewrites64.2%
if -3.9999999999999997e112 < a < 1.4500000000000001e-23Initial program 59.6%
Applied rewrites64.5%
Taylor expanded in y around inf
lower-*.f64N/A
lower-+.f6435.0
Applied rewrites35.0%
Taylor expanded in y around inf
lift-+.f6471.2
Applied rewrites71.2%
if 1.4500000000000001e-23 < a < 2.3e61Initial program 59.6%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6440.3
Applied rewrites40.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* z (/ (+ x y) (+ t (+ x y))))))
(if (<= z -4.8e+143)
t_1
(if (<= z 3.2e+187) (- (+ a z) (* b (/ y (+ (+ y x) t)))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = z * ((x + y) / (t + (x + y)));
double tmp;
if (z <= -4.8e+143) {
tmp = t_1;
} else if (z <= 3.2e+187) {
tmp = (a + z) - (b * (y / ((y + x) + 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 = z * ((x + y) / (t + (x + y)))
if (z <= (-4.8d+143)) then
tmp = t_1
else if (z <= 3.2d+187) then
tmp = (a + z) - (b * (y / ((y + x) + 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 = z * ((x + y) / (t + (x + y)));
double tmp;
if (z <= -4.8e+143) {
tmp = t_1;
} else if (z <= 3.2e+187) {
tmp = (a + z) - (b * (y / ((y + x) + t)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = z * ((x + y) / (t + (x + y))) tmp = 0 if z <= -4.8e+143: tmp = t_1 elif z <= 3.2e+187: tmp = (a + z) - (b * (y / ((y + x) + t))) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(z * Float64(Float64(x + y) / Float64(t + Float64(x + y)))) tmp = 0.0 if (z <= -4.8e+143) tmp = t_1; elseif (z <= 3.2e+187) tmp = Float64(Float64(a + z) - Float64(b * Float64(y / Float64(Float64(y + x) + t)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = z * ((x + y) / (t + (x + y))); tmp = 0.0; if (z <= -4.8e+143) tmp = t_1; elseif (z <= 3.2e+187) tmp = (a + z) - (b * (y / ((y + x) + t))); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z * N[(N[(x + y), $MachinePrecision] / N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.8e+143], t$95$1, If[LessEqual[z, 3.2e+187], N[(N[(a + z), $MachinePrecision] - N[(b * N[(y / N[(N[(y + x), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \frac{x + y}{t + \left(x + y\right)}\\
\mathbf{if}\;z \leq -4.8 \cdot 10^{+143}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{+187}:\\
\;\;\;\;\left(a + z\right) - b \cdot \frac{y}{\left(y + x\right) + t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -4.79999999999999959e143 or 3.19999999999999993e187 < z Initial program 59.6%
Applied rewrites71.1%
Taylor expanded in z around inf
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-+.f6439.3
Applied rewrites39.3%
if -4.79999999999999959e143 < z < 3.19999999999999993e187Initial program 59.6%
Applied rewrites64.5%
Taylor expanded in y around inf
lower-*.f64N/A
lower-+.f6435.0
Applied rewrites35.0%
Taylor expanded in y around inf
lift-+.f6471.2
Applied rewrites71.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y))))
(if (<= t_1 -1e+237)
(fma (/ y (+ x y)) a (- z b))
(if (<= t_1 2e+48)
(/ (fma a t (* z x)) (+ t x))
(- (+ a z) (* b (/ y (+ y t))))))))
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 tmp;
if (t_1 <= -1e+237) {
tmp = fma((y / (x + y)), a, (z - b));
} else if (t_1 <= 2e+48) {
tmp = fma(a, t, (z * x)) / (t + x);
} else {
tmp = (a + z) - (b * (y / (y + t)));
}
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)) tmp = 0.0 if (t_1 <= -1e+237) tmp = fma(Float64(y / Float64(x + y)), a, Float64(z - b)); elseif (t_1 <= 2e+48) tmp = Float64(fma(a, t, Float64(z * x)) / Float64(t + x)); else tmp = Float64(Float64(a + z) - Float64(b * Float64(y / Float64(y + t)))); 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]}, If[LessEqual[t$95$1, -1e+237], N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] * a + N[(z - b), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+48], N[(N[(a * t + N[(z * x), $MachinePrecision]), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision], N[(N[(a + z), $MachinePrecision] - N[(b * N[(y / N[(y + t), $MachinePrecision]), $MachinePrecision]), $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}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+237}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{x + y}, a, z - b\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+48}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, z \cdot x\right)}{t + x}\\
\mathbf{else}:\\
\;\;\;\;\left(a + z\right) - b \cdot \frac{y}{y + t}\\
\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)) < -9.9999999999999994e236Initial program 59.6%
Applied rewrites71.1%
Taylor expanded in y around inf
lower--.f6464.2
Applied rewrites64.2%
Taylor expanded in t around 0
lower-/.f64N/A
lift-+.f6456.5
Applied rewrites56.5%
if -9.9999999999999994e236 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 2.00000000000000009e48Initial program 59.6%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6440.3
Applied rewrites40.3%
if 2.00000000000000009e48 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 59.6%
Applied rewrites64.5%
Taylor expanded in x around 0
Applied rewrites49.7%
Taylor expanded in x around 0
Applied rewrites48.6%
Taylor expanded in x around 0
Applied rewrites43.5%
Taylor expanded in y around inf
lower-+.f6464.9
Applied rewrites64.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y))))
(if (<= t_1 -1e+237)
(fma (/ y (+ x y)) a (- z b))
(if (<= t_1 2e+178) (/ (fma a t (* z x)) (+ t x)) (- (+ a z) b)))))
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 tmp;
if (t_1 <= -1e+237) {
tmp = fma((y / (x + y)), a, (z - b));
} else if (t_1 <= 2e+178) {
tmp = fma(a, t, (z * x)) / (t + x);
} else {
tmp = (a + z) - b;
}
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)) tmp = 0.0 if (t_1 <= -1e+237) tmp = fma(Float64(y / Float64(x + y)), a, Float64(z - b)); elseif (t_1 <= 2e+178) tmp = Float64(fma(a, t, Float64(z * x)) / Float64(t + x)); else tmp = Float64(Float64(a + z) - b); 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]}, If[LessEqual[t$95$1, -1e+237], N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] * a + N[(z - b), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+178], N[(N[(a * t + N[(z * x), $MachinePrecision]), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision], N[(N[(a + z), $MachinePrecision] - b), $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}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+237}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{x + y}, a, z - b\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+178}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, z \cdot x\right)}{t + x}\\
\mathbf{else}:\\
\;\;\;\;\left(a + z\right) - b\\
\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)) < -9.9999999999999994e236Initial program 59.6%
Applied rewrites71.1%
Taylor expanded in y around inf
lower--.f6464.2
Applied rewrites64.2%
Taylor expanded in t around 0
lower-/.f64N/A
lift-+.f6456.5
Applied rewrites56.5%
if -9.9999999999999994e236 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 2.0000000000000001e178Initial program 59.6%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6440.3
Applied rewrites40.3%
if 2.0000000000000001e178 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 59.6%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6456.2
Applied rewrites56.2%
(FPCore (x y z t a b)
:precision binary64
(if (<= t -4.9e+210)
a
(if (<= t -5e-5)
(fma (/ t (+ t x)) a (- z b))
(if (<= t 1.45e+220) (fma (/ y (+ x y)) a (- z b)) a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -4.9e+210) {
tmp = a;
} else if (t <= -5e-5) {
tmp = fma((t / (t + x)), a, (z - b));
} else if (t <= 1.45e+220) {
tmp = fma((y / (x + y)), a, (z - b));
} else {
tmp = a;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -4.9e+210) tmp = a; elseif (t <= -5e-5) tmp = fma(Float64(t / Float64(t + x)), a, Float64(z - b)); elseif (t <= 1.45e+220) tmp = fma(Float64(y / Float64(x + y)), a, Float64(z - b)); else tmp = a; end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -4.9e+210], a, If[LessEqual[t, -5e-5], N[(N[(t / N[(t + x), $MachinePrecision]), $MachinePrecision] * a + N[(z - b), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.45e+220], N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] * a + N[(z - b), $MachinePrecision]), $MachinePrecision], a]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.9 \cdot 10^{+210}:\\
\;\;\;\;a\\
\mathbf{elif}\;t \leq -5 \cdot 10^{-5}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{t + x}, a, z - b\right)\\
\mathbf{elif}\;t \leq 1.45 \cdot 10^{+220}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{x + y}, a, z - b\right)\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if t < -4.90000000000000007e210 or 1.44999999999999996e220 < t Initial program 59.6%
Taylor expanded in t around inf
Applied rewrites32.8%
if -4.90000000000000007e210 < t < -5.00000000000000024e-5Initial program 59.6%
Applied rewrites71.1%
Taylor expanded in y around inf
lower--.f6464.2
Applied rewrites64.2%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6456.0
Applied rewrites56.0%
if -5.00000000000000024e-5 < t < 1.44999999999999996e220Initial program 59.6%
Applied rewrites71.1%
Taylor expanded in y around inf
lower--.f6464.2
Applied rewrites64.2%
Taylor expanded in t around 0
lower-/.f64N/A
lift-+.f6456.5
Applied rewrites56.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y))))
(if (<= t_1 -2e-89)
(- (+ a z) b)
(if (<= t_1 5e-23) (/ (* a t) (+ t x)) (fma (/ t (+ t x)) a (- z b))))))
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 tmp;
if (t_1 <= -2e-89) {
tmp = (a + z) - b;
} else if (t_1 <= 5e-23) {
tmp = (a * t) / (t + x);
} else {
tmp = fma((t / (t + x)), a, (z - b));
}
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)) tmp = 0.0 if (t_1 <= -2e-89) tmp = Float64(Float64(a + z) - b); elseif (t_1 <= 5e-23) tmp = Float64(Float64(a * t) / Float64(t + x)); else tmp = fma(Float64(t / Float64(t + x)), a, Float64(z - b)); 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]}, If[LessEqual[t$95$1, -2e-89], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision], If[LessEqual[t$95$1, 5e-23], N[(N[(a * t), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision], N[(N[(t / N[(t + x), $MachinePrecision]), $MachinePrecision] * a + N[(z - b), $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}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-89}:\\
\;\;\;\;\left(a + z\right) - b\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-23}:\\
\;\;\;\;\frac{a \cdot t}{t + x}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{t + x}, a, z - b\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)) < -2.00000000000000008e-89Initial program 59.6%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6456.2
Applied rewrites56.2%
if -2.00000000000000008e-89 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 5.0000000000000002e-23Initial program 59.6%
Taylor expanded in a around inf
lower-/.f64N/A
*-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6425.0
Applied rewrites25.0%
Taylor expanded in y around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6421.8
Applied rewrites21.8%
if 5.0000000000000002e-23 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 59.6%
Applied rewrites71.1%
Taylor expanded in y around inf
lower--.f6464.2
Applied rewrites64.2%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6456.0
Applied rewrites56.0%
(FPCore (x y z t a b) :precision binary64 (if (<= t -4.7e+210) a (if (<= t 1.55e+220) (- (+ a z) b) a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -4.7e+210) {
tmp = a;
} else if (t <= 1.55e+220) {
tmp = (a + z) - b;
} 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 <= (-4.7d+210)) then
tmp = a
else if (t <= 1.55d+220) then
tmp = (a + z) - b
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 <= -4.7e+210) {
tmp = a;
} else if (t <= 1.55e+220) {
tmp = (a + z) - b;
} else {
tmp = a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -4.7e+210: tmp = a elif t <= 1.55e+220: tmp = (a + z) - b else: tmp = a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -4.7e+210) tmp = a; elseif (t <= 1.55e+220) tmp = Float64(Float64(a + z) - b); else tmp = a; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -4.7e+210) tmp = a; elseif (t <= 1.55e+220) tmp = (a + z) - b; else tmp = a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -4.7e+210], a, If[LessEqual[t, 1.55e+220], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision], a]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.7 \cdot 10^{+210}:\\
\;\;\;\;a\\
\mathbf{elif}\;t \leq 1.55 \cdot 10^{+220}:\\
\;\;\;\;\left(a + z\right) - b\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if t < -4.7000000000000001e210 or 1.55e220 < t Initial program 59.6%
Taylor expanded in t around inf
Applied rewrites32.8%
if -4.7000000000000001e210 < t < 1.55e220Initial program 59.6%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6456.2
Applied rewrites56.2%
(FPCore (x y z t a b) :precision binary64 (if (<= x -110000.0) z (if (<= x 1.1e-27) (- a b) z)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -110000.0) {
tmp = z;
} else if (x <= 1.1e-27) {
tmp = a - b;
} else {
tmp = z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
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 (x <= (-110000.0d0)) then
tmp = z
else if (x <= 1.1d-27) then
tmp = a - b
else
tmp = z
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 (x <= -110000.0) {
tmp = z;
} else if (x <= 1.1e-27) {
tmp = a - b;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -110000.0: tmp = z elif x <= 1.1e-27: tmp = a - b else: tmp = z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -110000.0) tmp = z; elseif (x <= 1.1e-27) tmp = Float64(a - b); else tmp = z; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (x <= -110000.0) tmp = z; elseif (x <= 1.1e-27) tmp = a - b; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -110000.0], z, If[LessEqual[x, 1.1e-27], N[(a - b), $MachinePrecision], z]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -110000:\\
\;\;\;\;z\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{-27}:\\
\;\;\;\;a - b\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if x < -1.1e5 or 1.09999999999999993e-27 < x Initial program 59.6%
Taylor expanded in x around inf
Applied rewrites32.1%
if -1.1e5 < x < 1.09999999999999993e-27Initial program 59.6%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6456.2
Applied rewrites56.2%
Taylor expanded in z around 0
Applied rewrites38.2%
(FPCore (x y z t a b) :precision binary64 (if (<= x -6.5e+20) z (if (<= x 1.15e-27) a z)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -6.5e+20) {
tmp = z;
} else if (x <= 1.15e-27) {
tmp = a;
} else {
tmp = z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
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 (x <= (-6.5d+20)) then
tmp = z
else if (x <= 1.15d-27) then
tmp = a
else
tmp = z
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 (x <= -6.5e+20) {
tmp = z;
} else if (x <= 1.15e-27) {
tmp = a;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -6.5e+20: tmp = z elif x <= 1.15e-27: tmp = a else: tmp = z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -6.5e+20) tmp = z; elseif (x <= 1.15e-27) tmp = a; else tmp = z; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (x <= -6.5e+20) tmp = z; elseif (x <= 1.15e-27) tmp = a; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -6.5e+20], z, If[LessEqual[x, 1.15e-27], a, z]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.5 \cdot 10^{+20}:\\
\;\;\;\;z\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{-27}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if x < -6.5e20 or 1.15e-27 < x Initial program 59.6%
Taylor expanded in x around inf
Applied rewrites32.1%
if -6.5e20 < x < 1.15e-27Initial program 59.6%
Taylor expanded in t around inf
Applied rewrites32.8%
(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 59.6%
Taylor expanded in t around inf
Applied rewrites32.8%
herbie shell --seed 2025130
(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)))