
(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 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (+ (- (- x (* (- y 1.0) z)) (* (- t 1.0) a)) (* (- (+ y t) 2.0) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((x - ((y - 1.0d0) * z)) - ((t - 1.0d0) * a)) + (((y + t) - 2.0d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b);
}
def code(x, y, z, t, a, b): return ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x - Float64(Float64(y - 1.0) * z)) - Float64(Float64(t - 1.0) * a)) + Float64(Float64(Float64(y + t) - 2.0) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x - ((y - 1.0) * z)) - ((t - 1.0) * a)) + (((y + t) - 2.0) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x - N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] - N[(N[(t - 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - \left(y - 1\right) \cdot z\right) - \left(t - 1\right) \cdot a\right) + \left(\left(y + t\right) - 2\right) \cdot b
\end{array}
(FPCore (x y z t a b) :precision binary64 (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.3%
lift-+.f64N/A
lift--.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate--l-N/A
*-commutativeN/A
*-commutativeN/A
Applied rewrites97.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- 1.0 t) a)))
(if (<= a -2.9e+33)
t_1
(if (<= a -4.5e-247)
(fma y b x)
(if (<= a 2.7e-119)
(fma t b x)
(if (<= a 9.2e+94) (* (- 1.0 y) z) t_1))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (1.0 - t) * a;
double tmp;
if (a <= -2.9e+33) {
tmp = t_1;
} else if (a <= -4.5e-247) {
tmp = fma(y, b, x);
} else if (a <= 2.7e-119) {
tmp = fma(t, b, x);
} else if (a <= 9.2e+94) {
tmp = (1.0 - y) * z;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(1.0 - t) * a) tmp = 0.0 if (a <= -2.9e+33) tmp = t_1; elseif (a <= -4.5e-247) tmp = fma(y, b, x); elseif (a <= 2.7e-119) tmp = fma(t, b, x); elseif (a <= 9.2e+94) tmp = Float64(Float64(1.0 - y) * z); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(1.0 - t), $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[a, -2.9e+33], t$95$1, If[LessEqual[a, -4.5e-247], N[(y * b + x), $MachinePrecision], If[LessEqual[a, 2.7e-119], N[(t * b + x), $MachinePrecision], If[LessEqual[a, 9.2e+94], N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(1 - t\right) \cdot a\\
\mathbf{if}\;a \leq -2.9 \cdot 10^{+33}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq -4.5 \cdot 10^{-247}:\\
\;\;\;\;\mathsf{fma}\left(y, b, x\right)\\
\mathbf{elif}\;a \leq 2.7 \cdot 10^{-119}:\\
\;\;\;\;\mathsf{fma}\left(t, b, x\right)\\
\mathbf{elif}\;a \leq 9.2 \cdot 10^{+94}:\\
\;\;\;\;\left(1 - y\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -2.90000000000000025e33 or 9.1999999999999999e94 < a Initial program 92.2%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6455.4
Applied rewrites55.4%
if -2.90000000000000025e33 < a < -4.5000000000000002e-247Initial program 97.7%
Taylor expanded in x around inf
Applied rewrites63.7%
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lift--.f64N/A
lift-+.f6463.7
Applied rewrites63.7%
Taylor expanded in y around inf
Applied rewrites38.0%
if -4.5000000000000002e-247 < a < 2.70000000000000027e-119Initial program 98.1%
Taylor expanded in x around inf
Applied rewrites64.0%
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lift--.f64N/A
lift-+.f6464.0
Applied rewrites64.0%
Taylor expanded in t around inf
Applied rewrites42.2%
if 2.70000000000000027e-119 < a < 9.1999999999999999e94Initial program 96.1%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6428.9
Applied rewrites28.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- 1.0 t) a)))
(if (<= a -2.9e+33)
t_1
(if (<= a -4.5e-247)
(fma y b x)
(if (<= a 3e-119) (fma t b x) (if (<= a 3.5e+111) (fma y b x) t_1))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (1.0 - t) * a;
double tmp;
if (a <= -2.9e+33) {
tmp = t_1;
} else if (a <= -4.5e-247) {
tmp = fma(y, b, x);
} else if (a <= 3e-119) {
tmp = fma(t, b, x);
} else if (a <= 3.5e+111) {
tmp = fma(y, b, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(1.0 - t) * a) tmp = 0.0 if (a <= -2.9e+33) tmp = t_1; elseif (a <= -4.5e-247) tmp = fma(y, b, x); elseif (a <= 3e-119) tmp = fma(t, b, x); elseif (a <= 3.5e+111) tmp = fma(y, b, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(1.0 - t), $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[a, -2.9e+33], t$95$1, If[LessEqual[a, -4.5e-247], N[(y * b + x), $MachinePrecision], If[LessEqual[a, 3e-119], N[(t * b + x), $MachinePrecision], If[LessEqual[a, 3.5e+111], N[(y * b + x), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(1 - t\right) \cdot a\\
\mathbf{if}\;a \leq -2.9 \cdot 10^{+33}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq -4.5 \cdot 10^{-247}:\\
\;\;\;\;\mathsf{fma}\left(y, b, x\right)\\
\mathbf{elif}\;a \leq 3 \cdot 10^{-119}:\\
\;\;\;\;\mathsf{fma}\left(t, b, x\right)\\
\mathbf{elif}\;a \leq 3.5 \cdot 10^{+111}:\\
\;\;\;\;\mathsf{fma}\left(y, b, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -2.90000000000000025e33 or 3.5000000000000002e111 < a Initial program 92.1%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6456.1
Applied rewrites56.1%
if -2.90000000000000025e33 < a < -4.5000000000000002e-247 or 3.0000000000000002e-119 < a < 3.5000000000000002e111Initial program 97.0%
Taylor expanded in x around inf
Applied rewrites61.2%
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lift--.f64N/A
lift-+.f6461.2
Applied rewrites61.2%
Taylor expanded in y around inf
Applied rewrites37.2%
if -4.5000000000000002e-247 < a < 3.0000000000000002e-119Initial program 98.1%
Taylor expanded in x around inf
Applied rewrites64.0%
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lift--.f64N/A
lift-+.f6464.0
Applied rewrites64.0%
Taylor expanded in t around inf
Applied rewrites42.2%
(FPCore (x y z t a b)
:precision binary64
(if (<= b -2.2e-23)
(+ a (* (- (+ y t) 2.0) b))
(if (<= b 7.8e+144)
(- x (fma (- t 1.0) a (* (- y 1.0) z)))
(fma (- (+ t y) 2.0) b (* (- 1.0 y) z)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -2.2e-23) {
tmp = a + (((y + t) - 2.0) * b);
} else if (b <= 7.8e+144) {
tmp = x - fma((t - 1.0), a, ((y - 1.0) * z));
} else {
tmp = fma(((t + y) - 2.0), b, ((1.0 - y) * z));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -2.2e-23) tmp = Float64(a + Float64(Float64(Float64(y + t) - 2.0) * b)); elseif (b <= 7.8e+144) 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, Float64(Float64(1.0 - y) * z)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -2.2e-23], N[(a + N[(N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7.8e+144], 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), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.2 \cdot 10^{-23}:\\
\;\;\;\;a + \left(\left(y + t\right) - 2\right) \cdot b\\
\mathbf{elif}\;b \leq 7.8 \cdot 10^{+144}:\\
\;\;\;\;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, \left(1 - y\right) \cdot z\right)\\
\end{array}
\end{array}
if b < -2.1999999999999999e-23Initial program 92.3%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6471.9
Applied rewrites71.9%
Taylor expanded in t around 0
Applied rewrites67.2%
if -2.1999999999999999e-23 < b < 7.80000000000000036e144Initial program 98.3%
Taylor expanded in b around 0
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift--.f6485.9
Applied rewrites85.9%
if 7.80000000000000036e144 < b Initial program 88.6%
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 rewrites92.4%
Taylor expanded in z around inf
+-commutativeN/A
associate--l-N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6484.1
Applied rewrites84.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (- (+ y t) 2.0)))
(if (<= b -2.2e-23)
(+ a (* t_1 b))
(if (<= b 1.85e+145)
(- x (fma (- t 1.0) a (* (- y 1.0) z)))
(fma t_1 b x)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (y + t) - 2.0;
double tmp;
if (b <= -2.2e-23) {
tmp = a + (t_1 * b);
} else if (b <= 1.85e+145) {
tmp = x - fma((t - 1.0), a, ((y - 1.0) * z));
} else {
tmp = fma(t_1, b, x);
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(y + t) - 2.0) tmp = 0.0 if (b <= -2.2e-23) tmp = Float64(a + Float64(t_1 * b)); elseif (b <= 1.85e+145) tmp = Float64(x - fma(Float64(t - 1.0), a, Float64(Float64(y - 1.0) * z))); else tmp = fma(t_1, b, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision]}, If[LessEqual[b, -2.2e-23], N[(a + N[(t$95$1 * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.85e+145], N[(x - N[(N[(t - 1.0), $MachinePrecision] * a + N[(N[(y - 1.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * b + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y + t\right) - 2\\
\mathbf{if}\;b \leq -2.2 \cdot 10^{-23}:\\
\;\;\;\;a + t\_1 \cdot b\\
\mathbf{elif}\;b \leq 1.85 \cdot 10^{+145}:\\
\;\;\;\;x - \mathsf{fma}\left(t - 1, a, \left(y - 1\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, b, x\right)\\
\end{array}
\end{array}
if b < -2.1999999999999999e-23Initial program 92.3%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6471.9
Applied rewrites71.9%
Taylor expanded in t around 0
Applied rewrites67.2%
if -2.1999999999999999e-23 < b < 1.84999999999999997e145Initial program 98.3%
Taylor expanded in b around 0
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift--.f6485.9
Applied rewrites85.9%
if 1.84999999999999997e145 < b Initial program 88.6%
Taylor expanded in x around inf
Applied rewrites85.9%
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lift--.f64N/A
lift-+.f6485.9
Applied rewrites85.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b z) y)))
(if (<= y -4.8e+50)
t_1
(if (<= y -1.5e-133)
(fma t b x)
(if (<= y 23500000.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 <= -4.8e+50) {
tmp = t_1;
} else if (y <= -1.5e-133) {
tmp = fma(t, b, x);
} else if (y <= 23500000.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 <= -4.8e+50) tmp = t_1; elseif (y <= -1.5e-133) tmp = fma(t, b, x); elseif (y <= 23500000.0) tmp = Float64(Float64(b - a) * t); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b - z), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -4.8e+50], t$95$1, If[LessEqual[y, -1.5e-133], N[(t * b + x), $MachinePrecision], If[LessEqual[y, 23500000.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 -4.8 \cdot 10^{+50}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -1.5 \cdot 10^{-133}:\\
\;\;\;\;\mathsf{fma}\left(t, b, x\right)\\
\mathbf{elif}\;y \leq 23500000:\\
\;\;\;\;\left(b - a\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -4.8000000000000004e50 or 2.35e7 < y Initial program 92.3%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6467.2
Applied rewrites67.2%
if -4.8000000000000004e50 < y < -1.5000000000000001e-133Initial program 98.2%
Taylor expanded in x around inf
Applied rewrites50.9%
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lift--.f64N/A
lift-+.f6450.9
Applied rewrites50.9%
Taylor expanded in t around inf
Applied rewrites37.5%
if -1.5000000000000001e-133 < y < 2.35e7Initial program 97.8%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6439.1
Applied rewrites39.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- b a) t)))
(if (<= t -1.65e+59)
t_1
(if (<= t 2.1e-102)
(fma y b x)
(if (<= t 1.25e+35) (* (- 1.0 y) 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 <= -1.65e+59) {
tmp = t_1;
} else if (t <= 2.1e-102) {
tmp = fma(y, b, x);
} else if (t <= 1.25e+35) {
tmp = (1.0 - y) * 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 <= -1.65e+59) tmp = t_1; elseif (t <= 2.1e-102) tmp = fma(y, b, x); elseif (t <= 1.25e+35) tmp = Float64(Float64(1.0 - y) * 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, -1.65e+59], t$95$1, If[LessEqual[t, 2.1e-102], N[(y * b + x), $MachinePrecision], If[LessEqual[t, 1.25e+35], N[(N[(1.0 - y), $MachinePrecision] * z), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(b - a\right) \cdot t\\
\mathbf{if}\;t \leq -1.65 \cdot 10^{+59}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.1 \cdot 10^{-102}:\\
\;\;\;\;\mathsf{fma}\left(y, b, x\right)\\
\mathbf{elif}\;t \leq 1.25 \cdot 10^{+35}:\\
\;\;\;\;\left(1 - y\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.65e59 or 1.25000000000000005e35 < t Initial program 91.4%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6469.2
Applied rewrites69.2%
if -1.65e59 < t < 2.1e-102Initial program 98.2%
Taylor expanded in x around inf
Applied rewrites51.5%
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lift--.f64N/A
lift-+.f6451.5
Applied rewrites51.5%
Taylor expanded in y around inf
Applied rewrites39.4%
if 2.1e-102 < t < 1.25000000000000005e35Initial program 98.2%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6435.5
Applied rewrites35.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (- (+ y t) 2.0)))
(if (<= b -2.2e-23)
(+ a (* t_1 b))
(if (<= b 0.17) (- x (fma (- t 1.0) a (- z))) (fma t_1 b x)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (y + t) - 2.0;
double tmp;
if (b <= -2.2e-23) {
tmp = a + (t_1 * b);
} else if (b <= 0.17) {
tmp = x - fma((t - 1.0), a, -z);
} else {
tmp = fma(t_1, b, x);
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(y + t) - 2.0) tmp = 0.0 if (b <= -2.2e-23) tmp = Float64(a + Float64(t_1 * b)); elseif (b <= 0.17) tmp = Float64(x - fma(Float64(t - 1.0), a, Float64(-z))); else tmp = fma(t_1, b, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(y + t), $MachinePrecision] - 2.0), $MachinePrecision]}, If[LessEqual[b, -2.2e-23], N[(a + N[(t$95$1 * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 0.17], N[(x - N[(N[(t - 1.0), $MachinePrecision] * a + (-z)), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * b + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y + t\right) - 2\\
\mathbf{if}\;b \leq -2.2 \cdot 10^{-23}:\\
\;\;\;\;a + t\_1 \cdot b\\
\mathbf{elif}\;b \leq 0.17:\\
\;\;\;\;x - \mathsf{fma}\left(t - 1, a, -z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, b, x\right)\\
\end{array}
\end{array}
if b < -2.1999999999999999e-23Initial program 92.3%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6471.9
Applied rewrites71.9%
Taylor expanded in t around 0
Applied rewrites67.2%
if -2.1999999999999999e-23 < b < 0.170000000000000012Initial 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 rewrites69.6%
if 0.170000000000000012 < b Initial program 91.5%
Taylor expanded in x around inf
Applied rewrites72.3%
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lift--.f64N/A
lift-+.f6472.3
Applied rewrites72.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma (- (+ y t) 2.0) b x)))
(if (<= b -2.2e-23)
t_1
(if (<= b 0.17) (- 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 = fma(((y + t) - 2.0), b, x);
double tmp;
if (b <= -2.2e-23) {
tmp = t_1;
} else if (b <= 0.17) {
tmp = x - fma((t - 1.0), a, -z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(Float64(Float64(y + t) - 2.0), b, x) tmp = 0.0 if (b <= -2.2e-23) tmp = t_1; elseif (b <= 0.17) 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[(y + t), $MachinePrecision] - 2.0), $MachinePrecision] * b + x), $MachinePrecision]}, If[LessEqual[b, -2.2e-23], t$95$1, If[LessEqual[b, 0.17], N[(x - N[(N[(t - 1.0), $MachinePrecision] * a + (-z)), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\left(y + t\right) - 2, b, x\right)\\
\mathbf{if}\;b \leq -2.2 \cdot 10^{-23}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 0.17:\\
\;\;\;\;x - \mathsf{fma}\left(t - 1, a, -z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -2.1999999999999999e-23 or 0.170000000000000012 < b Initial program 91.9%
Taylor expanded in x around inf
Applied rewrites71.0%
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lift--.f64N/A
lift-+.f6471.0
Applied rewrites71.0%
if -2.1999999999999999e-23 < b < 0.170000000000000012Initial 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 rewrites69.6%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (fma (- (+ y t) 2.0) b x))) (if (<= b -2.1e-23) t_1 (if (<= b 9e-19) (- x (* z (- y 1.0))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(((y + t) - 2.0), b, x);
double tmp;
if (b <= -2.1e-23) {
tmp = t_1;
} else if (b <= 9e-19) {
tmp = x - (z * (y - 1.0));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(Float64(Float64(y + t) - 2.0), b, x) tmp = 0.0 if (b <= -2.1e-23) tmp = t_1; elseif (b <= 9e-19) tmp = Float64(x - Float64(z * Float64(y - 1.0))); else tmp = 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 + x), $MachinePrecision]}, If[LessEqual[b, -2.1e-23], t$95$1, If[LessEqual[b, 9e-19], N[(x - N[(z * N[(y - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\left(y + t\right) - 2, b, x\right)\\
\mathbf{if}\;b \leq -2.1 \cdot 10^{-23}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 9 \cdot 10^{-19}:\\
\;\;\;\;x - z \cdot \left(y - 1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -2.1000000000000001e-23 or 9.00000000000000026e-19 < b Initial program 92.1%
Taylor expanded in x around inf
Applied rewrites70.4%
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lift--.f64N/A
lift-+.f6470.4
Applied rewrites70.4%
if -2.1000000000000001e-23 < b < 9.00000000000000026e-19Initial program 99.1%
Taylor expanded in b around 0
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift--.f6492.5
Applied rewrites92.5%
Taylor expanded in z around inf
lower-*.f64N/A
lift--.f6458.0
Applied rewrites58.0%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (- (+ t y) 2.0) b))) (if (<= b -2.2e-23) t_1 (if (<= b 1e-13) (- x (* z (- y 1.0))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((t + y) - 2.0) * b;
double tmp;
if (b <= -2.2e-23) {
tmp = t_1;
} else if (b <= 1e-13) {
tmp = x - (z * (y - 1.0));
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = ((t + y) - 2.0d0) * b
if (b <= (-2.2d-23)) then
tmp = t_1
else if (b <= 1d-13) then
tmp = x - (z * (y - 1.0d0))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((t + y) - 2.0) * b;
double tmp;
if (b <= -2.2e-23) {
tmp = t_1;
} else if (b <= 1e-13) {
tmp = x - (z * (y - 1.0));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = ((t + y) - 2.0) * b tmp = 0 if b <= -2.2e-23: tmp = t_1 elif b <= 1e-13: tmp = x - (z * (y - 1.0)) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(t + y) - 2.0) * b) tmp = 0.0 if (b <= -2.2e-23) tmp = t_1; elseif (b <= 1e-13) tmp = Float64(x - Float64(z * Float64(y - 1.0))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = ((t + y) - 2.0) * b; tmp = 0.0; if (b <= -2.2e-23) tmp = t_1; elseif (b <= 1e-13) tmp = x - (z * (y - 1.0)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(t + y), $MachinePrecision] - 2.0), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[b, -2.2e-23], t$95$1, If[LessEqual[b, 1e-13], N[(x - N[(z * N[(y - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(t + y\right) - 2\right) \cdot b\\
\mathbf{if}\;b \leq -2.2 \cdot 10^{-23}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 10^{-13}:\\
\;\;\;\;x - z \cdot \left(y - 1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -2.1999999999999999e-23 or 1e-13 < b Initial program 92.1%
Taylor expanded in b around inf
*-commutativeN/A
+-commutativeN/A
lift--.f64N/A
lift-+.f64N/A
lift-*.f6462.2
lift-+.f64N/A
+-commutativeN/A
lower-+.f6462.2
Applied rewrites62.2%
if -2.1999999999999999e-23 < b < 1e-13Initial program 99.1%
Taylor expanded in b around 0
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift--.f6492.4
Applied rewrites92.4%
Taylor expanded in z around inf
lower-*.f64N/A
lift--.f6457.9
Applied rewrites57.9%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (- b z) y))) (if (<= y -4.8e+50) t_1 (if (<= y 6.8e+38) (fma (- t 2.0) b x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (b - z) * y;
double tmp;
if (y <= -4.8e+50) {
tmp = t_1;
} else if (y <= 6.8e+38) {
tmp = fma((t - 2.0), b, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(b - z) * y) tmp = 0.0 if (y <= -4.8e+50) tmp = t_1; elseif (y <= 6.8e+38) tmp = fma(Float64(t - 2.0), b, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b - z), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -4.8e+50], t$95$1, If[LessEqual[y, 6.8e+38], N[(N[(t - 2.0), $MachinePrecision] * b + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(b - z\right) \cdot y\\
\mathbf{if}\;y \leq -4.8 \cdot 10^{+50}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 6.8 \cdot 10^{+38}:\\
\;\;\;\;\mathsf{fma}\left(t - 2, b, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -4.8000000000000004e50 or 6.79999999999999992e38 < y Initial program 91.9%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6469.0
Applied rewrites69.0%
if -4.8000000000000004e50 < y < 6.79999999999999992e38Initial program 97.9%
Taylor expanded in x around inf
Applied rewrites51.0%
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lift--.f64N/A
lift-+.f6451.0
Applied rewrites51.0%
Taylor expanded in y around 0
Applied rewrites49.1%
(FPCore (x y z t a b) :precision binary64 (if (<= y -2.9e-12) (fma y b x) (if (<= y 4.8e+45) (fma t b x) (* (- z) y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -2.9e-12) {
tmp = fma(y, b, x);
} else if (y <= 4.8e+45) {
tmp = fma(t, b, x);
} else {
tmp = -z * y;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -2.9e-12) tmp = fma(y, b, x); elseif (y <= 4.8e+45) tmp = fma(t, b, x); else tmp = Float64(Float64(-z) * y); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -2.9e-12], N[(y * b + x), $MachinePrecision], If[LessEqual[y, 4.8e+45], N[(t * b + x), $MachinePrecision], N[((-z) * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.9 \cdot 10^{-12}:\\
\;\;\;\;\mathsf{fma}\left(y, b, x\right)\\
\mathbf{elif}\;y \leq 4.8 \cdot 10^{+45}:\\
\;\;\;\;\mathsf{fma}\left(t, b, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-z\right) \cdot y\\
\end{array}
\end{array}
if y < -2.9000000000000002e-12Initial program 92.8%
Taylor expanded in x around inf
Applied rewrites50.7%
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lift--.f64N/A
lift-+.f6450.7
Applied rewrites50.7%
Taylor expanded in y around inf
Applied rewrites41.0%
if -2.9000000000000002e-12 < y < 4.79999999999999979e45Initial program 97.9%
Taylor expanded in x around inf
Applied rewrites51.1%
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lift--.f64N/A
lift-+.f6451.1
Applied rewrites51.1%
Taylor expanded in t around inf
Applied rewrites39.4%
if 4.79999999999999979e45 < y Initial program 92.3%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6469.4
Applied rewrites69.4%
Taylor expanded in z around inf
mul-1-negN/A
lift-neg.f6439.6
Applied rewrites39.6%
(FPCore (x y z t a b) :precision binary64 (if (<= y -2.9e-12) (fma y b x) (if (<= y 6e+23) (fma t b x) (fma y b x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -2.9e-12) {
tmp = fma(y, b, x);
} else if (y <= 6e+23) {
tmp = fma(t, b, x);
} else {
tmp = fma(y, b, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -2.9e-12) tmp = fma(y, b, x); elseif (y <= 6e+23) tmp = fma(t, b, x); else tmp = fma(y, b, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -2.9e-12], N[(y * b + x), $MachinePrecision], If[LessEqual[y, 6e+23], N[(t * b + x), $MachinePrecision], N[(y * b + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.9 \cdot 10^{-12}:\\
\;\;\;\;\mathsf{fma}\left(y, b, x\right)\\
\mathbf{elif}\;y \leq 6 \cdot 10^{+23}:\\
\;\;\;\;\mathsf{fma}\left(t, b, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, b, x\right)\\
\end{array}
\end{array}
if y < -2.9000000000000002e-12 or 6.0000000000000002e23 < y Initial program 92.7%
Taylor expanded in x around inf
Applied rewrites50.7%
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lift--.f64N/A
lift-+.f6450.7
Applied rewrites50.7%
Taylor expanded in y around inf
Applied rewrites42.3%
if -2.9000000000000002e-12 < y < 6.0000000000000002e23Initial program 97.9%
Taylor expanded in x around inf
Applied rewrites51.1%
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lift--.f64N/A
lift-+.f6451.1
Applied rewrites51.1%
Taylor expanded in t around inf
Applied rewrites39.5%
(FPCore (x y z t a b) :precision binary64 (if (<= y -3e+51) (* b y) (if (<= y 2.1e+44) (fma t b x) (* b y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -3e+51) {
tmp = b * y;
} else if (y <= 2.1e+44) {
tmp = fma(t, b, x);
} else {
tmp = b * y;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -3e+51) tmp = Float64(b * y); elseif (y <= 2.1e+44) tmp = fma(t, b, x); else tmp = Float64(b * y); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -3e+51], N[(b * y), $MachinePrecision], If[LessEqual[y, 2.1e+44], N[(t * b + x), $MachinePrecision], N[(b * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3 \cdot 10^{+51}:\\
\;\;\;\;b \cdot y\\
\mathbf{elif}\;y \leq 2.1 \cdot 10^{+44}:\\
\;\;\;\;\mathsf{fma}\left(t, b, x\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot y\\
\end{array}
\end{array}
if y < -3e51 or 2.09999999999999987e44 < y Initial program 91.9%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6469.4
Applied rewrites69.4%
Taylor expanded in z around 0
Applied rewrites36.3%
if -3e51 < y < 2.09999999999999987e44Initial program 97.9%
Taylor expanded in x around inf
Applied rewrites51.1%
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift--.f64N/A
+-commutativeN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lift--.f64N/A
lift-+.f6451.1
Applied rewrites51.1%
Taylor expanded in t around inf
Applied rewrites38.9%
(FPCore (x y z t a b) :precision binary64 (if (<= y -2.9e-12) (* b y) (if (<= y 6e+23) (* b t) (* b y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -2.9e-12) {
tmp = b * y;
} else if (y <= 6e+23) {
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 <= (-2.9d-12)) then
tmp = b * y
else if (y <= 6d+23) 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 <= -2.9e-12) {
tmp = b * y;
} else if (y <= 6e+23) {
tmp = b * t;
} else {
tmp = b * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -2.9e-12: tmp = b * y elif y <= 6e+23: tmp = b * t else: tmp = b * y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -2.9e-12) tmp = Float64(b * y); elseif (y <= 6e+23) 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 <= -2.9e-12) tmp = b * y; elseif (y <= 6e+23) tmp = b * t; else tmp = b * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -2.9e-12], N[(b * y), $MachinePrecision], If[LessEqual[y, 6e+23], N[(b * t), $MachinePrecision], N[(b * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.9 \cdot 10^{-12}:\\
\;\;\;\;b \cdot y\\
\mathbf{elif}\;y \leq 6 \cdot 10^{+23}:\\
\;\;\;\;b \cdot t\\
\mathbf{else}:\\
\;\;\;\;b \cdot y\\
\end{array}
\end{array}
if y < -2.9000000000000002e-12 or 6.0000000000000002e23 < y Initial program 92.7%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6464.5
Applied rewrites64.5%
Taylor expanded in z around 0
Applied rewrites33.5%
if -2.9000000000000002e-12 < y < 6.0000000000000002e23Initial program 97.9%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6438.6
Applied rewrites38.6%
Taylor expanded in a around 0
Applied rewrites21.4%
(FPCore (x y z t a b) :precision binary64 (if (<= t -1.66e+59) (* b t) (if (<= t 1.7e+33) x (* b t))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -1.66e+59) {
tmp = b * t;
} else if (t <= 1.7e+33) {
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 <= (-1.66d+59)) then
tmp = b * t
else if (t <= 1.7d+33) 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 <= -1.66e+59) {
tmp = b * t;
} else if (t <= 1.7e+33) {
tmp = x;
} else {
tmp = b * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -1.66e+59: tmp = b * t elif t <= 1.7e+33: tmp = x else: tmp = b * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -1.66e+59) tmp = Float64(b * t); elseif (t <= 1.7e+33) 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 <= -1.66e+59) tmp = b * t; elseif (t <= 1.7e+33) tmp = x; else tmp = b * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -1.66e+59], N[(b * t), $MachinePrecision], If[LessEqual[t, 1.7e+33], x, N[(b * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.66 \cdot 10^{+59}:\\
\;\;\;\;b \cdot t\\
\mathbf{elif}\;t \leq 1.7 \cdot 10^{+33}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;b \cdot t\\
\end{array}
\end{array}
if t < -1.6599999999999999e59 or 1.7e33 < t Initial program 91.5%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6469.2
Applied rewrites69.2%
Taylor expanded in a around 0
Applied rewrites37.0%
if -1.6599999999999999e59 < t < 1.7e33Initial program 98.2%
Taylor expanded in x around inf
Applied rewrites19.7%
(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.3%
Taylor expanded in x around inf
Applied rewrites15.6%
herbie shell --seed 2025095
(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)))