
(FPCore (x y z t a b) :precision binary64 (+ (- (- x (* (- y 1.0) z)) (* (- t 1.0) a)) (* (- (+ y t) 2.0) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((x - ((y - 1.0d0) * z)) - ((t - 1.0d0) * a)) + (((y + t) - 2.0d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b);
}
def code(x, y, z, t, a, b): return ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x - Float64(Float64(y - 1.0) * z)) - Float64(Float64(t - 1.0) * a)) + Float64(Float64(Float64(y + t) - 2.0) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x - N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] - N[(N[(t - 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - \left(y - 1\right) \cdot z\right) - \left(t - 1\right) \cdot a\right) + \left(\left(y + t\right) - 2\right) \cdot b
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 18 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 (if (<= b 3.8e+190) (fma (- (+ t y) 2.0) b (- x (fma (- t 1.0) a (fma z y (- z))))) (+ x (fma (- y 2.0) b (* b t)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= 3.8e+190) {
tmp = fma(((t + y) - 2.0), b, (x - fma((t - 1.0), a, fma(z, y, -z))));
} else {
tmp = x + fma((y - 2.0), b, (b * t));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= 3.8e+190) tmp = fma(Float64(Float64(t + y) - 2.0), b, Float64(x - fma(Float64(t - 1.0), a, fma(z, y, Float64(-z))))); else tmp = Float64(x + fma(Float64(y - 2.0), b, Float64(b * t))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, 3.8e+190], N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + N[(x - N[(N[(t - 1.0), $MachinePrecision] * a + N[(z * y + (-z)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y - 2.0), $MachinePrecision] * b + N[(b * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 3.8 \cdot 10^{+190}:\\
\;\;\;\;\mathsf{fma}\left(\left(t + y\right) - 2, b, x - \mathsf{fma}\left(t - 1, a, \mathsf{fma}\left(z, y, -z\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + \mathsf{fma}\left(y - 2, b, b \cdot t\right)\\
\end{array}
\end{array}
if b < 3.79999999999999964e190Initial program 97.8%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate--l-N/A
*-commutativeN/A
*-commutativeN/A
Applied rewrites99.1%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6499.1
Applied rewrites99.1%
if 3.79999999999999964e190 < b Initial program 76.9%
Taylor expanded in x around inf
Applied rewrites96.2%
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
lower-fma.f64N/A
lower--.f64N/A
lower-*.f64100.0
Applied rewrites100.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma (- y) z z)) (t_2 (* (- b a) t)))
(if (<= t -5e+19)
t_2
(if (<= t 1.15e-265)
t_1
(if (<= t 1.3e-116)
(* (- y 2.0) b)
(if (<= t 1.35e-86) (* (- 1.0 t) a) (if (<= t 1.2e+61) t_1 t_2)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(-y, z, z);
double t_2 = (b - a) * t;
double tmp;
if (t <= -5e+19) {
tmp = t_2;
} else if (t <= 1.15e-265) {
tmp = t_1;
} else if (t <= 1.3e-116) {
tmp = (y - 2.0) * b;
} else if (t <= 1.35e-86) {
tmp = (1.0 - t) * a;
} else if (t <= 1.2e+61) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(Float64(-y), z, z) t_2 = Float64(Float64(b - a) * t) tmp = 0.0 if (t <= -5e+19) tmp = t_2; elseif (t <= 1.15e-265) tmp = t_1; elseif (t <= 1.3e-116) tmp = Float64(Float64(y - 2.0) * b); elseif (t <= 1.35e-86) tmp = Float64(Float64(1.0 - t) * a); elseif (t <= 1.2e+61) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[((-y) * z + z), $MachinePrecision]}, Block[{t$95$2 = N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -5e+19], t$95$2, If[LessEqual[t, 1.15e-265], t$95$1, If[LessEqual[t, 1.3e-116], N[(N[(y - 2.0), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[t, 1.35e-86], N[(N[(1.0 - t), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[t, 1.2e+61], t$95$1, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-y, z, z\right)\\
t_2 := \left(b - a\right) \cdot t\\
\mathbf{if}\;t \leq -5 \cdot 10^{+19}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq 1.15 \cdot 10^{-265}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.3 \cdot 10^{-116}:\\
\;\;\;\;\left(y - 2\right) \cdot b\\
\mathbf{elif}\;t \leq 1.35 \cdot 10^{-86}:\\
\;\;\;\;\left(1 - t\right) \cdot a\\
\mathbf{elif}\;t \leq 1.2 \cdot 10^{+61}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if t < -5e19 or 1.1999999999999999e61 < t Initial program 93.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6467.9
Applied rewrites67.9%
if -5e19 < t < 1.1499999999999999e-265 or 1.34999999999999996e-86 < t < 1.1999999999999999e61Initial program 98.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6438.0
Applied rewrites38.0%
Taylor expanded in y around 0
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f6438.0
Applied rewrites38.0%
if 1.1499999999999999e-265 < t < 1.3e-116Initial program 100.0%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate--l-N/A
*-commutativeN/A
*-commutativeN/A
Applied rewrites100.0%
Taylor expanded in b around inf
+-commutativeN/A
+-commutativeN/A
associate--l-N/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f6461.8
Applied rewrites61.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lift--.f6461.8
Applied rewrites61.8%
if 1.3e-116 < t < 1.34999999999999996e-86Initial program 90.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6453.2
Applied rewrites53.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma t b (- x (* (- y 1.0) z)))))
(if (<= z -2.1e+152)
t_1
(if (<= z 3.3e-99)
(fma (- (+ t y) 2.0) b (- x (- z)))
(if (<= z 1.12e+42) (* (- b a) t) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(t, b, (x - ((y - 1.0) * z)));
double tmp;
if (z <= -2.1e+152) {
tmp = t_1;
} else if (z <= 3.3e-99) {
tmp = fma(((t + y) - 2.0), b, (x - -z));
} else if (z <= 1.12e+42) {
tmp = (b - a) * t;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(t, b, Float64(x - Float64(Float64(y - 1.0) * z))) tmp = 0.0 if (z <= -2.1e+152) tmp = t_1; elseif (z <= 3.3e-99) tmp = fma(Float64(Float64(t + y) - 2.0), b, Float64(x - Float64(-z))); elseif (z <= 1.12e+42) tmp = Float64(Float64(b - a) * t); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(t * b + N[(x - N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.1e+152], t$95$1, If[LessEqual[z, 3.3e-99], N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + N[(x - (-z)), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.12e+42], N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t, b, x - \left(y - 1\right) \cdot z\right)\\
\mathbf{if}\;z \leq -2.1 \cdot 10^{+152}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{-99}:\\
\;\;\;\;\mathsf{fma}\left(\left(t + y\right) - 2, b, x - \left(-z\right)\right)\\
\mathbf{elif}\;z \leq 1.12 \cdot 10^{+42}:\\
\;\;\;\;\left(b - a\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.1000000000000002e152 or 1.12e42 < z Initial program 93.7%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate--l-N/A
*-commutativeN/A
*-commutativeN/A
Applied rewrites96.8%
Taylor expanded in z around inf
*-commutativeN/A
lift-*.f64N/A
lift--.f6487.0
Applied rewrites87.0%
Taylor expanded in t around inf
Applied rewrites82.9%
if -2.1000000000000002e152 < z < 3.29999999999999986e-99Initial program 96.3%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate--l-N/A
*-commutativeN/A
*-commutativeN/A
Applied rewrites97.1%
Taylor expanded in z around inf
*-commutativeN/A
lift-*.f64N/A
lift--.f6469.4
Applied rewrites69.4%
Taylor expanded in y around 0
mul-1-negN/A
lower-neg.f6466.6
Applied rewrites66.6%
if 3.29999999999999986e-99 < z < 1.12e42Initial program 99.9%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6475.7
Applied rewrites75.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma t b (- x (* (- y 1.0) z)))))
(if (<= z -2.1e+152)
t_1
(if (<= z 3.3e-99)
(+ x (* (- (+ y t) 2.0) b))
(if (<= z 1.12e+42) (* (- b a) t) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(t, b, (x - ((y - 1.0) * z)));
double tmp;
if (z <= -2.1e+152) {
tmp = t_1;
} else if (z <= 3.3e-99) {
tmp = x + (((y + t) - 2.0) * b);
} else if (z <= 1.12e+42) {
tmp = (b - a) * t;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(t, b, Float64(x - Float64(Float64(y - 1.0) * z))) tmp = 0.0 if (z <= -2.1e+152) tmp = t_1; elseif (z <= 3.3e-99) tmp = Float64(x + Float64(Float64(Float64(y + t) - 2.0) * b)); elseif (z <= 1.12e+42) tmp = Float64(Float64(b - a) * t); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(t * b + N[(x - N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.1e+152], t$95$1, If[LessEqual[z, 3.3e-99], N[(x + N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.12e+42], N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t, b, x - \left(y - 1\right) \cdot z\right)\\
\mathbf{if}\;z \leq -2.1 \cdot 10^{+152}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{-99}:\\
\;\;\;\;x + \left(\left(y + t\right) - 2\right) \cdot b\\
\mathbf{elif}\;z \leq 1.12 \cdot 10^{+42}:\\
\;\;\;\;\left(b - a\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.1000000000000002e152 or 1.12e42 < z Initial program 93.7%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate--l-N/A
*-commutativeN/A
*-commutativeN/A
Applied rewrites96.8%
Taylor expanded in z around inf
*-commutativeN/A
lift-*.f64N/A
lift--.f6487.0
Applied rewrites87.0%
Taylor expanded in t around inf
Applied rewrites82.9%
if -2.1000000000000002e152 < z < 3.29999999999999986e-99Initial program 96.3%
Taylor expanded in x around inf
Applied rewrites65.1%
if 3.29999999999999986e-99 < z < 1.12e42Initial program 99.9%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6475.7
Applied rewrites75.7%
(FPCore (x y z t a b)
:precision binary64
(if (<= b -9e+113)
(fma (- (+ t y) 2.0) b (- x (- z)))
(if (<= b 2.7e+171)
(- x (fma (- t 1.0) a (* (- y 1.0) z)))
(+ x (* (- (+ y t) 2.0) b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -9e+113) {
tmp = fma(((t + y) - 2.0), b, (x - -z));
} else if (b <= 2.7e+171) {
tmp = x - fma((t - 1.0), a, ((y - 1.0) * z));
} else {
tmp = x + (((y + t) - 2.0) * b);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -9e+113) tmp = fma(Float64(Float64(t + y) - 2.0), b, Float64(x - Float64(-z))); elseif (b <= 2.7e+171) tmp = Float64(x - fma(Float64(t - 1.0), a, Float64(Float64(y - 1.0) * z))); 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, -9e+113], N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + N[(x - (-z)), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.7e+171], N[(x - N[(N[(t - 1.0), $MachinePrecision] * a + N[(N[(y - 1.0), $MachinePrecision] * z), $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 -9 \cdot 10^{+113}:\\
\;\;\;\;\mathsf{fma}\left(\left(t + y\right) - 2, b, x - \left(-z\right)\right)\\
\mathbf{elif}\;b \leq 2.7 \cdot 10^{+171}:\\
\;\;\;\;x - \mathsf{fma}\left(t - 1, a, \left(y - 1\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(\left(y + t\right) - 2\right) \cdot b\\
\end{array}
\end{array}
if b < -9.0000000000000001e113Initial program 95.3%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate--l-N/A
*-commutativeN/A
*-commutativeN/A
Applied rewrites95.3%
Taylor expanded in z around inf
*-commutativeN/A
lift-*.f64N/A
lift--.f6486.9
Applied rewrites86.9%
Taylor expanded in y around 0
mul-1-negN/A
lower-neg.f6491.6
Applied rewrites91.6%
if -9.0000000000000001e113 < b < 2.6999999999999998e171Initial program 98.3%
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.6
Applied rewrites87.6%
if 2.6999999999999998e171 < b Initial program 81.3%
Taylor expanded in x around inf
Applied rewrites96.9%
(FPCore (x y z t a b)
:precision binary64
(if (<= y -4.2e+74)
(* b y)
(if (<= y 1e-267)
x
(if (<= y 1.4e-84) z (if (<= y 82000000.0) x (* b y))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -4.2e+74) {
tmp = b * y;
} else if (y <= 1e-267) {
tmp = x;
} else if (y <= 1.4e-84) {
tmp = z;
} else if (y <= 82000000.0) {
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 <= (-4.2d+74)) then
tmp = b * y
else if (y <= 1d-267) then
tmp = x
else if (y <= 1.4d-84) then
tmp = z
else if (y <= 82000000.0d0) 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 <= -4.2e+74) {
tmp = b * y;
} else if (y <= 1e-267) {
tmp = x;
} else if (y <= 1.4e-84) {
tmp = z;
} else if (y <= 82000000.0) {
tmp = x;
} else {
tmp = b * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -4.2e+74: tmp = b * y elif y <= 1e-267: tmp = x elif y <= 1.4e-84: tmp = z elif y <= 82000000.0: tmp = x else: tmp = b * y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -4.2e+74) tmp = Float64(b * y); elseif (y <= 1e-267) tmp = x; elseif (y <= 1.4e-84) tmp = z; elseif (y <= 82000000.0) 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 <= -4.2e+74) tmp = b * y; elseif (y <= 1e-267) tmp = x; elseif (y <= 1.4e-84) tmp = z; elseif (y <= 82000000.0) tmp = x; else tmp = b * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -4.2e+74], N[(b * y), $MachinePrecision], If[LessEqual[y, 1e-267], x, If[LessEqual[y, 1.4e-84], z, If[LessEqual[y, 82000000.0], x, N[(b * y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.2 \cdot 10^{+74}:\\
\;\;\;\;b \cdot y\\
\mathbf{elif}\;y \leq 10^{-267}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{-84}:\\
\;\;\;\;z\\
\mathbf{elif}\;y \leq 82000000:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;b \cdot y\\
\end{array}
\end{array}
if y < -4.1999999999999998e74 or 8.2e7 < y Initial program 91.7%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate--l-N/A
*-commutativeN/A
*-commutativeN/A
Applied rewrites94.4%
Taylor expanded in b around inf
+-commutativeN/A
+-commutativeN/A
associate--l-N/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f6448.4
Applied rewrites48.4%
Taylor expanded in y around inf
lower-*.f6441.3
Applied rewrites41.3%
if -4.1999999999999998e74 < y < 9.9999999999999998e-268 or 1.39999999999999991e-84 < y < 8.2e7Initial program 99.0%
Taylor expanded in x around inf
Applied rewrites30.9%
if 9.9999999999999998e-268 < y < 1.39999999999999991e-84Initial program 97.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6429.5
Applied rewrites29.5%
Taylor expanded in y around 0
Applied rewrites29.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma (- y) z z)))
(if (<= z -3.3e+172)
t_1
(if (<= z 3.3e-99)
(+ x (* (- (+ y t) 2.0) b))
(if (<= z 2.2e+45) (* (- b a) t) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(-y, z, z);
double tmp;
if (z <= -3.3e+172) {
tmp = t_1;
} else if (z <= 3.3e-99) {
tmp = x + (((y + t) - 2.0) * b);
} else if (z <= 2.2e+45) {
tmp = (b - a) * t;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(Float64(-y), z, z) tmp = 0.0 if (z <= -3.3e+172) tmp = t_1; elseif (z <= 3.3e-99) tmp = Float64(x + Float64(Float64(Float64(y + t) - 2.0) * b)); elseif (z <= 2.2e+45) tmp = Float64(Float64(b - a) * t); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[((-y) * z + z), $MachinePrecision]}, If[LessEqual[z, -3.3e+172], t$95$1, If[LessEqual[z, 3.3e-99], N[(x + N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.2e+45], N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-y, z, z\right)\\
\mathbf{if}\;z \leq -3.3 \cdot 10^{+172}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{-99}:\\
\;\;\;\;x + \left(\left(y + t\right) - 2\right) \cdot b\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{+45}:\\
\;\;\;\;\left(b - a\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.29999999999999983e172 or 2.2e45 < z Initial program 93.4%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6461.0
Applied rewrites61.0%
Taylor expanded in y around 0
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f6461.0
Applied rewrites61.0%
if -3.29999999999999983e172 < z < 3.29999999999999986e-99Initial program 96.4%
Taylor expanded in x around inf
Applied rewrites64.7%
if 3.29999999999999986e-99 < z < 2.2e45Initial program 99.9%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6475.7
Applied rewrites75.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b z) y)))
(if (<= y -1.3e+30)
t_1
(if (<= y -1.9e-285)
(+ x (* b t))
(if (<= y 1.16e+51) (* (- b a) t) 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 <= -1.3e+30) {
tmp = t_1;
} else if (y <= -1.9e-285) {
tmp = x + (b * t);
} else if (y <= 1.16e+51) {
tmp = (b - a) * t;
} 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 - z) * y
if (y <= (-1.3d+30)) then
tmp = t_1
else if (y <= (-1.9d-285)) then
tmp = x + (b * t)
else if (y <= 1.16d+51) then
tmp = (b - a) * t
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 - z) * y;
double tmp;
if (y <= -1.3e+30) {
tmp = t_1;
} else if (y <= -1.9e-285) {
tmp = x + (b * t);
} else if (y <= 1.16e+51) {
tmp = (b - a) * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (b - z) * y tmp = 0 if y <= -1.3e+30: tmp = t_1 elif y <= -1.9e-285: tmp = x + (b * t) elif y <= 1.16e+51: tmp = (b - a) * t 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 <= -1.3e+30) tmp = t_1; elseif (y <= -1.9e-285) tmp = Float64(x + Float64(b * t)); elseif (y <= 1.16e+51) tmp = Float64(Float64(b - a) * t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (b - z) * y; tmp = 0.0; if (y <= -1.3e+30) tmp = t_1; elseif (y <= -1.9e-285) tmp = x + (b * t); elseif (y <= 1.16e+51) tmp = (b - a) * t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b - z), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -1.3e+30], t$95$1, If[LessEqual[y, -1.9e-285], N[(x + N[(b * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.16e+51], N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(b - z\right) \cdot y\\
\mathbf{if}\;y \leq -1.3 \cdot 10^{+30}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -1.9 \cdot 10^{-285}:\\
\;\;\;\;x + b \cdot t\\
\mathbf{elif}\;y \leq 1.16 \cdot 10^{+51}:\\
\;\;\;\;\left(b - a\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.29999999999999994e30 or 1.16e51 < y Initial program 92.9%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6467.4
Applied rewrites67.4%
if -1.29999999999999994e30 < y < -1.9000000000000001e-285Initial program 100.0%
Taylor expanded in x around inf
Applied rewrites60.3%
Taylor expanded in t around inf
lower-*.f6451.5
Applied rewrites51.5%
if -1.9000000000000001e-285 < y < 1.16e51Initial program 96.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6446.1
Applied rewrites46.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- 1.0 t) a)))
(if (<= a -2.7e+61)
t_1
(if (<= a -1.55e-87)
(* (- y 2.0) b)
(if (<= a 7.5e+32) (fma (- y) z z) 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 <= -2.7e+61) {
tmp = t_1;
} else if (a <= -1.55e-87) {
tmp = (y - 2.0) * b;
} else if (a <= 7.5e+32) {
tmp = fma(-y, z, z);
} 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 <= -2.7e+61) tmp = t_1; elseif (a <= -1.55e-87) tmp = Float64(Float64(y - 2.0) * b); elseif (a <= 7.5e+32) tmp = fma(Float64(-y), z, z); 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, -2.7e+61], t$95$1, If[LessEqual[a, -1.55e-87], N[(N[(y - 2.0), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[a, 7.5e+32], N[((-y) * z + z), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(1 - t\right) \cdot a\\
\mathbf{if}\;a \leq -2.7 \cdot 10^{+61}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq -1.55 \cdot 10^{-87}:\\
\;\;\;\;\left(y - 2\right) \cdot b\\
\mathbf{elif}\;a \leq 7.5 \cdot 10^{+32}:\\
\;\;\;\;\mathsf{fma}\left(-y, z, z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -2.7000000000000002e61 or 7.49999999999999959e32 < a Initial program 92.6%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6456.9
Applied rewrites56.9%
if -2.7000000000000002e61 < a < -1.54999999999999999e-87Initial program 99.9%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate--l-N/A
*-commutativeN/A
*-commutativeN/A
Applied rewrites99.9%
Taylor expanded in b around inf
+-commutativeN/A
+-commutativeN/A
associate--l-N/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f6453.8
Applied rewrites53.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lift--.f6436.3
Applied rewrites36.3%
if -1.54999999999999999e-87 < a < 7.49999999999999959e32Initial program 97.3%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6439.5
Applied rewrites39.5%
Taylor expanded in y around 0
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f6439.5
Applied rewrites39.5%
(FPCore (x y z t a b) :precision binary64 (if (<= b -9.5e+109) (* b y) (if (<= b 4.8e-128) x (if (<= b 4.2e+42) (* (- a) t) (* b t)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -9.5e+109) {
tmp = b * y;
} else if (b <= 4.8e-128) {
tmp = x;
} else if (b <= 4.2e+42) {
tmp = -a * t;
} else {
tmp = b * t;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (b <= (-9.5d+109)) then
tmp = b * y
else if (b <= 4.8d-128) then
tmp = x
else if (b <= 4.2d+42) then
tmp = -a * t
else
tmp = b * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -9.5e+109) {
tmp = b * y;
} else if (b <= 4.8e-128) {
tmp = x;
} else if (b <= 4.2e+42) {
tmp = -a * t;
} else {
tmp = b * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if b <= -9.5e+109: tmp = b * y elif b <= 4.8e-128: tmp = x elif b <= 4.2e+42: tmp = -a * t else: tmp = b * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -9.5e+109) tmp = Float64(b * y); elseif (b <= 4.8e-128) tmp = x; elseif (b <= 4.2e+42) tmp = Float64(Float64(-a) * t); else tmp = Float64(b * t); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (b <= -9.5e+109) tmp = b * y; elseif (b <= 4.8e-128) tmp = x; elseif (b <= 4.2e+42) tmp = -a * t; else tmp = b * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -9.5e+109], N[(b * y), $MachinePrecision], If[LessEqual[b, 4.8e-128], x, If[LessEqual[b, 4.2e+42], N[((-a) * t), $MachinePrecision], N[(b * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -9.5 \cdot 10^{+109}:\\
\;\;\;\;b \cdot y\\
\mathbf{elif}\;b \leq 4.8 \cdot 10^{-128}:\\
\;\;\;\;x\\
\mathbf{elif}\;b \leq 4.2 \cdot 10^{+42}:\\
\;\;\;\;\left(-a\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;b \cdot t\\
\end{array}
\end{array}
if b < -9.49999999999999972e109Initial program 95.4%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate--l-N/A
*-commutativeN/A
*-commutativeN/A
Applied rewrites95.4%
Taylor expanded in b around inf
+-commutativeN/A
+-commutativeN/A
associate--l-N/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f6479.5
Applied rewrites79.5%
Taylor expanded in y around inf
lower-*.f6444.7
Applied rewrites44.7%
if -9.49999999999999972e109 < b < 4.7999999999999996e-128Initial program 100.0%
Taylor expanded in x around inf
Applied rewrites28.0%
if 4.7999999999999996e-128 < b < 4.19999999999999991e42Initial program 95.4%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6442.2
Applied rewrites42.2%
Taylor expanded in a around inf
mul-1-negN/A
lower-neg.f6433.6
Applied rewrites33.6%
if 4.19999999999999991e42 < b Initial program 87.7%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6451.6
Applied rewrites51.6%
Taylor expanded in a around 0
Applied rewrites44.8%
(FPCore (x y z t a b) :precision binary64 (if (<= b -9.5e+109) (* b y) (if (<= b 8.2e-66) x (if (<= b 1.8e+59) (* (- y) z) (* b t)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -9.5e+109) {
tmp = b * y;
} else if (b <= 8.2e-66) {
tmp = x;
} else if (b <= 1.8e+59) {
tmp = -y * z;
} else {
tmp = b * t;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (b <= (-9.5d+109)) then
tmp = b * y
else if (b <= 8.2d-66) then
tmp = x
else if (b <= 1.8d+59) then
tmp = -y * z
else
tmp = b * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -9.5e+109) {
tmp = b * y;
} else if (b <= 8.2e-66) {
tmp = x;
} else if (b <= 1.8e+59) {
tmp = -y * z;
} else {
tmp = b * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if b <= -9.5e+109: tmp = b * y elif b <= 8.2e-66: tmp = x elif b <= 1.8e+59: tmp = -y * z else: tmp = b * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -9.5e+109) tmp = Float64(b * y); elseif (b <= 8.2e-66) tmp = x; elseif (b <= 1.8e+59) tmp = Float64(Float64(-y) * z); else tmp = Float64(b * t); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (b <= -9.5e+109) tmp = b * y; elseif (b <= 8.2e-66) tmp = x; elseif (b <= 1.8e+59) tmp = -y * z; else tmp = b * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -9.5e+109], N[(b * y), $MachinePrecision], If[LessEqual[b, 8.2e-66], x, If[LessEqual[b, 1.8e+59], N[((-y) * z), $MachinePrecision], N[(b * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -9.5 \cdot 10^{+109}:\\
\;\;\;\;b \cdot y\\
\mathbf{elif}\;b \leq 8.2 \cdot 10^{-66}:\\
\;\;\;\;x\\
\mathbf{elif}\;b \leq 1.8 \cdot 10^{+59}:\\
\;\;\;\;\left(-y\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;b \cdot t\\
\end{array}
\end{array}
if b < -9.49999999999999972e109Initial program 95.4%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate--l-N/A
*-commutativeN/A
*-commutativeN/A
Applied rewrites95.4%
Taylor expanded in b around inf
+-commutativeN/A
+-commutativeN/A
associate--l-N/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f6479.5
Applied rewrites79.5%
Taylor expanded in y around inf
lower-*.f6444.7
Applied rewrites44.7%
if -9.49999999999999972e109 < b < 8.19999999999999996e-66Initial program 100.0%
Taylor expanded in x around inf
Applied rewrites27.3%
if 8.19999999999999996e-66 < b < 1.7999999999999999e59Initial program 90.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6439.5
Applied rewrites39.5%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6430.2
Applied rewrites30.2%
if 1.7999999999999999e59 < b Initial program 88.8%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6452.5
Applied rewrites52.5%
Taylor expanded in a around 0
Applied rewrites45.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -5.2e+19) (not (<= t 1.2e+61))) (* (- b a) t) (* (- b z) y)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -5.2e+19) || !(t <= 1.2e+61)) {
tmp = (b - a) * t;
} else {
tmp = (b - z) * y;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((t <= (-5.2d+19)) .or. (.not. (t <= 1.2d+61))) then
tmp = (b - a) * t
else
tmp = (b - z) * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -5.2e+19) || !(t <= 1.2e+61)) {
tmp = (b - a) * t;
} else {
tmp = (b - z) * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -5.2e+19) or not (t <= 1.2e+61): tmp = (b - a) * t else: tmp = (b - z) * y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -5.2e+19) || !(t <= 1.2e+61)) tmp = Float64(Float64(b - a) * t); else tmp = Float64(Float64(b - z) * y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((t <= -5.2e+19) || ~((t <= 1.2e+61))) tmp = (b - a) * t; else tmp = (b - z) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -5.2e+19], N[Not[LessEqual[t, 1.2e+61]], $MachinePrecision]], N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision], N[(N[(b - z), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.2 \cdot 10^{+19} \lor \neg \left(t \leq 1.2 \cdot 10^{+61}\right):\\
\;\;\;\;\left(b - a\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;\left(b - z\right) \cdot y\\
\end{array}
\end{array}
if t < -5.2e19 or 1.1999999999999999e61 < t Initial program 93.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6467.9
Applied rewrites67.9%
if -5.2e19 < t < 1.1999999999999999e61Initial program 97.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6439.5
Applied rewrites39.5%
Final simplification52.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -8.2e+151) (not (<= b 5.3e+149))) (* (- t 2.0) b) (fma (- y) z z)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -8.2e+151) || !(b <= 5.3e+149)) {
tmp = (t - 2.0) * b;
} else {
tmp = fma(-y, z, z);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -8.2e+151) || !(b <= 5.3e+149)) tmp = Float64(Float64(t - 2.0) * b); else tmp = fma(Float64(-y), z, z); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -8.2e+151], N[Not[LessEqual[b, 5.3e+149]], $MachinePrecision]], N[(N[(t - 2.0), $MachinePrecision] * b), $MachinePrecision], N[((-y) * z + z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -8.2 \cdot 10^{+151} \lor \neg \left(b \leq 5.3 \cdot 10^{+149}\right):\\
\;\;\;\;\left(t - 2\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-y, z, z\right)\\
\end{array}
\end{array}
if b < -8.1999999999999996e151 or 5.30000000000000032e149 < b Initial program 88.7%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate--l-N/A
*-commutativeN/A
*-commutativeN/A
Applied rewrites90.1%
Taylor expanded in b around inf
+-commutativeN/A
+-commutativeN/A
associate--l-N/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f6486.0
Applied rewrites86.0%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f6460.7
Applied rewrites60.7%
if -8.1999999999999996e151 < b < 5.30000000000000032e149Initial program 98.3%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6435.3
Applied rewrites35.3%
Taylor expanded in y around 0
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f6435.3
Applied rewrites35.3%
Final simplification42.4%
(FPCore (x y z t a b) :precision binary64 (if (<= b -1.15e+110) (* (- y 2.0) b) (if (<= b 5.3e+149) (fma (- y) z z) (* (- t 2.0) b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -1.15e+110) {
tmp = (y - 2.0) * b;
} else if (b <= 5.3e+149) {
tmp = fma(-y, z, z);
} else {
tmp = (t - 2.0) * b;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -1.15e+110) tmp = Float64(Float64(y - 2.0) * b); elseif (b <= 5.3e+149) tmp = fma(Float64(-y), z, z); else tmp = Float64(Float64(t - 2.0) * b); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -1.15e+110], N[(N[(y - 2.0), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[b, 5.3e+149], N[((-y) * z + z), $MachinePrecision], N[(N[(t - 2.0), $MachinePrecision] * b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.15 \cdot 10^{+110}:\\
\;\;\;\;\left(y - 2\right) \cdot b\\
\mathbf{elif}\;b \leq 5.3 \cdot 10^{+149}:\\
\;\;\;\;\mathsf{fma}\left(-y, z, z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t - 2\right) \cdot b\\
\end{array}
\end{array}
if b < -1.15e110Initial program 95.4%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate--l-N/A
*-commutativeN/A
*-commutativeN/A
Applied rewrites95.4%
Taylor expanded in b around inf
+-commutativeN/A
+-commutativeN/A
associate--l-N/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f6479.5
Applied rewrites79.5%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lift--.f6453.9
Applied rewrites53.9%
if -1.15e110 < b < 5.30000000000000032e149Initial program 98.3%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6435.5
Applied rewrites35.5%
Taylor expanded in y around 0
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f6435.5
Applied rewrites35.5%
if 5.30000000000000032e149 < b Initial program 82.4%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate--l-N/A
*-commutativeN/A
*-commutativeN/A
Applied rewrites85.3%
Taylor expanded in b around inf
+-commutativeN/A
+-commutativeN/A
associate--l-N/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f6488.6
Applied rewrites88.6%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f6467.8
Applied rewrites67.8%
(FPCore (x y z t a b) :precision binary64 (if (<= b -1.25e+110) (* b y) (if (<= b 5.3e+149) (fma (- y) z z) (* b t))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -1.25e+110) {
tmp = b * y;
} else if (b <= 5.3e+149) {
tmp = fma(-y, z, z);
} else {
tmp = b * t;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -1.25e+110) tmp = Float64(b * y); elseif (b <= 5.3e+149) tmp = fma(Float64(-y), z, z); else tmp = Float64(b * t); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -1.25e+110], N[(b * y), $MachinePrecision], If[LessEqual[b, 5.3e+149], N[((-y) * z + z), $MachinePrecision], N[(b * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.25 \cdot 10^{+110}:\\
\;\;\;\;b \cdot y\\
\mathbf{elif}\;b \leq 5.3 \cdot 10^{+149}:\\
\;\;\;\;\mathsf{fma}\left(-y, z, z\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot t\\
\end{array}
\end{array}
if b < -1.24999999999999995e110Initial program 95.4%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate--l-N/A
*-commutativeN/A
*-commutativeN/A
Applied rewrites95.4%
Taylor expanded in b around inf
+-commutativeN/A
+-commutativeN/A
associate--l-N/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f6479.5
Applied rewrites79.5%
Taylor expanded in y around inf
lower-*.f6444.7
Applied rewrites44.7%
if -1.24999999999999995e110 < b < 5.30000000000000032e149Initial program 98.3%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6435.5
Applied rewrites35.5%
Taylor expanded in y around 0
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f6435.5
Applied rewrites35.5%
if 5.30000000000000032e149 < b Initial program 82.4%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6459.4
Applied rewrites59.4%
Taylor expanded in a around 0
Applied rewrites56.6%
(FPCore (x y z t a b) :precision binary64 (if (<= b -9.5e+109) (* b y) (if (<= b 1750000000000.0) x (* b t))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -9.5e+109) {
tmp = b * y;
} else if (b <= 1750000000000.0) {
tmp = x;
} else {
tmp = b * t;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (b <= (-9.5d+109)) then
tmp = b * y
else if (b <= 1750000000000.0d0) then
tmp = x
else
tmp = b * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -9.5e+109) {
tmp = b * y;
} else if (b <= 1750000000000.0) {
tmp = x;
} else {
tmp = b * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if b <= -9.5e+109: tmp = b * y elif b <= 1750000000000.0: tmp = x else: tmp = b * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -9.5e+109) tmp = Float64(b * y); elseif (b <= 1750000000000.0) tmp = x; else tmp = Float64(b * t); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (b <= -9.5e+109) tmp = b * y; elseif (b <= 1750000000000.0) tmp = x; else tmp = b * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -9.5e+109], N[(b * y), $MachinePrecision], If[LessEqual[b, 1750000000000.0], x, N[(b * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -9.5 \cdot 10^{+109}:\\
\;\;\;\;b \cdot y\\
\mathbf{elif}\;b \leq 1750000000000:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;b \cdot t\\
\end{array}
\end{array}
if b < -9.49999999999999972e109Initial program 95.4%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate--l-N/A
*-commutativeN/A
*-commutativeN/A
Applied rewrites95.4%
Taylor expanded in b around inf
+-commutativeN/A
+-commutativeN/A
associate--l-N/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f6479.5
Applied rewrites79.5%
Taylor expanded in y around inf
lower-*.f6444.7
Applied rewrites44.7%
if -9.49999999999999972e109 < b < 1.75e12Initial program 99.3%
Taylor expanded in x around inf
Applied rewrites25.6%
if 1.75e12 < b Initial program 87.6%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6448.6
Applied rewrites48.6%
Taylor expanded in a around 0
Applied rewrites39.5%
(FPCore (x y z t a b) :precision binary64 (if (<= x -5.6e+79) x (if (<= x 9.8e+89) z x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -5.6e+79) {
tmp = x;
} else if (x <= 9.8e+89) {
tmp = z;
} else {
tmp = x;
}
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 (x <= (-5.6d+79)) then
tmp = x
else if (x <= 9.8d+89) then
tmp = z
else
tmp = x
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 (x <= -5.6e+79) {
tmp = x;
} else if (x <= 9.8e+89) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -5.6e+79: tmp = x elif x <= 9.8e+89: tmp = z else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -5.6e+79) tmp = x; elseif (x <= 9.8e+89) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (x <= -5.6e+79) tmp = x; elseif (x <= 9.8e+89) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -5.6e+79], x, If[LessEqual[x, 9.8e+89], z, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.6 \cdot 10^{+79}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 9.8 \cdot 10^{+89}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -5.6000000000000002e79 or 9.79999999999999992e89 < x Initial program 96.9%
Taylor expanded in x around inf
Applied rewrites42.5%
if -5.6000000000000002e79 < x < 9.79999999999999992e89Initial program 94.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6429.6
Applied rewrites29.6%
Taylor expanded in y around 0
Applied rewrites16.0%
(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.7%
Taylor expanded in x around inf
Applied rewrites18.1%
herbie shell --seed 2025045
(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)))