
(FPCore (x y z t a b) :precision binary64 (+ (- (- x (* (- y 1.0) z)) (* (- t 1.0) a)) (* (- (+ y t) 2.0) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b);
}
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 - 1.0d0) * z)) - ((t - 1.0d0) * a)) + (((y + t) - 2.0d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b);
}
def code(x, y, z, t, a, b): return ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x - Float64(Float64(y - 1.0) * z)) - Float64(Float64(t - 1.0) * a)) + Float64(Float64(Float64(y + t) - 2.0) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x - N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] - N[(N[(t - 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - \left(y - 1\right) \cdot z\right) - \left(t - 1\right) \cdot a\right) + \left(\left(y + t\right) - 2\right) \cdot b
\end{array}
Herbie found 19 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (+ (- (- x (* (- y 1.0) z)) (* (- t 1.0) a)) (* (- (+ y t) 2.0) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b);
}
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 - 1.0d0) * z)) - ((t - 1.0d0) * a)) + (((y + t) - 2.0d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b);
}
def code(x, y, z, t, a, b): return ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x - Float64(Float64(y - 1.0) * z)) - Float64(Float64(t - 1.0) * a)) + Float64(Float64(Float64(y + t) - 2.0) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x - N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] - N[(N[(t - 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - \left(y - 1\right) \cdot z\right) - \left(t - 1\right) \cdot a\right) + \left(\left(y + t\right) - 2\right) \cdot b
\end{array}
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1
(+ (- (- x (* (- y 1.0) z)) (* (- t 1.0) a)) (* (- (+ y t) 2.0) b))))
(if (<= t_1 INFINITY) t_1 (* (- b a) t))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b);
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = (b - a) * t;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b);
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = (b - a) * t;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b) tmp = 0 if t_1 <= math.inf: tmp = t_1 else: tmp = (b - a) * t return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(x - Float64(Float64(y - 1.0) * z)) - Float64(Float64(t - 1.0) * a)) + Float64(Float64(Float64(y + t) - 2.0) * b)) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(Float64(b - a) * t); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b); tmp = 0.0; if (t_1 <= Inf) tmp = t_1; else tmp = (b - a) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(x - N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] - N[(N[(t - 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(x - \left(y - 1\right) \cdot z\right) - \left(t - 1\right) \cdot a\right) + \left(\left(y + t\right) - 2\right) \cdot b\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(b - a\right) \cdot t\\
\end{array}
\end{array}
if (+.f64 (-.f64 (-.f64 x (*.f64 (-.f64 y #s(literal 1 binary64)) z)) (*.f64 (-.f64 t #s(literal 1 binary64)) a)) (*.f64 (-.f64 (+.f64 y t) #s(literal 2 binary64)) b)) < +inf.0Initial program 95.1%
if +inf.0 < (+.f64 (-.f64 (-.f64 x (*.f64 (-.f64 y #s(literal 1 binary64)) z)) (*.f64 (-.f64 t #s(literal 1 binary64)) a)) (*.f64 (-.f64 (+.f64 y t) #s(literal 2 binary64)) b)) Initial program 95.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6433.8
Applied rewrites33.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma (- (+ t y) 2.0) b x)) (t_2 (- t_1 (* (- y 1.0) z))))
(if (<= z -1.55e+156)
t_2
(if (<= z 1.9e+126) (- t_1 (* (- t 1.0) a)) t_2))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(((t + y) - 2.0), b, x);
double t_2 = t_1 - ((y - 1.0) * z);
double tmp;
if (z <= -1.55e+156) {
tmp = t_2;
} else if (z <= 1.9e+126) {
tmp = t_1 - ((t - 1.0) * a);
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(Float64(Float64(t + y) - 2.0), b, x) t_2 = Float64(t_1 - Float64(Float64(y - 1.0) * z)) tmp = 0.0 if (z <= -1.55e+156) tmp = t_2; elseif (z <= 1.9e+126) tmp = Float64(t_1 - Float64(Float64(t - 1.0) * a)); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + x), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 - N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.55e+156], t$95$2, If[LessEqual[z, 1.9e+126], N[(t$95$1 - N[(N[(t - 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right)\\
t_2 := t\_1 - \left(y - 1\right) \cdot z\\
\mathbf{if}\;z \leq -1.55 \cdot 10^{+156}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{+126}:\\
\;\;\;\;t\_1 - \left(t - 1\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if z < -1.5500000000000001e156 or 1.90000000000000008e126 < z Initial program 95.1%
Taylor expanded in a around 0
lower--.f64N/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f6472.8
Applied rewrites72.8%
if -1.5500000000000001e156 < z < 1.90000000000000008e126Initial program 95.1%
Taylor expanded in z around 0
lower--.f64N/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f6473.8
Applied rewrites73.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (- (+ a x) (* z (- y 1.0)))))
(if (<= z -3.2e+156)
t_1
(if (<= z 2e+123) (- (fma (- (+ t y) 2.0) b x) (* (- t 1.0) a)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a + x) - (z * (y - 1.0));
double tmp;
if (z <= -3.2e+156) {
tmp = t_1;
} else if (z <= 2e+123) {
tmp = fma(((t + y) - 2.0), b, x) - ((t - 1.0) * a);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a + x) - Float64(z * Float64(y - 1.0))) tmp = 0.0 if (z <= -3.2e+156) tmp = t_1; elseif (z <= 2e+123) tmp = Float64(fma(Float64(Float64(t + y) - 2.0), b, x) - Float64(Float64(t - 1.0) * a)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a + x), $MachinePrecision] - N[(z * N[(y - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.2e+156], t$95$1, If[LessEqual[z, 2e+123], N[(N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + x), $MachinePrecision] - N[(N[(t - 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a + x\right) - z \cdot \left(y - 1\right)\\
\mathbf{if}\;z \leq -3.2 \cdot 10^{+156}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2 \cdot 10^{+123}:\\
\;\;\;\;\mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - \left(t - 1\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.20000000000000002e156 or 1.99999999999999996e123 < z Initial program 95.1%
Taylor expanded in t around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6468.8
Applied rewrites68.8%
Taylor expanded in b around 0
lower--.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lift--.f6450.4
Applied rewrites50.4%
if -3.20000000000000002e156 < z < 1.99999999999999996e123Initial program 95.1%
Taylor expanded in z around 0
lower--.f64N/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f6473.8
Applied rewrites73.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (- (+ a x) (* z (- y 1.0)))))
(if (<= b -2.95e-12)
(fma (- (+ t y) 2.0) b x)
(if (<= b -2.8e-223)
t_1
(if (<= b 3.8e-227)
(- x (* a (- t 1.0)))
(if (<= b 4.2e-28) t_1 (+ (* (- a) t) (* (- (+ y t) 2.0) b))))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a + x) - (z * (y - 1.0));
double tmp;
if (b <= -2.95e-12) {
tmp = fma(((t + y) - 2.0), b, x);
} else if (b <= -2.8e-223) {
tmp = t_1;
} else if (b <= 3.8e-227) {
tmp = x - (a * (t - 1.0));
} else if (b <= 4.2e-28) {
tmp = t_1;
} else {
tmp = (-a * t) + (((y + t) - 2.0) * b);
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a + x) - Float64(z * Float64(y - 1.0))) tmp = 0.0 if (b <= -2.95e-12) tmp = fma(Float64(Float64(t + y) - 2.0), b, x); elseif (b <= -2.8e-223) tmp = t_1; elseif (b <= 3.8e-227) tmp = Float64(x - Float64(a * Float64(t - 1.0))); elseif (b <= 4.2e-28) tmp = t_1; else tmp = Float64(Float64(Float64(-a) * t) + Float64(Float64(Float64(y + t) - 2.0) * b)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a + x), $MachinePrecision] - N[(z * N[(y - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -2.95e-12], N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + x), $MachinePrecision], If[LessEqual[b, -2.8e-223], t$95$1, If[LessEqual[b, 3.8e-227], N[(x - N[(a * N[(t - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 4.2e-28], t$95$1, N[(N[((-a) * t), $MachinePrecision] + N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a + x\right) - z \cdot \left(y - 1\right)\\
\mathbf{if}\;b \leq -2.95 \cdot 10^{-12}:\\
\;\;\;\;\mathsf{fma}\left(\left(t + y\right) - 2, b, x\right)\\
\mathbf{elif}\;b \leq -2.8 \cdot 10^{-223}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 3.8 \cdot 10^{-227}:\\
\;\;\;\;x - a \cdot \left(t - 1\right)\\
\mathbf{elif}\;b \leq 4.2 \cdot 10^{-28}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(-a\right) \cdot t + \left(\left(y + t\right) - 2\right) \cdot b\\
\end{array}
\end{array}
if b < -2.95e-12Initial program 95.1%
Taylor expanded in a around 0
lower--.f64N/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f6472.8
Applied rewrites72.8%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6445.4
Applied rewrites45.4%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-+.f6451.0
Applied rewrites51.0%
if -2.95e-12 < b < -2.80000000000000015e-223 or 3.8000000000000001e-227 < b < 4.20000000000000013e-28Initial program 95.1%
Taylor expanded in t around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6468.8
Applied rewrites68.8%
Taylor expanded in b around 0
lower--.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lift--.f6450.4
Applied rewrites50.4%
if -2.80000000000000015e-223 < b < 3.8000000000000001e-227Initial program 95.1%
Taylor expanded in z around 0
lower--.f64N/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f6473.8
Applied rewrites73.8%
Taylor expanded in b around 0
lower--.f64N/A
lower-*.f64N/A
lift--.f6442.5
Applied rewrites42.5%
if 4.20000000000000013e-28 < b Initial program 95.1%
Taylor expanded in t around inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6451.2
Applied rewrites51.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (- (+ a x) (* z (- y 1.0)))) (t_2 (fma (- (+ t y) 2.0) b x)))
(if (<= b -2.95e-12)
t_2
(if (<= b -2.8e-223)
t_1
(if (<= b 3.8e-227)
(- x (* a (- t 1.0)))
(if (<= b 2.4e-30) t_1 t_2))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a + x) - (z * (y - 1.0));
double t_2 = fma(((t + y) - 2.0), b, x);
double tmp;
if (b <= -2.95e-12) {
tmp = t_2;
} else if (b <= -2.8e-223) {
tmp = t_1;
} else if (b <= 3.8e-227) {
tmp = x - (a * (t - 1.0));
} else if (b <= 2.4e-30) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a + x) - Float64(z * Float64(y - 1.0))) t_2 = fma(Float64(Float64(t + y) - 2.0), b, x) tmp = 0.0 if (b <= -2.95e-12) tmp = t_2; elseif (b <= -2.8e-223) tmp = t_1; elseif (b <= 3.8e-227) tmp = Float64(x - Float64(a * Float64(t - 1.0))); elseif (b <= 2.4e-30) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a + x), $MachinePrecision] - N[(z * N[(y - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + x), $MachinePrecision]}, If[LessEqual[b, -2.95e-12], t$95$2, If[LessEqual[b, -2.8e-223], t$95$1, If[LessEqual[b, 3.8e-227], N[(x - N[(a * N[(t - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.4e-30], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a + x\right) - z \cdot \left(y - 1\right)\\
t_2 := \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right)\\
\mathbf{if}\;b \leq -2.95 \cdot 10^{-12}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;b \leq -2.8 \cdot 10^{-223}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 3.8 \cdot 10^{-227}:\\
\;\;\;\;x - a \cdot \left(t - 1\right)\\
\mathbf{elif}\;b \leq 2.4 \cdot 10^{-30}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if b < -2.95e-12 or 2.39999999999999985e-30 < b Initial program 95.1%
Taylor expanded in a around 0
lower--.f64N/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f6472.8
Applied rewrites72.8%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6445.4
Applied rewrites45.4%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-+.f6451.0
Applied rewrites51.0%
if -2.95e-12 < b < -2.80000000000000015e-223 or 3.8000000000000001e-227 < b < 2.39999999999999985e-30Initial program 95.1%
Taylor expanded in t around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6468.8
Applied rewrites68.8%
Taylor expanded in b around 0
lower--.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lift--.f6450.4
Applied rewrites50.4%
if -2.80000000000000015e-223 < b < 3.8000000000000001e-227Initial program 95.1%
Taylor expanded in z around 0
lower--.f64N/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f6473.8
Applied rewrites73.8%
Taylor expanded in b around 0
lower--.f64N/A
lower-*.f64N/A
lift--.f6442.5
Applied rewrites42.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma (- (+ t y) 2.0) b x)))
(if (<= b -3e-38)
t_1
(if (<= b 2.95e-108)
(- x (* a (- t 1.0)))
(if (<= b 6.8e-47) (* (- 1.0 y) z) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(((t + y) - 2.0), b, x);
double tmp;
if (b <= -3e-38) {
tmp = t_1;
} else if (b <= 2.95e-108) {
tmp = x - (a * (t - 1.0));
} else if (b <= 6.8e-47) {
tmp = (1.0 - y) * z;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(Float64(Float64(t + y) - 2.0), b, x) tmp = 0.0 if (b <= -3e-38) tmp = t_1; elseif (b <= 2.95e-108) tmp = Float64(x - Float64(a * Float64(t - 1.0))); elseif (b <= 6.8e-47) tmp = Float64(Float64(1.0 - y) * z); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + x), $MachinePrecision]}, If[LessEqual[b, -3e-38], t$95$1, If[LessEqual[b, 2.95e-108], N[(x - N[(a * N[(t - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 6.8e-47], N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right)\\
\mathbf{if}\;b \leq -3 \cdot 10^{-38}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 2.95 \cdot 10^{-108}:\\
\;\;\;\;x - a \cdot \left(t - 1\right)\\
\mathbf{elif}\;b \leq 6.8 \cdot 10^{-47}:\\
\;\;\;\;\left(1 - y\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -2.99999999999999989e-38 or 6.8000000000000003e-47 < b Initial program 95.1%
Taylor expanded in a around 0
lower--.f64N/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f6472.8
Applied rewrites72.8%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6445.4
Applied rewrites45.4%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-+.f6451.0
Applied rewrites51.0%
if -2.99999999999999989e-38 < b < 2.94999999999999982e-108Initial program 95.1%
Taylor expanded in z around 0
lower--.f64N/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f6473.8
Applied rewrites73.8%
Taylor expanded in b around 0
lower--.f64N/A
lower-*.f64N/A
lift--.f6442.5
Applied rewrites42.5%
if 2.94999999999999982e-108 < b < 6.8000000000000003e-47Initial program 95.1%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6427.9
Applied rewrites27.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b a) t)))
(if (<= t -23500000000000.0)
t_1
(if (<= t 70000000000.0) (+ (fma (- y 2.0) b x) a) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (b - a) * t;
double tmp;
if (t <= -23500000000000.0) {
tmp = t_1;
} else if (t <= 70000000000.0) {
tmp = fma((y - 2.0), b, x) + a;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(b - a) * t) tmp = 0.0 if (t <= -23500000000000.0) tmp = t_1; elseif (t <= 70000000000.0) tmp = Float64(fma(Float64(y - 2.0), b, x) + a); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -23500000000000.0], t$95$1, If[LessEqual[t, 70000000000.0], N[(N[(N[(y - 2.0), $MachinePrecision] * b + x), $MachinePrecision] + a), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(b - a\right) \cdot t\\
\mathbf{if}\;t \leq -23500000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 70000000000:\\
\;\;\;\;\mathsf{fma}\left(y - 2, b, x\right) + a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.35e13 or 7e10 < t Initial program 95.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6433.8
Applied rewrites33.8%
if -2.35e13 < t < 7e10Initial program 95.1%
Taylor expanded in t around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6468.8
Applied rewrites68.8%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-fma.f64N/A
lift--.f6446.6
Applied rewrites46.6%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (fma (- t 2.0) b z))) (if (<= b -3.1e+57) t_1 (if (<= b 7.2e+25) (- x (* a (- t 1.0))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma((t - 2.0), b, z);
double tmp;
if (b <= -3.1e+57) {
tmp = t_1;
} else if (b <= 7.2e+25) {
tmp = x - (a * (t - 1.0));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(Float64(t - 2.0), b, z) tmp = 0.0 if (b <= -3.1e+57) tmp = t_1; elseif (b <= 7.2e+25) tmp = Float64(x - Float64(a * Float64(t - 1.0))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - 2.0), $MachinePrecision] * b + z), $MachinePrecision]}, If[LessEqual[b, -3.1e+57], t$95$1, If[LessEqual[b, 7.2e+25], N[(x - N[(a * N[(t - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t - 2, b, z\right)\\
\mathbf{if}\;b \leq -3.1 \cdot 10^{+57}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 7.2 \cdot 10^{+25}:\\
\;\;\;\;x - a \cdot \left(t - 1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -3.10000000000000013e57 or 7.20000000000000031e25 < b Initial program 95.1%
Taylor expanded in a around 0
lower--.f64N/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f6472.8
Applied rewrites72.8%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6445.4
Applied rewrites45.4%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6432.2
Applied rewrites32.2%
if -3.10000000000000013e57 < b < 7.20000000000000031e25Initial program 95.1%
Taylor expanded in z around 0
lower--.f64N/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f6473.8
Applied rewrites73.8%
Taylor expanded in b around 0
lower--.f64N/A
lower-*.f64N/A
lift--.f6442.5
Applied rewrites42.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b a) t)))
(if (<= t -23500000000000.0)
t_1
(if (<= t 1.3e+39) (fma (- y 2.0) b x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (b - a) * t;
double tmp;
if (t <= -23500000000000.0) {
tmp = t_1;
} else if (t <= 1.3e+39) {
tmp = fma((y - 2.0), b, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(b - a) * t) tmp = 0.0 if (t <= -23500000000000.0) tmp = t_1; elseif (t <= 1.3e+39) tmp = fma(Float64(y - 2.0), b, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -23500000000000.0], t$95$1, If[LessEqual[t, 1.3e+39], N[(N[(y - 2.0), $MachinePrecision] * b + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(b - a\right) \cdot t\\
\mathbf{if}\;t \leq -23500000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.3 \cdot 10^{+39}:\\
\;\;\;\;\mathsf{fma}\left(y - 2, b, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.35e13 or 1.3e39 < t Initial program 95.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6433.8
Applied rewrites33.8%
if -2.35e13 < t < 1.3e39Initial program 95.1%
Taylor expanded in t around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6468.8
Applied rewrites68.8%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-fma.f64N/A
lift--.f6446.6
Applied rewrites46.6%
Taylor expanded in b around 0
lower-+.f6424.3
Applied rewrites24.3%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6437.4
Applied rewrites37.4%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (- b a) t))) (if (<= t -920.0) t_1 (if (<= t 240.0) (fma (- y 2.0) b a) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (b - a) * t;
double tmp;
if (t <= -920.0) {
tmp = t_1;
} else if (t <= 240.0) {
tmp = fma((y - 2.0), b, a);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(b - a) * t) tmp = 0.0 if (t <= -920.0) tmp = t_1; elseif (t <= 240.0) tmp = fma(Float64(y - 2.0), b, a); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -920.0], t$95$1, If[LessEqual[t, 240.0], N[(N[(y - 2.0), $MachinePrecision] * b + a), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(b - a\right) \cdot t\\
\mathbf{if}\;t \leq -920:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 240:\\
\;\;\;\;\mathsf{fma}\left(y - 2, b, a\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -920 or 240 < t Initial program 95.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6433.8
Applied rewrites33.8%
if -920 < t < 240Initial program 95.1%
Taylor expanded in t around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6468.8
Applied rewrites68.8%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-fma.f64N/A
lift--.f6446.6
Applied rewrites46.6%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6433.3
Applied rewrites33.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b a) t)))
(if (<= t -8e-8)
t_1
(if (<= t 3.2e-251)
(+ a x)
(if (<= t 2e-112) (+ z x) (if (<= t 240.0) (* (- y 2.0) b) t_1))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (b - a) * t;
double tmp;
if (t <= -8e-8) {
tmp = t_1;
} else if (t <= 3.2e-251) {
tmp = a + x;
} else if (t <= 2e-112) {
tmp = z + x;
} else if (t <= 240.0) {
tmp = (y - 2.0) * b;
} 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 = (b - a) * t
if (t <= (-8d-8)) then
tmp = t_1
else if (t <= 3.2d-251) then
tmp = a + x
else if (t <= 2d-112) then
tmp = z + x
else if (t <= 240.0d0) then
tmp = (y - 2.0d0) * b
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 = (b - a) * t;
double tmp;
if (t <= -8e-8) {
tmp = t_1;
} else if (t <= 3.2e-251) {
tmp = a + x;
} else if (t <= 2e-112) {
tmp = z + x;
} else if (t <= 240.0) {
tmp = (y - 2.0) * b;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (b - a) * t tmp = 0 if t <= -8e-8: tmp = t_1 elif t <= 3.2e-251: tmp = a + x elif t <= 2e-112: tmp = z + x elif t <= 240.0: tmp = (y - 2.0) * b else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(b - a) * t) tmp = 0.0 if (t <= -8e-8) tmp = t_1; elseif (t <= 3.2e-251) tmp = Float64(a + x); elseif (t <= 2e-112) tmp = Float64(z + x); elseif (t <= 240.0) tmp = Float64(Float64(y - 2.0) * b); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (b - a) * t; tmp = 0.0; if (t <= -8e-8) tmp = t_1; elseif (t <= 3.2e-251) tmp = a + x; elseif (t <= 2e-112) tmp = z + x; elseif (t <= 240.0) tmp = (y - 2.0) * b; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -8e-8], t$95$1, If[LessEqual[t, 3.2e-251], N[(a + x), $MachinePrecision], If[LessEqual[t, 2e-112], N[(z + x), $MachinePrecision], If[LessEqual[t, 240.0], N[(N[(y - 2.0), $MachinePrecision] * b), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(b - a\right) \cdot t\\
\mathbf{if}\;t \leq -8 \cdot 10^{-8}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.2 \cdot 10^{-251}:\\
\;\;\;\;a + x\\
\mathbf{elif}\;t \leq 2 \cdot 10^{-112}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;t \leq 240:\\
\;\;\;\;\left(y - 2\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -8.0000000000000002e-8 or 240 < t Initial program 95.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6433.8
Applied rewrites33.8%
if -8.0000000000000002e-8 < t < 3.19999999999999982e-251Initial program 95.1%
Taylor expanded in t around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6468.8
Applied rewrites68.8%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-fma.f64N/A
lift--.f6446.6
Applied rewrites46.6%
Taylor expanded in b around 0
lower-+.f6424.3
Applied rewrites24.3%
if 3.19999999999999982e-251 < t < 1.9999999999999999e-112Initial program 95.1%
Taylor expanded in a around 0
lower--.f64N/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f6472.8
Applied rewrites72.8%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6445.4
Applied rewrites45.4%
Taylor expanded in b around 0
+-commutativeN/A
lower-+.f6423.7
Applied rewrites23.7%
if 1.9999999999999999e-112 < t < 240Initial program 95.1%
Taylor expanded in t around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6468.8
Applied rewrites68.8%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-fma.f64N/A
lift--.f6446.6
Applied rewrites46.6%
Taylor expanded in b around 0
lower-+.f6424.3
Applied rewrites24.3%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6424.2
Applied rewrites24.2%
(FPCore (x y z t a b)
:precision binary64
(if (<= b -1.25e+63)
(* b t)
(if (<= b 8e-112)
(- x (* a t))
(if (<= b 2.1e+106) (* (- 1.0 y) z) (* (- y 2.0) b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -1.25e+63) {
tmp = b * t;
} else if (b <= 8e-112) {
tmp = x - (a * t);
} else if (b <= 2.1e+106) {
tmp = (1.0 - y) * z;
} else {
tmp = (y - 2.0) * b;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
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 (b <= (-1.25d+63)) then
tmp = b * t
else if (b <= 8d-112) then
tmp = x - (a * t)
else if (b <= 2.1d+106) then
tmp = (1.0d0 - y) * z
else
tmp = (y - 2.0d0) * b
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 (b <= -1.25e+63) {
tmp = b * t;
} else if (b <= 8e-112) {
tmp = x - (a * t);
} else if (b <= 2.1e+106) {
tmp = (1.0 - y) * z;
} else {
tmp = (y - 2.0) * b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if b <= -1.25e+63: tmp = b * t elif b <= 8e-112: tmp = x - (a * t) elif b <= 2.1e+106: tmp = (1.0 - y) * z else: tmp = (y - 2.0) * b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -1.25e+63) tmp = Float64(b * t); elseif (b <= 8e-112) tmp = Float64(x - Float64(a * t)); elseif (b <= 2.1e+106) tmp = Float64(Float64(1.0 - y) * z); else tmp = Float64(Float64(y - 2.0) * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (b <= -1.25e+63) tmp = b * t; elseif (b <= 8e-112) tmp = x - (a * t); elseif (b <= 2.1e+106) tmp = (1.0 - y) * z; else tmp = (y - 2.0) * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -1.25e+63], N[(b * t), $MachinePrecision], If[LessEqual[b, 8e-112], N[(x - N[(a * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.1e+106], N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision], N[(N[(y - 2.0), $MachinePrecision] * b), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.25 \cdot 10^{+63}:\\
\;\;\;\;b \cdot t\\
\mathbf{elif}\;b \leq 8 \cdot 10^{-112}:\\
\;\;\;\;x - a \cdot t\\
\mathbf{elif}\;b \leq 2.1 \cdot 10^{+106}:\\
\;\;\;\;\left(1 - y\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;\left(y - 2\right) \cdot b\\
\end{array}
\end{array}
if b < -1.25000000000000003e63Initial program 95.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6433.8
Applied rewrites33.8%
Taylor expanded in a around 0
Applied rewrites17.9%
if -1.25000000000000003e63 < b < 7.9999999999999996e-112Initial program 95.1%
Taylor expanded in z around 0
lower--.f64N/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f6473.8
Applied rewrites73.8%
Taylor expanded in b around 0
lower--.f64N/A
lower-*.f64N/A
lift--.f6442.5
Applied rewrites42.5%
Taylor expanded in t around inf
lower-*.f6433.3
Applied rewrites33.3%
if 7.9999999999999996e-112 < b < 2.10000000000000005e106Initial program 95.1%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6427.9
Applied rewrites27.9%
if 2.10000000000000005e106 < b Initial program 95.1%
Taylor expanded in t around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6468.8
Applied rewrites68.8%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-fma.f64N/A
lift--.f6446.6
Applied rewrites46.6%
Taylor expanded in b around 0
lower-+.f6424.3
Applied rewrites24.3%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6424.2
Applied rewrites24.2%
(FPCore (x y z t a b) :precision binary64 (if (<= b -1.25e+63) (* b t) (if (<= b 4.5e-20) (- x (* a t)) (* (- y 2.0) b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -1.25e+63) {
tmp = b * t;
} else if (b <= 4.5e-20) {
tmp = x - (a * t);
} else {
tmp = (y - 2.0) * b;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
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 (b <= (-1.25d+63)) then
tmp = b * t
else if (b <= 4.5d-20) then
tmp = x - (a * t)
else
tmp = (y - 2.0d0) * b
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 (b <= -1.25e+63) {
tmp = b * t;
} else if (b <= 4.5e-20) {
tmp = x - (a * t);
} else {
tmp = (y - 2.0) * b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if b <= -1.25e+63: tmp = b * t elif b <= 4.5e-20: tmp = x - (a * t) else: tmp = (y - 2.0) * b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -1.25e+63) tmp = Float64(b * t); elseif (b <= 4.5e-20) tmp = Float64(x - Float64(a * t)); else tmp = Float64(Float64(y - 2.0) * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (b <= -1.25e+63) tmp = b * t; elseif (b <= 4.5e-20) tmp = x - (a * t); else tmp = (y - 2.0) * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -1.25e+63], N[(b * t), $MachinePrecision], If[LessEqual[b, 4.5e-20], N[(x - N[(a * t), $MachinePrecision]), $MachinePrecision], N[(N[(y - 2.0), $MachinePrecision] * b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.25 \cdot 10^{+63}:\\
\;\;\;\;b \cdot t\\
\mathbf{elif}\;b \leq 4.5 \cdot 10^{-20}:\\
\;\;\;\;x - a \cdot t\\
\mathbf{else}:\\
\;\;\;\;\left(y - 2\right) \cdot b\\
\end{array}
\end{array}
if b < -1.25000000000000003e63Initial program 95.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6433.8
Applied rewrites33.8%
Taylor expanded in a around 0
Applied rewrites17.9%
if -1.25000000000000003e63 < b < 4.5000000000000001e-20Initial program 95.1%
Taylor expanded in z around 0
lower--.f64N/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f6473.8
Applied rewrites73.8%
Taylor expanded in b around 0
lower--.f64N/A
lower-*.f64N/A
lift--.f6442.5
Applied rewrites42.5%
Taylor expanded in t around inf
lower-*.f6433.3
Applied rewrites33.3%
if 4.5000000000000001e-20 < b Initial program 95.1%
Taylor expanded in t around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6468.8
Applied rewrites68.8%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-fma.f64N/A
lift--.f6446.6
Applied rewrites46.6%
Taylor expanded in b around 0
lower-+.f6424.3
Applied rewrites24.3%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6424.2
Applied rewrites24.2%
(FPCore (x y z t a b) :precision binary64 (if (<= b -0.44) (* b t) (if (<= b 1.8e-142) (+ a x) (if (<= b 1.25e-21) (+ z x) (* (- y 2.0) b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -0.44) {
tmp = b * t;
} else if (b <= 1.8e-142) {
tmp = a + x;
} else if (b <= 1.25e-21) {
tmp = z + x;
} else {
tmp = (y - 2.0) * b;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
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 (b <= (-0.44d0)) then
tmp = b * t
else if (b <= 1.8d-142) then
tmp = a + x
else if (b <= 1.25d-21) then
tmp = z + x
else
tmp = (y - 2.0d0) * b
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 (b <= -0.44) {
tmp = b * t;
} else if (b <= 1.8e-142) {
tmp = a + x;
} else if (b <= 1.25e-21) {
tmp = z + x;
} else {
tmp = (y - 2.0) * b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if b <= -0.44: tmp = b * t elif b <= 1.8e-142: tmp = a + x elif b <= 1.25e-21: tmp = z + x else: tmp = (y - 2.0) * b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -0.44) tmp = Float64(b * t); elseif (b <= 1.8e-142) tmp = Float64(a + x); elseif (b <= 1.25e-21) tmp = Float64(z + x); else tmp = Float64(Float64(y - 2.0) * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (b <= -0.44) tmp = b * t; elseif (b <= 1.8e-142) tmp = a + x; elseif (b <= 1.25e-21) tmp = z + x; else tmp = (y - 2.0) * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -0.44], N[(b * t), $MachinePrecision], If[LessEqual[b, 1.8e-142], N[(a + x), $MachinePrecision], If[LessEqual[b, 1.25e-21], N[(z + x), $MachinePrecision], N[(N[(y - 2.0), $MachinePrecision] * b), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.44:\\
\;\;\;\;b \cdot t\\
\mathbf{elif}\;b \leq 1.8 \cdot 10^{-142}:\\
\;\;\;\;a + x\\
\mathbf{elif}\;b \leq 1.25 \cdot 10^{-21}:\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;\left(y - 2\right) \cdot b\\
\end{array}
\end{array}
if b < -0.440000000000000002Initial program 95.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6433.8
Applied rewrites33.8%
Taylor expanded in a around 0
Applied rewrites17.9%
if -0.440000000000000002 < b < 1.8e-142Initial program 95.1%
Taylor expanded in t around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6468.8
Applied rewrites68.8%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-fma.f64N/A
lift--.f6446.6
Applied rewrites46.6%
Taylor expanded in b around 0
lower-+.f6424.3
Applied rewrites24.3%
if 1.8e-142 < b < 1.24999999999999993e-21Initial program 95.1%
Taylor expanded in a around 0
lower--.f64N/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f6472.8
Applied rewrites72.8%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6445.4
Applied rewrites45.4%
Taylor expanded in b around 0
+-commutativeN/A
lower-+.f6423.7
Applied rewrites23.7%
if 1.24999999999999993e-21 < b Initial program 95.1%
Taylor expanded in t around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6468.8
Applied rewrites68.8%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-fma.f64N/A
lift--.f6446.6
Applied rewrites46.6%
Taylor expanded in b around 0
lower-+.f6424.3
Applied rewrites24.3%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6424.2
Applied rewrites24.2%
(FPCore (x y z t a b) :precision binary64 (if (<= b -0.44) (* b t) (if (<= b 1.8e-142) (+ a x) (if (<= b 3.6e+45) (+ z x) (* b t)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -0.44) {
tmp = b * t;
} else if (b <= 1.8e-142) {
tmp = a + x;
} else if (b <= 3.6e+45) {
tmp = z + x;
} else {
tmp = b * t;
}
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 (b <= (-0.44d0)) then
tmp = b * t
else if (b <= 1.8d-142) then
tmp = a + x
else if (b <= 3.6d+45) then
tmp = z + x
else
tmp = b * t
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 (b <= -0.44) {
tmp = b * t;
} else if (b <= 1.8e-142) {
tmp = a + x;
} else if (b <= 3.6e+45) {
tmp = z + x;
} else {
tmp = b * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if b <= -0.44: tmp = b * t elif b <= 1.8e-142: tmp = a + x elif b <= 3.6e+45: tmp = z + x else: tmp = b * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -0.44) tmp = Float64(b * t); elseif (b <= 1.8e-142) tmp = Float64(a + x); elseif (b <= 3.6e+45) tmp = Float64(z + x); else tmp = Float64(b * t); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (b <= -0.44) tmp = b * t; elseif (b <= 1.8e-142) tmp = a + x; elseif (b <= 3.6e+45) tmp = z + x; else tmp = b * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -0.44], N[(b * t), $MachinePrecision], If[LessEqual[b, 1.8e-142], N[(a + x), $MachinePrecision], If[LessEqual[b, 3.6e+45], N[(z + x), $MachinePrecision], N[(b * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.44:\\
\;\;\;\;b \cdot t\\
\mathbf{elif}\;b \leq 1.8 \cdot 10^{-142}:\\
\;\;\;\;a + x\\
\mathbf{elif}\;b \leq 3.6 \cdot 10^{+45}:\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;b \cdot t\\
\end{array}
\end{array}
if b < -0.440000000000000002 or 3.6e45 < b Initial program 95.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6433.8
Applied rewrites33.8%
Taylor expanded in a around 0
Applied rewrites17.9%
if -0.440000000000000002 < b < 1.8e-142Initial program 95.1%
Taylor expanded in t around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6468.8
Applied rewrites68.8%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-fma.f64N/A
lift--.f6446.6
Applied rewrites46.6%
Taylor expanded in b around 0
lower-+.f6424.3
Applied rewrites24.3%
if 1.8e-142 < b < 3.6e45Initial program 95.1%
Taylor expanded in a around 0
lower--.f64N/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f6472.8
Applied rewrites72.8%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6445.4
Applied rewrites45.4%
Taylor expanded in b around 0
+-commutativeN/A
lower-+.f6423.7
Applied rewrites23.7%
(FPCore (x y z t a b) :precision binary64 (if (<= z -7.5e-50) (+ z x) (if (<= z 1.8e+141) (+ a x) (+ z x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -7.5e-50) {
tmp = z + x;
} else if (z <= 1.8e+141) {
tmp = a + x;
} else {
tmp = z + x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
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 (z <= (-7.5d-50)) then
tmp = z + x
else if (z <= 1.8d+141) then
tmp = a + x
else
tmp = z + x
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 (z <= -7.5e-50) {
tmp = z + x;
} else if (z <= 1.8e+141) {
tmp = a + x;
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -7.5e-50: tmp = z + x elif z <= 1.8e+141: tmp = a + x else: tmp = z + x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -7.5e-50) tmp = Float64(z + x); elseif (z <= 1.8e+141) tmp = Float64(a + x); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -7.5e-50) tmp = z + x; elseif (z <= 1.8e+141) tmp = a + x; else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -7.5e-50], N[(z + x), $MachinePrecision], If[LessEqual[z, 1.8e+141], N[(a + x), $MachinePrecision], N[(z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{-50}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{+141}:\\
\;\;\;\;a + x\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if z < -7.5e-50 or 1.8000000000000001e141 < z Initial program 95.1%
Taylor expanded in a around 0
lower--.f64N/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f6472.8
Applied rewrites72.8%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6445.4
Applied rewrites45.4%
Taylor expanded in b around 0
+-commutativeN/A
lower-+.f6423.7
Applied rewrites23.7%
if -7.5e-50 < z < 1.8000000000000001e141Initial program 95.1%
Taylor expanded in t around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6468.8
Applied rewrites68.8%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-fma.f64N/A
lift--.f6446.6
Applied rewrites46.6%
Taylor expanded in b around 0
lower-+.f6424.3
Applied rewrites24.3%
(FPCore (x y z t a b) :precision binary64 (if (<= z -1.8e+194) z (if (<= z 1.8e+141) (+ a x) z)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1.8e+194) {
tmp = z;
} else if (z <= 1.8e+141) {
tmp = a + x;
} 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 (z <= (-1.8d+194)) then
tmp = z
else if (z <= 1.8d+141) then
tmp = a + x
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 (z <= -1.8e+194) {
tmp = z;
} else if (z <= 1.8e+141) {
tmp = a + x;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -1.8e+194: tmp = z elif z <= 1.8e+141: tmp = a + x else: tmp = z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -1.8e+194) tmp = z; elseif (z <= 1.8e+141) tmp = Float64(a + x); else tmp = z; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -1.8e+194) tmp = z; elseif (z <= 1.8e+141) tmp = a + x; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1.8e+194], z, If[LessEqual[z, 1.8e+141], N[(a + x), $MachinePrecision], z]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{+194}:\\
\;\;\;\;z\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{+141}:\\
\;\;\;\;a + x\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if z < -1.8e194 or 1.8000000000000001e141 < z Initial program 95.1%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6427.9
Applied rewrites27.9%
Taylor expanded in y around 0
Applied rewrites10.6%
if -1.8e194 < z < 1.8000000000000001e141Initial program 95.1%
Taylor expanded in t around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6468.8
Applied rewrites68.8%
Taylor expanded in z around 0
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-fma.f64N/A
lift--.f6446.6
Applied rewrites46.6%
Taylor expanded in b around 0
lower-+.f6424.3
Applied rewrites24.3%
(FPCore (x y z t a b) :precision binary64 (if (<= z -7e-50) z (if (<= z 1.2e+141) a z)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -7e-50) {
tmp = z;
} else if (z <= 1.2e+141) {
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 (z <= (-7d-50)) then
tmp = z
else if (z <= 1.2d+141) 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 (z <= -7e-50) {
tmp = z;
} else if (z <= 1.2e+141) {
tmp = a;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -7e-50: tmp = z elif z <= 1.2e+141: tmp = a else: tmp = z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -7e-50) tmp = z; elseif (z <= 1.2e+141) tmp = a; else tmp = z; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -7e-50) tmp = z; elseif (z <= 1.2e+141) tmp = a; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -7e-50], z, If[LessEqual[z, 1.2e+141], a, z]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7 \cdot 10^{-50}:\\
\;\;\;\;z\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{+141}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if z < -6.99999999999999993e-50 or 1.19999999999999999e141 < z Initial program 95.1%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6427.9
Applied rewrites27.9%
Taylor expanded in y around 0
Applied rewrites10.6%
if -6.99999999999999993e-50 < z < 1.19999999999999999e141Initial program 95.1%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6429.3
Applied rewrites29.3%
Taylor expanded in t around 0
Applied rewrites11.2%
(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 95.1%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6429.3
Applied rewrites29.3%
Taylor expanded in t around 0
Applied rewrites11.2%
herbie shell --seed 2025142
(FPCore (x y z t a b)
:name "Statistics.Distribution.Beta:$centropy from math-functions-0.1.5.2"
:precision binary64
(+ (- (- x (* (- y 1.0) z)) (* (- t 1.0) a)) (* (- (+ y t) 2.0) b)))