
(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 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (+ (- (- x (* (- y 1.0) z)) (* (- t 1.0) a)) (* (- (+ y t) 2.0) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((x - ((y - 1.0d0) * z)) - ((t - 1.0d0) * a)) + (((y + t) - 2.0d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b);
}
def code(x, y, z, t, a, b): return ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x - Float64(Float64(y - 1.0) * z)) - Float64(Float64(t - 1.0) * a)) + Float64(Float64(Float64(y + t) - 2.0) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x - N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] - N[(N[(t - 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - \left(y - 1\right) \cdot z\right) - \left(t - 1\right) \cdot a\right) + \left(\left(y + t\right) - 2\right) \cdot b
\end{array}
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1
(+ (- (- x (* (- y 1.0) z)) (* (- t 1.0) a)) (* (- (+ y t) 2.0) b))))
(if (<= t_1 INFINITY) t_1 (* (- b a) t))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b);
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = (b - a) * t;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b);
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = (b - a) * t;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b) tmp = 0 if t_1 <= math.inf: tmp = t_1 else: tmp = (b - a) * t return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(x - Float64(Float64(y - 1.0) * z)) - Float64(Float64(t - 1.0) * a)) + Float64(Float64(Float64(y + t) - 2.0) * b)) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(Float64(b - a) * t); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b); tmp = 0.0; if (t_1 <= Inf) tmp = t_1; else tmp = (b - a) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(x - N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] - N[(N[(t - 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(x - \left(y - 1\right) \cdot z\right) - \left(t - 1\right) \cdot a\right) + \left(\left(y + t\right) - 2\right) \cdot b\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(b - a\right) \cdot t\\
\end{array}
\end{array}
if (+.f64 (-.f64 (-.f64 x (*.f64 (-.f64 y #s(literal 1 binary64)) z)) (*.f64 (-.f64 t #s(literal 1 binary64)) a)) (*.f64 (-.f64 (+.f64 y t) #s(literal 2 binary64)) b)) < +inf.0Initial program 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 t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6492.9
Applied rewrites92.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -2.45e+92) (not (<= t 3.4e+153))) (* (- b a) t) (fma (- y 2.0) b (- x (fma (- y 1.0) z (- a))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -2.45e+92) || !(t <= 3.4e+153)) {
tmp = (b - a) * t;
} else {
tmp = fma((y - 2.0), b, (x - fma((y - 1.0), z, -a)));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -2.45e+92) || !(t <= 3.4e+153)) tmp = Float64(Float64(b - a) * t); else tmp = fma(Float64(y - 2.0), b, Float64(x - fma(Float64(y - 1.0), z, Float64(-a)))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -2.45e+92], N[Not[LessEqual[t, 3.4e+153]], $MachinePrecision]], N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision], N[(N[(y - 2.0), $MachinePrecision] * b + N[(x - N[(N[(y - 1.0), $MachinePrecision] * z + (-a)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.45 \cdot 10^{+92} \lor \neg \left(t \leq 3.4 \cdot 10^{+153}\right):\\
\;\;\;\;\left(b - a\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y - 2, b, x - \mathsf{fma}\left(y - 1, z, -a\right)\right)\\
\end{array}
\end{array}
if t < -2.4500000000000001e92 or 3.3999999999999997e153 < t Initial program 87.8%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6481.3
Applied rewrites81.3%
if -2.4500000000000001e92 < t < 3.3999999999999997e153Initial program 98.7%
Taylor expanded in t around 0
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6489.4
Applied rewrites89.4%
Final simplification86.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b a) t)))
(if (<= t -1.7e+95)
t_1
(if (<= t -5.5e+18)
(+ (* (- z) y) (* (- (+ y t) 2.0) b))
(if (<= t 4.1e+86) (fma (- y 2.0) b (+ a x)) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (b - a) * t;
double tmp;
if (t <= -1.7e+95) {
tmp = t_1;
} else if (t <= -5.5e+18) {
tmp = (-z * y) + (((y + t) - 2.0) * b);
} else if (t <= 4.1e+86) {
tmp = fma((y - 2.0), b, (a + x));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(b - a) * t) tmp = 0.0 if (t <= -1.7e+95) tmp = t_1; elseif (t <= -5.5e+18) tmp = Float64(Float64(Float64(-z) * y) + Float64(Float64(Float64(y + t) - 2.0) * b)); elseif (t <= 4.1e+86) tmp = fma(Float64(y - 2.0), b, Float64(a + x)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -1.7e+95], t$95$1, If[LessEqual[t, -5.5e+18], N[(N[((-z) * y), $MachinePrecision] + N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4.1e+86], N[(N[(y - 2.0), $MachinePrecision] * b + N[(a + x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(b - a\right) \cdot t\\
\mathbf{if}\;t \leq -1.7 \cdot 10^{+95}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -5.5 \cdot 10^{+18}:\\
\;\;\;\;\left(-z\right) \cdot y + \left(\left(y + t\right) - 2\right) \cdot b\\
\mathbf{elif}\;t \leq 4.1 \cdot 10^{+86}:\\
\;\;\;\;\mathsf{fma}\left(y - 2, b, a + x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.70000000000000011e95 or 4.0999999999999999e86 < t Initial program 88.4%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6477.7
Applied rewrites77.7%
if -1.70000000000000011e95 < t < -5.5e18Initial program 93.3%
Taylor expanded in y around inf
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6468.0
Applied rewrites68.0%
if -5.5e18 < t < 4.0999999999999999e86Initial program 100.0%
Taylor expanded in t around 0
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6494.5
Applied rewrites94.5%
Taylor expanded in z around 0
Applied rewrites64.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- 1.0 y) z)) (t_2 (* (- b a) t)))
(if (<= t -1.1e+92)
t_2
(if (<= t -2.6e-254)
t_1
(if (<= t 2e-243) (* (- y 2.0) b) (if (<= t 115.0) t_1 t_2))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (1.0 - y) * z;
double t_2 = (b - a) * t;
double tmp;
if (t <= -1.1e+92) {
tmp = t_2;
} else if (t <= -2.6e-254) {
tmp = t_1;
} else if (t <= 2e-243) {
tmp = (y - 2.0) * b;
} else if (t <= 115.0) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (1.0d0 - y) * z
t_2 = (b - a) * t
if (t <= (-1.1d+92)) then
tmp = t_2
else if (t <= (-2.6d-254)) then
tmp = t_1
else if (t <= 2d-243) then
tmp = (y - 2.0d0) * b
else if (t <= 115.0d0) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (1.0 - y) * z;
double t_2 = (b - a) * t;
double tmp;
if (t <= -1.1e+92) {
tmp = t_2;
} else if (t <= -2.6e-254) {
tmp = t_1;
} else if (t <= 2e-243) {
tmp = (y - 2.0) * b;
} else if (t <= 115.0) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (1.0 - y) * z t_2 = (b - a) * t tmp = 0 if t <= -1.1e+92: tmp = t_2 elif t <= -2.6e-254: tmp = t_1 elif t <= 2e-243: tmp = (y - 2.0) * b elif t <= 115.0: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(1.0 - y) * z) t_2 = Float64(Float64(b - a) * t) tmp = 0.0 if (t <= -1.1e+92) tmp = t_2; elseif (t <= -2.6e-254) tmp = t_1; elseif (t <= 2e-243) tmp = Float64(Float64(y - 2.0) * b); elseif (t <= 115.0) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (1.0 - y) * z; t_2 = (b - a) * t; tmp = 0.0; if (t <= -1.1e+92) tmp = t_2; elseif (t <= -2.6e-254) tmp = t_1; elseif (t <= 2e-243) tmp = (y - 2.0) * b; elseif (t <= 115.0) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$2 = N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -1.1e+92], t$95$2, If[LessEqual[t, -2.6e-254], t$95$1, If[LessEqual[t, 2e-243], N[(N[(y - 2.0), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[t, 115.0], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(1 - y\right) \cdot z\\
t_2 := \left(b - a\right) \cdot t\\
\mathbf{if}\;t \leq -1.1 \cdot 10^{+92}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq -2.6 \cdot 10^{-254}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2 \cdot 10^{-243}:\\
\;\;\;\;\left(y - 2\right) \cdot b\\
\mathbf{elif}\;t \leq 115:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if t < -1.09999999999999996e92 or 115 < t Initial program 90.2%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6471.1
Applied rewrites71.1%
if -1.09999999999999996e92 < t < -2.6e-254 or 1.99999999999999999e-243 < t < 115Initial program 99.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6443.6
Applied rewrites43.6%
if -2.6e-254 < t < 1.99999999999999999e-243Initial program 99.9%
Taylor expanded in t around 0
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f64100.0
Applied rewrites100.0%
Taylor expanded in b around inf
Applied rewrites50.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- t) a)) (t_2 (* (- z) y)))
(if (<= y -4.4e+30)
t_2
(if (<= y -5e-113)
t_1
(if (<= y 3.7e-159) (* b t) (if (<= y 4.4e+50) t_1 t_2))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = -t * a;
double t_2 = -z * y;
double tmp;
if (y <= -4.4e+30) {
tmp = t_2;
} else if (y <= -5e-113) {
tmp = t_1;
} else if (y <= 3.7e-159) {
tmp = b * t;
} else if (y <= 4.4e+50) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = -t * a
t_2 = -z * y
if (y <= (-4.4d+30)) then
tmp = t_2
else if (y <= (-5d-113)) then
tmp = t_1
else if (y <= 3.7d-159) then
tmp = b * t
else if (y <= 4.4d+50) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = -t * a;
double t_2 = -z * y;
double tmp;
if (y <= -4.4e+30) {
tmp = t_2;
} else if (y <= -5e-113) {
tmp = t_1;
} else if (y <= 3.7e-159) {
tmp = b * t;
} else if (y <= 4.4e+50) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = -t * a t_2 = -z * y tmp = 0 if y <= -4.4e+30: tmp = t_2 elif y <= -5e-113: tmp = t_1 elif y <= 3.7e-159: tmp = b * t elif y <= 4.4e+50: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(-t) * a) t_2 = Float64(Float64(-z) * y) tmp = 0.0 if (y <= -4.4e+30) tmp = t_2; elseif (y <= -5e-113) tmp = t_1; elseif (y <= 3.7e-159) tmp = Float64(b * t); elseif (y <= 4.4e+50) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = -t * a; t_2 = -z * y; tmp = 0.0; if (y <= -4.4e+30) tmp = t_2; elseif (y <= -5e-113) tmp = t_1; elseif (y <= 3.7e-159) tmp = b * t; elseif (y <= 4.4e+50) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[((-t) * a), $MachinePrecision]}, Block[{t$95$2 = N[((-z) * y), $MachinePrecision]}, If[LessEqual[y, -4.4e+30], t$95$2, If[LessEqual[y, -5e-113], t$95$1, If[LessEqual[y, 3.7e-159], N[(b * t), $MachinePrecision], If[LessEqual[y, 4.4e+50], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-t\right) \cdot a\\
t_2 := \left(-z\right) \cdot y\\
\mathbf{if}\;y \leq -4.4 \cdot 10^{+30}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq -5 \cdot 10^{-113}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 3.7 \cdot 10^{-159}:\\
\;\;\;\;b \cdot t\\
\mathbf{elif}\;y \leq 4.4 \cdot 10^{+50}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if y < -4.4e30 or 4.40000000000000034e50 < y Initial program 92.5%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6471.7
Applied rewrites71.7%
Taylor expanded in z around inf
Applied rewrites49.9%
if -4.4e30 < y < -4.9999999999999997e-113 or 3.6999999999999999e-159 < y < 4.40000000000000034e50Initial program 96.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6444.9
Applied rewrites44.9%
Taylor expanded in t around inf
Applied rewrites33.6%
if -4.9999999999999997e-113 < y < 3.6999999999999999e-159Initial program 95.9%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6449.0
Applied rewrites49.0%
Taylor expanded in a around 0
Applied rewrites35.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- t 2.0) b)))
(if (<= b -1.02e+51)
t_1
(if (<= b 3.65e-227)
(* (- 1.0 y) z)
(if (<= b 1.85e+111) (* (- 1.0 t) a) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - 2.0) * b;
double tmp;
if (b <= -1.02e+51) {
tmp = t_1;
} else if (b <= 3.65e-227) {
tmp = (1.0 - y) * z;
} else if (b <= 1.85e+111) {
tmp = (1.0 - t) * a;
} 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 - 2.0d0) * b
if (b <= (-1.02d+51)) then
tmp = t_1
else if (b <= 3.65d-227) then
tmp = (1.0d0 - y) * z
else if (b <= 1.85d+111) then
tmp = (1.0d0 - t) * a
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 - 2.0) * b;
double tmp;
if (b <= -1.02e+51) {
tmp = t_1;
} else if (b <= 3.65e-227) {
tmp = (1.0 - y) * z;
} else if (b <= 1.85e+111) {
tmp = (1.0 - t) * a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (t - 2.0) * b tmp = 0 if b <= -1.02e+51: tmp = t_1 elif b <= 3.65e-227: tmp = (1.0 - y) * z elif b <= 1.85e+111: tmp = (1.0 - t) * a else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - 2.0) * b) tmp = 0.0 if (b <= -1.02e+51) tmp = t_1; elseif (b <= 3.65e-227) tmp = Float64(Float64(1.0 - y) * z); elseif (b <= 1.85e+111) tmp = Float64(Float64(1.0 - t) * a); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (t - 2.0) * b; tmp = 0.0; if (b <= -1.02e+51) tmp = t_1; elseif (b <= 3.65e-227) tmp = (1.0 - y) * z; elseif (b <= 1.85e+111) tmp = (1.0 - t) * a; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - 2.0), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[b, -1.02e+51], t$95$1, If[LessEqual[b, 3.65e-227], N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[b, 1.85e+111], N[(N[(1.0 - t), $MachinePrecision] * a), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t - 2\right) \cdot b\\
\mathbf{if}\;b \leq -1.02 \cdot 10^{+51}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 3.65 \cdot 10^{-227}:\\
\;\;\;\;\left(1 - y\right) \cdot z\\
\mathbf{elif}\;b \leq 1.85 \cdot 10^{+111}:\\
\;\;\;\;\left(1 - t\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -1.02e51 or 1.8500000000000001e111 < b Initial program 87.6%
Taylor expanded in t around 0
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6453.0
Applied rewrites53.0%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6482.5
Applied rewrites82.5%
Taylor expanded in y around 0
Applied rewrites59.6%
if -1.02e51 < b < 3.6500000000000001e-227Initial program 96.5%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6444.5
Applied rewrites44.5%
if 3.6500000000000001e-227 < b < 1.8500000000000001e111Initial program 100.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6439.3
Applied rewrites39.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- z) y)))
(if (<= y -1.05e+35)
t_1
(if (<= y 6.5e-59) (* (- t 2.0) b) (if (<= y 4.4e+50) (* (- t) a) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = -z * y;
double tmp;
if (y <= -1.05e+35) {
tmp = t_1;
} else if (y <= 6.5e-59) {
tmp = (t - 2.0) * b;
} else if (y <= 4.4e+50) {
tmp = -t * a;
} 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 = -z * y
if (y <= (-1.05d+35)) then
tmp = t_1
else if (y <= 6.5d-59) then
tmp = (t - 2.0d0) * b
else if (y <= 4.4d+50) then
tmp = -t * a
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 = -z * y;
double tmp;
if (y <= -1.05e+35) {
tmp = t_1;
} else if (y <= 6.5e-59) {
tmp = (t - 2.0) * b;
} else if (y <= 4.4e+50) {
tmp = -t * a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = -z * y tmp = 0 if y <= -1.05e+35: tmp = t_1 elif y <= 6.5e-59: tmp = (t - 2.0) * b elif y <= 4.4e+50: tmp = -t * a else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(-z) * y) tmp = 0.0 if (y <= -1.05e+35) tmp = t_1; elseif (y <= 6.5e-59) tmp = Float64(Float64(t - 2.0) * b); elseif (y <= 4.4e+50) tmp = Float64(Float64(-t) * a); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = -z * y; tmp = 0.0; if (y <= -1.05e+35) tmp = t_1; elseif (y <= 6.5e-59) tmp = (t - 2.0) * b; elseif (y <= 4.4e+50) tmp = -t * a; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[((-z) * y), $MachinePrecision]}, If[LessEqual[y, -1.05e+35], t$95$1, If[LessEqual[y, 6.5e-59], N[(N[(t - 2.0), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[y, 4.4e+50], N[((-t) * a), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-z\right) \cdot y\\
\mathbf{if}\;y \leq -1.05 \cdot 10^{+35}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 6.5 \cdot 10^{-59}:\\
\;\;\;\;\left(t - 2\right) \cdot b\\
\mathbf{elif}\;y \leq 4.4 \cdot 10^{+50}:\\
\;\;\;\;\left(-t\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.0499999999999999e35 or 4.40000000000000034e50 < y Initial program 92.4%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6471.5
Applied rewrites71.5%
Taylor expanded in z around inf
Applied rewrites50.3%
if -1.0499999999999999e35 < y < 6.50000000000000017e-59Initial program 96.0%
Taylor expanded in t around 0
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6455.4
Applied rewrites55.4%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6440.5
Applied rewrites40.5%
Taylor expanded in y around 0
Applied rewrites37.6%
if 6.50000000000000017e-59 < y < 4.40000000000000034e50Initial program 95.8%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6443.2
Applied rewrites43.2%
Taylor expanded in t around inf
Applied rewrites38.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -1.3e+80) (not (<= t 4.1e+86))) (* (- b a) t) (fma (- y 2.0) b (+ a x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -1.3e+80) || !(t <= 4.1e+86)) {
tmp = (b - a) * t;
} else {
tmp = fma((y - 2.0), b, (a + x));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -1.3e+80) || !(t <= 4.1e+86)) tmp = Float64(Float64(b - a) * t); else tmp = fma(Float64(y - 2.0), b, Float64(a + x)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -1.3e+80], N[Not[LessEqual[t, 4.1e+86]], $MachinePrecision]], N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision], N[(N[(y - 2.0), $MachinePrecision] * b + N[(a + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.3 \cdot 10^{+80} \lor \neg \left(t \leq 4.1 \cdot 10^{+86}\right):\\
\;\;\;\;\left(b - a\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y - 2, b, a + x\right)\\
\end{array}
\end{array}
if t < -1.29999999999999991e80 or 4.0999999999999999e86 < t Initial program 89.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6475.6
Applied rewrites75.6%
if -1.29999999999999991e80 < t < 4.0999999999999999e86Initial program 99.3%
Taylor expanded in t around 0
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6492.1
Applied rewrites92.1%
Taylor expanded in z around 0
Applied rewrites63.0%
Final simplification68.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -6.5e+76) (not (<= t 4.1e+86))) (* (- b a) t) (+ (fma -2.0 b (+ a x)) z)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -6.5e+76) || !(t <= 4.1e+86)) {
tmp = (b - a) * t;
} else {
tmp = fma(-2.0, b, (a + x)) + z;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -6.5e+76) || !(t <= 4.1e+86)) tmp = Float64(Float64(b - a) * t); else tmp = Float64(fma(-2.0, b, Float64(a + x)) + z); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -6.5e+76], N[Not[LessEqual[t, 4.1e+86]], $MachinePrecision]], N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision], N[(N[(-2.0 * b + N[(a + x), $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.5 \cdot 10^{+76} \lor \neg \left(t \leq 4.1 \cdot 10^{+86}\right):\\
\;\;\;\;\left(b - a\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-2, b, a + x\right) + z\\
\end{array}
\end{array}
if t < -6.5000000000000005e76 or 4.0999999999999999e86 < t Initial program 89.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6475.6
Applied rewrites75.6%
if -6.5000000000000005e76 < t < 4.0999999999999999e86Initial program 99.3%
Taylor expanded in t around 0
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6492.1
Applied rewrites92.1%
Taylor expanded in y around 0
Applied rewrites56.0%
Final simplification65.0%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -3e+19) (not (<= t 4.1e+86))) (* (- b a) t) (fma -2.0 b (+ a x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -3e+19) || !(t <= 4.1e+86)) {
tmp = (b - a) * t;
} else {
tmp = fma(-2.0, b, (a + x));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -3e+19) || !(t <= 4.1e+86)) tmp = Float64(Float64(b - a) * t); else tmp = fma(-2.0, b, Float64(a + x)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -3e+19], N[Not[LessEqual[t, 4.1e+86]], $MachinePrecision]], N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision], N[(-2.0 * b + N[(a + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3 \cdot 10^{+19} \lor \neg \left(t \leq 4.1 \cdot 10^{+86}\right):\\
\;\;\;\;\left(b - a\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-2, b, a + x\right)\\
\end{array}
\end{array}
if t < -3e19 or 4.0999999999999999e86 < t Initial program 89.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6472.7
Applied rewrites72.7%
if -3e19 < t < 4.0999999999999999e86Initial program 100.0%
Taylor expanded in t around 0
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6494.5
Applied rewrites94.5%
Taylor expanded in z around 0
Applied rewrites64.8%
Taylor expanded in y around 0
Applied rewrites49.0%
Final simplification60.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -4.5e+17) (not (<= y 2.3e+51))) (* (- 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.5e+17) || !(y <= 2.3e+51)) {
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.5d+17)) .or. (.not. (y <= 2.3d+51))) 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.5e+17) || !(y <= 2.3e+51)) {
tmp = (b - z) * y;
} else {
tmp = (b - a) * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -4.5e+17) or not (y <= 2.3e+51): 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.5e+17) || !(y <= 2.3e+51)) 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.5e+17) || ~((y <= 2.3e+51))) 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.5e+17], N[Not[LessEqual[y, 2.3e+51]], $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.5 \cdot 10^{+17} \lor \neg \left(y \leq 2.3 \cdot 10^{+51}\right):\\
\;\;\;\;\left(b - z\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(b - a\right) \cdot t\\
\end{array}
\end{array}
if y < -4.5e17 or 2.30000000000000005e51 < y Initial program 92.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6471.9
Applied rewrites71.9%
if -4.5e17 < y < 2.30000000000000005e51Initial program 95.9%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6449.2
Applied rewrites49.2%
Final simplification59.0%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -2.6e+59) (not (<= b 1.85e+111))) (* (- t 2.0) b) (* (- 1.0 t) a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -2.6e+59) || !(b <= 1.85e+111)) {
tmp = (t - 2.0) * b;
} 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 ((b <= (-2.6d+59)) .or. (.not. (b <= 1.85d+111))) then
tmp = (t - 2.0d0) * b
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 ((b <= -2.6e+59) || !(b <= 1.85e+111)) {
tmp = (t - 2.0) * b;
} else {
tmp = (1.0 - t) * a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (b <= -2.6e+59) or not (b <= 1.85e+111): tmp = (t - 2.0) * b else: tmp = (1.0 - t) * a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -2.6e+59) || !(b <= 1.85e+111)) tmp = Float64(Float64(t - 2.0) * b); 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 ((b <= -2.6e+59) || ~((b <= 1.85e+111))) tmp = (t - 2.0) * b; else tmp = (1.0 - t) * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -2.6e+59], N[Not[LessEqual[b, 1.85e+111]], $MachinePrecision]], N[(N[(t - 2.0), $MachinePrecision] * b), $MachinePrecision], N[(N[(1.0 - t), $MachinePrecision] * a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.6 \cdot 10^{+59} \lor \neg \left(b \leq 1.85 \cdot 10^{+111}\right):\\
\;\;\;\;\left(t - 2\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;\left(1 - t\right) \cdot a\\
\end{array}
\end{array}
if b < -2.59999999999999999e59 or 1.8500000000000001e111 < b Initial program 87.5%
Taylor expanded in t around 0
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6453.6
Applied rewrites53.6%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6483.3
Applied rewrites83.3%
Taylor expanded in y around 0
Applied rewrites60.2%
if -2.59999999999999999e59 < b < 1.8500000000000001e111Initial program 98.2%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6438.7
Applied rewrites38.7%
Final simplification46.1%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -8.4e+58) (not (<= b 4.4e+102))) (* b t) (* (- t) a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -8.4e+58) || !(b <= 4.4e+102)) {
tmp = b * t;
} else {
tmp = -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 ((b <= (-8.4d+58)) .or. (.not. (b <= 4.4d+102))) then
tmp = b * t
else
tmp = -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 ((b <= -8.4e+58) || !(b <= 4.4e+102)) {
tmp = b * t;
} else {
tmp = -t * a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (b <= -8.4e+58) or not (b <= 4.4e+102): tmp = b * t else: tmp = -t * a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -8.4e+58) || !(b <= 4.4e+102)) tmp = Float64(b * t); else tmp = Float64(Float64(-t) * a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((b <= -8.4e+58) || ~((b <= 4.4e+102))) tmp = b * t; else tmp = -t * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -8.4e+58], N[Not[LessEqual[b, 4.4e+102]], $MachinePrecision]], N[(b * t), $MachinePrecision], N[((-t) * a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -8.4 \cdot 10^{+58} \lor \neg \left(b \leq 4.4 \cdot 10^{+102}\right):\\
\;\;\;\;b \cdot t\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) \cdot a\\
\end{array}
\end{array}
if b < -8.40000000000000048e58 or 4.40000000000000015e102 < b Initial program 88.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6450.5
Applied rewrites50.5%
Taylor expanded in a around 0
Applied rewrites46.1%
if -8.40000000000000048e58 < b < 4.40000000000000015e102Initial program 98.2%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6438.9
Applied rewrites38.9%
Taylor expanded in t around inf
Applied rewrites28.2%
Final simplification34.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -130000.0) (not (<= t 0.04))) (* b t) (* 1.0 a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -130000.0) || !(t <= 0.04)) {
tmp = b * t;
} else {
tmp = 1.0 * 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 ((t <= (-130000.0d0)) .or. (.not. (t <= 0.04d0))) then
tmp = b * t
else
tmp = 1.0d0 * 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 ((t <= -130000.0) || !(t <= 0.04)) {
tmp = b * t;
} else {
tmp = 1.0 * a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -130000.0) or not (t <= 0.04): tmp = b * t else: tmp = 1.0 * a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -130000.0) || !(t <= 0.04)) tmp = Float64(b * t); else tmp = Float64(1.0 * a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((t <= -130000.0) || ~((t <= 0.04))) tmp = b * t; else tmp = 1.0 * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -130000.0], N[Not[LessEqual[t, 0.04]], $MachinePrecision]], N[(b * t), $MachinePrecision], N[(1.0 * a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -130000 \lor \neg \left(t \leq 0.04\right):\\
\;\;\;\;b \cdot t\\
\mathbf{else}:\\
\;\;\;\;1 \cdot a\\
\end{array}
\end{array}
if t < -1.3e5 or 0.0400000000000000008 < t Initial program 90.6%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6466.4
Applied rewrites66.4%
Taylor expanded in a around 0
Applied rewrites35.5%
if -1.3e5 < t < 0.0400000000000000008Initial program 100.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6421.7
Applied rewrites21.7%
Taylor expanded in t around inf
Applied rewrites2.4%
Taylor expanded in t around 0
Applied rewrites21.5%
Final simplification29.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -2.15e+18) (not (<= t 3.3e+153))) (* b t) (* b y)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -2.15e+18) || !(t <= 3.3e+153)) {
tmp = b * t;
} else {
tmp = b * y;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((t <= (-2.15d+18)) .or. (.not. (t <= 3.3d+153))) then
tmp = b * t
else
tmp = b * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -2.15e+18) || !(t <= 3.3e+153)) {
tmp = b * t;
} else {
tmp = b * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -2.15e+18) or not (t <= 3.3e+153): tmp = b * t else: tmp = b * y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -2.15e+18) || !(t <= 3.3e+153)) tmp = Float64(b * t); else tmp = Float64(b * y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((t <= -2.15e+18) || ~((t <= 3.3e+153))) tmp = b * t; else tmp = b * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -2.15e+18], N[Not[LessEqual[t, 3.3e+153]], $MachinePrecision]], N[(b * t), $MachinePrecision], N[(b * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.15 \cdot 10^{+18} \lor \neg \left(t \leq 3.3 \cdot 10^{+153}\right):\\
\;\;\;\;b \cdot t\\
\mathbf{else}:\\
\;\;\;\;b \cdot y\\
\end{array}
\end{array}
if t < -2.15e18 or 3.29999999999999994e153 < t Initial program 88.4%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6475.0
Applied rewrites75.0%
Taylor expanded in a around 0
Applied rewrites42.6%
if -2.15e18 < t < 3.29999999999999994e153Initial program 99.3%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6441.4
Applied rewrites41.4%
Taylor expanded in z around 0
Applied rewrites19.1%
Final simplification29.4%
(FPCore (x y z t a b) :precision binary64 (* b t))
double code(double x, double y, double z, double t, double a, double b) {
return b * t;
}
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 = b * t
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return b * t;
}
def code(x, y, z, t, a, b): return b * t
function code(x, y, z, t, a, b) return Float64(b * t) end
function tmp = code(x, y, z, t, a, b) tmp = b * t; end
code[x_, y_, z_, t_, a_, b_] := N[(b * t), $MachinePrecision]
\begin{array}{l}
\\
b \cdot t
\end{array}
Initial program 94.5%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6439.7
Applied rewrites39.7%
Taylor expanded in a around 0
Applied rewrites21.6%
herbie shell --seed 2024352
(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)))