
(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 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (+ (- (- x (* (- y 1.0) z)) (* (- t 1.0) a)) (* (- (+ y t) 2.0) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((x - ((y - 1.0d0) * z)) - ((t - 1.0d0) * a)) + (((y + t) - 2.0d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b);
}
def code(x, y, z, t, a, b): return ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x - Float64(Float64(y - 1.0) * z)) - Float64(Float64(t - 1.0) * a)) + Float64(Float64(Float64(y + t) - 2.0) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x - N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] - N[(N[(t - 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - \left(y - 1\right) \cdot z\right) - \left(t - 1\right) \cdot a\right) + \left(\left(y + t\right) - 2\right) \cdot b
\end{array}
(FPCore (x y z t a b) :precision binary64 (fma (- (+ y t) 2.0) b (fma (- 1.0 y) z (- x (* a (- t 1.0))))))
double code(double x, double y, double z, double t, double a, double b) {
return fma(((y + t) - 2.0), b, fma((1.0 - y), z, (x - (a * (t - 1.0)))));
}
function code(x, y, z, t, a, b) return fma(Float64(Float64(y + t) - 2.0), b, fma(Float64(1.0 - y), z, Float64(x - Float64(a * Float64(t - 1.0))))) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b + N[(N[(1.0 - y), $MachinePrecision] * z + N[(x - N[(a * N[(t - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\left(y + t\right) - 2, b, \mathsf{fma}\left(1 - y, z, x - a \cdot \left(t - 1\right)\right)\right)
\end{array}
Initial program 95.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 rewrites98.4%
Taylor expanded in z around 0
+-commutativeN/A
associate--l-N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6498.4
Applied rewrites98.4%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.4
lift--.f64N/A
lift--.f64N/A
lift-fma.f64N/A
lift--.f64N/A
lift-*.f64N/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lower--.f64N/A
lower-*.f64N/A
lift--.f6498.4
Applied rewrites98.4%
(FPCore (x y z t a b)
:precision binary64
(if (<= b -9.5e+188)
(fma (- (+ t y) 2.0) b (* (- a) t))
(if (<= b 9.9e+157)
(fma y b (fma (- 1.0 y) z (- x (* 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 <= -9.5e+188) {
tmp = fma(((t + y) - 2.0), b, (-a * t));
} else if (b <= 9.9e+157) {
tmp = fma(y, b, fma((1.0 - y), z, (x - (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 <= -9.5e+188) tmp = fma(Float64(Float64(t + y) - 2.0), b, Float64(Float64(-a) * t)); elseif (b <= 9.9e+157) tmp = fma(y, b, fma(Float64(1.0 - y), z, Float64(x - 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, -9.5e+188], N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + N[((-a) * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 9.9e+157], N[(y * b + N[(N[(1.0 - y), $MachinePrecision] * z + N[(x - N[(a * N[(t - 1.0), $MachinePrecision]), $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 -9.5 \cdot 10^{+188}:\\
\;\;\;\;\mathsf{fma}\left(\left(t + y\right) - 2, b, \left(-a\right) \cdot t\right)\\
\mathbf{elif}\;b \leq 9.9 \cdot 10^{+157}:\\
\;\;\;\;\mathsf{fma}\left(y, b, \mathsf{fma}\left(1 - y, z, x - a \cdot \left(t - 1\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(\left(y + t\right) - 2\right) \cdot b\\
\end{array}
\end{array}
if b < -9.4999999999999996e188Initial 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 rewrites95.8%
Taylor expanded in t around inf
+-commutativeN/A
associate--l-N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6495.5
Applied rewrites95.5%
if -9.4999999999999996e188 < b < 9.9000000000000005e157Initial program 97.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 z around 0
+-commutativeN/A
associate--l-N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64100.0
Applied rewrites100.0%
lift-+.f64N/A
+-commutativeN/A
lower-+.f64100.0
lift--.f64N/A
lift--.f64N/A
lift-fma.f64N/A
lift--.f64N/A
lift-*.f64N/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
lower--.f64N/A
lower-*.f64N/A
lift--.f64100.0
Applied rewrites100.0%
Taylor expanded in y around inf
Applied rewrites93.4%
if 9.9000000000000005e157 < b Initial program 90.0%
Taylor expanded in x around inf
Applied rewrites96.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- a) t)) (t_2 (* (- y) z)))
(if (<= y -1.5e+17)
t_2
(if (<= y -8.2e-96)
t_1
(if (<= y -1.65e-258)
a
(if (<= y 7e-174) x (if (<= y 16500.0) t_1 t_2)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = -a * t;
double t_2 = -y * z;
double tmp;
if (y <= -1.5e+17) {
tmp = t_2;
} else if (y <= -8.2e-96) {
tmp = t_1;
} else if (y <= -1.65e-258) {
tmp = a;
} else if (y <= 7e-174) {
tmp = x;
} else if (y <= 16500.0) {
tmp = t_1;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = -a * t
t_2 = -y * z
if (y <= (-1.5d+17)) then
tmp = t_2
else if (y <= (-8.2d-96)) then
tmp = t_1
else if (y <= (-1.65d-258)) then
tmp = a
else if (y <= 7d-174) then
tmp = x
else if (y <= 16500.0d0) then
tmp = t_1
else
tmp = t_2
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 = -a * t;
double t_2 = -y * z;
double tmp;
if (y <= -1.5e+17) {
tmp = t_2;
} else if (y <= -8.2e-96) {
tmp = t_1;
} else if (y <= -1.65e-258) {
tmp = a;
} else if (y <= 7e-174) {
tmp = x;
} else if (y <= 16500.0) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = -a * t t_2 = -y * z tmp = 0 if y <= -1.5e+17: tmp = t_2 elif y <= -8.2e-96: tmp = t_1 elif y <= -1.65e-258: tmp = a elif y <= 7e-174: tmp = x elif y <= 16500.0: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(-a) * t) t_2 = Float64(Float64(-y) * z) tmp = 0.0 if (y <= -1.5e+17) tmp = t_2; elseif (y <= -8.2e-96) tmp = t_1; elseif (y <= -1.65e-258) tmp = a; elseif (y <= 7e-174) tmp = x; elseif (y <= 16500.0) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = -a * t; t_2 = -y * z; tmp = 0.0; if (y <= -1.5e+17) tmp = t_2; elseif (y <= -8.2e-96) tmp = t_1; elseif (y <= -1.65e-258) tmp = a; elseif (y <= 7e-174) tmp = x; elseif (y <= 16500.0) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[((-a) * t), $MachinePrecision]}, Block[{t$95$2 = N[((-y) * z), $MachinePrecision]}, If[LessEqual[y, -1.5e+17], t$95$2, If[LessEqual[y, -8.2e-96], t$95$1, If[LessEqual[y, -1.65e-258], a, If[LessEqual[y, 7e-174], x, If[LessEqual[y, 16500.0], t$95$1, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-a\right) \cdot t\\
t_2 := \left(-y\right) \cdot z\\
\mathbf{if}\;y \leq -1.5 \cdot 10^{+17}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq -8.2 \cdot 10^{-96}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -1.65 \cdot 10^{-258}:\\
\;\;\;\;a\\
\mathbf{elif}\;y \leq 7 \cdot 10^{-174}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 16500:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if y < -1.5e17 or 16500 < y Initial program 92.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6447.0
Applied rewrites47.0%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6447.0
Applied rewrites47.0%
if -1.5e17 < y < -8.20000000000000048e-96 or 6.99999999999999975e-174 < y < 16500Initial program 98.2%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6446.6
Applied rewrites46.6%
Taylor expanded in a around inf
mul-1-negN/A
lower-neg.f6436.0
Applied rewrites36.0%
if -8.20000000000000048e-96 < y < -1.65e-258Initial program 100.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6446.3
Applied rewrites46.3%
Taylor expanded in t around 0
Applied rewrites36.5%
if -1.65e-258 < y < 6.99999999999999975e-174Initial program 100.0%
Taylor expanded in x around inf
Applied rewrites32.5%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -1.72e+140) (not (<= a 6.5e+60))) (- x (fma (- t 1.0) a (* (- y 1.0) z))) (fma (- (+ t y) 2.0) b (fma (- 1.0 y) z x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -1.72e+140) || !(a <= 6.5e+60)) {
tmp = x - fma((t - 1.0), a, ((y - 1.0) * z));
} else {
tmp = fma(((t + y) - 2.0), b, fma((1.0 - y), z, x));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -1.72e+140) || !(a <= 6.5e+60)) tmp = Float64(x - fma(Float64(t - 1.0), a, Float64(Float64(y - 1.0) * z))); else tmp = fma(Float64(Float64(t + y) - 2.0), b, fma(Float64(1.0 - y), z, x)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -1.72e+140], N[Not[LessEqual[a, 6.5e+60]], $MachinePrecision]], N[(x - N[(N[(t - 1.0), $MachinePrecision] * a + N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + N[(N[(1.0 - y), $MachinePrecision] * z + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.72 \cdot 10^{+140} \lor \neg \left(a \leq 6.5 \cdot 10^{+60}\right):\\
\;\;\;\;x - \mathsf{fma}\left(t - 1, a, \left(y - 1\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(t + y\right) - 2, b, \mathsf{fma}\left(1 - y, z, x\right)\right)\\
\end{array}
\end{array}
if a < -1.7199999999999999e140 or 6.49999999999999931e60 < a Initial program 94.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.8
Applied rewrites87.8%
if -1.7199999999999999e140 < a < 6.49999999999999931e60Initial program 96.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 rewrites98.8%
Taylor expanded in z around 0
+-commutativeN/A
associate--l-N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6498.8
Applied rewrites98.8%
Taylor expanded in a around 0
*-commutativeN/A
+-commutativeN/A
lift-fma.f64N/A
lift--.f6492.1
Applied rewrites92.1%
Final simplification90.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b z) y)))
(if (<= y -6.8e+47)
t_1
(if (<= y -1.06e-244)
(* (- 1.0 t) a)
(if (<= y 2.5e-173)
(+ x (* -2.0 b))
(if (<= y 45000000000000.0) (* (- 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 <= -6.8e+47) {
tmp = t_1;
} else if (y <= -1.06e-244) {
tmp = (1.0 - t) * a;
} else if (y <= 2.5e-173) {
tmp = x + (-2.0 * b);
} else if (y <= 45000000000000.0) {
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 <= (-6.8d+47)) then
tmp = t_1
else if (y <= (-1.06d-244)) then
tmp = (1.0d0 - t) * a
else if (y <= 2.5d-173) then
tmp = x + ((-2.0d0) * b)
else if (y <= 45000000000000.0d0) 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 <= -6.8e+47) {
tmp = t_1;
} else if (y <= -1.06e-244) {
tmp = (1.0 - t) * a;
} else if (y <= 2.5e-173) {
tmp = x + (-2.0 * b);
} else if (y <= 45000000000000.0) {
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 <= -6.8e+47: tmp = t_1 elif y <= -1.06e-244: tmp = (1.0 - t) * a elif y <= 2.5e-173: tmp = x + (-2.0 * b) elif y <= 45000000000000.0: 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 <= -6.8e+47) tmp = t_1; elseif (y <= -1.06e-244) tmp = Float64(Float64(1.0 - t) * a); elseif (y <= 2.5e-173) tmp = Float64(x + Float64(-2.0 * b)); elseif (y <= 45000000000000.0) 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 <= -6.8e+47) tmp = t_1; elseif (y <= -1.06e-244) tmp = (1.0 - t) * a; elseif (y <= 2.5e-173) tmp = x + (-2.0 * b); elseif (y <= 45000000000000.0) 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, -6.8e+47], t$95$1, If[LessEqual[y, -1.06e-244], N[(N[(1.0 - t), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[y, 2.5e-173], N[(x + N[(-2.0 * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 45000000000000.0], 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 -6.8 \cdot 10^{+47}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -1.06 \cdot 10^{-244}:\\
\;\;\;\;\left(1 - t\right) \cdot a\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{-173}:\\
\;\;\;\;x + -2 \cdot b\\
\mathbf{elif}\;y \leq 45000000000000:\\
\;\;\;\;\left(b - a\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -6.7999999999999996e47 or 4.5e13 < y Initial program 92.4%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6472.7
Applied rewrites72.7%
if -6.7999999999999996e47 < y < -1.05999999999999999e-244Initial program 100.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6447.9
Applied rewrites47.9%
if -1.05999999999999999e-244 < y < 2.5000000000000001e-173Initial program 100.0%
Taylor expanded in x around inf
Applied rewrites63.7%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f6463.7
Applied rewrites63.7%
Taylor expanded in t around 0
Applied rewrites45.3%
if 2.5000000000000001e-173 < y < 4.5e13Initial program 97.3%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6447.7
Applied rewrites47.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -1.05e+148) (not (<= b 4.8e+109))) (fma (- (+ t y) 2.0) b (* (- a) t)) (- x (fma (- t 1.0) a (* (- y 1.0) z)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -1.05e+148) || !(b <= 4.8e+109)) {
tmp = fma(((t + y) - 2.0), b, (-a * t));
} else {
tmp = x - fma((t - 1.0), a, ((y - 1.0) * z));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -1.05e+148) || !(b <= 4.8e+109)) tmp = fma(Float64(Float64(t + y) - 2.0), b, Float64(Float64(-a) * t)); else tmp = Float64(x - fma(Float64(t - 1.0), a, Float64(Float64(y - 1.0) * z))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -1.05e+148], N[Not[LessEqual[b, 4.8e+109]], $MachinePrecision]], N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + N[((-a) * t), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(t - 1.0), $MachinePrecision] * a + N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.05 \cdot 10^{+148} \lor \neg \left(b \leq 4.8 \cdot 10^{+109}\right):\\
\;\;\;\;\mathsf{fma}\left(\left(t + y\right) - 2, b, \left(-a\right) \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;x - \mathsf{fma}\left(t - 1, a, \left(y - 1\right) \cdot z\right)\\
\end{array}
\end{array}
if b < -1.04999999999999999e148 or 4.79999999999999975e109 < b Initial program 90.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 rewrites94.4%
Taylor expanded in t around inf
+-commutativeN/A
associate--l-N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6488.9
Applied rewrites88.9%
if -1.04999999999999999e148 < b < 4.79999999999999975e109Initial program 97.8%
Taylor expanded in b around 0
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift--.f6488.1
Applied rewrites88.1%
Final simplification88.3%
(FPCore (x y z t a b) :precision binary64 (fma (- (+ t y) 2.0) b (- (fma (- 1.0 y) z x) (* (- t 1.0) a))))
double code(double x, double y, double z, double t, double a, double b) {
return fma(((t + y) - 2.0), b, (fma((1.0 - y), z, x) - ((t - 1.0) * a)));
}
function code(x, y, z, t, a, b) return fma(Float64(Float64(t + y) - 2.0), b, Float64(fma(Float64(1.0 - y), z, x) - Float64(Float64(t - 1.0) * a))) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + N[(N[(N[(1.0 - y), $MachinePrecision] * z + x), $MachinePrecision] - N[(N[(t - 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\left(t + y\right) - 2, b, \mathsf{fma}\left(1 - y, z, x\right) - \left(t - 1\right) \cdot a\right)
\end{array}
Initial program 95.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 rewrites98.4%
Taylor expanded in z around 0
+-commutativeN/A
associate--l-N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6498.4
Applied rewrites98.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b z) y)))
(if (<= y -6.8e+47)
t_1
(if (<= y -1.8e-140)
(* (- 1.0 t) a)
(if (<= y 8200000000000.0) (+ x (* (- t 2.0) b)) 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 <= -6.8e+47) {
tmp = t_1;
} else if (y <= -1.8e-140) {
tmp = (1.0 - t) * a;
} else if (y <= 8200000000000.0) {
tmp = x + ((t - 2.0) * b);
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = (b - z) * y
if (y <= (-6.8d+47)) then
tmp = t_1
else if (y <= (-1.8d-140)) then
tmp = (1.0d0 - t) * a
else if (y <= 8200000000000.0d0) then
tmp = x + ((t - 2.0d0) * b)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (b - z) * y;
double tmp;
if (y <= -6.8e+47) {
tmp = t_1;
} else if (y <= -1.8e-140) {
tmp = (1.0 - t) * a;
} else if (y <= 8200000000000.0) {
tmp = x + ((t - 2.0) * b);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (b - z) * y tmp = 0 if y <= -6.8e+47: tmp = t_1 elif y <= -1.8e-140: tmp = (1.0 - t) * a elif y <= 8200000000000.0: tmp = x + ((t - 2.0) * b) 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 <= -6.8e+47) tmp = t_1; elseif (y <= -1.8e-140) tmp = Float64(Float64(1.0 - t) * a); elseif (y <= 8200000000000.0) tmp = Float64(x + Float64(Float64(t - 2.0) * b)); 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 <= -6.8e+47) tmp = t_1; elseif (y <= -1.8e-140) tmp = (1.0 - t) * a; elseif (y <= 8200000000000.0) tmp = x + ((t - 2.0) * b); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b - z), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -6.8e+47], t$95$1, If[LessEqual[y, -1.8e-140], N[(N[(1.0 - t), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[y, 8200000000000.0], N[(x + N[(N[(t - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(b - z\right) \cdot y\\
\mathbf{if}\;y \leq -6.8 \cdot 10^{+47}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -1.8 \cdot 10^{-140}:\\
\;\;\;\;\left(1 - t\right) \cdot a\\
\mathbf{elif}\;y \leq 8200000000000:\\
\;\;\;\;x + \left(t - 2\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -6.7999999999999996e47 or 8.2e12 < y Initial program 92.4%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6472.7
Applied rewrites72.7%
if -6.7999999999999996e47 < y < -1.8e-140Initial program 100.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6451.6
Applied rewrites51.6%
if -1.8e-140 < y < 8.2e12Initial program 98.9%
Taylor expanded in x around inf
Applied rewrites53.8%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f6453.8
Applied rewrites53.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -3.4e+116) (not (<= z 2.7e+88))) (* (- 1.0 y) z) (+ x (* (- (+ y t) 2.0) b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -3.4e+116) || !(z <= 2.7e+88)) {
tmp = (1.0 - y) * z;
} else {
tmp = x + (((y + t) - 2.0) * b);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((z <= (-3.4d+116)) .or. (.not. (z <= 2.7d+88))) then
tmp = (1.0d0 - y) * z
else
tmp = x + (((y + t) - 2.0d0) * b)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -3.4e+116) || !(z <= 2.7e+88)) {
tmp = (1.0 - y) * z;
} else {
tmp = x + (((y + t) - 2.0) * b);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -3.4e+116) or not (z <= 2.7e+88): tmp = (1.0 - y) * z else: tmp = x + (((y + t) - 2.0) * b) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -3.4e+116) || !(z <= 2.7e+88)) tmp = Float64(Float64(1.0 - y) * z); else tmp = Float64(x + Float64(Float64(Float64(y + t) - 2.0) * b)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -3.4e+116) || ~((z <= 2.7e+88))) tmp = (1.0 - y) * z; else tmp = x + (((y + t) - 2.0) * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -3.4e+116], N[Not[LessEqual[z, 2.7e+88]], $MachinePrecision]], N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision], N[(x + N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.4 \cdot 10^{+116} \lor \neg \left(z \leq 2.7 \cdot 10^{+88}\right):\\
\;\;\;\;\left(1 - y\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + \left(\left(y + t\right) - 2\right) \cdot b\\
\end{array}
\end{array}
if z < -3.40000000000000023e116 or 2.70000000000000016e88 < z Initial program 94.4%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6469.0
Applied rewrites69.0%
if -3.40000000000000023e116 < z < 2.70000000000000016e88Initial program 96.4%
Taylor expanded in x around inf
Applied rewrites61.4%
Final simplification64.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- y) z)))
(if (<= y -6.8e+47)
t_1
(if (<= y -1.65e-258) a (if (<= y 1.3e-18) x t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = -y * z;
double tmp;
if (y <= -6.8e+47) {
tmp = t_1;
} else if (y <= -1.65e-258) {
tmp = a;
} else if (y <= 1.3e-18) {
tmp = x;
} 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 = -y * z
if (y <= (-6.8d+47)) then
tmp = t_1
else if (y <= (-1.65d-258)) then
tmp = a
else if (y <= 1.3d-18) then
tmp = x
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 = -y * z;
double tmp;
if (y <= -6.8e+47) {
tmp = t_1;
} else if (y <= -1.65e-258) {
tmp = a;
} else if (y <= 1.3e-18) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = -y * z tmp = 0 if y <= -6.8e+47: tmp = t_1 elif y <= -1.65e-258: tmp = a elif y <= 1.3e-18: tmp = x else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(-y) * z) tmp = 0.0 if (y <= -6.8e+47) tmp = t_1; elseif (y <= -1.65e-258) tmp = a; elseif (y <= 1.3e-18) tmp = x; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = -y * z; tmp = 0.0; if (y <= -6.8e+47) tmp = t_1; elseif (y <= -1.65e-258) tmp = a; elseif (y <= 1.3e-18) tmp = x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[((-y) * z), $MachinePrecision]}, If[LessEqual[y, -6.8e+47], t$95$1, If[LessEqual[y, -1.65e-258], a, If[LessEqual[y, 1.3e-18], x, t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-y\right) \cdot z\\
\mathbf{if}\;y \leq -6.8 \cdot 10^{+47}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -1.65 \cdot 10^{-258}:\\
\;\;\;\;a\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{-18}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -6.7999999999999996e47 or 1.3e-18 < y Initial program 92.5%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6446.5
Applied rewrites46.5%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6446.5
Applied rewrites46.5%
if -6.7999999999999996e47 < y < -1.65e-258Initial program 100.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6448.0
Applied rewrites48.0%
Taylor expanded in t around 0
Applied rewrites27.9%
if -1.65e-258 < y < 1.3e-18Initial program 98.5%
Taylor expanded in x around inf
Applied rewrites27.0%
(FPCore (x y z t a b) :precision binary64 (if (<= x -1.873e+141) x (if (<= x 5.2e-231) a (if (<= x 2.5e+75) (* b t) x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -1.873e+141) {
tmp = x;
} else if (x <= 5.2e-231) {
tmp = a;
} else if (x <= 2.5e+75) {
tmp = b * t;
} 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 <= (-1.873d+141)) then
tmp = x
else if (x <= 5.2d-231) then
tmp = a
else if (x <= 2.5d+75) then
tmp = b * t
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 <= -1.873e+141) {
tmp = x;
} else if (x <= 5.2e-231) {
tmp = a;
} else if (x <= 2.5e+75) {
tmp = b * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -1.873e+141: tmp = x elif x <= 5.2e-231: tmp = a elif x <= 2.5e+75: tmp = b * t else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -1.873e+141) tmp = x; elseif (x <= 5.2e-231) tmp = a; elseif (x <= 2.5e+75) tmp = Float64(b * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (x <= -1.873e+141) tmp = x; elseif (x <= 5.2e-231) tmp = a; elseif (x <= 2.5e+75) tmp = b * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -1.873e+141], x, If[LessEqual[x, 5.2e-231], a, If[LessEqual[x, 2.5e+75], N[(b * t), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.873 \cdot 10^{+141}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{-231}:\\
\;\;\;\;a\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{+75}:\\
\;\;\;\;b \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.87300000000000014e141 or 2.5000000000000001e75 < x Initial program 98.8%
Taylor expanded in x around inf
Applied rewrites39.1%
if -1.87300000000000014e141 < x < 5.20000000000000006e-231Initial program 92.9%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6440.7
Applied rewrites40.7%
Taylor expanded in t around 0
Applied rewrites19.9%
if 5.20000000000000006e-231 < x < 2.5000000000000001e75Initial program 96.7%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6437.7
Applied rewrites37.7%
Taylor expanded in a around 0
Applied rewrites23.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -6.8e+47) (not (<= y 1.6e+50))) (* (- b z) y) (* (- 1.0 t) a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -6.8e+47) || !(y <= 1.6e+50)) {
tmp = (b - z) * y;
} else {
tmp = (1.0 - t) * a;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((y <= (-6.8d+47)) .or. (.not. (y <= 1.6d+50))) then
tmp = (b - z) * y
else
tmp = (1.0d0 - t) * a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -6.8e+47) || !(y <= 1.6e+50)) {
tmp = (b - z) * y;
} else {
tmp = (1.0 - t) * a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -6.8e+47) or not (y <= 1.6e+50): tmp = (b - z) * y else: tmp = (1.0 - t) * a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -6.8e+47) || !(y <= 1.6e+50)) tmp = Float64(Float64(b - z) * y); else tmp = Float64(Float64(1.0 - t) * a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -6.8e+47) || ~((y <= 1.6e+50))) tmp = (b - z) * y; else tmp = (1.0 - t) * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -6.8e+47], N[Not[LessEqual[y, 1.6e+50]], $MachinePrecision]], N[(N[(b - z), $MachinePrecision] * y), $MachinePrecision], N[(N[(1.0 - t), $MachinePrecision] * a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.8 \cdot 10^{+47} \lor \neg \left(y \leq 1.6 \cdot 10^{+50}\right):\\
\;\;\;\;\left(b - z\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(1 - t\right) \cdot a\\
\end{array}
\end{array}
if y < -6.7999999999999996e47 or 1.59999999999999991e50 < y Initial program 92.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6474.4
Applied rewrites74.4%
if -6.7999999999999996e47 < y < 1.59999999999999991e50Initial program 99.2%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6440.2
Applied rewrites40.2%
Final simplification57.1%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -8.5e+68) (not (<= a 6.5e+62))) (* (- 1.0 t) a) (* (- 1.0 y) z)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -8.5e+68) || !(a <= 6.5e+62)) {
tmp = (1.0 - t) * a;
} else {
tmp = (1.0 - y) * 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 ((a <= (-8.5d+68)) .or. (.not. (a <= 6.5d+62))) then
tmp = (1.0d0 - t) * a
else
tmp = (1.0d0 - y) * 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 ((a <= -8.5e+68) || !(a <= 6.5e+62)) {
tmp = (1.0 - t) * a;
} else {
tmp = (1.0 - y) * z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a <= -8.5e+68) or not (a <= 6.5e+62): tmp = (1.0 - t) * a else: tmp = (1.0 - y) * z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -8.5e+68) || !(a <= 6.5e+62)) tmp = Float64(Float64(1.0 - t) * a); else tmp = Float64(Float64(1.0 - y) * z); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((a <= -8.5e+68) || ~((a <= 6.5e+62))) tmp = (1.0 - t) * a; else tmp = (1.0 - y) * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -8.5e+68], N[Not[LessEqual[a, 6.5e+62]], $MachinePrecision]], N[(N[(1.0 - t), $MachinePrecision] * a), $MachinePrecision], N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -8.5 \cdot 10^{+68} \lor \neg \left(a \leq 6.5 \cdot 10^{+62}\right):\\
\;\;\;\;\left(1 - t\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(1 - y\right) \cdot z\\
\end{array}
\end{array}
if a < -8.49999999999999966e68 or 6.5000000000000003e62 < a Initial program 94.5%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6458.4
Applied rewrites58.4%
if -8.49999999999999966e68 < a < 6.5000000000000003e62Initial program 96.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6442.5
Applied rewrites42.5%
Final simplification49.2%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -3.4e+95) (not (<= y 5.5e+99))) (* (- y) z) (* (- 1.0 t) a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -3.4e+95) || !(y <= 5.5e+99)) {
tmp = -y * z;
} else {
tmp = (1.0 - t) * a;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((y <= (-3.4d+95)) .or. (.not. (y <= 5.5d+99))) then
tmp = -y * z
else
tmp = (1.0d0 - t) * a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -3.4e+95) || !(y <= 5.5e+99)) {
tmp = -y * z;
} else {
tmp = (1.0 - t) * a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -3.4e+95) or not (y <= 5.5e+99): tmp = -y * z else: tmp = (1.0 - t) * a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -3.4e+95) || !(y <= 5.5e+99)) tmp = Float64(Float64(-y) * z); else tmp = Float64(Float64(1.0 - t) * a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -3.4e+95) || ~((y <= 5.5e+99))) tmp = -y * z; else tmp = (1.0 - t) * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -3.4e+95], N[Not[LessEqual[y, 5.5e+99]], $MachinePrecision]], N[((-y) * z), $MachinePrecision], N[(N[(1.0 - t), $MachinePrecision] * a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.4 \cdot 10^{+95} \lor \neg \left(y \leq 5.5 \cdot 10^{+99}\right):\\
\;\;\;\;\left(-y\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;\left(1 - t\right) \cdot a\\
\end{array}
\end{array}
if y < -3.40000000000000022e95 or 5.5000000000000002e99 < y Initial program 91.4%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6454.0
Applied rewrites54.0%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6454.0
Applied rewrites54.0%
if -3.40000000000000022e95 < y < 5.5000000000000002e99Initial program 98.6%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6439.0
Applied rewrites39.0%
Final simplification45.1%
(FPCore (x y z t a b) :precision binary64 (if (<= x -1.873e+141) x (if (<= x 2.2e-154) a (if (<= x 1.9e+93) z x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -1.873e+141) {
tmp = x;
} else if (x <= 2.2e-154) {
tmp = a;
} else if (x <= 1.9e+93) {
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 <= (-1.873d+141)) then
tmp = x
else if (x <= 2.2d-154) then
tmp = a
else if (x <= 1.9d+93) 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 <= -1.873e+141) {
tmp = x;
} else if (x <= 2.2e-154) {
tmp = a;
} else if (x <= 1.9e+93) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -1.873e+141: tmp = x elif x <= 2.2e-154: tmp = a elif x <= 1.9e+93: tmp = z else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -1.873e+141) tmp = x; elseif (x <= 2.2e-154) tmp = a; elseif (x <= 1.9e+93) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (x <= -1.873e+141) tmp = x; elseif (x <= 2.2e-154) tmp = a; elseif (x <= 1.9e+93) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -1.873e+141], x, If[LessEqual[x, 2.2e-154], a, If[LessEqual[x, 1.9e+93], z, x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.873 \cdot 10^{+141}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{-154}:\\
\;\;\;\;a\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{+93}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.87300000000000014e141 or 1.8999999999999999e93 < x Initial program 98.7%
Taylor expanded in x around inf
Applied rewrites40.2%
if -1.87300000000000014e141 < x < 2.20000000000000007e-154Initial program 93.6%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6442.0
Applied rewrites42.0%
Taylor expanded in t around 0
Applied rewrites19.5%
if 2.20000000000000007e-154 < x < 1.8999999999999999e93Initial program 96.2%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6450.0
Applied rewrites50.0%
Taylor expanded in y around 0
Applied rewrites17.9%
(FPCore (x y z t a b) :precision binary64 (if (<= x -1.873e+141) x (if (<= x 9e+72) a x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -1.873e+141) {
tmp = x;
} else if (x <= 9e+72) {
tmp = a;
} 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 <= (-1.873d+141)) then
tmp = x
else if (x <= 9d+72) then
tmp = a
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 <= -1.873e+141) {
tmp = x;
} else if (x <= 9e+72) {
tmp = a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -1.873e+141: tmp = x elif x <= 9e+72: tmp = a else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -1.873e+141) tmp = x; elseif (x <= 9e+72) tmp = a; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (x <= -1.873e+141) tmp = x; elseif (x <= 9e+72) tmp = a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -1.873e+141], x, If[LessEqual[x, 9e+72], a, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.873 \cdot 10^{+141}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 9 \cdot 10^{+72}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.87300000000000014e141 or 8.9999999999999997e72 < x Initial program 98.8%
Taylor expanded in x around inf
Applied rewrites38.6%
if -1.87300000000000014e141 < x < 8.9999999999999997e72Initial program 94.2%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6436.3
Applied rewrites36.3%
Taylor expanded in t around 0
Applied rewrites16.4%
(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 rewrites15.0%
herbie shell --seed 2025051
(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)))