
(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}
Sampling outcomes in binary64 precision:
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]
\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 (+ y x)))
(t_2 (fma t_1 a z))
(t_3 (+ (+ x t) y))
(t_4 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) t_3)))
(if (or (<= t_4 (- INFINITY)) (not (<= t_4 5e+227)))
(- (fma (- (/ (fma t_1 b a) (+ y x)) (/ t_2 (+ y x))) t t_2) (* t_1 b))
(/ (fma (- (+ a z) b) y (fma a t (* z x))) t_3))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = y / (y + x);
double t_2 = fma(t_1, a, z);
double t_3 = (x + t) + y;
double t_4 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / t_3;
double tmp;
if ((t_4 <= -((double) INFINITY)) || !(t_4 <= 5e+227)) {
tmp = fma(((fma(t_1, b, a) / (y + x)) - (t_2 / (y + x))), t, t_2) - (t_1 * b);
} else {
tmp = fma(((a + z) - b), y, fma(a, t, (z * x))) / t_3;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(y / Float64(y + x)) t_2 = fma(t_1, a, z) t_3 = Float64(Float64(x + t) + y) t_4 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / t_3) tmp = 0.0 if ((t_4 <= Float64(-Inf)) || !(t_4 <= 5e+227)) tmp = Float64(fma(Float64(Float64(fma(t_1, b, a) / Float64(y + x)) - Float64(t_2 / Float64(y + x))), t, t_2) - Float64(t_1 * b)); else tmp = Float64(fma(Float64(Float64(a + z) - b), y, fma(a, t, Float64(z * x))) / t_3); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * a + z), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]}, Block[{t$95$4 = 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$3), $MachinePrecision]}, If[Or[LessEqual[t$95$4, (-Infinity)], N[Not[LessEqual[t$95$4, 5e+227]], $MachinePrecision]], N[(N[(N[(N[(N[(t$95$1 * b + a), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision] - N[(t$95$2 / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t + t$95$2), $MachinePrecision] - N[(t$95$1 * b), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision] * y + N[(a * t + N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{y + x}\\
t_2 := \mathsf{fma}\left(t\_1, a, z\right)\\
t_3 := \left(x + t\right) + y\\
t_4 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{t\_3}\\
\mathbf{if}\;t\_4 \leq -\infty \lor \neg \left(t\_4 \leq 5 \cdot 10^{+227}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{\mathsf{fma}\left(t\_1, b, a\right)}{y + x} - \frac{t\_2}{y + x}, t, t\_2\right) - t\_1 \cdot b\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(a + z\right) - b, y, \mathsf{fma}\left(a, t, z \cdot x\right)\right)}{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 4.9999999999999996e227 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 6.9%
Taylor expanded in t around 0
lower--.f64N/A
Applied rewrites86.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)) < 4.9999999999999996e227Initial program 99.7%
Taylor expanded in y around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6499.7
Applied rewrites99.7%
Final simplification94.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)))
(if (or (<= t_2 (- INFINITY)) (not (<= t_2 2e+274)))
(- (+ z a) (* (/ y (+ y x)) b))
(/ (fma (- (+ a z) b) y (fma a t (* z x))) t_1))))
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 <= -((double) INFINITY)) || !(t_2 <= 2e+274)) {
tmp = (z + a) - ((y / (y + x)) * b);
} else {
tmp = fma(((a + z) - b), y, fma(a, t, (z * x))) / t_1;
}
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 <= Float64(-Inf)) || !(t_2 <= 2e+274)) tmp = Float64(Float64(z + a) - Float64(Float64(y / Float64(y + x)) * b)); else tmp = Float64(fma(Float64(Float64(a + z) - b), y, fma(a, t, Float64(z * x))) / t_1); 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[Or[LessEqual[t$95$2, (-Infinity)], N[Not[LessEqual[t$95$2, 2e+274]], $MachinePrecision]], N[(N[(z + a), $MachinePrecision] - N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision] * y + N[(a * t + N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]]]]
\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}\\
\mathbf{if}\;t\_2 \leq -\infty \lor \neg \left(t\_2 \leq 2 \cdot 10^{+274}\right):\\
\;\;\;\;\left(z + a\right) - \frac{y}{y + x} \cdot b\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(a + z\right) - b, y, \mathsf{fma}\left(a, t, z \cdot x\right)\right)}{t\_1}\\
\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 1.99999999999999984e274 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 5.1%
Taylor expanded in t around 0
lower--.f64N/A
Applied rewrites86.1%
Taylor expanded in y around inf
Applied rewrites79.0%
if -inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 1.99999999999999984e274Initial program 99.7%
Taylor expanded in y around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6499.7
Applied rewrites99.7%
Final simplification91.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (+ t y) a))
(t_2 (/ (- (+ (* (+ x y) z) t_1) (* y b)) (+ (+ x t) y))))
(if (or (<= t_2 -5e+70) (not (<= t_2 5e+227)))
(- (+ z a) (* (/ y (+ y x)) b))
(/ (fma (+ y x) z t_1) (+ (+ y x) t)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t + y) * a;
double t_2 = ((((x + y) * z) + t_1) - (y * b)) / ((x + t) + y);
double tmp;
if ((t_2 <= -5e+70) || !(t_2 <= 5e+227)) {
tmp = (z + a) - ((y / (y + x)) * b);
} else {
tmp = fma((y + x), z, t_1) / ((y + x) + t);
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t + y) * a) t_2 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + t_1) - Float64(y * b)) / Float64(Float64(x + t) + y)) tmp = 0.0 if ((t_2 <= -5e+70) || !(t_2 <= 5e+227)) tmp = Float64(Float64(z + a) - Float64(Float64(y / Float64(y + x)) * b)); else tmp = Float64(fma(Float64(y + x), z, t_1) / Float64(Float64(y + x) + t)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + t$95$1), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$2, -5e+70], N[Not[LessEqual[t$95$2, 5e+227]], $MachinePrecision]], N[(N[(z + a), $MachinePrecision] - N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y + x), $MachinePrecision] * z + t$95$1), $MachinePrecision] / N[(N[(y + x), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t + y\right) \cdot a\\
t_2 := \frac{\left(\left(x + y\right) \cdot z + t\_1\right) - y \cdot b}{\left(x + t\right) + y}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+70} \lor \neg \left(t\_2 \leq 5 \cdot 10^{+227}\right):\\
\;\;\;\;\left(z + a\right) - \frac{y}{y + x} \cdot b\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y + x, z, t\_1\right)}{\left(y + x\right) + t}\\
\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)) < -5.0000000000000002e70 or 4.9999999999999996e227 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 24.3%
Taylor expanded in t around 0
lower--.f64N/A
Applied rewrites80.1%
Taylor expanded in y around inf
Applied rewrites79.3%
if -5.0000000000000002e70 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 4.9999999999999996e227Initial program 99.7%
Taylor expanded in b around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6478.8
Applied rewrites78.8%
Final simplification79.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y))))
(if (or (<= t_1 -2e+22) (not (<= t_1 1000000.0)))
(- (+ a z) b)
(/ (* a t) (+ t x)))))
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 <= -2e+22) || !(t_1 <= 1000000.0)) {
tmp = (a + z) - b;
} else {
tmp = (a * t) / (t + x);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
if ((t_1 <= (-2d+22)) .or. (.not. (t_1 <= 1000000.0d0))) then
tmp = (a + z) - b
else
tmp = (a * t) / (t + x)
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 + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
double tmp;
if ((t_1 <= -2e+22) || !(t_1 <= 1000000.0)) {
tmp = (a + z) - b;
} else {
tmp = (a * t) / (t + x);
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y) tmp = 0 if (t_1 <= -2e+22) or not (t_1 <= 1000000.0): tmp = (a + z) - b else: tmp = (a * t) / (t + x) 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 <= -2e+22) || !(t_1 <= 1000000.0)) tmp = Float64(Float64(a + z) - b); else tmp = Float64(Float64(a * t) / Float64(t + x)); 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); tmp = 0.0; if ((t_1 <= -2e+22) || ~((t_1 <= 1000000.0))) tmp = (a + z) - b; else tmp = (a * t) / (t + x); 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]}, If[Or[LessEqual[t$95$1, -2e+22], N[Not[LessEqual[t$95$1, 1000000.0]], $MachinePrecision]], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision], N[(N[(a * t), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision]]]
\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}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+22} \lor \neg \left(t\_1 \leq 1000000\right):\\
\;\;\;\;\left(a + z\right) - b\\
\mathbf{else}:\\
\;\;\;\;\frac{a \cdot t}{t + x}\\
\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)) < -2e22 or 1e6 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 45.2%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6464.3
Applied rewrites64.3%
if -2e22 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 1e6Initial program 99.7%
Taylor expanded in t around 0
lower--.f64N/A
Applied rewrites49.6%
Taylor expanded in y around 0
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6463.7
Applied rewrites63.7%
Taylor expanded in x around 0
Applied rewrites49.4%
Final simplification60.1%
(FPCore (x y z t a b) :precision binary64 (if (or (<= x -3.75e+124) (not (<= x 2.4e+118))) (- z (* (/ (- b a) x) y)) (fma (- z b) (/ y (+ t y)) a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x <= -3.75e+124) || !(x <= 2.4e+118)) {
tmp = z - (((b - a) / x) * y);
} else {
tmp = fma((z - b), (y / (t + y)), a);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((x <= -3.75e+124) || !(x <= 2.4e+118)) tmp = Float64(z - Float64(Float64(Float64(b - a) / x) * y)); else tmp = fma(Float64(z - b), Float64(y / Float64(t + y)), a); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[x, -3.75e+124], N[Not[LessEqual[x, 2.4e+118]], $MachinePrecision]], N[(z - N[(N[(N[(b - a), $MachinePrecision] / x), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[(N[(z - b), $MachinePrecision] * N[(y / N[(t + y), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.75 \cdot 10^{+124} \lor \neg \left(x \leq 2.4 \cdot 10^{+118}\right):\\
\;\;\;\;z - \frac{b - a}{x} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z - b, \frac{y}{t + y}, a\right)\\
\end{array}
\end{array}
if x < -3.75000000000000019e124 or 2.4e118 < x Initial program 41.9%
Taylor expanded in x around -inf
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lower-/.f64N/A
Applied rewrites62.8%
Taylor expanded in y around inf
Applied rewrites72.1%
if -3.75000000000000019e124 < x < 2.4e118Initial program 67.8%
Taylor expanded in x around 0
lower-/.f64N/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
*-commutativeN/A
distribute-lft-out--N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6450.6
Applied rewrites50.6%
Taylor expanded in a around 0
Applied rewrites79.1%
Applied rewrites81.6%
Final simplification78.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= x -3.75e+124) (not (<= x 2.4e+118))) (- z (* (/ (- b a) x) y)) (fma y (/ (- z b) (+ t y)) a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x <= -3.75e+124) || !(x <= 2.4e+118)) {
tmp = z - (((b - a) / x) * y);
} else {
tmp = fma(y, ((z - b) / (t + y)), a);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((x <= -3.75e+124) || !(x <= 2.4e+118)) tmp = Float64(z - Float64(Float64(Float64(b - a) / x) * y)); else tmp = fma(y, Float64(Float64(z - b) / Float64(t + y)), a); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[x, -3.75e+124], N[Not[LessEqual[x, 2.4e+118]], $MachinePrecision]], N[(z - N[(N[(N[(b - a), $MachinePrecision] / x), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(z - b), $MachinePrecision] / N[(t + y), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.75 \cdot 10^{+124} \lor \neg \left(x \leq 2.4 \cdot 10^{+118}\right):\\
\;\;\;\;z - \frac{b - a}{x} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z - b}{t + y}, a\right)\\
\end{array}
\end{array}
if x < -3.75000000000000019e124 or 2.4e118 < x Initial program 41.9%
Taylor expanded in x around -inf
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lower-/.f64N/A
Applied rewrites62.8%
Taylor expanded in y around inf
Applied rewrites72.1%
if -3.75000000000000019e124 < x < 2.4e118Initial program 67.8%
Taylor expanded in x around 0
lower-/.f64N/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
*-commutativeN/A
distribute-lft-out--N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6450.6
Applied rewrites50.6%
Taylor expanded in a around 0
Applied rewrites79.1%
Final simplification77.2%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -2.8e+49) (not (<= t 2.5e+55))) (fma y (/ z (+ t y)) a) (- (+ a z) b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -2.8e+49) || !(t <= 2.5e+55)) {
tmp = fma(y, (z / (t + y)), a);
} else {
tmp = (a + z) - b;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -2.8e+49) || !(t <= 2.5e+55)) tmp = fma(y, Float64(z / Float64(t + y)), a); else tmp = Float64(Float64(a + z) - b); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -2.8e+49], N[Not[LessEqual[t, 2.5e+55]], $MachinePrecision]], N[(y * N[(z / N[(t + y), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.8 \cdot 10^{+49} \lor \neg \left(t \leq 2.5 \cdot 10^{+55}\right):\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{t + y}, a\right)\\
\mathbf{else}:\\
\;\;\;\;\left(a + z\right) - b\\
\end{array}
\end{array}
if t < -2.7999999999999998e49 or 2.50000000000000023e55 < t Initial program 60.8%
Taylor expanded in x around 0
lower-/.f64N/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
*-commutativeN/A
distribute-lft-out--N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6451.9
Applied rewrites51.9%
Taylor expanded in a around 0
Applied rewrites82.0%
Taylor expanded in z around inf
Applied rewrites69.7%
if -2.7999999999999998e49 < t < 2.50000000000000023e55Initial program 60.4%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6461.1
Applied rewrites61.1%
Final simplification64.5%
(FPCore (x y z t a b) :precision binary64 (if (<= t -2.8e+49) (fma y (/ z (+ t y)) a) (if (<= t 2.5e+55) (- (+ a z) b) (fma (/ (- z b) t) y a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -2.8e+49) {
tmp = fma(y, (z / (t + y)), a);
} else if (t <= 2.5e+55) {
tmp = (a + z) - b;
} else {
tmp = fma(((z - b) / t), y, a);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -2.8e+49) tmp = fma(y, Float64(z / Float64(t + y)), a); elseif (t <= 2.5e+55) tmp = Float64(Float64(a + z) - b); else tmp = fma(Float64(Float64(z - b) / t), y, a); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -2.8e+49], N[(y * N[(z / N[(t + y), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision], If[LessEqual[t, 2.5e+55], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision], N[(N[(N[(z - b), $MachinePrecision] / t), $MachinePrecision] * y + a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.8 \cdot 10^{+49}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{t + y}, a\right)\\
\mathbf{elif}\;t \leq 2.5 \cdot 10^{+55}:\\
\;\;\;\;\left(a + z\right) - b\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - b}{t}, y, a\right)\\
\end{array}
\end{array}
if t < -2.7999999999999998e49Initial program 68.8%
Taylor expanded in x around 0
lower-/.f64N/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
*-commutativeN/A
distribute-lft-out--N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6462.7
Applied rewrites62.7%
Taylor expanded in a around 0
Applied rewrites91.4%
Taylor expanded in z around inf
Applied rewrites79.3%
if -2.7999999999999998e49 < t < 2.50000000000000023e55Initial program 60.4%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6461.1
Applied rewrites61.1%
if 2.50000000000000023e55 < t Initial program 54.1%
Taylor expanded in x around 0
lower-/.f64N/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
*-commutativeN/A
distribute-lft-out--N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6442.9
Applied rewrites42.9%
Taylor expanded in y around 0
Applied rewrites64.7%
(FPCore (x y z t a b) :precision binary64 (if (<= t -2.8e+49) (fma y (/ z (+ t y)) a) (if (<= t 2.5e+55) (- (+ a z) b) (fma (- z b) (/ y t) a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -2.8e+49) {
tmp = fma(y, (z / (t + y)), a);
} else if (t <= 2.5e+55) {
tmp = (a + z) - b;
} else {
tmp = fma((z - b), (y / t), a);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -2.8e+49) tmp = fma(y, Float64(z / Float64(t + y)), a); elseif (t <= 2.5e+55) tmp = Float64(Float64(a + z) - b); else tmp = fma(Float64(z - b), Float64(y / t), a); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -2.8e+49], N[(y * N[(z / N[(t + y), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision], If[LessEqual[t, 2.5e+55], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision], N[(N[(z - b), $MachinePrecision] * N[(y / t), $MachinePrecision] + a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.8 \cdot 10^{+49}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{t + y}, a\right)\\
\mathbf{elif}\;t \leq 2.5 \cdot 10^{+55}:\\
\;\;\;\;\left(a + z\right) - b\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z - b, \frac{y}{t}, a\right)\\
\end{array}
\end{array}
if t < -2.7999999999999998e49Initial program 68.8%
Taylor expanded in x around 0
lower-/.f64N/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
*-commutativeN/A
distribute-lft-out--N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6462.7
Applied rewrites62.7%
Taylor expanded in a around 0
Applied rewrites91.4%
Taylor expanded in z around inf
Applied rewrites79.3%
if -2.7999999999999998e49 < t < 2.50000000000000023e55Initial program 60.4%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6461.1
Applied rewrites61.1%
if 2.50000000000000023e55 < t Initial program 54.1%
Taylor expanded in x around 0
lower-/.f64N/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
*-commutativeN/A
distribute-lft-out--N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6442.9
Applied rewrites42.9%
Taylor expanded in a around 0
Applied rewrites74.1%
Applied rewrites75.9%
Taylor expanded in y around 0
Applied rewrites64.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -1.25e+117) (not (<= t 9.5e+52))) (* a (/ t (+ t x))) (- (+ a z) b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -1.25e+117) || !(t <= 9.5e+52)) {
tmp = a * (t / (t + x));
} else {
tmp = (a + z) - b;
}
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.25d+117)) .or. (.not. (t <= 9.5d+52))) then
tmp = a * (t / (t + x))
else
tmp = (a + z) - b
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.25e+117) || !(t <= 9.5e+52)) {
tmp = a * (t / (t + x));
} else {
tmp = (a + z) - b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -1.25e+117) or not (t <= 9.5e+52): tmp = a * (t / (t + x)) else: tmp = (a + z) - b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -1.25e+117) || !(t <= 9.5e+52)) tmp = Float64(a * Float64(t / Float64(t + x))); else tmp = Float64(Float64(a + z) - b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((t <= -1.25e+117) || ~((t <= 9.5e+52))) tmp = a * (t / (t + x)); else tmp = (a + z) - b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -1.25e+117], N[Not[LessEqual[t, 9.5e+52]], $MachinePrecision]], N[(a * N[(t / N[(t + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.25 \cdot 10^{+117} \lor \neg \left(t \leq 9.5 \cdot 10^{+52}\right):\\
\;\;\;\;a \cdot \frac{t}{t + x}\\
\mathbf{else}:\\
\;\;\;\;\left(a + z\right) - b\\
\end{array}
\end{array}
if t < -1.24999999999999996e117 or 9.49999999999999994e52 < t Initial program 58.7%
Taylor expanded in a around inf
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6446.1
Applied rewrites46.1%
Taylor expanded in y around 0
Applied rewrites58.3%
if -1.24999999999999996e117 < t < 9.49999999999999994e52Initial program 61.5%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6460.9
Applied rewrites60.9%
Final simplification60.0%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -235.0) (not (<= y 2.7e+44))) (- (+ a z) b) (+ a z)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -235.0) || !(y <= 2.7e+44)) {
tmp = (a + z) - b;
} else {
tmp = a + z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((y <= (-235.0d0)) .or. (.not. (y <= 2.7d+44))) then
tmp = (a + z) - b
else
tmp = a + z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -235.0) || !(y <= 2.7e+44)) {
tmp = (a + z) - b;
} else {
tmp = a + z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -235.0) or not (y <= 2.7e+44): tmp = (a + z) - b else: tmp = a + z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -235.0) || !(y <= 2.7e+44)) tmp = Float64(Float64(a + z) - b); else tmp = Float64(a + z); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -235.0) || ~((y <= 2.7e+44))) tmp = (a + z) - b; else tmp = a + z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -235.0], N[Not[LessEqual[y, 2.7e+44]], $MachinePrecision]], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision], N[(a + z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -235 \lor \neg \left(y \leq 2.7 \cdot 10^{+44}\right):\\
\;\;\;\;\left(a + z\right) - b\\
\mathbf{else}:\\
\;\;\;\;a + z\\
\end{array}
\end{array}
if y < -235 or 2.7e44 < y Initial program 38.9%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6476.5
Applied rewrites76.5%
if -235 < y < 2.7e44Initial program 81.5%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6432.5
Applied rewrites32.5%
Taylor expanded in b around inf
Applied rewrites6.1%
Taylor expanded in b around 0
Applied rewrites41.3%
Final simplification58.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -5.6e-82) (not (<= z 1.7e-59))) (+ a z) (- a b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -5.6e-82) || !(z <= 1.7e-59)) {
tmp = a + z;
} else {
tmp = a - b;
}
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 ((z <= (-5.6d-82)) .or. (.not. (z <= 1.7d-59))) then
tmp = a + z
else
tmp = a - b
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 ((z <= -5.6e-82) || !(z <= 1.7e-59)) {
tmp = a + z;
} else {
tmp = a - b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -5.6e-82) or not (z <= 1.7e-59): tmp = a + z else: tmp = a - b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -5.6e-82) || !(z <= 1.7e-59)) tmp = Float64(a + z); else tmp = Float64(a - b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -5.6e-82) || ~((z <= 1.7e-59))) tmp = a + z; else tmp = a - b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -5.6e-82], N[Not[LessEqual[z, 1.7e-59]], $MachinePrecision]], N[(a + z), $MachinePrecision], N[(a - b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.6 \cdot 10^{-82} \lor \neg \left(z \leq 1.7 \cdot 10^{-59}\right):\\
\;\;\;\;a + z\\
\mathbf{else}:\\
\;\;\;\;a - b\\
\end{array}
\end{array}
if z < -5.60000000000000049e-82 or 1.70000000000000009e-59 < z Initial program 49.4%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6456.4
Applied rewrites56.4%
Taylor expanded in b around inf
Applied rewrites8.6%
Taylor expanded in b around 0
Applied rewrites56.2%
if -5.60000000000000049e-82 < z < 1.70000000000000009e-59Initial program 77.6%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6450.8
Applied rewrites50.8%
Taylor expanded in z around 0
Applied rewrites51.4%
Final simplification54.3%
(FPCore (x y z t a b) :precision binary64 (if (<= z -3.5e+20) (- z b) (if (<= z 1.7e-59) (- a b) (+ a z))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -3.5e+20) {
tmp = z - b;
} else if (z <= 1.7e-59) {
tmp = a - b;
} else {
tmp = a + z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (z <= (-3.5d+20)) then
tmp = z - b
else if (z <= 1.7d-59) then
tmp = a - b
else
tmp = a + z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -3.5e+20) {
tmp = z - b;
} else if (z <= 1.7e-59) {
tmp = a - b;
} else {
tmp = a + z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -3.5e+20: tmp = z - b elif z <= 1.7e-59: tmp = a - b else: tmp = a + z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -3.5e+20) tmp = Float64(z - b); elseif (z <= 1.7e-59) tmp = Float64(a - b); else tmp = Float64(a + z); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -3.5e+20) tmp = z - b; elseif (z <= 1.7e-59) tmp = a - b; else tmp = a + z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -3.5e+20], N[(z - b), $MachinePrecision], If[LessEqual[z, 1.7e-59], N[(a - b), $MachinePrecision], N[(a + z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{+20}:\\
\;\;\;\;z - b\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{-59}:\\
\;\;\;\;a - b\\
\mathbf{else}:\\
\;\;\;\;a + z\\
\end{array}
\end{array}
if z < -3.5e20Initial program 43.7%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6461.2
Applied rewrites61.2%
Taylor expanded in a around 0
Applied rewrites56.9%
if -3.5e20 < z < 1.70000000000000009e-59Initial program 76.2%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6449.5
Applied rewrites49.5%
Taylor expanded in z around 0
Applied rewrites49.5%
if 1.70000000000000009e-59 < z Initial program 49.9%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6455.6
Applied rewrites55.6%
Taylor expanded in b around inf
Applied rewrites7.1%
Taylor expanded in b around 0
Applied rewrites60.5%
(FPCore (x y z t a b) :precision binary64 (if (<= b 7e+210) (+ a z) (- b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= 7e+210) {
tmp = a + z;
} else {
tmp = -b;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (b <= 7d+210) then
tmp = a + z
else
tmp = -b
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= 7e+210) {
tmp = a + z;
} else {
tmp = -b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if b <= 7e+210: tmp = a + z else: tmp = -b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= 7e+210) tmp = Float64(a + z); else tmp = Float64(-b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (b <= 7e+210) tmp = a + z; else tmp = -b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, 7e+210], N[(a + z), $MachinePrecision], (-b)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 7 \cdot 10^{+210}:\\
\;\;\;\;a + z\\
\mathbf{else}:\\
\;\;\;\;-b\\
\end{array}
\end{array}
if b < 6.9999999999999999e210Initial program 61.2%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6455.5
Applied rewrites55.5%
Taylor expanded in b around inf
Applied rewrites11.5%
Taylor expanded in b around 0
Applied rewrites53.0%
if 6.9999999999999999e210 < b Initial program 53.9%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6440.4
Applied rewrites40.4%
Taylor expanded in b around inf
Applied rewrites35.7%
(FPCore (x y z t a b) :precision binary64 (- b))
double code(double x, double y, double z, double t, double a, double b) {
return -b;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = -b
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return -b;
}
def code(x, y, z, t, a, b): return -b
function code(x, y, z, t, a, b) return Float64(-b) end
function tmp = code(x, y, z, t, a, b) tmp = -b; end
code[x_, y_, z_, t_, a_, b_] := (-b)
\begin{array}{l}
\\
-b
\end{array}
Initial program 60.5%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6454.2
Applied rewrites54.2%
Taylor expanded in b around inf
Applied rewrites13.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_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 2024352
(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)))