
(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 24 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) a) (* z (- y 1.0)))))
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) + a) - (z * (y - 1.0))));
}
function code(x, y, z, t, a, b) return fma(Float64(b - a), t, Float64(Float64(fma(Float64(y - 2.0), b, x) + a) - Float64(z * Float64(y - 1.0)))) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(b - a), $MachinePrecision] * t + N[(N[(N[(N[(y - 2.0), $MachinePrecision] * b + x), $MachinePrecision] + a), $MachinePrecision] - N[(z * N[(y - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(b - a, t, \left(\mathsf{fma}\left(y - 2, b, x\right) + a\right) - z \cdot \left(y - 1\right)\right)
\end{array}
Initial program 96.1%
Taylor expanded in t around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites98.0%
Applied rewrites98.0%
(FPCore (x y z t a b)
:precision binary64
(if (<= t -1.1e+20)
(- (+ (fma (- b a) t (fma (- y 2.0) b x)) a) (- z))
(if (<= t 7.2e-51)
(+ (+ (fma -2.0 b (fma (- b z) y z)) x) a)
(fma (- 1.0 t) a (fma (- (+ t y) 2.0) b (fma (- z) y z))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -1.1e+20) {
tmp = (fma((b - a), t, fma((y - 2.0), b, x)) + a) - -z;
} else if (t <= 7.2e-51) {
tmp = (fma(-2.0, b, fma((b - z), y, z)) + x) + a;
} else {
tmp = fma((1.0 - t), a, fma(((t + y) - 2.0), b, fma(-z, y, z)));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -1.1e+20) tmp = Float64(Float64(fma(Float64(b - a), t, fma(Float64(y - 2.0), b, x)) + a) - Float64(-z)); elseif (t <= 7.2e-51) tmp = Float64(Float64(fma(-2.0, b, fma(Float64(b - z), y, z)) + x) + a); else tmp = fma(Float64(1.0 - t), a, fma(Float64(Float64(t + y) - 2.0), b, fma(Float64(-z), y, z))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -1.1e+20], N[(N[(N[(N[(b - a), $MachinePrecision] * t + N[(N[(y - 2.0), $MachinePrecision] * b + x), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision] - (-z)), $MachinePrecision], If[LessEqual[t, 7.2e-51], N[(N[(N[(-2.0 * b + N[(N[(b - z), $MachinePrecision] * y + z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision] + a), $MachinePrecision], N[(N[(1.0 - t), $MachinePrecision] * a + N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + N[((-z) * y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.1 \cdot 10^{+20}:\\
\;\;\;\;\left(\mathsf{fma}\left(b - a, t, \mathsf{fma}\left(y - 2, b, x\right)\right) + a\right) - \left(-z\right)\\
\mathbf{elif}\;t \leq 7.2 \cdot 10^{-51}:\\
\;\;\;\;\left(\mathsf{fma}\left(-2, b, \mathsf{fma}\left(b - z, y, z\right)\right) + x\right) + a\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 - t, a, \mathsf{fma}\left(\left(t + y\right) - 2, b, \mathsf{fma}\left(-z, y, z\right)\right)\right)\\
\end{array}
\end{array}
if t < -1.1e20Initial program 92.8%
Taylor expanded in t around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites98.2%
Taylor expanded in y around 0
Applied rewrites92.9%
if -1.1e20 < t < 7.2000000000000001e-51Initial program 99.2%
Taylor expanded in y around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites100.0%
Taylor expanded in t around 0
Applied rewrites99.3%
if 7.2000000000000001e-51 < t Initial program 92.9%
Taylor expanded in x around 0
Applied rewrites94.5%
(FPCore (x y z t a b)
:precision binary64
(if (<= t -1.75e+167)
(fma (- b a) t (* (- b z) y))
(if (<= t -3.1e+20)
(fma (- t 2.0) b (+ (fma (- 1.0 t) a x) z))
(if (<= t 7.2e+22)
(+ (+ (fma -2.0 b (fma (- b z) y z)) x) a)
(fma (- b a) t (* (- 1.0 y) z))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -1.75e+167) {
tmp = fma((b - a), t, ((b - z) * y));
} else if (t <= -3.1e+20) {
tmp = fma((t - 2.0), b, (fma((1.0 - t), a, x) + z));
} else if (t <= 7.2e+22) {
tmp = (fma(-2.0, b, fma((b - z), y, z)) + x) + a;
} else {
tmp = fma((b - a), t, ((1.0 - y) * z));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -1.75e+167) tmp = fma(Float64(b - a), t, Float64(Float64(b - z) * y)); elseif (t <= -3.1e+20) tmp = fma(Float64(t - 2.0), b, Float64(fma(Float64(1.0 - t), a, x) + z)); elseif (t <= 7.2e+22) tmp = Float64(Float64(fma(-2.0, b, fma(Float64(b - z), y, z)) + x) + a); else tmp = fma(Float64(b - a), t, Float64(Float64(1.0 - y) * z)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -1.75e+167], N[(N[(b - a), $MachinePrecision] * t + N[(N[(b - z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -3.1e+20], N[(N[(t - 2.0), $MachinePrecision] * b + N[(N[(N[(1.0 - t), $MachinePrecision] * a + x), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7.2e+22], N[(N[(N[(-2.0 * b + N[(N[(b - z), $MachinePrecision] * y + z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision] + a), $MachinePrecision], N[(N[(b - a), $MachinePrecision] * t + N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.75 \cdot 10^{+167}:\\
\;\;\;\;\mathsf{fma}\left(b - a, t, \left(b - z\right) \cdot y\right)\\
\mathbf{elif}\;t \leq -3.1 \cdot 10^{+20}:\\
\;\;\;\;\mathsf{fma}\left(t - 2, b, \mathsf{fma}\left(1 - t, a, x\right) + z\right)\\
\mathbf{elif}\;t \leq 7.2 \cdot 10^{+22}:\\
\;\;\;\;\left(\mathsf{fma}\left(-2, b, \mathsf{fma}\left(b - z, y, z\right)\right) + x\right) + a\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b - a, t, \left(1 - y\right) \cdot z\right)\\
\end{array}
\end{array}
if t < -1.74999999999999994e167Initial program 84.6%
Taylor expanded in t around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites96.1%
Applied rewrites96.1%
Taylor expanded in y around inf
Applied rewrites96.5%
if -1.74999999999999994e167 < t < -3.1e20Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
+-commutativeN/A
associate--r+N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
*-lft-identityN/A
lower-+.f64N/A
Applied rewrites87.2%
if -3.1e20 < t < 7.2e22Initial program 99.3%
Taylor expanded in y around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites99.3%
Taylor expanded in t around 0
Applied rewrites97.8%
if 7.2e22 < t Initial program 91.0%
Taylor expanded in t around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites94.6%
Applied rewrites94.6%
Taylor expanded in z around inf
Applied rewrites86.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- (+ t y) 2.0) b)))
(if (<= b -1.1e+78)
t_1
(if (<= b 3.9e-113)
(fma (- 1.0 y) z x)
(if (<= b 1.5e-42)
(* (- 1.0 t) a)
(if (<= b 2.5e+133) (* (- b z) y) t_1))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((t + y) - 2.0) * b;
double tmp;
if (b <= -1.1e+78) {
tmp = t_1;
} else if (b <= 3.9e-113) {
tmp = fma((1.0 - y), z, x);
} else if (b <= 1.5e-42) {
tmp = (1.0 - t) * a;
} else if (b <= 2.5e+133) {
tmp = (b - z) * y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(t + y) - 2.0) * b) tmp = 0.0 if (b <= -1.1e+78) tmp = t_1; elseif (b <= 3.9e-113) tmp = fma(Float64(1.0 - y), z, x); elseif (b <= 1.5e-42) tmp = Float64(Float64(1.0 - t) * a); elseif (b <= 2.5e+133) tmp = Float64(Float64(b - z) * y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[b, -1.1e+78], t$95$1, If[LessEqual[b, 3.9e-113], N[(N[(1.0 - y), $MachinePrecision] * z + x), $MachinePrecision], If[LessEqual[b, 1.5e-42], N[(N[(1.0 - t), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[b, 2.5e+133], N[(N[(b - z), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(t + y\right) - 2\right) \cdot b\\
\mathbf{if}\;b \leq -1.1 \cdot 10^{+78}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 3.9 \cdot 10^{-113}:\\
\;\;\;\;\mathsf{fma}\left(1 - y, z, x\right)\\
\mathbf{elif}\;b \leq 1.5 \cdot 10^{-42}:\\
\;\;\;\;\left(1 - t\right) \cdot a\\
\mathbf{elif}\;b \leq 2.5 \cdot 10^{+133}:\\
\;\;\;\;\left(b - z\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -1.10000000000000007e78 or 2.4999999999999998e133 < b Initial program 88.9%
Taylor expanded in t around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites95.0%
Applied rewrites95.0%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6483.2
Applied rewrites83.2%
if -1.10000000000000007e78 < b < 3.8999999999999999e-113Initial program 100.0%
Taylor expanded in y around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites100.0%
Taylor expanded in b around 0
Applied rewrites90.7%
Taylor expanded in a around 0
Applied rewrites61.4%
if 3.8999999999999999e-113 < b < 1.50000000000000014e-42Initial program 99.7%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6465.0
Applied rewrites65.0%
if 1.50000000000000014e-42 < b < 2.4999999999999998e133Initial program 96.9%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6460.4
Applied rewrites60.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -3.1e+20) (not (<= t 7.2e+22))) (fma (- b a) t (* (- 1.0 y) z)) (+ (+ (fma -2.0 b (fma (- b z) y z)) x) a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -3.1e+20) || !(t <= 7.2e+22)) {
tmp = fma((b - a), t, ((1.0 - y) * z));
} else {
tmp = (fma(-2.0, b, fma((b - z), y, z)) + x) + a;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -3.1e+20) || !(t <= 7.2e+22)) tmp = fma(Float64(b - a), t, Float64(Float64(1.0 - y) * z)); else tmp = Float64(Float64(fma(-2.0, b, fma(Float64(b - z), y, z)) + x) + a); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -3.1e+20], N[Not[LessEqual[t, 7.2e+22]], $MachinePrecision]], N[(N[(b - a), $MachinePrecision] * t + N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-2.0 * b + N[(N[(b - z), $MachinePrecision] * y + z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision] + a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.1 \cdot 10^{+20} \lor \neg \left(t \leq 7.2 \cdot 10^{+22}\right):\\
\;\;\;\;\mathsf{fma}\left(b - a, t, \left(1 - y\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(-2, b, \mathsf{fma}\left(b - z, y, z\right)\right) + x\right) + a\\
\end{array}
\end{array}
if t < -3.1e20 or 7.2e22 < t Initial program 91.9%
Taylor expanded in t around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites96.4%
Applied rewrites96.4%
Taylor expanded in z around inf
Applied rewrites85.0%
if -3.1e20 < t < 7.2e22Initial program 99.3%
Taylor expanded in y around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites99.3%
Taylor expanded in t around 0
Applied rewrites97.8%
Final simplification92.2%
(FPCore (x y z t a b)
:precision binary64
(if (<= t -1.1e+20)
(- (+ (fma (- b a) t (fma (- y 2.0) b x)) a) (- z))
(if (<= t 7.2e+22)
(+ (+ (fma -2.0 b (fma (- b z) y z)) x) a)
(fma (- b a) t (* (- 1.0 y) z)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -1.1e+20) {
tmp = (fma((b - a), t, fma((y - 2.0), b, x)) + a) - -z;
} else if (t <= 7.2e+22) {
tmp = (fma(-2.0, b, fma((b - z), y, z)) + x) + a;
} else {
tmp = fma((b - a), t, ((1.0 - y) * z));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -1.1e+20) tmp = Float64(Float64(fma(Float64(b - a), t, fma(Float64(y - 2.0), b, x)) + a) - Float64(-z)); elseif (t <= 7.2e+22) tmp = Float64(Float64(fma(-2.0, b, fma(Float64(b - z), y, z)) + x) + a); else tmp = fma(Float64(b - a), t, Float64(Float64(1.0 - y) * z)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -1.1e+20], N[(N[(N[(N[(b - a), $MachinePrecision] * t + N[(N[(y - 2.0), $MachinePrecision] * b + x), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision] - (-z)), $MachinePrecision], If[LessEqual[t, 7.2e+22], N[(N[(N[(-2.0 * b + N[(N[(b - z), $MachinePrecision] * y + z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision] + a), $MachinePrecision], N[(N[(b - a), $MachinePrecision] * t + N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.1 \cdot 10^{+20}:\\
\;\;\;\;\left(\mathsf{fma}\left(b - a, t, \mathsf{fma}\left(y - 2, b, x\right)\right) + a\right) - \left(-z\right)\\
\mathbf{elif}\;t \leq 7.2 \cdot 10^{+22}:\\
\;\;\;\;\left(\mathsf{fma}\left(-2, b, \mathsf{fma}\left(b - z, y, z\right)\right) + x\right) + a\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b - a, t, \left(1 - y\right) \cdot z\right)\\
\end{array}
\end{array}
if t < -1.1e20Initial program 92.8%
Taylor expanded in t around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites98.2%
Taylor expanded in y around 0
Applied rewrites92.9%
if -1.1e20 < t < 7.2e22Initial program 99.3%
Taylor expanded in y around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites99.3%
Taylor expanded in t around 0
Applied rewrites97.8%
if 7.2e22 < t Initial program 91.0%
Taylor expanded in t around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites94.6%
Applied rewrites94.6%
Taylor expanded in z around inf
Applied rewrites86.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -1.35e+93) (not (<= b 1.4e+21))) (fma (- (+ y t) 2.0) b (* (- z) y)) (fma (- 1.0 y) z (- x (* (- t 1.0) a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -1.35e+93) || !(b <= 1.4e+21)) {
tmp = fma(((y + t) - 2.0), b, (-z * y));
} else {
tmp = fma((1.0 - y), z, (x - ((t - 1.0) * a)));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -1.35e+93) || !(b <= 1.4e+21)) tmp = fma(Float64(Float64(y + t) - 2.0), b, Float64(Float64(-z) * y)); else tmp = fma(Float64(1.0 - y), z, Float64(x - Float64(Float64(t - 1.0) * a))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -1.35e+93], N[Not[LessEqual[b, 1.4e+21]], $MachinePrecision]], N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b + N[((-z) * y), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - y), $MachinePrecision] * z + N[(x - N[(N[(t - 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.35 \cdot 10^{+93} \lor \neg \left(b \leq 1.4 \cdot 10^{+21}\right):\\
\;\;\;\;\mathsf{fma}\left(\left(y + t\right) - 2, b, \left(-z\right) \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 - y, z, x - \left(t - 1\right) \cdot a\right)\\
\end{array}
\end{array}
if b < -1.35e93 or 1.4e21 < b Initial program 90.6%
Taylor expanded in y around inf
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6479.0
Applied rewrites79.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6482.8
Applied rewrites82.8%
if -1.35e93 < b < 1.4e21Initial program 99.9%
Taylor expanded in y around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites99.9%
Taylor expanded in b around 0
Applied rewrites89.8%
Final simplification86.9%
(FPCore (x y z t a b) :precision binary64 (- (+ (fma (- b a) t (fma (- y 2.0) b x)) a) (* (- y 1.0) z)))
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)) + a) - ((y - 1.0) * z);
}
function code(x, y, z, t, a, b) return Float64(Float64(fma(Float64(b - a), t, fma(Float64(y - 2.0), b, x)) + a) - Float64(Float64(y - 1.0) * z)) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(b - a), $MachinePrecision] * t + N[(N[(y - 2.0), $MachinePrecision] * b + x), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision] - N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\mathsf{fma}\left(b - a, t, \mathsf{fma}\left(y - 2, b, x\right)\right) + a\right) - \left(y - 1\right) \cdot z
\end{array}
Initial program 96.1%
Taylor expanded in t around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites98.0%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -8.8e+14) (not (<= t 2.75e+22))) (fma (- b a) t (* (- 1.0 y) z)) (+ (fma -2.0 b (fma (- b z) y z)) a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -8.8e+14) || !(t <= 2.75e+22)) {
tmp = fma((b - a), t, ((1.0 - y) * z));
} else {
tmp = fma(-2.0, b, fma((b - z), y, z)) + a;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -8.8e+14) || !(t <= 2.75e+22)) tmp = fma(Float64(b - a), t, Float64(Float64(1.0 - y) * z)); else tmp = Float64(fma(-2.0, b, fma(Float64(b - z), y, z)) + a); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -8.8e+14], N[Not[LessEqual[t, 2.75e+22]], $MachinePrecision]], N[(N[(b - a), $MachinePrecision] * t + N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(N[(-2.0 * b + N[(N[(b - z), $MachinePrecision] * y + z), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.8 \cdot 10^{+14} \lor \neg \left(t \leq 2.75 \cdot 10^{+22}\right):\\
\;\;\;\;\mathsf{fma}\left(b - a, t, \left(1 - y\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-2, b, \mathsf{fma}\left(b - z, y, z\right)\right) + a\\
\end{array}
\end{array}
if t < -8.8e14 or 2.7500000000000001e22 < t Initial program 92.1%
Taylor expanded in t around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites96.5%
Applied rewrites96.5%
Taylor expanded in z around inf
Applied rewrites84.5%
if -8.8e14 < t < 2.7500000000000001e22Initial program 99.3%
Taylor expanded in y around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites99.3%
Taylor expanded in t around 0
Applied rewrites98.4%
Taylor expanded in x around 0
Applied rewrites82.7%
Final simplification83.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b a) t)))
(if (<= t -6e+23)
t_1
(if (<= t -5.2e-66)
(fma (- 1.0 y) z x)
(if (<= t 1.15e+23) (+ (fma b (+ y -2.0) 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 <= -6e+23) {
tmp = t_1;
} else if (t <= -5.2e-66) {
tmp = fma((1.0 - y), z, x);
} else if (t <= 1.15e+23) {
tmp = fma(b, (y + -2.0), 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 <= -6e+23) tmp = t_1; elseif (t <= -5.2e-66) tmp = fma(Float64(1.0 - y), z, x); elseif (t <= 1.15e+23) tmp = Float64(fma(b, Float64(y + -2.0), x) + a); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -6e+23], t$95$1, If[LessEqual[t, -5.2e-66], N[(N[(1.0 - y), $MachinePrecision] * z + x), $MachinePrecision], If[LessEqual[t, 1.15e+23], N[(N[(b * N[(y + -2.0), $MachinePrecision] + 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 -6 \cdot 10^{+23}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -5.2 \cdot 10^{-66}:\\
\;\;\;\;\mathsf{fma}\left(1 - y, z, x\right)\\
\mathbf{elif}\;t \leq 1.15 \cdot 10^{+23}:\\
\;\;\;\;\mathsf{fma}\left(b, y + -2, x\right) + a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -6.0000000000000002e23 or 1.15e23 < t Initial program 91.8%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6467.0
Applied rewrites67.0%
if -6.0000000000000002e23 < t < -5.1999999999999998e-66Initial program 99.9%
Taylor expanded in y around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites100.0%
Taylor expanded in b around 0
Applied rewrites87.4%
Taylor expanded in a around 0
Applied rewrites77.3%
if -5.1999999999999998e-66 < t < 1.15e23Initial program 99.1%
Taylor expanded in y around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites99.1%
Taylor expanded in t around 0
Applied rewrites98.0%
Taylor expanded in z around 0
Applied rewrites70.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -3.4) (not (<= y 8.5e+21))) (fma (- b a) t (* (- b z) y)) (+ z (- x (* (- t 1.0) a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -3.4) || !(y <= 8.5e+21)) {
tmp = fma((b - a), t, ((b - z) * y));
} else {
tmp = z + (x - ((t - 1.0) * a));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -3.4) || !(y <= 8.5e+21)) tmp = fma(Float64(b - a), t, Float64(Float64(b - z) * y)); else tmp = Float64(z + Float64(x - Float64(Float64(t - 1.0) * a))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -3.4], N[Not[LessEqual[y, 8.5e+21]], $MachinePrecision]], N[(N[(b - a), $MachinePrecision] * t + N[(N[(b - z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[(z + N[(x - N[(N[(t - 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.4 \lor \neg \left(y \leq 8.5 \cdot 10^{+21}\right):\\
\;\;\;\;\mathsf{fma}\left(b - a, t, \left(b - z\right) \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;z + \left(x - \left(t - 1\right) \cdot a\right)\\
\end{array}
\end{array}
if y < -3.39999999999999991 or 8.5e21 < y Initial program 94.6%
Taylor expanded in t around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites96.2%
Applied rewrites96.2%
Taylor expanded in y around inf
Applied rewrites85.3%
if -3.39999999999999991 < y < 8.5e21Initial program 97.5%
Taylor expanded in y around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites97.6%
Taylor expanded in b around 0
Applied rewrites71.3%
Taylor expanded in y around 0
Applied rewrites71.3%
Final simplification78.5%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -5.2e-66) (not (<= t 1.05))) (fma (- b a) t (* (- 1.0 y) z)) (+ (fma b (+ y -2.0) x) a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -5.2e-66) || !(t <= 1.05)) {
tmp = fma((b - a), t, ((1.0 - y) * z));
} else {
tmp = fma(b, (y + -2.0), x) + a;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -5.2e-66) || !(t <= 1.05)) tmp = fma(Float64(b - a), t, Float64(Float64(1.0 - y) * z)); else tmp = Float64(fma(b, Float64(y + -2.0), x) + a); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -5.2e-66], N[Not[LessEqual[t, 1.05]], $MachinePrecision]], N[(N[(b - a), $MachinePrecision] * t + N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(N[(b * N[(y + -2.0), $MachinePrecision] + x), $MachinePrecision] + a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.2 \cdot 10^{-66} \lor \neg \left(t \leq 1.05\right):\\
\;\;\;\;\mathsf{fma}\left(b - a, t, \left(1 - y\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b, y + -2, x\right) + a\\
\end{array}
\end{array}
if t < -5.1999999999999998e-66 or 1.05000000000000004 < t Initial program 93.7%
Taylor expanded in t around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites97.2%
Applied rewrites97.2%
Taylor expanded in z around inf
Applied rewrites81.2%
if -5.1999999999999998e-66 < t < 1.05000000000000004Initial program 99.1%
Taylor expanded in y around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites100.0%
Taylor expanded in t around 0
Applied rewrites99.4%
Taylor expanded in z around 0
Applied rewrites72.3%
Final simplification77.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -9.5e+22) (not (<= y 2.2e+25))) (* (- b z) y) (+ z (- x (* (- t 1.0) a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -9.5e+22) || !(y <= 2.2e+25)) {
tmp = (b - z) * y;
} else {
tmp = z + (x - ((t - 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 ((y <= (-9.5d+22)) .or. (.not. (y <= 2.2d+25))) then
tmp = (b - z) * y
else
tmp = z + (x - ((t - 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 ((y <= -9.5e+22) || !(y <= 2.2e+25)) {
tmp = (b - z) * y;
} else {
tmp = z + (x - ((t - 1.0) * a));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -9.5e+22) or not (y <= 2.2e+25): tmp = (b - z) * y else: tmp = z + (x - ((t - 1.0) * a)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -9.5e+22) || !(y <= 2.2e+25)) tmp = Float64(Float64(b - z) * y); else tmp = Float64(z + Float64(x - Float64(Float64(t - 1.0) * a))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -9.5e+22) || ~((y <= 2.2e+25))) tmp = (b - z) * y; else tmp = z + (x - ((t - 1.0) * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -9.5e+22], N[Not[LessEqual[y, 2.2e+25]], $MachinePrecision]], N[(N[(b - z), $MachinePrecision] * y), $MachinePrecision], N[(z + N[(x - N[(N[(t - 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.5 \cdot 10^{+22} \lor \neg \left(y \leq 2.2 \cdot 10^{+25}\right):\\
\;\;\;\;\left(b - z\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;z + \left(x - \left(t - 1\right) \cdot a\right)\\
\end{array}
\end{array}
if y < -9.49999999999999937e22 or 2.2000000000000001e25 < y Initial program 94.5%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6472.0
Applied rewrites72.0%
if -9.49999999999999937e22 < y < 2.2000000000000001e25Initial program 97.6%
Taylor expanded in y around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites97.6%
Taylor expanded in b around 0
Applied rewrites71.5%
Taylor expanded in y around 0
Applied rewrites70.8%
Final simplification71.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b a) t)))
(if (<= t -6e+23)
t_1
(if (<= t 3.4e-283)
(fma (- 1.0 y) z x)
(if (<= t 1.4e+24) (* (- b z) y) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (b - a) * t;
double tmp;
if (t <= -6e+23) {
tmp = t_1;
} else if (t <= 3.4e-283) {
tmp = fma((1.0 - y), z, x);
} else if (t <= 1.4e+24) {
tmp = (b - z) * y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(b - a) * t) tmp = 0.0 if (t <= -6e+23) tmp = t_1; elseif (t <= 3.4e-283) tmp = fma(Float64(1.0 - y), z, x); elseif (t <= 1.4e+24) tmp = Float64(Float64(b - z) * y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -6e+23], t$95$1, If[LessEqual[t, 3.4e-283], N[(N[(1.0 - y), $MachinePrecision] * z + x), $MachinePrecision], If[LessEqual[t, 1.4e+24], N[(N[(b - z), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(b - a\right) \cdot t\\
\mathbf{if}\;t \leq -6 \cdot 10^{+23}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.4 \cdot 10^{-283}:\\
\;\;\;\;\mathsf{fma}\left(1 - y, z, x\right)\\
\mathbf{elif}\;t \leq 1.4 \cdot 10^{+24}:\\
\;\;\;\;\left(b - z\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -6.0000000000000002e23 or 1.4000000000000001e24 < t Initial program 91.8%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6467.0
Applied rewrites67.0%
if -6.0000000000000002e23 < t < 3.3999999999999998e-283Initial program 98.8%
Taylor expanded in y around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites100.0%
Taylor expanded in b around 0
Applied rewrites76.0%
Taylor expanded in a around 0
Applied rewrites59.9%
if 3.3999999999999998e-283 < t < 1.4000000000000001e24Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6450.0
Applied rewrites50.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b a) t)))
(if (<= t -6e+23)
t_1
(if (<= t -5.8e-167)
(* (- 1.0 y) z)
(if (<= t 6.8e+22) (* (- y 2.0) b) 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 <= -6e+23) {
tmp = t_1;
} else if (t <= -5.8e-167) {
tmp = (1.0 - y) * z;
} else if (t <= 6.8e+22) {
tmp = (y - 2.0) * b;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = (b - a) * t
if (t <= (-6d+23)) then
tmp = t_1
else if (t <= (-5.8d-167)) then
tmp = (1.0d0 - y) * z
else if (t <= 6.8d+22) then
tmp = (y - 2.0d0) * b
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (b - a) * t;
double tmp;
if (t <= -6e+23) {
tmp = t_1;
} else if (t <= -5.8e-167) {
tmp = (1.0 - y) * z;
} else if (t <= 6.8e+22) {
tmp = (y - 2.0) * b;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (b - a) * t tmp = 0 if t <= -6e+23: tmp = t_1 elif t <= -5.8e-167: tmp = (1.0 - y) * z elif t <= 6.8e+22: tmp = (y - 2.0) * b 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 <= -6e+23) tmp = t_1; elseif (t <= -5.8e-167) tmp = Float64(Float64(1.0 - y) * z); elseif (t <= 6.8e+22) tmp = Float64(Float64(y - 2.0) * b); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (b - a) * t; tmp = 0.0; if (t <= -6e+23) tmp = t_1; elseif (t <= -5.8e-167) tmp = (1.0 - y) * z; elseif (t <= 6.8e+22) tmp = (y - 2.0) * b; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -6e+23], t$95$1, If[LessEqual[t, -5.8e-167], N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[t, 6.8e+22], N[(N[(y - 2.0), $MachinePrecision] * b), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(b - a\right) \cdot t\\
\mathbf{if}\;t \leq -6 \cdot 10^{+23}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -5.8 \cdot 10^{-167}:\\
\;\;\;\;\left(1 - y\right) \cdot z\\
\mathbf{elif}\;t \leq 6.8 \cdot 10^{+22}:\\
\;\;\;\;\left(y - 2\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -6.0000000000000002e23 or 6.8e22 < t Initial program 91.8%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6467.0
Applied rewrites67.0%
if -6.0000000000000002e23 < t < -5.80000000000000005e-167Initial program 100.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6451.3
Applied rewrites51.3%
if -5.80000000000000005e-167 < t < 6.8e22Initial program 98.9%
Taylor expanded in t around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites98.9%
Applied rewrites98.9%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6438.2
Applied rewrites38.2%
Taylor expanded in t around 0
Applied rewrites37.0%
(FPCore (x y z t a b)
:precision binary64
(if (<= b -3.7e+93)
(* (- t 2.0) b)
(if (<= b -7.3e-224)
(* (- 1.0 y) z)
(if (<= b 1.4e+21) (* (- 1.0 t) a) (* (- y 2.0) b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -3.7e+93) {
tmp = (t - 2.0) * b;
} else if (b <= -7.3e-224) {
tmp = (1.0 - y) * z;
} else if (b <= 1.4e+21) {
tmp = (1.0 - t) * a;
} else {
tmp = (y - 2.0) * b;
}
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 <= (-3.7d+93)) then
tmp = (t - 2.0d0) * b
else if (b <= (-7.3d-224)) then
tmp = (1.0d0 - y) * z
else if (b <= 1.4d+21) then
tmp = (1.0d0 - t) * a
else
tmp = (y - 2.0d0) * b
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 <= -3.7e+93) {
tmp = (t - 2.0) * b;
} else if (b <= -7.3e-224) {
tmp = (1.0 - y) * z;
} else if (b <= 1.4e+21) {
tmp = (1.0 - t) * a;
} else {
tmp = (y - 2.0) * b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if b <= -3.7e+93: tmp = (t - 2.0) * b elif b <= -7.3e-224: tmp = (1.0 - y) * z elif b <= 1.4e+21: tmp = (1.0 - t) * a else: tmp = (y - 2.0) * b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -3.7e+93) tmp = Float64(Float64(t - 2.0) * b); elseif (b <= -7.3e-224) tmp = Float64(Float64(1.0 - y) * z); elseif (b <= 1.4e+21) tmp = Float64(Float64(1.0 - t) * a); else tmp = Float64(Float64(y - 2.0) * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (b <= -3.7e+93) tmp = (t - 2.0) * b; elseif (b <= -7.3e-224) tmp = (1.0 - y) * z; elseif (b <= 1.4e+21) tmp = (1.0 - t) * a; else tmp = (y - 2.0) * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -3.7e+93], N[(N[(t - 2.0), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[b, -7.3e-224], N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[b, 1.4e+21], N[(N[(1.0 - t), $MachinePrecision] * a), $MachinePrecision], N[(N[(y - 2.0), $MachinePrecision] * b), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.7 \cdot 10^{+93}:\\
\;\;\;\;\left(t - 2\right) \cdot b\\
\mathbf{elif}\;b \leq -7.3 \cdot 10^{-224}:\\
\;\;\;\;\left(1 - y\right) \cdot z\\
\mathbf{elif}\;b \leq 1.4 \cdot 10^{+21}:\\
\;\;\;\;\left(1 - t\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(y - 2\right) \cdot b\\
\end{array}
\end{array}
if b < -3.69999999999999987e93Initial program 93.2%
Taylor expanded in t around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites97.7%
Applied rewrites97.7%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6484.5
Applied rewrites84.5%
Taylor expanded in y around 0
Applied rewrites62.6%
if -3.69999999999999987e93 < b < -7.3e-224Initial program 98.5%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6445.2
Applied rewrites45.2%
if -7.3e-224 < b < 1.4e21Initial program 99.9%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6447.1
Applied rewrites47.1%
if 1.4e21 < b Initial program 90.1%
Taylor expanded in t around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites95.1%
Applied rewrites95.1%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6463.9
Applied rewrites63.9%
Taylor expanded in t around 0
Applied rewrites49.1%
(FPCore (x y z t a b)
:precision binary64
(if (<= b -3.7e+93)
(* (- t 2.0) b)
(if (<= b -4.4e-221)
(* (- y) z)
(if (<= b 1.4e+21) (* (- 1.0 t) a) (* (- y 2.0) b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -3.7e+93) {
tmp = (t - 2.0) * b;
} else if (b <= -4.4e-221) {
tmp = -y * z;
} else if (b <= 1.4e+21) {
tmp = (1.0 - t) * a;
} else {
tmp = (y - 2.0) * b;
}
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 <= (-3.7d+93)) then
tmp = (t - 2.0d0) * b
else if (b <= (-4.4d-221)) then
tmp = -y * z
else if (b <= 1.4d+21) then
tmp = (1.0d0 - t) * a
else
tmp = (y - 2.0d0) * b
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 <= -3.7e+93) {
tmp = (t - 2.0) * b;
} else if (b <= -4.4e-221) {
tmp = -y * z;
} else if (b <= 1.4e+21) {
tmp = (1.0 - t) * a;
} else {
tmp = (y - 2.0) * b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if b <= -3.7e+93: tmp = (t - 2.0) * b elif b <= -4.4e-221: tmp = -y * z elif b <= 1.4e+21: tmp = (1.0 - t) * a else: tmp = (y - 2.0) * b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -3.7e+93) tmp = Float64(Float64(t - 2.0) * b); elseif (b <= -4.4e-221) tmp = Float64(Float64(-y) * z); elseif (b <= 1.4e+21) tmp = Float64(Float64(1.0 - t) * a); else tmp = Float64(Float64(y - 2.0) * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (b <= -3.7e+93) tmp = (t - 2.0) * b; elseif (b <= -4.4e-221) tmp = -y * z; elseif (b <= 1.4e+21) tmp = (1.0 - t) * a; else tmp = (y - 2.0) * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -3.7e+93], N[(N[(t - 2.0), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[b, -4.4e-221], N[((-y) * z), $MachinePrecision], If[LessEqual[b, 1.4e+21], N[(N[(1.0 - t), $MachinePrecision] * a), $MachinePrecision], N[(N[(y - 2.0), $MachinePrecision] * b), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.7 \cdot 10^{+93}:\\
\;\;\;\;\left(t - 2\right) \cdot b\\
\mathbf{elif}\;b \leq -4.4 \cdot 10^{-221}:\\
\;\;\;\;\left(-y\right) \cdot z\\
\mathbf{elif}\;b \leq 1.4 \cdot 10^{+21}:\\
\;\;\;\;\left(1 - t\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(y - 2\right) \cdot b\\
\end{array}
\end{array}
if b < -3.69999999999999987e93Initial program 93.2%
Taylor expanded in t around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites97.7%
Applied rewrites97.7%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6484.5
Applied rewrites84.5%
Taylor expanded in y around 0
Applied rewrites62.6%
if -3.69999999999999987e93 < b < -4.40000000000000003e-221Initial program 98.5%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6445.2
Applied rewrites45.2%
Taylor expanded in y around inf
Applied rewrites32.4%
if -4.40000000000000003e-221 < b < 1.4e21Initial program 99.9%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6447.1
Applied rewrites47.1%
if 1.4e21 < b Initial program 90.1%
Taylor expanded in t around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites95.1%
Applied rewrites95.1%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6463.9
Applied rewrites63.9%
Taylor expanded in t around 0
Applied rewrites49.1%
(FPCore (x y z t a b)
:precision binary64
(if (<= b -3.7e+93)
(* (- t 2.0) b)
(if (<= b 2.5e-207)
(* (- y) z)
(if (<= b 3.1e+16) (* (- t) a) (* (- y 2.0) b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -3.7e+93) {
tmp = (t - 2.0) * b;
} else if (b <= 2.5e-207) {
tmp = -y * z;
} else if (b <= 3.1e+16) {
tmp = -t * a;
} else {
tmp = (y - 2.0) * b;
}
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 <= (-3.7d+93)) then
tmp = (t - 2.0d0) * b
else if (b <= 2.5d-207) then
tmp = -y * z
else if (b <= 3.1d+16) then
tmp = -t * a
else
tmp = (y - 2.0d0) * b
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 <= -3.7e+93) {
tmp = (t - 2.0) * b;
} else if (b <= 2.5e-207) {
tmp = -y * z;
} else if (b <= 3.1e+16) {
tmp = -t * a;
} else {
tmp = (y - 2.0) * b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if b <= -3.7e+93: tmp = (t - 2.0) * b elif b <= 2.5e-207: tmp = -y * z elif b <= 3.1e+16: tmp = -t * a else: tmp = (y - 2.0) * b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -3.7e+93) tmp = Float64(Float64(t - 2.0) * b); elseif (b <= 2.5e-207) tmp = Float64(Float64(-y) * z); elseif (b <= 3.1e+16) tmp = Float64(Float64(-t) * a); else tmp = Float64(Float64(y - 2.0) * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (b <= -3.7e+93) tmp = (t - 2.0) * b; elseif (b <= 2.5e-207) tmp = -y * z; elseif (b <= 3.1e+16) tmp = -t * a; else tmp = (y - 2.0) * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -3.7e+93], N[(N[(t - 2.0), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[b, 2.5e-207], N[((-y) * z), $MachinePrecision], If[LessEqual[b, 3.1e+16], N[((-t) * a), $MachinePrecision], N[(N[(y - 2.0), $MachinePrecision] * b), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.7 \cdot 10^{+93}:\\
\;\;\;\;\left(t - 2\right) \cdot b\\
\mathbf{elif}\;b \leq 2.5 \cdot 10^{-207}:\\
\;\;\;\;\left(-y\right) \cdot z\\
\mathbf{elif}\;b \leq 3.1 \cdot 10^{+16}:\\
\;\;\;\;\left(-t\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(y - 2\right) \cdot b\\
\end{array}
\end{array}
if b < -3.69999999999999987e93Initial program 93.2%
Taylor expanded in t around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites97.7%
Applied rewrites97.7%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6484.5
Applied rewrites84.5%
Taylor expanded in y around 0
Applied rewrites62.6%
if -3.69999999999999987e93 < b < 2.50000000000000007e-207Initial program 99.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6443.3
Applied rewrites43.3%
Taylor expanded in y around inf
Applied rewrites33.5%
if 2.50000000000000007e-207 < b < 3.1e16Initial program 99.9%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6450.4
Applied rewrites50.4%
Taylor expanded in t around inf
Applied rewrites35.4%
if 3.1e16 < b Initial program 90.1%
Taylor expanded in t around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites95.1%
Applied rewrites95.1%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6463.9
Applied rewrites63.9%
Taylor expanded in t around 0
Applied rewrites49.1%
(FPCore (x y z t a b) :precision binary64 (if (<= b -3.7e+93) (* t b) (if (<= b 2.5e-207) (* (- y) z) (if (<= b 5.8e+18) (* (- t) a) (* b y)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -3.7e+93) {
tmp = t * b;
} else if (b <= 2.5e-207) {
tmp = -y * z;
} else if (b <= 5.8e+18) {
tmp = -t * a;
} 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 (b <= (-3.7d+93)) then
tmp = t * b
else if (b <= 2.5d-207) then
tmp = -y * z
else if (b <= 5.8d+18) then
tmp = -t * a
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 (b <= -3.7e+93) {
tmp = t * b;
} else if (b <= 2.5e-207) {
tmp = -y * z;
} else if (b <= 5.8e+18) {
tmp = -t * a;
} else {
tmp = b * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if b <= -3.7e+93: tmp = t * b elif b <= 2.5e-207: tmp = -y * z elif b <= 5.8e+18: tmp = -t * a else: tmp = b * y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -3.7e+93) tmp = Float64(t * b); elseif (b <= 2.5e-207) tmp = Float64(Float64(-y) * z); elseif (b <= 5.8e+18) tmp = Float64(Float64(-t) * a); else tmp = Float64(b * y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (b <= -3.7e+93) tmp = t * b; elseif (b <= 2.5e-207) tmp = -y * z; elseif (b <= 5.8e+18) tmp = -t * a; else tmp = b * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -3.7e+93], N[(t * b), $MachinePrecision], If[LessEqual[b, 2.5e-207], N[((-y) * z), $MachinePrecision], If[LessEqual[b, 5.8e+18], N[((-t) * a), $MachinePrecision], N[(b * y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.7 \cdot 10^{+93}:\\
\;\;\;\;t \cdot b\\
\mathbf{elif}\;b \leq 2.5 \cdot 10^{-207}:\\
\;\;\;\;\left(-y\right) \cdot z\\
\mathbf{elif}\;b \leq 5.8 \cdot 10^{+18}:\\
\;\;\;\;\left(-t\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;b \cdot y\\
\end{array}
\end{array}
if b < -3.69999999999999987e93Initial program 93.2%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6449.0
Applied rewrites49.0%
Taylor expanded in a around 0
Applied rewrites44.7%
if -3.69999999999999987e93 < b < 2.50000000000000007e-207Initial program 99.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6443.3
Applied rewrites43.3%
Taylor expanded in y around inf
Applied rewrites33.5%
if 2.50000000000000007e-207 < b < 5.8e18Initial program 99.9%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6450.4
Applied rewrites50.4%
Taylor expanded in t around inf
Applied rewrites35.4%
if 5.8e18 < b Initial program 90.1%
Taylor expanded in t around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites95.1%
Applied rewrites95.1%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6463.9
Applied rewrites63.9%
Taylor expanded in y around inf
Applied rewrites39.5%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -9.5e+20) (not (<= y 104.0))) (* (- b z) y) (* (- 1.0 t) a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -9.5e+20) || !(y <= 104.0)) {
tmp = (b - z) * y;
} 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 ((y <= (-9.5d+20)) .or. (.not. (y <= 104.0d0))) then
tmp = (b - z) * y
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 ((y <= -9.5e+20) || !(y <= 104.0)) {
tmp = (b - z) * y;
} else {
tmp = (1.0 - t) * a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -9.5e+20) or not (y <= 104.0): tmp = (b - z) * y else: tmp = (1.0 - t) * a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -9.5e+20) || !(y <= 104.0)) tmp = Float64(Float64(b - z) * y); 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 ((y <= -9.5e+20) || ~((y <= 104.0))) tmp = (b - z) * y; else tmp = (1.0 - t) * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -9.5e+20], N[Not[LessEqual[y, 104.0]], $MachinePrecision]], N[(N[(b - z), $MachinePrecision] * y), $MachinePrecision], N[(N[(1.0 - t), $MachinePrecision] * a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.5 \cdot 10^{+20} \lor \neg \left(y \leq 104\right):\\
\;\;\;\;\left(b - z\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(1 - t\right) \cdot a\\
\end{array}
\end{array}
if y < -9.5e20 or 104 < y Initial program 94.5%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6470.9
Applied rewrites70.9%
if -9.5e20 < y < 104Initial program 97.6%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6441.5
Applied rewrites41.5%
Final simplification56.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -4.2e+47) (not (<= y 5.4e+15))) (* (- y) z) (* (- t 2.0) b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -4.2e+47) || !(y <= 5.4e+15)) {
tmp = -y * z;
} else {
tmp = (t - 2.0) * b;
}
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.2d+47)) .or. (.not. (y <= 5.4d+15))) then
tmp = -y * z
else
tmp = (t - 2.0d0) * b
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.2e+47) || !(y <= 5.4e+15)) {
tmp = -y * z;
} else {
tmp = (t - 2.0) * b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -4.2e+47) or not (y <= 5.4e+15): tmp = -y * z else: tmp = (t - 2.0) * b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -4.2e+47) || !(y <= 5.4e+15)) tmp = Float64(Float64(-y) * z); else tmp = Float64(Float64(t - 2.0) * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -4.2e+47) || ~((y <= 5.4e+15))) tmp = -y * z; else tmp = (t - 2.0) * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -4.2e+47], N[Not[LessEqual[y, 5.4e+15]], $MachinePrecision]], N[((-y) * z), $MachinePrecision], N[(N[(t - 2.0), $MachinePrecision] * b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.2 \cdot 10^{+47} \lor \neg \left(y \leq 5.4 \cdot 10^{+15}\right):\\
\;\;\;\;\left(-y\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;\left(t - 2\right) \cdot b\\
\end{array}
\end{array}
if y < -4.2e47 or 5.4e15 < y Initial program 94.2%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6445.5
Applied rewrites45.5%
Taylor expanded in y around inf
Applied rewrites45.5%
if -4.2e47 < y < 5.4e15Initial program 97.7%
Taylor expanded in t around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites99.2%
Applied rewrites99.2%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6434.9
Applied rewrites34.9%
Taylor expanded in y around 0
Applied rewrites32.8%
Final simplification38.8%
(FPCore (x y z t a b) :precision binary64 (if (<= b -1.25e+93) (* t b) (if (<= b 5.8e+18) (* (- t) a) (* b y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -1.25e+93) {
tmp = t * b;
} else if (b <= 5.8e+18) {
tmp = -t * a;
} 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 (b <= (-1.25d+93)) then
tmp = t * b
else if (b <= 5.8d+18) then
tmp = -t * a
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 (b <= -1.25e+93) {
tmp = t * b;
} else if (b <= 5.8e+18) {
tmp = -t * a;
} else {
tmp = b * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if b <= -1.25e+93: tmp = t * b elif b <= 5.8e+18: tmp = -t * a else: tmp = b * y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -1.25e+93) tmp = Float64(t * b); elseif (b <= 5.8e+18) tmp = Float64(Float64(-t) * a); else tmp = Float64(b * y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (b <= -1.25e+93) tmp = t * b; elseif (b <= 5.8e+18) tmp = -t * a; else tmp = b * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -1.25e+93], N[(t * b), $MachinePrecision], If[LessEqual[b, 5.8e+18], N[((-t) * a), $MachinePrecision], N[(b * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.25 \cdot 10^{+93}:\\
\;\;\;\;t \cdot b\\
\mathbf{elif}\;b \leq 5.8 \cdot 10^{+18}:\\
\;\;\;\;\left(-t\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;b \cdot y\\
\end{array}
\end{array}
if b < -1.25e93Initial program 91.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6447.9
Applied rewrites47.9%
Taylor expanded in a around 0
Applied rewrites43.7%
if -1.25e93 < b < 5.8e18Initial program 99.9%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6436.8
Applied rewrites36.8%
Taylor expanded in t around inf
Applied rewrites24.5%
if 5.8e18 < b Initial program 90.1%
Taylor expanded in t around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites95.1%
Applied rewrites95.1%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6463.9
Applied rewrites63.9%
Taylor expanded in y around inf
Applied rewrites39.5%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -7.2e+23) (not (<= t 1.18e+44))) (* t b) (* b y)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -7.2e+23) || !(t <= 1.18e+44)) {
tmp = t * b;
} 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 <= (-7.2d+23)) .or. (.not. (t <= 1.18d+44))) then
tmp = t * b
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 <= -7.2e+23) || !(t <= 1.18e+44)) {
tmp = t * b;
} else {
tmp = b * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -7.2e+23) or not (t <= 1.18e+44): tmp = t * b else: tmp = b * y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -7.2e+23) || !(t <= 1.18e+44)) tmp = Float64(t * b); else tmp = Float64(b * y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((t <= -7.2e+23) || ~((t <= 1.18e+44))) tmp = t * b; else tmp = b * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -7.2e+23], N[Not[LessEqual[t, 1.18e+44]], $MachinePrecision]], N[(t * b), $MachinePrecision], N[(b * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.2 \cdot 10^{+23} \lor \neg \left(t \leq 1.18 \cdot 10^{+44}\right):\\
\;\;\;\;t \cdot b\\
\mathbf{else}:\\
\;\;\;\;b \cdot y\\
\end{array}
\end{array}
if t < -7.1999999999999997e23 or 1.17999999999999997e44 < t Initial program 91.3%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6466.9
Applied rewrites66.9%
Taylor expanded in a around 0
Applied rewrites36.7%
if -7.1999999999999997e23 < t < 1.17999999999999997e44Initial program 99.3%
Taylor expanded in t around 0
associate--r+N/A
lower--.f64N/A
Applied rewrites99.3%
Applied rewrites99.3%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6432.2
Applied rewrites32.2%
Taylor expanded in y around inf
Applied rewrites21.6%
Final simplification27.8%
(FPCore (x y z t a b) :precision binary64 (* t b))
double code(double x, double y, double z, double t, double a, double b) {
return t * 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 = t * b
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return t * b;
}
def code(x, y, z, t, a, b): return t * b
function code(x, y, z, t, a, b) return Float64(t * b) end
function tmp = code(x, y, z, t, a, b) tmp = t * b; end
code[x_, y_, z_, t_, a_, b_] := N[(t * b), $MachinePrecision]
\begin{array}{l}
\\
t \cdot b
\end{array}
Initial program 96.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6431.2
Applied rewrites31.2%
Taylor expanded in a around 0
Applied rewrites16.7%
herbie shell --seed 2025008
(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)))