
(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 19 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (+ (- (- x (* (- y 1.0) z)) (* (- t 1.0) a)) (* (- (+ y t) 2.0) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((x - ((y - 1.0d0) * z)) - ((t - 1.0d0) * a)) + (((y + t) - 2.0d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b);
}
def code(x, y, z, t, a, b): return ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x - Float64(Float64(y - 1.0) * z)) - Float64(Float64(t - 1.0) * a)) + Float64(Float64(Float64(y + t) - 2.0) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x - N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] - N[(N[(t - 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - \left(y - 1\right) \cdot z\right) - \left(t - 1\right) \cdot a\right) + \left(\left(y + t\right) - 2\right) \cdot b
\end{array}
(FPCore (x y z t a b) :precision binary64 (fma (- 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) {
return fma((b - a), t, fma((y - 2.0), b, (x - fma((y - 1.0), z, -a))));
}
function code(x, y, z, t, a, b) return fma(Float64(b - a), t, fma(Float64(y - 2.0), b, Float64(x - fma(Float64(y - 1.0), z, Float64(-a))))) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(b - a), $MachinePrecision] * t + N[(N[(y - 2.0), $MachinePrecision] * b + N[(x - N[(N[(y - 1.0), $MachinePrecision] * z + (-a)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(b - a, t, \mathsf{fma}\left(y - 2, b, x - \mathsf{fma}\left(y - 1, z, -a\right)\right)\right)
\end{array}
Initial program 96.9%
Taylor expanded in t around 0
+-commutativeN/A
associate--l+N/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate--l+N/A
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
Applied rewrites99.6%
(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 (or (<= t_1 (- INFINITY)) (not (<= t_1 5e+302)))
(* b y)
(+ (+ z 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)) || !(t_1 <= 5e+302)) {
tmp = b * y;
} else {
tmp = (z + x) + a;
}
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) || !(t_1 <= 5e+302)) {
tmp = b * y;
} else {
tmp = (z + x) + a;
}
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) or not (t_1 <= 5e+302): tmp = b * y else: tmp = (z + 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 <= Float64(-Inf)) || !(t_1 <= 5e+302)) tmp = Float64(b * y); else tmp = Float64(Float64(z + x) + a); 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) || ~((t_1 <= 5e+302))) tmp = b * y; else tmp = (z + x) + a; 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[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 5e+302]], $MachinePrecision]], N[(b * y), $MachinePrecision], N[(N[(z + x), $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 \lor \neg \left(t\_1 \leq 5 \cdot 10^{+302}\right):\\
\;\;\;\;b \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(z + x\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.0 or 5e302 < (+.f64 (-.f64 (-.f64 x (*.f64 (-.f64 y #s(literal 1 binary64)) z)) (*.f64 (-.f64 t #s(literal 1 binary64)) a)) (*.f64 (-.f64 (+.f64 y t) #s(literal 2 binary64)) b)) Initial program 91.2%
Taylor expanded in t around 0
+-commutativeN/A
associate--l+N/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate--l+N/A
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
Applied rewrites98.9%
Taylor expanded in b around -inf
Applied rewrites51.8%
Taylor expanded in y around inf
Applied rewrites34.2%
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)) < 5e302Initial program 100.0%
Taylor expanded in y around 0
associate--l+N/A
+-commutativeN/A
fp-cancel-sign-sub-invN/A
associate--r-N/A
associate-+l+N/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
lower-+.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower--.f64N/A
distribute-lft-out--N/A
*-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
Applied rewrites86.6%
Taylor expanded in t around 0
Applied rewrites62.9%
Taylor expanded in b around 0
Applied rewrites54.1%
Final simplification47.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma (- 1.0 t) a (fma (- z) (- y 1.0) x))))
(if (<= y -2.7e+43)
t_1
(if (<= y 2.7)
(+ (+ a (fma (- b a) t (fma -2.0 b z))) x)
(if (<= y 1.9e+189) t_1 (fma (- z) y (* b y)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma((1.0 - t), a, fma(-z, (y - 1.0), x));
double tmp;
if (y <= -2.7e+43) {
tmp = t_1;
} else if (y <= 2.7) {
tmp = (a + fma((b - a), t, fma(-2.0, b, z))) + x;
} else if (y <= 1.9e+189) {
tmp = t_1;
} else {
tmp = fma(-z, y, (b * y));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(Float64(1.0 - t), a, fma(Float64(-z), Float64(y - 1.0), x)) tmp = 0.0 if (y <= -2.7e+43) tmp = t_1; elseif (y <= 2.7) tmp = Float64(Float64(a + fma(Float64(b - a), t, fma(-2.0, b, z))) + x); elseif (y <= 1.9e+189) tmp = t_1; else tmp = fma(Float64(-z), y, Float64(b * y)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(1.0 - t), $MachinePrecision] * a + N[((-z) * N[(y - 1.0), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.7e+43], t$95$1, If[LessEqual[y, 2.7], N[(N[(a + N[(N[(b - a), $MachinePrecision] * t + N[(-2.0 * b + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[y, 1.9e+189], t$95$1, N[((-z) * y + N[(b * y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(1 - t, a, \mathsf{fma}\left(-z, y - 1, x\right)\right)\\
\mathbf{if}\;y \leq -2.7 \cdot 10^{+43}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.7:\\
\;\;\;\;\left(a + \mathsf{fma}\left(b - a, t, \mathsf{fma}\left(-2, b, z\right)\right)\right) + x\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+189}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-z, y, b \cdot y\right)\\
\end{array}
\end{array}
if y < -2.7000000000000002e43 or 2.7000000000000002 < y < 1.8999999999999999e189Initial program 92.0%
Taylor expanded in t around 0
+-commutativeN/A
associate--l+N/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate--l+N/A
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
Applied rewrites98.9%
Taylor expanded in b around 0
Applied rewrites72.9%
if -2.7000000000000002e43 < y < 2.7000000000000002Initial program 99.3%
Taylor expanded in y around 0
associate--l+N/A
+-commutativeN/A
fp-cancel-sign-sub-invN/A
associate--r-N/A
associate-+l+N/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
lower-+.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower--.f64N/A
distribute-lft-out--N/A
*-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
Applied rewrites97.8%
Taylor expanded in t around 0
Applied rewrites98.5%
if 1.8999999999999999e189 < y Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6479.5
Applied rewrites79.5%
Taylor expanded in z around 0
Applied rewrites79.5%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -3.8e+107) (not (<= z 1.85e+27))) (fma (- 1.0 t) a (fma (- z) (- y 1.0) x)) (fma (- b a) t (+ (fma (- y 2.0) b x) a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -3.8e+107) || !(z <= 1.85e+27)) {
tmp = fma((1.0 - t), a, fma(-z, (y - 1.0), x));
} else {
tmp = fma((b - a), t, (fma((y - 2.0), b, x) + a));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -3.8e+107) || !(z <= 1.85e+27)) tmp = fma(Float64(1.0 - t), a, fma(Float64(-z), Float64(y - 1.0), x)); else tmp = fma(Float64(b - a), t, Float64(fma(Float64(y - 2.0), b, x) + a)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -3.8e+107], N[Not[LessEqual[z, 1.85e+27]], $MachinePrecision]], N[(N[(1.0 - t), $MachinePrecision] * a + N[((-z) * N[(y - 1.0), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], N[(N[(b - a), $MachinePrecision] * t + N[(N[(N[(y - 2.0), $MachinePrecision] * b + x), $MachinePrecision] + a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{+107} \lor \neg \left(z \leq 1.85 \cdot 10^{+27}\right):\\
\;\;\;\;\mathsf{fma}\left(1 - t, a, \mathsf{fma}\left(-z, y - 1, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b - a, t, \mathsf{fma}\left(y - 2, b, x\right) + a\right)\\
\end{array}
\end{array}
if z < -3.7999999999999998e107 or 1.85000000000000001e27 < z Initial program 92.7%
Taylor expanded in t around 0
+-commutativeN/A
associate--l+N/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate--l+N/A
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
Applied rewrites99.0%
Taylor expanded in b around 0
Applied rewrites87.0%
if -3.7999999999999998e107 < z < 1.85000000000000001e27Initial program 99.4%
Taylor expanded in t around 0
+-commutativeN/A
associate--l+N/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate--l+N/A
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
Applied rewrites100.0%
Taylor expanded in z around 0
Applied rewrites96.8%
Final simplification93.1%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -3.8e+107) (not (<= z 1.85e+27))) (fma (- 1.0 t) a (fma (- z) (- y 1.0) x)) (fma (- 1.0 t) a (fma (- (+ t y) 2.0) b x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -3.8e+107) || !(z <= 1.85e+27)) {
tmp = fma((1.0 - t), a, fma(-z, (y - 1.0), x));
} else {
tmp = fma((1.0 - t), a, fma(((t + y) - 2.0), b, x));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -3.8e+107) || !(z <= 1.85e+27)) tmp = fma(Float64(1.0 - t), a, fma(Float64(-z), Float64(y - 1.0), x)); else tmp = fma(Float64(1.0 - t), a, fma(Float64(Float64(t + y) - 2.0), b, x)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -3.8e+107], N[Not[LessEqual[z, 1.85e+27]], $MachinePrecision]], N[(N[(1.0 - t), $MachinePrecision] * a + N[((-z) * N[(y - 1.0), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - t), $MachinePrecision] * a + N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{+107} \lor \neg \left(z \leq 1.85 \cdot 10^{+27}\right):\\
\;\;\;\;\mathsf{fma}\left(1 - t, a, \mathsf{fma}\left(-z, y - 1, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 - t, a, \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right)\right)\\
\end{array}
\end{array}
if z < -3.7999999999999998e107 or 1.85000000000000001e27 < z Initial program 92.7%
Taylor expanded in t around 0
+-commutativeN/A
associate--l+N/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate--l+N/A
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
Applied rewrites99.0%
Taylor expanded in b around 0
Applied rewrites87.0%
if -3.7999999999999998e107 < z < 1.85000000000000001e27Initial program 99.4%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
associate-+l-N/A
Applied rewrites96.8%
Final simplification93.1%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -2.9e+107) (not (<= z 1.6e+27))) (fma (- 1.0 t) a (fma (- z) (- y 1.0) x)) (fma (- a) t (+ (fma (- y 2.0) b x) a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -2.9e+107) || !(z <= 1.6e+27)) {
tmp = fma((1.0 - t), a, fma(-z, (y - 1.0), x));
} else {
tmp = fma(-a, t, (fma((y - 2.0), b, x) + a));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -2.9e+107) || !(z <= 1.6e+27)) tmp = fma(Float64(1.0 - t), a, fma(Float64(-z), Float64(y - 1.0), x)); else tmp = fma(Float64(-a), t, Float64(fma(Float64(y - 2.0), b, x) + a)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -2.9e+107], N[Not[LessEqual[z, 1.6e+27]], $MachinePrecision]], N[(N[(1.0 - t), $MachinePrecision] * a + N[((-z) * N[(y - 1.0), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], N[((-a) * t + N[(N[(N[(y - 2.0), $MachinePrecision] * b + x), $MachinePrecision] + a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.9 \cdot 10^{+107} \lor \neg \left(z \leq 1.6 \cdot 10^{+27}\right):\\
\;\;\;\;\mathsf{fma}\left(1 - t, a, \mathsf{fma}\left(-z, y - 1, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-a, t, \mathsf{fma}\left(y - 2, b, x\right) + a\right)\\
\end{array}
\end{array}
if z < -2.89999999999999988e107 or 1.60000000000000008e27 < z Initial program 92.7%
Taylor expanded in t around 0
+-commutativeN/A
associate--l+N/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate--l+N/A
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
Applied rewrites99.0%
Taylor expanded in b around 0
Applied rewrites87.0%
if -2.89999999999999988e107 < z < 1.60000000000000008e27Initial program 99.4%
Taylor expanded in t around 0
+-commutativeN/A
associate--l+N/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate--l+N/A
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
Applied rewrites100.0%
Taylor expanded in z around 0
Applied rewrites96.8%
Taylor expanded in a around inf
Applied rewrites82.8%
Final simplification84.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -9.8e+98) (not (<= b 7.2e+67))) (fma (- b a) t (fma (- y 2.0) b a)) (fma (- 1.0 t) a (fma (- z) (- y 1.0) x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -9.8e+98) || !(b <= 7.2e+67)) {
tmp = fma((b - a), t, fma((y - 2.0), b, a));
} else {
tmp = fma((1.0 - t), a, fma(-z, (y - 1.0), x));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -9.8e+98) || !(b <= 7.2e+67)) tmp = fma(Float64(b - a), t, fma(Float64(y - 2.0), b, a)); else tmp = fma(Float64(1.0 - t), a, fma(Float64(-z), Float64(y - 1.0), x)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -9.8e+98], N[Not[LessEqual[b, 7.2e+67]], $MachinePrecision]], N[(N[(b - a), $MachinePrecision] * t + N[(N[(y - 2.0), $MachinePrecision] * b + a), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - t), $MachinePrecision] * a + N[((-z) * N[(y - 1.0), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -9.8 \cdot 10^{+98} \lor \neg \left(b \leq 7.2 \cdot 10^{+67}\right):\\
\;\;\;\;\mathsf{fma}\left(b - a, t, \mathsf{fma}\left(y - 2, b, a\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 - t, a, \mathsf{fma}\left(-z, y - 1, x\right)\right)\\
\end{array}
\end{array}
if b < -9.79999999999999958e98 or 7.1999999999999998e67 < b Initial program 96.6%
Taylor expanded in t around 0
+-commutativeN/A
associate--l+N/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate--l+N/A
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
Applied rewrites100.0%
Taylor expanded in z around 0
Applied rewrites86.0%
Taylor expanded in x around 0
Applied rewrites79.5%
if -9.79999999999999958e98 < b < 7.1999999999999998e67Initial program 97.0%
Taylor expanded in t around 0
+-commutativeN/A
associate--l+N/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate--l+N/A
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
Applied rewrites99.4%
Taylor expanded in b around 0
Applied rewrites86.5%
Final simplification84.1%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -2.9e+107) (not (<= z 7.5e+111))) (- x (fma z (- y 1.0) (- a))) (fma (- b a) t (fma (- y 2.0) b a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -2.9e+107) || !(z <= 7.5e+111)) {
tmp = x - fma(z, (y - 1.0), -a);
} else {
tmp = fma((b - a), t, fma((y - 2.0), b, a));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -2.9e+107) || !(z <= 7.5e+111)) tmp = Float64(x - fma(z, Float64(y - 1.0), Float64(-a))); else tmp = fma(Float64(b - a), t, fma(Float64(y - 2.0), b, a)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -2.9e+107], N[Not[LessEqual[z, 7.5e+111]], $MachinePrecision]], N[(x - N[(z * N[(y - 1.0), $MachinePrecision] + (-a)), $MachinePrecision]), $MachinePrecision], N[(N[(b - a), $MachinePrecision] * t + N[(N[(y - 2.0), $MachinePrecision] * b + a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.9 \cdot 10^{+107} \lor \neg \left(z \leq 7.5 \cdot 10^{+111}\right):\\
\;\;\;\;x - \mathsf{fma}\left(z, y - 1, -a\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b - a, t, \mathsf{fma}\left(y - 2, b, a\right)\right)\\
\end{array}
\end{array}
if z < -2.89999999999999988e107 or 7.49999999999999948e111 < z Initial program 91.6%
Taylor expanded in t around 0
+-commutativeN/A
associate--l+N/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate--l+N/A
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
Applied rewrites98.8%
Taylor expanded in z around 0
Applied rewrites41.4%
Taylor expanded in b around 0
lower--.f64N/A
lower-fma.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f6488.5
Applied rewrites88.5%
Taylor expanded in t around 0
Applied rewrites80.3%
if -2.89999999999999988e107 < z < 7.49999999999999948e111Initial program 99.4%
Taylor expanded in t around 0
+-commutativeN/A
associate--l+N/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate--l+N/A
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
Applied rewrites100.0%
Taylor expanded in z around 0
Applied rewrites95.3%
Taylor expanded in x around 0
Applied rewrites74.7%
Final simplification76.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b a) t)))
(if (<= t -1.02e+125)
t_1
(if (<= t -3.5e-67)
(* (- b z) y)
(if (<= t 175000.0) (+ (fma -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.02e+125) {
tmp = t_1;
} else if (t <= -3.5e-67) {
tmp = (b - z) * y;
} else if (t <= 175000.0) {
tmp = fma(-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.02e+125) tmp = t_1; elseif (t <= -3.5e-67) tmp = Float64(Float64(b - z) * y); elseif (t <= 175000.0) tmp = Float64(fma(-2.0, b, 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.02e+125], t$95$1, If[LessEqual[t, -3.5e-67], N[(N[(b - z), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t, 175000.0], N[(N[(-2.0 * b + a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(b - a\right) \cdot t\\
\mathbf{if}\;t \leq -1.02 \cdot 10^{+125}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -3.5 \cdot 10^{-67}:\\
\;\;\;\;\left(b - z\right) \cdot y\\
\mathbf{elif}\;t \leq 175000:\\
\;\;\;\;\mathsf{fma}\left(-2, b, a\right) + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.02e125 or 175000 < t Initial program 92.9%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6472.3
Applied rewrites72.3%
if -1.02e125 < t < -3.5e-67Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6449.4
Applied rewrites49.4%
if -3.5e-67 < t < 175000Initial program 99.1%
Taylor expanded in y around 0
associate--l+N/A
+-commutativeN/A
fp-cancel-sign-sub-invN/A
associate--r-N/A
associate-+l+N/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
lower-+.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower--.f64N/A
distribute-lft-out--N/A
*-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
Applied rewrites66.8%
Taylor expanded in t around 0
Applied rewrites66.2%
Applied rewrites66.2%
Taylor expanded in z around 0
Applied rewrites56.0%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -1.02e+125) (not (<= t 3.4e+41))) (* (- b a) t) (- x (fma z (- y 1.0) (- a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -1.02e+125) || !(t <= 3.4e+41)) {
tmp = (b - a) * t;
} else {
tmp = x - fma(z, (y - 1.0), -a);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -1.02e+125) || !(t <= 3.4e+41)) tmp = Float64(Float64(b - a) * t); else tmp = Float64(x - fma(z, Float64(y - 1.0), Float64(-a))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -1.02e+125], N[Not[LessEqual[t, 3.4e+41]], $MachinePrecision]], N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision], N[(x - N[(z * N[(y - 1.0), $MachinePrecision] + (-a)), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.02 \cdot 10^{+125} \lor \neg \left(t \leq 3.4 \cdot 10^{+41}\right):\\
\;\;\;\;\left(b - a\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x - \mathsf{fma}\left(z, y - 1, -a\right)\\
\end{array}
\end{array}
if t < -1.02e125 or 3.39999999999999998e41 < t Initial program 93.5%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6475.0
Applied rewrites75.0%
if -1.02e125 < t < 3.39999999999999998e41Initial program 98.8%
Taylor expanded in t around 0
+-commutativeN/A
associate--l+N/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate--l+N/A
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
Applied rewrites100.0%
Taylor expanded in z around 0
Applied rewrites72.2%
Taylor expanded in b around 0
lower--.f64N/A
lower-fma.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f6472.8
Applied rewrites72.8%
Taylor expanded in t around 0
Applied rewrites68.4%
Final simplification70.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b a) t)))
(if (<= t -1.02e+125)
t_1
(if (<= t -3.5e-67)
(* (- b z) y)
(if (<= t 1.56e+28) (+ (+ z x) a) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (b - a) * t;
double tmp;
if (t <= -1.02e+125) {
tmp = t_1;
} else if (t <= -3.5e-67) {
tmp = (b - z) * y;
} else if (t <= 1.56e+28) {
tmp = (z + x) + 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 = (b - a) * t
if (t <= (-1.02d+125)) then
tmp = t_1
else if (t <= (-3.5d-67)) then
tmp = (b - z) * y
else if (t <= 1.56d+28) then
tmp = (z + x) + 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 = (b - a) * t;
double tmp;
if (t <= -1.02e+125) {
tmp = t_1;
} else if (t <= -3.5e-67) {
tmp = (b - z) * y;
} else if (t <= 1.56e+28) {
tmp = (z + x) + a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (b - a) * t tmp = 0 if t <= -1.02e+125: tmp = t_1 elif t <= -3.5e-67: tmp = (b - z) * y elif t <= 1.56e+28: tmp = (z + x) + a else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(b - a) * t) tmp = 0.0 if (t <= -1.02e+125) tmp = t_1; elseif (t <= -3.5e-67) tmp = Float64(Float64(b - z) * y); elseif (t <= 1.56e+28) tmp = Float64(Float64(z + x) + a); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (b - a) * t; tmp = 0.0; if (t <= -1.02e+125) tmp = t_1; elseif (t <= -3.5e-67) tmp = (b - z) * y; elseif (t <= 1.56e+28) tmp = (z + x) + a; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -1.02e+125], t$95$1, If[LessEqual[t, -3.5e-67], N[(N[(b - z), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t, 1.56e+28], N[(N[(z + x), $MachinePrecision] + a), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(b - a\right) \cdot t\\
\mathbf{if}\;t \leq -1.02 \cdot 10^{+125}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -3.5 \cdot 10^{-67}:\\
\;\;\;\;\left(b - z\right) \cdot y\\
\mathbf{elif}\;t \leq 1.56 \cdot 10^{+28}:\\
\;\;\;\;\left(z + x\right) + a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.02e125 or 1.5599999999999999e28 < t Initial program 92.7%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6472.9
Applied rewrites72.9%
if -1.02e125 < t < -3.5e-67Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6449.4
Applied rewrites49.4%
if -3.5e-67 < t < 1.5599999999999999e28Initial program 99.2%
Taylor expanded in y around 0
associate--l+N/A
+-commutativeN/A
fp-cancel-sign-sub-invN/A
associate--r-N/A
associate-+l+N/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
lower-+.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower--.f64N/A
distribute-lft-out--N/A
*-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
Applied rewrites67.3%
Taylor expanded in t around 0
Applied rewrites66.0%
Taylor expanded in b around 0
Applied rewrites55.4%
(FPCore (x y z t a b) :precision binary64 (if (<= y -3e+85) (* (- b z) y) (if (<= y 1.1e+37) (+ (fma (- t 2.0) b z) x) (fma (- z) y (* b y)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -3e+85) {
tmp = (b - z) * y;
} else if (y <= 1.1e+37) {
tmp = fma((t - 2.0), b, z) + x;
} else {
tmp = fma(-z, y, (b * y));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -3e+85) tmp = Float64(Float64(b - z) * y); elseif (y <= 1.1e+37) tmp = Float64(fma(Float64(t - 2.0), b, z) + x); else tmp = fma(Float64(-z), y, Float64(b * y)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -3e+85], N[(N[(b - z), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[y, 1.1e+37], N[(N[(N[(t - 2.0), $MachinePrecision] * b + z), $MachinePrecision] + x), $MachinePrecision], N[((-z) * y + N[(b * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3 \cdot 10^{+85}:\\
\;\;\;\;\left(b - z\right) \cdot y\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{+37}:\\
\;\;\;\;\mathsf{fma}\left(t - 2, b, z\right) + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-z, y, b \cdot y\right)\\
\end{array}
\end{array}
if y < -3e85Initial program 86.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6468.5
Applied rewrites68.5%
if -3e85 < y < 1.1e37Initial program 99.3%
Taylor expanded in y around 0
associate--l+N/A
+-commutativeN/A
fp-cancel-sign-sub-invN/A
associate--r-N/A
associate-+l+N/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
lower-+.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower--.f64N/A
distribute-lft-out--N/A
*-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
Applied rewrites95.9%
Taylor expanded in a around 0
Applied rewrites63.9%
if 1.1e37 < y Initial program 98.4%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6468.6
Applied rewrites68.6%
Taylor expanded in z around 0
Applied rewrites68.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -3e+85) (not (<= y 1.1e+37))) (* (- b z) y) (+ (fma (- t 2.0) b z) x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -3e+85) || !(y <= 1.1e+37)) {
tmp = (b - z) * y;
} else {
tmp = fma((t - 2.0), b, z) + x;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -3e+85) || !(y <= 1.1e+37)) tmp = Float64(Float64(b - z) * y); else tmp = Float64(fma(Float64(t - 2.0), b, z) + x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -3e+85], N[Not[LessEqual[y, 1.1e+37]], $MachinePrecision]], N[(N[(b - z), $MachinePrecision] * y), $MachinePrecision], N[(N[(N[(t - 2.0), $MachinePrecision] * b + z), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3 \cdot 10^{+85} \lor \neg \left(y \leq 1.1 \cdot 10^{+37}\right):\\
\;\;\;\;\left(b - z\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t - 2, b, z\right) + x\\
\end{array}
\end{array}
if y < -3e85 or 1.1e37 < y Initial program 93.3%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6468.5
Applied rewrites68.5%
if -3e85 < y < 1.1e37Initial program 99.3%
Taylor expanded in y around 0
associate--l+N/A
+-commutativeN/A
fp-cancel-sign-sub-invN/A
associate--r-N/A
associate-+l+N/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
lower-+.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower--.f64N/A
distribute-lft-out--N/A
*-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
Applied rewrites95.9%
Taylor expanded in a around 0
Applied rewrites63.9%
Final simplification65.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -2700.0) (not (<= t 1.56e+28))) (* (- b a) t) (+ (+ a (fma -2.0 b z)) x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -2700.0) || !(t <= 1.56e+28)) {
tmp = (b - a) * t;
} else {
tmp = (a + fma(-2.0, b, z)) + x;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -2700.0) || !(t <= 1.56e+28)) tmp = Float64(Float64(b - a) * t); else tmp = Float64(Float64(a + fma(-2.0, b, z)) + x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -2700.0], N[Not[LessEqual[t, 1.56e+28]], $MachinePrecision]], N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision], N[(N[(a + N[(-2.0 * b + z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2700 \lor \neg \left(t \leq 1.56 \cdot 10^{+28}\right):\\
\;\;\;\;\left(b - a\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;\left(a + \mathsf{fma}\left(-2, b, z\right)\right) + x\\
\end{array}
\end{array}
if t < -2700 or 1.5599999999999999e28 < t Initial program 94.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6465.9
Applied rewrites65.9%
if -2700 < t < 1.5599999999999999e28Initial program 99.2%
Taylor expanded in y around 0
associate--l+N/A
+-commutativeN/A
fp-cancel-sign-sub-invN/A
associate--r-N/A
associate-+l+N/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
lower-+.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower--.f64N/A
distribute-lft-out--N/A
*-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
Applied rewrites64.9%
Taylor expanded in t around 0
Applied rewrites63.4%
Applied rewrites63.4%
Final simplification64.5%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -2700.0) (not (<= t 1.56e+28))) (* (- b a) t) (+ (+ z x) a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -2700.0) || !(t <= 1.56e+28)) {
tmp = (b - a) * t;
} else {
tmp = (z + x) + 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 <= (-2700.0d0)) .or. (.not. (t <= 1.56d+28))) then
tmp = (b - a) * t
else
tmp = (z + x) + 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 <= -2700.0) || !(t <= 1.56e+28)) {
tmp = (b - a) * t;
} else {
tmp = (z + x) + a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -2700.0) or not (t <= 1.56e+28): tmp = (b - a) * t else: tmp = (z + x) + a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -2700.0) || !(t <= 1.56e+28)) tmp = Float64(Float64(b - a) * t); else tmp = Float64(Float64(z + x) + a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((t <= -2700.0) || ~((t <= 1.56e+28))) tmp = (b - a) * t; else tmp = (z + x) + a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -2700.0], N[Not[LessEqual[t, 1.56e+28]], $MachinePrecision]], N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision], N[(N[(z + x), $MachinePrecision] + a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2700 \lor \neg \left(t \leq 1.56 \cdot 10^{+28}\right):\\
\;\;\;\;\left(b - a\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;\left(z + x\right) + a\\
\end{array}
\end{array}
if t < -2700 or 1.5599999999999999e28 < t Initial program 94.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6465.9
Applied rewrites65.9%
if -2700 < t < 1.5599999999999999e28Initial program 99.2%
Taylor expanded in y around 0
associate--l+N/A
+-commutativeN/A
fp-cancel-sign-sub-invN/A
associate--r-N/A
associate-+l+N/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
lower-+.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower--.f64N/A
distribute-lft-out--N/A
*-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
Applied rewrites64.9%
Taylor expanded in t around 0
Applied rewrites63.4%
Taylor expanded in b around 0
Applied rewrites52.9%
Final simplification58.9%
(FPCore (x y z t a b) :precision binary64 (if (<= t -1300.0) (* (- 1.0 t) a) (if (<= t 1.86e+28) (+ (+ z x) a) (* (- t) a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -1300.0) {
tmp = (1.0 - t) * a;
} else if (t <= 1.86e+28) {
tmp = (z + x) + a;
} 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 (t <= (-1300.0d0)) then
tmp = (1.0d0 - t) * a
else if (t <= 1.86d+28) then
tmp = (z + x) + a
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 (t <= -1300.0) {
tmp = (1.0 - t) * a;
} else if (t <= 1.86e+28) {
tmp = (z + x) + a;
} else {
tmp = -t * a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -1300.0: tmp = (1.0 - t) * a elif t <= 1.86e+28: tmp = (z + x) + a else: tmp = -t * a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -1300.0) tmp = Float64(Float64(1.0 - t) * a); elseif (t <= 1.86e+28) tmp = Float64(Float64(z + x) + a); else tmp = Float64(Float64(-t) * a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -1300.0) tmp = (1.0 - t) * a; elseif (t <= 1.86e+28) tmp = (z + x) + a; else tmp = -t * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -1300.0], N[(N[(1.0 - t), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[t, 1.86e+28], N[(N[(z + x), $MachinePrecision] + a), $MachinePrecision], N[((-t) * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1300:\\
\;\;\;\;\left(1 - t\right) \cdot a\\
\mathbf{elif}\;t \leq 1.86 \cdot 10^{+28}:\\
\;\;\;\;\left(z + x\right) + a\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) \cdot a\\
\end{array}
\end{array}
if t < -1300Initial program 96.4%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6433.8
Applied rewrites33.8%
if -1300 < t < 1.86000000000000009e28Initial program 99.2%
Taylor expanded in y around 0
associate--l+N/A
+-commutativeN/A
fp-cancel-sign-sub-invN/A
associate--r-N/A
associate-+l+N/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
lower-+.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower--.f64N/A
distribute-lft-out--N/A
*-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
Applied rewrites64.9%
Taylor expanded in t around 0
Applied rewrites63.4%
Taylor expanded in b around 0
Applied rewrites52.9%
if 1.86000000000000009e28 < t Initial program 92.2%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6449.8
Applied rewrites49.8%
Taylor expanded in t around inf
Applied rewrites49.8%
(FPCore (x y z t a b) :precision binary64 (if (<= t -3.8e+131) (* b t) (if (<= t 1.86e+28) (+ (+ z x) a) (* (- t) a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -3.8e+131) {
tmp = b * t;
} else if (t <= 1.86e+28) {
tmp = (z + x) + a;
} 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 (t <= (-3.8d+131)) then
tmp = b * t
else if (t <= 1.86d+28) then
tmp = (z + x) + a
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 (t <= -3.8e+131) {
tmp = b * t;
} else if (t <= 1.86e+28) {
tmp = (z + x) + a;
} else {
tmp = -t * a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -3.8e+131: tmp = b * t elif t <= 1.86e+28: tmp = (z + x) + a else: tmp = -t * a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -3.8e+131) tmp = Float64(b * t); elseif (t <= 1.86e+28) tmp = Float64(Float64(z + x) + a); else tmp = Float64(Float64(-t) * a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -3.8e+131) tmp = b * t; elseif (t <= 1.86e+28) tmp = (z + x) + a; else tmp = -t * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -3.8e+131], N[(b * t), $MachinePrecision], If[LessEqual[t, 1.86e+28], N[(N[(z + x), $MachinePrecision] + a), $MachinePrecision], N[((-t) * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.8 \cdot 10^{+131}:\\
\;\;\;\;b \cdot t\\
\mathbf{elif}\;t \leq 1.86 \cdot 10^{+28}:\\
\;\;\;\;\left(z + x\right) + a\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) \cdot a\\
\end{array}
\end{array}
if t < -3.8000000000000004e131Initial program 93.1%
Taylor expanded in t around 0
+-commutativeN/A
associate--l+N/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate--l+N/A
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
Applied rewrites100.0%
Taylor expanded in b around -inf
Applied rewrites43.4%
Taylor expanded in t around inf
Applied rewrites43.6%
if -3.8000000000000004e131 < t < 1.86000000000000009e28Initial program 99.4%
Taylor expanded in y around 0
associate--l+N/A
+-commutativeN/A
fp-cancel-sign-sub-invN/A
associate--r-N/A
associate-+l+N/A
+-commutativeN/A
fp-cancel-sub-sign-invN/A
lower-+.f64N/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
lower--.f64N/A
distribute-lft-out--N/A
*-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
Applied rewrites64.3%
Taylor expanded in t around 0
Applied rewrites56.9%
Taylor expanded in b around 0
Applied rewrites48.0%
if 1.86000000000000009e28 < t Initial program 92.2%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6449.8
Applied rewrites49.8%
Taylor expanded in t around inf
Applied rewrites49.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -5.1e+14) (not (<= y 3.1e+36))) (* b y) (* b t)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -5.1e+14) || !(y <= 3.1e+36)) {
tmp = b * y;
} else {
tmp = b * t;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((y <= (-5.1d+14)) .or. (.not. (y <= 3.1d+36))) then
tmp = b * y
else
tmp = b * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -5.1e+14) || !(y <= 3.1e+36)) {
tmp = b * y;
} else {
tmp = b * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -5.1e+14) or not (y <= 3.1e+36): tmp = b * y else: tmp = b * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -5.1e+14) || !(y <= 3.1e+36)) tmp = Float64(b * y); else tmp = Float64(b * t); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -5.1e+14) || ~((y <= 3.1e+36))) tmp = b * y; else tmp = b * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -5.1e+14], N[Not[LessEqual[y, 3.1e+36]], $MachinePrecision]], N[(b * y), $MachinePrecision], N[(b * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.1 \cdot 10^{+14} \lor \neg \left(y \leq 3.1 \cdot 10^{+36}\right):\\
\;\;\;\;b \cdot y\\
\mathbf{else}:\\
\;\;\;\;b \cdot t\\
\end{array}
\end{array}
if y < -5.1e14 or 3.0999999999999999e36 < y Initial program 94.0%
Taylor expanded in t around 0
+-commutativeN/A
associate--l+N/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate--l+N/A
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
Applied rewrites99.1%
Taylor expanded in b around -inf
Applied rewrites39.9%
Taylor expanded in y around inf
Applied rewrites35.6%
if -5.1e14 < y < 3.0999999999999999e36Initial program 99.3%
Taylor expanded in t around 0
+-commutativeN/A
associate--l+N/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate--l+N/A
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
Applied rewrites100.0%
Taylor expanded in b around -inf
Applied rewrites31.9%
Taylor expanded in t around inf
Applied rewrites21.9%
Final simplification28.2%
(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 96.9%
Taylor expanded in t around 0
+-commutativeN/A
associate--l+N/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate--l+N/A
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
Applied rewrites99.6%
Taylor expanded in b around -inf
Applied rewrites35.6%
Taylor expanded in t around inf
Applied rewrites16.0%
herbie shell --seed 2024363
(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)))