
(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}
Sampling outcomes in binary64 precision:
Herbie found 21 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 (fma (- 1.0 t) a (fma (- (+ t y) 2.0) b x)))))
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 = fma((1.0 - t), a, fma(((t + y) - 2.0), b, x));
}
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 = fma(Float64(1.0 - t), a, fma(Float64(Float64(t + y) - 2.0), b, x)); end return 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[(1.0 - t), $MachinePrecision] * a + N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + x), $MachinePrecision]), $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}:\\
\;\;\;\;\mathsf{fma}\left(1 - t, a, \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right)\right)\\
\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%
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 z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
associate-+l-N/A
Applied rewrites60.0%
(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 -5e+302) (* b t) (if (<= t_1 5e+305) (+ a x) (* b y)))))
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 <= -5e+302) {
tmp = b * t;
} else if (t_1 <= 5e+305) {
tmp = a + x;
} else {
tmp = b * y;
}
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 = ((x - ((y - 1.0d0) * z)) - ((t - 1.0d0) * a)) + (((y + t) - 2.0d0) * b)
if (t_1 <= (-5d+302)) then
tmp = b * t
else if (t_1 <= 5d+305) then
tmp = a + x
else
tmp = b * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b);
double tmp;
if (t_1 <= -5e+302) {
tmp = b * t;
} else if (t_1 <= 5e+305) {
tmp = a + x;
} else {
tmp = b * y;
}
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 <= -5e+302: tmp = b * t elif t_1 <= 5e+305: tmp = a + x else: tmp = b * y 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 <= -5e+302) tmp = Float64(b * t); elseif (t_1 <= 5e+305) tmp = Float64(a + x); else tmp = Float64(b * y); 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 <= -5e+302) tmp = b * t; elseif (t_1 <= 5e+305) tmp = a + x; else tmp = b * y; 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, -5e+302], N[(b * t), $MachinePrecision], If[LessEqual[t$95$1, 5e+305], N[(a + x), $MachinePrecision], N[(b * y), $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 -5 \cdot 10^{+302}:\\
\;\;\;\;b \cdot t\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+305}:\\
\;\;\;\;a + x\\
\mathbf{else}:\\
\;\;\;\;b \cdot y\\
\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)) < -5e302Initial program 100.0%
Taylor expanded in a around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
lower-fma.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6471.9
Applied rewrites71.9%
Taylor expanded in y around inf
Applied rewrites71.9%
Taylor expanded in t around inf
Applied rewrites37.7%
if -5e302 < (+.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)) < 5.00000000000000009e305Initial program 100.0%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
associate-+l-N/A
Applied rewrites72.0%
Taylor expanded in b around 0
Applied rewrites48.5%
Taylor expanded in t around 0
Applied rewrites37.7%
if 5.00000000000000009e305 < (+.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 74.1%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
associate-+l-N/A
Applied rewrites72.8%
Taylor expanded in y around inf
Applied rewrites40.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- a) t)))
(if (<= t -4e+226)
(* b t)
(if (<= t -6.8)
t_1
(if (<= t -5.6e-303)
(+ a x)
(if (<= t 5e-127) (* b y) (if (<= t 8e+139) (* (- y) z) t_1)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = -a * t;
double tmp;
if (t <= -4e+226) {
tmp = b * t;
} else if (t <= -6.8) {
tmp = t_1;
} else if (t <= -5.6e-303) {
tmp = a + x;
} else if (t <= 5e-127) {
tmp = b * y;
} else if (t <= 8e+139) {
tmp = -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 = -a * t
if (t <= (-4d+226)) then
tmp = b * t
else if (t <= (-6.8d0)) then
tmp = t_1
else if (t <= (-5.6d-303)) then
tmp = a + x
else if (t <= 5d-127) then
tmp = b * y
else if (t <= 8d+139) then
tmp = -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 = -a * t;
double tmp;
if (t <= -4e+226) {
tmp = b * t;
} else if (t <= -6.8) {
tmp = t_1;
} else if (t <= -5.6e-303) {
tmp = a + x;
} else if (t <= 5e-127) {
tmp = b * y;
} else if (t <= 8e+139) {
tmp = -y * z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = -a * t tmp = 0 if t <= -4e+226: tmp = b * t elif t <= -6.8: tmp = t_1 elif t <= -5.6e-303: tmp = a + x elif t <= 5e-127: tmp = b * y elif t <= 8e+139: tmp = -y * z else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(-a) * t) tmp = 0.0 if (t <= -4e+226) tmp = Float64(b * t); elseif (t <= -6.8) tmp = t_1; elseif (t <= -5.6e-303) tmp = Float64(a + x); elseif (t <= 5e-127) tmp = Float64(b * y); elseif (t <= 8e+139) tmp = Float64(Float64(-y) * z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = -a * t; tmp = 0.0; if (t <= -4e+226) tmp = b * t; elseif (t <= -6.8) tmp = t_1; elseif (t <= -5.6e-303) tmp = a + x; elseif (t <= 5e-127) tmp = b * y; elseif (t <= 8e+139) tmp = -y * z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[((-a) * t), $MachinePrecision]}, If[LessEqual[t, -4e+226], N[(b * t), $MachinePrecision], If[LessEqual[t, -6.8], t$95$1, If[LessEqual[t, -5.6e-303], N[(a + x), $MachinePrecision], If[LessEqual[t, 5e-127], N[(b * y), $MachinePrecision], If[LessEqual[t, 8e+139], N[((-y) * z), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-a\right) \cdot t\\
\mathbf{if}\;t \leq -4 \cdot 10^{+226}:\\
\;\;\;\;b \cdot t\\
\mathbf{elif}\;t \leq -6.8:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -5.6 \cdot 10^{-303}:\\
\;\;\;\;a + x\\
\mathbf{elif}\;t \leq 5 \cdot 10^{-127}:\\
\;\;\;\;b \cdot y\\
\mathbf{elif}\;t \leq 8 \cdot 10^{+139}:\\
\;\;\;\;\left(-y\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.99999999999999985e226Initial program 93.8%
Taylor expanded in a around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
lower-fma.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6481.8
Applied rewrites81.8%
Taylor expanded in y around inf
Applied rewrites76.0%
Taylor expanded in t around inf
Applied rewrites63.2%
if -3.99999999999999985e226 < t < -6.79999999999999982 or 8.00000000000000026e139 < t Initial program 91.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6467.4
Applied rewrites67.4%
Taylor expanded in a around inf
Applied rewrites46.2%
if -6.79999999999999982 < t < -5.6e-303Initial program 98.5%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
associate-+l-N/A
Applied rewrites69.1%
Taylor expanded in b around 0
Applied rewrites43.4%
Taylor expanded in t around 0
Applied rewrites43.4%
if -5.6e-303 < t < 4.9999999999999997e-127Initial program 97.2%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
associate-+l-N/A
Applied rewrites78.3%
Taylor expanded in y around inf
Applied rewrites45.9%
if 4.9999999999999997e-127 < t < 8.00000000000000026e139Initial program 92.1%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6443.4
Applied rewrites43.4%
Taylor expanded in y around inf
Applied rewrites35.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma (- z) (- y 1.0) x)) (t_2 (* (- (+ t y) 2.0) b)))
(if (<= b -7.2e+33)
t_2
(if (<= b -2.2e-238)
t_1
(if (<= b 8.5e-193)
(fma (- 1.0 t) a x)
(if (<= b 2.3e+111) t_1 t_2))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(-z, (y - 1.0), x);
double t_2 = ((t + y) - 2.0) * b;
double tmp;
if (b <= -7.2e+33) {
tmp = t_2;
} else if (b <= -2.2e-238) {
tmp = t_1;
} else if (b <= 8.5e-193) {
tmp = fma((1.0 - t), a, x);
} else if (b <= 2.3e+111) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(Float64(-z), Float64(y - 1.0), x) t_2 = Float64(Float64(Float64(t + y) - 2.0) * b) tmp = 0.0 if (b <= -7.2e+33) tmp = t_2; elseif (b <= -2.2e-238) tmp = t_1; elseif (b <= 8.5e-193) tmp = fma(Float64(1.0 - t), a, x); elseif (b <= 2.3e+111) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[((-z) * N[(y - 1.0), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[b, -7.2e+33], t$95$2, If[LessEqual[b, -2.2e-238], t$95$1, If[LessEqual[b, 8.5e-193], N[(N[(1.0 - t), $MachinePrecision] * a + x), $MachinePrecision], If[LessEqual[b, 2.3e+111], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-z, y - 1, x\right)\\
t_2 := \left(\left(t + y\right) - 2\right) \cdot b\\
\mathbf{if}\;b \leq -7.2 \cdot 10^{+33}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;b \leq -2.2 \cdot 10^{-238}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 8.5 \cdot 10^{-193}:\\
\;\;\;\;\mathsf{fma}\left(1 - t, a, x\right)\\
\mathbf{elif}\;b \leq 2.3 \cdot 10^{+111}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if b < -7.2000000000000005e33 or 2.30000000000000002e111 < b Initial program 90.4%
Taylor expanded in a around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
lower-fma.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6482.2
Applied rewrites82.2%
Taylor expanded in y around inf
Applied rewrites80.6%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6479.8
Applied rewrites79.8%
if -7.2000000000000005e33 < b < -2.19999999999999991e-238 or 8.50000000000000004e-193 < b < 2.30000000000000002e111Initial program 94.8%
Taylor expanded in a around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
lower-fma.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6472.8
Applied rewrites72.8%
Taylor expanded in b around 0
Applied rewrites59.4%
if -2.19999999999999991e-238 < b < 8.50000000000000004e-193Initial program 100.0%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
associate-+l-N/A
Applied rewrites74.4%
Taylor expanded in b around 0
Applied rewrites72.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma (- z) (- y 1.0) x)) (t_2 (* (- b a) t)))
(if (<= t -5.4e+100)
t_2
(if (<= t -4.2e-283)
t_1
(if (<= t 1.92e-121) (fma (- y 2.0) b a) (if (<= t 3e+19) t_1 t_2))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(-z, (y - 1.0), x);
double t_2 = (b - a) * t;
double tmp;
if (t <= -5.4e+100) {
tmp = t_2;
} else if (t <= -4.2e-283) {
tmp = t_1;
} else if (t <= 1.92e-121) {
tmp = fma((y - 2.0), b, a);
} else if (t <= 3e+19) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(Float64(-z), Float64(y - 1.0), x) t_2 = Float64(Float64(b - a) * t) tmp = 0.0 if (t <= -5.4e+100) tmp = t_2; elseif (t <= -4.2e-283) tmp = t_1; elseif (t <= 1.92e-121) tmp = fma(Float64(y - 2.0), b, a); elseif (t <= 3e+19) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[((-z) * N[(y - 1.0), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -5.4e+100], t$95$2, If[LessEqual[t, -4.2e-283], t$95$1, If[LessEqual[t, 1.92e-121], N[(N[(y - 2.0), $MachinePrecision] * b + a), $MachinePrecision], If[LessEqual[t, 3e+19], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-z, y - 1, x\right)\\
t_2 := \left(b - a\right) \cdot t\\
\mathbf{if}\;t \leq -5.4 \cdot 10^{+100}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq -4.2 \cdot 10^{-283}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.92 \cdot 10^{-121}:\\
\;\;\;\;\mathsf{fma}\left(y - 2, b, a\right)\\
\mathbf{elif}\;t \leq 3 \cdot 10^{+19}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if t < -5.39999999999999997e100 or 3e19 < t Initial program 91.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6473.2
Applied rewrites73.2%
if -5.39999999999999997e100 < t < -4.19999999999999994e-283 or 1.9199999999999999e-121 < t < 3e19Initial program 96.0%
Taylor expanded in a around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
lower-fma.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6479.5
Applied rewrites79.5%
Taylor expanded in b around 0
Applied rewrites61.0%
if -4.19999999999999994e-283 < t < 1.9199999999999999e-121Initial program 97.7%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
associate-+l-N/A
Applied rewrites80.0%
Taylor expanded in t around 0
Applied rewrites80.0%
Taylor expanded in x around 0
Applied rewrites72.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (- (+ t y) 2.0)))
(if (or (<= z -4.8e+32) (not (<= z 2.45e+95)))
(fma t_1 b (- x (* (- y 1.0) z)))
(fma (- 1.0 t) a (fma t_1 b x)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t + y) - 2.0;
double tmp;
if ((z <= -4.8e+32) || !(z <= 2.45e+95)) {
tmp = fma(t_1, b, (x - ((y - 1.0) * z)));
} else {
tmp = fma((1.0 - t), a, fma(t_1, b, x));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t + y) - 2.0) tmp = 0.0 if ((z <= -4.8e+32) || !(z <= 2.45e+95)) tmp = fma(t_1, b, Float64(x - Float64(Float64(y - 1.0) * z))); else tmp = fma(Float64(1.0 - t), a, fma(t_1, b, x)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision]}, If[Or[LessEqual[z, -4.8e+32], N[Not[LessEqual[z, 2.45e+95]], $MachinePrecision]], N[(t$95$1 * b + N[(x - N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - t), $MachinePrecision] * a + N[(t$95$1 * b + x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t + y\right) - 2\\
\mathbf{if}\;z \leq -4.8 \cdot 10^{+32} \lor \neg \left(z \leq 2.45 \cdot 10^{+95}\right):\\
\;\;\;\;\mathsf{fma}\left(t\_1, b, x - \left(y - 1\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 - t, a, \mathsf{fma}\left(t\_1, b, x\right)\right)\\
\end{array}
\end{array}
if z < -4.79999999999999983e32 or 2.4499999999999999e95 < z Initial program 93.6%
Taylor expanded in a around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
lower-fma.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6485.4
Applied rewrites85.4%
if -4.79999999999999983e32 < z < 2.4499999999999999e95Initial program 94.4%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
associate-+l-N/A
Applied rewrites93.9%
Final simplification90.8%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -8.8e+250)
(* (- 1.0 y) z)
(if (<= z 2.1e+99)
(fma (- 1.0 t) a (fma (- (+ t y) 2.0) b x))
(fma (- z) (- y 1.0) x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -8.8e+250) {
tmp = (1.0 - y) * z;
} else if (z <= 2.1e+99) {
tmp = fma((1.0 - t), a, fma(((t + y) - 2.0), b, x));
} else {
tmp = fma(-z, (y - 1.0), x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -8.8e+250) tmp = Float64(Float64(1.0 - y) * z); elseif (z <= 2.1e+99) tmp = fma(Float64(1.0 - t), a, fma(Float64(Float64(t + y) - 2.0), b, x)); else tmp = fma(Float64(-z), Float64(y - 1.0), x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -8.8e+250], N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[z, 2.1e+99], N[(N[(1.0 - t), $MachinePrecision] * a + N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + x), $MachinePrecision]), $MachinePrecision], N[((-z) * N[(y - 1.0), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.8 \cdot 10^{+250}:\\
\;\;\;\;\left(1 - y\right) \cdot z\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{+99}:\\
\;\;\;\;\mathsf{fma}\left(1 - t, a, \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-z, y - 1, x\right)\\
\end{array}
\end{array}
if z < -8.80000000000000058e250Initial program 100.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6490.0
Applied rewrites90.0%
if -8.80000000000000058e250 < z < 2.1000000000000001e99Initial program 95.0%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
associate-+l-N/A
Applied rewrites88.6%
if 2.1000000000000001e99 < z Initial program 89.1%
Taylor expanded in a around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
lower-fma.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6495.8
Applied rewrites95.8%
Taylor expanded in b around 0
Applied rewrites83.2%
(FPCore (x y z t a b)
:precision binary64
(if (<= y -5e+175)
(* (- b z) y)
(if (<= y 6.6e-9)
(+ (fma (- t 2.0) b z) (fma (- 1.0 t) a x))
(fma (- (+ t y) 2.0) b (- x (* z y))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -5e+175) {
tmp = (b - z) * y;
} else if (y <= 6.6e-9) {
tmp = fma((t - 2.0), b, z) + fma((1.0 - t), a, x);
} else {
tmp = fma(((t + y) - 2.0), b, (x - (z * y)));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -5e+175) tmp = Float64(Float64(b - z) * y); elseif (y <= 6.6e-9) tmp = Float64(fma(Float64(t - 2.0), b, z) + fma(Float64(1.0 - t), a, x)); else tmp = fma(Float64(Float64(t + y) - 2.0), b, Float64(x - Float64(z * y))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -5e+175], N[(N[(b - z), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[y, 6.6e-9], N[(N[(N[(t - 2.0), $MachinePrecision] * b + z), $MachinePrecision] + N[(N[(1.0 - t), $MachinePrecision] * a + x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{+175}:\\
\;\;\;\;\left(b - z\right) \cdot y\\
\mathbf{elif}\;y \leq 6.6 \cdot 10^{-9}:\\
\;\;\;\;\mathsf{fma}\left(t - 2, b, z\right) + \mathsf{fma}\left(1 - t, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(t + y\right) - 2, b, x - z \cdot y\right)\\
\end{array}
\end{array}
if y < -5e175Initial program 89.5%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6492.2
Applied rewrites92.2%
if -5e175 < y < 6.60000000000000037e-9Initial program 96.0%
Taylor expanded in y around 0
associate--l+N/A
+-commutativeN/A
fp-cancel-sign-sub-invN/A
associate--r-N/A
associate-+l+N/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
lower-+.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower--.f64N/A
distribute-lft-out--N/A
*-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
Applied rewrites88.6%
if 6.60000000000000037e-9 < y Initial program 92.5%
Taylor expanded in a around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
lower-fma.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6482.2
Applied rewrites82.2%
Taylor expanded in y around inf
Applied rewrites81.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b a) t)))
(if (<= t -6.8)
t_1
(if (<= t -5.6e-303)
(+ a x)
(if (<= t 4.2e-126) (* b y) (if (<= t 8.2e+14) (* (- 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 <= -6.8) {
tmp = t_1;
} else if (t <= -5.6e-303) {
tmp = a + x;
} else if (t <= 4.2e-126) {
tmp = b * y;
} else if (t <= 8.2e+14) {
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 <= (-6.8d0)) then
tmp = t_1
else if (t <= (-5.6d-303)) then
tmp = a + x
else if (t <= 4.2d-126) then
tmp = b * y
else if (t <= 8.2d+14) 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 <= -6.8) {
tmp = t_1;
} else if (t <= -5.6e-303) {
tmp = a + x;
} else if (t <= 4.2e-126) {
tmp = b * y;
} else if (t <= 8.2e+14) {
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 <= -6.8: tmp = t_1 elif t <= -5.6e-303: tmp = a + x elif t <= 4.2e-126: tmp = b * y elif t <= 8.2e+14: 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 <= -6.8) tmp = t_1; elseif (t <= -5.6e-303) tmp = Float64(a + x); elseif (t <= 4.2e-126) tmp = Float64(b * y); elseif (t <= 8.2e+14) 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 <= -6.8) tmp = t_1; elseif (t <= -5.6e-303) tmp = a + x; elseif (t <= 4.2e-126) tmp = b * y; elseif (t <= 8.2e+14) 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, -6.8], t$95$1, If[LessEqual[t, -5.6e-303], N[(a + x), $MachinePrecision], If[LessEqual[t, 4.2e-126], N[(b * y), $MachinePrecision], If[LessEqual[t, 8.2e+14], 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 -6.8:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -5.6 \cdot 10^{-303}:\\
\;\;\;\;a + x\\
\mathbf{elif}\;t \leq 4.2 \cdot 10^{-126}:\\
\;\;\;\;b \cdot y\\
\mathbf{elif}\;t \leq 8.2 \cdot 10^{+14}:\\
\;\;\;\;\left(1 - y\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -6.79999999999999982 or 8.2e14 < t Initial program 91.2%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6466.4
Applied rewrites66.4%
if -6.79999999999999982 < t < -5.6e-303Initial program 98.5%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
associate-+l-N/A
Applied rewrites69.1%
Taylor expanded in b around 0
Applied rewrites43.4%
Taylor expanded in t around 0
Applied rewrites43.4%
if -5.6e-303 < t < 4.1999999999999997e-126Initial program 97.3%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
associate-+l-N/A
Applied rewrites78.9%
Taylor expanded in y around inf
Applied rewrites44.6%
if 4.1999999999999997e-126 < t < 8.2e14Initial program 94.1%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6454.1
Applied rewrites54.1%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -2.7e+112) (not (<= a 5.6e+73))) (fma (- 1.0 t) a x) (fma (- (+ t y) 2.0) b (- x (* z y)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -2.7e+112) || !(a <= 5.6e+73)) {
tmp = fma((1.0 - t), a, x);
} else {
tmp = fma(((t + y) - 2.0), b, (x - (z * y)));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -2.7e+112) || !(a <= 5.6e+73)) tmp = fma(Float64(1.0 - t), a, x); else tmp = fma(Float64(Float64(t + y) - 2.0), b, Float64(x - Float64(z * y))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -2.7e+112], N[Not[LessEqual[a, 5.6e+73]], $MachinePrecision]], N[(N[(1.0 - t), $MachinePrecision] * a + x), $MachinePrecision], N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.7 \cdot 10^{+112} \lor \neg \left(a \leq 5.6 \cdot 10^{+73}\right):\\
\;\;\;\;\mathsf{fma}\left(1 - t, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(t + y\right) - 2, b, x - z \cdot y\right)\\
\end{array}
\end{array}
if a < -2.7000000000000001e112 or 5.60000000000000016e73 < a Initial program 91.1%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
associate-+l-N/A
Applied rewrites82.8%
Taylor expanded in b around 0
Applied rewrites73.6%
if -2.7000000000000001e112 < a < 5.60000000000000016e73Initial program 96.1%
Taylor expanded in a around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
lower-fma.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6492.6
Applied rewrites92.6%
Taylor expanded in y around inf
Applied rewrites80.9%
Final simplification78.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b z) y)))
(if (<= y -4e+175)
t_1
(if (<= y -2.2e-128)
(fma (- 1.0 t) a x)
(if (<= y 1.1) (+ (fma (- t 2.0) b x) 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 <= -4e+175) {
tmp = t_1;
} else if (y <= -2.2e-128) {
tmp = fma((1.0 - t), a, x);
} else if (y <= 1.1) {
tmp = fma((t - 2.0), b, x) + 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 <= -4e+175) tmp = t_1; elseif (y <= -2.2e-128) tmp = fma(Float64(1.0 - t), a, x); elseif (y <= 1.1) tmp = Float64(fma(Float64(t - 2.0), b, x) + 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, -4e+175], t$95$1, If[LessEqual[y, -2.2e-128], N[(N[(1.0 - t), $MachinePrecision] * a + x), $MachinePrecision], If[LessEqual[y, 1.1], N[(N[(N[(t - 2.0), $MachinePrecision] * b + x), $MachinePrecision] + z), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(b - z\right) \cdot y\\
\mathbf{if}\;y \leq -4 \cdot 10^{+175}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -2.2 \cdot 10^{-128}:\\
\;\;\;\;\mathsf{fma}\left(1 - t, a, x\right)\\
\mathbf{elif}\;y \leq 1.1:\\
\;\;\;\;\mathsf{fma}\left(t - 2, b, x\right) + z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.9999999999999997e175 or 1.1000000000000001 < y Initial program 91.3%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6475.2
Applied rewrites75.2%
if -3.9999999999999997e175 < y < -2.20000000000000009e-128Initial program 97.0%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
associate-+l-N/A
Applied rewrites83.5%
Taylor expanded in b around 0
Applied rewrites65.0%
if -2.20000000000000009e-128 < y < 1.1000000000000001Initial program 95.3%
Taylor expanded in y around 0
associate--l+N/A
+-commutativeN/A
fp-cancel-sign-sub-invN/A
associate--r-N/A
associate-+l+N/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
lower-+.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower--.f64N/A
distribute-lft-out--N/A
*-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
Applied rewrites95.2%
Taylor expanded in a around 0
Applied rewrites73.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b a) t)))
(if (<= t -5.4e+100)
t_1
(if (<= t -1.4e+24)
(fma (- z) (- y 1.0) x)
(if (<= t 8.5e-27) (+ (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 <= -5.4e+100) {
tmp = t_1;
} else if (t <= -1.4e+24) {
tmp = fma(-z, (y - 1.0), x);
} else if (t <= 8.5e-27) {
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 <= -5.4e+100) tmp = t_1; elseif (t <= -1.4e+24) tmp = fma(Float64(-z), Float64(y - 1.0), x); elseif (t <= 8.5e-27) 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, -5.4e+100], t$95$1, If[LessEqual[t, -1.4e+24], N[((-z) * N[(y - 1.0), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t, 8.5e-27], 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 -5.4 \cdot 10^{+100}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -1.4 \cdot 10^{+24}:\\
\;\;\;\;\mathsf{fma}\left(-z, y - 1, x\right)\\
\mathbf{elif}\;t \leq 8.5 \cdot 10^{-27}:\\
\;\;\;\;\mathsf{fma}\left(y - 2, b, x\right) + a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -5.39999999999999997e100 or 8.50000000000000033e-27 < t Initial program 90.3%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6471.3
Applied rewrites71.3%
if -5.39999999999999997e100 < t < -1.4000000000000001e24Initial program 94.4%
Taylor expanded in a around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
lower-fma.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6472.9
Applied rewrites72.9%
Taylor expanded in b around 0
Applied rewrites62.2%
if -1.4000000000000001e24 < t < 8.50000000000000033e-27Initial program 97.6%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
associate-+l-N/A
Applied rewrites72.7%
Taylor expanded in t around 0
Applied rewrites70.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b a) t)))
(if (<= t -3.6e+98)
t_1
(if (<= t -2.55e-26)
(fma (- t) a x)
(if (<= t 8.5e-27) (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 <= -3.6e+98) {
tmp = t_1;
} else if (t <= -2.55e-26) {
tmp = fma(-t, a, x);
} else if (t <= 8.5e-27) {
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 <= -3.6e+98) tmp = t_1; elseif (t <= -2.55e-26) tmp = fma(Float64(-t), a, x); elseif (t <= 8.5e-27) 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, -3.6e+98], t$95$1, If[LessEqual[t, -2.55e-26], N[((-t) * a + x), $MachinePrecision], If[LessEqual[t, 8.5e-27], 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 -3.6 \cdot 10^{+98}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -2.55 \cdot 10^{-26}:\\
\;\;\;\;\mathsf{fma}\left(-t, a, x\right)\\
\mathbf{elif}\;t \leq 8.5 \cdot 10^{-27}:\\
\;\;\;\;\mathsf{fma}\left(y - 2, b, a\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.59999999999999981e98 or 8.50000000000000033e-27 < t Initial program 90.4%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6470.7
Applied rewrites70.7%
if -3.59999999999999981e98 < t < -2.54999999999999995e-26Initial program 93.5%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
associate-+l-N/A
Applied rewrites74.8%
Taylor expanded in b around 0
Applied rewrites52.8%
Taylor expanded in t around inf
Applied rewrites50.5%
if -2.54999999999999995e-26 < t < 8.50000000000000033e-27Initial program 98.2%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
associate-+l-N/A
Applied rewrites71.0%
Taylor expanded in t around 0
Applied rewrites71.0%
Taylor expanded in x around 0
Applied rewrites57.4%
(FPCore (x y z t a b)
:precision binary64
(if (<= y -9.2e+169)
(* b y)
(if (<= y -1.4e-134)
(* (- 1.0 t) a)
(if (<= y 8e+84) (fma (- t) a x) (* b y)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -9.2e+169) {
tmp = b * y;
} else if (y <= -1.4e-134) {
tmp = (1.0 - t) * a;
} else if (y <= 8e+84) {
tmp = fma(-t, a, x);
} else {
tmp = b * y;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -9.2e+169) tmp = Float64(b * y); elseif (y <= -1.4e-134) tmp = Float64(Float64(1.0 - t) * a); elseif (y <= 8e+84) tmp = fma(Float64(-t), a, x); else tmp = Float64(b * y); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -9.2e+169], N[(b * y), $MachinePrecision], If[LessEqual[y, -1.4e-134], N[(N[(1.0 - t), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[y, 8e+84], N[((-t) * a + x), $MachinePrecision], N[(b * y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.2 \cdot 10^{+169}:\\
\;\;\;\;b \cdot y\\
\mathbf{elif}\;y \leq -1.4 \cdot 10^{-134}:\\
\;\;\;\;\left(1 - t\right) \cdot a\\
\mathbf{elif}\;y \leq 8 \cdot 10^{+84}:\\
\;\;\;\;\mathsf{fma}\left(-t, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot y\\
\end{array}
\end{array}
if y < -9.1999999999999997e169 or 8.00000000000000046e84 < y Initial program 90.7%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
associate-+l-N/A
Applied rewrites70.0%
Taylor expanded in y around inf
Applied rewrites51.4%
if -9.1999999999999997e169 < y < -1.3999999999999999e-134Initial program 97.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6455.5
Applied rewrites55.5%
if -1.3999999999999999e-134 < y < 8.00000000000000046e84Initial program 95.1%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
associate-+l-N/A
Applied rewrites75.7%
Taylor expanded in b around 0
Applied rewrites50.5%
Taylor expanded in t around inf
Applied rewrites39.2%
(FPCore (x y z t a b) :precision binary64 (if (<= y -7.5e+209) (* b y) (if (<= y -2e+67) (* (- y) z) (if (<= y 9.5e+74) (+ a x) (* b y)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -7.5e+209) {
tmp = b * y;
} else if (y <= -2e+67) {
tmp = -y * z;
} else if (y <= 9.5e+74) {
tmp = a + x;
} else {
tmp = b * y;
}
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 (y <= (-7.5d+209)) then
tmp = b * y
else if (y <= (-2d+67)) then
tmp = -y * z
else if (y <= 9.5d+74) then
tmp = a + x
else
tmp = b * y
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 (y <= -7.5e+209) {
tmp = b * y;
} else if (y <= -2e+67) {
tmp = -y * z;
} else if (y <= 9.5e+74) {
tmp = a + x;
} else {
tmp = b * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -7.5e+209: tmp = b * y elif y <= -2e+67: tmp = -y * z elif y <= 9.5e+74: tmp = a + x else: tmp = b * y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -7.5e+209) tmp = Float64(b * y); elseif (y <= -2e+67) tmp = Float64(Float64(-y) * z); elseif (y <= 9.5e+74) tmp = Float64(a + x); else tmp = Float64(b * y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y <= -7.5e+209) tmp = b * y; elseif (y <= -2e+67) tmp = -y * z; elseif (y <= 9.5e+74) tmp = a + x; else tmp = b * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -7.5e+209], N[(b * y), $MachinePrecision], If[LessEqual[y, -2e+67], N[((-y) * z), $MachinePrecision], If[LessEqual[y, 9.5e+74], N[(a + x), $MachinePrecision], N[(b * y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.5 \cdot 10^{+209}:\\
\;\;\;\;b \cdot y\\
\mathbf{elif}\;y \leq -2 \cdot 10^{+67}:\\
\;\;\;\;\left(-y\right) \cdot z\\
\mathbf{elif}\;y \leq 9.5 \cdot 10^{+74}:\\
\;\;\;\;a + x\\
\mathbf{else}:\\
\;\;\;\;b \cdot y\\
\end{array}
\end{array}
if y < -7.50000000000000055e209 or 9.5000000000000006e74 < y Initial program 89.7%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
associate-+l-N/A
Applied rewrites73.8%
Taylor expanded in y around inf
Applied rewrites55.2%
if -7.50000000000000055e209 < y < -1.99999999999999997e67Initial program 96.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6438.4
Applied rewrites38.4%
Taylor expanded in y around inf
Applied rewrites38.4%
if -1.99999999999999997e67 < y < 9.5000000000000006e74Initial program 95.9%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
associate-+l-N/A
Applied rewrites78.2%
Taylor expanded in b around 0
Applied rewrites54.6%
Taylor expanded in t around 0
Applied rewrites32.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -4e+175) (not (<= y 5.6e+67))) (* (- b z) y) (fma (- 1.0 t) a x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -4e+175) || !(y <= 5.6e+67)) {
tmp = (b - z) * y;
} else {
tmp = fma((1.0 - t), a, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -4e+175) || !(y <= 5.6e+67)) tmp = Float64(Float64(b - z) * y); else tmp = fma(Float64(1.0 - t), a, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -4e+175], N[Not[LessEqual[y, 5.6e+67]], $MachinePrecision]], N[(N[(b - z), $MachinePrecision] * y), $MachinePrecision], N[(N[(1.0 - t), $MachinePrecision] * a + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4 \cdot 10^{+175} \lor \neg \left(y \leq 5.6 \cdot 10^{+67}\right):\\
\;\;\;\;\left(b - z\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 - t, a, x\right)\\
\end{array}
\end{array}
if y < -3.9999999999999997e175 or 5.5999999999999995e67 < y Initial program 90.9%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6482.4
Applied rewrites82.4%
if -3.9999999999999997e175 < y < 5.5999999999999995e67Initial program 95.8%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
associate-+l-N/A
Applied rewrites78.6%
Taylor expanded in b around 0
Applied rewrites55.9%
Final simplification65.0%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -1.76e+167) (not (<= y 850000000000.0))) (* (- b z) y) (* (- b a) t)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -1.76e+167) || !(y <= 850000000000.0)) {
tmp = (b - z) * y;
} else {
tmp = (b - a) * 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 ((y <= (-1.76d+167)) .or. (.not. (y <= 850000000000.0d0))) then
tmp = (b - z) * y
else
tmp = (b - a) * 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 ((y <= -1.76e+167) || !(y <= 850000000000.0)) {
tmp = (b - z) * y;
} else {
tmp = (b - a) * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -1.76e+167) or not (y <= 850000000000.0): tmp = (b - z) * y else: tmp = (b - a) * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -1.76e+167) || !(y <= 850000000000.0)) tmp = Float64(Float64(b - z) * y); else tmp = Float64(Float64(b - a) * t); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -1.76e+167) || ~((y <= 850000000000.0))) tmp = (b - z) * y; else tmp = (b - a) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -1.76e+167], N[Not[LessEqual[y, 850000000000.0]], $MachinePrecision]], N[(N[(b - z), $MachinePrecision] * y), $MachinePrecision], N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.76 \cdot 10^{+167} \lor \neg \left(y \leq 850000000000\right):\\
\;\;\;\;\left(b - z\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(b - a\right) \cdot t\\
\end{array}
\end{array}
if y < -1.7599999999999999e167 or 8.5e11 < y Initial program 91.2%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6475.7
Applied rewrites75.7%
if -1.7599999999999999e167 < y < 8.5e11Initial program 96.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6444.7
Applied rewrites44.7%
Final simplification57.2%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -1.6e+34) (not (<= z 2.85e+78))) (* (- 1.0 y) z) (fma (- t) a x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -1.6e+34) || !(z <= 2.85e+78)) {
tmp = (1.0 - y) * z;
} else {
tmp = fma(-t, a, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -1.6e+34) || !(z <= 2.85e+78)) tmp = Float64(Float64(1.0 - y) * z); else tmp = fma(Float64(-t), a, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -1.6e+34], N[Not[LessEqual[z, 2.85e+78]], $MachinePrecision]], N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision], N[((-t) * a + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{+34} \lor \neg \left(z \leq 2.85 \cdot 10^{+78}\right):\\
\;\;\;\;\left(1 - y\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-t, a, x\right)\\
\end{array}
\end{array}
if z < -1.5999999999999999e34 or 2.84999999999999993e78 < z Initial program 92.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6466.2
Applied rewrites66.2%
if -1.5999999999999999e34 < z < 2.84999999999999993e78Initial program 94.9%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
associate-+l-N/A
Applied rewrites94.9%
Taylor expanded in b around 0
Applied rewrites54.9%
Taylor expanded in t around inf
Applied rewrites42.5%
Final simplification51.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -2.9e+189) (not (<= y 8e+84))) (* b y) (fma (- t) a x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -2.9e+189) || !(y <= 8e+84)) {
tmp = b * y;
} else {
tmp = fma(-t, a, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -2.9e+189) || !(y <= 8e+84)) tmp = Float64(b * y); else tmp = fma(Float64(-t), a, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -2.9e+189], N[Not[LessEqual[y, 8e+84]], $MachinePrecision]], N[(b * y), $MachinePrecision], N[((-t) * a + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.9 \cdot 10^{+189} \lor \neg \left(y \leq 8 \cdot 10^{+84}\right):\\
\;\;\;\;b \cdot y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-t, a, x\right)\\
\end{array}
\end{array}
if y < -2.90000000000000019e189 or 8.00000000000000046e84 < y Initial program 90.1%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
associate-+l-N/A
Applied rewrites72.3%
Taylor expanded in y around inf
Applied rewrites54.4%
if -2.90000000000000019e189 < y < 8.00000000000000046e84Initial program 96.0%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
associate-+l-N/A
Applied rewrites76.7%
Taylor expanded in b around 0
Applied rewrites54.9%
Taylor expanded in t around inf
Applied rewrites41.9%
Final simplification45.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -2.7e+189) (not (<= y 9.5e+74))) (* b y) (+ a x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -2.7e+189) || !(y <= 9.5e+74)) {
tmp = b * y;
} else {
tmp = a + 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 ((y <= (-2.7d+189)) .or. (.not. (y <= 9.5d+74))) then
tmp = b * y
else
tmp = a + 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 ((y <= -2.7e+189) || !(y <= 9.5e+74)) {
tmp = b * y;
} else {
tmp = a + x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -2.7e+189) or not (y <= 9.5e+74): tmp = b * y else: tmp = a + x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -2.7e+189) || !(y <= 9.5e+74)) tmp = Float64(b * y); else tmp = Float64(a + x); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -2.7e+189) || ~((y <= 9.5e+74))) tmp = b * y; else tmp = a + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -2.7e+189], N[Not[LessEqual[y, 9.5e+74]], $MachinePrecision]], N[(b * y), $MachinePrecision], N[(a + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.7 \cdot 10^{+189} \lor \neg \left(y \leq 9.5 \cdot 10^{+74}\right):\\
\;\;\;\;b \cdot y\\
\mathbf{else}:\\
\;\;\;\;a + x\\
\end{array}
\end{array}
if y < -2.69999999999999994e189 or 9.5000000000000006e74 < y Initial program 90.2%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
associate-+l-N/A
Applied rewrites72.7%
Taylor expanded in y around inf
Applied rewrites53.8%
if -2.69999999999999994e189 < y < 9.5000000000000006e74Initial program 96.0%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
associate-+l-N/A
Applied rewrites76.6%
Taylor expanded in b around 0
Applied rewrites54.7%
Taylor expanded in t around 0
Applied rewrites29.5%
Final simplification37.3%
(FPCore (x y z t a b) :precision binary64 (+ a x))
double code(double x, double y, double z, double t, double a, double b) {
return a + 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 = a + x
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return a + x;
}
def code(x, y, z, t, a, b): return a + x
function code(x, y, z, t, a, b) return Float64(a + x) end
function tmp = code(x, y, z, t, a, b) tmp = a + x; end
code[x_, y_, z_, t_, a_, b_] := N[(a + x), $MachinePrecision]
\begin{array}{l}
\\
a + x
\end{array}
Initial program 94.1%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
associate-+l-N/A
Applied rewrites75.3%
Taylor expanded in b around 0
Applied rewrites44.1%
Taylor expanded in t around 0
Applied rewrites22.9%
herbie shell --seed 2024364
(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)))