
(FPCore (x y z t a b) :precision binary64 (+ (- (- x (* (- y 1.0) z)) (* (- t 1.0) a)) (* (- (+ y t) 2.0) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((x - ((y - 1.0d0) * z)) - ((t - 1.0d0) * a)) + (((y + t) - 2.0d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b);
}
def code(x, y, z, t, a, b): return ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x - Float64(Float64(y - 1.0) * z)) - Float64(Float64(t - 1.0) * a)) + Float64(Float64(Float64(y + t) - 2.0) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x - N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] - N[(N[(t - 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - \left(y - 1\right) \cdot z\right) - \left(t - 1\right) \cdot a\right) + \left(\left(y + t\right) - 2\right) \cdot b
\end{array}
Herbie found 23 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 (<= t 2e-132) (- (+ (fma (- b z) y (* (- t 2.0) b)) x) (fma (- t 1.0) a (- z))) (- (+ (fma (- b a) t (* (- y 2.0) b)) x) (fma (- y 1.0) z (- a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= 2e-132) {
tmp = (fma((b - z), y, ((t - 2.0) * b)) + x) - fma((t - 1.0), a, -z);
} else {
tmp = (fma((b - a), t, ((y - 2.0) * b)) + x) - fma((y - 1.0), z, -a);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= 2e-132) tmp = Float64(Float64(fma(Float64(b - z), y, Float64(Float64(t - 2.0) * b)) + x) - fma(Float64(t - 1.0), a, Float64(-z))); else tmp = Float64(Float64(fma(Float64(b - a), t, Float64(Float64(y - 2.0) * b)) + x) - fma(Float64(y - 1.0), z, Float64(-a))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, 2e-132], N[(N[(N[(N[(b - z), $MachinePrecision] * y + N[(N[(t - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision] - N[(N[(t - 1.0), $MachinePrecision] * a + (-z)), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(b - a), $MachinePrecision] * t + N[(N[(y - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision] - N[(N[(y - 1.0), $MachinePrecision] * z + (-a)), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 2 \cdot 10^{-132}:\\
\;\;\;\;\left(\mathsf{fma}\left(b - z, y, \left(t - 2\right) \cdot b\right) + x\right) - \mathsf{fma}\left(t - 1, a, -z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(b - a, t, \left(y - 2\right) \cdot b\right) + x\right) - \mathsf{fma}\left(y - 1, z, -a\right)\\
\end{array}
\end{array}
if t < 2e-132Initial program 95.7%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6496.8
Applied rewrites96.8%
if 2e-132 < t Initial program 94.3%
Taylor expanded in t around 0
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6495.4
Applied rewrites95.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- (+ y t) 2.0) b)))
(if (<= b -6.1e+99)
(+ x t_1)
(if (<= b 2.7e-23)
(- x (fma (- t 1.0) a (* (- y 1.0) z)))
(+ (fma (- 1.0 t) a x) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((y + t) - 2.0) * b;
double tmp;
if (b <= -6.1e+99) {
tmp = x + t_1;
} else if (b <= 2.7e-23) {
tmp = x - fma((t - 1.0), a, ((y - 1.0) * z));
} else {
tmp = fma((1.0 - t), a, x) + t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(y + t) - 2.0) * b) tmp = 0.0 if (b <= -6.1e+99) tmp = Float64(x + t_1); elseif (b <= 2.7e-23) tmp = Float64(x - fma(Float64(t - 1.0), a, Float64(Float64(y - 1.0) * z))); else tmp = Float64(fma(Float64(1.0 - t), a, x) + t_1); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[b, -6.1e+99], N[(x + t$95$1), $MachinePrecision], If[LessEqual[b, 2.7e-23], N[(x - N[(N[(t - 1.0), $MachinePrecision] * a + N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - t), $MachinePrecision] * a + x), $MachinePrecision] + t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(y + t\right) - 2\right) \cdot b\\
\mathbf{if}\;b \leq -6.1 \cdot 10^{+99}:\\
\;\;\;\;x + t\_1\\
\mathbf{elif}\;b \leq 2.7 \cdot 10^{-23}:\\
\;\;\;\;x - \mathsf{fma}\left(t - 1, a, \left(y - 1\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 - t, a, x\right) + t\_1\\
\end{array}
\end{array}
if b < -6.09999999999999973e99Initial program 90.6%
Taylor expanded in x around inf
Applied rewrites82.4%
if -6.09999999999999973e99 < b < 2.69999999999999985e-23Initial program 98.4%
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.4
Applied rewrites88.4%
if 2.69999999999999985e-23 < b Initial program 91.3%
Taylor expanded in a around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift--.f6491.3
Applied rewrites91.3%
Taylor expanded in z around 0
*-commutativeN/A
+-commutativeN/A
lift-fma.f64N/A
lift--.f6480.9
Applied rewrites80.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b a) t)))
(if (<= t -155000000000.0)
t_1
(if (<= t -4.4e-80)
(fma (- y) z z)
(if (<= t 1.65e-86)
(- x (- (- a) z))
(if (<= t 1.05e+19) (* (- b z) y) t_1))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (b - a) * t;
double tmp;
if (t <= -155000000000.0) {
tmp = t_1;
} else if (t <= -4.4e-80) {
tmp = fma(-y, z, z);
} else if (t <= 1.65e-86) {
tmp = x - (-a - z);
} else if (t <= 1.05e+19) {
tmp = (b - z) * y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(b - a) * t) tmp = 0.0 if (t <= -155000000000.0) tmp = t_1; elseif (t <= -4.4e-80) tmp = fma(Float64(-y), z, z); elseif (t <= 1.65e-86) tmp = Float64(x - Float64(Float64(-a) - z)); elseif (t <= 1.05e+19) tmp = Float64(Float64(b - z) * y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b - a), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -155000000000.0], t$95$1, If[LessEqual[t, -4.4e-80], N[((-y) * z + z), $MachinePrecision], If[LessEqual[t, 1.65e-86], N[(x - N[((-a) - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.05e+19], N[(N[(b - z), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(b - a\right) \cdot t\\
\mathbf{if}\;t \leq -155000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -4.4 \cdot 10^{-80}:\\
\;\;\;\;\mathsf{fma}\left(-y, z, z\right)\\
\mathbf{elif}\;t \leq 1.65 \cdot 10^{-86}:\\
\;\;\;\;x - \left(\left(-a\right) - z\right)\\
\mathbf{elif}\;t \leq 1.05 \cdot 10^{+19}:\\
\;\;\;\;\left(b - z\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.55e11 or 1.05e19 < t Initial program 92.2%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6465.7
Applied rewrites65.7%
if -1.55e11 < t < -4.4000000000000002e-80Initial program 98.1%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6431.6
Applied rewrites31.6%
Taylor expanded in y around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6431.6
Applied rewrites31.6%
if -4.4000000000000002e-80 < t < 1.64999999999999993e-86Initial program 98.1%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f64100.0
Applied rewrites100.0%
Taylor expanded in x around inf
Applied rewrites49.9%
Taylor expanded in t around 0
lower--.f64N/A
mul-1-negN/A
lower-neg.f6449.9
Applied rewrites49.9%
if 1.64999999999999993e-86 < t < 1.05e19Initial program 97.2%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6436.8
Applied rewrites36.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b z) y)))
(if (<= y -1.45e+15)
t_1
(if (<= y -2e-58)
(* (- 1.0 t) a)
(if (<= y -1.95e-246)
(- x (- z))
(if (<= y 4.8e+103) (* (- 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.45e+15) {
tmp = t_1;
} else if (y <= -2e-58) {
tmp = (1.0 - t) * a;
} else if (y <= -1.95e-246) {
tmp = x - -z;
} else if (y <= 4.8e+103) {
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.45d+15)) then
tmp = t_1
else if (y <= (-2d-58)) then
tmp = (1.0d0 - t) * a
else if (y <= (-1.95d-246)) then
tmp = x - -z
else if (y <= 4.8d+103) 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.45e+15) {
tmp = t_1;
} else if (y <= -2e-58) {
tmp = (1.0 - t) * a;
} else if (y <= -1.95e-246) {
tmp = x - -z;
} else if (y <= 4.8e+103) {
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.45e+15: tmp = t_1 elif y <= -2e-58: tmp = (1.0 - t) * a elif y <= -1.95e-246: tmp = x - -z elif y <= 4.8e+103: 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.45e+15) tmp = t_1; elseif (y <= -2e-58) tmp = Float64(Float64(1.0 - t) * a); elseif (y <= -1.95e-246) tmp = Float64(x - Float64(-z)); elseif (y <= 4.8e+103) 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.45e+15) tmp = t_1; elseif (y <= -2e-58) tmp = (1.0 - t) * a; elseif (y <= -1.95e-246) tmp = x - -z; elseif (y <= 4.8e+103) 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.45e+15], t$95$1, If[LessEqual[y, -2e-58], N[(N[(1.0 - t), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[y, -1.95e-246], N[(x - (-z)), $MachinePrecision], If[LessEqual[y, 4.8e+103], 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.45 \cdot 10^{+15}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -2 \cdot 10^{-58}:\\
\;\;\;\;\left(1 - t\right) \cdot a\\
\mathbf{elif}\;y \leq -1.95 \cdot 10^{-246}:\\
\;\;\;\;x - \left(-z\right)\\
\mathbf{elif}\;y \leq 4.8 \cdot 10^{+103}:\\
\;\;\;\;\left(b - a\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.45e15 or 4.7999999999999997e103 < y Initial program 91.5%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6469.0
Applied rewrites69.0%
if -1.45e15 < y < -2.0000000000000001e-58Initial program 97.9%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6432.9
Applied rewrites32.9%
if -2.0000000000000001e-58 < y < -1.94999999999999989e-246Initial program 98.3%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6498.3
Applied rewrites98.3%
Taylor expanded in x around inf
Applied rewrites68.9%
Taylor expanded in z around inf
mul-1-negN/A
lift-neg.f6439.1
Applied rewrites39.1%
if -1.94999999999999989e-246 < y < 4.7999999999999997e103Initial program 97.5%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6438.8
Applied rewrites38.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- (+ t y) 2.0) b)))
(if (<= b -5.4e+99)
t_1
(if (<= b -2.22e-54)
(- x (fma z (- y 1.0) (- a)))
(if (<= b 3.2e+33) (- x (fma (- t 1.0) a (- z))) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((t + y) - 2.0) * b;
double tmp;
if (b <= -5.4e+99) {
tmp = t_1;
} else if (b <= -2.22e-54) {
tmp = x - fma(z, (y - 1.0), -a);
} else if (b <= 3.2e+33) {
tmp = x - fma((t - 1.0), a, -z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(t + y) - 2.0) * b) tmp = 0.0 if (b <= -5.4e+99) tmp = t_1; elseif (b <= -2.22e-54) tmp = Float64(x - fma(z, Float64(y - 1.0), Float64(-a))); elseif (b <= 3.2e+33) tmp = Float64(x - fma(Float64(t - 1.0), a, Float64(-z))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[b, -5.4e+99], t$95$1, If[LessEqual[b, -2.22e-54], N[(x - N[(z * N[(y - 1.0), $MachinePrecision] + (-a)), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.2e+33], N[(x - N[(N[(t - 1.0), $MachinePrecision] * a + (-z)), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(t + y\right) - 2\right) \cdot b\\
\mathbf{if}\;b \leq -5.4 \cdot 10^{+99}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq -2.22 \cdot 10^{-54}:\\
\;\;\;\;x - \mathsf{fma}\left(z, y - 1, -a\right)\\
\mathbf{elif}\;b \leq 3.2 \cdot 10^{+33}:\\
\;\;\;\;x - \mathsf{fma}\left(t - 1, a, -z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -5.39999999999999978e99 or 3.20000000000000017e33 < b Initial program 90.1%
Taylor expanded in b around inf
*-commutativeN/A
+-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f6473.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f6473.0
Applied rewrites73.0%
if -5.39999999999999978e99 < b < -2.2200000000000001e-54Initial program 95.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--.f6467.4
Applied rewrites67.4%
Taylor expanded in t around 0
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6450.9
Applied rewrites50.9%
if -2.2200000000000001e-54 < b < 3.20000000000000017e33Initial program 99.3%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6499.3
Applied rewrites99.3%
Taylor expanded in x around inf
Applied rewrites70.1%
(FPCore (x y z t a b)
:precision binary64
(if (<= b -6.1e+99)
(+ x (* (- (+ y t) 2.0) b))
(if (<= b 1e+22)
(- x (fma (- t 1.0) a (* (- y 1.0) 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 <= -6.1e+99) {
tmp = x + (((y + t) - 2.0) * b);
} else if (b <= 1e+22) {
tmp = x - fma((t - 1.0), a, ((y - 1.0) * 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 <= -6.1e+99) tmp = Float64(x + Float64(Float64(Float64(y + t) - 2.0) * b)); elseif (b <= 1e+22) tmp = Float64(x - fma(Float64(t - 1.0), a, Float64(Float64(y - 1.0) * 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, -6.1e+99], N[(x + N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1e+22], N[(x - N[(N[(t - 1.0), $MachinePrecision] * a + N[(N[(y - 1.0), $MachinePrecision] * z), $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 -6.1 \cdot 10^{+99}:\\
\;\;\;\;x + \left(\left(y + t\right) - 2\right) \cdot b\\
\mathbf{elif}\;b \leq 10^{+22}:\\
\;\;\;\;x - \mathsf{fma}\left(t - 1, a, \left(y - 1\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + \mathsf{fma}\left(y - 2, b, b \cdot t\right)\\
\end{array}
\end{array}
if b < -6.09999999999999973e99Initial program 90.6%
Taylor expanded in x around inf
Applied rewrites82.4%
if -6.09999999999999973e99 < b < 1e22Initial program 98.5%
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.5
Applied rewrites87.5%
if 1e22 < b Initial program 90.0%
Taylor expanded in x around inf
Applied rewrites75.0%
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-*.f6473.2
Applied rewrites73.2%
(FPCore (x y z t a b) :precision binary64 (fma (- (+ t y) 2.0) b (- x (fma (- t 1.0) a (* (- y 1.0) z)))))
double code(double x, double y, double z, double t, double a, double b) {
return fma(((t + y) - 2.0), b, (x - fma((t - 1.0), a, ((y - 1.0) * z))));
}
function code(x, y, z, t, a, b) return fma(Float64(Float64(t + y) - 2.0), b, Float64(x - fma(Float64(t - 1.0), a, Float64(Float64(y - 1.0) * z)))) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b + N[(x - N[(N[(t - 1.0), $MachinePrecision] * a + N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\left(t + y\right) - 2, b, x - \mathsf{fma}\left(t - 1, a, \left(y - 1\right) \cdot z\right)\right)
\end{array}
Initial program 95.2%
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.6%
(FPCore (x y z t a b)
:precision binary64
(if (<= b -5.7e+99)
(+ x (* (- (+ y t) 2.0) b))
(if (<= b 6.6e+21)
(- x (fma (- t 1.0) a (* 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 <= -5.7e+99) {
tmp = x + (((y + t) - 2.0) * b);
} else if (b <= 6.6e+21) {
tmp = x - fma((t - 1.0), a, (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 <= -5.7e+99) tmp = Float64(x + Float64(Float64(Float64(y + t) - 2.0) * b)); elseif (b <= 6.6e+21) tmp = Float64(x - fma(Float64(t - 1.0), a, Float64(y * 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, -5.7e+99], N[(x + N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 6.6e+21], N[(x - N[(N[(t - 1.0), $MachinePrecision] * a + N[(y * z), $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 -5.7 \cdot 10^{+99}:\\
\;\;\;\;x + \left(\left(y + t\right) - 2\right) \cdot b\\
\mathbf{elif}\;b \leq 6.6 \cdot 10^{+21}:\\
\;\;\;\;x - \mathsf{fma}\left(t - 1, a, y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + \mathsf{fma}\left(y - 2, b, b \cdot t\right)\\
\end{array}
\end{array}
if b < -5.70000000000000003e99Initial program 90.6%
Taylor expanded in x around inf
Applied rewrites82.4%
if -5.70000000000000003e99 < b < 6.6e21Initial program 98.5%
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.5
Applied rewrites87.5%
Taylor expanded in y around inf
Applied rewrites75.4%
if 6.6e21 < b Initial program 90.1%
Taylor expanded in x around inf
Applied rewrites74.9%
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-*.f6473.2
Applied rewrites73.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ x (* (- (+ y t) 2.0) b))))
(if (<= b -5.7e+99)
t_1
(if (<= b 6.6e+21) (- x (fma (- t 1.0) a (* y z))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (((y + t) - 2.0) * b);
double tmp;
if (b <= -5.7e+99) {
tmp = t_1;
} else if (b <= 6.6e+21) {
tmp = x - fma((t - 1.0), a, (y * z));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(x + Float64(Float64(Float64(y + t) - 2.0) * b)) tmp = 0.0 if (b <= -5.7e+99) tmp = t_1; elseif (b <= 6.6e+21) tmp = Float64(x - fma(Float64(t - 1.0), a, Float64(y * z))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -5.7e+99], t$95$1, If[LessEqual[b, 6.6e+21], N[(x - N[(N[(t - 1.0), $MachinePrecision] * a + N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(\left(y + t\right) - 2\right) \cdot b\\
\mathbf{if}\;b \leq -5.7 \cdot 10^{+99}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 6.6 \cdot 10^{+21}:\\
\;\;\;\;x - \mathsf{fma}\left(t - 1, a, y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -5.70000000000000003e99 or 6.6e21 < b Initial program 90.3%
Taylor expanded in x around inf
Applied rewrites78.2%
if -5.70000000000000003e99 < b < 6.6e21Initial program 98.5%
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.5
Applied rewrites87.5%
Taylor expanded in y around inf
Applied rewrites75.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b z) y)))
(if (<= y -8.5e+14)
t_1
(if (<= y 3.4e-295)
(- x (* a t))
(if (<= y 4.8e+103) (* (- 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 <= -8.5e+14) {
tmp = t_1;
} else if (y <= 3.4e-295) {
tmp = x - (a * t);
} else if (y <= 4.8e+103) {
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 <= (-8.5d+14)) then
tmp = t_1
else if (y <= 3.4d-295) then
tmp = x - (a * t)
else if (y <= 4.8d+103) 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 <= -8.5e+14) {
tmp = t_1;
} else if (y <= 3.4e-295) {
tmp = x - (a * t);
} else if (y <= 4.8e+103) {
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 <= -8.5e+14: tmp = t_1 elif y <= 3.4e-295: tmp = x - (a * t) elif y <= 4.8e+103: 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 <= -8.5e+14) tmp = t_1; elseif (y <= 3.4e-295) tmp = Float64(x - Float64(a * t)); elseif (y <= 4.8e+103) 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 <= -8.5e+14) tmp = t_1; elseif (y <= 3.4e-295) tmp = x - (a * t); elseif (y <= 4.8e+103) 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, -8.5e+14], t$95$1, If[LessEqual[y, 3.4e-295], N[(x - N[(a * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.8e+103], 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 -8.5 \cdot 10^{+14}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 3.4 \cdot 10^{-295}:\\
\;\;\;\;x - a \cdot t\\
\mathbf{elif}\;y \leq 4.8 \cdot 10^{+103}:\\
\;\;\;\;\left(b - a\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -8.5e14 or 4.7999999999999997e103 < y Initial program 91.5%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6469.0
Applied rewrites69.0%
if -8.5e14 < y < 3.40000000000000007e-295Initial program 98.1%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6498.1
Applied rewrites98.1%
Taylor expanded in x around inf
Applied rewrites68.2%
Taylor expanded in t around inf
lower-*.f6438.2
Applied rewrites38.2%
if 3.40000000000000007e-295 < y < 4.7999999999999997e103Initial program 97.5%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6438.1
Applied rewrites38.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma (- y) z z)))
(if (<= z -2.2e+98)
t_1
(if (<= z -2.05e+30) (* b y) (if (<= z 1.5e+48) (* (- 1.0 t) a) 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 <= -2.2e+98) {
tmp = t_1;
} else if (z <= -2.05e+30) {
tmp = b * y;
} else if (z <= 1.5e+48) {
tmp = (1.0 - t) * a;
} 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 <= -2.2e+98) tmp = t_1; elseif (z <= -2.05e+30) tmp = Float64(b * y); elseif (z <= 1.5e+48) tmp = Float64(Float64(1.0 - t) * a); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[((-y) * z + z), $MachinePrecision]}, If[LessEqual[z, -2.2e+98], t$95$1, If[LessEqual[z, -2.05e+30], N[(b * y), $MachinePrecision], If[LessEqual[z, 1.5e+48], N[(N[(1.0 - t), $MachinePrecision] * a), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-y, z, z\right)\\
\mathbf{if}\;z \leq -2.2 \cdot 10^{+98}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -2.05 \cdot 10^{+30}:\\
\;\;\;\;b \cdot y\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{+48}:\\
\;\;\;\;\left(1 - t\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.20000000000000009e98 or 1.5e48 < z Initial program 91.1%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6458.8
Applied rewrites58.8%
Taylor expanded in y around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6458.9
Applied rewrites58.9%
if -2.20000000000000009e98 < z < -2.05000000000000003e30Initial program 96.6%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6432.8
Applied rewrites32.8%
Taylor expanded in z around 0
Applied rewrites14.1%
if -2.05000000000000003e30 < z < 1.5e48Initial program 97.8%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6434.5
Applied rewrites34.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- (+ y t) 2.0) b)))
(if (<= b -5.8e+34)
(+ a t_1)
(if (<= b 9.4e+20) (- x (fma (- t 1.0) a (- z))) (+ x t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((y + t) - 2.0) * b;
double tmp;
if (b <= -5.8e+34) {
tmp = a + t_1;
} else if (b <= 9.4e+20) {
tmp = x - fma((t - 1.0), a, -z);
} else {
tmp = x + t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(y + t) - 2.0) * b) tmp = 0.0 if (b <= -5.8e+34) tmp = Float64(a + t_1); elseif (b <= 9.4e+20) tmp = Float64(x - fma(Float64(t - 1.0), a, Float64(-z))); else tmp = Float64(x + t_1); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[b, -5.8e+34], N[(a + t$95$1), $MachinePrecision], If[LessEqual[b, 9.4e+20], N[(x - N[(N[(t - 1.0), $MachinePrecision] * a + (-z)), $MachinePrecision]), $MachinePrecision], N[(x + t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(y + t\right) - 2\right) \cdot b\\
\mathbf{if}\;b \leq -5.8 \cdot 10^{+34}:\\
\;\;\;\;a + t\_1\\
\mathbf{elif}\;b \leq 9.4 \cdot 10^{+20}:\\
\;\;\;\;x - \mathsf{fma}\left(t - 1, a, -z\right)\\
\mathbf{else}:\\
\;\;\;\;x + t\_1\\
\end{array}
\end{array}
if b < -5.8000000000000003e34Initial program 91.2%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6476.5
Applied rewrites76.5%
Taylor expanded in t around 0
Applied rewrites74.3%
if -5.8000000000000003e34 < b < 9.4e20Initial program 99.0%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6499.1
Applied rewrites99.1%
Taylor expanded in x around inf
Applied rewrites68.6%
if 9.4e20 < b Initial program 90.1%
Taylor expanded in x around inf
Applied rewrites74.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ x (* (- (+ y t) 2.0) b))))
(if (<= b -1.48e+32)
t_1
(if (<= b 9.4e+20) (- x (fma (- t 1.0) a (- z))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (((y + t) - 2.0) * b);
double tmp;
if (b <= -1.48e+32) {
tmp = t_1;
} else if (b <= 9.4e+20) {
tmp = x - fma((t - 1.0), a, -z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(x + Float64(Float64(Float64(y + t) - 2.0) * b)) tmp = 0.0 if (b <= -1.48e+32) tmp = t_1; elseif (b <= 9.4e+20) tmp = Float64(x - fma(Float64(t - 1.0), a, Float64(-z))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -1.48e+32], t$95$1, If[LessEqual[b, 9.4e+20], N[(x - N[(N[(t - 1.0), $MachinePrecision] * a + (-z)), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(\left(y + t\right) - 2\right) \cdot b\\
\mathbf{if}\;b \leq -1.48 \cdot 10^{+32}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 9.4 \cdot 10^{+20}:\\
\;\;\;\;x - \mathsf{fma}\left(t - 1, a, -z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -1.4799999999999999e32 or 9.4e20 < b Initial program 90.7%
Taylor expanded in x around inf
Applied rewrites75.5%
if -1.4799999999999999e32 < b < 9.4e20Initial program 99.1%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6499.1
Applied rewrites99.1%
Taylor expanded in x around inf
Applied rewrites68.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- (+ t y) 2.0) b)))
(if (<= b -5.4e+99)
t_1
(if (<= b 4.6e+33) (- x (fma z (- y 1.0) (- a))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((t + y) - 2.0) * b;
double tmp;
if (b <= -5.4e+99) {
tmp = t_1;
} else if (b <= 4.6e+33) {
tmp = x - fma(z, (y - 1.0), -a);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(t + y) - 2.0) * b) tmp = 0.0 if (b <= -5.4e+99) tmp = t_1; elseif (b <= 4.6e+33) tmp = Float64(x - fma(z, Float64(y - 1.0), Float64(-a))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[b, -5.4e+99], t$95$1, If[LessEqual[b, 4.6e+33], N[(x - N[(z * N[(y - 1.0), $MachinePrecision] + (-a)), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(t + y\right) - 2\right) \cdot b\\
\mathbf{if}\;b \leq -5.4 \cdot 10^{+99}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 4.6 \cdot 10^{+33}:\\
\;\;\;\;x - \mathsf{fma}\left(z, y - 1, -a\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -5.39999999999999978e99 or 4.60000000000000021e33 < b Initial program 90.1%
Taylor expanded in b around inf
*-commutativeN/A
+-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f6473.1
lift-+.f64N/A
+-commutativeN/A
lower-+.f6473.1
Applied rewrites73.1%
if -5.39999999999999978e99 < b < 4.60000000000000021e33Initial program 98.5%
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.2
Applied rewrites87.2%
Taylor expanded in t around 0
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6466.5
Applied rewrites66.5%
(FPCore (x y z t a b)
:precision binary64
(if (<= t -2.6e+83)
(* b t)
(if (<= t 3.5e+19)
(fma (- y) z z)
(if (<= t 1.22e+212) (* (- a) t) (* b t)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -2.6e+83) {
tmp = b * t;
} else if (t <= 3.5e+19) {
tmp = fma(-y, z, z);
} else if (t <= 1.22e+212) {
tmp = -a * t;
} else {
tmp = b * t;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -2.6e+83) tmp = Float64(b * t); elseif (t <= 3.5e+19) tmp = fma(Float64(-y), z, z); elseif (t <= 1.22e+212) tmp = Float64(Float64(-a) * t); else tmp = Float64(b * t); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -2.6e+83], N[(b * t), $MachinePrecision], If[LessEqual[t, 3.5e+19], N[((-y) * z + z), $MachinePrecision], If[LessEqual[t, 1.22e+212], N[((-a) * t), $MachinePrecision], N[(b * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.6 \cdot 10^{+83}:\\
\;\;\;\;b \cdot t\\
\mathbf{elif}\;t \leq 3.5 \cdot 10^{+19}:\\
\;\;\;\;\mathsf{fma}\left(-y, z, z\right)\\
\mathbf{elif}\;t \leq 1.22 \cdot 10^{+212}:\\
\;\;\;\;\left(-a\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;b \cdot t\\
\end{array}
\end{array}
if t < -2.6000000000000001e83 or 1.22000000000000005e212 < t Initial program 89.2%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6474.8
Applied rewrites74.8%
Taylor expanded in a around 0
Applied rewrites41.0%
if -2.6000000000000001e83 < t < 3.5e19Initial program 97.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6433.3
Applied rewrites33.3%
Taylor expanded in y around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6433.3
Applied rewrites33.3%
if 3.5e19 < t < 1.22000000000000005e212Initial program 94.9%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6459.4
Applied rewrites59.4%
Taylor expanded in a around inf
mul-1-negN/A
lower-neg.f6434.2
Applied rewrites34.2%
(FPCore (x y z t a b) :precision binary64 (if (<= y -7200000000.0) (* b y) (if (<= y 0.046) (- x (- z)) (if (<= y 2.45e+95) (* b t) (* b y)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -7200000000.0) {
tmp = b * y;
} else if (y <= 0.046) {
tmp = x - -z;
} else if (y <= 2.45e+95) {
tmp = b * t;
} 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 <= (-7200000000.0d0)) then
tmp = b * y
else if (y <= 0.046d0) then
tmp = x - -z
else if (y <= 2.45d+95) then
tmp = b * t
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 <= -7200000000.0) {
tmp = b * y;
} else if (y <= 0.046) {
tmp = x - -z;
} else if (y <= 2.45e+95) {
tmp = b * t;
} else {
tmp = b * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -7200000000.0: tmp = b * y elif y <= 0.046: tmp = x - -z elif y <= 2.45e+95: tmp = b * t else: tmp = b * y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -7200000000.0) tmp = Float64(b * y); elseif (y <= 0.046) tmp = Float64(x - Float64(-z)); elseif (y <= 2.45e+95) tmp = Float64(b * t); else tmp = Float64(b * y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y <= -7200000000.0) tmp = b * y; elseif (y <= 0.046) tmp = x - -z; elseif (y <= 2.45e+95) tmp = b * t; else tmp = b * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -7200000000.0], N[(b * y), $MachinePrecision], If[LessEqual[y, 0.046], N[(x - (-z)), $MachinePrecision], If[LessEqual[y, 2.45e+95], N[(b * t), $MachinePrecision], N[(b * y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7200000000:\\
\;\;\;\;b \cdot y\\
\mathbf{elif}\;y \leq 0.046:\\
\;\;\;\;x - \left(-z\right)\\
\mathbf{elif}\;y \leq 2.45 \cdot 10^{+95}:\\
\;\;\;\;b \cdot t\\
\mathbf{else}:\\
\;\;\;\;b \cdot y\\
\end{array}
\end{array}
if y < -7.2e9 or 2.4499999999999999e95 < y Initial program 91.6%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6468.2
Applied rewrites68.2%
Taylor expanded in z around 0
Applied rewrites36.3%
if -7.2e9 < y < 0.045999999999999999Initial program 97.9%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6497.9
Applied rewrites97.9%
Taylor expanded in x around inf
Applied rewrites68.6%
Taylor expanded in z around inf
mul-1-negN/A
lift-neg.f6436.6
Applied rewrites36.6%
if 0.045999999999999999 < y < 2.4499999999999999e95Initial program 97.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6434.2
Applied rewrites34.2%
Taylor expanded in a around 0
Applied rewrites19.0%
(FPCore (x y z t a b) :precision binary64 (if (<= t -134000000000.0) (* b t) (if (<= t 1.55e-276) z (if (<= t 4e+37) x (* b t)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -134000000000.0) {
tmp = b * t;
} else if (t <= 1.55e-276) {
tmp = z;
} else if (t <= 4e+37) {
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 (t <= (-134000000000.0d0)) then
tmp = b * t
else if (t <= 1.55d-276) then
tmp = z
else if (t <= 4d+37) 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 (t <= -134000000000.0) {
tmp = b * t;
} else if (t <= 1.55e-276) {
tmp = z;
} else if (t <= 4e+37) {
tmp = x;
} else {
tmp = b * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -134000000000.0: tmp = b * t elif t <= 1.55e-276: tmp = z elif t <= 4e+37: tmp = x else: tmp = b * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -134000000000.0) tmp = Float64(b * t); elseif (t <= 1.55e-276) tmp = z; elseif (t <= 4e+37) 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 (t <= -134000000000.0) tmp = b * t; elseif (t <= 1.55e-276) tmp = z; elseif (t <= 4e+37) tmp = x; else tmp = b * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -134000000000.0], N[(b * t), $MachinePrecision], If[LessEqual[t, 1.55e-276], z, If[LessEqual[t, 4e+37], x, N[(b * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -134000000000:\\
\;\;\;\;b \cdot t\\
\mathbf{elif}\;t \leq 1.55 \cdot 10^{-276}:\\
\;\;\;\;z\\
\mathbf{elif}\;t \leq 4 \cdot 10^{+37}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;b \cdot t\\
\end{array}
\end{array}
if t < -1.34e11 or 3.99999999999999982e37 < t Initial program 92.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6466.4
Applied rewrites66.4%
Taylor expanded in a around 0
Applied rewrites34.7%
if -1.34e11 < t < 1.54999999999999995e-276Initial program 98.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6433.9
Applied rewrites33.9%
Taylor expanded in y around 0
Applied rewrites14.8%
if 1.54999999999999995e-276 < t < 3.99999999999999982e37Initial program 97.8%
Taylor expanded in x around inf
Applied rewrites20.1%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (- (+ t y) 2.0) b))) (if (<= b -5.8e+34) t_1 (if (<= b 3.5e+31) (- x (fma t a (- z))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((t + y) - 2.0) * b;
double tmp;
if (b <= -5.8e+34) {
tmp = t_1;
} else if (b <= 3.5e+31) {
tmp = x - fma(t, a, -z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(t + y) - 2.0) * b) tmp = 0.0 if (b <= -5.8e+34) tmp = t_1; elseif (b <= 3.5e+31) tmp = Float64(x - fma(t, a, Float64(-z))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[b, -5.8e+34], t$95$1, If[LessEqual[b, 3.5e+31], N[(x - N[(t * a + (-z)), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(t + y\right) - 2\right) \cdot b\\
\mathbf{if}\;b \leq -5.8 \cdot 10^{+34}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 3.5 \cdot 10^{+31}:\\
\;\;\;\;x - \mathsf{fma}\left(t, a, -z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -5.8000000000000003e34 or 3.5e31 < b Initial program 90.5%
Taylor expanded in b around inf
*-commutativeN/A
+-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f6469.3
lift-+.f64N/A
+-commutativeN/A
lower-+.f6469.3
Applied rewrites69.3%
if -5.8000000000000003e34 < b < 3.5e31Initial program 99.0%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6499.1
Applied rewrites99.1%
Taylor expanded in x around inf
Applied rewrites68.3%
Taylor expanded in t around inf
Applied rewrites55.5%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (- (+ t y) 2.0) b))) (if (<= b -1.7e+33) t_1 (if (<= b 3.7e+31) (- x (- (- a) z)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((t + y) - 2.0) * b;
double tmp;
if (b <= -1.7e+33) {
tmp = t_1;
} else if (b <= 3.7e+31) {
tmp = x - (-a - z);
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = ((t + y) - 2.0d0) * b
if (b <= (-1.7d+33)) then
tmp = t_1
else if (b <= 3.7d+31) then
tmp = x - (-a - z)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((t + y) - 2.0) * b;
double tmp;
if (b <= -1.7e+33) {
tmp = t_1;
} else if (b <= 3.7e+31) {
tmp = x - (-a - z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = ((t + y) - 2.0) * b tmp = 0 if b <= -1.7e+33: tmp = t_1 elif b <= 3.7e+31: tmp = x - (-a - z) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(t + y) - 2.0) * b) tmp = 0.0 if (b <= -1.7e+33) tmp = t_1; elseif (b <= 3.7e+31) tmp = Float64(x - Float64(Float64(-a) - z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = ((t + y) - 2.0) * b; tmp = 0.0; if (b <= -1.7e+33) tmp = t_1; elseif (b <= 3.7e+31) tmp = x - (-a - z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[b, -1.7e+33], t$95$1, If[LessEqual[b, 3.7e+31], N[(x - N[((-a) - z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(t + y\right) - 2\right) \cdot b\\
\mathbf{if}\;b \leq -1.7 \cdot 10^{+33}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 3.7 \cdot 10^{+31}:\\
\;\;\;\;x - \left(\left(-a\right) - z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -1.7e33 or 3.6999999999999998e31 < b Initial program 90.5%
Taylor expanded in b around inf
*-commutativeN/A
+-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f6469.3
lift-+.f64N/A
+-commutativeN/A
lower-+.f6469.3
Applied rewrites69.3%
if -1.7e33 < b < 3.6999999999999998e31Initial program 99.1%
Taylor expanded in y around 0
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
mul-1-negN/A
lower-neg.f6499.1
Applied rewrites99.1%
Taylor expanded in x around inf
Applied rewrites68.4%
Taylor expanded in t around 0
lower--.f64N/A
mul-1-negN/A
lower-neg.f6446.0
Applied rewrites46.0%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (- b a) t))) (if (<= t -155000000000.0) t_1 (if (<= t 9.1e+18) (fma (- y) z z) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (b - a) * t;
double tmp;
if (t <= -155000000000.0) {
tmp = t_1;
} else if (t <= 9.1e+18) {
tmp = fma(-y, z, z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(b - a) * t) tmp = 0.0 if (t <= -155000000000.0) tmp = t_1; elseif (t <= 9.1e+18) 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[(b - a), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -155000000000.0], t$95$1, If[LessEqual[t, 9.1e+18], N[((-y) * z + z), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(b - a\right) \cdot t\\
\mathbf{if}\;t \leq -155000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 9.1 \cdot 10^{+18}:\\
\;\;\;\;\mathsf{fma}\left(-y, z, z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.55e11 or 9.1e18 < t Initial program 92.2%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6465.7
Applied rewrites65.7%
if -1.55e11 < t < 9.1e18Initial program 97.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6433.7
Applied rewrites33.7%
Taylor expanded in y around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6433.7
Applied rewrites33.7%
(FPCore (x y z t a b) :precision binary64 (if (<= t -0.00028) (* b t) (if (<= t 1.15e+50) (* b y) (* b t))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -0.00028) {
tmp = b * t;
} else if (t <= 1.15e+50) {
tmp = b * y;
} 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 (t <= (-0.00028d0)) then
tmp = b * t
else if (t <= 1.15d+50) then
tmp = b * y
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 (t <= -0.00028) {
tmp = b * t;
} else if (t <= 1.15e+50) {
tmp = b * y;
} else {
tmp = b * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -0.00028: tmp = b * t elif t <= 1.15e+50: tmp = b * y else: tmp = b * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -0.00028) tmp = Float64(b * t); elseif (t <= 1.15e+50) tmp = Float64(b * y); else tmp = Float64(b * t); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -0.00028) tmp = b * t; elseif (t <= 1.15e+50) tmp = b * y; else tmp = b * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -0.00028], N[(b * t), $MachinePrecision], If[LessEqual[t, 1.15e+50], N[(b * y), $MachinePrecision], N[(b * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -0.00028:\\
\;\;\;\;b \cdot t\\
\mathbf{elif}\;t \leq 1.15 \cdot 10^{+50}:\\
\;\;\;\;b \cdot y\\
\mathbf{else}:\\
\;\;\;\;b \cdot t\\
\end{array}
\end{array}
if t < -2.7999999999999998e-4 or 1.14999999999999998e50 < t Initial program 92.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6465.6
Applied rewrites65.6%
Taylor expanded in a around 0
Applied rewrites34.3%
if -2.7999999999999998e-4 < t < 1.14999999999999998e50Initial program 98.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6438.5
Applied rewrites38.5%
Taylor expanded in z around 0
Applied rewrites21.2%
(FPCore (x y z t a b) :precision binary64 (if (<= x -8.2e+220) x (if (<= x 450000000000.0) z x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -8.2e+220) {
tmp = x;
} else if (x <= 450000000000.0) {
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 <= (-8.2d+220)) then
tmp = x
else if (x <= 450000000000.0d0) 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 <= -8.2e+220) {
tmp = x;
} else if (x <= 450000000000.0) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -8.2e+220: tmp = x elif x <= 450000000000.0: tmp = z else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -8.2e+220) tmp = x; elseif (x <= 450000000000.0) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (x <= -8.2e+220) tmp = x; elseif (x <= 450000000000.0) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -8.2e+220], x, If[LessEqual[x, 450000000000.0], z, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.2 \cdot 10^{+220}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 450000000000:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -8.19999999999999962e220 or 4.5e11 < x Initial program 94.5%
Taylor expanded in x around inf
Applied rewrites32.9%
if -8.19999999999999962e220 < x < 4.5e11Initial program 95.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6431.4
Applied rewrites31.4%
Taylor expanded in y around 0
Applied rewrites12.8%
(FPCore (x y z t a b) :precision binary64 x)
double code(double x, double y, double z, double t, double a, double b) {
return x;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = x
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x;
}
def code(x, y, z, t, a, b): return x
function code(x, y, z, t, a, b) return x end
function tmp = code(x, y, z, t, a, b) tmp = x; end
code[x_, y_, z_, t_, a_, b_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 95.2%
Taylor expanded in x around inf
Applied rewrites15.6%
herbie shell --seed 2025089
(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)))