
(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 18 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 (* (- y 1.0) z)) (t_2 (- (+ t y) 2.0)))
(if (<= (+ (- (- x t_1) (* (- t 1.0) a)) (* (- (+ y t) 2.0) b)) INFINITY)
(fma t_2 b (- x (fma (- t 1.0) a t_1)))
(* t_2 b))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (y - 1.0) * z;
double t_2 = (t + y) - 2.0;
double tmp;
if ((((x - t_1) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b)) <= ((double) INFINITY)) {
tmp = fma(t_2, b, (x - fma((t - 1.0), a, t_1)));
} else {
tmp = t_2 * b;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(y - 1.0) * z) t_2 = Float64(Float64(t + y) - 2.0) tmp = 0.0 if (Float64(Float64(Float64(x - t_1) - Float64(Float64(t - 1.0) * a)) + Float64(Float64(Float64(y + t) - 2.0) * b)) <= Inf) tmp = fma(t_2, b, Float64(x - fma(Float64(t - 1.0), a, t_1))); else tmp = Float64(t_2 * b); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision]}, If[LessEqual[N[(N[(N[(x - t$95$1), $MachinePrecision] - N[(N[(t - 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], Infinity], N[(t$95$2 * b + N[(x - N[(N[(t - 1.0), $MachinePrecision] * a + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 * b), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - 1\right) \cdot z\\
t_2 := \left(t + y\right) - 2\\
\mathbf{if}\;\left(\left(x - t\_1\right) - \left(t - 1\right) \cdot a\right) + \left(\left(y + t\right) - 2\right) \cdot b \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(t\_2, b, x - \mathsf{fma}\left(t - 1, a, t\_1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2 \cdot b\\
\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 100.0%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate--l-N/A
*-commutativeN/A
*-commutativeN/A
Applied rewrites100.0%
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 0.0%
Taylor expanded in b around inf
*-commutativeN/A
+-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f6450.1
lift-+.f64N/A
+-commutativeN/A
lower-+.f6450.1
Applied rewrites50.1%
(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))
(* b t)
(if (<= t_1 5e+307) (- x (- z)) (* b 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 = b * t;
} else if (t_1 <= 5e+307) {
tmp = x - -z;
} else {
tmp = b * 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 = b * t;
} else if (t_1 <= 5e+307) {
tmp = x - -z;
} else {
tmp = b * 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 = b * t elif t_1 <= 5e+307: tmp = x - -z else: tmp = b * 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 <= Float64(-Inf)) tmp = Float64(b * t); elseif (t_1 <= 5e+307) tmp = Float64(x - Float64(-z)); else tmp = Float64(b * 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 = b * t; elseif (t_1 <= 5e+307) tmp = x - -z; else tmp = b * 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)], N[(b * t), $MachinePrecision], If[LessEqual[t$95$1, 5e+307], N[(x - (-z)), $MachinePrecision], N[(b * 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:\\
\;\;\;\;b \cdot t\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+307}:\\
\;\;\;\;x - \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;b \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.0 or 5e307 < (+.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 86.8%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6455.6
Applied rewrites55.6%
Taylor expanded in a around 0
Applied rewrites30.7%
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)) < 5e307Initial program 100.0%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f64100.0
Applied rewrites100.0%
Taylor expanded in x around inf
Applied rewrites61.1%
Taylor expanded in z around inf
mul-1-negN/A
lift-neg.f6437.0
Applied rewrites37.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma (- (+ t y) 2.0) b (* (- 1.0 y) z))))
(if (<= b -0.068)
t_1
(if (<= b 2400000000000.0)
(- x (fma (- t 1.0) a (* (- y 1.0) z)))
(if (<= b 1.85e+166) t_1 (+ x (* (- (+ y t) 2.0) b)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(((t + y) - 2.0), b, ((1.0 - y) * z));
double tmp;
if (b <= -0.068) {
tmp = t_1;
} else if (b <= 2400000000000.0) {
tmp = x - fma((t - 1.0), a, ((y - 1.0) * z));
} else if (b <= 1.85e+166) {
tmp = t_1;
} else {
tmp = x + (((y + t) - 2.0) * b);
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(Float64(Float64(t + y) - 2.0), b, Float64(Float64(1.0 - y) * z)) tmp = 0.0 if (b <= -0.068) tmp = t_1; elseif (b <= 2400000000000.0) tmp = Float64(x - fma(Float64(t - 1.0), a, Float64(Float64(y - 1.0) * z))); elseif (b <= 1.85e+166) tmp = t_1; else tmp = Float64(x + 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[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -0.068], t$95$1, If[LessEqual[b, 2400000000000.0], N[(x - N[(N[(t - 1.0), $MachinePrecision] * a + N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.85e+166], t$95$1, N[(x + N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\left(t + y\right) - 2, b, \left(1 - y\right) \cdot z\right)\\
\mathbf{if}\;b \leq -0.068:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 2400000000000:\\
\;\;\;\;x - \mathsf{fma}\left(t - 1, a, \left(y - 1\right) \cdot z\right)\\
\mathbf{elif}\;b \leq 1.85 \cdot 10^{+166}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x + \left(\left(y + t\right) - 2\right) \cdot b\\
\end{array}
\end{array}
if b < -0.068000000000000005 or 2.4e12 < b < 1.85000000000000011e166Initial program 91.3%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate--l-N/A
*-commutativeN/A
*-commutativeN/A
Applied rewrites96.0%
Taylor expanded in z around inf
+-commutativeN/A
associate--l-N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6473.7
Applied rewrites73.7%
if -0.068000000000000005 < b < 2.4e12Initial program 99.2%
Taylor expanded in b around 0
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift--.f6491.3
Applied rewrites91.3%
if 1.85000000000000011e166 < b Initial program 89.3%
Taylor expanded in x around inf
Applied rewrites89.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b a) t)))
(if (<= t -4.3e-22)
t_1
(if (<= t 2.3e-101)
(* (- b z) y)
(if (<= t 3.1e-5)
(- x (- z))
(if (<= t 2.4e+53) (* (- 1.0 y) z) 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 <= -4.3e-22) {
tmp = t_1;
} else if (t <= 2.3e-101) {
tmp = (b - z) * y;
} else if (t <= 3.1e-5) {
tmp = x - -z;
} else if (t <= 2.4e+53) {
tmp = (1.0 - y) * z;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = (b - a) * t
if (t <= (-4.3d-22)) then
tmp = t_1
else if (t <= 2.3d-101) then
tmp = (b - z) * y
else if (t <= 3.1d-5) then
tmp = x - -z
else if (t <= 2.4d+53) then
tmp = (1.0d0 - y) * z
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (b - a) * t;
double tmp;
if (t <= -4.3e-22) {
tmp = t_1;
} else if (t <= 2.3e-101) {
tmp = (b - z) * y;
} else if (t <= 3.1e-5) {
tmp = x - -z;
} else if (t <= 2.4e+53) {
tmp = (1.0 - y) * z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (b - a) * t tmp = 0 if t <= -4.3e-22: tmp = t_1 elif t <= 2.3e-101: tmp = (b - z) * y elif t <= 3.1e-5: tmp = x - -z elif t <= 2.4e+53: tmp = (1.0 - y) * z 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 <= -4.3e-22) tmp = t_1; elseif (t <= 2.3e-101) tmp = Float64(Float64(b - z) * y); elseif (t <= 3.1e-5) tmp = Float64(x - Float64(-z)); elseif (t <= 2.4e+53) tmp = Float64(Float64(1.0 - y) * z); 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 <= -4.3e-22) tmp = t_1; elseif (t <= 2.3e-101) tmp = (b - z) * y; elseif (t <= 3.1e-5) tmp = x - -z; elseif (t <= 2.4e+53) tmp = (1.0 - y) * z; 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, -4.3e-22], t$95$1, If[LessEqual[t, 2.3e-101], N[(N[(b - z), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t, 3.1e-5], N[(x - (-z)), $MachinePrecision], If[LessEqual[t, 2.4e+53], N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(b - a\right) \cdot t\\
\mathbf{if}\;t \leq -4.3 \cdot 10^{-22}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.3 \cdot 10^{-101}:\\
\;\;\;\;\left(b - z\right) \cdot y\\
\mathbf{elif}\;t \leq 3.1 \cdot 10^{-5}:\\
\;\;\;\;x - \left(-z\right)\\
\mathbf{elif}\;t \leq 2.4 \cdot 10^{+53}:\\
\;\;\;\;\left(1 - y\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -4.30000000000000037e-22 or 2.4e53 < t Initial program 92.4%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6463.7
Applied rewrites63.7%
if -4.30000000000000037e-22 < t < 2.2999999999999999e-101Initial program 97.4%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6439.8
Applied rewrites39.8%
if 2.2999999999999999e-101 < t < 3.10000000000000014e-5Initial program 97.7%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f64100.0
Applied rewrites100.0%
Taylor expanded in x around inf
Applied rewrites50.8%
Taylor expanded in z around inf
mul-1-negN/A
lift-neg.f6432.6
Applied rewrites32.6%
if 3.10000000000000014e-5 < t < 2.4e53Initial program 98.2%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6432.1
Applied rewrites32.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- 1.0 y) z)) (t_2 (* (- b a) t)))
(if (<= t -4.3e-22)
t_2
(if (<= t 3.7e-261)
t_1
(if (<= t 3.1e-5) (- x (- z)) (if (<= t 2.4e+53) t_1 t_2))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (1.0 - y) * z;
double t_2 = (b - a) * t;
double tmp;
if (t <= -4.3e-22) {
tmp = t_2;
} else if (t <= 3.7e-261) {
tmp = t_1;
} else if (t <= 3.1e-5) {
tmp = x - -z;
} else if (t <= 2.4e+53) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (1.0d0 - y) * z
t_2 = (b - a) * t
if (t <= (-4.3d-22)) then
tmp = t_2
else if (t <= 3.7d-261) then
tmp = t_1
else if (t <= 3.1d-5) then
tmp = x - -z
else if (t <= 2.4d+53) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (1.0 - y) * z;
double t_2 = (b - a) * t;
double tmp;
if (t <= -4.3e-22) {
tmp = t_2;
} else if (t <= 3.7e-261) {
tmp = t_1;
} else if (t <= 3.1e-5) {
tmp = x - -z;
} else if (t <= 2.4e+53) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (1.0 - y) * z t_2 = (b - a) * t tmp = 0 if t <= -4.3e-22: tmp = t_2 elif t <= 3.7e-261: tmp = t_1 elif t <= 3.1e-5: tmp = x - -z elif t <= 2.4e+53: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(1.0 - y) * z) t_2 = Float64(Float64(b - a) * t) tmp = 0.0 if (t <= -4.3e-22) tmp = t_2; elseif (t <= 3.7e-261) tmp = t_1; elseif (t <= 3.1e-5) tmp = Float64(x - Float64(-z)); elseif (t <= 2.4e+53) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (1.0 - y) * z; t_2 = (b - a) * t; tmp = 0.0; if (t <= -4.3e-22) tmp = t_2; elseif (t <= 3.7e-261) tmp = t_1; elseif (t <= 3.1e-5) tmp = x - -z; elseif (t <= 2.4e+53) 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[(1.0 - y), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$2 = N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -4.3e-22], t$95$2, If[LessEqual[t, 3.7e-261], t$95$1, If[LessEqual[t, 3.1e-5], N[(x - (-z)), $MachinePrecision], If[LessEqual[t, 2.4e+53], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(1 - y\right) \cdot z\\
t_2 := \left(b - a\right) \cdot t\\
\mathbf{if}\;t \leq -4.3 \cdot 10^{-22}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq 3.7 \cdot 10^{-261}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.1 \cdot 10^{-5}:\\
\;\;\;\;x - \left(-z\right)\\
\mathbf{elif}\;t \leq 2.4 \cdot 10^{+53}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if t < -4.30000000000000037e-22 or 2.4e53 < t Initial program 92.4%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6463.7
Applied rewrites63.7%
if -4.30000000000000037e-22 < t < 3.7000000000000002e-261 or 3.10000000000000014e-5 < t < 2.4e53Initial program 97.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6433.6
Applied rewrites33.6%
if 3.7000000000000002e-261 < t < 3.10000000000000014e-5Initial program 97.4%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f64100.0
Applied rewrites100.0%
Taylor expanded in x around inf
Applied rewrites50.0%
Taylor expanded in z around inf
mul-1-negN/A
lift-neg.f6431.5
Applied rewrites31.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ x (* (- (+ y t) 2.0) b))))
(if (<= b -3.6e+44)
t_1
(if (<= b 2.06e+64) (- x (fma (- t 1.0) a (* (- y 1.0) z))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (((y + t) - 2.0) * b);
double tmp;
if (b <= -3.6e+44) {
tmp = t_1;
} else if (b <= 2.06e+64) {
tmp = x - fma((t - 1.0), a, ((y - 1.0) * z));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(x + Float64(Float64(Float64(y + t) - 2.0) * b)) tmp = 0.0 if (b <= -3.6e+44) tmp = t_1; elseif (b <= 2.06e+64) tmp = Float64(x - fma(Float64(t - 1.0), a, Float64(Float64(y - 1.0) * z))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -3.6e+44], t$95$1, If[LessEqual[b, 2.06e+64], N[(x - N[(N[(t - 1.0), $MachinePrecision] * a + N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(\left(y + t\right) - 2\right) \cdot b\\
\mathbf{if}\;b \leq -3.6 \cdot 10^{+44}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 2.06 \cdot 10^{+64}:\\
\;\;\;\;x - \mathsf{fma}\left(t - 1, a, \left(y - 1\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -3.6e44 or 2.05999999999999986e64 < b Initial program 89.7%
Taylor expanded in x around inf
Applied rewrites77.6%
if -3.6e44 < b < 2.05999999999999986e64Initial program 99.0%
Taylor expanded in b around 0
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift--.f6488.6
Applied rewrites88.6%
(FPCore (x y z t a b)
:precision binary64
(if (<= t -1.05e+22)
(* (- b a) t)
(if (<= t 3.2e-5)
(- x (- (- a) z))
(if (<= t 2.4e+53) (* (- 1.0 y) z) (fma (- a) t (* b t))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -1.05e+22) {
tmp = (b - a) * t;
} else if (t <= 3.2e-5) {
tmp = x - (-a - z);
} else if (t <= 2.4e+53) {
tmp = (1.0 - y) * z;
} else {
tmp = fma(-a, t, (b * t));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -1.05e+22) tmp = Float64(Float64(b - a) * t); elseif (t <= 3.2e-5) tmp = Float64(x - Float64(Float64(-a) - z)); elseif (t <= 2.4e+53) tmp = Float64(Float64(1.0 - y) * z); else tmp = fma(Float64(-a), t, Float64(b * t)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -1.05e+22], N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[t, 3.2e-5], N[(x - N[((-a) - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.4e+53], N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision], N[((-a) * t + N[(b * t), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.05 \cdot 10^{+22}:\\
\;\;\;\;\left(b - a\right) \cdot t\\
\mathbf{elif}\;t \leq 3.2 \cdot 10^{-5}:\\
\;\;\;\;x - \left(\left(-a\right) - z\right)\\
\mathbf{elif}\;t \leq 2.4 \cdot 10^{+53}:\\
\;\;\;\;\left(1 - y\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-a, t, b \cdot t\right)\\
\end{array}
\end{array}
if t < -1.0499999999999999e22Initial program 92.3%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6464.5
Applied rewrites64.5%
if -1.0499999999999999e22 < t < 3.19999999999999986e-5Initial program 97.5%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f64100.0
Applied rewrites100.0%
Taylor expanded in x around inf
Applied rewrites49.4%
Taylor expanded in t around 0
lower--.f64N/A
mul-1-negN/A
lower-neg.f6448.5
Applied rewrites48.5%
if 3.19999999999999986e-5 < t < 2.4e53Initial program 98.2%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6432.1
Applied rewrites32.1%
if 2.4e53 < t Initial program 91.7%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6470.8
Applied rewrites70.8%
Taylor expanded in a around 0
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-*.f6468.4
Applied rewrites68.4%
(FPCore (x y z t a b)
:precision binary64
(if (<= y -3.2e+16)
(fma y b (- x (* z y)))
(if (<= y 4.9e+89)
(- x (fma (- t 1.0) a (- z)))
(fma (- (+ t y) 2.0) b (* (- y) z)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -3.2e+16) {
tmp = fma(y, b, (x - (z * y)));
} else if (y <= 4.9e+89) {
tmp = x - fma((t - 1.0), a, -z);
} else {
tmp = fma(((t + y) - 2.0), b, (-y * z));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -3.2e+16) tmp = fma(y, b, Float64(x - Float64(z * y))); elseif (y <= 4.9e+89) tmp = Float64(x - fma(Float64(t - 1.0), a, Float64(-z))); else tmp = fma(Float64(Float64(t + y) - 2.0), b, Float64(Float64(-y) * z)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -3.2e+16], N[(y * b + N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.9e+89], N[(x - N[(N[(t - 1.0), $MachinePrecision] * a + (-z)), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + N[((-y) * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.2 \cdot 10^{+16}:\\
\;\;\;\;\mathsf{fma}\left(y, b, x - z \cdot y\right)\\
\mathbf{elif}\;y \leq 4.9 \cdot 10^{+89}:\\
\;\;\;\;x - \mathsf{fma}\left(t - 1, a, -z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(t + y\right) - 2, b, \left(-y\right) \cdot z\right)\\
\end{array}
\end{array}
if y < -3.2e16Initial program 92.4%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate--l-N/A
*-commutativeN/A
*-commutativeN/A
Applied rewrites95.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6479.9
Applied rewrites79.9%
Taylor expanded in y around inf
+-commutative73.8
Applied rewrites73.8%
if -3.2e16 < y < 4.89999999999999996e89Initial program 97.8%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6497.9
Applied rewrites97.9%
Taylor expanded in x around inf
Applied rewrites65.5%
if 4.89999999999999996e89 < y Initial program 89.7%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate--l-N/A
*-commutativeN/A
*-commutativeN/A
Applied rewrites94.8%
Taylor expanded in y around inf
+-commutativeN/A
associate--l-N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6473.5
Applied rewrites73.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b a) t)))
(if (<= t -1.05e+22)
t_1
(if (<= t 3.2e-5)
(- x (- (- a) z))
(if (<= t 2.4e+53) (* (- 1.0 y) z) 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 <= -1.05e+22) {
tmp = t_1;
} else if (t <= 3.2e-5) {
tmp = x - (-a - z);
} else if (t <= 2.4e+53) {
tmp = (1.0 - y) * z;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = (b - a) * t
if (t <= (-1.05d+22)) then
tmp = t_1
else if (t <= 3.2d-5) then
tmp = x - (-a - z)
else if (t <= 2.4d+53) then
tmp = (1.0d0 - y) * z
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (b - a) * t;
double tmp;
if (t <= -1.05e+22) {
tmp = t_1;
} else if (t <= 3.2e-5) {
tmp = x - (-a - z);
} else if (t <= 2.4e+53) {
tmp = (1.0 - y) * z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (b - a) * t tmp = 0 if t <= -1.05e+22: tmp = t_1 elif t <= 3.2e-5: tmp = x - (-a - z) elif t <= 2.4e+53: tmp = (1.0 - y) * z 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 <= -1.05e+22) tmp = t_1; elseif (t <= 3.2e-5) tmp = Float64(x - Float64(Float64(-a) - z)); elseif (t <= 2.4e+53) tmp = Float64(Float64(1.0 - y) * z); 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 <= -1.05e+22) tmp = t_1; elseif (t <= 3.2e-5) tmp = x - (-a - z); elseif (t <= 2.4e+53) tmp = (1.0 - y) * z; 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, -1.05e+22], t$95$1, If[LessEqual[t, 3.2e-5], N[(x - N[((-a) - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.4e+53], N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(b - a\right) \cdot t\\
\mathbf{if}\;t \leq -1.05 \cdot 10^{+22}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.2 \cdot 10^{-5}:\\
\;\;\;\;x - \left(\left(-a\right) - z\right)\\
\mathbf{elif}\;t \leq 2.4 \cdot 10^{+53}:\\
\;\;\;\;\left(1 - y\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.0499999999999999e22 or 2.4e53 < t Initial program 92.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6467.5
Applied rewrites67.5%
if -1.0499999999999999e22 < t < 3.19999999999999986e-5Initial program 97.5%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f64100.0
Applied rewrites100.0%
Taylor expanded in x around inf
Applied rewrites49.4%
Taylor expanded in t around 0
lower--.f64N/A
mul-1-negN/A
lower-neg.f6448.5
Applied rewrites48.5%
if 3.19999999999999986e-5 < t < 2.4e53Initial program 98.2%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6432.1
Applied rewrites32.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma (- a) t a)))
(if (<= a -1750.0)
t_1
(if (<= a -1.22e-104) (* (- z) y) (if (<= a 0.072) (- x (- z)) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(-a, t, a);
double tmp;
if (a <= -1750.0) {
tmp = t_1;
} else if (a <= -1.22e-104) {
tmp = -z * y;
} else if (a <= 0.072) {
tmp = x - -z;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(Float64(-a), t, a) tmp = 0.0 if (a <= -1750.0) tmp = t_1; elseif (a <= -1.22e-104) tmp = Float64(Float64(-z) * y); elseif (a <= 0.072) tmp = Float64(x - Float64(-z)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[((-a) * t + a), $MachinePrecision]}, If[LessEqual[a, -1750.0], t$95$1, If[LessEqual[a, -1.22e-104], N[((-z) * y), $MachinePrecision], If[LessEqual[a, 0.072], N[(x - (-z)), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-a, t, a\right)\\
\mathbf{if}\;a \leq -1750:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq -1.22 \cdot 10^{-104}:\\
\;\;\;\;\left(-z\right) \cdot y\\
\mathbf{elif}\;a \leq 0.072:\\
\;\;\;\;x - \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1750 or 0.0719999999999999946 < a Initial program 92.5%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6450.0
Applied rewrites50.0%
Taylor expanded in t around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6450.0
Applied rewrites50.0%
if -1750 < a < -1.21999999999999997e-104Initial program 97.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6437.0
Applied rewrites37.0%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6420.6
Applied rewrites20.6%
if -1.21999999999999997e-104 < a < 0.0719999999999999946Initial program 97.6%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6499.1
Applied rewrites99.1%
Taylor expanded in x around inf
Applied rewrites36.2%
Taylor expanded in z around inf
mul-1-negN/A
lift-neg.f6432.9
Applied rewrites32.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma y b (- x (* z y)))))
(if (<= y -3.2e+16)
t_1
(if (<= y 7.8e+46) (- x (fma (- t 1.0) a (- z))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(y, b, (x - (z * y)));
double tmp;
if (y <= -3.2e+16) {
tmp = t_1;
} else if (y <= 7.8e+46) {
tmp = x - fma((t - 1.0), a, -z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(y, b, Float64(x - Float64(z * y))) tmp = 0.0 if (y <= -3.2e+16) tmp = t_1; elseif (y <= 7.8e+46) tmp = Float64(x - fma(Float64(t - 1.0), a, Float64(-z))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(y * b + N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.2e+16], t$95$1, If[LessEqual[y, 7.8e+46], N[(x - N[(N[(t - 1.0), $MachinePrecision] * a + (-z)), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, b, x - z \cdot y\right)\\
\mathbf{if}\;y \leq -3.2 \cdot 10^{+16}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 7.8 \cdot 10^{+46}:\\
\;\;\;\;x - \mathsf{fma}\left(t - 1, a, -z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.2e16 or 7.7999999999999999e46 < y Initial program 91.5%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate--l-N/A
*-commutativeN/A
*-commutativeN/A
Applied rewrites95.5%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6479.8
Applied rewrites79.8%
Taylor expanded in y around inf
+-commutative74.0
Applied rewrites74.0%
if -3.2e16 < y < 7.7999999999999999e46Initial program 98.0%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6498.0
Applied rewrites98.0%
Taylor expanded in x around inf
Applied rewrites67.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ x (* (- (+ y t) 2.0) b))))
(if (<= b -3.6e+44)
t_1
(if (<= b 3.6e+59) (- x (fma (- t 1.0) a (- z))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (((y + t) - 2.0) * b);
double tmp;
if (b <= -3.6e+44) {
tmp = t_1;
} else if (b <= 3.6e+59) {
tmp = x - fma((t - 1.0), a, -z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(x + Float64(Float64(Float64(y + t) - 2.0) * b)) tmp = 0.0 if (b <= -3.6e+44) tmp = t_1; elseif (b <= 3.6e+59) tmp = Float64(x - fma(Float64(t - 1.0), a, Float64(-z))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -3.6e+44], t$95$1, If[LessEqual[b, 3.6e+59], N[(x - N[(N[(t - 1.0), $MachinePrecision] * a + (-z)), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(\left(y + t\right) - 2\right) \cdot b\\
\mathbf{if}\;b \leq -3.6 \cdot 10^{+44}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 3.6 \cdot 10^{+59}:\\
\;\;\;\;x - \mathsf{fma}\left(t - 1, a, -z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -3.6e44 or 3.5999999999999999e59 < b Initial program 89.8%
Taylor expanded in x around inf
Applied rewrites77.5%
if -3.6e44 < b < 3.5999999999999999e59Initial program 99.0%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6499.1
Applied rewrites99.1%
Taylor expanded in x around inf
Applied rewrites67.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b z) y)))
(if (<= y -1.95e+43)
t_1
(if (<= y 7e+89) (- x (fma (- t 1.0) a (- z))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (b - z) * y;
double tmp;
if (y <= -1.95e+43) {
tmp = t_1;
} else if (y <= 7e+89) {
tmp = x - fma((t - 1.0), a, -z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(b - z) * y) tmp = 0.0 if (y <= -1.95e+43) tmp = t_1; elseif (y <= 7e+89) tmp = Float64(x - fma(Float64(t - 1.0), a, Float64(-z))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b - z), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -1.95e+43], t$95$1, If[LessEqual[y, 7e+89], N[(x - N[(N[(t - 1.0), $MachinePrecision] * a + (-z)), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(b - z\right) \cdot y\\
\mathbf{if}\;y \leq -1.95 \cdot 10^{+43}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 7 \cdot 10^{+89}:\\
\;\;\;\;x - \mathsf{fma}\left(t - 1, a, -z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.95e43 or 7.0000000000000001e89 < y Initial program 90.9%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6470.6
Applied rewrites70.6%
if -1.95e43 < y < 7.0000000000000001e89Initial program 97.8%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6497.9
Applied rewrites97.9%
Taylor expanded in x around inf
Applied rewrites65.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- a) t)))
(if (<= t -5.5e+27)
t_1
(if (<= t 1.05e+91) (- x (- z)) (if (<= t 1.3e+200) t_1 (* b t))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = -a * t;
double tmp;
if (t <= -5.5e+27) {
tmp = t_1;
} else if (t <= 1.05e+91) {
tmp = x - -z;
} else if (t <= 1.3e+200) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = -a * t
if (t <= (-5.5d+27)) then
tmp = t_1
else if (t <= 1.05d+91) then
tmp = x - -z
else if (t <= 1.3d+200) then
tmp = t_1
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 t_1 = -a * t;
double tmp;
if (t <= -5.5e+27) {
tmp = t_1;
} else if (t <= 1.05e+91) {
tmp = x - -z;
} else if (t <= 1.3e+200) {
tmp = t_1;
} else {
tmp = b * t;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = -a * t tmp = 0 if t <= -5.5e+27: tmp = t_1 elif t <= 1.05e+91: tmp = x - -z elif t <= 1.3e+200: tmp = t_1 else: tmp = b * t return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(-a) * t) tmp = 0.0 if (t <= -5.5e+27) tmp = t_1; elseif (t <= 1.05e+91) tmp = Float64(x - Float64(-z)); elseif (t <= 1.3e+200) tmp = t_1; else tmp = Float64(b * t); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = -a * t; tmp = 0.0; if (t <= -5.5e+27) tmp = t_1; elseif (t <= 1.05e+91) tmp = x - -z; elseif (t <= 1.3e+200) tmp = t_1; else tmp = b * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[((-a) * t), $MachinePrecision]}, If[LessEqual[t, -5.5e+27], t$95$1, If[LessEqual[t, 1.05e+91], N[(x - (-z)), $MachinePrecision], If[LessEqual[t, 1.3e+200], t$95$1, N[(b * t), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-a\right) \cdot t\\
\mathbf{if}\;t \leq -5.5 \cdot 10^{+27}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.05 \cdot 10^{+91}:\\
\;\;\;\;x - \left(-z\right)\\
\mathbf{elif}\;t \leq 1.3 \cdot 10^{+200}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;b \cdot t\\
\end{array}
\end{array}
if t < -5.49999999999999966e27 or 1.05000000000000004e91 < t < 1.3000000000000001e200Initial program 92.4%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6465.0
Applied rewrites65.0%
Taylor expanded in a around inf
mul-1-negN/A
lower-neg.f6437.5
Applied rewrites37.5%
if -5.49999999999999966e27 < t < 1.05000000000000004e91Initial program 97.6%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6499.6
Applied rewrites99.6%
Taylor expanded in x around inf
Applied rewrites49.2%
Taylor expanded in z around inf
mul-1-negN/A
lift-neg.f6430.7
Applied rewrites30.7%
if 1.3000000000000001e200 < t Initial program 88.3%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6483.4
Applied rewrites83.4%
Taylor expanded in a around 0
Applied rewrites43.9%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (- 1.0 y) z))) (if (<= z -4.3e-24) t_1 (if (<= z 6.5e+118) (fma (- a) t a) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (1.0 - y) * z;
double tmp;
if (z <= -4.3e-24) {
tmp = t_1;
} else if (z <= 6.5e+118) {
tmp = fma(-a, t, a);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(1.0 - y) * z) tmp = 0.0 if (z <= -4.3e-24) tmp = t_1; elseif (z <= 6.5e+118) tmp = fma(Float64(-a), t, a); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -4.3e-24], t$95$1, If[LessEqual[z, 6.5e+118], N[((-a) * t + a), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(1 - y\right) \cdot z\\
\mathbf{if}\;z \leq -4.3 \cdot 10^{-24}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{+118}:\\
\;\;\;\;\mathsf{fma}\left(-a, t, a\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -4.3000000000000003e-24 or 6.5e118 < z Initial program 91.5%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6452.8
Applied rewrites52.8%
if -4.3000000000000003e-24 < z < 6.5e118Initial program 97.7%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6433.6
Applied rewrites33.6%
Taylor expanded in t around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6433.6
Applied rewrites33.6%
(FPCore (x y z t a b) :precision binary64 (if (<= b -2.9e-16) (* b t) (if (<= b 4.4e+22) x (* b t))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -2.9e-16) {
tmp = b * t;
} else if (b <= 4.4e+22) {
tmp = 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 <= (-2.9d-16)) then
tmp = b * t
else if (b <= 4.4d+22) then
tmp = 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 <= -2.9e-16) {
tmp = b * t;
} else if (b <= 4.4e+22) {
tmp = x;
} else {
tmp = b * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if b <= -2.9e-16: tmp = b * t elif b <= 4.4e+22: tmp = x else: tmp = b * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -2.9e-16) tmp = Float64(b * t); elseif (b <= 4.4e+22) tmp = 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 <= -2.9e-16) tmp = b * t; elseif (b <= 4.4e+22) tmp = x; else tmp = b * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -2.9e-16], N[(b * t), $MachinePrecision], If[LessEqual[b, 4.4e+22], x, N[(b * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.9 \cdot 10^{-16}:\\
\;\;\;\;b \cdot t\\
\mathbf{elif}\;b \leq 4.4 \cdot 10^{+22}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;b \cdot t\\
\end{array}
\end{array}
if b < -2.8999999999999998e-16 or 4.4e22 < b Initial program 90.9%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6438.4
Applied rewrites38.4%
Taylor expanded in a around 0
Applied rewrites30.8%
if -2.8999999999999998e-16 < b < 4.4e22Initial program 99.2%
Taylor expanded in x around inf
Applied rewrites22.0%
(FPCore (x y z t a b) :precision binary64 (if (<= a -4.1e+136) a x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -4.1e+136) {
tmp = a;
} else {
tmp = 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 (a <= (-4.1d+136)) then
tmp = a
else
tmp = 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 (a <= -4.1e+136) {
tmp = a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= -4.1e+136: tmp = a else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -4.1e+136) tmp = a; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (a <= -4.1e+136) tmp = a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -4.1e+136], a, x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.1 \cdot 10^{+136}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -4.0999999999999998e136Initial program 89.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6464.8
Applied rewrites64.8%
Taylor expanded in t around 0
Applied rewrites23.4%
if -4.0999999999999998e136 < a Initial program 96.0%
Taylor expanded in x around inf
Applied rewrites16.7%
(FPCore (x y z t a b) :precision binary64 x)
double code(double x, double y, double z, double t, double a, double b) {
return x;
}
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
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x;
}
def code(x, y, z, t, a, b): return x
function code(x, y, z, t, a, b) return x end
function tmp = code(x, y, z, t, a, b) tmp = x; end
code[x_, y_, z_, t_, a_, b_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 95.1%
Taylor expanded in x around inf
Applied rewrites15.4%
herbie shell --seed 2025093
(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)))