
(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]
\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}
Herbie found 15 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]
\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}
(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 (+ (+ t x) y))
(t_3
(fma z (/ (+ y x) t_2) (- (* (+ t y) (/ a t_2)) (* b (/ y t_2))))))
(if (<= t_1 (- INFINITY)) t_3 (if (<= t_1 2e+241) t_1 t_3))))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 = (t + x) + y;
double t_3 = fma(z, ((y + x) / t_2), (((t + y) * (a / t_2)) - (b * (y / t_2))));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = t_3;
} else if (t_1 <= 2e+241) {
tmp = t_1;
} else {
tmp = t_3;
}
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(t + x) + y) t_3 = fma(z, Float64(Float64(y + x) / t_2), Float64(Float64(Float64(t + y) * Float64(a / t_2)) - Float64(b * Float64(y / t_2)))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = t_3; elseif (t_1 <= 2e+241) tmp = t_1; else tmp = t_3; 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[(t + x), $MachinePrecision] + y), $MachinePrecision]}, Block[{t$95$3 = N[(z * N[(N[(y + x), $MachinePrecision] / t$95$2), $MachinePrecision] + N[(N[(N[(t + y), $MachinePrecision] * N[(a / t$95$2), $MachinePrecision]), $MachinePrecision] - N[(b * N[(y / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], t$95$3, If[LessEqual[t$95$1, 2e+241], t$95$1, t$95$3]]]]]
\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(t + x\right) + y\\
t_3 := \mathsf{fma}\left(z, \frac{y + x}{t\_2}, \left(t + y\right) \cdot \frac{a}{t\_2} - b \cdot \frac{y}{t\_2}\right)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+241}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\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.0000000000000001e241 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 59.6%
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
div-addN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
Applied rewrites71.3%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6494.4%
Applied rewrites94.4%
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.0000000000000001e241Initial program 59.6%
(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 (+ (+ t x) y))
(t_3 (fma z (/ (+ y x) t_2) (- a (* b (/ y t_2))))))
(if (<= t_1 -2e+242) t_3 (if (<= t_1 1e+71) t_1 t_3))))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 = (t + x) + y;
double t_3 = fma(z, ((y + x) / t_2), (a - (b * (y / t_2))));
double tmp;
if (t_1 <= -2e+242) {
tmp = t_3;
} else if (t_1 <= 1e+71) {
tmp = t_1;
} else {
tmp = t_3;
}
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(t + x) + y) t_3 = fma(z, Float64(Float64(y + x) / t_2), Float64(a - Float64(b * Float64(y / t_2)))) tmp = 0.0 if (t_1 <= -2e+242) tmp = t_3; elseif (t_1 <= 1e+71) tmp = t_1; else tmp = t_3; 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[(t + x), $MachinePrecision] + y), $MachinePrecision]}, Block[{t$95$3 = N[(z * N[(N[(y + x), $MachinePrecision] / t$95$2), $MachinePrecision] + N[(a - N[(b * N[(y / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+242], t$95$3, If[LessEqual[t$95$1, 1e+71], t$95$1, t$95$3]]]]]
\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(t + x\right) + y\\
t_3 := \mathsf{fma}\left(z, \frac{y + x}{t\_2}, a - b \cdot \frac{y}{t\_2}\right)\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+242}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_1 \leq 10^{+71}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -2.0000000000000001e242 or 1e71 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 59.6%
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
div-addN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
Applied rewrites71.3%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6494.4%
Applied rewrites94.4%
Taylor expanded in x around 0
Applied rewrites84.8%
if -2.0000000000000001e242 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 1e71Initial program 59.6%
(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 (+ (+ t x) y)))
(if (<= t_1 -2e+242)
(fma z (/ (+ y x) t_2) (- a b))
(if (<= t_1 1e+135) t_1 (fma z 1.0 (- a (* b (/ y 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 = (t + x) + y;
double tmp;
if (t_1 <= -2e+242) {
tmp = fma(z, ((y + x) / t_2), (a - b));
} else if (t_1 <= 1e+135) {
tmp = t_1;
} else {
tmp = fma(z, 1.0, (a - (b * (y / 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(t + x) + y) tmp = 0.0 if (t_1 <= -2e+242) tmp = fma(z, Float64(Float64(y + x) / t_2), Float64(a - b)); elseif (t_1 <= 1e+135) tmp = t_1; else tmp = fma(z, 1.0, Float64(a - Float64(b * Float64(y / 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[(t + x), $MachinePrecision] + y), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+242], N[(z * N[(N[(y + x), $MachinePrecision] / t$95$2), $MachinePrecision] + N[(a - b), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+135], t$95$1, N[(z * 1.0 + N[(a - N[(b * N[(y / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\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(t + x\right) + y\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+242}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{y + x}{t\_2}, a - b\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+135}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, 1, a - b \cdot \frac{y}{t\_2}\right)\\
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -2.0000000000000001e242Initial program 59.6%
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
div-addN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
Applied rewrites71.3%
Taylor expanded in y around inf
lower--.f6464.7%
Applied rewrites64.7%
if -2.0000000000000001e242 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 9.9999999999999996e134Initial program 59.6%
if 9.9999999999999996e134 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 59.6%
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
div-addN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
Applied rewrites71.3%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6494.4%
Applied rewrites94.4%
Taylor expanded in x around 0
Applied rewrites84.8%
Taylor expanded in x around inf
Applied rewrites70.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (+ x y) z))
(t_2 (/ (- (+ t_1 (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
(t_3 (+ (+ t x) y))
(t_4 (- a (/ (- (* b y) t_1) t_3))))
(if (<= t_2 (- INFINITY))
(fma z (/ (+ y x) t_3) (- a b))
(if (<= t_2 -2e-16)
t_4
(if (<= t_2 1e-48)
(/ (fma a (+ t y) (* z (+ x y))) (+ t (+ x y)))
(if (<= t_2 1e+135) t_4 (fma z 1.0 (- a (* b (/ y t_3))))))))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + y) * z;
double t_2 = ((t_1 + ((t + y) * a)) - (y * b)) / ((x + t) + y);
double t_3 = (t + x) + y;
double t_4 = a - (((b * y) - t_1) / t_3);
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = fma(z, ((y + x) / t_3), (a - b));
} else if (t_2 <= -2e-16) {
tmp = t_4;
} else if (t_2 <= 1e-48) {
tmp = fma(a, (t + y), (z * (x + y))) / (t + (x + y));
} else if (t_2 <= 1e+135) {
tmp = t_4;
} else {
tmp = fma(z, 1.0, (a - (b * (y / t_3))));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + y) * z) t_2 = Float64(Float64(Float64(t_1 + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y)) t_3 = Float64(Float64(t + x) + y) t_4 = Float64(a - Float64(Float64(Float64(b * y) - t_1) / t_3)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = fma(z, Float64(Float64(y + x) / t_3), Float64(a - b)); elseif (t_2 <= -2e-16) tmp = t_4; elseif (t_2 <= 1e-48) tmp = Float64(fma(a, Float64(t + y), Float64(z * Float64(x + y))) / Float64(t + Float64(x + y))); elseif (t_2 <= 1e+135) tmp = t_4; else tmp = fma(z, 1.0, Float64(a - Float64(b * Float64(y / t_3)))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(t$95$1 + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(t + x), $MachinePrecision] + y), $MachinePrecision]}, Block[{t$95$4 = N[(a - N[(N[(N[(b * y), $MachinePrecision] - t$95$1), $MachinePrecision] / t$95$3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(z * N[(N[(y + x), $MachinePrecision] / t$95$3), $MachinePrecision] + N[(a - b), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -2e-16], t$95$4, If[LessEqual[t$95$2, 1e-48], N[(N[(a * N[(t + y), $MachinePrecision] + N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+135], t$95$4, N[(z * 1.0 + N[(a - N[(b * N[(y / t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
t_1 := \left(x + y\right) \cdot z\\
t_2 := \frac{\left(t\_1 + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\\
t_3 := \left(t + x\right) + y\\
t_4 := a - \frac{b \cdot y - t\_1}{t\_3}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{y + x}{t\_3}, a - b\right)\\
\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-16}:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_2 \leq 10^{-48}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t + y, z \cdot \left(x + y\right)\right)}{t + \left(x + y\right)}\\
\mathbf{elif}\;t\_2 \leq 10^{+135}:\\
\;\;\;\;t\_4\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, 1, a - b \cdot \frac{y}{t\_3}\right)\\
\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.0Initial program 59.6%
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
div-addN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
Applied rewrites71.3%
Taylor expanded in y around inf
lower--.f6464.7%
Applied rewrites64.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)) < -2e-16 or 9.9999999999999997e-49 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 9.9999999999999996e134Initial program 59.6%
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
div-addN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
Applied rewrites71.3%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6494.4%
Applied rewrites94.4%
Taylor expanded in x around 0
Applied rewrites84.8%
lift-fma.f64N/A
+-commutativeN/A
lift--.f64N/A
associate-+l-N/A
lower--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
Applied rewrites59.0%
if -2e-16 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 9.9999999999999997e-49Initial program 59.6%
Taylor expanded in b around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-+.f6446.8%
Applied rewrites46.8%
if 9.9999999999999996e134 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 59.6%
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
div-addN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
Applied rewrites71.3%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6494.4%
Applied rewrites94.4%
Taylor expanded in x around 0
Applied rewrites84.8%
Taylor expanded in x around inf
Applied rewrites70.8%
(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 (fma z 1.0 (- a (* b (/ y (+ (+ t x) y)))))))
(if (<= t_1 -5e+148)
t_2
(if (<= t_1 4e+55) (/ (fma a (+ t y) (* z (+ x y))) (+ t (+ x y))) 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 = fma(z, 1.0, (a - (b * (y / ((t + x) + y)))));
double tmp;
if (t_1 <= -5e+148) {
tmp = t_2;
} else if (t_1 <= 4e+55) {
tmp = fma(a, (t + y), (z * (x + y))) / (t + (x + y));
} 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 = fma(z, 1.0, Float64(a - Float64(b * Float64(y / Float64(Float64(t + x) + y))))) tmp = 0.0 if (t_1 <= -5e+148) tmp = t_2; elseif (t_1 <= 4e+55) tmp = Float64(fma(a, Float64(t + y), Float64(z * Float64(x + y))) / Float64(t + Float64(x + y))); 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 * 1.0 + N[(a - N[(b * N[(y / N[(N[(t + x), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+148], t$95$2, If[LessEqual[t$95$1, 4e+55], N[(N[(a * N[(t + y), $MachinePrecision] + N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\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 := \mathsf{fma}\left(z, 1, a - b \cdot \frac{y}{\left(t + x\right) + y}\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+148}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+55}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t + y, z \cdot \left(x + y\right)\right)}{t + \left(x + y\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -5.0000000000000002e148 or 4e55 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 59.6%
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
div-addN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
Applied rewrites71.3%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6494.4%
Applied rewrites94.4%
Taylor expanded in x around 0
Applied rewrites84.8%
Taylor expanded in x around inf
Applied rewrites70.8%
if -5.0000000000000002e148 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 4e55Initial program 59.6%
Taylor expanded in b around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-+.f6446.8%
Applied rewrites46.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_1))
(t_3 (fma z 1.0 (- a (* b (/ y (+ (+ t x) y)))))))
(if (<= t_2 -1e-12)
t_3
(if (<= t_2 4e-7)
(/ (fma a t (* x z)) (+ t x))
(if (<= t_2 2e+84) (/ (* y (- (+ a 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(z, 1.0, (a - (b * (y / ((t + x) + y)))));
double tmp;
if (t_2 <= -1e-12) {
tmp = t_3;
} else if (t_2 <= 4e-7) {
tmp = fma(a, t, (x * z)) / (t + x);
} else if (t_2 <= 2e+84) {
tmp = (y * ((a + 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 = fma(z, 1.0, Float64(a - Float64(b * Float64(y / Float64(Float64(t + x) + y))))) tmp = 0.0 if (t_2 <= -1e-12) tmp = t_3; elseif (t_2 <= 4e-7) tmp = Float64(fma(a, t, Float64(x * z)) / Float64(t + x)); elseif (t_2 <= 2e+84) tmp = Float64(Float64(y * Float64(Float64(a + 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[(z * 1.0 + N[(a - N[(b * N[(y / N[(N[(t + x), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e-12], t$95$3, If[LessEqual[t$95$2, 4e-7], N[(N[(a * t + N[(x * z), $MachinePrecision]), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+84], N[(N[(y * N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], t$95$3]]]]]]
\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(z, 1, a - b \cdot \frac{y}{\left(t + x\right) + y}\right)\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{-12}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{-7}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, x \cdot z\right)}{t + x}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+84}:\\
\;\;\;\;\frac{y \cdot \left(\left(a + z\right) - b\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\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.9999999999999998e-13 or 2.0000000000000001e84 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 59.6%
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
div-addN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
Applied rewrites71.3%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6494.4%
Applied rewrites94.4%
Taylor expanded in x around 0
Applied rewrites84.8%
Taylor expanded in x around inf
Applied rewrites70.8%
if -9.9999999999999998e-13 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 3.9999999999999998e-7Initial program 59.6%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-+.f6440.2%
Applied rewrites40.2%
if 3.9999999999999998e-7 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 2.0000000000000001e84Initial program 59.6%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-+.f6430.1%
Applied rewrites30.1%
(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 z (/ (+ y x) (+ (+ t x) y)) (- a b))))
(if (<= t_2 -1e-12)
t_3
(if (<= t_2 4e-7)
(/ (fma a t (* x z)) (+ t x))
(if (<= t_2 1e+79) (/ (* y (- (+ a 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(z, ((y + x) / ((t + x) + y)), (a - b));
double tmp;
if (t_2 <= -1e-12) {
tmp = t_3;
} else if (t_2 <= 4e-7) {
tmp = fma(a, t, (x * z)) / (t + x);
} else if (t_2 <= 1e+79) {
tmp = (y * ((a + 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 = fma(z, Float64(Float64(y + x) / Float64(Float64(t + x) + y)), Float64(a - b)) tmp = 0.0 if (t_2 <= -1e-12) tmp = t_3; elseif (t_2 <= 4e-7) tmp = Float64(fma(a, t, Float64(x * z)) / Float64(t + x)); elseif (t_2 <= 1e+79) tmp = Float64(Float64(y * Float64(Float64(a + 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[(z * N[(N[(y + x), $MachinePrecision] / N[(N[(t + x), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision] + N[(a - b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e-12], t$95$3, If[LessEqual[t$95$2, 4e-7], N[(N[(a * t + N[(x * z), $MachinePrecision]), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+79], N[(N[(y * N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], t$95$3]]]]]]
\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(z, \frac{y + x}{\left(t + x\right) + y}, a - b\right)\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{-12}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{-7}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, x \cdot z\right)}{t + x}\\
\mathbf{elif}\;t\_2 \leq 10^{+79}:\\
\;\;\;\;\frac{y \cdot \left(\left(a + z\right) - b\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\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.9999999999999998e-13 or 9.9999999999999997e78 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 59.6%
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
div-addN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
Applied rewrites71.3%
Taylor expanded in y around inf
lower--.f6464.7%
Applied rewrites64.7%
if -9.9999999999999998e-13 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 3.9999999999999998e-7Initial program 59.6%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-+.f6440.2%
Applied rewrites40.2%
if 3.9999999999999998e-7 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 9.9999999999999997e78Initial program 59.6%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-+.f6430.1%
Applied rewrites30.1%
(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 -1000.0)
(fma z (/ x (+ t x)) (- a b))
(if (<= t_2 4e-7)
(/ (fma a t (* x z)) (+ t x))
(if (<= t_2 2e+84) (/ (* y t_3) 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 <= -1000.0) {
tmp = fma(z, (x / (t + x)), (a - b));
} else if (t_2 <= 4e-7) {
tmp = fma(a, t, (x * z)) / (t + x);
} else if (t_2 <= 2e+84) {
tmp = (y * t_3) / 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 <= -1000.0) tmp = fma(z, Float64(x / Float64(t + x)), Float64(a - b)); elseif (t_2 <= 4e-7) tmp = Float64(fma(a, t, Float64(x * z)) / Float64(t + x)); elseif (t_2 <= 2e+84) tmp = Float64(Float64(y * t_3) / 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, -1000.0], N[(z * N[(x / N[(t + x), $MachinePrecision]), $MachinePrecision] + N[(a - b), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 4e-7], N[(N[(a * t + N[(x * z), $MachinePrecision]), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+84], N[(N[(y * t$95$3), $MachinePrecision] / t$95$1), $MachinePrecision], t$95$3]]]]]]
\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 -1000:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{x}{t + x}, a - b\right)\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{-7}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, x \cdot z\right)}{t + x}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+84}:\\
\;\;\;\;\frac{y \cdot t\_3}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -1e3Initial program 59.6%
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
div-addN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
Applied rewrites71.3%
Taylor expanded in y around inf
lower--.f6464.7%
Applied rewrites64.7%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6456.7%
Applied rewrites56.7%
if -1e3 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 3.9999999999999998e-7Initial program 59.6%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-+.f6440.2%
Applied rewrites40.2%
if 3.9999999999999998e-7 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 2.0000000000000001e84Initial program 59.6%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-+.f6430.1%
Applied rewrites30.1%
if 2.0000000000000001e84 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 59.6%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6456.8%
Applied rewrites56.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_1)))
(if (<= t_2 -1000.0)
(fma z (/ x (+ t x)) (- a b))
(if (<= t_2 4e-7)
(/ (fma a t (* x z)) (+ t x))
(if (<= t_2 2e+84) (/ (* y (- z b)) t_1) (- (+ a z) b))))))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 tmp;
if (t_2 <= -1000.0) {
tmp = fma(z, (x / (t + x)), (a - b));
} else if (t_2 <= 4e-7) {
tmp = fma(a, t, (x * z)) / (t + x);
} else if (t_2 <= 2e+84) {
tmp = (y * (z - b)) / t_1;
} else {
tmp = (a + z) - b;
}
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) tmp = 0.0 if (t_2 <= -1000.0) tmp = fma(z, Float64(x / Float64(t + x)), Float64(a - b)); elseif (t_2 <= 4e-7) tmp = Float64(fma(a, t, Float64(x * z)) / Float64(t + x)); elseif (t_2 <= 2e+84) tmp = Float64(Float64(y * Float64(z - b)) / t_1); else tmp = Float64(Float64(a + z) - b); 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]}, If[LessEqual[t$95$2, -1000.0], N[(z * N[(x / N[(t + x), $MachinePrecision]), $MachinePrecision] + N[(a - b), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 4e-7], N[(N[(a * t + N[(x * z), $MachinePrecision]), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+84], N[(N[(y * N[(z - b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]]]]]]
\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}\\
\mathbf{if}\;t\_2 \leq -1000:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{x}{t + x}, a - b\right)\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{-7}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, x \cdot z\right)}{t + x}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+84}:\\
\;\;\;\;\frac{y \cdot \left(z - b\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\left(a + z\right) - b\\
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -1e3Initial program 59.6%
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
div-addN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
Applied rewrites71.3%
Taylor expanded in y around inf
lower--.f6464.7%
Applied rewrites64.7%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6456.7%
Applied rewrites56.7%
if -1e3 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 3.9999999999999998e-7Initial program 59.6%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-+.f6440.2%
Applied rewrites40.2%
if 3.9999999999999998e-7 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 2.0000000000000001e84Initial program 59.6%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-+.f6430.1%
Applied rewrites30.1%
Taylor expanded in a around 0
lower--.f6422.5%
Applied rewrites22.5%
if 2.0000000000000001e84 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 59.6%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6456.8%
Applied rewrites56.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y))))
(if (<= t_1 -1000.0)
(fma z (/ x (+ t x)) (- a b))
(if (<= t_1 1e-5) (/ (fma a t (* x z)) (+ t x)) (- (+ a z) b)))))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 tmp;
if (t_1 <= -1000.0) {
tmp = fma(z, (x / (t + x)), (a - b));
} else if (t_1 <= 1e-5) {
tmp = fma(a, t, (x * z)) / (t + x);
} else {
tmp = (a + z) - b;
}
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)) tmp = 0.0 if (t_1 <= -1000.0) tmp = fma(z, Float64(x / Float64(t + x)), Float64(a - b)); elseif (t_1 <= 1e-5) tmp = Float64(fma(a, t, Float64(x * z)) / Float64(t + x)); else tmp = Float64(Float64(a + z) - b); 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]}, If[LessEqual[t$95$1, -1000.0], N[(z * N[(x / N[(t + x), $MachinePrecision]), $MachinePrecision] + N[(a - b), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e-5], N[(N[(a * t + N[(x * z), $MachinePrecision]), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]]]]
\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}\\
\mathbf{if}\;t\_1 \leq -1000:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{x}{t + x}, a - b\right)\\
\mathbf{elif}\;t\_1 \leq 10^{-5}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, x \cdot z\right)}{t + x}\\
\mathbf{else}:\\
\;\;\;\;\left(a + z\right) - b\\
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -1e3Initial program 59.6%
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
div-addN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
Applied rewrites71.3%
Taylor expanded in y around inf
lower--.f6464.7%
Applied rewrites64.7%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6456.7%
Applied rewrites56.7%
if -1e3 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 1.0000000000000001e-5Initial program 59.6%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-+.f6440.2%
Applied rewrites40.2%
if 1.0000000000000001e-5 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 59.6%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6456.8%
Applied rewrites56.8%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (fma (/ (- z a) t) x a))) (if (<= t -1.06e+155) t_1 (if (<= t 23.5) (- (+ a z) b) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(((z - a) / t), x, a);
double tmp;
if (t <= -1.06e+155) {
tmp = t_1;
} else if (t <= 23.5) {
tmp = (a + z) - b;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(Float64(Float64(z - a) / t), x, a) tmp = 0.0 if (t <= -1.06e+155) tmp = t_1; elseif (t <= 23.5) tmp = Float64(Float64(a + z) - b); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] * x + a), $MachinePrecision]}, If[LessEqual[t, -1.06e+155], t$95$1, If[LessEqual[t, 23.5], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z - a}{t}, x, a\right)\\
\mathbf{if}\;t \leq -1.06 \cdot 10^{+155}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 23.5:\\
\;\;\;\;\left(a + z\right) - b\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if t < -1.06e155 or 23.5 < t Initial program 59.6%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-+.f6440.2%
Applied rewrites40.2%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6429.2%
Applied rewrites29.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6429.2%
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6429.3%
Applied rewrites29.3%
if -1.06e155 < t < 23.5Initial program 59.6%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6456.8%
Applied rewrites56.8%
(FPCore (x y z t a b) :precision binary64 (if (<= t -1.06e+155) a (if (<= t 2.85e+162) (- (+ a z) b) a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -1.06e+155) {
tmp = a;
} else if (t <= 2.85e+162) {
tmp = (a + z) - b;
} 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.06d+155)) then
tmp = a
else if (t <= 2.85d+162) then
tmp = (a + z) - b
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.06e+155) {
tmp = a;
} else if (t <= 2.85e+162) {
tmp = (a + z) - b;
} else {
tmp = a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -1.06e+155: tmp = a elif t <= 2.85e+162: tmp = (a + z) - b else: tmp = a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -1.06e+155) tmp = a; elseif (t <= 2.85e+162) tmp = Float64(Float64(a + z) - b); else tmp = a; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -1.06e+155) tmp = a; elseif (t <= 2.85e+162) tmp = (a + z) - b; else tmp = a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -1.06e+155], a, If[LessEqual[t, 2.85e+162], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision], a]]
\begin{array}{l}
\mathbf{if}\;t \leq -1.06 \cdot 10^{+155}:\\
\;\;\;\;a\\
\mathbf{elif}\;t \leq 2.85 \cdot 10^{+162}:\\
\;\;\;\;\left(a + z\right) - b\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
if t < -1.06e155 or 2.85e162 < t Initial program 59.6%
Taylor expanded in t around inf
Applied rewrites32.7%
if -1.06e155 < t < 2.85e162Initial program 59.6%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6456.8%
Applied rewrites56.8%
(FPCore (x y z t a b) :precision binary64 (if (<= t -1.1e+16) a (if (<= t 0.0038) (- z b) a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -1.1e+16) {
tmp = a;
} else if (t <= 0.0038) {
tmp = z - b;
} 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.1d+16)) then
tmp = a
else if (t <= 0.0038d0) then
tmp = z - b
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.1e+16) {
tmp = a;
} else if (t <= 0.0038) {
tmp = z - b;
} else {
tmp = a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -1.1e+16: tmp = a elif t <= 0.0038: tmp = z - b else: tmp = a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -1.1e+16) tmp = a; elseif (t <= 0.0038) tmp = Float64(z - b); else tmp = a; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -1.1e+16) tmp = a; elseif (t <= 0.0038) tmp = z - b; else tmp = a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -1.1e+16], a, If[LessEqual[t, 0.0038], N[(z - b), $MachinePrecision], a]]
\begin{array}{l}
\mathbf{if}\;t \leq -1.1 \cdot 10^{+16}:\\
\;\;\;\;a\\
\mathbf{elif}\;t \leq 0.0038:\\
\;\;\;\;z - b\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
if t < -1.1e16 or 0.0038 < t Initial program 59.6%
Taylor expanded in t around inf
Applied rewrites32.7%
if -1.1e16 < t < 0.0038Initial program 59.6%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6456.8%
Applied rewrites56.8%
Taylor expanded in a around 0
lower--.f6437.6%
Applied rewrites37.6%
(FPCore (x y z t a b) :precision binary64 (if (<= t -6.1e-41) a (if (<= t 2.7e+34) z a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -6.1e-41) {
tmp = a;
} else if (t <= 2.7e+34) {
tmp = 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 <= (-6.1d-41)) then
tmp = a
else if (t <= 2.7d+34) then
tmp = 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 <= -6.1e-41) {
tmp = a;
} else if (t <= 2.7e+34) {
tmp = z;
} else {
tmp = a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -6.1e-41: tmp = a elif t <= 2.7e+34: tmp = z else: tmp = a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -6.1e-41) tmp = a; elseif (t <= 2.7e+34) tmp = z; else tmp = a; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -6.1e-41) tmp = a; elseif (t <= 2.7e+34) tmp = z; else tmp = a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -6.1e-41], a, If[LessEqual[t, 2.7e+34], z, a]]
\begin{array}{l}
\mathbf{if}\;t \leq -6.1 \cdot 10^{-41}:\\
\;\;\;\;a\\
\mathbf{elif}\;t \leq 2.7 \cdot 10^{+34}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
if t < -6.0999999999999999e-41 or 2.7e34 < t Initial program 59.6%
Taylor expanded in t around inf
Applied rewrites32.7%
if -6.0999999999999999e-41 < t < 2.7e34Initial program 59.6%
Taylor expanded in x around inf
Applied rewrites32.2%
(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
a
Initial program 59.6%
Taylor expanded in t around inf
Applied rewrites32.7%
herbie shell --seed 2025189
(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)))