
(FPCore (x y z t a b) :precision binary64 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
double code(double x, double y, double z, double t, double a, double b) {
return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
}
def code(x, y, z, t, a, b): return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y)) end
function tmp = code(x, y, z, t, a, b) tmp = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}
\end{array}
Herbie found 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 (+ x (+ y t)))
(t_2 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
(t_3 (+ (+ t x) y))
(t_4 (/ (+ t y) t_3))
(t_5 (fma a t_4 (- (* (+ x y) (/ z t_1)) (* b (/ y t_1))))))
(if (<= t_2 -2e+266)
t_5
(if (<= t_2 1e+304) (fma a t_4 (/ (- (* z (+ y x)) (* b y)) t_3)) t_5))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (y + t);
double t_2 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
double t_3 = (t + x) + y;
double t_4 = (t + y) / t_3;
double t_5 = fma(a, t_4, (((x + y) * (z / t_1)) - (b * (y / t_1))));
double tmp;
if (t_2 <= -2e+266) {
tmp = t_5;
} else if (t_2 <= 1e+304) {
tmp = fma(a, t_4, (((z * (y + x)) - (b * y)) / t_3));
} else {
tmp = t_5;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(x + Float64(y + t)) t_2 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y)) t_3 = Float64(Float64(t + x) + y) t_4 = Float64(Float64(t + y) / t_3) t_5 = fma(a, t_4, Float64(Float64(Float64(x + y) * Float64(z / t_1)) - Float64(b * Float64(y / t_1)))) tmp = 0.0 if (t_2 <= -2e+266) tmp = t_5; elseif (t_2 <= 1e+304) tmp = fma(a, t_4, Float64(Float64(Float64(z * Float64(y + x)) - Float64(b * y)) / t_3)); else tmp = t_5; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(y + t), $MachinePrecision]), $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] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(t + x), $MachinePrecision] + y), $MachinePrecision]}, Block[{t$95$4 = N[(N[(t + y), $MachinePrecision] / t$95$3), $MachinePrecision]}, Block[{t$95$5 = N[(a * t$95$4 + N[(N[(N[(x + y), $MachinePrecision] * N[(z / t$95$1), $MachinePrecision]), $MachinePrecision] - N[(b * N[(y / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+266], t$95$5, If[LessEqual[t$95$2, 1e+304], N[(a * t$95$4 + N[(N[(N[(z * N[(y + x), $MachinePrecision]), $MachinePrecision] - N[(b * y), $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision]), $MachinePrecision], t$95$5]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(y + t\right)\\
t_2 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\\
t_3 := \left(t + x\right) + y\\
t_4 := \frac{t + y}{t\_3}\\
t_5 := \mathsf{fma}\left(a, t\_4, \left(x + y\right) \cdot \frac{z}{t\_1} - b \cdot \frac{y}{t\_1}\right)\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+266}:\\
\;\;\;\;t\_5\\
\mathbf{elif}\;t\_2 \leq 10^{+304}:\\
\;\;\;\;\mathsf{fma}\left(a, t\_4, \frac{z \cdot \left(y + x\right) - b \cdot y}{t\_3}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_5\\
\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)) < -2.0000000000000001e266 or 9.9999999999999994e303 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 61.4%
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
div-addN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
sub-flip-reverseN/A
lower-fma.f64N/A
Applied rewrites73.0%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower--.f64N/A
Applied rewrites94.1%
if -2.0000000000000001e266 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 9.9999999999999994e303Initial program 61.4%
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
div-addN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
sub-flip-reverseN/A
lower-fma.f64N/A
Applied rewrites73.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (+ t x) y))
(t_2 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
(t_3 (+ x (+ y t)))
(t_4 (fma a 1.0 (- (* (+ x y) (/ z t_3)) (* b (/ y t_3))))))
(if (<= t_2 -2e+266)
t_4
(if (<= t_2 1e+304)
(fma a (/ (+ t y) t_1) (/ (- (* z (+ y x)) (* b y)) t_1))
t_4))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t + x) + y;
double t_2 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
double t_3 = x + (y + t);
double t_4 = fma(a, 1.0, (((x + y) * (z / t_3)) - (b * (y / t_3))));
double tmp;
if (t_2 <= -2e+266) {
tmp = t_4;
} else if (t_2 <= 1e+304) {
tmp = fma(a, ((t + y) / t_1), (((z * (y + x)) - (b * y)) / t_1));
} else {
tmp = t_4;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t + x) + y) t_2 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y)) t_3 = Float64(x + Float64(y + t)) t_4 = fma(a, 1.0, Float64(Float64(Float64(x + y) * Float64(z / t_3)) - Float64(b * Float64(y / t_3)))) tmp = 0.0 if (t_2 <= -2e+266) tmp = t_4; elseif (t_2 <= 1e+304) tmp = fma(a, Float64(Float64(t + y) / t_1), Float64(Float64(Float64(z * Float64(y + x)) - Float64(b * y)) / t_1)); else tmp = t_4; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t + x), $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] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x + N[(y + t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(a * 1.0 + N[(N[(N[(x + y), $MachinePrecision] * N[(z / t$95$3), $MachinePrecision]), $MachinePrecision] - N[(b * N[(y / t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+266], t$95$4, If[LessEqual[t$95$2, 1e+304], N[(a * N[(N[(t + y), $MachinePrecision] / t$95$1), $MachinePrecision] + N[(N[(N[(z * N[(y + x), $MachinePrecision]), $MachinePrecision] - N[(b * y), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], t$95$4]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t + x\right) + y\\
t_2 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\\
t_3 := x + \left(y + t\right)\\
t_4 := \mathsf{fma}\left(a, 1, \left(x + y\right) \cdot \frac{z}{t\_3} - b \cdot \frac{y}{t\_3}\right)\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+266}:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_2 \leq 10^{+304}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{t + y}{t\_1}, \frac{z \cdot \left(y + x\right) - b \cdot y}{t\_1}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_4\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -2.0000000000000001e266 or 9.9999999999999994e303 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 61.4%
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
div-addN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
sub-flip-reverseN/A
lower-fma.f64N/A
Applied rewrites73.0%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower--.f64N/A
Applied rewrites94.1%
Taylor expanded in x around 0
Applied rewrites80.7%
if -2.0000000000000001e266 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 9.9999999999999994e303Initial program 61.4%
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
div-addN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
sub-flip-reverseN/A
lower-fma.f64N/A
Applied rewrites73.0%
(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 (+ x (+ y t)))
(t_4 (fma a 1.0 (- (* (+ x y) (/ z t_3)) (* b (/ y t_3))))))
(if (<= t_2 -2e+266)
t_4
(if (<= t_2 1e+304)
(/ (fma a t (fma x z (* y (- (+ a z) b)))) t_1)
t_4))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + t) + y;
double t_2 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / t_1;
double t_3 = x + (y + t);
double t_4 = fma(a, 1.0, (((x + y) * (z / t_3)) - (b * (y / t_3))));
double tmp;
if (t_2 <= -2e+266) {
tmp = t_4;
} else if (t_2 <= 1e+304) {
tmp = fma(a, t, fma(x, z, (y * ((a + z) - b)))) / t_1;
} else {
tmp = t_4;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + t) + y) t_2 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / t_1) t_3 = Float64(x + Float64(y + t)) t_4 = fma(a, 1.0, Float64(Float64(Float64(x + y) * Float64(z / t_3)) - Float64(b * Float64(y / t_3)))) tmp = 0.0 if (t_2 <= -2e+266) tmp = t_4; elseif (t_2 <= 1e+304) tmp = Float64(fma(a, t, fma(x, z, Float64(y * Float64(Float64(a + z) - b)))) / t_1); else tmp = t_4; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(x + N[(y + t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(a * 1.0 + N[(N[(N[(x + y), $MachinePrecision] * N[(z / t$95$3), $MachinePrecision]), $MachinePrecision] - N[(b * N[(y / t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+266], t$95$4, If[LessEqual[t$95$2, 1e+304], N[(N[(a * t + N[(x * z + N[(y * N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], t$95$4]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{t\_1}\\
t_3 := x + \left(y + t\right)\\
t_4 := \mathsf{fma}\left(a, 1, \left(x + y\right) \cdot \frac{z}{t\_3} - b \cdot \frac{y}{t\_3}\right)\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+266}:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_2 \leq 10^{+304}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, \mathsf{fma}\left(x, z, y \cdot \left(\left(a + z\right) - b\right)\right)\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;t\_4\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -2.0000000000000001e266 or 9.9999999999999994e303 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 61.4%
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
div-addN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
sub-flip-reverseN/A
lower-fma.f64N/A
Applied rewrites73.0%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower--.f64N/A
Applied rewrites94.1%
Taylor expanded in x around 0
Applied rewrites80.7%
if -2.0000000000000001e266 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 9.9999999999999994e303Initial program 61.4%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6461.7
Applied rewrites61.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (+ x t) y))
(t_2 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) t_1))
(t_3
(fma
a
(/ (+ t y) (+ (+ t x) y))
(- (* (+ x y) (/ z (+ x (+ y t)))) b))))
(if (<= t_2 -2e+266)
t_3
(if (<= t_2 1e+304)
(/ (fma a t (fma x z (* 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(a, ((t + y) / ((t + x) + y)), (((x + y) * (z / (x + (y + t)))) - b));
double tmp;
if (t_2 <= -2e+266) {
tmp = t_3;
} else if (t_2 <= 1e+304) {
tmp = fma(a, t, fma(x, z, (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(a, Float64(Float64(t + y) / Float64(Float64(t + x) + y)), Float64(Float64(Float64(x + y) * Float64(z / Float64(x + Float64(y + t)))) - b)) tmp = 0.0 if (t_2 <= -2e+266) tmp = t_3; elseif (t_2 <= 1e+304) tmp = Float64(fma(a, t, fma(x, z, 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[(a * N[(N[(t + y), $MachinePrecision] / N[(N[(t + x), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(x + y), $MachinePrecision] * N[(z / N[(x + N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+266], t$95$3, If[LessEqual[t$95$2, 1e+304], N[(N[(a * t + N[(x * z + N[(y * N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], t$95$3]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{t\_1}\\
t_3 := \mathsf{fma}\left(a, \frac{t + y}{\left(t + x\right) + y}, \left(x + y\right) \cdot \frac{z}{x + \left(y + t\right)} - b\right)\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+266}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 10^{+304}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, \mathsf{fma}\left(x, z, y \cdot \left(\left(a + z\right) - b\right)\right)\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -2.0000000000000001e266 or 9.9999999999999994e303 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 61.4%
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
div-addN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
sub-flip-reverseN/A
lower-fma.f64N/A
Applied rewrites73.0%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower--.f64N/A
Applied rewrites94.1%
Taylor expanded in y around inf
Applied rewrites68.7%
if -2.0000000000000001e266 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 9.9999999999999994e303Initial program 61.4%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6461.7
Applied rewrites61.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (+ x t) y))
(t_2 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) t_1))
(t_3 (fma a (/ (+ t y) (+ (+ t x) y)) (- z b))))
(if (<= t_2 -2e+266)
t_3
(if (<= t_2 4e+294)
(/ (fma a t (fma x z (* 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(a, ((t + y) / ((t + x) + y)), (z - b));
double tmp;
if (t_2 <= -2e+266) {
tmp = t_3;
} else if (t_2 <= 4e+294) {
tmp = fma(a, t, fma(x, z, (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(a, Float64(Float64(t + y) / Float64(Float64(t + x) + y)), Float64(z - b)) tmp = 0.0 if (t_2 <= -2e+266) tmp = t_3; elseif (t_2 <= 4e+294) tmp = Float64(fma(a, t, fma(x, z, 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[(a * N[(N[(t + y), $MachinePrecision] / N[(N[(t + x), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision] + N[(z - b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+266], t$95$3, If[LessEqual[t$95$2, 4e+294], N[(N[(a * t + N[(x * z + N[(y * N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], t$95$3]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{t\_1}\\
t_3 := \mathsf{fma}\left(a, \frac{t + y}{\left(t + x\right) + y}, z - b\right)\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+266}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+294}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, \mathsf{fma}\left(x, z, y \cdot \left(\left(a + z\right) - b\right)\right)\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -2.0000000000000001e266 or 4.00000000000000027e294 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 61.4%
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
div-addN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
sub-flip-reverseN/A
lower-fma.f64N/A
Applied rewrites73.0%
Taylor expanded in y around inf
lower--.f6462.7
Applied rewrites62.7%
if -2.0000000000000001e266 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 4.00000000000000027e294Initial program 61.4%
Taylor expanded in y around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6461.7
Applied rewrites61.7%
(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 a (/ (+ t y) (+ (+ t x) y)) (- z b))))
(if (<= t_1 -2e+266)
t_2
(if (<= t_1 5e+84) (/ (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(a, ((t + y) / ((t + x) + y)), (z - b));
double tmp;
if (t_1 <= -2e+266) {
tmp = t_2;
} else if (t_1 <= 5e+84) {
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(a, Float64(Float64(t + y) / Float64(Float64(t + x) + y)), Float64(z - b)) tmp = 0.0 if (t_1 <= -2e+266) tmp = t_2; elseif (t_1 <= 5e+84) 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[(a * N[(N[(t + y), $MachinePrecision] / N[(N[(t + x), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision] + N[(z - b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+266], t$95$2, If[LessEqual[t$95$1, 5e+84], 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}
\\
\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(a, \frac{t + y}{\left(t + x\right) + y}, z - b\right)\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+266}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+84}:\\
\;\;\;\;\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}
\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.0000000000000001e266 or 5.0000000000000001e84 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 61.4%
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
div-addN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
sub-flip-reverseN/A
lower-fma.f64N/A
Applied rewrites73.0%
Taylor expanded in y around inf
lower--.f6462.7
Applied rewrites62.7%
if -2.0000000000000001e266 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 5.0000000000000001e84Initial program 61.4%
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-+.f6448.1
Applied rewrites48.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 a (/ (+ t y) (+ (+ t x) y)) (- z b))))
(if (<= t_2 -1e+249)
t_3
(if (<= t_2 -5e-20)
(/ (- (* z (+ x y)) (* b y)) t_1)
(if (<= t_2 -5e-244)
(/ (fma a t (* x z)) (+ t x))
(if (<= t_2 0.05) (/ (- (* a (+ t y)) (* y b)) t_1) t_3))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + t) + y;
double t_2 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / t_1;
double t_3 = fma(a, ((t + y) / ((t + x) + y)), (z - b));
double tmp;
if (t_2 <= -1e+249) {
tmp = t_3;
} else if (t_2 <= -5e-20) {
tmp = ((z * (x + y)) - (b * y)) / t_1;
} else if (t_2 <= -5e-244) {
tmp = fma(a, t, (x * z)) / (t + x);
} else if (t_2 <= 0.05) {
tmp = ((a * (t + y)) - (y * b)) / t_1;
} else {
tmp = t_3;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + t) + y) t_2 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / t_1) t_3 = fma(a, Float64(Float64(t + y) / Float64(Float64(t + x) + y)), Float64(z - b)) tmp = 0.0 if (t_2 <= -1e+249) tmp = t_3; elseif (t_2 <= -5e-20) tmp = Float64(Float64(Float64(z * Float64(x + y)) - Float64(b * y)) / t_1); elseif (t_2 <= -5e-244) tmp = Float64(fma(a, t, Float64(x * z)) / Float64(t + x)); elseif (t_2 <= 0.05) tmp = Float64(Float64(Float64(a * Float64(t + y)) - Float64(y * 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[(a * N[(N[(t + y), $MachinePrecision] / N[(N[(t + x), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision] + N[(z - b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+249], t$95$3, If[LessEqual[t$95$2, -5e-20], N[(N[(N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision] - N[(b * y), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[t$95$2, -5e-244], N[(N[(a * t + N[(x * z), $MachinePrecision]), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.05], N[(N[(N[(a * N[(t + y), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], t$95$3]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{t\_1}\\
t_3 := \mathsf{fma}\left(a, \frac{t + y}{\left(t + x\right) + y}, z - b\right)\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+249}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq -5 \cdot 10^{-20}:\\
\;\;\;\;\frac{z \cdot \left(x + y\right) - b \cdot y}{t\_1}\\
\mathbf{elif}\;t\_2 \leq -5 \cdot 10^{-244}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, x \cdot z\right)}{t + x}\\
\mathbf{elif}\;t\_2 \leq 0.05:\\
\;\;\;\;\frac{a \cdot \left(t + y\right) - y \cdot b}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -9.9999999999999992e248 or 0.050000000000000003 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 61.4%
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
div-addN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
sub-flip-reverseN/A
lower-fma.f64N/A
Applied rewrites73.0%
Taylor expanded in y around inf
lower--.f6462.7
Applied rewrites62.7%
if -9.9999999999999992e248 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -4.9999999999999999e-20Initial program 61.4%
Taylor expanded in a around 0
lower--.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6438.3
Applied rewrites38.3%
if -4.9999999999999999e-20 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -4.99999999999999998e-244Initial program 61.4%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-+.f6440.8
Applied rewrites40.8%
if -4.99999999999999998e-244 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 0.050000000000000003Initial program 61.4%
Taylor expanded in z around 0
lower-*.f64N/A
lower-+.f6438.6
Applied rewrites38.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (+ x t) y))
(t_2 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) t_1))
(t_3 (fma a (/ (+ t y) (+ (+ t x) y)) (- z b))))
(if (<= t_2 -1e+249)
t_3
(if (<= t_2 -5e-20)
(/ (- (* z (+ x y)) (* b y)) t_1)
(if (<= t_2 -5e-244)
(/ (fma a t (* x z)) (+ t x))
(if (<= t_2 0.05) (/ (- (* a t) (* y b)) t_1) t_3))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + t) + y;
double t_2 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / t_1;
double t_3 = fma(a, ((t + y) / ((t + x) + y)), (z - b));
double tmp;
if (t_2 <= -1e+249) {
tmp = t_3;
} else if (t_2 <= -5e-20) {
tmp = ((z * (x + y)) - (b * y)) / t_1;
} else if (t_2 <= -5e-244) {
tmp = fma(a, t, (x * z)) / (t + x);
} else if (t_2 <= 0.05) {
tmp = ((a * t) - (y * b)) / t_1;
} else {
tmp = t_3;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + t) + y) t_2 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / t_1) t_3 = fma(a, Float64(Float64(t + y) / Float64(Float64(t + x) + y)), Float64(z - b)) tmp = 0.0 if (t_2 <= -1e+249) tmp = t_3; elseif (t_2 <= -5e-20) tmp = Float64(Float64(Float64(z * Float64(x + y)) - Float64(b * y)) / t_1); elseif (t_2 <= -5e-244) tmp = Float64(fma(a, t, Float64(x * z)) / Float64(t + x)); elseif (t_2 <= 0.05) tmp = Float64(Float64(Float64(a * t) - Float64(y * 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[(a * N[(N[(t + y), $MachinePrecision] / N[(N[(t + x), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision] + N[(z - b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+249], t$95$3, If[LessEqual[t$95$2, -5e-20], N[(N[(N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision] - N[(b * y), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[t$95$2, -5e-244], N[(N[(a * t + N[(x * z), $MachinePrecision]), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.05], N[(N[(N[(a * t), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], t$95$3]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{t\_1}\\
t_3 := \mathsf{fma}\left(a, \frac{t + y}{\left(t + x\right) + y}, z - b\right)\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+249}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq -5 \cdot 10^{-20}:\\
\;\;\;\;\frac{z \cdot \left(x + y\right) - b \cdot y}{t\_1}\\
\mathbf{elif}\;t\_2 \leq -5 \cdot 10^{-244}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, x \cdot z\right)}{t + x}\\
\mathbf{elif}\;t\_2 \leq 0.05:\\
\;\;\;\;\frac{a \cdot t - y \cdot b}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -9.9999999999999992e248 or 0.050000000000000003 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 61.4%
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
div-addN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
sub-flip-reverseN/A
lower-fma.f64N/A
Applied rewrites73.0%
Taylor expanded in y around inf
lower--.f6462.7
Applied rewrites62.7%
if -9.9999999999999992e248 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -4.9999999999999999e-20Initial program 61.4%
Taylor expanded in a around 0
lower--.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6438.3
Applied rewrites38.3%
if -4.9999999999999999e-20 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -4.99999999999999998e-244Initial program 61.4%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-+.f6440.8
Applied rewrites40.8%
if -4.99999999999999998e-244 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 0.050000000000000003Initial program 61.4%
Taylor expanded in z around 0
lower-*.f64N/A
lower-+.f6438.6
Applied rewrites38.6%
Taylor expanded in y around 0
lower-*.f6430.9
Applied rewrites30.9%
(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 a (/ (+ t y) (+ (+ t x) y)) (- z b))))
(if (<= t_2 -1e+18)
t_3
(if (<= t_2 -1e-36)
(/ (* y (- (+ a z) b)) t_1)
(if (<= t_2 -5e-244)
(/ (fma a t (* x z)) (+ t x))
(if (<= t_2 0.05) (/ (- (* a t) (* y b)) t_1) t_3))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + t) + y;
double t_2 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / t_1;
double t_3 = fma(a, ((t + y) / ((t + x) + y)), (z - b));
double tmp;
if (t_2 <= -1e+18) {
tmp = t_3;
} else if (t_2 <= -1e-36) {
tmp = (y * ((a + z) - b)) / t_1;
} else if (t_2 <= -5e-244) {
tmp = fma(a, t, (x * z)) / (t + x);
} else if (t_2 <= 0.05) {
tmp = ((a * t) - (y * b)) / t_1;
} else {
tmp = t_3;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + t) + y) t_2 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / t_1) t_3 = fma(a, Float64(Float64(t + y) / Float64(Float64(t + x) + y)), Float64(z - b)) tmp = 0.0 if (t_2 <= -1e+18) tmp = t_3; elseif (t_2 <= -1e-36) tmp = Float64(Float64(y * Float64(Float64(a + z) - b)) / t_1); elseif (t_2 <= -5e-244) tmp = Float64(fma(a, t, Float64(x * z)) / Float64(t + x)); elseif (t_2 <= 0.05) tmp = Float64(Float64(Float64(a * t) - Float64(y * 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[(a * N[(N[(t + y), $MachinePrecision] / N[(N[(t + x), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision] + N[(z - b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+18], t$95$3, If[LessEqual[t$95$2, -1e-36], N[(N[(y * N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[t$95$2, -5e-244], N[(N[(a * t + N[(x * z), $MachinePrecision]), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.05], N[(N[(N[(a * t), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], t$95$3]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{t\_1}\\
t_3 := \mathsf{fma}\left(a, \frac{t + y}{\left(t + x\right) + y}, z - b\right)\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+18}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{-36}:\\
\;\;\;\;\frac{y \cdot \left(\left(a + z\right) - b\right)}{t\_1}\\
\mathbf{elif}\;t\_2 \leq -5 \cdot 10^{-244}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, x \cdot z\right)}{t + x}\\
\mathbf{elif}\;t\_2 \leq 0.05:\\
\;\;\;\;\frac{a \cdot t - y \cdot b}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -1e18 or 0.050000000000000003 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 61.4%
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
div-addN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
sub-flip-reverseN/A
lower-fma.f64N/A
Applied rewrites73.0%
Taylor expanded in y around inf
lower--.f6462.7
Applied rewrites62.7%
if -1e18 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -9.9999999999999994e-37Initial program 61.4%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-+.f6431.4
Applied rewrites31.4%
if -9.9999999999999994e-37 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -4.99999999999999998e-244Initial program 61.4%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-+.f6440.8
Applied rewrites40.8%
if -4.99999999999999998e-244 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 0.050000000000000003Initial program 61.4%
Taylor expanded in z around 0
lower-*.f64N/A
lower-+.f6438.6
Applied rewrites38.6%
Taylor expanded in y around 0
lower-*.f6430.9
Applied rewrites30.9%
(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 -2e+145)
t_3
(if (<= t_2 -1e-36)
(/ (* y t_3) t_1)
(if (<= t_2 5e+84) (/ (fma a t (* x z)) (+ t x)) t_3)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + t) + y;
double t_2 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / t_1;
double t_3 = (a + z) - b;
double tmp;
if (t_2 <= -2e+145) {
tmp = t_3;
} else if (t_2 <= -1e-36) {
tmp = (y * t_3) / t_1;
} else if (t_2 <= 5e+84) {
tmp = fma(a, t, (x * z)) / (t + x);
} else {
tmp = t_3;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + t) + y) t_2 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / t_1) t_3 = Float64(Float64(a + z) - b) tmp = 0.0 if (t_2 <= -2e+145) tmp = t_3; elseif (t_2 <= -1e-36) tmp = Float64(Float64(y * t_3) / t_1); elseif (t_2 <= 5e+84) tmp = Float64(fma(a, t, Float64(x * z)) / Float64(t + x)); else tmp = t_3; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+145], t$95$3, If[LessEqual[t$95$2, -1e-36], N[(N[(y * t$95$3), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[t$95$2, 5e+84], N[(N[(a * t + N[(x * z), $MachinePrecision]), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision], t$95$3]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{t\_1}\\
t_3 := \left(a + z\right) - b\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+145}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{-36}:\\
\;\;\;\;\frac{y \cdot t\_3}{t\_1}\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+84}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, x \cdot z\right)}{t + x}\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -2e145 or 5.0000000000000001e84 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 61.4%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6453.9
Applied rewrites53.9%
if -2e145 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -9.9999999999999994e-37Initial program 61.4%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-+.f6431.4
Applied rewrites31.4%
if -9.9999999999999994e-37 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 5.0000000000000001e84Initial program 61.4%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-+.f6440.8
Applied rewrites40.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 (- (+ a z) b)))
(if (<= t_1 -2e+266)
t_2
(if (<= t_1 5e+84) (/ (fma a t (* x z)) (+ t x)) t_2))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
double t_2 = (a + z) - b;
double tmp;
if (t_1 <= -2e+266) {
tmp = t_2;
} else if (t_1 <= 5e+84) {
tmp = fma(a, t, (x * z)) / (t + x);
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y)) t_2 = Float64(Float64(a + z) - b) tmp = 0.0 if (t_1 <= -2e+266) tmp = t_2; elseif (t_1 <= 5e+84) tmp = Float64(fma(a, t, Float64(x * z)) / Float64(t + x)); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+266], t$95$2, If[LessEqual[t$95$1, 5e+84], N[(N[(a * t + N[(x * z), $MachinePrecision]), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\\
t_2 := \left(a + z\right) - b\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+266}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+84}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, x \cdot z\right)}{t + x}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -2.0000000000000001e266 or 5.0000000000000001e84 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 61.4%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6453.9
Applied rewrites53.9%
if -2.0000000000000001e266 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 5.0000000000000001e84Initial program 61.4%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-+.f6440.8
Applied rewrites40.8%
(FPCore (x y z t a b) :precision binary64 (if (<= x -6.5e+202) z (if (<= x 2.6e+131) (- (+ a z) b) z)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -6.5e+202) {
tmp = z;
} else if (x <= 2.6e+131) {
tmp = (a + z) - b;
} else {
tmp = z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (x <= (-6.5d+202)) then
tmp = z
else if (x <= 2.6d+131) then
tmp = (a + z) - b
else
tmp = z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -6.5e+202) {
tmp = z;
} else if (x <= 2.6e+131) {
tmp = (a + z) - b;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -6.5e+202: tmp = z elif x <= 2.6e+131: tmp = (a + z) - b else: tmp = z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -6.5e+202) tmp = z; elseif (x <= 2.6e+131) tmp = Float64(Float64(a + z) - b); else tmp = z; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (x <= -6.5e+202) tmp = z; elseif (x <= 2.6e+131) tmp = (a + z) - b; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -6.5e+202], z, If[LessEqual[x, 2.6e+131], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision], z]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.5 \cdot 10^{+202}:\\
\;\;\;\;z\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{+131}:\\
\;\;\;\;\left(a + z\right) - b\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if x < -6.4999999999999996e202 or 2.6e131 < x Initial program 61.4%
Taylor expanded in x around inf
Applied rewrites32.0%
if -6.4999999999999996e202 < x < 2.6e131Initial program 61.4%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6453.9
Applied rewrites53.9%
(FPCore (x y z t a b) :precision binary64 (if (<= x -1.55e+199) z (if (<= x 3e+126) (- a b) z)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -1.55e+199) {
tmp = z;
} else if (x <= 3e+126) {
tmp = a - b;
} else {
tmp = z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (x <= (-1.55d+199)) then
tmp = z
else if (x <= 3d+126) then
tmp = a - b
else
tmp = z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -1.55e+199) {
tmp = z;
} else if (x <= 3e+126) {
tmp = a - b;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -1.55e+199: tmp = z elif x <= 3e+126: tmp = a - b else: tmp = z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -1.55e+199) tmp = z; elseif (x <= 3e+126) tmp = Float64(a - b); else tmp = z; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (x <= -1.55e+199) tmp = z; elseif (x <= 3e+126) tmp = a - b; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -1.55e+199], z, If[LessEqual[x, 3e+126], N[(a - b), $MachinePrecision], z]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.55 \cdot 10^{+199}:\\
\;\;\;\;z\\
\mathbf{elif}\;x \leq 3 \cdot 10^{+126}:\\
\;\;\;\;a - b\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if x < -1.54999999999999993e199 or 3.0000000000000002e126 < x Initial program 61.4%
Taylor expanded in x around inf
Applied rewrites32.0%
if -1.54999999999999993e199 < x < 3.0000000000000002e126Initial program 61.4%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6453.9
Applied rewrites53.9%
Taylor expanded in z around 0
lower--.f6436.6
Applied rewrites36.6%
(FPCore (x y z t a b) :precision binary64 (if (<= t -1.48e-5) a (if (<= t 5.8e+35) z a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -1.48e-5) {
tmp = a;
} else if (t <= 5.8e+35) {
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 <= (-1.48d-5)) then
tmp = a
else if (t <= 5.8d+35) 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 <= -1.48e-5) {
tmp = a;
} else if (t <= 5.8e+35) {
tmp = z;
} else {
tmp = a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -1.48e-5: tmp = a elif t <= 5.8e+35: tmp = z else: tmp = a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -1.48e-5) tmp = a; elseif (t <= 5.8e+35) tmp = z; else tmp = a; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -1.48e-5) tmp = a; elseif (t <= 5.8e+35) tmp = z; else tmp = a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -1.48e-5], a, If[LessEqual[t, 5.8e+35], z, a]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.48 \cdot 10^{-5}:\\
\;\;\;\;a\\
\mathbf{elif}\;t \leq 5.8 \cdot 10^{+35}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if t < -1.4800000000000001e-5 or 5.79999999999999989e35 < t Initial program 61.4%
Taylor expanded in t around inf
Applied rewrites32.4%
if -1.4800000000000001e-5 < t < 5.79999999999999989e35Initial program 61.4%
Taylor expanded in x around inf
Applied rewrites32.0%
(FPCore (x y z t a b) :precision binary64 a)
double code(double x, double y, double z, double t, double a, double b) {
return a;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = a
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return a;
}
def code(x, y, z, t, a, b): return a
function code(x, y, z, t, a, b) return a end
function tmp = code(x, y, z, t, a, b) tmp = a; end
code[x_, y_, z_, t_, a_, b_] := a
\begin{array}{l}
\\
a
\end{array}
Initial program 61.4%
Taylor expanded in t around inf
Applied rewrites32.4%
herbie shell --seed 2025162
(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)))