
(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 14 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 (+ (+ y x) t))
(t_2 (/ (+ y x) t_1))
(t_3
(* (- (+ (/ (+ t y) t_1) (* (/ z a) t_2)) (* (/ b a) (/ y t_1))) a)))
(if (<= a -4.8e+27)
t_3
(if (<= a 4.2e-85) (fma t_2 z (/ (fma (+ t y) a (* (- b) y)) t_1)) t_3))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (y + x) + t;
double t_2 = (y + x) / t_1;
double t_3 = ((((t + y) / t_1) + ((z / a) * t_2)) - ((b / a) * (y / t_1))) * a;
double tmp;
if (a <= -4.8e+27) {
tmp = t_3;
} else if (a <= 4.2e-85) {
tmp = fma(t_2, z, (fma((t + y), a, (-b * y)) / t_1));
} else {
tmp = t_3;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(y + x) + t) t_2 = Float64(Float64(y + x) / t_1) t_3 = Float64(Float64(Float64(Float64(Float64(t + y) / t_1) + Float64(Float64(z / a) * t_2)) - Float64(Float64(b / a) * Float64(y / t_1))) * a) tmp = 0.0 if (a <= -4.8e+27) tmp = t_3; elseif (a <= 4.2e-85) tmp = fma(t_2, z, Float64(fma(Float64(t + y), a, Float64(Float64(-b) * y)) / t_1)); else tmp = t_3; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(y + x), $MachinePrecision] + t), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y + x), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(N[(N[(t + y), $MachinePrecision] / t$95$1), $MachinePrecision] + N[(N[(z / a), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision] - N[(N[(b / a), $MachinePrecision] * N[(y / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[a, -4.8e+27], t$95$3, If[LessEqual[a, 4.2e-85], N[(t$95$2 * z + N[(N[(N[(t + y), $MachinePrecision] * a + N[((-b) * y), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], t$95$3]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y + x\right) + t\\
t_2 := \frac{y + x}{t\_1}\\
t_3 := \left(\left(\frac{t + y}{t\_1} + \frac{z}{a} \cdot t\_2\right) - \frac{b}{a} \cdot \frac{y}{t\_1}\right) \cdot a\\
\mathbf{if}\;a \leq -4.8 \cdot 10^{+27}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;a \leq 4.2 \cdot 10^{-85}:\\
\;\;\;\;\mathsf{fma}\left(t\_2, z, \frac{\mathsf{fma}\left(t + y, a, \left(-b\right) \cdot y\right)}{t\_1}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if a < -4.79999999999999995e27 or 4.2e-85 < a Initial program 50.9%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites97.6%
if -4.79999999999999995e27 < a < 4.2e-85Initial program 71.7%
Applied rewrites87.6%
(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 (- (+ a z) b)))
(if (<= t_2 -1e+60)
t_3
(if (<= t_2 1e+55)
(/ (fma a t (* z x)) (+ t x))
(if (<= t_2 1e+185) (/ (* t_3 y) 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 = (a + z) - b;
double tmp;
if (t_2 <= -1e+60) {
tmp = t_3;
} else if (t_2 <= 1e+55) {
tmp = fma(a, t, (z * x)) / (t + x);
} else if (t_2 <= 1e+185) {
tmp = (t_3 * y) / 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(Float64(a + z) - b) tmp = 0.0 if (t_2 <= -1e+60) tmp = t_3; elseif (t_2 <= 1e+55) tmp = Float64(fma(a, t, Float64(z * x)) / Float64(t + x)); elseif (t_2 <= 1e+185) tmp = Float64(Float64(t_3 * y) / 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[(a + z), $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+60], t$95$3, If[LessEqual[t$95$2, 1e+55], N[(N[(a * t + N[(z * x), $MachinePrecision]), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+185], N[(N[(t$95$3 * y), $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 := \left(a + z\right) - b\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+60}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 10^{+55}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, z \cdot x\right)}{t + x}\\
\mathbf{elif}\;t\_2 \leq 10^{+185}:\\
\;\;\;\;\frac{t\_3 \cdot y}{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)) < -9.9999999999999995e59 or 9.9999999999999998e184 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 31.5%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6468.7
Applied rewrites68.7%
if -9.9999999999999995e59 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 1.00000000000000001e55Initial program 99.3%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6464.2
Applied rewrites64.2%
if 1.00000000000000001e55 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 9.9999999999999998e184Initial program 99.7%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6456.0
Applied rewrites56.0%
(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 (- (+ a z) b)))
(if (<= t_1 (- INFINITY)) t_2 (if (<= t_1 1e+219) t_1 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 = (a + z) - b;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = t_2;
} else if (t_1 <= 1e+219) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
public static 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 = (a + z) - b;
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = t_2;
} else if (t_1 <= 1e+219) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y) t_2 = (a + z) - b tmp = 0 if t_1 <= -math.inf: tmp = t_2 elif t_1 <= 1e+219: tmp = t_1 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(Float64(a + z) - b) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = t_2; elseif (t_1 <= 1e+219) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y); t_2 = (a + z) - b; tmp = 0.0; if (t_1 <= -Inf) tmp = t_2; elseif (t_1 <= 1e+219) tmp = t_1; else tmp = t_2; end tmp_2 = 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[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], t$95$2, If[LessEqual[t$95$1, 1e+219], t$95$1, 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 := \left(a + z\right) - b\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 10^{+219}:\\
\;\;\;\;t\_1\\
\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)) < -inf.0 or 9.99999999999999965e218 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 10.6%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6471.9
Applied rewrites71.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)) < 9.99999999999999965e218Initial program 99.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 (- (+ a z) b)))
(if (<= t_2 (- INFINITY))
t_3
(if (<= t_2 1e+185) (/ (fma (+ t y) a (* (+ y x) z)) 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 = (a + z) - b;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_3;
} else if (t_2 <= 1e+185) {
tmp = fma((t + y), a, ((y + x) * z)) / 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(Float64(a + z) - b) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_3; elseif (t_2 <= 1e+185) tmp = Float64(fma(Float64(t + y), a, Float64(Float64(y + x) * z)) / 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[(a + z), $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$3, If[LessEqual[t$95$2, 1e+185], N[(N[(N[(t + y), $MachinePrecision] * a + N[(N[(y + x), $MachinePrecision] * z), $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 := \left(a + z\right) - b\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 10^{+185}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t + y, a, \left(y + x\right) \cdot z\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 9.9999999999999998e184 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 13.5%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6471.7
Applied rewrites71.7%
if -inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 9.9999999999999998e184Initial program 99.5%
Taylor expanded in b around 0
*-commutativeN/A
lower-fma.f64N/A
lift-+.f64N/A
*-commutativeN/A
lift-*.f64N/A
+-commutativeN/A
lower-+.f6477.4
Applied rewrites77.4%
(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 (- (+ a z) b)))
(if (<= t_1 -2e+132)
t_2
(if (<= t_1 2e+137) (/ (fma a (+ t y) (* z (+ x y))) (+ 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 = (a + z) - b;
double tmp;
if (t_1 <= -2e+132) {
tmp = t_2;
} else if (t_1 <= 2e+137) {
tmp = fma(a, (t + y), (z * (x + y))) / (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(Float64(a + z) - b) tmp = 0.0 if (t_1 <= -2e+132) tmp = t_2; elseif (t_1 <= 2e+137) tmp = Float64(fma(a, Float64(t + y), Float64(z * Float64(x + y))) / 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[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+132], t$95$2, If[LessEqual[t$95$1, 2e+137], N[(N[(a * N[(t + y), $MachinePrecision] + N[(z * N[(x + y), $MachinePrecision]), $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 := \left(a + z\right) - b\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+132}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+137}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t + y, z \cdot \left(x + y\right)\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)) < -1.99999999999999998e132 or 2.0000000000000001e137 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 28.0%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6470.6
Applied rewrites70.6%
if -1.99999999999999998e132 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 2.0000000000000001e137Initial program 99.4%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6429.0
Applied rewrites29.0%
Taylor expanded in y around 0
lower-+.f6432.0
Applied rewrites32.0%
Taylor expanded in b around 0
lower-fma.f64N/A
lift-+.f64N/A
lower-*.f64N/A
lift-+.f6464.3
Applied rewrites64.3%
(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 (- (+ a z) b)))
(if (<= t_1 -1e+60)
t_2
(if (<= t_1 2e+137) (/ (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 = (a + z) - b;
double tmp;
if (t_1 <= -1e+60) {
tmp = t_2;
} else if (t_1 <= 2e+137) {
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(Float64(a + z) - b) tmp = 0.0 if (t_1 <= -1e+60) tmp = t_2; elseif (t_1 <= 2e+137) 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[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+60], t$95$2, If[LessEqual[t$95$1, 2e+137], 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 := \left(a + z\right) - b\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+60}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+137}:\\
\;\;\;\;\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.9999999999999995e59 or 2.0000000000000001e137 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 34.2%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6468.5
Applied rewrites68.5%
if -9.9999999999999995e59 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 2.0000000000000001e137Initial program 99.4%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6463.1
Applied rewrites63.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ a (* x (/ (- z a) t)))))
(if (<= t -8e+186)
t_1
(if (<= t 1.65e+61)
(- (+ a z) b)
(if (<= t 1.22e+156) (+ z (* t (/ (- a z) x))) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a + (x * ((z - a) / t));
double tmp;
if (t <= -8e+186) {
tmp = t_1;
} else if (t <= 1.65e+61) {
tmp = (a + z) - b;
} else if (t <= 1.22e+156) {
tmp = z + (t * ((a - z) / x));
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = a + (x * ((z - a) / t))
if (t <= (-8d+186)) then
tmp = t_1
else if (t <= 1.65d+61) then
tmp = (a + z) - b
else if (t <= 1.22d+156) then
tmp = z + (t * ((a - z) / x))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a + (x * ((z - a) / t));
double tmp;
if (t <= -8e+186) {
tmp = t_1;
} else if (t <= 1.65e+61) {
tmp = (a + z) - b;
} else if (t <= 1.22e+156) {
tmp = z + (t * ((a - z) / x));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = a + (x * ((z - a) / t)) tmp = 0 if t <= -8e+186: tmp = t_1 elif t <= 1.65e+61: tmp = (a + z) - b elif t <= 1.22e+156: tmp = z + (t * ((a - z) / x)) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(a + Float64(x * Float64(Float64(z - a) / t))) tmp = 0.0 if (t <= -8e+186) tmp = t_1; elseif (t <= 1.65e+61) tmp = Float64(Float64(a + z) - b); elseif (t <= 1.22e+156) tmp = Float64(z + Float64(t * Float64(Float64(a - z) / x))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = a + (x * ((z - a) / t)); tmp = 0.0; if (t <= -8e+186) tmp = t_1; elseif (t <= 1.65e+61) tmp = (a + z) - b; elseif (t <= 1.22e+156) tmp = z + (t * ((a - z) / x)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a + N[(x * N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -8e+186], t$95$1, If[LessEqual[t, 1.65e+61], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision], If[LessEqual[t, 1.22e+156], N[(z + N[(t * N[(N[(a - z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a + x \cdot \frac{z - a}{t}\\
\mathbf{if}\;t \leq -8 \cdot 10^{+186}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.65 \cdot 10^{+61}:\\
\;\;\;\;\left(a + z\right) - b\\
\mathbf{elif}\;t \leq 1.22 \cdot 10^{+156}:\\
\;\;\;\;z + t \cdot \frac{a - z}{x}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -7.99999999999999984e186 or 1.21999999999999991e156 < t Initial program 46.6%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6434.8
Applied rewrites34.8%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6464.0
Applied rewrites64.0%
if -7.99999999999999984e186 < t < 1.6499999999999999e61Initial program 65.1%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6459.7
Applied rewrites59.7%
if 1.6499999999999999e61 < t < 1.21999999999999991e156Initial program 58.6%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6442.5
Applied rewrites42.5%
Taylor expanded in t around 0
lower-+.f64N/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6425.8
Applied rewrites25.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ a (* x (/ (- z a) t)))))
(if (<= t -8e+186)
t_1
(if (<= t 2.2e-24) (- (+ a z) b) (if (<= t 7e+158) (+ a z) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a + (x * ((z - a) / t));
double tmp;
if (t <= -8e+186) {
tmp = t_1;
} else if (t <= 2.2e-24) {
tmp = (a + z) - b;
} else if (t <= 7e+158) {
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 = a + (x * ((z - a) / t))
if (t <= (-8d+186)) then
tmp = t_1
else if (t <= 2.2d-24) then
tmp = (a + z) - b
else if (t <= 7d+158) 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 = a + (x * ((z - a) / t));
double tmp;
if (t <= -8e+186) {
tmp = t_1;
} else if (t <= 2.2e-24) {
tmp = (a + z) - b;
} else if (t <= 7e+158) {
tmp = a + z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = a + (x * ((z - a) / t)) tmp = 0 if t <= -8e+186: tmp = t_1 elif t <= 2.2e-24: tmp = (a + z) - b elif t <= 7e+158: tmp = a + z else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(a + Float64(x * Float64(Float64(z - a) / t))) tmp = 0.0 if (t <= -8e+186) tmp = t_1; elseif (t <= 2.2e-24) tmp = Float64(Float64(a + z) - b); elseif (t <= 7e+158) tmp = Float64(a + z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = a + (x * ((z - a) / t)); tmp = 0.0; if (t <= -8e+186) tmp = t_1; elseif (t <= 2.2e-24) tmp = (a + z) - b; elseif (t <= 7e+158) tmp = a + z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a + N[(x * N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -8e+186], t$95$1, If[LessEqual[t, 2.2e-24], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision], If[LessEqual[t, 7e+158], N[(a + z), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a + x \cdot \frac{z - a}{t}\\
\mathbf{if}\;t \leq -8 \cdot 10^{+186}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.2 \cdot 10^{-24}:\\
\;\;\;\;\left(a + z\right) - b\\
\mathbf{elif}\;t \leq 7 \cdot 10^{+158}:\\
\;\;\;\;a + z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -7.99999999999999984e186 or 7.0000000000000003e158 < t Initial program 46.7%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6434.9
Applied rewrites34.9%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6464.1
Applied rewrites64.1%
if -7.99999999999999984e186 < t < 2.20000000000000002e-24Initial program 65.1%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6459.9
Applied rewrites59.9%
if 2.20000000000000002e-24 < t < 7.0000000000000003e158Initial program 61.5%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6454.6
Applied rewrites54.6%
Taylor expanded in b around 0
lift-+.f6451.9
Applied rewrites51.9%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (/ (+ t y) (+ t (+ x y))) a))) (if (<= t -3.8e+187) t_1 (if (<= t 3.45e+124) (- (+ a z) b) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((t + y) / (t + (x + y))) * a;
double tmp;
if (t <= -3.8e+187) {
tmp = t_1;
} else if (t <= 3.45e+124) {
tmp = (a + z) - b;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = ((t + y) / (t + (x + y))) * a
if (t <= (-3.8d+187)) then
tmp = t_1
else if (t <= 3.45d+124) then
tmp = (a + z) - b
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((t + y) / (t + (x + y))) * a;
double tmp;
if (t <= -3.8e+187) {
tmp = t_1;
} else if (t <= 3.45e+124) {
tmp = (a + z) - b;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = ((t + y) / (t + (x + y))) * a tmp = 0 if t <= -3.8e+187: tmp = t_1 elif t <= 3.45e+124: tmp = (a + z) - b else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(t + y) / Float64(t + Float64(x + y))) * a) tmp = 0.0 if (t <= -3.8e+187) tmp = t_1; elseif (t <= 3.45e+124) tmp = Float64(Float64(a + z) - b); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = ((t + y) / (t + (x + y))) * a; tmp = 0.0; if (t <= -3.8e+187) tmp = t_1; elseif (t <= 3.45e+124) tmp = (a + z) - b; 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] / N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[t, -3.8e+187], t$95$1, If[LessEqual[t, 3.45e+124], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t + y}{t + \left(x + y\right)} \cdot a\\
\mathbf{if}\;t \leq -3.8 \cdot 10^{+187}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.45 \cdot 10^{+124}:\\
\;\;\;\;\left(a + z\right) - b\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.8e187 or 3.45e124 < t Initial program 47.6%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites79.3%
Taylor expanded in a around inf
div-add-revN/A
lower-/.f64N/A
lift-+.f64N/A
lower-+.f64N/A
lower-+.f6459.1
Applied rewrites59.1%
if -3.8e187 < t < 3.45e124Initial program 64.8%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6459.3
Applied rewrites59.3%
(FPCore (x y z t a b)
:precision binary64
(if (<= t -3.6e+202)
a
(if (<= t -8.5e-53)
(+ a z)
(if (<= t 4.75e-88) (- z b) (if (<= t 2.8e+155) (+ a z) a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -3.6e+202) {
tmp = a;
} else if (t <= -8.5e-53) {
tmp = a + z;
} else if (t <= 4.75e-88) {
tmp = z - b;
} else if (t <= 2.8e+155) {
tmp = a + z;
} else {
tmp = a;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (t <= (-3.6d+202)) then
tmp = a
else if (t <= (-8.5d-53)) then
tmp = a + z
else if (t <= 4.75d-88) then
tmp = z - b
else if (t <= 2.8d+155) then
tmp = a + z
else
tmp = a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -3.6e+202) {
tmp = a;
} else if (t <= -8.5e-53) {
tmp = a + z;
} else if (t <= 4.75e-88) {
tmp = z - b;
} else if (t <= 2.8e+155) {
tmp = a + z;
} else {
tmp = a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -3.6e+202: tmp = a elif t <= -8.5e-53: tmp = a + z elif t <= 4.75e-88: tmp = z - b elif t <= 2.8e+155: tmp = a + z else: tmp = a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -3.6e+202) tmp = a; elseif (t <= -8.5e-53) tmp = Float64(a + z); elseif (t <= 4.75e-88) tmp = Float64(z - b); elseif (t <= 2.8e+155) tmp = Float64(a + z); else tmp = a; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -3.6e+202) tmp = a; elseif (t <= -8.5e-53) tmp = a + z; elseif (t <= 4.75e-88) tmp = z - b; elseif (t <= 2.8e+155) tmp = a + z; else tmp = a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -3.6e+202], a, If[LessEqual[t, -8.5e-53], N[(a + z), $MachinePrecision], If[LessEqual[t, 4.75e-88], N[(z - b), $MachinePrecision], If[LessEqual[t, 2.8e+155], N[(a + z), $MachinePrecision], a]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.6 \cdot 10^{+202}:\\
\;\;\;\;a\\
\mathbf{elif}\;t \leq -8.5 \cdot 10^{-53}:\\
\;\;\;\;a + z\\
\mathbf{elif}\;t \leq 4.75 \cdot 10^{-88}:\\
\;\;\;\;z - b\\
\mathbf{elif}\;t \leq 2.8 \cdot 10^{+155}:\\
\;\;\;\;a + z\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if t < -3.60000000000000008e202 or 2.80000000000000016e155 < t Initial program 46.4%
Taylor expanded in t around inf
Applied rewrites56.7%
if -3.60000000000000008e202 < t < -8.50000000000000044e-53 or 4.75e-88 < t < 2.80000000000000016e155Initial program 61.9%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6453.3
Applied rewrites53.3%
Taylor expanded in b around 0
lift-+.f6451.0
Applied rewrites51.0%
if -8.50000000000000044e-53 < t < 4.75e-88Initial program 66.9%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6464.4
Applied rewrites64.4%
Taylor expanded in z around inf
Applied rewrites51.7%
(FPCore (x y z t a b) :precision binary64 (if (<= t -1.6e+188) a (if (<= t 2.2e-24) (- (+ a z) b) (if (<= t 2.8e+155) (+ a z) a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -1.6e+188) {
tmp = a;
} else if (t <= 2.2e-24) {
tmp = (a + z) - b;
} else if (t <= 2.8e+155) {
tmp = a + z;
} else {
tmp = a;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (t <= (-1.6d+188)) then
tmp = a
else if (t <= 2.2d-24) then
tmp = (a + z) - b
else if (t <= 2.8d+155) then
tmp = a + z
else
tmp = a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -1.6e+188) {
tmp = a;
} else if (t <= 2.2e-24) {
tmp = (a + z) - b;
} else if (t <= 2.8e+155) {
tmp = a + z;
} else {
tmp = a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -1.6e+188: tmp = a elif t <= 2.2e-24: tmp = (a + z) - b elif t <= 2.8e+155: tmp = a + z else: tmp = a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -1.6e+188) tmp = a; elseif (t <= 2.2e-24) tmp = Float64(Float64(a + z) - b); elseif (t <= 2.8e+155) tmp = Float64(a + z); else tmp = a; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -1.6e+188) tmp = a; elseif (t <= 2.2e-24) tmp = (a + z) - b; elseif (t <= 2.8e+155) tmp = a + z; else tmp = a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -1.6e+188], a, If[LessEqual[t, 2.2e-24], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision], If[LessEqual[t, 2.8e+155], N[(a + z), $MachinePrecision], a]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.6 \cdot 10^{+188}:\\
\;\;\;\;a\\
\mathbf{elif}\;t \leq 2.2 \cdot 10^{-24}:\\
\;\;\;\;\left(a + z\right) - b\\
\mathbf{elif}\;t \leq 2.8 \cdot 10^{+155}:\\
\;\;\;\;a + z\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if t < -1.59999999999999985e188 or 2.80000000000000016e155 < t Initial program 46.7%
Taylor expanded in t around inf
Applied rewrites56.1%
if -1.59999999999999985e188 < t < 2.20000000000000002e-24Initial program 65.1%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6459.9
Applied rewrites59.9%
if 2.20000000000000002e-24 < t < 2.80000000000000016e155Initial program 61.9%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6454.6
Applied rewrites54.6%
Taylor expanded in b around 0
lift-+.f6451.7
Applied rewrites51.7%
(FPCore (x y z t a b) :precision binary64 (if (<= t -3.6e+202) a (if (<= t 2.8e+155) (+ a z) a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -3.6e+202) {
tmp = a;
} else if (t <= 2.8e+155) {
tmp = a + z;
} else {
tmp = a;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (t <= (-3.6d+202)) then
tmp = a
else if (t <= 2.8d+155) then
tmp = a + z
else
tmp = a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -3.6e+202) {
tmp = a;
} else if (t <= 2.8e+155) {
tmp = a + z;
} else {
tmp = a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -3.6e+202: tmp = a elif t <= 2.8e+155: tmp = a + z else: tmp = a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -3.6e+202) tmp = a; elseif (t <= 2.8e+155) tmp = Float64(a + z); else tmp = a; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -3.6e+202) tmp = a; elseif (t <= 2.8e+155) tmp = a + z; else tmp = a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -3.6e+202], a, If[LessEqual[t, 2.8e+155], N[(a + z), $MachinePrecision], a]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.6 \cdot 10^{+202}:\\
\;\;\;\;a\\
\mathbf{elif}\;t \leq 2.8 \cdot 10^{+155}:\\
\;\;\;\;a + z\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if t < -3.60000000000000008e202 or 2.80000000000000016e155 < t Initial program 46.4%
Taylor expanded in t around inf
Applied rewrites56.7%
if -3.60000000000000008e202 < t < 2.80000000000000016e155Initial program 64.3%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6458.6
Applied rewrites58.6%
Taylor expanded in b around 0
lift-+.f6452.5
Applied rewrites52.5%
(FPCore (x y z t a b) :precision binary64 (if (<= x -6e+93) z (if (<= x 1.05e+57) a z)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -6e+93) {
tmp = z;
} else if (x <= 1.05e+57) {
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 <= (-6d+93)) then
tmp = z
else if (x <= 1.05d+57) 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 <= -6e+93) {
tmp = z;
} else if (x <= 1.05e+57) {
tmp = a;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -6e+93: tmp = z elif x <= 1.05e+57: tmp = a else: tmp = z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -6e+93) tmp = z; elseif (x <= 1.05e+57) tmp = a; else tmp = z; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (x <= -6e+93) tmp = z; elseif (x <= 1.05e+57) tmp = a; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -6e+93], z, If[LessEqual[x, 1.05e+57], a, z]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6 \cdot 10^{+93}:\\
\;\;\;\;z\\
\mathbf{elif}\;x \leq 1.05 \cdot 10^{+57}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if x < -5.99999999999999957e93 or 1.04999999999999995e57 < x Initial program 50.3%
Taylor expanded in x around inf
Applied rewrites47.5%
if -5.99999999999999957e93 < x < 1.04999999999999995e57Initial program 66.9%
Taylor expanded in t around inf
Applied rewrites43.0%
(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 60.5%
Taylor expanded in t around inf
Applied rewrites32.8%
(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_3 (/ t_2 t_1))
(t_4 (- (+ z a) b)))
(if (< t_3 -3.5813117084150564e+153)
t_4
(if (< t_3 1.2285964308315609e+82) (/ 1.0 (/ t_1 t_2)) 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);
double t_3 = t_2 / t_1;
double t_4 = (z + a) - b;
double tmp;
if (t_3 < -3.5813117084150564e+153) {
tmp = t_4;
} else if (t_3 < 1.2285964308315609e+82) {
tmp = 1.0 / (t_1 / t_2);
} else {
tmp = t_4;
}
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) :: t_4
real(8) :: tmp
t_1 = (x + t) + y
t_2 = (((x + y) * z) + ((t + y) * a)) - (y * b)
t_3 = t_2 / t_1
t_4 = (z + a) - b
if (t_3 < (-3.5813117084150564d+153)) then
tmp = t_4
else if (t_3 < 1.2285964308315609d+82) then
tmp = 1.0d0 / (t_1 / t_2)
else
tmp = t_4
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);
double t_3 = t_2 / t_1;
double t_4 = (z + a) - b;
double tmp;
if (t_3 < -3.5813117084150564e+153) {
tmp = t_4;
} else if (t_3 < 1.2285964308315609e+82) {
tmp = 1.0 / (t_1 / t_2);
} else {
tmp = t_4;
}
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_3 = t_2 / t_1 t_4 = (z + a) - b tmp = 0 if t_3 < -3.5813117084150564e+153: tmp = t_4 elif t_3 < 1.2285964308315609e+82: tmp = 1.0 / (t_1 / t_2) 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(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) t_3 = Float64(t_2 / t_1) t_4 = Float64(Float64(z + a) - b) tmp = 0.0 if (t_3 < -3.5813117084150564e+153) tmp = t_4; elseif (t_3 < 1.2285964308315609e+82) tmp = Float64(1.0 / Float64(t_1 / t_2)); else tmp = t_4; 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_3 = t_2 / t_1; t_4 = (z + a) - b; tmp = 0.0; if (t_3 < -3.5813117084150564e+153) tmp = t_4; elseif (t_3 < 1.2285964308315609e+82) tmp = 1.0 / (t_1 / t_2); else tmp = t_4; 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[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 / t$95$1), $MachinePrecision]}, Block[{t$95$4 = N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision]}, If[Less[t$95$3, -3.5813117084150564e+153], t$95$4, If[Less[t$95$3, 1.2285964308315609e+82], N[(1.0 / N[(t$95$1 / t$95$2), $MachinePrecision]), $MachinePrecision], t$95$4]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b\\
t_3 := \frac{t\_2}{t\_1}\\
t_4 := \left(z + a\right) - b\\
\mathbf{if}\;t\_3 < -3.5813117084150564 \cdot 10^{+153}:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_3 < 1.2285964308315609 \cdot 10^{+82}:\\
\;\;\;\;\frac{1}{\frac{t\_1}{t\_2}}\\
\mathbf{else}:\\
\;\;\;\;t\_4\\
\end{array}
\end{array}
herbie shell --seed 2025106
(FPCore (x y z t a b)
:name "AI.Clustering.Hierarchical.Internal:ward from clustering-0.2.1"
:precision binary64
:alt
(! :herbie-platform default (if (< (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)) -3581311708415056400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (+ z a) b) (if (< (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)) 12285964308315609000000000000000000000000000000000000000000000000000000000000000000) (/ 1 (/ (+ (+ x t) y) (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)))) (- (+ z a) b))))
(/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))