
(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 21 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (+ (- (- x (* (- y 1.0) z)) (* (- t 1.0) a)) (* (- (+ y t) 2.0) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((x - ((y - 1.0d0) * z)) - ((t - 1.0d0) * a)) + (((y + t) - 2.0d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b);
}
def code(x, y, z, t, a, b): return ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x - Float64(Float64(y - 1.0) * z)) - Float64(Float64(t - 1.0) * a)) + Float64(Float64(Float64(y + t) - 2.0) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x - N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] - N[(N[(t - 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - \left(y - 1\right) \cdot z\right) - \left(t - 1\right) \cdot a\right) + \left(\left(y + t\right) - 2\right) \cdot b
\end{array}
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1
(+ (- (- x (* (- y 1.0) z)) (* (- t 1.0) a)) (* (- (+ y t) 2.0) b))))
(if (<= t_1 INFINITY) t_1 (fma (- y 2.0) b (* b t)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b);
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = fma((y - 2.0), b, (b * t));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(x - Float64(Float64(y - 1.0) * z)) - Float64(Float64(t - 1.0) * a)) + Float64(Float64(Float64(y + t) - 2.0) * b)) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = fma(Float64(y - 2.0), b, Float64(b * t)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(x - N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] - N[(N[(t - 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(N[(y - 2.0), $MachinePrecision] * b + N[(b * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(x - \left(y - 1\right) \cdot z\right) - \left(t - 1\right) \cdot a\right) + \left(\left(y + t\right) - 2\right) \cdot b\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y - 2, b, b \cdot t\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 inf
*-commutativeN/A
+-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f6449.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6449.9
Applied rewrites49.9%
lift-+.f64N/A
lift--.f64N/A
lower-*.f64N/A
*-commutativeN/A
associate--l+N/A
distribute-lft-outN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-*.f6446.4
Applied rewrites46.4%
(FPCore (x y z t a b) :precision binary64 (if (<= y 1e+92) (+ x (- (fma (- b a) t (* (- y 2.0) b)) (fma (- y 1.0) z (- a)))) (+ x (- (fma (- b z) y (* (- t 2.0) b)) (fma (- t 1.0) a (- z))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= 1e+92) {
tmp = x + (fma((b - a), t, ((y - 2.0) * b)) - fma((y - 1.0), z, -a));
} else {
tmp = x + (fma((b - z), y, ((t - 2.0) * b)) - fma((t - 1.0), a, -z));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= 1e+92) tmp = Float64(x + Float64(fma(Float64(b - a), t, Float64(Float64(y - 2.0) * b)) - fma(Float64(y - 1.0), z, Float64(-a)))); else tmp = Float64(x + Float64(fma(Float64(b - z), y, Float64(Float64(t - 2.0) * b)) - fma(Float64(t - 1.0), a, Float64(-z)))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, 1e+92], 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], N[(x + N[(N[(N[(b - z), $MachinePrecision] * y + N[(N[(t - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision] - N[(N[(t - 1.0), $MachinePrecision] * a + (-z)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 10^{+92}:\\
\;\;\;\;x + \left(\mathsf{fma}\left(b - a, t, \left(y - 2\right) \cdot b\right) - \mathsf{fma}\left(y - 1, z, -a\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) - \mathsf{fma}\left(t - 1, a, -z\right)\right)\\
\end{array}
\end{array}
if y < 1e92Initial program 96.5%
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.5
Applied rewrites97.5%
if 1e92 < y Initial program 90.0%
Taylor expanded in y 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.f6493.9
Applied rewrites93.9%
(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.2
Applied rewrites96.2%
(FPCore (x y z t a b)
:precision binary64
(if (<= b -5.1e+126)
(+ x (fma (- t 2.0) b (* b y)))
(if (<= b 1.9e+83)
(+ x (- (fma (- y) z z) (* a (- t 1.0))))
(+ x (* (- (+ y t) 2.0) b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -5.1e+126) {
tmp = x + fma((t - 2.0), b, (b * y));
} else if (b <= 1.9e+83) {
tmp = x + (fma(-y, z, z) - (a * (t - 1.0)));
} else {
tmp = x + (((y + t) - 2.0) * b);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -5.1e+126) tmp = Float64(x + fma(Float64(t - 2.0), b, Float64(b * y))); elseif (b <= 1.9e+83) tmp = Float64(x + Float64(fma(Float64(-y), z, z) - Float64(a * Float64(t - 1.0)))); else tmp = Float64(x + Float64(Float64(Float64(y + t) - 2.0) * b)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -5.1e+126], N[(x + N[(N[(t - 2.0), $MachinePrecision] * b + N[(b * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.9e+83], N[(x + N[(N[((-y) * z + z), $MachinePrecision] - N[(a * N[(t - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5.1 \cdot 10^{+126}:\\
\;\;\;\;x + \mathsf{fma}\left(t - 2, b, b \cdot y\right)\\
\mathbf{elif}\;b \leq 1.9 \cdot 10^{+83}:\\
\;\;\;\;x + \left(\mathsf{fma}\left(-y, z, z\right) - a \cdot \left(t - 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(\left(y + t\right) - 2\right) \cdot b\\
\end{array}
\end{array}
if b < -5.1000000000000001e126Initial program 90.5%
Taylor expanded in x around inf
Applied rewrites85.8%
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
*-commutativeN/A
associate--l+N/A
distribute-lft-outN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-*.f6482.6
Applied rewrites82.6%
if -5.1000000000000001e126 < b < 1.9000000000000001e83Initial program 98.2%
Taylor expanded in y 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.8
Applied rewrites98.8%
Taylor expanded in b around 0
lower--.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-*.f64N/A
lift--.f6484.0
Applied rewrites84.0%
if 1.9000000000000001e83 < b Initial program 89.3%
Taylor expanded in x around inf
Applied rewrites80.7%
(FPCore (x y z t a b)
:precision binary64
(if (<= b -5.1e+126)
(+ x (fma (- t 2.0) b (* b y)))
(if (<= b 1.9e+83)
(- (fma (- 1.0 y) z x) (* (- t 1.0) a))
(+ x (* (- (+ y t) 2.0) b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -5.1e+126) {
tmp = x + fma((t - 2.0), b, (b * y));
} else if (b <= 1.9e+83) {
tmp = fma((1.0 - y), z, x) - ((t - 1.0) * a);
} else {
tmp = x + (((y + t) - 2.0) * b);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -5.1e+126) tmp = Float64(x + fma(Float64(t - 2.0), b, Float64(b * y))); elseif (b <= 1.9e+83) tmp = Float64(fma(Float64(1.0 - y), z, x) - Float64(Float64(t - 1.0) * a)); else tmp = Float64(x + Float64(Float64(Float64(y + t) - 2.0) * b)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -5.1e+126], N[(x + N[(N[(t - 2.0), $MachinePrecision] * b + N[(b * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.9e+83], N[(N[(N[(1.0 - y), $MachinePrecision] * z + x), $MachinePrecision] - N[(N[(t - 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5.1 \cdot 10^{+126}:\\
\;\;\;\;x + \mathsf{fma}\left(t - 2, b, b \cdot y\right)\\
\mathbf{elif}\;b \leq 1.9 \cdot 10^{+83}:\\
\;\;\;\;\mathsf{fma}\left(1 - y, z, x\right) - \left(t - 1\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;x + \left(\left(y + t\right) - 2\right) \cdot b\\
\end{array}
\end{array}
if b < -5.1000000000000001e126Initial program 90.5%
Taylor expanded in x around inf
Applied rewrites85.8%
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
*-commutativeN/A
associate--l+N/A
distribute-lft-outN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-*.f6482.6
Applied rewrites82.6%
if -5.1000000000000001e126 < b < 1.9000000000000001e83Initial program 98.2%
Taylor expanded in b around 0
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
associate--l-N/A
*-commutativeN/A
lower--.f64N/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
*-commutativeN/A
mul-1-negN/A
sub-negate-revN/A
+-commutativeN/A
sub-negate-revN/A
mul-1-negN/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
sub-negate-revN/A
lower--.f64N/A
Applied rewrites84.0%
if 1.9000000000000001e83 < b Initial program 89.3%
Taylor expanded in x around inf
Applied rewrites80.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ x (* (- (+ y t) 2.0) b))))
(if (<= b -4.8e+93)
t_1
(if (<= b 3400000000.0) (+ x (- z (* a (- t 1.0)))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (((y + t) - 2.0) * b);
double tmp;
if (b <= -4.8e+93) {
tmp = t_1;
} else if (b <= 3400000000.0) {
tmp = x + (z - (a * (t - 1.0)));
} 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 = x + (((y + t) - 2.0d0) * b)
if (b <= (-4.8d+93)) then
tmp = t_1
else if (b <= 3400000000.0d0) then
tmp = x + (z - (a * (t - 1.0d0)))
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 = x + (((y + t) - 2.0) * b);
double tmp;
if (b <= -4.8e+93) {
tmp = t_1;
} else if (b <= 3400000000.0) {
tmp = x + (z - (a * (t - 1.0)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x + (((y + t) - 2.0) * b) tmp = 0 if b <= -4.8e+93: tmp = t_1 elif b <= 3400000000.0: tmp = x + (z - (a * (t - 1.0))) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x + Float64(Float64(Float64(y + t) - 2.0) * b)) tmp = 0.0 if (b <= -4.8e+93) tmp = t_1; elseif (b <= 3400000000.0) tmp = Float64(x + Float64(z - Float64(a * Float64(t - 1.0)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x + (((y + t) - 2.0) * b); tmp = 0.0; if (b <= -4.8e+93) tmp = t_1; elseif (b <= 3400000000.0) tmp = x + (z - (a * (t - 1.0))); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -4.8e+93], t$95$1, If[LessEqual[b, 3400000000.0], N[(x + N[(z - N[(a * N[(t - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(\left(y + t\right) - 2\right) \cdot b\\
\mathbf{if}\;b \leq -4.8 \cdot 10^{+93}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 3400000000:\\
\;\;\;\;x + \left(z - a \cdot \left(t - 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -4.80000000000000021e93 or 3.4e9 < b Initial program 90.8%
Taylor expanded in x around inf
Applied rewrites77.3%
if -4.80000000000000021e93 < b < 3.4e9Initial program 98.8%
Taylor expanded in y 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 b around 0
lower--.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-*.f64N/A
lift--.f6487.9
Applied rewrites87.9%
Taylor expanded in y around 0
Applied rewrites67.9%
(FPCore (x y z t a b)
:precision binary64
(if (<= b -3.3e+95)
(* (- (+ t y) 2.0) b)
(if (<= b 106000000000.0)
(+ x (- z (* a (- t 1.0))))
(fma (- t 2.0) b (* b y)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -3.3e+95) {
tmp = ((t + y) - 2.0) * b;
} else if (b <= 106000000000.0) {
tmp = x + (z - (a * (t - 1.0)));
} else {
tmp = fma((t - 2.0), b, (b * y));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -3.3e+95) tmp = Float64(Float64(Float64(t + y) - 2.0) * b); elseif (b <= 106000000000.0) tmp = Float64(x + Float64(z - Float64(a * Float64(t - 1.0)))); else tmp = fma(Float64(t - 2.0), b, Float64(b * y)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -3.3e+95], N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[b, 106000000000.0], N[(x + N[(z - N[(a * N[(t - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t - 2.0), $MachinePrecision] * b + N[(b * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.3 \cdot 10^{+95}:\\
\;\;\;\;\left(\left(t + y\right) - 2\right) \cdot b\\
\mathbf{elif}\;b \leq 106000000000:\\
\;\;\;\;x + \left(z - a \cdot \left(t - 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t - 2, b, b \cdot y\right)\\
\end{array}
\end{array}
if b < -3.2999999999999998e95Initial program 90.9%
Taylor expanded in b around inf
*-commutativeN/A
+-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f6477.7
lift-+.f64N/A
+-commutativeN/A
lower-+.f6477.7
Applied rewrites77.7%
if -3.2999999999999998e95 < b < 1.06e11Initial program 98.7%
Taylor expanded in y 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 b around 0
lower--.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-*.f64N/A
lift--.f6487.8
Applied rewrites87.8%
Taylor expanded in y around 0
Applied rewrites67.9%
if 1.06e11 < b Initial program 90.8%
Taylor expanded in b around inf
*-commutativeN/A
+-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f6466.5
lift-+.f64N/A
+-commutativeN/A
lower-+.f6466.5
Applied rewrites66.5%
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
*-commutativeN/A
+-commutativeN/A
associate--l+N/A
distribute-lft-outN/A
+-commutativeN/A
*-commutativeN/A
lift-fma.f64N/A
lift--.f64N/A
lift-*.f6464.4
Applied rewrites64.4%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (- (+ t y) 2.0) b))) (if (<= b -2.6e+88) t_1 (if (<= b 0.82) (+ x (* (- 1.0 t) a)) 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 <= -2.6e+88) {
tmp = t_1;
} else if (b <= 0.82) {
tmp = x + ((1.0 - t) * a);
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = ((t + y) - 2.0d0) * b
if (b <= (-2.6d+88)) then
tmp = t_1
else if (b <= 0.82d0) then
tmp = x + ((1.0d0 - t) * a)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((t + y) - 2.0) * b;
double tmp;
if (b <= -2.6e+88) {
tmp = t_1;
} else if (b <= 0.82) {
tmp = x + ((1.0 - t) * a);
} 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 <= -2.6e+88: tmp = t_1 elif b <= 0.82: tmp = x + ((1.0 - t) * a) 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 <= -2.6e+88) tmp = t_1; elseif (b <= 0.82) tmp = Float64(x + Float64(Float64(1.0 - t) * a)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = ((t + y) - 2.0) * b; tmp = 0.0; if (b <= -2.6e+88) tmp = t_1; elseif (b <= 0.82) tmp = x + ((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[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[b, -2.6e+88], t$95$1, If[LessEqual[b, 0.82], N[(x + N[(N[(1.0 - t), $MachinePrecision] * a), $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 -2.6 \cdot 10^{+88}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 0.82:\\
\;\;\;\;x + \left(1 - t\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -2.6000000000000001e88 or 0.819999999999999951 < b Initial program 91.0%
Taylor expanded in b around inf
*-commutativeN/A
+-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f6470.2
lift-+.f64N/A
+-commutativeN/A
lower-+.f6470.2
Applied rewrites70.2%
if -2.6000000000000001e88 < b < 0.819999999999999951Initial program 98.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.0
Applied rewrites99.0%
Taylor expanded in a around inf
*-commutativeN/A
mul-1-negN/A
sub-flipN/A
sub-negate-revN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
sub-negate-revN/A
lower--.f6456.3
Applied rewrites56.3%
(FPCore (x y z t a b) :precision binary64 (if (<= b -2.6e+88) (* (- (+ t y) 2.0) b) (if (<= b 0.82) (+ x (* (- 1.0 t) a)) (fma (- t 2.0) b (* b y)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -2.6e+88) {
tmp = ((t + y) - 2.0) * b;
} else if (b <= 0.82) {
tmp = x + ((1.0 - t) * a);
} else {
tmp = fma((t - 2.0), b, (b * y));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -2.6e+88) tmp = Float64(Float64(Float64(t + y) - 2.0) * b); elseif (b <= 0.82) tmp = Float64(x + Float64(Float64(1.0 - t) * a)); else tmp = fma(Float64(t - 2.0), b, Float64(b * y)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -2.6e+88], N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[b, 0.82], N[(x + N[(N[(1.0 - t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], N[(N[(t - 2.0), $MachinePrecision] * b + N[(b * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.6 \cdot 10^{+88}:\\
\;\;\;\;\left(\left(t + y\right) - 2\right) \cdot b\\
\mathbf{elif}\;b \leq 0.82:\\
\;\;\;\;x + \left(1 - t\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t - 2, b, b \cdot y\right)\\
\end{array}
\end{array}
if b < -2.6000000000000001e88Initial program 90.9%
Taylor expanded in b around inf
*-commutativeN/A
+-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f6476.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6476.9
Applied rewrites76.9%
if -2.6000000000000001e88 < b < 0.819999999999999951Initial program 98.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.0
Applied rewrites99.0%
Taylor expanded in a around inf
*-commutativeN/A
mul-1-negN/A
sub-flipN/A
sub-negate-revN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
sub-negate-revN/A
lower--.f6456.3
Applied rewrites56.3%
if 0.819999999999999951 < b Initial program 91.0%
Taylor expanded in b around inf
*-commutativeN/A
+-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f6465.6
lift-+.f64N/A
+-commutativeN/A
lower-+.f6465.6
Applied rewrites65.6%
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
*-commutativeN/A
+-commutativeN/A
associate--l+N/A
distribute-lft-outN/A
+-commutativeN/A
*-commutativeN/A
lift-fma.f64N/A
lift--.f64N/A
lift-*.f6463.6
Applied rewrites63.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b a) t)))
(if (<= t -680000000.0)
t_1
(if (<= t 3.45e+19)
(fma (- y 2.0) b x)
(if (<= t 4.5e+137) (+ x (* (- a) t)) 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 <= -680000000.0) {
tmp = t_1;
} else if (t <= 3.45e+19) {
tmp = fma((y - 2.0), b, x);
} else if (t <= 4.5e+137) {
tmp = x + (-a * t);
} 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 <= -680000000.0) tmp = t_1; elseif (t <= 3.45e+19) tmp = fma(Float64(y - 2.0), b, x); elseif (t <= 4.5e+137) tmp = Float64(x + Float64(Float64(-a) * t)); 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, -680000000.0], t$95$1, If[LessEqual[t, 3.45e+19], N[(N[(y - 2.0), $MachinePrecision] * b + x), $MachinePrecision], If[LessEqual[t, 4.5e+137], N[(x + N[((-a) * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(b - a\right) \cdot t\\
\mathbf{if}\;t \leq -680000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.45 \cdot 10^{+19}:\\
\;\;\;\;\mathsf{fma}\left(y - 2, b, x\right)\\
\mathbf{elif}\;t \leq 4.5 \cdot 10^{+137}:\\
\;\;\;\;x + \left(-a\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -6.8e8 or 4.5000000000000001e137 < t Initial program 92.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6469.7
Applied rewrites69.7%
if -6.8e8 < t < 3.45e19Initial program 97.7%
Taylor expanded in x around inf
Applied rewrites51.9%
Taylor expanded in y around inf
Applied rewrites51.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6451.2
Applied rewrites51.2%
if 3.45e19 < t < 4.5000000000000001e137Initial program 96.1%
Taylor expanded in y 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.f6495.3
Applied rewrites95.3%
Taylor expanded in b around 0
lower--.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-*.f64N/A
lift--.f6465.6
Applied rewrites65.6%
Taylor expanded in t around inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6440.5
Applied rewrites40.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b a) t)))
(if (<= t -265000000.0)
t_1
(if (<= t 1.7e+25)
(fma y b x)
(if (<= t 4.5e+137) (+ x (* (- a) t)) 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 <= -265000000.0) {
tmp = t_1;
} else if (t <= 1.7e+25) {
tmp = fma(y, b, x);
} else if (t <= 4.5e+137) {
tmp = x + (-a * t);
} 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 <= -265000000.0) tmp = t_1; elseif (t <= 1.7e+25) tmp = fma(y, b, x); elseif (t <= 4.5e+137) tmp = Float64(x + Float64(Float64(-a) * t)); 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, -265000000.0], t$95$1, If[LessEqual[t, 1.7e+25], N[(y * b + x), $MachinePrecision], If[LessEqual[t, 4.5e+137], N[(x + N[((-a) * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(b - a\right) \cdot t\\
\mathbf{if}\;t \leq -265000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.7 \cdot 10^{+25}:\\
\;\;\;\;\mathsf{fma}\left(y, b, x\right)\\
\mathbf{elif}\;t \leq 4.5 \cdot 10^{+137}:\\
\;\;\;\;x + \left(-a\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.65e8 or 4.5000000000000001e137 < t Initial program 92.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6469.7
Applied rewrites69.7%
if -2.65e8 < t < 1.69999999999999992e25Initial program 97.7%
Taylor expanded in x around inf
Applied rewrites51.8%
Taylor expanded in y around inf
Applied rewrites39.3%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6439.3
Applied rewrites39.3%
if 1.69999999999999992e25 < t < 4.5000000000000001e137Initial program 96.0%
Taylor expanded in y 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.f6495.0
Applied rewrites95.0%
Taylor expanded in b around 0
lower--.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-*.f64N/A
lift--.f6465.2
Applied rewrites65.2%
Taylor expanded in t around inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6440.4
Applied rewrites40.4%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (- b a) t))) (if (<= t -265000000.0) t_1 (if (<= t 2.35e+70) (fma y b x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (b - a) * t;
double tmp;
if (t <= -265000000.0) {
tmp = t_1;
} else if (t <= 2.35e+70) {
tmp = fma(y, b, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(b - a) * t) tmp = 0.0 if (t <= -265000000.0) tmp = t_1; elseif (t <= 2.35e+70) tmp = fma(y, b, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -265000000.0], t$95$1, If[LessEqual[t, 2.35e+70], N[(y * b + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(b - a\right) \cdot t\\
\mathbf{if}\;t \leq -265000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.35 \cdot 10^{+70}:\\
\;\;\;\;\mathsf{fma}\left(y, b, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.65e8 or 2.3499999999999999e70 < t Initial program 92.5%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6467.5
Applied rewrites67.5%
if -2.65e8 < t < 2.3499999999999999e70Initial program 97.7%
Taylor expanded in x around inf
Applied rewrites51.8%
Taylor expanded in y around inf
Applied rewrites39.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6439.0
Applied rewrites39.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- 1.0 y) z)))
(if (<= z -1.15e+150)
t_1
(if (<= z 1.5e-59)
(fma y b x)
(if (<= z 5.3e+181) (* (- 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 <= -1.15e+150) {
tmp = t_1;
} else if (z <= 1.5e-59) {
tmp = fma(y, b, x);
} else if (z <= 5.3e+181) {
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 <= -1.15e+150) tmp = t_1; elseif (z <= 1.5e-59) tmp = fma(y, b, x); elseif (z <= 5.3e+181) tmp = Float64(Float64(1.0 - t) * a); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -1.15e+150], t$95$1, If[LessEqual[z, 1.5e-59], N[(y * b + x), $MachinePrecision], If[LessEqual[z, 5.3e+181], 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 -1.15 \cdot 10^{+150}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{-59}:\\
\;\;\;\;\mathsf{fma}\left(y, b, x\right)\\
\mathbf{elif}\;z \leq 5.3 \cdot 10^{+181}:\\
\;\;\;\;\left(1 - t\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.15000000000000001e150 or 5.2999999999999996e181 < z Initial program 91.7%
Taylor expanded in z around inf
sub-negate-revN/A
mul-1-negN/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
sub-negate-revN/A
lower--.f6469.4
Applied rewrites69.4%
if -1.15000000000000001e150 < z < 1.5e-59Initial program 97.2%
Taylor expanded in x around inf
Applied rewrites61.7%
Taylor expanded in y around inf
Applied rewrites38.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6438.9
Applied rewrites38.9%
if 1.5e-59 < z < 5.2999999999999996e181Initial program 94.6%
Taylor expanded in a around inf
sub-negate-revN/A
mul-1-negN/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
sub-negate-revN/A
lower--.f6428.4
Applied rewrites28.4%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (- 1.0 t) a))) (if (<= a -5.1e+14) t_1 (if (<= a 3.2e+71) (fma y b x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (1.0 - t) * a;
double tmp;
if (a <= -5.1e+14) {
tmp = t_1;
} else if (a <= 3.2e+71) {
tmp = fma(y, b, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(1.0 - t) * a) tmp = 0.0 if (a <= -5.1e+14) tmp = t_1; elseif (a <= 3.2e+71) tmp = fma(y, b, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(1.0 - t), $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[a, -5.1e+14], t$95$1, If[LessEqual[a, 3.2e+71], N[(y * b + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(1 - t\right) \cdot a\\
\mathbf{if}\;a \leq -5.1 \cdot 10^{+14}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 3.2 \cdot 10^{+71}:\\
\;\;\;\;\mathsf{fma}\left(y, b, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -5.1e14 or 3.20000000000000023e71 < a Initial program 92.1%
Taylor expanded in a around inf
sub-negate-revN/A
mul-1-negN/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
sub-negate-revN/A
lower--.f6454.4
Applied rewrites54.4%
if -5.1e14 < a < 3.20000000000000023e71Initial program 98.0%
Taylor expanded in x around inf
Applied rewrites63.1%
Taylor expanded in y around inf
Applied rewrites38.1%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6438.1
Applied rewrites38.1%
(FPCore (x y z t a b) :precision binary64 (if (<= t -3.2e+70) (* (- a) t) (if (<= t 8.2e+137) (fma y b x) (* t b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -3.2e+70) {
tmp = -a * t;
} else if (t <= 8.2e+137) {
tmp = fma(y, b, x);
} else {
tmp = t * b;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -3.2e+70) tmp = Float64(Float64(-a) * t); elseif (t <= 8.2e+137) tmp = fma(y, b, x); else tmp = Float64(t * b); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -3.2e+70], N[((-a) * t), $MachinePrecision], If[LessEqual[t, 8.2e+137], N[(y * b + x), $MachinePrecision], N[(t * b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.2 \cdot 10^{+70}:\\
\;\;\;\;\left(-a\right) \cdot t\\
\mathbf{elif}\;t \leq 8.2 \cdot 10^{+137}:\\
\;\;\;\;\mathsf{fma}\left(y, b, x\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot b\\
\end{array}
\end{array}
if t < -3.2000000000000002e70Initial program 92.8%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6471.8
Applied rewrites71.8%
Taylor expanded in a around inf
mul-1-negN/A
lower-neg.f6441.2
Applied rewrites41.2%
if -3.2000000000000002e70 < t < 8.19999999999999994e137Initial program 97.4%
Taylor expanded in x around inf
Applied rewrites51.5%
Taylor expanded in y around inf
Applied rewrites37.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6437.8
Applied rewrites37.8%
if 8.19999999999999994e137 < t Initial program 89.4%
Taylor expanded in b around inf
*-commutativeN/A
+-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f6444.7
lift-+.f64N/A
+-commutativeN/A
lower-+.f6444.7
Applied rewrites44.7%
Taylor expanded in t around inf
Applied rewrites41.2%
(FPCore (x y z t a b)
:precision binary64
(if (<= t -1.75e+75)
(* (- a) t)
(if (<= t 6.6e-222)
(* b y)
(if (<= t 6.4e-12) a (if (<= t 7.6e+107) x (* t b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -1.75e+75) {
tmp = -a * t;
} else if (t <= 6.6e-222) {
tmp = b * y;
} else if (t <= 6.4e-12) {
tmp = a;
} else if (t <= 7.6e+107) {
tmp = x;
} else {
tmp = t * 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 (t <= (-1.75d+75)) then
tmp = -a * t
else if (t <= 6.6d-222) then
tmp = b * y
else if (t <= 6.4d-12) then
tmp = a
else if (t <= 7.6d+107) then
tmp = x
else
tmp = t * 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 (t <= -1.75e+75) {
tmp = -a * t;
} else if (t <= 6.6e-222) {
tmp = b * y;
} else if (t <= 6.4e-12) {
tmp = a;
} else if (t <= 7.6e+107) {
tmp = x;
} else {
tmp = t * b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -1.75e+75: tmp = -a * t elif t <= 6.6e-222: tmp = b * y elif t <= 6.4e-12: tmp = a elif t <= 7.6e+107: tmp = x else: tmp = t * b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -1.75e+75) tmp = Float64(Float64(-a) * t); elseif (t <= 6.6e-222) tmp = Float64(b * y); elseif (t <= 6.4e-12) tmp = a; elseif (t <= 7.6e+107) tmp = x; else tmp = Float64(t * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -1.75e+75) tmp = -a * t; elseif (t <= 6.6e-222) tmp = b * y; elseif (t <= 6.4e-12) tmp = a; elseif (t <= 7.6e+107) tmp = x; else tmp = t * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -1.75e+75], N[((-a) * t), $MachinePrecision], If[LessEqual[t, 6.6e-222], N[(b * y), $MachinePrecision], If[LessEqual[t, 6.4e-12], a, If[LessEqual[t, 7.6e+107], x, N[(t * b), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.75 \cdot 10^{+75}:\\
\;\;\;\;\left(-a\right) \cdot t\\
\mathbf{elif}\;t \leq 6.6 \cdot 10^{-222}:\\
\;\;\;\;b \cdot y\\
\mathbf{elif}\;t \leq 6.4 \cdot 10^{-12}:\\
\;\;\;\;a\\
\mathbf{elif}\;t \leq 7.6 \cdot 10^{+107}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t \cdot b\\
\end{array}
\end{array}
if t < -1.7499999999999999e75Initial program 92.7%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6472.8
Applied rewrites72.8%
Taylor expanded in a around inf
mul-1-negN/A
lower-neg.f6441.6
Applied rewrites41.6%
if -1.7499999999999999e75 < t < 6.60000000000000004e-222Initial program 97.6%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6439.7
Applied rewrites39.7%
Taylor expanded in z around 0
Applied rewrites22.0%
if 6.60000000000000004e-222 < t < 6.4000000000000002e-12Initial program 97.9%
Taylor expanded in a around inf
sub-negate-revN/A
mul-1-negN/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
sub-negate-revN/A
lower--.f6419.9
Applied rewrites19.9%
Taylor expanded in t around 0
Applied rewrites19.8%
if 6.4000000000000002e-12 < t < 7.5999999999999996e107Initial program 97.2%
Taylor expanded in x around inf
Applied rewrites16.0%
if 7.5999999999999996e107 < t Initial program 89.9%
Taylor expanded in b around inf
*-commutativeN/A
+-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f6444.1
lift-+.f64N/A
+-commutativeN/A
lower-+.f6444.1
Applied rewrites44.1%
Taylor expanded in t around inf
Applied rewrites39.4%
(FPCore (x y z t a b)
:precision binary64
(if (<= t -2.3e-32)
(* t b)
(if (<= t 6.6e-222)
(* b y)
(if (<= t 6.4e-12) a (if (<= t 7.6e+107) x (* t b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -2.3e-32) {
tmp = t * b;
} else if (t <= 6.6e-222) {
tmp = b * y;
} else if (t <= 6.4e-12) {
tmp = a;
} else if (t <= 7.6e+107) {
tmp = x;
} else {
tmp = t * 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 (t <= (-2.3d-32)) then
tmp = t * b
else if (t <= 6.6d-222) then
tmp = b * y
else if (t <= 6.4d-12) then
tmp = a
else if (t <= 7.6d+107) then
tmp = x
else
tmp = t * 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 (t <= -2.3e-32) {
tmp = t * b;
} else if (t <= 6.6e-222) {
tmp = b * y;
} else if (t <= 6.4e-12) {
tmp = a;
} else if (t <= 7.6e+107) {
tmp = x;
} else {
tmp = t * b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -2.3e-32: tmp = t * b elif t <= 6.6e-222: tmp = b * y elif t <= 6.4e-12: tmp = a elif t <= 7.6e+107: tmp = x else: tmp = t * b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -2.3e-32) tmp = Float64(t * b); elseif (t <= 6.6e-222) tmp = Float64(b * y); elseif (t <= 6.4e-12) tmp = a; elseif (t <= 7.6e+107) tmp = x; else tmp = Float64(t * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -2.3e-32) tmp = t * b; elseif (t <= 6.6e-222) tmp = b * y; elseif (t <= 6.4e-12) tmp = a; elseif (t <= 7.6e+107) tmp = x; else tmp = t * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -2.3e-32], N[(t * b), $MachinePrecision], If[LessEqual[t, 6.6e-222], N[(b * y), $MachinePrecision], If[LessEqual[t, 6.4e-12], a, If[LessEqual[t, 7.6e+107], x, N[(t * b), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.3 \cdot 10^{-32}:\\
\;\;\;\;t \cdot b\\
\mathbf{elif}\;t \leq 6.6 \cdot 10^{-222}:\\
\;\;\;\;b \cdot y\\
\mathbf{elif}\;t \leq 6.4 \cdot 10^{-12}:\\
\;\;\;\;a\\
\mathbf{elif}\;t \leq 7.6 \cdot 10^{+107}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t \cdot b\\
\end{array}
\end{array}
if t < -2.3000000000000001e-32 or 7.5999999999999996e107 < t Initial program 92.6%
Taylor expanded in b around inf
*-commutativeN/A
+-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f6441.3
lift-+.f64N/A
+-commutativeN/A
lower-+.f6441.3
Applied rewrites41.3%
Taylor expanded in t around inf
Applied rewrites33.5%
if -2.3000000000000001e-32 < t < 6.60000000000000004e-222Initial program 97.7%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6439.9
Applied rewrites39.9%
Taylor expanded in z around 0
Applied rewrites22.5%
if 6.60000000000000004e-222 < t < 6.4000000000000002e-12Initial program 97.9%
Taylor expanded in a around inf
sub-negate-revN/A
mul-1-negN/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
sub-negate-revN/A
lower--.f6419.9
Applied rewrites19.9%
Taylor expanded in t around 0
Applied rewrites19.8%
if 6.4000000000000002e-12 < t < 7.5999999999999996e107Initial program 97.2%
Taylor expanded in x around inf
Applied rewrites16.0%
(FPCore (x y z t a b) :precision binary64 (if (<= y -1.35e+48) (* b y) (if (<= y -9.2e-218) z (if (<= y 3e+39) x (* b y)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -1.35e+48) {
tmp = b * y;
} else if (y <= -9.2e-218) {
tmp = z;
} else if (y <= 3e+39) {
tmp = x;
} 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.35d+48)) then
tmp = b * y
else if (y <= (-9.2d-218)) then
tmp = z
else if (y <= 3d+39) then
tmp = x
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.35e+48) {
tmp = b * y;
} else if (y <= -9.2e-218) {
tmp = z;
} else if (y <= 3e+39) {
tmp = x;
} else {
tmp = b * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -1.35e+48: tmp = b * y elif y <= -9.2e-218: tmp = z elif y <= 3e+39: tmp = x else: tmp = b * y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -1.35e+48) tmp = Float64(b * y); elseif (y <= -9.2e-218) tmp = z; elseif (y <= 3e+39) tmp = x; 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.35e+48) tmp = b * y; elseif (y <= -9.2e-218) tmp = z; elseif (y <= 3e+39) tmp = x; else tmp = b * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -1.35e+48], N[(b * y), $MachinePrecision], If[LessEqual[y, -9.2e-218], z, If[LessEqual[y, 3e+39], x, N[(b * y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.35 \cdot 10^{+48}:\\
\;\;\;\;b \cdot y\\
\mathbf{elif}\;y \leq -9.2 \cdot 10^{-218}:\\
\;\;\;\;z\\
\mathbf{elif}\;y \leq 3 \cdot 10^{+39}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;b \cdot y\\
\end{array}
\end{array}
if y < -1.35000000000000002e48 or 3e39 < y Initial program 92.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6468.1
Applied rewrites68.1%
Taylor expanded in z around 0
Applied rewrites36.8%
if -1.35000000000000002e48 < y < -9.19999999999999979e-218Initial program 98.1%
Taylor expanded in z around inf
sub-negate-revN/A
mul-1-negN/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
sub-negate-revN/A
lower--.f6420.5
Applied rewrites20.5%
Taylor expanded in y around 0
Applied rewrites17.0%
if -9.19999999999999979e-218 < y < 3e39Initial program 97.9%
Taylor expanded in x around inf
Applied rewrites18.9%
(FPCore (x y z t a b) :precision binary64 (if (<= z -1.4e+150) z (if (<= z 6e-60) x (if (<= z 4.5e+96) a z))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1.4e+150) {
tmp = z;
} else if (z <= 6e-60) {
tmp = x;
} else if (z <= 4.5e+96) {
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 <= (-1.4d+150)) then
tmp = z
else if (z <= 6d-60) then
tmp = x
else if (z <= 4.5d+96) 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 <= -1.4e+150) {
tmp = z;
} else if (z <= 6e-60) {
tmp = x;
} else if (z <= 4.5e+96) {
tmp = a;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -1.4e+150: tmp = z elif z <= 6e-60: tmp = x elif z <= 4.5e+96: tmp = a else: tmp = z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -1.4e+150) tmp = z; elseif (z <= 6e-60) tmp = x; elseif (z <= 4.5e+96) tmp = a; else tmp = z; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -1.4e+150) tmp = z; elseif (z <= 6e-60) tmp = x; elseif (z <= 4.5e+96) tmp = a; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1.4e+150], z, If[LessEqual[z, 6e-60], x, If[LessEqual[z, 4.5e+96], a, z]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{+150}:\\
\;\;\;\;z\\
\mathbf{elif}\;z \leq 6 \cdot 10^{-60}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{+96}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if z < -1.40000000000000005e150 or 4.49999999999999957e96 < z Initial program 91.7%
Taylor expanded in z around inf
sub-negate-revN/A
mul-1-negN/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
sub-negate-revN/A
lower--.f6463.6
Applied rewrites63.6%
Taylor expanded in y around 0
Applied rewrites24.9%
if -1.40000000000000005e150 < z < 6.00000000000000038e-60Initial program 97.2%
Taylor expanded in x around inf
Applied rewrites19.7%
if 6.00000000000000038e-60 < z < 4.49999999999999957e96Initial program 96.2%
Taylor expanded in a around inf
sub-negate-revN/A
mul-1-negN/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
sub-negate-revN/A
lower--.f6431.7
Applied rewrites31.7%
Taylor expanded in t around 0
Applied rewrites12.0%
(FPCore (x y z t a b) :precision binary64 (if (<= a -2.05e+245) a (if (<= a 1.8e+111) x a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -2.05e+245) {
tmp = a;
} else if (a <= 1.8e+111) {
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 <= (-2.05d+245)) then
tmp = a
else if (a <= 1.8d+111) 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 <= -2.05e+245) {
tmp = a;
} else if (a <= 1.8e+111) {
tmp = x;
} else {
tmp = a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= -2.05e+245: tmp = a elif a <= 1.8e+111: tmp = x else: tmp = a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -2.05e+245) tmp = a; elseif (a <= 1.8e+111) tmp = x; else tmp = a; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (a <= -2.05e+245) tmp = a; elseif (a <= 1.8e+111) tmp = x; else tmp = a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -2.05e+245], a, If[LessEqual[a, 1.8e+111], x, a]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.05 \cdot 10^{+245}:\\
\;\;\;\;a\\
\mathbf{elif}\;a \leq 1.8 \cdot 10^{+111}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if a < -2.05000000000000002e245 or 1.8000000000000001e111 < a Initial program 90.9%
Taylor expanded in a around inf
sub-negate-revN/A
mul-1-negN/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
sub-negate-revN/A
lower--.f6466.4
Applied rewrites66.4%
Taylor expanded in t around 0
Applied rewrites27.1%
if -2.05000000000000002e245 < a < 1.8000000000000001e111Initial program 96.6%
Taylor expanded in x around inf
Applied rewrites17.8%
(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.5%
herbie shell --seed 2025128
(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)))