
(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}
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
(let* ((t_1 (* (- y 1.0) z))
(t_2 (+ (- (- x t_1) (* (- t 1.0) a)) (* (- (+ y t) 2.0) b))))
(if (<= t_2 INFINITY) t_2 (- x (fma (- t 1.0) a t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (y - 1.0) * z;
double t_2 = ((x - t_1) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b);
double tmp;
if (t_2 <= ((double) INFINITY)) {
tmp = t_2;
} else {
tmp = x - fma((t - 1.0), a, t_1);
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(y - 1.0) * z) t_2 = Float64(Float64(Float64(x - t_1) - Float64(Float64(t - 1.0) * a)) + Float64(Float64(Float64(y + t) - 2.0) * b)) tmp = 0.0 if (t_2 <= Inf) tmp = t_2; else tmp = Float64(x - fma(Float64(t - 1.0), a, t_1)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(x - t$95$1), $MachinePrecision] - N[(N[(t - 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, Infinity], t$95$2, N[(x - N[(N[(t - 1.0), $MachinePrecision] * a + t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - 1\right) \cdot z\\
t_2 := \left(\left(x - t\_1\right) - \left(t - 1\right) \cdot a\right) + \left(\left(y + t\right) - 2\right) \cdot b\\
\mathbf{if}\;t\_2 \leq \infty:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;x - \mathsf{fma}\left(t - 1, a, t\_1\right)\\
\end{array}
\end{array}
if (+.f64 (-.f64 (-.f64 x (*.f64 (-.f64 y #s(literal 1 binary64)) z)) (*.f64 (-.f64 t #s(literal 1 binary64)) a)) (*.f64 (-.f64 (+.f64 y t) #s(literal 2 binary64)) b)) < +inf.0Initial program 100.0%
if +inf.0 < (+.f64 (-.f64 (-.f64 x (*.f64 (-.f64 y #s(literal 1 binary64)) z)) (*.f64 (-.f64 t #s(literal 1 binary64)) a)) (*.f64 (-.f64 (+.f64 y t) #s(literal 2 binary64)) b)) Initial program 0.0%
Taylor expanded in b around 0
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f6447.8
Applied rewrites47.8%
(FPCore (x y z t a b) :precision binary64 (+ x (- (fma (- b a) t (* (- y 2.0) b)) (fma (- y 1.0) z (- a)))))
double code(double x, double y, double z, double t, double a, double b) {
return x + (fma((b - a), t, ((y - 2.0) * b)) - fma((y - 1.0), z, -a));
}
function code(x, y, z, t, a, b) return Float64(x + Float64(fma(Float64(b - a), t, Float64(Float64(y - 2.0) * b)) - fma(Float64(y - 1.0), z, Float64(-a)))) end
code[x_, y_, z_, t_, a_, b_] := N[(x + N[(N[(N[(b - a), $MachinePrecision] * t + N[(N[(y - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision] - N[(N[(y - 1.0), $MachinePrecision] * z + (-a)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\mathsf{fma}\left(b - a, t, \left(y - 2\right) \cdot b\right) - \mathsf{fma}\left(y - 1, z, -a\right)\right)
\end{array}
Initial program 95.4%
Taylor expanded in t around 0
associate--l+N/A
lower-+.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6496.6
Applied rewrites96.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- y 1.0) z)))
(if (<= a -1.05e+182)
(- x (fma (- t 1.0) a t_1))
(if (<= a 2.25e+139)
(- (fma (- (+ t y) 2.0) b x) t_1)
(+ (* (- 1.0 t) a) (* (- y 2.0) b))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (y - 1.0) * z;
double tmp;
if (a <= -1.05e+182) {
tmp = x - fma((t - 1.0), a, t_1);
} else if (a <= 2.25e+139) {
tmp = fma(((t + y) - 2.0), b, x) - t_1;
} else {
tmp = ((1.0 - t) * a) + ((y - 2.0) * b);
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(y - 1.0) * z) tmp = 0.0 if (a <= -1.05e+182) tmp = Float64(x - fma(Float64(t - 1.0), a, t_1)); elseif (a <= 2.25e+139) tmp = Float64(fma(Float64(Float64(t + y) - 2.0), b, x) - t_1); else tmp = Float64(Float64(Float64(1.0 - t) * a) + Float64(Float64(y - 2.0) * b)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[a, -1.05e+182], N[(x - N[(N[(t - 1.0), $MachinePrecision] * a + t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2.25e+139], N[(N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + x), $MachinePrecision] - t$95$1), $MachinePrecision], N[(N[(N[(1.0 - t), $MachinePrecision] * a), $MachinePrecision] + N[(N[(y - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - 1\right) \cdot z\\
\mathbf{if}\;a \leq -1.05 \cdot 10^{+182}:\\
\;\;\;\;x - \mathsf{fma}\left(t - 1, a, t\_1\right)\\
\mathbf{elif}\;a \leq 2.25 \cdot 10^{+139}:\\
\;\;\;\;\mathsf{fma}\left(\left(t + y\right) - 2, b, x\right) - t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(1 - t\right) \cdot a + \left(y - 2\right) \cdot b\\
\end{array}
\end{array}
if a < -1.0499999999999999e182Initial program 90.1%
Taylor expanded in b around 0
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f6485.4
Applied rewrites85.4%
if -1.0499999999999999e182 < a < 2.25e139Initial program 97.0%
Taylor expanded in a around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f6484.8
Applied rewrites84.8%
if 2.25e139 < a Initial program 90.4%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6476.2
Applied rewrites76.2%
Taylor expanded in y around inf
Applied rewrites77.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- (+ y t) 2.0) b)))
(if (<= b -1.85e-11)
(+ (* (- 1.0 y) z) t_1)
(if (<= b 3.15e+31)
(- x (fma (- t 1.0) a (* (- y 1.0) z)))
(+ (* (- 1.0 t) a) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((y + t) - 2.0) * b;
double tmp;
if (b <= -1.85e-11) {
tmp = ((1.0 - y) * z) + t_1;
} else if (b <= 3.15e+31) {
tmp = x - fma((t - 1.0), a, ((y - 1.0) * z));
} else {
tmp = ((1.0 - t) * a) + t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(y + t) - 2.0) * b) tmp = 0.0 if (b <= -1.85e-11) tmp = Float64(Float64(Float64(1.0 - y) * z) + t_1); elseif (b <= 3.15e+31) tmp = Float64(x - fma(Float64(t - 1.0), a, Float64(Float64(y - 1.0) * z))); else tmp = Float64(Float64(Float64(1.0 - t) * a) + t_1); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[b, -1.85e-11], N[(N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision] + t$95$1), $MachinePrecision], If[LessEqual[b, 3.15e+31], N[(x - N[(N[(t - 1.0), $MachinePrecision] * a + N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - t), $MachinePrecision] * a), $MachinePrecision] + t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(y + t\right) - 2\right) \cdot b\\
\mathbf{if}\;b \leq -1.85 \cdot 10^{-11}:\\
\;\;\;\;\left(1 - y\right) \cdot z + t\_1\\
\mathbf{elif}\;b \leq 3.15 \cdot 10^{+31}:\\
\;\;\;\;x - \mathsf{fma}\left(t - 1, a, \left(y - 1\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - t\right) \cdot a + t\_1\\
\end{array}
\end{array}
if b < -1.8500000000000001e-11Initial program 91.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6474.3
Applied rewrites74.3%
if -1.8500000000000001e-11 < b < 3.1499999999999999e31Initial program 99.1%
Taylor expanded in b around 0
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f6491.3
Applied rewrites91.3%
if 3.1499999999999999e31 < b Initial program 90.7%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6476.5
Applied rewrites76.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (* (- 1.0 t) a) (* (- (+ y t) 2.0) b))))
(if (<= b -2.7e+106)
t_1
(if (<= b 3.15e+31) (- x (fma (- t 1.0) a (* (- y 1.0) z))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((1.0 - t) * a) + (((y + t) - 2.0) * b);
double tmp;
if (b <= -2.7e+106) {
tmp = t_1;
} else if (b <= 3.15e+31) {
tmp = x - fma((t - 1.0), a, ((y - 1.0) * z));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(1.0 - t) * a) + Float64(Float64(Float64(y + t) - 2.0) * b)) tmp = 0.0 if (b <= -2.7e+106) tmp = t_1; elseif (b <= 3.15e+31) tmp = Float64(x - fma(Float64(t - 1.0), a, Float64(Float64(y - 1.0) * z))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(1.0 - t), $MachinePrecision] * a), $MachinePrecision] + N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -2.7e+106], t$95$1, If[LessEqual[b, 3.15e+31], N[(x - N[(N[(t - 1.0), $MachinePrecision] * a + N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(1 - t\right) \cdot a + \left(\left(y + t\right) - 2\right) \cdot b\\
\mathbf{if}\;b \leq -2.7 \cdot 10^{+106}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 3.15 \cdot 10^{+31}:\\
\;\;\;\;x - \mathsf{fma}\left(t - 1, a, \left(y - 1\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -2.70000000000000006e106 or 3.1499999999999999e31 < b Initial program 90.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6478.5
Applied rewrites78.5%
if -2.70000000000000006e106 < b < 3.1499999999999999e31Initial program 98.7%
Taylor expanded in b around 0
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f6487.3
Applied rewrites87.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma (- (+ t y) 2.0) b x)))
(if (<= b -2.85e+106)
t_1
(if (<= b 8.5e+36) (- x (fma (- t 1.0) a (* (- y 1.0) z))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(((t + y) - 2.0), b, x);
double tmp;
if (b <= -2.85e+106) {
tmp = t_1;
} else if (b <= 8.5e+36) {
tmp = x - fma((t - 1.0), a, ((y - 1.0) * z));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(Float64(Float64(t + y) - 2.0), b, x) tmp = 0.0 if (b <= -2.85e+106) tmp = t_1; elseif (b <= 8.5e+36) tmp = Float64(x - fma(Float64(t - 1.0), a, Float64(Float64(y - 1.0) * z))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + x), $MachinePrecision]}, If[LessEqual[b, -2.85e+106], t$95$1, If[LessEqual[b, 8.5e+36], N[(x - N[(N[(t - 1.0), $MachinePrecision] * a + N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\left(t + y\right) - 2, b, x\right)\\
\mathbf{if}\;b \leq -2.85 \cdot 10^{+106}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 8.5 \cdot 10^{+36}:\\
\;\;\;\;x - \mathsf{fma}\left(t - 1, a, \left(y - 1\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -2.8499999999999999e106 or 8.50000000000000014e36 < b Initial program 90.0%
Taylor expanded in x around inf
Applied rewrites79.4%
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f6479.4
Applied rewrites79.4%
if -2.8499999999999999e106 < b < 8.50000000000000014e36Initial program 98.7%
Taylor expanded in b around 0
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f6487.1
Applied rewrites87.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (* (- 1.0 y) z) (* t b))))
(if (<= z -1.85e+33)
t_1
(if (<= z 5.4e+172) (fma (- (+ t y) 2.0) b x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((1.0 - y) * z) + (t * b);
double tmp;
if (z <= -1.85e+33) {
tmp = t_1;
} else if (z <= 5.4e+172) {
tmp = fma(((t + y) - 2.0), b, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(1.0 - y) * z) + Float64(t * b)) tmp = 0.0 if (z <= -1.85e+33) tmp = t_1; elseif (z <= 5.4e+172) tmp = fma(Float64(Float64(t + y) - 2.0), b, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision] + N[(t * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.85e+33], t$95$1, If[LessEqual[z, 5.4e+172], N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(1 - y\right) \cdot z + t \cdot b\\
\mathbf{if}\;z \leq -1.85 \cdot 10^{+33}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 5.4 \cdot 10^{+172}:\\
\;\;\;\;\mathsf{fma}\left(\left(t + y\right) - 2, b, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.8499999999999999e33 or 5.4e172 < z Initial program 92.2%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6474.5
Applied rewrites74.5%
Taylor expanded in t around inf
Applied rewrites69.3%
if -1.8499999999999999e33 < z < 5.4e172Initial program 96.9%
Taylor expanded in x around inf
Applied rewrites60.0%
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f6460.0
Applied rewrites60.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ x (* (- 1.0 y) z))))
(if (<= z -3.5e+120)
t_1
(if (<= z 3.6e+173) (fma (- (+ t y) 2.0) b x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + ((1.0 - y) * z);
double tmp;
if (z <= -3.5e+120) {
tmp = t_1;
} else if (z <= 3.6e+173) {
tmp = fma(((t + y) - 2.0), b, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(x + Float64(Float64(1.0 - y) * z)) tmp = 0.0 if (z <= -3.5e+120) tmp = t_1; elseif (z <= 3.6e+173) tmp = fma(Float64(Float64(t + y) - 2.0), b, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.5e+120], t$95$1, If[LessEqual[z, 3.6e+173], N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(1 - y\right) \cdot z\\
\mathbf{if}\;z \leq -3.5 \cdot 10^{+120}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{+173}:\\
\;\;\;\;\mathsf{fma}\left(\left(t + y\right) - 2, b, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.50000000000000007e120 or 3.6000000000000002e173 < z Initial program 91.2%
Taylor expanded in t around 0
associate--l+N/A
lower-+.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6492.4
Applied rewrites92.4%
Taylor expanded in z around inf
*-commutativeN/A
lift--.f64N/A
lift-*.f6471.8
Applied rewrites71.8%
if -3.50000000000000007e120 < z < 3.6000000000000002e173Initial program 96.8%
Taylor expanded in x around inf
Applied rewrites59.1%
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f6459.1
Applied rewrites59.1%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (- (+ t y) 2.0) b))) (if (<= b -8.6e-28) t_1 (if (<= b 3.5e+40) (+ x (* (- 1.0 y) z)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((t + y) - 2.0) * b;
double tmp;
if (b <= -8.6e-28) {
tmp = t_1;
} else if (b <= 3.5e+40) {
tmp = x + ((1.0 - y) * z);
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = ((t + y) - 2.0d0) * b
if (b <= (-8.6d-28)) then
tmp = t_1
else if (b <= 3.5d+40) then
tmp = x + ((1.0d0 - y) * z)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((t + y) - 2.0) * b;
double tmp;
if (b <= -8.6e-28) {
tmp = t_1;
} else if (b <= 3.5e+40) {
tmp = x + ((1.0 - y) * z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = ((t + y) - 2.0) * b tmp = 0 if b <= -8.6e-28: tmp = t_1 elif b <= 3.5e+40: tmp = x + ((1.0 - y) * z) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(t + y) - 2.0) * b) tmp = 0.0 if (b <= -8.6e-28) tmp = t_1; elseif (b <= 3.5e+40) tmp = Float64(x + Float64(Float64(1.0 - y) * z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = ((t + y) - 2.0) * b; tmp = 0.0; if (b <= -8.6e-28) tmp = t_1; elseif (b <= 3.5e+40) tmp = x + ((1.0 - y) * z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[b, -8.6e-28], t$95$1, If[LessEqual[b, 3.5e+40], N[(x + N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision]), $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 -8.6 \cdot 10^{-28}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 3.5 \cdot 10^{+40}:\\
\;\;\;\;x + \left(1 - y\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -8.6e-28 or 3.4999999999999999e40 < b Initial program 91.5%
Taylor expanded in b around inf
*-commutativeN/A
+-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f6465.7
lift-+.f64N/A
+-commutativeN/A
lower-+.f6465.7
Applied rewrites65.7%
if -8.6e-28 < b < 3.4999999999999999e40Initial program 99.0%
Taylor expanded in t around 0
associate--l+N/A
lower-+.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6499.1
Applied rewrites99.1%
Taylor expanded in z around inf
*-commutativeN/A
lift--.f64N/A
lift-*.f6456.9
Applied rewrites56.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b z) y)))
(if (<= y -0.0004)
t_1
(if (<= y 1600000000000.0) (fma (- t 2.0) b x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (b - z) * y;
double tmp;
if (y <= -0.0004) {
tmp = t_1;
} else if (y <= 1600000000000.0) {
tmp = fma((t - 2.0), b, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(b - z) * y) tmp = 0.0 if (y <= -0.0004) tmp = t_1; elseif (y <= 1600000000000.0) tmp = fma(Float64(t - 2.0), b, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b - z), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -0.0004], t$95$1, If[LessEqual[y, 1600000000000.0], N[(N[(t - 2.0), $MachinePrecision] * b + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(b - z\right) \cdot y\\
\mathbf{if}\;y \leq -0.0004:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1600000000000:\\
\;\;\;\;\mathsf{fma}\left(t - 2, b, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -4.00000000000000019e-4 or 1.6e12 < y Initial program 92.9%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6463.6
Applied rewrites63.6%
if -4.00000000000000019e-4 < y < 1.6e12Initial program 97.7%
Taylor expanded in x around inf
Applied rewrites51.2%
Taylor expanded in y around 0
Applied rewrites50.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6450.8
Applied rewrites50.8%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (- b a) t))) (if (<= t -7e+54) t_1 (if (<= t 4.1e+15) (* (- 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 <= -7e+54) {
tmp = t_1;
} else if (t <= 4.1e+15) {
tmp = (b - z) * y;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = (b - a) * t
if (t <= (-7d+54)) then
tmp = t_1
else if (t <= 4.1d+15) then
tmp = (b - z) * y
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (b - a) * t;
double tmp;
if (t <= -7e+54) {
tmp = t_1;
} else if (t <= 4.1e+15) {
tmp = (b - z) * y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (b - a) * t tmp = 0 if t <= -7e+54: tmp = t_1 elif t <= 4.1e+15: 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 <= -7e+54) tmp = t_1; elseif (t <= 4.1e+15) tmp = Float64(Float64(b - z) * y); 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 <= -7e+54) tmp = t_1; elseif (t <= 4.1e+15) tmp = (b - z) * y; 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, -7e+54], t$95$1, If[LessEqual[t, 4.1e+15], 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 -7 \cdot 10^{+54}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 4.1 \cdot 10^{+15}:\\
\;\;\;\;\left(b - z\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -7.0000000000000002e54 or 4.1e15 < t Initial program 92.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6466.9
Applied rewrites66.9%
if -7.0000000000000002e54 < t < 4.1e15Initial program 98.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6438.4
Applied rewrites38.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b a) t)))
(if (<= t -3.1e+23)
t_1
(if (<= t -1.8e-45)
(* b y)
(if (<= t -6.1e-248)
(* (- 1.0 y) z)
(if (<= t 40000000000.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 <= -3.1e+23) {
tmp = t_1;
} else if (t <= -1.8e-45) {
tmp = b * y;
} else if (t <= -6.1e-248) {
tmp = (1.0 - y) * z;
} else if (t <= 40000000000.0) {
tmp = 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 <= (-3.1d+23)) then
tmp = t_1
else if (t <= (-1.8d-45)) then
tmp = b * y
else if (t <= (-6.1d-248)) then
tmp = (1.0d0 - y) * z
else if (t <= 40000000000.0d0) then
tmp = 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 <= -3.1e+23) {
tmp = t_1;
} else if (t <= -1.8e-45) {
tmp = b * y;
} else if (t <= -6.1e-248) {
tmp = (1.0 - y) * z;
} else if (t <= 40000000000.0) {
tmp = 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 <= -3.1e+23: tmp = t_1 elif t <= -1.8e-45: tmp = b * y elif t <= -6.1e-248: tmp = (1.0 - y) * z elif t <= 40000000000.0: tmp = 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 <= -3.1e+23) tmp = t_1; elseif (t <= -1.8e-45) tmp = Float64(b * y); elseif (t <= -6.1e-248) tmp = Float64(Float64(1.0 - y) * z); elseif (t <= 40000000000.0) tmp = Float64(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 <= -3.1e+23) tmp = t_1; elseif (t <= -1.8e-45) tmp = b * y; elseif (t <= -6.1e-248) tmp = (1.0 - y) * z; elseif (t <= 40000000000.0) tmp = 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, -3.1e+23], t$95$1, If[LessEqual[t, -1.8e-45], N[(b * y), $MachinePrecision], If[LessEqual[t, -6.1e-248], N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[t, 40000000000.0], N[(x + a), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(b - a\right) \cdot t\\
\mathbf{if}\;t \leq -3.1 \cdot 10^{+23}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -1.8 \cdot 10^{-45}:\\
\;\;\;\;b \cdot y\\
\mathbf{elif}\;t \leq -6.1 \cdot 10^{-248}:\\
\;\;\;\;\left(1 - y\right) \cdot z\\
\mathbf{elif}\;t \leq 40000000000:\\
\;\;\;\;x + a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.09999999999999971e23 or 4e10 < t Initial program 92.5%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6465.2
Applied rewrites65.2%
if -3.09999999999999971e23 < t < -1.8e-45Initial program 97.6%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6437.1
Applied rewrites37.1%
Taylor expanded in z around 0
Applied rewrites19.5%
if -1.8e-45 < t < -6.0999999999999999e-248Initial program 98.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6432.5
Applied rewrites32.5%
if -6.0999999999999999e-248 < t < 4e10Initial program 98.0%
Taylor expanded in t around 0
associate--l+N/A
lower-+.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6498.0
Applied rewrites98.0%
Taylor expanded in a around -inf
associate-*r*N/A
mul-1-negN/A
lift-neg.f64N/A
lower-*.f64N/A
lower--.f6438.7
Applied rewrites38.7%
Taylor expanded in t around 0
Applied rewrites37.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- 1.0 y) z)))
(if (<= z -8e+129)
t_1
(if (<= z -1.85e-119)
(+ x a)
(if (<= z 4.2e-183) (* b y) (if (<= z 9.5e-27) (* (- 1.0 t) a) t_1))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (1.0 - y) * z;
double tmp;
if (z <= -8e+129) {
tmp = t_1;
} else if (z <= -1.85e-119) {
tmp = x + a;
} else if (z <= 4.2e-183) {
tmp = b * y;
} else if (z <= 9.5e-27) {
tmp = (1.0 - t) * a;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = (1.0d0 - y) * z
if (z <= (-8d+129)) then
tmp = t_1
else if (z <= (-1.85d-119)) then
tmp = x + a
else if (z <= 4.2d-183) then
tmp = b * y
else if (z <= 9.5d-27) then
tmp = (1.0d0 - t) * a
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (1.0 - y) * z;
double tmp;
if (z <= -8e+129) {
tmp = t_1;
} else if (z <= -1.85e-119) {
tmp = x + a;
} else if (z <= 4.2e-183) {
tmp = b * y;
} else if (z <= 9.5e-27) {
tmp = (1.0 - t) * a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (1.0 - y) * z tmp = 0 if z <= -8e+129: tmp = t_1 elif z <= -1.85e-119: tmp = x + a elif z <= 4.2e-183: tmp = b * y elif z <= 9.5e-27: tmp = (1.0 - t) * a else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(1.0 - y) * z) tmp = 0.0 if (z <= -8e+129) tmp = t_1; elseif (z <= -1.85e-119) tmp = Float64(x + a); elseif (z <= 4.2e-183) tmp = Float64(b * y); elseif (z <= 9.5e-27) tmp = Float64(Float64(1.0 - t) * a); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (1.0 - y) * z; tmp = 0.0; if (z <= -8e+129) tmp = t_1; elseif (z <= -1.85e-119) tmp = x + a; elseif (z <= 4.2e-183) tmp = b * y; elseif (z <= 9.5e-27) tmp = (1.0 - t) * a; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -8e+129], t$95$1, If[LessEqual[z, -1.85e-119], N[(x + a), $MachinePrecision], If[LessEqual[z, 4.2e-183], N[(b * y), $MachinePrecision], If[LessEqual[z, 9.5e-27], N[(N[(1.0 - t), $MachinePrecision] * a), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(1 - y\right) \cdot z\\
\mathbf{if}\;z \leq -8 \cdot 10^{+129}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.85 \cdot 10^{-119}:\\
\;\;\;\;x + a\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{-183}:\\
\;\;\;\;b \cdot y\\
\mathbf{elif}\;z \leq 9.5 \cdot 10^{-27}:\\
\;\;\;\;\left(1 - t\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -8e129 or 9.50000000000000037e-27 < z Initial program 92.3%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6453.2
Applied rewrites53.2%
if -8e129 < z < -1.8500000000000001e-119Initial program 96.7%
Taylor expanded in t around 0
associate--l+N/A
lower-+.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6497.9
Applied rewrites97.9%
Taylor expanded in a around -inf
associate-*r*N/A
mul-1-negN/A
lift-neg.f64N/A
lower-*.f64N/A
lower--.f6443.7
Applied rewrites43.7%
Taylor expanded in t around 0
Applied rewrites27.8%
if -1.8500000000000001e-119 < z < 4.2000000000000004e-183Initial program 98.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6423.7
Applied rewrites23.7%
Taylor expanded in z around 0
Applied rewrites22.4%
if 4.2000000000000004e-183 < z < 9.50000000000000037e-27Initial program 97.8%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6436.4
Applied rewrites36.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- z) y)))
(if (<= z -8e+129)
t_1
(if (<= z -1.85e-119)
(+ x a)
(if (<= z 4.2e-183)
(* b y)
(if (<= z 19500000.0) (* (- 1.0 t) a) (if (<= z 3.6e+186) t_1 z)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = -z * y;
double tmp;
if (z <= -8e+129) {
tmp = t_1;
} else if (z <= -1.85e-119) {
tmp = x + a;
} else if (z <= 4.2e-183) {
tmp = b * y;
} else if (z <= 19500000.0) {
tmp = (1.0 - t) * a;
} else if (z <= 3.6e+186) {
tmp = t_1;
} else {
tmp = z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = -z * y
if (z <= (-8d+129)) then
tmp = t_1
else if (z <= (-1.85d-119)) then
tmp = x + a
else if (z <= 4.2d-183) then
tmp = b * y
else if (z <= 19500000.0d0) then
tmp = (1.0d0 - t) * a
else if (z <= 3.6d+186) then
tmp = t_1
else
tmp = z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = -z * y;
double tmp;
if (z <= -8e+129) {
tmp = t_1;
} else if (z <= -1.85e-119) {
tmp = x + a;
} else if (z <= 4.2e-183) {
tmp = b * y;
} else if (z <= 19500000.0) {
tmp = (1.0 - t) * a;
} else if (z <= 3.6e+186) {
tmp = t_1;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = -z * y tmp = 0 if z <= -8e+129: tmp = t_1 elif z <= -1.85e-119: tmp = x + a elif z <= 4.2e-183: tmp = b * y elif z <= 19500000.0: tmp = (1.0 - t) * a elif z <= 3.6e+186: tmp = t_1 else: tmp = z return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(-z) * y) tmp = 0.0 if (z <= -8e+129) tmp = t_1; elseif (z <= -1.85e-119) tmp = Float64(x + a); elseif (z <= 4.2e-183) tmp = Float64(b * y); elseif (z <= 19500000.0) tmp = Float64(Float64(1.0 - t) * a); elseif (z <= 3.6e+186) tmp = t_1; else tmp = z; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = -z * y; tmp = 0.0; if (z <= -8e+129) tmp = t_1; elseif (z <= -1.85e-119) tmp = x + a; elseif (z <= 4.2e-183) tmp = b * y; elseif (z <= 19500000.0) tmp = (1.0 - t) * a; elseif (z <= 3.6e+186) tmp = t_1; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[((-z) * y), $MachinePrecision]}, If[LessEqual[z, -8e+129], t$95$1, If[LessEqual[z, -1.85e-119], N[(x + a), $MachinePrecision], If[LessEqual[z, 4.2e-183], N[(b * y), $MachinePrecision], If[LessEqual[z, 19500000.0], N[(N[(1.0 - t), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[z, 3.6e+186], t$95$1, z]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-z\right) \cdot y\\
\mathbf{if}\;z \leq -8 \cdot 10^{+129}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.85 \cdot 10^{-119}:\\
\;\;\;\;x + a\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{-183}:\\
\;\;\;\;b \cdot y\\
\mathbf{elif}\;z \leq 19500000:\\
\;\;\;\;\left(1 - t\right) \cdot a\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{+186}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if z < -8e129 or 1.95e7 < z < 3.6000000000000002e186Initial program 92.3%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6440.0
Applied rewrites40.0%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6433.3
Applied rewrites33.3%
if -8e129 < z < -1.8500000000000001e-119Initial program 96.7%
Taylor expanded in t around 0
associate--l+N/A
lower-+.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6497.9
Applied rewrites97.9%
Taylor expanded in a around -inf
associate-*r*N/A
mul-1-negN/A
lift-neg.f64N/A
lower-*.f64N/A
lower--.f6443.7
Applied rewrites43.7%
Taylor expanded in t around 0
Applied rewrites27.8%
if -1.8500000000000001e-119 < z < 4.2000000000000004e-183Initial program 98.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6423.7
Applied rewrites23.7%
Taylor expanded in z around 0
Applied rewrites22.4%
if 4.2000000000000004e-183 < z < 1.95e7Initial program 97.8%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6434.0
Applied rewrites34.0%
if 3.6000000000000002e186 < z Initial program 90.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6471.9
Applied rewrites71.9%
Taylor expanded in y around 0
Applied rewrites29.7%
(FPCore (x y z t a b) :precision binary64 (if (<= y -1.75e+104) (* b y) (if (<= y 7.6e+51) (+ x a) (* b y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -1.75e+104) {
tmp = b * y;
} else if (y <= 7.6e+51) {
tmp = x + 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 (y <= (-1.75d+104)) then
tmp = b * y
else if (y <= 7.6d+51) then
tmp = x + 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 (y <= -1.75e+104) {
tmp = b * y;
} else if (y <= 7.6e+51) {
tmp = x + a;
} else {
tmp = b * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -1.75e+104: tmp = b * y elif y <= 7.6e+51: tmp = x + a else: tmp = b * y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -1.75e+104) tmp = Float64(b * y); elseif (y <= 7.6e+51) tmp = Float64(x + a); else tmp = Float64(b * y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y <= -1.75e+104) tmp = b * y; elseif (y <= 7.6e+51) tmp = x + a; else tmp = b * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -1.75e+104], N[(b * y), $MachinePrecision], If[LessEqual[y, 7.6e+51], N[(x + a), $MachinePrecision], N[(b * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.75 \cdot 10^{+104}:\\
\;\;\;\;b \cdot y\\
\mathbf{elif}\;y \leq 7.6 \cdot 10^{+51}:\\
\;\;\;\;x + a\\
\mathbf{else}:\\
\;\;\;\;b \cdot y\\
\end{array}
\end{array}
if y < -1.7500000000000001e104 or 7.5999999999999994e51 < y Initial program 91.2%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6471.1
Applied rewrites71.1%
Taylor expanded in z around 0
Applied rewrites37.4%
if -1.7500000000000001e104 < y < 7.5999999999999994e51Initial program 97.8%
Taylor expanded in t around 0
associate--l+N/A
lower-+.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6499.6
Applied rewrites99.6%
Taylor expanded in a around -inf
associate-*r*N/A
mul-1-negN/A
lift-neg.f64N/A
lower-*.f64N/A
lower--.f6451.2
Applied rewrites51.2%
Taylor expanded in t around 0
Applied rewrites31.9%
(FPCore (x y z t a b) :precision binary64 (if (<= z -9.2e+129) z (if (<= z 4e+180) (+ x a) z)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -9.2e+129) {
tmp = z;
} else if (z <= 4e+180) {
tmp = x + a;
} else {
tmp = z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (z <= (-9.2d+129)) then
tmp = z
else if (z <= 4d+180) then
tmp = x + a
else
tmp = z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -9.2e+129) {
tmp = z;
} else if (z <= 4e+180) {
tmp = x + a;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -9.2e+129: tmp = z elif z <= 4e+180: tmp = x + a else: tmp = z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -9.2e+129) tmp = z; elseif (z <= 4e+180) tmp = Float64(x + a); else tmp = z; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -9.2e+129) tmp = z; elseif (z <= 4e+180) tmp = x + a; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -9.2e+129], z, If[LessEqual[z, 4e+180], N[(x + a), $MachinePrecision], z]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.2 \cdot 10^{+129}:\\
\;\;\;\;z\\
\mathbf{elif}\;z \leq 4 \cdot 10^{+180}:\\
\;\;\;\;x + a\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if z < -9.19999999999999961e129 or 4e180 < z Initial program 91.2%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6467.6
Applied rewrites67.6%
Taylor expanded in y around 0
Applied rewrites27.8%
if -9.19999999999999961e129 < z < 4e180Initial program 96.7%
Taylor expanded in t around 0
associate--l+N/A
lower-+.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6498.0
Applied rewrites98.0%
Taylor expanded in a around -inf
associate-*r*N/A
mul-1-negN/A
lift-neg.f64N/A
lower-*.f64N/A
lower--.f6449.0
Applied rewrites49.0%
Taylor expanded in t around 0
Applied rewrites30.3%
(FPCore (x y z t a b) :precision binary64 (if (<= z -3.5e+129) z (if (<= z 7.6e-257) x (if (<= z 3.8e-27) a z))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -3.5e+129) {
tmp = z;
} else if (z <= 7.6e-257) {
tmp = x;
} else if (z <= 3.8e-27) {
tmp = a;
} else {
tmp = z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (z <= (-3.5d+129)) then
tmp = z
else if (z <= 7.6d-257) then
tmp = x
else if (z <= 3.8d-27) then
tmp = a
else
tmp = z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -3.5e+129) {
tmp = z;
} else if (z <= 7.6e-257) {
tmp = x;
} else if (z <= 3.8e-27) {
tmp = a;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -3.5e+129: tmp = z elif z <= 7.6e-257: tmp = x elif z <= 3.8e-27: tmp = a else: tmp = z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -3.5e+129) tmp = z; elseif (z <= 7.6e-257) tmp = x; elseif (z <= 3.8e-27) tmp = a; else tmp = z; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -3.5e+129) tmp = z; elseif (z <= 7.6e-257) tmp = x; elseif (z <= 3.8e-27) tmp = a; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -3.5e+129], z, If[LessEqual[z, 7.6e-257], x, If[LessEqual[z, 3.8e-27], a, z]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{+129}:\\
\;\;\;\;z\\
\mathbf{elif}\;z \leq 7.6 \cdot 10^{-257}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{-27}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if z < -3.4999999999999998e129 or 3.8e-27 < z Initial program 92.3%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6453.1
Applied rewrites53.1%
Taylor expanded in y around 0
Applied rewrites20.7%
if -3.4999999999999998e129 < z < 7.6000000000000007e-257Initial program 97.3%
Taylor expanded in x around inf
Applied rewrites19.5%
if 7.6000000000000007e-257 < z < 3.8e-27Initial program 97.9%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6436.5
Applied rewrites36.5%
Taylor expanded in t around 0
Applied rewrites15.5%
(FPCore (x y z t a b) :precision binary64 (if (<= a -7.5e+100) a (if (<= a 2.7e+146) x a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -7.5e+100) {
tmp = a;
} else if (a <= 2.7e+146) {
tmp = x;
} else {
tmp = 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 (a <= (-7.5d+100)) then
tmp = a
else if (a <= 2.7d+146) then
tmp = x
else
tmp = 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 (a <= -7.5e+100) {
tmp = a;
} else if (a <= 2.7e+146) {
tmp = x;
} else {
tmp = a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= -7.5e+100: tmp = a elif a <= 2.7e+146: tmp = x else: tmp = a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -7.5e+100) tmp = a; elseif (a <= 2.7e+146) tmp = x; else tmp = a; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (a <= -7.5e+100) tmp = a; elseif (a <= 2.7e+146) tmp = x; else tmp = a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -7.5e+100], a, If[LessEqual[a, 2.7e+146], x, a]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -7.5 \cdot 10^{+100}:\\
\;\;\;\;a\\
\mathbf{elif}\;a \leq 2.7 \cdot 10^{+146}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if a < -7.49999999999999983e100 or 2.69999999999999989e146 < a Initial program 91.2%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6463.6
Applied rewrites63.6%
Taylor expanded in t around 0
Applied rewrites26.4%
if -7.49999999999999983e100 < a < 2.69999999999999989e146Initial program 97.1%
Taylor expanded in x around inf
Applied rewrites19.6%
(FPCore (x y z t a b) :precision binary64 x)
double code(double x, double y, double z, double t, double a, double b) {
return x;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = x
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x;
}
def code(x, y, z, t, a, b): return x
function code(x, y, z, t, a, b) return x end
function tmp = code(x, y, z, t, a, b) tmp = x; end
code[x_, y_, z_, t_, a_, b_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 95.4%
Taylor expanded in x around inf
Applied rewrites15.9%
herbie shell --seed 2025112
(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)))