
(FPCore (x y z t a b) :precision binary64 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
double code(double x, double y, double z, double t, double a, double b) {
return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
}
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) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
}
def code(x, y, z, t, a, b): return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y)) end
function tmp = code(x, y, z, t, a, b) tmp = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}
\end{array}
Herbie found 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
double code(double x, double y, double z, double t, double a, double b) {
return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
}
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) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
}
def code(x, y, z, t, a, b): return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y)) end
function tmp = code(x, y, z, t, a, b) tmp = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}
\end{array}
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (+ (+ t y) x))) (- (fma (- b) (/ y t_1) (* (/ (+ y x) t_1) z)) (* (/ (- (- t) y) t_1) a))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t + y) + x;
return fma(-b, (y / t_1), (((y + x) / t_1) * z)) - (((-t - y) / t_1) * a);
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t + y) + x) return Float64(fma(Float64(-b), Float64(y / t_1), Float64(Float64(Float64(y + x) / t_1) * z)) - Float64(Float64(Float64(Float64(-t) - y) / t_1) * a)) end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t + y), $MachinePrecision] + x), $MachinePrecision]}, N[(N[((-b) * N[(y / t$95$1), $MachinePrecision] + N[(N[(N[(y + x), $MachinePrecision] / t$95$1), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] - N[(N[(N[((-t) - y), $MachinePrecision] / t$95$1), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t + y\right) + x\\
\mathsf{fma}\left(-b, \frac{y}{t\_1}, \frac{y + x}{t\_1} \cdot z\right) - \frac{\left(-t\right) - y}{t\_1} \cdot a
\end{array}
\end{array}
Initial program 59.6%
Applied rewrites98.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (+ x t) y))
(t_2 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) t_1))
(t_3 (+ (+ t y) x))
(t_4 (- (fma (- b) (/ y t_3) z) (* (/ (- (- t) y) t_3) a))))
(if (<= t_2 (- INFINITY))
t_4
(if (<= t_2 5e+89) (/ (fma (- (+ a z) b) y (fma a t (* z x))) t_1) t_4))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + t) + y;
double t_2 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / t_1;
double t_3 = (t + y) + x;
double t_4 = fma(-b, (y / t_3), z) - (((-t - y) / t_3) * a);
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_4;
} else if (t_2 <= 5e+89) {
tmp = fma(((a + z) - b), y, fma(a, t, (z * x))) / t_1;
} else {
tmp = t_4;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + t) + y) t_2 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / t_1) t_3 = Float64(Float64(t + y) + x) t_4 = Float64(fma(Float64(-b), Float64(y / t_3), z) - Float64(Float64(Float64(Float64(-t) - y) / t_3) * a)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_4; elseif (t_2 <= 5e+89) tmp = Float64(fma(Float64(Float64(a + z) - b), y, fma(a, t, Float64(z * x))) / t_1); else tmp = t_4; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(t + y), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$4 = N[(N[((-b) * N[(y / t$95$3), $MachinePrecision] + z), $MachinePrecision] - N[(N[(N[((-t) - y), $MachinePrecision] / t$95$3), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$4, If[LessEqual[t$95$2, 5e+89], N[(N[(N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision] * y + N[(a * t + N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], t$95$4]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{t\_1}\\
t_3 := \left(t + y\right) + x\\
t_4 := \mathsf{fma}\left(-b, \frac{y}{t\_3}, z\right) - \frac{\left(-t\right) - y}{t\_3} \cdot a\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+89}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(a + z\right) - b, y, \mathsf{fma}\left(a, t, z \cdot x\right)\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;t\_4\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -inf.0 or 4.99999999999999983e89 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 23.3%
Applied rewrites99.9%
Taylor expanded in x around inf
Applied rewrites90.9%
if -inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 4.99999999999999983e89Initial program 99.4%
Taylor expanded in y around 0
+-commutativeN/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6499.4
Applied rewrites99.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (+ x t) y))
(t_2 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) t_1))
(t_3 (- (fma (- b) (/ y (+ (+ t y) x)) z) (- a))))
(if (<= t_2 (- INFINITY))
t_3
(if (<= t_2 2e+246)
(/ (fma (- (+ a z) b) y (fma a t (* z x))) t_1)
t_3))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + t) + y;
double t_2 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / t_1;
double t_3 = fma(-b, (y / ((t + y) + x)), z) - -a;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_3;
} else if (t_2 <= 2e+246) {
tmp = fma(((a + z) - b), y, fma(a, t, (z * x))) / t_1;
} else {
tmp = t_3;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + t) + y) t_2 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / t_1) t_3 = Float64(fma(Float64(-b), Float64(y / Float64(Float64(t + y) + x)), z) - Float64(-a)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_3; elseif (t_2 <= 2e+246) tmp = Float64(fma(Float64(Float64(a + z) - b), y, fma(a, t, Float64(z * x))) / t_1); else tmp = t_3; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[((-b) * N[(y / N[(N[(t + y), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision] - (-a)), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$3, If[LessEqual[t$95$2, 2e+246], N[(N[(N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision] * y + N[(a * t + N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], t$95$3]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{t\_1}\\
t_3 := \mathsf{fma}\left(-b, \frac{y}{\left(t + y\right) + x}, z\right) - \left(-a\right)\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+246}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(a + z\right) - b, y, \mathsf{fma}\left(a, t, z \cdot x\right)\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -inf.0 or 2.00000000000000014e246 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 8.6%
Applied rewrites99.9%
Taylor expanded in x around inf
Applied rewrites91.8%
Taylor expanded in x around 0
mul-1-negN/A
lower-neg.f6483.5
Applied rewrites83.5%
if -inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 2.00000000000000014e246Initial program 99.4%
Taylor expanded in y around 0
+-commutativeN/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6499.4
Applied rewrites99.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (+ x t) y))
(t_2 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) t_1))
(t_3 (- (fma (- b) (/ y (+ (+ t y) x)) z) (- a))))
(if (<= t_2 -2e+125)
t_3
(if (<= t_2 5e+132) (/ (fma (+ t y) a (* y (- z b))) t_1) t_3))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + t) + y;
double t_2 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / t_1;
double t_3 = fma(-b, (y / ((t + y) + x)), z) - -a;
double tmp;
if (t_2 <= -2e+125) {
tmp = t_3;
} else if (t_2 <= 5e+132) {
tmp = fma((t + y), a, (y * (z - b))) / t_1;
} else {
tmp = t_3;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + t) + y) t_2 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / t_1) t_3 = Float64(fma(Float64(-b), Float64(y / Float64(Float64(t + y) + x)), z) - Float64(-a)) tmp = 0.0 if (t_2 <= -2e+125) tmp = t_3; elseif (t_2 <= 5e+132) tmp = Float64(fma(Float64(t + y), a, Float64(y * Float64(z - b))) / t_1); else tmp = t_3; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[((-b) * N[(y / N[(N[(t + y), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision] - (-a)), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+125], t$95$3, If[LessEqual[t$95$2, 5e+132], N[(N[(N[(t + y), $MachinePrecision] * a + N[(y * N[(z - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], t$95$3]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{t\_1}\\
t_3 := \mathsf{fma}\left(-b, \frac{y}{\left(t + y\right) + x}, z\right) - \left(-a\right)\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+125}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+132}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t + y, a, y \cdot \left(z - b\right)\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -1.9999999999999998e125 or 5.0000000000000001e132 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 29.1%
Applied rewrites99.9%
Taylor expanded in x around inf
Applied rewrites91.0%
Taylor expanded in x around 0
mul-1-negN/A
lower-neg.f6481.8
Applied rewrites81.8%
if -1.9999999999999998e125 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 5.0000000000000001e132Initial program 99.3%
Taylor expanded in x around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lift-+.f64N/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f6472.7
Applied rewrites72.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (+ t y) x)) (t_2 (- z (* (/ (- (- t) y) t_1) a))))
(if (<= a -8.5e+100)
t_2
(if (<= a 1.5e-23) (- (fma (- b) (/ y t_1) z) (- a)) t_2))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t + y) + x;
double t_2 = z - (((-t - y) / t_1) * a);
double tmp;
if (a <= -8.5e+100) {
tmp = t_2;
} else if (a <= 1.5e-23) {
tmp = fma(-b, (y / t_1), z) - -a;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t + y) + x) t_2 = Float64(z - Float64(Float64(Float64(Float64(-t) - y) / t_1) * a)) tmp = 0.0 if (a <= -8.5e+100) tmp = t_2; elseif (a <= 1.5e-23) tmp = Float64(fma(Float64(-b), Float64(y / t_1), z) - Float64(-a)); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t + y), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(z - N[(N[(N[((-t) - y), $MachinePrecision] / t$95$1), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -8.5e+100], t$95$2, If[LessEqual[a, 1.5e-23], N[(N[((-b) * N[(y / t$95$1), $MachinePrecision] + z), $MachinePrecision] - (-a)), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t + y\right) + x\\
t_2 := z - \frac{\left(-t\right) - y}{t\_1} \cdot a\\
\mathbf{if}\;a \leq -8.5 \cdot 10^{+100}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;a \leq 1.5 \cdot 10^{-23}:\\
\;\;\;\;\mathsf{fma}\left(-b, \frac{y}{t\_1}, z\right) - \left(-a\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if a < -8.50000000000000043e100 or 1.50000000000000001e-23 < a Initial program 46.5%
Applied rewrites99.2%
Taylor expanded in x around inf
Applied rewrites79.8%
if -8.50000000000000043e100 < a < 1.50000000000000001e-23Initial program 70.0%
Applied rewrites98.3%
Taylor expanded in x around inf
Applied rewrites79.6%
Taylor expanded in x around 0
mul-1-negN/A
lower-neg.f6473.2
Applied rewrites73.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (+ t y) x)))
(if (<= b -6.1e+190)
(* (- b) (/ y t_1))
(if (<= b 1.3e+231)
(- z (* (/ (- (- t) y) t_1) a))
(/ (- (* z x) (* y b)) (+ (+ x t) y))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t + y) + x;
double tmp;
if (b <= -6.1e+190) {
tmp = -b * (y / t_1);
} else if (b <= 1.3e+231) {
tmp = z - (((-t - y) / t_1) * a);
} else {
tmp = ((z * x) - (y * b)) / ((x + t) + 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) :: t_1
real(8) :: tmp
t_1 = (t + y) + x
if (b <= (-6.1d+190)) then
tmp = -b * (y / t_1)
else if (b <= 1.3d+231) then
tmp = z - (((-t - y) / t_1) * a)
else
tmp = ((z * x) - (y * b)) / ((x + t) + y)
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) + x;
double tmp;
if (b <= -6.1e+190) {
tmp = -b * (y / t_1);
} else if (b <= 1.3e+231) {
tmp = z - (((-t - y) / t_1) * a);
} else {
tmp = ((z * x) - (y * b)) / ((x + t) + y);
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (t + y) + x tmp = 0 if b <= -6.1e+190: tmp = -b * (y / t_1) elif b <= 1.3e+231: tmp = z - (((-t - y) / t_1) * a) else: tmp = ((z * x) - (y * b)) / ((x + t) + y) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t + y) + x) tmp = 0.0 if (b <= -6.1e+190) tmp = Float64(Float64(-b) * Float64(y / t_1)); elseif (b <= 1.3e+231) tmp = Float64(z - Float64(Float64(Float64(Float64(-t) - y) / t_1) * a)); else tmp = Float64(Float64(Float64(z * x) - Float64(y * b)) / Float64(Float64(x + t) + y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (t + y) + x; tmp = 0.0; if (b <= -6.1e+190) tmp = -b * (y / t_1); elseif (b <= 1.3e+231) tmp = z - (((-t - y) / t_1) * a); else tmp = ((z * x) - (y * b)) / ((x + t) + y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t + y), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[b, -6.1e+190], N[((-b) * N[(y / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.3e+231], N[(z - N[(N[(N[((-t) - y), $MachinePrecision] / t$95$1), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z * x), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t + y\right) + x\\
\mathbf{if}\;b \leq -6.1 \cdot 10^{+190}:\\
\;\;\;\;\left(-b\right) \cdot \frac{y}{t\_1}\\
\mathbf{elif}\;b \leq 1.3 \cdot 10^{+231}:\\
\;\;\;\;z - \frac{\left(-t\right) - y}{t\_1} \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot x - y \cdot b}{\left(x + t\right) + y}\\
\end{array}
\end{array}
if b < -6.1000000000000004e190Initial program 43.8%
Taylor expanded in b around inf
mul-1-negN/A
associate-/l*N/A
distribute-lft-neg-outN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate-+r+N/A
lower-+.f64N/A
lift-+.f6457.1
Applied rewrites57.1%
if -6.1000000000000004e190 < b < 1.2999999999999999e231Initial program 62.5%
Applied rewrites99.0%
Taylor expanded in x around inf
Applied rewrites69.7%
if 1.2999999999999999e231 < b Initial program 45.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6435.5
Applied rewrites35.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (+ x t) y))
(t_2 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) t_1))
(t_3 (- z (- b a))))
(if (<= t_2 -5e+144)
t_3
(if (<= t_2 -1e-24)
(/ (* (- (+ a z) b) y) t_1)
(if (<= t_2 2e+97) (/ (- (* a t) (* y b)) t_1) t_3)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + t) + y;
double t_2 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / t_1;
double t_3 = z - (b - a);
double tmp;
if (t_2 <= -5e+144) {
tmp = t_3;
} else if (t_2 <= -1e-24) {
tmp = (((a + z) - b) * y) / t_1;
} else if (t_2 <= 2e+97) {
tmp = ((a * t) - (y * b)) / t_1;
} else {
tmp = t_3;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = (x + t) + y
t_2 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / t_1
t_3 = z - (b - a)
if (t_2 <= (-5d+144)) then
tmp = t_3
else if (t_2 <= (-1d-24)) then
tmp = (((a + z) - b) * y) / t_1
else if (t_2 <= 2d+97) then
tmp = ((a * t) - (y * b)) / t_1
else
tmp = t_3
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + t) + y;
double t_2 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / t_1;
double t_3 = z - (b - a);
double tmp;
if (t_2 <= -5e+144) {
tmp = t_3;
} else if (t_2 <= -1e-24) {
tmp = (((a + z) - b) * y) / t_1;
} else if (t_2 <= 2e+97) {
tmp = ((a * t) - (y * b)) / t_1;
} else {
tmp = t_3;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (x + t) + y t_2 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / t_1 t_3 = z - (b - a) tmp = 0 if t_2 <= -5e+144: tmp = t_3 elif t_2 <= -1e-24: tmp = (((a + z) - b) * y) / t_1 elif t_2 <= 2e+97: tmp = ((a * t) - (y * b)) / t_1 else: tmp = t_3 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + t) + y) t_2 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / t_1) t_3 = Float64(z - Float64(b - a)) tmp = 0.0 if (t_2 <= -5e+144) tmp = t_3; elseif (t_2 <= -1e-24) tmp = Float64(Float64(Float64(Float64(a + z) - b) * y) / t_1); elseif (t_2 <= 2e+97) tmp = Float64(Float64(Float64(a * t) - Float64(y * b)) / t_1); else tmp = t_3; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (x + t) + y; t_2 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / t_1; t_3 = z - (b - a); tmp = 0.0; if (t_2 <= -5e+144) tmp = t_3; elseif (t_2 <= -1e-24) tmp = (((a + z) - b) * y) / t_1; elseif (t_2 <= 2e+97) tmp = ((a * t) - (y * b)) / t_1; else tmp = t_3; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(z - N[(b - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+144], t$95$3, If[LessEqual[t$95$2, -1e-24], N[(N[(N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision] * y), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[t$95$2, 2e+97], N[(N[(N[(a * t), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], t$95$3]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{t\_1}\\
t_3 := z - \left(b - a\right)\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+144}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{-24}:\\
\;\;\;\;\frac{\left(\left(a + z\right) - b\right) \cdot y}{t\_1}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+97}:\\
\;\;\;\;\frac{a \cdot t - y \cdot b}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -4.9999999999999999e144 or 2.0000000000000001e97 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 30.3%
Applied rewrites99.9%
Taylor expanded in y around inf
fp-cancel-sub-sign-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
associate-+l-N/A
lower--.f64N/A
lower--.f6470.0
Applied rewrites70.0%
if -4.9999999999999999e144 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -9.99999999999999924e-25Initial program 99.7%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6451.1
Applied rewrites51.1%
if -9.99999999999999924e-25 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 2.0000000000000001e97Initial program 99.2%
Taylor expanded in t around inf
lower-*.f6452.4
Applied rewrites52.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (+ x t) y))
(t_2 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) t_1))
(t_3 (- z (- b a))))
(if (<= t_2 -5e+144)
t_3
(if (<= t_2 -2e-6)
(/ (* (- (+ a z) b) y) t_1)
(if (<= t_2 2e+178) (/ (fma a t (* z x)) (+ t x)) t_3)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + t) + y;
double t_2 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / t_1;
double t_3 = z - (b - a);
double tmp;
if (t_2 <= -5e+144) {
tmp = t_3;
} else if (t_2 <= -2e-6) {
tmp = (((a + z) - b) * y) / t_1;
} else if (t_2 <= 2e+178) {
tmp = fma(a, t, (z * x)) / (t + x);
} else {
tmp = t_3;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + t) + y) t_2 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / t_1) t_3 = Float64(z - Float64(b - a)) tmp = 0.0 if (t_2 <= -5e+144) tmp = t_3; elseif (t_2 <= -2e-6) tmp = Float64(Float64(Float64(Float64(a + z) - b) * y) / t_1); elseif (t_2 <= 2e+178) tmp = Float64(fma(a, t, Float64(z * x)) / Float64(t + x)); else tmp = t_3; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(z - N[(b - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+144], t$95$3, If[LessEqual[t$95$2, -2e-6], N[(N[(N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision] * y), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[t$95$2, 2e+178], N[(N[(a * t + N[(z * x), $MachinePrecision]), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision], t$95$3]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{t\_1}\\
t_3 := z - \left(b - a\right)\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+144}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-6}:\\
\;\;\;\;\frac{\left(\left(a + z\right) - b\right) \cdot y}{t\_1}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+178}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, z \cdot x\right)}{t + x}\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -4.9999999999999999e144 or 2.0000000000000001e178 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 23.6%
Applied rewrites99.9%
Taylor expanded in y around inf
fp-cancel-sub-sign-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
associate-+l-N/A
lower--.f64N/A
lower--.f6471.8
Applied rewrites71.8%
if -4.9999999999999999e144 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -1.99999999999999991e-6Initial program 99.7%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6451.0
Applied rewrites51.0%
if -1.99999999999999991e-6 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 2.0000000000000001e178Initial program 99.3%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6462.3
Applied rewrites62.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (- z (* (/ (- (- t) y) (+ y x)) a))))
(if (<= x -1.4e+45)
t_1
(if (<= x -2.4e-36)
(/ (fma a t (* z x)) (+ t x))
(if (<= x 3.5e-41) (- z (- b a)) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = z - (((-t - y) / (y + x)) * a);
double tmp;
if (x <= -1.4e+45) {
tmp = t_1;
} else if (x <= -2.4e-36) {
tmp = fma(a, t, (z * x)) / (t + x);
} else if (x <= 3.5e-41) {
tmp = z - (b - a);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(z - Float64(Float64(Float64(Float64(-t) - y) / Float64(y + x)) * a)) tmp = 0.0 if (x <= -1.4e+45) tmp = t_1; elseif (x <= -2.4e-36) tmp = Float64(fma(a, t, Float64(z * x)) / Float64(t + x)); elseif (x <= 3.5e-41) tmp = Float64(z - Float64(b - a)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z - N[(N[(N[((-t) - y), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.4e+45], t$95$1, If[LessEqual[x, -2.4e-36], N[(N[(a * t + N[(z * x), $MachinePrecision]), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.5e-41], N[(z - N[(b - a), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z - \frac{\left(-t\right) - y}{y + x} \cdot a\\
\mathbf{if}\;x \leq -1.4 \cdot 10^{+45}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -2.4 \cdot 10^{-36}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, z \cdot x\right)}{t + x}\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-41}:\\
\;\;\;\;z - \left(b - a\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.4e45 or 3.5e-41 < x Initial program 53.4%
Applied rewrites98.6%
Taylor expanded in x around inf
Applied rewrites71.2%
Taylor expanded in y around inf
Applied rewrites61.6%
if -1.4e45 < x < -2.4e-36Initial program 64.8%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6447.3
Applied rewrites47.3%
if -2.4e-36 < x < 3.5e-41Initial program 65.8%
Applied rewrites98.6%
Taylor expanded in y around inf
fp-cancel-sub-sign-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
associate-+l-N/A
lower--.f64N/A
lower--.f6465.2
Applied rewrites65.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
(t_2 (- z (- b a))))
(if (<= t_1 -1e+237)
t_2
(if (<= t_1 2e+178) (/ (fma a t (* z x)) (+ t x)) t_2))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
double t_2 = z - (b - a);
double tmp;
if (t_1 <= -1e+237) {
tmp = t_2;
} else if (t_1 <= 2e+178) {
tmp = fma(a, t, (z * x)) / (t + x);
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y)) t_2 = Float64(z - Float64(b - a)) tmp = 0.0 if (t_1 <= -1e+237) tmp = t_2; elseif (t_1 <= 2e+178) tmp = Float64(fma(a, t, Float64(z * x)) / Float64(t + x)); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(z - N[(b - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+237], t$95$2, If[LessEqual[t$95$1, 2e+178], N[(N[(a * t + N[(z * x), $MachinePrecision]), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\\
t_2 := z - \left(b - a\right)\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+237}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+178}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, z \cdot x\right)}{t + x}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -9.9999999999999994e236 or 2.0000000000000001e178 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 16.9%
Applied rewrites99.9%
Taylor expanded in y around inf
fp-cancel-sub-sign-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
associate-+l-N/A
lower--.f64N/A
lower--.f6473.1
Applied rewrites73.1%
if -9.9999999999999994e236 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 2.0000000000000001e178Initial program 99.4%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6461.1
Applied rewrites61.1%
(FPCore (x y z t a b) :precision binary64 (if (<= x -1.8e+158) (+ (/ (* y (- b)) x) z) (if (<= x 2.9e+38) (- z (- b a)) (+ (/ (* (- a z) t) x) z))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -1.8e+158) {
tmp = ((y * -b) / x) + z;
} else if (x <= 2.9e+38) {
tmp = z - (b - a);
} else {
tmp = (((a - z) * t) / x) + z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (x <= (-1.8d+158)) then
tmp = ((y * -b) / x) + z
else if (x <= 2.9d+38) then
tmp = z - (b - a)
else
tmp = (((a - z) * t) / x) + z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -1.8e+158) {
tmp = ((y * -b) / x) + z;
} else if (x <= 2.9e+38) {
tmp = z - (b - a);
} else {
tmp = (((a - z) * t) / x) + z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -1.8e+158: tmp = ((y * -b) / x) + z elif x <= 2.9e+38: tmp = z - (b - a) else: tmp = (((a - z) * t) / x) + z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -1.8e+158) tmp = Float64(Float64(Float64(y * Float64(-b)) / x) + z); elseif (x <= 2.9e+38) tmp = Float64(z - Float64(b - a)); else tmp = Float64(Float64(Float64(Float64(a - z) * t) / x) + z); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (x <= -1.8e+158) tmp = ((y * -b) / x) + z; elseif (x <= 2.9e+38) tmp = z - (b - a); else tmp = (((a - z) * t) / x) + z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -1.8e+158], N[(N[(N[(y * (-b)), $MachinePrecision] / x), $MachinePrecision] + z), $MachinePrecision], If[LessEqual[x, 2.9e+38], N[(z - N[(b - a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(a - z), $MachinePrecision] * t), $MachinePrecision] / x), $MachinePrecision] + z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.8 \cdot 10^{+158}:\\
\;\;\;\;\frac{y \cdot \left(-b\right)}{x} + z\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{+38}:\\
\;\;\;\;z - \left(b - a\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(a - z\right) \cdot t}{x} + z\\
\end{array}
\end{array}
if x < -1.79999999999999994e158Initial program 43.4%
Taylor expanded in x around inf
Applied rewrites54.3%
Taylor expanded in b around inf
mul-1-negN/A
distribute-lft-neg-outN/A
lift-neg.f64N/A
*-commutativeN/A
lower-*.f6458.4
Applied rewrites58.4%
if -1.79999999999999994e158 < x < 2.90000000000000007e38Initial program 64.8%
Applied rewrites98.9%
Taylor expanded in y around inf
fp-cancel-sub-sign-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
associate-+l-N/A
lower--.f64N/A
lower--.f6462.0
Applied rewrites62.0%
if 2.90000000000000007e38 < x Initial program 53.0%
Taylor expanded in x around inf
Applied rewrites49.0%
Taylor expanded in y around 0
*-commutativeN/A
distribute-rgt-out--N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6445.0
Applied rewrites45.0%
(FPCore (x y z t a b) :precision binary64 (if (<= x -1.8e+158) (+ (/ (* y (- b)) x) z) (if (<= x 4.9e+60) (- z (- b a)) (* (/ x (+ t x)) z))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -1.8e+158) {
tmp = ((y * -b) / x) + z;
} else if (x <= 4.9e+60) {
tmp = z - (b - a);
} else {
tmp = (x / (t + x)) * z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (x <= (-1.8d+158)) then
tmp = ((y * -b) / x) + z
else if (x <= 4.9d+60) then
tmp = z - (b - a)
else
tmp = (x / (t + x)) * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -1.8e+158) {
tmp = ((y * -b) / x) + z;
} else if (x <= 4.9e+60) {
tmp = z - (b - a);
} else {
tmp = (x / (t + x)) * z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -1.8e+158: tmp = ((y * -b) / x) + z elif x <= 4.9e+60: tmp = z - (b - a) else: tmp = (x / (t + x)) * z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -1.8e+158) tmp = Float64(Float64(Float64(y * Float64(-b)) / x) + z); elseif (x <= 4.9e+60) tmp = Float64(z - Float64(b - a)); else tmp = Float64(Float64(x / Float64(t + x)) * z); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (x <= -1.8e+158) tmp = ((y * -b) / x) + z; elseif (x <= 4.9e+60) tmp = z - (b - a); else tmp = (x / (t + x)) * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -1.8e+158], N[(N[(N[(y * (-b)), $MachinePrecision] / x), $MachinePrecision] + z), $MachinePrecision], If[LessEqual[x, 4.9e+60], N[(z - N[(b - a), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(t + x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.8 \cdot 10^{+158}:\\
\;\;\;\;\frac{y \cdot \left(-b\right)}{x} + z\\
\mathbf{elif}\;x \leq 4.9 \cdot 10^{+60}:\\
\;\;\;\;z - \left(b - a\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t + x} \cdot z\\
\end{array}
\end{array}
if x < -1.79999999999999994e158Initial program 43.4%
Taylor expanded in x around inf
Applied rewrites54.3%
Taylor expanded in b around inf
mul-1-negN/A
distribute-lft-neg-outN/A
lift-neg.f64N/A
*-commutativeN/A
lower-*.f6458.4
Applied rewrites58.4%
if -1.79999999999999994e158 < x < 4.9000000000000003e60Initial program 64.7%
Applied rewrites98.9%
Taylor expanded in y around inf
fp-cancel-sub-sign-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
associate-+l-N/A
lower--.f64N/A
lower--.f6461.9
Applied rewrites61.9%
if 4.9000000000000003e60 < x Initial program 52.4%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6439.0
Applied rewrites39.0%
Taylor expanded in z around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f6450.6
Applied rewrites50.6%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (- z (- b a)))) (if (<= y -5.8e-120) t_1 (if (<= y 8.2e+23) (* (/ t (+ t x)) a) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = z - (b - a);
double tmp;
if (y <= -5.8e-120) {
tmp = t_1;
} else if (y <= 8.2e+23) {
tmp = (t / (t + x)) * a;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = z - (b - a)
if (y <= (-5.8d-120)) then
tmp = t_1
else if (y <= 8.2d+23) then
tmp = (t / (t + x)) * a
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = z - (b - a);
double tmp;
if (y <= -5.8e-120) {
tmp = t_1;
} else if (y <= 8.2e+23) {
tmp = (t / (t + x)) * a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = z - (b - a) tmp = 0 if y <= -5.8e-120: tmp = t_1 elif y <= 8.2e+23: tmp = (t / (t + x)) * a else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(z - Float64(b - a)) tmp = 0.0 if (y <= -5.8e-120) tmp = t_1; elseif (y <= 8.2e+23) tmp = Float64(Float64(t / Float64(t + x)) * a); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = z - (b - a); tmp = 0.0; if (y <= -5.8e-120) tmp = t_1; elseif (y <= 8.2e+23) tmp = (t / (t + x)) * a; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z - N[(b - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.8e-120], t$95$1, If[LessEqual[y, 8.2e+23], N[(N[(t / N[(t + x), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z - \left(b - a\right)\\
\mathbf{if}\;y \leq -5.8 \cdot 10^{-120}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{+23}:\\
\;\;\;\;\frac{t}{t + x} \cdot a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -5.8e-120 or 8.19999999999999992e23 < y Initial program 46.6%
Applied rewrites99.7%
Taylor expanded in y around inf
fp-cancel-sub-sign-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
associate-+l-N/A
lower--.f64N/A
lower--.f6468.8
Applied rewrites68.8%
if -5.8e-120 < y < 8.19999999999999992e23Initial program 77.5%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6458.1
Applied rewrites58.1%
Taylor expanded in z around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f6441.4
Applied rewrites41.4%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (- z (- b a)))) (if (<= y -1700.0) t_1 (if (<= y 2.6e+44) (+ a z) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = z - (b - a);
double tmp;
if (y <= -1700.0) {
tmp = t_1;
} else if (y <= 2.6e+44) {
tmp = 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 = z - (b - a)
if (y <= (-1700.0d0)) then
tmp = t_1
else if (y <= 2.6d+44) then
tmp = 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 = z - (b - a);
double tmp;
if (y <= -1700.0) {
tmp = t_1;
} else if (y <= 2.6e+44) {
tmp = a + z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = z - (b - a) tmp = 0 if y <= -1700.0: tmp = t_1 elif y <= 2.6e+44: tmp = a + z else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(z - Float64(b - a)) tmp = 0.0 if (y <= -1700.0) tmp = t_1; elseif (y <= 2.6e+44) tmp = Float64(a + z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = z - (b - a); tmp = 0.0; if (y <= -1700.0) tmp = t_1; elseif (y <= 2.6e+44) tmp = a + z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z - N[(b - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1700.0], t$95$1, If[LessEqual[y, 2.6e+44], N[(a + z), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z - \left(b - a\right)\\
\mathbf{if}\;y \leq -1700:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{+44}:\\
\;\;\;\;a + z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1700 or 2.5999999999999999e44 < y Initial program 40.0%
Applied rewrites99.9%
Taylor expanded in y around inf
fp-cancel-sub-sign-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
associate-+l-N/A
lower--.f64N/A
lower--.f6474.2
Applied rewrites74.2%
if -1700 < y < 2.5999999999999999e44Initial program 77.2%
Applied rewrites97.6%
Taylor expanded in y around inf
fp-cancel-sub-sign-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
associate-+l-N/A
lower--.f64N/A
lower--.f6440.1
Applied rewrites40.1%
Taylor expanded in b around 0
lower-+.f6448.5
Applied rewrites48.5%
(FPCore (x y z t a b) :precision binary64 (if (<= b -5.3e+191) (- a b) (+ a z)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -5.3e+191) {
tmp = a - b;
} else {
tmp = a + z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (b <= (-5.3d+191)) then
tmp = a - b
else
tmp = a + z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -5.3e+191) {
tmp = a - b;
} else {
tmp = a + z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if b <= -5.3e+191: tmp = a - b else: tmp = a + z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -5.3e+191) tmp = Float64(a - b); else tmp = Float64(a + z); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (b <= -5.3e+191) tmp = a - b; else tmp = a + z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -5.3e+191], N[(a - b), $MachinePrecision], N[(a + z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5.3 \cdot 10^{+191}:\\
\;\;\;\;a - b\\
\mathbf{else}:\\
\;\;\;\;a + z\\
\end{array}
\end{array}
if b < -5.30000000000000031e191Initial program 43.8%
Applied rewrites96.9%
Taylor expanded in y around inf
fp-cancel-sub-sign-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
associate-+l-N/A
lower--.f64N/A
lower--.f6444.1
Applied rewrites44.1%
Taylor expanded in z around 0
lower--.f6438.4
Applied rewrites38.4%
if -5.30000000000000031e191 < b Initial program 61.3%
Applied rewrites98.9%
Taylor expanded in y around inf
fp-cancel-sub-sign-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
associate-+l-N/A
lower--.f64N/A
lower--.f6457.5
Applied rewrites57.5%
Taylor expanded in b around 0
lower-+.f6454.5
Applied rewrites54.5%
(FPCore (x y z t a b) :precision binary64 (if (<= x -3650000.0) z (if (<= x 2.9e-27) (- a b) z)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -3650000.0) {
tmp = z;
} else if (x <= 2.9e-27) {
tmp = a - b;
} else {
tmp = z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (x <= (-3650000.0d0)) then
tmp = z
else if (x <= 2.9d-27) then
tmp = a - b
else
tmp = z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -3650000.0) {
tmp = z;
} else if (x <= 2.9e-27) {
tmp = a - b;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -3650000.0: tmp = z elif x <= 2.9e-27: tmp = a - b else: tmp = z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -3650000.0) tmp = z; elseif (x <= 2.9e-27) tmp = Float64(a - b); else tmp = z; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (x <= -3650000.0) tmp = z; elseif (x <= 2.9e-27) tmp = a - b; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -3650000.0], z, If[LessEqual[x, 2.9e-27], N[(a - b), $MachinePrecision], z]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3650000:\\
\;\;\;\;z\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{-27}:\\
\;\;\;\;a - b\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if x < -3.65e6 or 2.90000000000000004e-27 < x Initial program 53.6%
Taylor expanded in x around inf
Applied rewrites43.1%
if -3.65e6 < x < 2.90000000000000004e-27Initial program 66.0%
Applied rewrites98.7%
Taylor expanded in y around inf
fp-cancel-sub-sign-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
associate-+l-N/A
lower--.f64N/A
lower--.f6464.6
Applied rewrites64.6%
Taylor expanded in z around 0
lower--.f6452.2
Applied rewrites52.2%
(FPCore (x y z t a b) :precision binary64 (if (<= x -3.8e+20) z (if (<= x 2.9e-27) a z)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -3.8e+20) {
tmp = z;
} else if (x <= 2.9e-27) {
tmp = a;
} else {
tmp = z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (x <= (-3.8d+20)) then
tmp = z
else if (x <= 2.9d-27) then
tmp = a
else
tmp = z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -3.8e+20) {
tmp = z;
} else if (x <= 2.9e-27) {
tmp = a;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -3.8e+20: tmp = z elif x <= 2.9e-27: tmp = a else: tmp = z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -3.8e+20) tmp = z; elseif (x <= 2.9e-27) tmp = a; else tmp = z; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (x <= -3.8e+20) tmp = z; elseif (x <= 2.9e-27) tmp = a; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -3.8e+20], z, If[LessEqual[x, 2.9e-27], a, z]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.8 \cdot 10^{+20}:\\
\;\;\;\;z\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{-27}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if x < -3.8e20 or 2.90000000000000004e-27 < x Initial program 53.3%
Taylor expanded in x around inf
Applied rewrites43.4%
if -3.8e20 < x < 2.90000000000000004e-27Initial program 66.0%
Taylor expanded in t around inf
Applied rewrites44.9%
(FPCore (x y z t a b) :precision binary64 a)
double code(double x, double y, double z, double t, double a, double b) {
return a;
}
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 = a
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return a;
}
def code(x, y, z, t, a, b): return a
function code(x, y, z, t, a, b) return a end
function tmp = code(x, y, z, t, a, b) tmp = a; end
code[x_, y_, z_, t_, a_, b_] := a
\begin{array}{l}
\\
a
\end{array}
Initial program 59.6%
Taylor expanded in t around inf
Applied rewrites32.8%
herbie shell --seed 2025130
(FPCore (x y z t a b)
:name "AI.Clustering.Hierarchical.Internal:ward from clustering-0.2.1"
:precision binary64
(/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))