
(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 -2.0 b z) (fma (- b z) y x)) a))))
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(-2.0, b, z) + fma((b - z), y, x)) + a;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(x - Float64(Float64(y - 1.0) * z)) - Float64(Float64(t - 1.0) * a)) + Float64(Float64(Float64(y + t) - 2.0) * b)) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(Float64(fma(-2.0, b, z) + fma(Float64(b - z), y, x)) + a); 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[(N[(-2.0 * b + z), $MachinePrecision] + N[(N[(b - z), $MachinePrecision] * y + x), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(x - \left(y - 1\right) \cdot z\right) - \left(t - 1\right) \cdot a\right) + \left(\left(y + t\right) - 2\right) \cdot b\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(-2, b, z\right) + \mathsf{fma}\left(b - z, y, x\right)\right) + a\\
\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 y around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites35.3%
Taylor expanded in t around 0
Applied rewrites71.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -2.2e-9) (not (<= y 0.125))) (fma (- 1.0 t) a (fma (- (+ t y) 2.0) b (fma (- z) y z))) (fma (- t 2.0) b (+ (fma (- 1.0 t) a x) z))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -2.2e-9) || !(y <= 0.125)) {
tmp = fma((1.0 - t), a, fma(((t + y) - 2.0), b, fma(-z, y, z)));
} else {
tmp = fma((t - 2.0), b, (fma((1.0 - t), a, x) + z));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -2.2e-9) || !(y <= 0.125)) tmp = fma(Float64(1.0 - t), a, fma(Float64(Float64(t + y) - 2.0), b, fma(Float64(-z), y, z))); else tmp = fma(Float64(t - 2.0), b, Float64(fma(Float64(1.0 - t), a, x) + z)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -2.2e-9], N[Not[LessEqual[y, 0.125]], $MachinePrecision]], N[(N[(1.0 - t), $MachinePrecision] * a + N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + N[((-z) * y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t - 2.0), $MachinePrecision] * b + N[(N[(N[(1.0 - t), $MachinePrecision] * a + x), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.2 \cdot 10^{-9} \lor \neg \left(y \leq 0.125\right):\\
\;\;\;\;\mathsf{fma}\left(1 - t, a, \mathsf{fma}\left(\left(t + y\right) - 2, b, \mathsf{fma}\left(-z, y, z\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t - 2, b, \mathsf{fma}\left(1 - t, a, x\right) + z\right)\\
\end{array}
\end{array}
if y < -2.1999999999999998e-9 or 0.125 < y Initial program 89.2%
Taylor expanded in x around 0
Applied rewrites90.3%
if -2.1999999999999998e-9 < y < 0.125Initial program 98.3%
Taylor expanded in y around 0
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
associate--r+N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
*-lft-identityN/A
lower-+.f64N/A
Applied rewrites99.1%
Final simplification94.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (- (+ t y) 2.0)) (t_2 (fma t_1 b (- x (* (- y 1.0) z)))))
(if (<= b -3.5e-24)
t_2
(if (<= b 8.5e-31)
(- (fma (- 1.0 y) z x) (* (- t 1.0) a))
(if (<= b 2.1e+166) t_2 (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 t_2 = fma(t_1, b, (x - ((y - 1.0) * z)));
double tmp;
if (b <= -3.5e-24) {
tmp = t_2;
} else if (b <= 8.5e-31) {
tmp = fma((1.0 - y), z, x) - ((t - 1.0) * a);
} else if (b <= 2.1e+166) {
tmp = t_2;
} 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) t_2 = fma(t_1, b, Float64(x - Float64(Float64(y - 1.0) * z))) tmp = 0.0 if (b <= -3.5e-24) tmp = t_2; elseif (b <= 8.5e-31) tmp = Float64(fma(Float64(1.0 - y), z, x) - Float64(Float64(t - 1.0) * a)); elseif (b <= 2.1e+166) tmp = t_2; 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]}, Block[{t$95$2 = N[(t$95$1 * b + N[(x - N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -3.5e-24], t$95$2, If[LessEqual[b, 8.5e-31], N[(N[(N[(1.0 - y), $MachinePrecision] * z + x), $MachinePrecision] - N[(N[(t - 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.1e+166], t$95$2, 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\\
t_2 := \mathsf{fma}\left(t\_1, b, x - \left(y - 1\right) \cdot z\right)\\
\mathbf{if}\;b \leq -3.5 \cdot 10^{-24}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;b \leq 8.5 \cdot 10^{-31}:\\
\;\;\;\;\mathsf{fma}\left(1 - y, z, x\right) - \left(t - 1\right) \cdot a\\
\mathbf{elif}\;b \leq 2.1 \cdot 10^{+166}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 - t, a, \mathsf{fma}\left(t\_1, b, x\right)\right)\\
\end{array}
\end{array}
if b < -3.4999999999999996e-24 or 8.5000000000000007e-31 < b < 2.1000000000000001e166Initial program 88.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--.f6488.7
Applied rewrites88.7%
if -3.4999999999999996e-24 < b < 8.5000000000000007e-31Initial program 99.2%
Taylor expanded in y around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites99.2%
Taylor expanded in b around 0
Applied rewrites94.9%
if 2.1000000000000001e166 < b Initial program 84.6%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
associate-*r*N/A
Applied rewrites99.9%
(FPCore (x y z t a b) :precision binary64 (if (<= y 8e+178) (- (+ (fma (- b z) y (fma (- t 2.0) b x)) z) (* (- t 1.0) a)) (+ (+ (fma -2.0 b z) (fma (- b z) y x)) a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= 8e+178) {
tmp = (fma((b - z), y, fma((t - 2.0), b, x)) + z) - ((t - 1.0) * a);
} else {
tmp = (fma(-2.0, b, z) + fma((b - z), y, x)) + a;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= 8e+178) tmp = Float64(Float64(fma(Float64(b - z), y, fma(Float64(t - 2.0), b, x)) + z) - Float64(Float64(t - 1.0) * a)); else tmp = Float64(Float64(fma(-2.0, b, z) + fma(Float64(b - z), y, x)) + a); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, 8e+178], N[(N[(N[(N[(b - z), $MachinePrecision] * y + N[(N[(t - 2.0), $MachinePrecision] * b + x), $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision] - N[(N[(t - 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-2.0 * b + z), $MachinePrecision] + N[(N[(b - z), $MachinePrecision] * y + x), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 8 \cdot 10^{+178}:\\
\;\;\;\;\left(\mathsf{fma}\left(b - z, y, \mathsf{fma}\left(t - 2, b, x\right)\right) + z\right) - \left(t - 1\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(-2, b, z\right) + \mathsf{fma}\left(b - z, y, x\right)\right) + a\\
\end{array}
\end{array}
if y < 8.0000000000000004e178Initial program 95.7%
Taylor expanded in y around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites95.7%
if 8.0000000000000004e178 < y Initial program 70.8%
Taylor expanded in y around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites66.7%
Taylor expanded in t around 0
Applied rewrites100.0%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -6.4e-24) (not (<= b 1.15e+117))) (fma (- 1.0 t) a (fma (- (+ t y) 2.0) b x)) (- (fma (- 1.0 y) z x) (* (- t 1.0) a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -6.4e-24) || !(b <= 1.15e+117)) {
tmp = fma((1.0 - t), a, fma(((t + y) - 2.0), b, x));
} else {
tmp = fma((1.0 - y), z, x) - ((t - 1.0) * a);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -6.4e-24) || !(b <= 1.15e+117)) tmp = fma(Float64(1.0 - t), a, fma(Float64(Float64(t + y) - 2.0), b, x)); else tmp = Float64(fma(Float64(1.0 - y), z, x) - Float64(Float64(t - 1.0) * a)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -6.4e-24], N[Not[LessEqual[b, 1.15e+117]], $MachinePrecision]], N[(N[(1.0 - t), $MachinePrecision] * a + N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - y), $MachinePrecision] * z + x), $MachinePrecision] - N[(N[(t - 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -6.4 \cdot 10^{-24} \lor \neg \left(b \leq 1.15 \cdot 10^{+117}\right):\\
\;\;\;\;\mathsf{fma}\left(1 - t, a, \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 - y, z, x\right) - \left(t - 1\right) \cdot a\\
\end{array}
\end{array}
if b < -6.40000000000000025e-24 or 1.14999999999999994e117 < b Initial program 89.2%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
associate-*r*N/A
Applied rewrites90.4%
if -6.40000000000000025e-24 < b < 1.14999999999999994e117Initial program 96.5%
Taylor expanded in y around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites97.2%
Taylor expanded in b around 0
Applied rewrites90.4%
Final simplification90.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -6.4e-24) (not (<= b 1.3e-20))) (fma (- (+ t y) 2.0) b (+ x z)) (- (fma (- 1.0 y) z x) (* (- t 1.0) a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -6.4e-24) || !(b <= 1.3e-20)) {
tmp = fma(((t + y) - 2.0), b, (x + z));
} else {
tmp = fma((1.0 - y), z, x) - ((t - 1.0) * a);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -6.4e-24) || !(b <= 1.3e-20)) tmp = fma(Float64(Float64(t + y) - 2.0), b, Float64(x + z)); else tmp = Float64(fma(Float64(1.0 - y), z, x) - Float64(Float64(t - 1.0) * a)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -6.4e-24], N[Not[LessEqual[b, 1.3e-20]], $MachinePrecision]], N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + N[(x + z), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - y), $MachinePrecision] * z + x), $MachinePrecision] - N[(N[(t - 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -6.4 \cdot 10^{-24} \lor \neg \left(b \leq 1.3 \cdot 10^{-20}\right):\\
\;\;\;\;\mathsf{fma}\left(\left(t + y\right) - 2, b, x + z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 - y, z, x\right) - \left(t - 1\right) \cdot a\\
\end{array}
\end{array}
if b < -6.40000000000000025e-24 or 1.29999999999999997e-20 < b Initial program 87.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--.f6486.3
Applied rewrites86.3%
Taylor expanded in y around 0
Applied rewrites83.5%
if -6.40000000000000025e-24 < b < 1.29999999999999997e-20Initial program 99.2%
Taylor expanded in y around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites99.2%
Taylor expanded in b around 0
Applied rewrites95.0%
Final simplification89.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- t) a)))
(if (<= t -2.25e+49)
t_1
(if (<= t -0.06)
(* y b)
(if (<= t 6.2e-75) (+ a x) (if (<= t 440000000.0) (* (- z) y) t_1))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = -t * a;
double tmp;
if (t <= -2.25e+49) {
tmp = t_1;
} else if (t <= -0.06) {
tmp = y * b;
} else if (t <= 6.2e-75) {
tmp = a + x;
} else if (t <= 440000000.0) {
tmp = -z * y;
} 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 = -t * a
if (t <= (-2.25d+49)) then
tmp = t_1
else if (t <= (-0.06d0)) then
tmp = y * b
else if (t <= 6.2d-75) then
tmp = a + x
else if (t <= 440000000.0d0) then
tmp = -z * y
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 = -t * a;
double tmp;
if (t <= -2.25e+49) {
tmp = t_1;
} else if (t <= -0.06) {
tmp = y * b;
} else if (t <= 6.2e-75) {
tmp = a + x;
} else if (t <= 440000000.0) {
tmp = -z * y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = -t * a tmp = 0 if t <= -2.25e+49: tmp = t_1 elif t <= -0.06: tmp = y * b elif t <= 6.2e-75: tmp = a + x elif t <= 440000000.0: tmp = -z * y else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(-t) * a) tmp = 0.0 if (t <= -2.25e+49) tmp = t_1; elseif (t <= -0.06) tmp = Float64(y * b); elseif (t <= 6.2e-75) tmp = Float64(a + x); elseif (t <= 440000000.0) tmp = Float64(Float64(-z) * y); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = -t * a; tmp = 0.0; if (t <= -2.25e+49) tmp = t_1; elseif (t <= -0.06) tmp = y * b; elseif (t <= 6.2e-75) tmp = a + x; elseif (t <= 440000000.0) tmp = -z * y; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[((-t) * a), $MachinePrecision]}, If[LessEqual[t, -2.25e+49], t$95$1, If[LessEqual[t, -0.06], N[(y * b), $MachinePrecision], If[LessEqual[t, 6.2e-75], N[(a + x), $MachinePrecision], If[LessEqual[t, 440000000.0], N[((-z) * y), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-t\right) \cdot a\\
\mathbf{if}\;t \leq -2.25 \cdot 10^{+49}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -0.06:\\
\;\;\;\;y \cdot b\\
\mathbf{elif}\;t \leq 6.2 \cdot 10^{-75}:\\
\;\;\;\;a + x\\
\mathbf{elif}\;t \leq 440000000:\\
\;\;\;\;\left(-z\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.24999999999999991e49 or 4.4e8 < t Initial program 91.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6437.5
Applied rewrites37.5%
Taylor expanded in t around inf
Applied rewrites37.2%
if -2.24999999999999991e49 < t < -0.059999999999999998Initial program 86.7%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
associate-*r*N/A
Applied rewrites73.9%
Taylor expanded in y around inf
Applied rewrites42.1%
if -0.059999999999999998 < t < 6.20000000000000013e-75Initial program 97.9%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
associate-*r*N/A
Applied rewrites67.9%
Taylor expanded in t around 0
Applied rewrites67.1%
Taylor expanded in b around 0
Applied rewrites38.8%
if 6.20000000000000013e-75 < t < 4.4e8Initial program 92.7%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6472.8
Applied rewrites72.8%
Taylor expanded in z around inf
Applied rewrites65.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b z) y)))
(if (<= y -7e+61)
t_1
(if (<= y -1.1e-28)
(fma (- 1.0 t) a x)
(if (<= y 1.85e+15) (+ (fma (- t 2.0) b z) x) 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 <= -7e+61) {
tmp = t_1;
} else if (y <= -1.1e-28) {
tmp = fma((1.0 - t), a, x);
} else if (y <= 1.85e+15) {
tmp = fma((t - 2.0), b, z) + x;
} 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 <= -7e+61) tmp = t_1; elseif (y <= -1.1e-28) tmp = fma(Float64(1.0 - t), a, x); elseif (y <= 1.85e+15) tmp = Float64(fma(Float64(t - 2.0), b, z) + x); 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, -7e+61], t$95$1, If[LessEqual[y, -1.1e-28], N[(N[(1.0 - t), $MachinePrecision] * a + x), $MachinePrecision], If[LessEqual[y, 1.85e+15], N[(N[(N[(t - 2.0), $MachinePrecision] * b + z), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(b - z\right) \cdot y\\
\mathbf{if}\;y \leq -7 \cdot 10^{+61}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -1.1 \cdot 10^{-28}:\\
\;\;\;\;\mathsf{fma}\left(1 - t, a, x\right)\\
\mathbf{elif}\;y \leq 1.85 \cdot 10^{+15}:\\
\;\;\;\;\mathsf{fma}\left(t - 2, b, z\right) + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -7.00000000000000036e61 or 1.85e15 < y Initial program 87.9%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6472.0
Applied rewrites72.0%
if -7.00000000000000036e61 < y < -1.09999999999999998e-28Initial program 99.8%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
associate-*r*N/A
Applied rewrites89.5%
Taylor expanded in b around 0
Applied rewrites66.5%
if -1.09999999999999998e-28 < y < 1.85e15Initial program 98.3%
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--.f6474.7
Applied rewrites74.7%
Taylor expanded in y around 0
Applied rewrites74.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- (+ t y) 2.0) b)))
(if (<= b -6.4e-24)
t_1
(if (<= b 2.9e-28)
(fma (- 1.0 t) a x)
(if (<= b 5.8e+116) (* (- 1.0 y) z) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((t + y) - 2.0) * b;
double tmp;
if (b <= -6.4e-24) {
tmp = t_1;
} else if (b <= 2.9e-28) {
tmp = fma((1.0 - t), a, x);
} else if (b <= 5.8e+116) {
tmp = (1.0 - y) * z;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(t + y) - 2.0) * b) tmp = 0.0 if (b <= -6.4e-24) tmp = t_1; elseif (b <= 2.9e-28) tmp = fma(Float64(1.0 - t), a, x); elseif (b <= 5.8e+116) tmp = Float64(Float64(1.0 - y) * z); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[b, -6.4e-24], t$95$1, If[LessEqual[b, 2.9e-28], N[(N[(1.0 - t), $MachinePrecision] * a + x), $MachinePrecision], If[LessEqual[b, 5.8e+116], N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(t + y\right) - 2\right) \cdot b\\
\mathbf{if}\;b \leq -6.4 \cdot 10^{-24}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 2.9 \cdot 10^{-28}:\\
\;\;\;\;\mathsf{fma}\left(1 - t, a, x\right)\\
\mathbf{elif}\;b \leq 5.8 \cdot 10^{+116}:\\
\;\;\;\;\left(1 - y\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -6.40000000000000025e-24 or 5.8000000000000003e116 < b Initial program 89.2%
Taylor expanded in y around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites87.4%
Taylor expanded in t around 0
Applied rewrites61.5%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6478.3
Applied rewrites78.3%
if -6.40000000000000025e-24 < b < 2.90000000000000013e-28Initial program 99.2%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
associate-*r*N/A
Applied rewrites57.2%
Taylor expanded in b around 0
Applied rewrites52.8%
if 2.90000000000000013e-28 < b < 5.8000000000000003e116Initial program 81.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6452.9
Applied rewrites52.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -7.2e-30) (not (<= b 8e+51))) (fma (- (+ t y) 2.0) b (+ x z)) (+ (fma (- 1.0 y) z x) a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -7.2e-30) || !(b <= 8e+51)) {
tmp = fma(((t + y) - 2.0), b, (x + z));
} else {
tmp = fma((1.0 - y), z, x) + a;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -7.2e-30) || !(b <= 8e+51)) tmp = fma(Float64(Float64(t + y) - 2.0), b, Float64(x + z)); else tmp = Float64(fma(Float64(1.0 - y), z, x) + a); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -7.2e-30], N[Not[LessEqual[b, 8e+51]], $MachinePrecision]], N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + N[(x + z), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - y), $MachinePrecision] * z + x), $MachinePrecision] + a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -7.2 \cdot 10^{-30} \lor \neg \left(b \leq 8 \cdot 10^{+51}\right):\\
\;\;\;\;\mathsf{fma}\left(\left(t + y\right) - 2, b, x + z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 - y, z, x\right) + a\\
\end{array}
\end{array}
if b < -7.2000000000000006e-30 or 8e51 < b Initial program 88.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--.f6485.3
Applied rewrites85.3%
Taylor expanded in y around 0
Applied rewrites85.3%
if -7.2000000000000006e-30 < b < 8e51Initial program 97.7%
Taylor expanded in y around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites97.8%
Taylor expanded in t around 0
Applied rewrites75.8%
Taylor expanded in b around 0
Applied rewrites73.7%
Final simplification79.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b a) t)))
(if (<= t -5.9e+29)
t_1
(if (<= t 4.4e-74)
(+ (fma (- y 2.0) b x) a)
(if (<= t 3100000000.0) (* (- b z) y) 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.9e+29) {
tmp = t_1;
} else if (t <= 4.4e-74) {
tmp = fma((y - 2.0), b, x) + a;
} else if (t <= 3100000000.0) {
tmp = (b - z) * y;
} 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.9e+29) tmp = t_1; elseif (t <= 4.4e-74) tmp = Float64(fma(Float64(y - 2.0), b, x) + a); elseif (t <= 3100000000.0) tmp = Float64(Float64(b - z) * y); 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.9e+29], t$95$1, If[LessEqual[t, 4.4e-74], N[(N[(N[(y - 2.0), $MachinePrecision] * b + x), $MachinePrecision] + a), $MachinePrecision], If[LessEqual[t, 3100000000.0], N[(N[(b - z), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(b - a\right) \cdot t\\
\mathbf{if}\;t \leq -5.9 \cdot 10^{+29}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 4.4 \cdot 10^{-74}:\\
\;\;\;\;\mathsf{fma}\left(y - 2, b, x\right) + a\\
\mathbf{elif}\;t \leq 3100000000:\\
\;\;\;\;\left(b - z\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -5.8999999999999999e29 or 3.1e9 < t Initial program 90.5%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6463.5
Applied rewrites63.5%
if -5.8999999999999999e29 < t < 4.40000000000000021e-74Initial program 97.1%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
associate-*r*N/A
Applied rewrites68.2%
Taylor expanded in t around 0
Applied rewrites65.7%
if 4.40000000000000021e-74 < t < 3.1e9Initial program 93.2%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6468.5
Applied rewrites68.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b a) t)))
(if (<= t -0.112)
t_1
(if (<= t -1.8e-217)
(+ a x)
(if (<= t 3100000000.0) (* (- 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 <= -0.112) {
tmp = t_1;
} else if (t <= -1.8e-217) {
tmp = a + x;
} else if (t <= 3100000000.0) {
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 <= (-0.112d0)) then
tmp = t_1
else if (t <= (-1.8d-217)) then
tmp = a + x
else if (t <= 3100000000.0d0) 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 <= -0.112) {
tmp = t_1;
} else if (t <= -1.8e-217) {
tmp = a + x;
} else if (t <= 3100000000.0) {
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 <= -0.112: tmp = t_1 elif t <= -1.8e-217: tmp = a + x elif t <= 3100000000.0: 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 <= -0.112) tmp = t_1; elseif (t <= -1.8e-217) tmp = Float64(a + x); elseif (t <= 3100000000.0) 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 <= -0.112) tmp = t_1; elseif (t <= -1.8e-217) tmp = a + x; elseif (t <= 3100000000.0) 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, -0.112], t$95$1, If[LessEqual[t, -1.8e-217], N[(a + x), $MachinePrecision], If[LessEqual[t, 3100000000.0], 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 -0.112:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -1.8 \cdot 10^{-217}:\\
\;\;\;\;a + x\\
\mathbf{elif}\;t \leq 3100000000:\\
\;\;\;\;\left(1 - y\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -0.112000000000000002 or 3.1e9 < t Initial program 90.5%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6460.7
Applied rewrites60.7%
if -0.112000000000000002 < t < -1.79999999999999991e-217Initial program 97.6%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
associate-*r*N/A
Applied rewrites71.4%
Taylor expanded in t around 0
Applied rewrites69.5%
Taylor expanded in b around 0
Applied rewrites47.1%
if -1.79999999999999991e-217 < t < 3.1e9Initial program 97.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6443.8
Applied rewrites43.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- 1.0 t) a)))
(if (<= a -3.8e+57)
t_1
(if (<= a -3.4e-159)
(* (- z) y)
(if (<= a 9.4e+97) (* (- y 2.0) b) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (1.0 - t) * a;
double tmp;
if (a <= -3.8e+57) {
tmp = t_1;
} else if (a <= -3.4e-159) {
tmp = -z * y;
} else if (a <= 9.4e+97) {
tmp = (y - 2.0) * b;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = (1.0d0 - t) * a
if (a <= (-3.8d+57)) then
tmp = t_1
else if (a <= (-3.4d-159)) then
tmp = -z * y
else if (a <= 9.4d+97) then
tmp = (y - 2.0d0) * b
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (1.0 - t) * a;
double tmp;
if (a <= -3.8e+57) {
tmp = t_1;
} else if (a <= -3.4e-159) {
tmp = -z * y;
} else if (a <= 9.4e+97) {
tmp = (y - 2.0) * b;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (1.0 - t) * a tmp = 0 if a <= -3.8e+57: tmp = t_1 elif a <= -3.4e-159: tmp = -z * y elif a <= 9.4e+97: tmp = (y - 2.0) * b else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(1.0 - t) * a) tmp = 0.0 if (a <= -3.8e+57) tmp = t_1; elseif (a <= -3.4e-159) tmp = Float64(Float64(-z) * y); elseif (a <= 9.4e+97) tmp = Float64(Float64(y - 2.0) * b); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (1.0 - t) * a; tmp = 0.0; if (a <= -3.8e+57) tmp = t_1; elseif (a <= -3.4e-159) tmp = -z * y; elseif (a <= 9.4e+97) tmp = (y - 2.0) * b; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(1.0 - t), $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[a, -3.8e+57], t$95$1, If[LessEqual[a, -3.4e-159], N[((-z) * y), $MachinePrecision], If[LessEqual[a, 9.4e+97], N[(N[(y - 2.0), $MachinePrecision] * b), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(1 - t\right) \cdot a\\
\mathbf{if}\;a \leq -3.8 \cdot 10^{+57}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq -3.4 \cdot 10^{-159}:\\
\;\;\;\;\left(-z\right) \cdot y\\
\mathbf{elif}\;a \leq 9.4 \cdot 10^{+97}:\\
\;\;\;\;\left(y - 2\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -3.7999999999999999e57 or 9.3999999999999994e97 < a Initial program 89.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6462.1
Applied rewrites62.1%
if -3.7999999999999999e57 < a < -3.39999999999999984e-159Initial program 96.1%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6444.1
Applied rewrites44.1%
Taylor expanded in z around inf
Applied rewrites34.5%
if -3.39999999999999984e-159 < a < 9.3999999999999994e97Initial program 95.6%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
associate-*r*N/A
Applied rewrites69.7%
Taylor expanded in t around 0
Applied rewrites44.7%
Taylor expanded in x around 0
Applied rewrites27.5%
Taylor expanded in a around 0
Applied rewrites26.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- t) a)))
(if (<= t -2.25e+49)
t_1
(if (<= t -0.06) (* y b) (if (<= t 3100000000.0) (+ a x) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = -t * a;
double tmp;
if (t <= -2.25e+49) {
tmp = t_1;
} else if (t <= -0.06) {
tmp = y * b;
} else if (t <= 3100000000.0) {
tmp = a + x;
} 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 = -t * a
if (t <= (-2.25d+49)) then
tmp = t_1
else if (t <= (-0.06d0)) then
tmp = y * b
else if (t <= 3100000000.0d0) then
tmp = a + x
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 = -t * a;
double tmp;
if (t <= -2.25e+49) {
tmp = t_1;
} else if (t <= -0.06) {
tmp = y * b;
} else if (t <= 3100000000.0) {
tmp = a + x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = -t * a tmp = 0 if t <= -2.25e+49: tmp = t_1 elif t <= -0.06: tmp = y * b elif t <= 3100000000.0: tmp = a + x else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(-t) * a) tmp = 0.0 if (t <= -2.25e+49) tmp = t_1; elseif (t <= -0.06) tmp = Float64(y * b); elseif (t <= 3100000000.0) tmp = Float64(a + x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = -t * a; tmp = 0.0; if (t <= -2.25e+49) tmp = t_1; elseif (t <= -0.06) tmp = y * b; elseif (t <= 3100000000.0) tmp = a + x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[((-t) * a), $MachinePrecision]}, If[LessEqual[t, -2.25e+49], t$95$1, If[LessEqual[t, -0.06], N[(y * b), $MachinePrecision], If[LessEqual[t, 3100000000.0], N[(a + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-t\right) \cdot a\\
\mathbf{if}\;t \leq -2.25 \cdot 10^{+49}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -0.06:\\
\;\;\;\;y \cdot b\\
\mathbf{elif}\;t \leq 3100000000:\\
\;\;\;\;a + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.24999999999999991e49 or 3.1e9 < t Initial program 90.9%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6437.7
Applied rewrites37.7%
Taylor expanded in t around inf
Applied rewrites37.5%
if -2.24999999999999991e49 < t < -0.059999999999999998Initial program 86.7%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
associate-*r*N/A
Applied rewrites73.9%
Taylor expanded in y around inf
Applied rewrites42.1%
if -0.059999999999999998 < t < 3.1e9Initial program 97.2%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
associate-*r*N/A
Applied rewrites63.4%
Taylor expanded in t around 0
Applied rewrites62.4%
Taylor expanded in b around 0
Applied rewrites35.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -6.4e-24) (not (<= b 8.5e+124))) (* (- (+ t y) 2.0) b) (+ (fma (- 1.0 y) z x) a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -6.4e-24) || !(b <= 8.5e+124)) {
tmp = ((t + y) - 2.0) * b;
} else {
tmp = fma((1.0 - y), z, x) + a;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -6.4e-24) || !(b <= 8.5e+124)) tmp = Float64(Float64(Float64(t + y) - 2.0) * b); else tmp = Float64(fma(Float64(1.0 - y), z, x) + a); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -6.4e-24], N[Not[LessEqual[b, 8.5e+124]], $MachinePrecision]], N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision], N[(N[(N[(1.0 - y), $MachinePrecision] * z + x), $MachinePrecision] + a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -6.4 \cdot 10^{-24} \lor \neg \left(b \leq 8.5 \cdot 10^{+124}\right):\\
\;\;\;\;\left(\left(t + y\right) - 2\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 - y, z, x\right) + a\\
\end{array}
\end{array}
if b < -6.40000000000000025e-24 or 8.4999999999999997e124 < b Initial program 89.1%
Taylor expanded in y around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites87.3%
Taylor expanded in t around 0
Applied rewrites61.2%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6479.0
Applied rewrites79.0%
if -6.40000000000000025e-24 < b < 8.4999999999999997e124Initial program 96.6%
Taylor expanded in y around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites97.3%
Taylor expanded in t around 0
Applied rewrites75.6%
Taylor expanded in b around 0
Applied rewrites72.4%
Final simplification75.2%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -7e+61) (not (<= y 7.2e+19))) (* (- 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 <= -7e+61) || !(y <= 7.2e+19)) {
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 <= -7e+61) || !(y <= 7.2e+19)) 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, -7e+61], N[Not[LessEqual[y, 7.2e+19]], $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 -7 \cdot 10^{+61} \lor \neg \left(y \leq 7.2 \cdot 10^{+19}\right):\\
\;\;\;\;\left(b - z\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 - t, a, x\right)\\
\end{array}
\end{array}
if y < -7.00000000000000036e61 or 7.2e19 < y Initial program 87.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6472.6
Applied rewrites72.6%
if -7.00000000000000036e61 < y < 7.2e19Initial program 98.5%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
associate-*r*N/A
Applied rewrites77.9%
Taylor expanded in b around 0
Applied rewrites52.2%
Final simplification62.0%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -1.9e+63) (not (<= y 6.6e+31))) (* (- 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.9e+63) || !(y <= 6.6e+31)) {
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.9d+63)) .or. (.not. (y <= 6.6d+31))) 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.9e+63) || !(y <= 6.6e+31)) {
tmp = (b - z) * y;
} else {
tmp = (b - a) * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -1.9e+63) or not (y <= 6.6e+31): 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.9e+63) || !(y <= 6.6e+31)) 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.9e+63) || ~((y <= 6.6e+31))) 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.9e+63], N[Not[LessEqual[y, 6.6e+31]], $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.9 \cdot 10^{+63} \lor \neg \left(y \leq 6.6 \cdot 10^{+31}\right):\\
\;\;\;\;\left(b - z\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(b - a\right) \cdot t\\
\end{array}
\end{array}
if y < -1.9000000000000001e63 or 6.59999999999999985e31 < y Initial program 87.5%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6473.5
Applied rewrites73.5%
if -1.9000000000000001e63 < y < 6.59999999999999985e31Initial program 98.5%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6444.0
Applied rewrites44.0%
Final simplification57.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -2.35e-20) (not (<= z 2.9e+130))) (* (- 1.0 y) z) (* (- 1.0 t) a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -2.35e-20) || !(z <= 2.9e+130)) {
tmp = (1.0 - y) * z;
} else {
tmp = (1.0 - t) * a;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((z <= (-2.35d-20)) .or. (.not. (z <= 2.9d+130))) then
tmp = (1.0d0 - y) * z
else
tmp = (1.0d0 - t) * a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -2.35e-20) || !(z <= 2.9e+130)) {
tmp = (1.0 - y) * z;
} else {
tmp = (1.0 - t) * a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -2.35e-20) or not (z <= 2.9e+130): tmp = (1.0 - y) * z else: tmp = (1.0 - t) * a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -2.35e-20) || !(z <= 2.9e+130)) tmp = Float64(Float64(1.0 - y) * z); else tmp = Float64(Float64(1.0 - t) * a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -2.35e-20) || ~((z <= 2.9e+130))) tmp = (1.0 - y) * z; else tmp = (1.0 - t) * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -2.35e-20], N[Not[LessEqual[z, 2.9e+130]], $MachinePrecision]], N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision], N[(N[(1.0 - t), $MachinePrecision] * a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.35 \cdot 10^{-20} \lor \neg \left(z \leq 2.9 \cdot 10^{+130}\right):\\
\;\;\;\;\left(1 - y\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;\left(1 - t\right) \cdot a\\
\end{array}
\end{array}
if z < -2.35000000000000007e-20 or 2.8999999999999999e130 < z Initial program 88.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6458.0
Applied rewrites58.0%
if -2.35000000000000007e-20 < z < 2.8999999999999999e130Initial program 96.7%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6438.6
Applied rewrites38.6%
Final simplification46.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -1.65e+45) (not (<= b 1.2e+55))) (* (- y 2.0) b) (* (- z) y)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -1.65e+45) || !(b <= 1.2e+55)) {
tmp = (y - 2.0) * b;
} else {
tmp = -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 <= (-1.65d+45)) .or. (.not. (b <= 1.2d+55))) then
tmp = (y - 2.0d0) * b
else
tmp = -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 <= -1.65e+45) || !(b <= 1.2e+55)) {
tmp = (y - 2.0) * b;
} else {
tmp = -z * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (b <= -1.65e+45) or not (b <= 1.2e+55): tmp = (y - 2.0) * b else: tmp = -z * y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -1.65e+45) || !(b <= 1.2e+55)) tmp = Float64(Float64(y - 2.0) * b); else tmp = Float64(Float64(-z) * y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((b <= -1.65e+45) || ~((b <= 1.2e+55))) tmp = (y - 2.0) * b; else tmp = -z * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -1.65e+45], N[Not[LessEqual[b, 1.2e+55]], $MachinePrecision]], N[(N[(y - 2.0), $MachinePrecision] * b), $MachinePrecision], N[((-z) * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.65 \cdot 10^{+45} \lor \neg \left(b \leq 1.2 \cdot 10^{+55}\right):\\
\;\;\;\;\left(y - 2\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(-z\right) \cdot y\\
\end{array}
\end{array}
if b < -1.65e45 or 1.2e55 < b Initial program 87.5%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
associate-*r*N/A
Applied rewrites87.0%
Taylor expanded in t around 0
Applied rewrites52.7%
Taylor expanded in x around 0
Applied rewrites49.2%
Taylor expanded in a around 0
Applied rewrites45.0%
if -1.65e45 < b < 1.2e55Initial program 97.9%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6433.9
Applied rewrites33.9%
Taylor expanded in z around inf
Applied rewrites31.8%
Final simplification37.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -2.1e+48) (not (<= b 4.8e+57))) (* y b) (+ a x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -2.1e+48) || !(b <= 4.8e+57)) {
tmp = y * b;
} 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 ((b <= (-2.1d+48)) .or. (.not. (b <= 4.8d+57))) then
tmp = y * b
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 ((b <= -2.1e+48) || !(b <= 4.8e+57)) {
tmp = y * b;
} else {
tmp = a + x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (b <= -2.1e+48) or not (b <= 4.8e+57): tmp = y * b else: tmp = a + x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -2.1e+48) || !(b <= 4.8e+57)) tmp = Float64(y * b); else tmp = Float64(a + x); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((b <= -2.1e+48) || ~((b <= 4.8e+57))) tmp = y * b; else tmp = a + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -2.1e+48], N[Not[LessEqual[b, 4.8e+57]], $MachinePrecision]], N[(y * b), $MachinePrecision], N[(a + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.1 \cdot 10^{+48} \lor \neg \left(b \leq 4.8 \cdot 10^{+57}\right):\\
\;\;\;\;y \cdot b\\
\mathbf{else}:\\
\;\;\;\;a + x\\
\end{array}
\end{array}
if b < -2.0999999999999998e48 or 4.80000000000000009e57 < b Initial program 87.4%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
associate-*r*N/A
Applied rewrites86.9%
Taylor expanded in y around inf
Applied rewrites38.3%
if -2.0999999999999998e48 < b < 4.80000000000000009e57Initial program 97.9%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
associate-*r*N/A
Applied rewrites58.0%
Taylor expanded in t around 0
Applied rewrites31.5%
Taylor expanded in b around 0
Applied rewrites28.4%
Final simplification32.7%
(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 93.3%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
mul-1-negN/A
associate-*r*N/A
Applied rewrites70.5%
Taylor expanded in t around 0
Applied rewrites40.5%
Taylor expanded in b around 0
Applied rewrites20.7%
herbie shell --seed 2025016
(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)))