
(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 20 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 (fma (- (+ t y) 2.0) b (- x (fma (- t 1.0) a (fma z y (- z))))))
double code(double x, double y, double z, double t, double a, double b) {
return fma(((t + y) - 2.0), b, (x - fma((t - 1.0), a, fma(z, y, -z))));
}
function code(x, y, z, t, a, b) return fma(Float64(Float64(t + y) - 2.0), b, Float64(x - fma(Float64(t - 1.0), a, fma(z, y, Float64(-z))))) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + N[(x - N[(N[(t - 1.0), $MachinePrecision] * a + N[(z * y + (-z)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\left(t + y\right) - 2, b, x - \mathsf{fma}\left(t - 1, a, \mathsf{fma}\left(z, y, -z\right)\right)\right)
\end{array}
Initial program 96.1%
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 rewrites97.6%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6497.7
Applied rewrites97.7%
(FPCore (x y z t a b)
:precision binary64
(if (<= b -1.15e+17)
(- (fma (- (+ t y) 2.0) b x) (* (- t 1.0) a))
(if (<= b 1.12e+52)
(- x (fma (- t 1.0) a (* (- y 1.0) z)))
(+ a (* (- (+ y t) 2.0) b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -1.15e+17) {
tmp = fma(((t + y) - 2.0), b, x) - ((t - 1.0) * a);
} else if (b <= 1.12e+52) {
tmp = x - fma((t - 1.0), a, ((y - 1.0) * z));
} else {
tmp = a + (((y + t) - 2.0) * b);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -1.15e+17) tmp = Float64(fma(Float64(Float64(t + y) - 2.0), b, x) - Float64(Float64(t - 1.0) * a)); elseif (b <= 1.12e+52) tmp = Float64(x - fma(Float64(t - 1.0), a, Float64(Float64(y - 1.0) * z))); else tmp = Float64(a + Float64(Float64(Float64(y + t) - 2.0) * b)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -1.15e+17], N[(N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + x), $MachinePrecision] - N[(N[(t - 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.12e+52], N[(x - N[(N[(t - 1.0), $MachinePrecision] * a + N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.15 \cdot 10^{+17}:\\
\;\;\;\;\mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - \left(t - 1\right) \cdot a\\
\mathbf{elif}\;b \leq 1.12 \cdot 10^{+52}:\\
\;\;\;\;x - \mathsf{fma}\left(t - 1, a, \left(y - 1\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;a + \left(\left(y + t\right) - 2\right) \cdot b\\
\end{array}
\end{array}
if b < -1.15e17Initial program 93.8%
Taylor expanded in z around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift--.f6489.5
Applied rewrites89.5%
if -1.15e17 < b < 1.12000000000000002e52Initial 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--.f6490.9
Applied rewrites90.9%
if 1.12000000000000002e52 < b Initial program 90.5%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6484.9
Applied rewrites84.9%
Taylor expanded in t around 0
Applied rewrites90.5%
(FPCore (x y z t a b)
:precision binary64
(if (<= b -7e+19)
(fma (- (+ t y) 2.0) b (- x (* a t)))
(if (<= b 1.12e+52)
(- x (fma (- t 1.0) a (* (- y 1.0) z)))
(+ a (* (- (+ y t) 2.0) b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -7e+19) {
tmp = fma(((t + y) - 2.0), b, (x - (a * t)));
} else if (b <= 1.12e+52) {
tmp = x - fma((t - 1.0), a, ((y - 1.0) * z));
} else {
tmp = a + (((y + t) - 2.0) * b);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -7e+19) tmp = fma(Float64(Float64(t + y) - 2.0), b, Float64(x - Float64(a * t))); elseif (b <= 1.12e+52) tmp = Float64(x - fma(Float64(t - 1.0), a, Float64(Float64(y - 1.0) * z))); else tmp = Float64(a + Float64(Float64(Float64(y + t) - 2.0) * b)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -7e+19], N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + N[(x - N[(a * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.12e+52], N[(x - N[(N[(t - 1.0), $MachinePrecision] * a + N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -7 \cdot 10^{+19}:\\
\;\;\;\;\mathsf{fma}\left(\left(t + y\right) - 2, b, x - a \cdot t\right)\\
\mathbf{elif}\;b \leq 1.12 \cdot 10^{+52}:\\
\;\;\;\;x - \mathsf{fma}\left(t - 1, a, \left(y - 1\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;a + \left(\left(y + t\right) - 2\right) \cdot b\\
\end{array}
\end{array}
if b < -7e19Initial program 93.8%
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.9%
Taylor expanded in t around inf
lower-*.f6486.4
Applied rewrites86.4%
if -7e19 < b < 1.12000000000000002e52Initial 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--.f6490.9
Applied rewrites90.9%
if 1.12000000000000002e52 < b Initial program 90.5%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6484.9
Applied rewrites84.9%
Taylor expanded in t around 0
Applied rewrites90.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- (+ y t) 2.0) b)))
(if (<= b -8.5e+118)
(+ x t_1)
(if (<= b 1.12e+52) (- x (fma (- t 1.0) a (* (- y 1.0) z))) (+ a t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((y + t) - 2.0) * b;
double tmp;
if (b <= -8.5e+118) {
tmp = x + t_1;
} else if (b <= 1.12e+52) {
tmp = x - fma((t - 1.0), a, ((y - 1.0) * z));
} else {
tmp = a + t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(y + t) - 2.0) * b) tmp = 0.0 if (b <= -8.5e+118) tmp = Float64(x + t_1); elseif (b <= 1.12e+52) tmp = Float64(x - fma(Float64(t - 1.0), a, Float64(Float64(y - 1.0) * z))); else tmp = Float64(a + t_1); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[b, -8.5e+118], N[(x + t$95$1), $MachinePrecision], If[LessEqual[b, 1.12e+52], N[(x - N[(N[(t - 1.0), $MachinePrecision] * a + N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(y + t\right) - 2\right) \cdot b\\
\mathbf{if}\;b \leq -8.5 \cdot 10^{+118}:\\
\;\;\;\;x + t\_1\\
\mathbf{elif}\;b \leq 1.12 \cdot 10^{+52}:\\
\;\;\;\;x - \mathsf{fma}\left(t - 1, a, \left(y - 1\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;a + t\_1\\
\end{array}
\end{array}
if b < -8.50000000000000033e118Initial program 92.7%
Taylor expanded in x around inf
Applied rewrites90.7%
if -8.50000000000000033e118 < b < 1.12000000000000002e52Initial program 98.7%
Taylor expanded in b around 0
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift--.f6486.9
Applied rewrites86.9%
if 1.12000000000000002e52 < b Initial program 90.5%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6484.9
Applied rewrites84.9%
Taylor expanded in t around 0
Applied rewrites90.5%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -7e+19) (not (<= b 6.6e+38))) (+ x (* (- (+ y t) 2.0) b)) (- x (fma z (- y 1.0) (- a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -7e+19) || !(b <= 6.6e+38)) {
tmp = x + (((y + t) - 2.0) * b);
} else {
tmp = x - fma(z, (y - 1.0), -a);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -7e+19) || !(b <= 6.6e+38)) tmp = Float64(x + Float64(Float64(Float64(y + t) - 2.0) * b)); else tmp = Float64(x - fma(z, Float64(y - 1.0), Float64(-a))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -7e+19], N[Not[LessEqual[b, 6.6e+38]], $MachinePrecision]], N[(x + N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], N[(x - N[(z * N[(y - 1.0), $MachinePrecision] + (-a)), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -7 \cdot 10^{+19} \lor \neg \left(b \leq 6.6 \cdot 10^{+38}\right):\\
\;\;\;\;x + \left(\left(y + t\right) - 2\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;x - \mathsf{fma}\left(z, y - 1, -a\right)\\
\end{array}
\end{array}
if b < -7e19 or 6.5999999999999998e38 < b Initial program 92.5%
Taylor expanded in x around inf
Applied rewrites82.5%
if -7e19 < b < 6.5999999999999998e38Initial 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.4
Applied rewrites91.4%
Taylor expanded in t around 0
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6476.8
Applied rewrites76.8%
Final simplification79.5%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -6.6e+62) (not (<= b 7.5e+38))) (* (- (+ t y) 2.0) b) (- x (fma z (- y 1.0) (- a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -6.6e+62) || !(b <= 7.5e+38)) {
tmp = ((t + y) - 2.0) * b;
} else {
tmp = x - fma(z, (y - 1.0), -a);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -6.6e+62) || !(b <= 7.5e+38)) tmp = Float64(Float64(Float64(t + y) - 2.0) * b); else tmp = Float64(x - fma(z, Float64(y - 1.0), Float64(-a))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -6.6e+62], N[Not[LessEqual[b, 7.5e+38]], $MachinePrecision]], N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision], N[(x - N[(z * N[(y - 1.0), $MachinePrecision] + (-a)), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -6.6 \cdot 10^{+62} \lor \neg \left(b \leq 7.5 \cdot 10^{+38}\right):\\
\;\;\;\;\left(\left(t + y\right) - 2\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;x - \mathsf{fma}\left(z, y - 1, -a\right)\\
\end{array}
\end{array}
if b < -6.6e62 or 7.4999999999999999e38 < b Initial program 91.6%
Taylor expanded in b around inf
*-commutativeN/A
+-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f6480.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6480.8
Applied rewrites80.8%
if -6.6e62 < b < 7.4999999999999999e38Initial program 99.3%
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.9
Applied rewrites88.9%
Taylor expanded in t around 0
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6474.5
Applied rewrites74.5%
Final simplification77.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b z) y)))
(if (<= y -9e+37)
t_1
(if (<= y -9.8e-301)
(+ x (* -2.0 b))
(if (<= y 8e+39) (- x (* a t)) 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 <= -9e+37) {
tmp = t_1;
} else if (y <= -9.8e-301) {
tmp = x + (-2.0 * b);
} else if (y <= 8e+39) {
tmp = x - (a * t);
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = (b - z) * y
if (y <= (-9d+37)) then
tmp = t_1
else if (y <= (-9.8d-301)) then
tmp = x + ((-2.0d0) * b)
else if (y <= 8d+39) then
tmp = x - (a * t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (b - z) * y;
double tmp;
if (y <= -9e+37) {
tmp = t_1;
} else if (y <= -9.8e-301) {
tmp = x + (-2.0 * b);
} else if (y <= 8e+39) {
tmp = x - (a * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (b - z) * y tmp = 0 if y <= -9e+37: tmp = t_1 elif y <= -9.8e-301: tmp = x + (-2.0 * b) elif y <= 8e+39: tmp = x - (a * t) 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 <= -9e+37) tmp = t_1; elseif (y <= -9.8e-301) tmp = Float64(x + Float64(-2.0 * b)); elseif (y <= 8e+39) tmp = Float64(x - Float64(a * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (b - z) * y; tmp = 0.0; if (y <= -9e+37) tmp = t_1; elseif (y <= -9.8e-301) tmp = x + (-2.0 * b); elseif (y <= 8e+39) tmp = x - (a * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b - z), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -9e+37], t$95$1, If[LessEqual[y, -9.8e-301], N[(x + N[(-2.0 * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8e+39], N[(x - N[(a * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(b - z\right) \cdot y\\
\mathbf{if}\;y \leq -9 \cdot 10^{+37}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -9.8 \cdot 10^{-301}:\\
\;\;\;\;x + -2 \cdot b\\
\mathbf{elif}\;y \leq 8 \cdot 10^{+39}:\\
\;\;\;\;x - a \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -8.99999999999999923e37 or 7.99999999999999952e39 < y Initial program 95.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6475.9
Applied rewrites75.9%
if -8.99999999999999923e37 < y < -9.8e-301Initial program 94.7%
Taylor expanded in x around inf
Applied rewrites62.1%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f6461.7
Applied rewrites61.7%
Taylor expanded in t around 0
Applied rewrites38.7%
if -9.8e-301 < y < 7.99999999999999952e39Initial program 98.7%
Taylor expanded in b around 0
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift--.f6471.4
Applied rewrites71.4%
Taylor expanded in t around inf
lower-*.f6446.5
Applied rewrites46.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b z) y)))
(if (<= y -4.8e+35)
t_1
(if (<= y 2.7e-204) (* (- b a) t) (if (<= y 8e+39) (- x (* a t)) 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 <= -4.8e+35) {
tmp = t_1;
} else if (y <= 2.7e-204) {
tmp = (b - a) * t;
} else if (y <= 8e+39) {
tmp = x - (a * t);
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = (b - z) * y
if (y <= (-4.8d+35)) then
tmp = t_1
else if (y <= 2.7d-204) then
tmp = (b - a) * t
else if (y <= 8d+39) then
tmp = x - (a * t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (b - z) * y;
double tmp;
if (y <= -4.8e+35) {
tmp = t_1;
} else if (y <= 2.7e-204) {
tmp = (b - a) * t;
} else if (y <= 8e+39) {
tmp = x - (a * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (b - z) * y tmp = 0 if y <= -4.8e+35: tmp = t_1 elif y <= 2.7e-204: tmp = (b - a) * t elif y <= 8e+39: tmp = x - (a * t) 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 <= -4.8e+35) tmp = t_1; elseif (y <= 2.7e-204) tmp = Float64(Float64(b - a) * t); elseif (y <= 8e+39) tmp = Float64(x - Float64(a * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (b - z) * y; tmp = 0.0; if (y <= -4.8e+35) tmp = t_1; elseif (y <= 2.7e-204) tmp = (b - a) * t; elseif (y <= 8e+39) tmp = x - (a * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b - z), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -4.8e+35], t$95$1, If[LessEqual[y, 2.7e-204], N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[y, 8e+39], N[(x - N[(a * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(b - z\right) \cdot y\\
\mathbf{if}\;y \leq -4.8 \cdot 10^{+35}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.7 \cdot 10^{-204}:\\
\;\;\;\;\left(b - a\right) \cdot t\\
\mathbf{elif}\;y \leq 8 \cdot 10^{+39}:\\
\;\;\;\;x - a \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -4.80000000000000029e35 or 7.99999999999999952e39 < y Initial program 95.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6475.2
Applied rewrites75.2%
if -4.80000000000000029e35 < y < 2.69999999999999991e-204Initial program 95.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6439.4
Applied rewrites39.4%
if 2.69999999999999991e-204 < y < 7.99999999999999952e39Initial program 100.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--.f6473.0
Applied rewrites73.0%
Taylor expanded in t around inf
lower-*.f6449.0
Applied rewrites49.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- (+ y t) 2.0) b)))
(if (<= b -7e+19)
(+ x t_1)
(if (<= b 6.6e+38) (- x (fma z (- y 1.0) (- a))) (+ a t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((y + t) - 2.0) * b;
double tmp;
if (b <= -7e+19) {
tmp = x + t_1;
} else if (b <= 6.6e+38) {
tmp = x - fma(z, (y - 1.0), -a);
} else {
tmp = a + t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(y + t) - 2.0) * b) tmp = 0.0 if (b <= -7e+19) tmp = Float64(x + t_1); elseif (b <= 6.6e+38) tmp = Float64(x - fma(z, Float64(y - 1.0), Float64(-a))); else tmp = Float64(a + t_1); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[b, -7e+19], N[(x + t$95$1), $MachinePrecision], If[LessEqual[b, 6.6e+38], N[(x - N[(z * N[(y - 1.0), $MachinePrecision] + (-a)), $MachinePrecision]), $MachinePrecision], N[(a + t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(y + t\right) - 2\right) \cdot b\\
\mathbf{if}\;b \leq -7 \cdot 10^{+19}:\\
\;\;\;\;x + t\_1\\
\mathbf{elif}\;b \leq 6.6 \cdot 10^{+38}:\\
\;\;\;\;x - \mathsf{fma}\left(z, y - 1, -a\right)\\
\mathbf{else}:\\
\;\;\;\;a + t\_1\\
\end{array}
\end{array}
if b < -7e19Initial program 93.8%
Taylor expanded in x around inf
Applied rewrites80.6%
if -7e19 < b < 6.5999999999999998e38Initial 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.4
Applied rewrites91.4%
Taylor expanded in t around 0
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6476.8
Applied rewrites76.8%
if 6.5999999999999998e38 < b Initial program 91.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6484.1
Applied rewrites84.1%
Taylor expanded in t around 0
Applied rewrites87.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -6.5e+62) (not (<= b 6.6e+38))) (* (- (+ t y) 2.0) b) (- x (* z (- y 1.0)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -6.5e+62) || !(b <= 6.6e+38)) {
tmp = ((t + y) - 2.0) * b;
} else {
tmp = x - (z * (y - 1.0));
}
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 <= (-6.5d+62)) .or. (.not. (b <= 6.6d+38))) then
tmp = ((t + y) - 2.0d0) * b
else
tmp = x - (z * (y - 1.0d0))
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 <= -6.5e+62) || !(b <= 6.6e+38)) {
tmp = ((t + y) - 2.0) * b;
} else {
tmp = x - (z * (y - 1.0));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (b <= -6.5e+62) or not (b <= 6.6e+38): tmp = ((t + y) - 2.0) * b else: tmp = x - (z * (y - 1.0)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -6.5e+62) || !(b <= 6.6e+38)) tmp = Float64(Float64(Float64(t + y) - 2.0) * b); else tmp = Float64(x - Float64(z * Float64(y - 1.0))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((b <= -6.5e+62) || ~((b <= 6.6e+38))) tmp = ((t + y) - 2.0) * b; else tmp = x - (z * (y - 1.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -6.5e+62], N[Not[LessEqual[b, 6.6e+38]], $MachinePrecision]], N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision], N[(x - N[(z * N[(y - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -6.5 \cdot 10^{+62} \lor \neg \left(b \leq 6.6 \cdot 10^{+38}\right):\\
\;\;\;\;\left(\left(t + y\right) - 2\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot \left(y - 1\right)\\
\end{array}
\end{array}
if b < -6.5000000000000003e62 or 6.5999999999999998e38 < b Initial program 91.6%
Taylor expanded in b around inf
*-commutativeN/A
+-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f6480.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6480.8
Applied rewrites80.8%
if -6.5000000000000003e62 < b < 6.5999999999999998e38Initial program 99.3%
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.9
Applied rewrites88.9%
Taylor expanded in z around inf
lower-*.f64N/A
lift--.f6464.0
Applied rewrites64.0%
Final simplification71.0%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -5.5e+89) (not (<= b 6.6e+38))) (* (- (+ t y) 2.0) b) (- x (* a (- t 1.0)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -5.5e+89) || !(b <= 6.6e+38)) {
tmp = ((t + y) - 2.0) * b;
} else {
tmp = x - (a * (t - 1.0));
}
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 <= (-5.5d+89)) .or. (.not. (b <= 6.6d+38))) then
tmp = ((t + y) - 2.0d0) * b
else
tmp = x - (a * (t - 1.0d0))
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 <= -5.5e+89) || !(b <= 6.6e+38)) {
tmp = ((t + y) - 2.0) * b;
} else {
tmp = x - (a * (t - 1.0));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (b <= -5.5e+89) or not (b <= 6.6e+38): tmp = ((t + y) - 2.0) * b else: tmp = x - (a * (t - 1.0)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -5.5e+89) || !(b <= 6.6e+38)) tmp = Float64(Float64(Float64(t + y) - 2.0) * b); else tmp = Float64(x - Float64(a * Float64(t - 1.0))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((b <= -5.5e+89) || ~((b <= 6.6e+38))) tmp = ((t + y) - 2.0) * b; else tmp = x - (a * (t - 1.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -5.5e+89], N[Not[LessEqual[b, 6.6e+38]], $MachinePrecision]], N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision], N[(x - N[(a * N[(t - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5.5 \cdot 10^{+89} \lor \neg \left(b \leq 6.6 \cdot 10^{+38}\right):\\
\;\;\;\;\left(\left(t + y\right) - 2\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;x - a \cdot \left(t - 1\right)\\
\end{array}
\end{array}
if b < -5.49999999999999976e89 or 6.5999999999999998e38 < b Initial program 91.2%
Taylor expanded in b around inf
*-commutativeN/A
+-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f6482.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f6482.0
Applied rewrites82.0%
if -5.49999999999999976e89 < b < 6.5999999999999998e38Initial program 99.3%
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.0
Applied rewrites88.0%
Taylor expanded in z around 0
lower-*.f64N/A
lift--.f6450.7
Applied rewrites50.7%
Final simplification63.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -6e+62) (not (<= b 6.6e+38))) (* (- (+ 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 ((b <= -6e+62) || !(b <= 6.6e+38)) {
tmp = ((t + y) - 2.0) * b;
} else {
tmp = x - (z * 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 ((b <= (-6d+62)) .or. (.not. (b <= 6.6d+38))) then
tmp = ((t + y) - 2.0d0) * b
else
tmp = x - (z * 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 ((b <= -6e+62) || !(b <= 6.6e+38)) {
tmp = ((t + y) - 2.0) * b;
} else {
tmp = x - (z * y);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (b <= -6e+62) or not (b <= 6.6e+38): tmp = ((t + y) - 2.0) * b else: tmp = x - (z * y) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -6e+62) || !(b <= 6.6e+38)) tmp = Float64(Float64(Float64(t + y) - 2.0) * b); else tmp = Float64(x - Float64(z * y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((b <= -6e+62) || ~((b <= 6.6e+38))) tmp = ((t + y) - 2.0) * b; else tmp = x - (z * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -6e+62], N[Not[LessEqual[b, 6.6e+38]], $MachinePrecision]], N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision], N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -6 \cdot 10^{+62} \lor \neg \left(b \leq 6.6 \cdot 10^{+38}\right):\\
\;\;\;\;\left(\left(t + y\right) - 2\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot y\\
\end{array}
\end{array}
if b < -6e62 or 6.5999999999999998e38 < b Initial program 91.6%
Taylor expanded in b around inf
*-commutativeN/A
+-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f6480.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6480.8
Applied rewrites80.8%
if -6e62 < b < 6.5999999999999998e38Initial program 99.3%
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.9
Applied rewrites88.9%
Taylor expanded in y around inf
*-commutativeN/A
lift-*.f6447.0
Applied rewrites47.0%
Final simplification61.2%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -4.8e+35) (not (<= y 2.65e+73))) (* (- b z) y) (* (- b a) t)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -4.8e+35) || !(y <= 2.65e+73)) {
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 <= (-4.8d+35)) .or. (.not. (y <= 2.65d+73))) 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 <= -4.8e+35) || !(y <= 2.65e+73)) {
tmp = (b - z) * y;
} else {
tmp = (b - a) * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -4.8e+35) or not (y <= 2.65e+73): tmp = (b - z) * y else: tmp = (b - a) * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -4.8e+35) || !(y <= 2.65e+73)) 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 <= -4.8e+35) || ~((y <= 2.65e+73))) 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, -4.8e+35], N[Not[LessEqual[y, 2.65e+73]], $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 -4.8 \cdot 10^{+35} \lor \neg \left(y \leq 2.65 \cdot 10^{+73}\right):\\
\;\;\;\;\left(b - z\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(b - a\right) \cdot t\\
\end{array}
\end{array}
if y < -4.80000000000000029e35 or 2.64999999999999998e73 < y Initial program 94.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6476.8
Applied rewrites76.8%
if -4.80000000000000029e35 < y < 2.64999999999999998e73Initial program 96.8%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6438.7
Applied rewrites38.7%
Final simplification53.0%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -2.25e+104) (not (<= t 7e+75))) (* (- b a) t) (fma (- z) y z)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -2.25e+104) || !(t <= 7e+75)) {
tmp = (b - a) * t;
} else {
tmp = fma(-z, y, z);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -2.25e+104) || !(t <= 7e+75)) tmp = Float64(Float64(b - a) * t); else tmp = fma(Float64(-z), y, z); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -2.25e+104], N[Not[LessEqual[t, 7e+75]], $MachinePrecision]], N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision], N[((-z) * y + z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.25 \cdot 10^{+104} \lor \neg \left(t \leq 7 \cdot 10^{+75}\right):\\
\;\;\;\;\left(b - a\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-z, y, z\right)\\
\end{array}
\end{array}
if t < -2.2499999999999999e104 or 6.9999999999999997e75 < t Initial program 94.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6470.0
Applied rewrites70.0%
if -2.2499999999999999e104 < t < 6.9999999999999997e75Initial program 97.4%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6434.0
Applied rewrites34.0%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lift-neg.f6434.0
Applied rewrites34.0%
Final simplification48.2%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -9e+14) (not (<= z 1.4e-27))) (fma (- z) y z) (* (- 1.0 t) a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -9e+14) || !(z <= 1.4e-27)) {
tmp = fma(-z, y, z);
} else {
tmp = (1.0 - t) * a;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -9e+14) || !(z <= 1.4e-27)) tmp = fma(Float64(-z), y, z); else tmp = Float64(Float64(1.0 - t) * a); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -9e+14], N[Not[LessEqual[z, 1.4e-27]], $MachinePrecision]], N[((-z) * y + z), $MachinePrecision], N[(N[(1.0 - t), $MachinePrecision] * a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{+14} \lor \neg \left(z \leq 1.4 \cdot 10^{-27}\right):\\
\;\;\;\;\mathsf{fma}\left(-z, y, z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - t\right) \cdot a\\
\end{array}
\end{array}
if z < -9e14 or 1.4e-27 < z Initial program 94.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6453.1
Applied rewrites53.1%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lift-neg.f6453.2
Applied rewrites53.2%
if -9e14 < z < 1.4e-27Initial program 97.5%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6434.1
Applied rewrites34.1%
Final simplification44.1%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -1.25e+63) (not (<= b 7.2e+84))) (* b t) (fma (- z) y z)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -1.25e+63) || !(b <= 7.2e+84)) {
tmp = b * t;
} else {
tmp = fma(-z, y, z);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -1.25e+63) || !(b <= 7.2e+84)) tmp = Float64(b * t); else tmp = fma(Float64(-z), y, z); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -1.25e+63], N[Not[LessEqual[b, 7.2e+84]], $MachinePrecision]], N[(b * t), $MachinePrecision], N[((-z) * y + z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.25 \cdot 10^{+63} \lor \neg \left(b \leq 7.2 \cdot 10^{+84}\right):\\
\;\;\;\;b \cdot t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-z, y, z\right)\\
\end{array}
\end{array}
if b < -1.25000000000000003e63 or 7.1999999999999999e84 < b Initial program 90.8%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6444.0
Applied rewrites44.0%
Taylor expanded in a around 0
Applied rewrites41.3%
if -1.25000000000000003e63 < b < 7.1999999999999999e84Initial program 99.3%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6440.7
Applied rewrites40.7%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lift-neg.f6440.7
Applied rewrites40.7%
Final simplification40.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -1.95e-5) (not (<= y 7e+91))) (* (- y) z) (* b t)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -1.95e-5) || !(y <= 7e+91)) {
tmp = -y * z;
} 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 ((y <= (-1.95d-5)) .or. (.not. (y <= 7d+91))) then
tmp = -y * z
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 ((y <= -1.95e-5) || !(y <= 7e+91)) {
tmp = -y * z;
} else {
tmp = b * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -1.95e-5) or not (y <= 7e+91): tmp = -y * z else: tmp = b * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -1.95e-5) || !(y <= 7e+91)) tmp = Float64(Float64(-y) * z); else tmp = Float64(b * t); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -1.95e-5) || ~((y <= 7e+91))) tmp = -y * z; else tmp = b * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -1.95e-5], N[Not[LessEqual[y, 7e+91]], $MachinePrecision]], N[((-y) * z), $MachinePrecision], N[(b * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.95 \cdot 10^{-5} \lor \neg \left(y \leq 7 \cdot 10^{+91}\right):\\
\;\;\;\;\left(-y\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;b \cdot t\\
\end{array}
\end{array}
if y < -1.95e-5 or 7.00000000000000001e91 < y Initial program 94.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6448.8
Applied rewrites48.8%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6448.0
Applied rewrites48.0%
if -1.95e-5 < y < 7.00000000000000001e91Initial program 96.8%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6438.1
Applied rewrites38.1%
Taylor expanded in a around 0
Applied rewrites27.6%
Final simplification35.5%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -2.8e+104) (not (<= t 0.00055))) (* b t) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -2.8e+104) || !(t <= 0.00055)) {
tmp = b * t;
} 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 ((t <= (-2.8d+104)) .or. (.not. (t <= 0.00055d0))) then
tmp = b * t
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 ((t <= -2.8e+104) || !(t <= 0.00055)) {
tmp = b * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -2.8e+104) or not (t <= 0.00055): tmp = b * t else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -2.8e+104) || !(t <= 0.00055)) tmp = Float64(b * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((t <= -2.8e+104) || ~((t <= 0.00055))) tmp = b * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -2.8e+104], N[Not[LessEqual[t, 0.00055]], $MachinePrecision]], N[(b * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.8 \cdot 10^{+104} \lor \neg \left(t \leq 0.00055\right):\\
\;\;\;\;b \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -2.8e104 or 5.50000000000000033e-4 < t Initial program 93.7%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6465.8
Applied rewrites65.8%
Taylor expanded in a around 0
Applied rewrites43.0%
if -2.8e104 < t < 5.50000000000000033e-4Initial program 97.9%
Taylor expanded in x around inf
Applied rewrites22.2%
Final simplification31.3%
(FPCore (x y z t a b) :precision binary64 (if (<= z -2.2e+130) z (if (<= z 9e+111) x z)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -2.2e+130) {
tmp = z;
} else if (z <= 9e+111) {
tmp = x;
} else {
tmp = z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (z <= (-2.2d+130)) then
tmp = z
else if (z <= 9d+111) then
tmp = x
else
tmp = z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -2.2e+130) {
tmp = z;
} else if (z <= 9e+111) {
tmp = x;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -2.2e+130: tmp = z elif z <= 9e+111: tmp = x else: tmp = z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -2.2e+130) tmp = z; elseif (z <= 9e+111) tmp = x; else tmp = z; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -2.2e+130) tmp = z; elseif (z <= 9e+111) tmp = x; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -2.2e+130], z, If[LessEqual[z, 9e+111], x, z]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.2 \cdot 10^{+130}:\\
\;\;\;\;z\\
\mathbf{elif}\;z \leq 9 \cdot 10^{+111}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if z < -2.19999999999999993e130 or 9.00000000000000001e111 < z Initial program 91.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6468.7
Applied rewrites68.7%
Taylor expanded in y around 0
Applied rewrites24.2%
if -2.19999999999999993e130 < z < 9.00000000000000001e111Initial program 98.2%
Taylor expanded in x around inf
Applied rewrites21.3%
(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 96.1%
Taylor expanded in x around inf
Applied rewrites16.4%
herbie shell --seed 2025037
(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)))