
(FPCore (x y z t a b) :precision binary64 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
double code(double x, double y, double z, double t, double a, double b) {
return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
}
def code(x, y, z, t, a, b): return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y)) end
function tmp = code(x, y, z, t, a, b) tmp = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]
\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
double code(double x, double y, double z, double t, double a, double b) {
return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
}
def code(x, y, z, t, a, b): return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y)) end
function tmp = code(x, y, z, t, a, b) tmp = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]
\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (+ x t) y))
(t_2 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) t_1))
(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 (- INFINITY))
t_5
(if (<= t_2 1e+244) (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 + t) + y;
double t_2 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / t_1;
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 <= -((double) INFINITY)) {
tmp = t_5;
} else if (t_2 <= 1e+244) {
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(Float64(x + t) + y) t_2 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / t_1) t_3 = Float64(Float64(t + 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 <= Float64(-Inf)) tmp = t_5; elseif (t_2 <= 1e+244) 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[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(t + 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, (-Infinity)], t$95$5, If[LessEqual[t$95$2, 1e+244], 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}
t_1 := \left(x + t\right) + y\\
t_2 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{t\_1}\\
t_3 := \left(t + 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 -\infty:\\
\;\;\;\;t\_5\\
\mathbf{elif}\;t\_2 \leq 10^{+244}:\\
\;\;\;\;\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}
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.0000000000000001e244 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 61.0%
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
div-addN/A
sub-flip-reverseN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites72.7%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6494.3%
lift-+.f64N/A
+-commutativeN/A
lift-+.f6494.3%
Applied rewrites94.3%
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.0000000000000001e244Initial program 61.0%
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
div-addN/A
sub-flip-reverseN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites72.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 (/ z t_1))
(t_4 (+ (+ t x) y)))
(if (<= t_2 (- INFINITY))
(fma a 1.0 (- (* (+ x y) t_3) (* y (/ b t_1))))
(if (<= t_2 1e+244)
(fma a (/ (+ t y) t_4) (/ (- (* z (+ y x)) (* b y)) t_4))
(fma t_3 (+ x y) (fma (- (/ y t_1)) b (* 1.0 a)))))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + t) + y;
double t_2 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / t_1;
double t_3 = z / t_1;
double t_4 = (t + x) + y;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = fma(a, 1.0, (((x + y) * t_3) - (y * (b / t_1))));
} else if (t_2 <= 1e+244) {
tmp = fma(a, ((t + y) / t_4), (((z * (y + x)) - (b * y)) / t_4));
} else {
tmp = fma(t_3, (x + y), fma(-(y / t_1), b, (1.0 * a)));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + t) + y) t_2 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / t_1) t_3 = Float64(z / t_1) t_4 = Float64(Float64(t + x) + y) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = fma(a, 1.0, Float64(Float64(Float64(x + y) * t_3) - Float64(y * Float64(b / t_1)))); elseif (t_2 <= 1e+244) tmp = fma(a, Float64(Float64(t + y) / t_4), Float64(Float64(Float64(z * Float64(y + x)) - Float64(b * y)) / t_4)); else tmp = fma(t_3, Float64(x + y), fma(Float64(-Float64(y / t_1)), b, Float64(1.0 * a))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(z / t$95$1), $MachinePrecision]}, Block[{t$95$4 = N[(N[(t + x), $MachinePrecision] + y), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(a * 1.0 + N[(N[(N[(x + y), $MachinePrecision] * t$95$3), $MachinePrecision] - N[(y * N[(b / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+244], N[(a * N[(N[(t + y), $MachinePrecision] / t$95$4), $MachinePrecision] + N[(N[(N[(z * N[(y + x), $MachinePrecision]), $MachinePrecision] - N[(b * y), $MachinePrecision]), $MachinePrecision] / t$95$4), $MachinePrecision]), $MachinePrecision], N[(t$95$3 * N[(x + y), $MachinePrecision] + N[((-N[(y / t$95$1), $MachinePrecision]) * b + N[(1.0 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{t\_1}\\
t_3 := \frac{z}{t\_1}\\
t_4 := \left(t + x\right) + y\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(a, 1, \left(x + y\right) \cdot t\_3 - y \cdot \frac{b}{t\_1}\right)\\
\mathbf{elif}\;t\_2 \leq 10^{+244}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{t + y}{t\_4}, \frac{z \cdot \left(y + x\right) - b \cdot y}{t\_4}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_3, x + y, \mathsf{fma}\left(-\frac{y}{t\_1}, b, 1 \cdot a\right)\right)\\
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -inf.0Initial program 61.0%
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
div-addN/A
sub-flip-reverseN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites72.7%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6494.3%
lift-+.f64N/A
+-commutativeN/A
lift-+.f6494.3%
Applied rewrites94.3%
Taylor expanded in x around 0
Applied rewrites81.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6480.6%
Applied rewrites80.6%
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.0000000000000001e244Initial program 61.0%
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
div-addN/A
sub-flip-reverseN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites72.7%
if 1.0000000000000001e244 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 61.0%
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
div-addN/A
sub-flip-reverseN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites72.7%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6494.3%
lift-+.f64N/A
+-commutativeN/A
lift-+.f6494.3%
Applied rewrites94.3%
Taylor expanded in x around 0
Applied rewrites81.7%
lift-fma.f64N/A
+-commutativeN/A
lift--.f64N/A
sub-flipN/A
associate-+l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites81.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 (* (+ x y) (/ z t_1))))
(if (<= t_2 (- INFINITY))
(fma a 1.0 (- t_3 (* y (/ b t_1))))
(if (<= t_2 1e+244) t_2 (fma a 1.0 (- t_3 (* b (/ y 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 t_3 = (x + y) * (z / t_1);
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = fma(a, 1.0, (t_3 - (y * (b / t_1))));
} else if (t_2 <= 1e+244) {
tmp = t_2;
} else {
tmp = fma(a, 1.0, (t_3 - (b * (y / 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) t_3 = Float64(Float64(x + y) * Float64(z / t_1)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = fma(a, 1.0, Float64(t_3 - Float64(y * Float64(b / t_1)))); elseif (t_2 <= 1e+244) tmp = t_2; else tmp = fma(a, 1.0, Float64(t_3 - Float64(b * Float64(y / 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]}, Block[{t$95$3 = N[(N[(x + y), $MachinePrecision] * N[(z / t$95$1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(a * 1.0 + N[(t$95$3 - N[(y * N[(b / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+244], t$95$2, N[(a * 1.0 + N[(t$95$3 - N[(b * N[(y / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{t\_1}\\
t_3 := \left(x + y\right) \cdot \frac{z}{t\_1}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(a, 1, t\_3 - y \cdot \frac{b}{t\_1}\right)\\
\mathbf{elif}\;t\_2 \leq 10^{+244}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, 1, t\_3 - b \cdot \frac{y}{t\_1}\right)\\
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -inf.0Initial program 61.0%
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
div-addN/A
sub-flip-reverseN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites72.7%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6494.3%
lift-+.f64N/A
+-commutativeN/A
lift-+.f6494.3%
Applied rewrites94.3%
Taylor expanded in x around 0
Applied rewrites81.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6480.6%
Applied rewrites80.6%
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.0000000000000001e244Initial program 61.0%
if 1.0000000000000001e244 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 61.0%
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
div-addN/A
sub-flip-reverseN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites72.7%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6494.3%
lift-+.f64N/A
+-commutativeN/A
lift-+.f6494.3%
Applied rewrites94.3%
Taylor expanded in x around 0
Applied rewrites81.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 (/ z t_1)))
(if (<= t_2 (- INFINITY))
(fma a 1.0 (- (* (+ x y) t_3) (* y (/ b t_1))))
(if (<= t_2 1e+244)
t_2
(fma t_3 (+ x y) (fma (- (/ y t_1)) b (* 1.0 a)))))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + t) + y;
double t_2 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / t_1;
double t_3 = z / t_1;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = fma(a, 1.0, (((x + y) * t_3) - (y * (b / t_1))));
} else if (t_2 <= 1e+244) {
tmp = t_2;
} else {
tmp = fma(t_3, (x + y), fma(-(y / t_1), b, (1.0 * a)));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + t) + y) t_2 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / t_1) t_3 = Float64(z / t_1) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = fma(a, 1.0, Float64(Float64(Float64(x + y) * t_3) - Float64(y * Float64(b / t_1)))); elseif (t_2 <= 1e+244) tmp = t_2; else tmp = fma(t_3, Float64(x + y), fma(Float64(-Float64(y / t_1)), b, Float64(1.0 * a))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(z / t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(a * 1.0 + N[(N[(N[(x + y), $MachinePrecision] * t$95$3), $MachinePrecision] - N[(y * N[(b / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+244], t$95$2, N[(t$95$3 * N[(x + y), $MachinePrecision] + N[((-N[(y / t$95$1), $MachinePrecision]) * b + N[(1.0 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{t\_1}\\
t_3 := \frac{z}{t\_1}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(a, 1, \left(x + y\right) \cdot t\_3 - y \cdot \frac{b}{t\_1}\right)\\
\mathbf{elif}\;t\_2 \leq 10^{+244}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_3, x + y, \mathsf{fma}\left(-\frac{y}{t\_1}, b, 1 \cdot a\right)\right)\\
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -inf.0Initial program 61.0%
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
div-addN/A
sub-flip-reverseN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites72.7%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6494.3%
lift-+.f64N/A
+-commutativeN/A
lift-+.f6494.3%
Applied rewrites94.3%
Taylor expanded in x around 0
Applied rewrites81.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6480.6%
Applied rewrites80.6%
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.0000000000000001e244Initial program 61.0%
if 1.0000000000000001e244 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 61.0%
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
div-addN/A
sub-flip-reverseN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites72.7%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6494.3%
lift-+.f64N/A
+-commutativeN/A
lift-+.f6494.3%
Applied rewrites94.3%
Taylor expanded in x around 0
Applied rewrites81.7%
lift-fma.f64N/A
+-commutativeN/A
lift--.f64N/A
sub-flipN/A
associate-+l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites81.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 1.0 (- (* (+ x y) (/ z t_1)) (* b (/ y t_1))))))
(if (<= t_2 (- INFINITY)) t_3 (if (<= t_2 1e+244) t_2 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, 1.0, (((x + y) * (z / t_1)) - (b * (y / t_1))));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_3;
} else if (t_2 <= 1e+244) {
tmp = t_2;
} 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, 1.0, Float64(Float64(Float64(x + y) * Float64(z / t_1)) - Float64(b * Float64(y / t_1)))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_3; elseif (t_2 <= 1e+244) tmp = t_2; 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 * 1.0 + 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, (-Infinity)], t$95$3, If[LessEqual[t$95$2, 1e+244], t$95$2, t$95$3]]]]]
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{t\_1}\\
t_3 := \mathsf{fma}\left(a, 1, \left(x + y\right) \cdot \frac{z}{t\_1} - b \cdot \frac{y}{t\_1}\right)\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 10^{+244}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -inf.0 or 1.0000000000000001e244 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 61.0%
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
div-addN/A
sub-flip-reverseN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites72.7%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6494.3%
lift-+.f64N/A
+-commutativeN/A
lift-+.f6494.3%
Applied rewrites94.3%
Taylor expanded in x around 0
Applied rewrites81.7%
if -inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 1.0000000000000001e244Initial program 61.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 (fma a (/ (+ t y) (+ (+ t x) y)) (- (* (+ x y) (/ z t_1)) b))))
(if (<= t_2 (- INFINITY)) t_3 (if (<= t_2 5e+271) t_2 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 / t_1)) - b));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_3;
} else if (t_2 <= 5e+271) {
tmp = t_2;
} 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 / t_1)) - b)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_3; elseif (t_2 <= 5e+271) tmp = t_2; 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 / t$95$1), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$3, If[LessEqual[t$95$2, 5e+271], t$95$2, t$95$3]]]]]
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{t\_1}\\
t_3 := \mathsf{fma}\left(a, \frac{t + y}{\left(t + x\right) + y}, \left(x + y\right) \cdot \frac{z}{t\_1} - b\right)\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+271}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -inf.0 or 5.0000000000000003e271 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 61.0%
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
div-addN/A
sub-flip-reverseN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites72.7%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6494.3%
lift-+.f64N/A
+-commutativeN/A
lift-+.f6494.3%
Applied rewrites94.3%
Taylor expanded in y around inf
Applied rewrites69.7%
if -inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 5.0000000000000003e271Initial program 61.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)))
(if (<= t_2 (- INFINITY))
(fma a (/ (+ t y) (+ (+ t x) y)) (- z b))
(if (<= t_2 5e+271) t_2 (fma a 1.0 (- (* (+ x y) (/ z t_1)) b))))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + t) + y;
double t_2 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / t_1;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = fma(a, ((t + y) / ((t + x) + y)), (z - b));
} else if (t_2 <= 5e+271) {
tmp = t_2;
} else {
tmp = fma(a, 1.0, (((x + y) * (z / t_1)) - b));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + t) + y) t_2 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / t_1) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = fma(a, Float64(Float64(t + y) / Float64(Float64(t + x) + y)), Float64(z - b)); elseif (t_2 <= 5e+271) tmp = t_2; else tmp = fma(a, 1.0, Float64(Float64(Float64(x + y) * Float64(z / t_1)) - b)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], 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, 5e+271], t$95$2, N[(a * 1.0 + N[(N[(N[(x + y), $MachinePrecision] * N[(z / t$95$1), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{t\_1}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{t + y}{\left(t + x\right) + y}, z - b\right)\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+271}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, 1, \left(x + y\right) \cdot \frac{z}{t\_1} - b\right)\\
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -inf.0Initial program 61.0%
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
div-addN/A
sub-flip-reverseN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites72.7%
Taylor expanded in y around inf
lower--.f6463.3%
Applied rewrites63.3%
if -inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 5.0000000000000003e271Initial program 61.0%
if 5.0000000000000003e271 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 61.0%
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
div-addN/A
sub-flip-reverseN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites72.7%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6494.3%
lift-+.f64N/A
+-commutativeN/A
lift-+.f6494.3%
Applied rewrites94.3%
Taylor expanded in x around 0
Applied rewrites81.7%
Taylor expanded in y around inf
Applied rewrites61.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)))
(if (<= t_2 -2e+137)
(fma a (/ (+ t y) (+ (+ t x) y)) (- z b))
(if (<= t_2 1e+244)
(/ (fma a (+ t y) (* z (+ x y))) (+ t (+ x y)))
(fma a 1.0 (- (* (+ x y) (/ z t_1)) b))))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + t) + y;
double t_2 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / t_1;
double tmp;
if (t_2 <= -2e+137) {
tmp = fma(a, ((t + y) / ((t + x) + y)), (z - b));
} else if (t_2 <= 1e+244) {
tmp = fma(a, (t + y), (z * (x + y))) / (t + (x + y));
} else {
tmp = fma(a, 1.0, (((x + y) * (z / t_1)) - b));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + t) + y) t_2 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / t_1) tmp = 0.0 if (t_2 <= -2e+137) tmp = fma(a, Float64(Float64(t + y) / Float64(Float64(t + x) + y)), Float64(z - b)); elseif (t_2 <= 1e+244) tmp = Float64(fma(a, Float64(t + y), Float64(z * Float64(x + y))) / Float64(t + Float64(x + y))); else tmp = fma(a, 1.0, Float64(Float64(Float64(x + y) * Float64(z / t_1)) - b)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+137], 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+244], N[(N[(a * N[(t + y), $MachinePrecision] + N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * 1.0 + N[(N[(N[(x + y), $MachinePrecision] * N[(z / t$95$1), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{t\_1}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+137}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{t + y}{\left(t + x\right) + y}, z - b\right)\\
\mathbf{elif}\;t\_2 \leq 10^{+244}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t + y, z \cdot \left(x + y\right)\right)}{t + \left(x + y\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, 1, \left(x + y\right) \cdot \frac{z}{t\_1} - b\right)\\
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -2.0000000000000001e137Initial program 61.0%
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
div-addN/A
sub-flip-reverseN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites72.7%
Taylor expanded in y around inf
lower--.f6463.3%
Applied rewrites63.3%
if -2.0000000000000001e137 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 1.0000000000000001e244Initial program 61.0%
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-+.f6447.9%
Applied rewrites47.9%
if 1.0000000000000001e244 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 61.0%
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
div-addN/A
sub-flip-reverseN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites72.7%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6494.3%
lift-+.f64N/A
+-commutativeN/A
lift-+.f6494.3%
Applied rewrites94.3%
Taylor expanded in x around 0
Applied rewrites81.7%
Taylor expanded in y around inf
Applied rewrites61.9%
(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 -5e+34)
t_2
(if (<= t_1 50000000.0) (/ (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 = fma(a, ((t + y) / ((t + x) + y)), (z - b));
double tmp;
if (t_1 <= -5e+34) {
tmp = t_2;
} else if (t_1 <= 50000000.0) {
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 = fma(a, Float64(Float64(t + y) / Float64(Float64(t + x) + y)), Float64(z - b)) tmp = 0.0 if (t_1 <= -5e+34) tmp = t_2; elseif (t_1 <= 50000000.0) 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[(a * N[(N[(t + y), $MachinePrecision] / N[(N[(t + x), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision] + N[(z - b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+34], t$95$2, If[LessEqual[t$95$1, 50000000.0], N[(N[(a * t + N[(x * z), $MachinePrecision]), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
t_1 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\\
t_2 := \mathsf{fma}\left(a, \frac{t + y}{\left(t + x\right) + y}, z - b\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+34}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 50000000:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, x \cdot z\right)}{t + x}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -4.9999999999999998e34 or 5e7 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 61.0%
lift-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
div-addN/A
sub-flip-reverseN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites72.7%
Taylor expanded in y around inf
lower--.f6463.3%
Applied rewrites63.3%
if -4.9999999999999998e34 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 5e7Initial program 61.0%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-+.f6441.0%
Applied rewrites41.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
(t_2 (- z (- b a))))
(if (<= t_1 -5e+34)
t_2
(if (<= t_1 50000000.0) (/ (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 = z - (b - a);
double tmp;
if (t_1 <= -5e+34) {
tmp = t_2;
} else if (t_1 <= 50000000.0) {
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(z - Float64(b - a)) tmp = 0.0 if (t_1 <= -5e+34) tmp = t_2; elseif (t_1 <= 50000000.0) 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[(z - N[(b - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+34], t$95$2, If[LessEqual[t$95$1, 50000000.0], N[(N[(a * t + N[(x * z), $MachinePrecision]), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
t_1 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\\
t_2 := z - \left(b - a\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+34}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 50000000:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, x \cdot z\right)}{t + x}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -4.9999999999999998e34 or 5e7 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 61.0%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6455.2%
Applied rewrites55.2%
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f6455.2%
Applied rewrites55.2%
if -4.9999999999999998e34 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 5e7Initial program 61.0%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-+.f6441.0%
Applied rewrites41.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
(t_2 (- z (- b a))))
(if (<= t_1 -5e+34)
t_2
(if (<= t_1 50000000.0) (/ (fma a t (* x z)) t) t_2))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
double t_2 = z - (b - a);
double tmp;
if (t_1 <= -5e+34) {
tmp = t_2;
} else if (t_1 <= 50000000.0) {
tmp = fma(a, t, (x * z)) / t;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y)) t_2 = Float64(z - Float64(b - a)) tmp = 0.0 if (t_1 <= -5e+34) tmp = t_2; elseif (t_1 <= 50000000.0) tmp = Float64(fma(a, t, Float64(x * z)) / t); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(z - N[(b - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+34], t$95$2, If[LessEqual[t$95$1, 50000000.0], N[(N[(a * t + N[(x * z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
t_1 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\\
t_2 := z - \left(b - a\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+34}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 50000000:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, x \cdot z\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -4.9999999999999998e34 or 5e7 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 61.0%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6455.2%
Applied rewrites55.2%
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f6455.2%
Applied rewrites55.2%
if -4.9999999999999998e34 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 5e7Initial program 61.0%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-+.f6441.0%
Applied rewrites41.0%
Taylor expanded in x around 0
Applied rewrites24.9%
(FPCore (x y z t a b) :precision binary64 (if (<= x -5.2e+42) z (- z (- b a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -5.2e+42) {
tmp = z;
} else {
tmp = z - (b - 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 (x <= (-5.2d+42)) then
tmp = z
else
tmp = z - (b - 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 (x <= -5.2e+42) {
tmp = z;
} else {
tmp = z - (b - a);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -5.2e+42: tmp = z else: tmp = z - (b - a) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -5.2e+42) tmp = z; else tmp = Float64(z - Float64(b - a)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (x <= -5.2e+42) tmp = z; else tmp = z - (b - a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -5.2e+42], z, N[(z - N[(b - a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;x \leq -5.2 \cdot 10^{+42}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;z - \left(b - a\right)\\
\end{array}
if x < -5.1999999999999998e42Initial program 61.0%
Taylor expanded in x around inf
Applied rewrites32.5%
if -5.1999999999999998e42 < x Initial program 61.0%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6455.2%
Applied rewrites55.2%
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
sub-negate-revN/A
sub-flip-reverseN/A
lower--.f64N/A
lower--.f6455.2%
Applied rewrites55.2%
(FPCore (x y z t a b) :precision binary64 (if (<= z -6.5e+29) z (if (<= z 9.2e-21) a z)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -6.5e+29) {
tmp = z;
} else if (z <= 9.2e-21) {
tmp = a;
} else {
tmp = z;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (z <= (-6.5d+29)) then
tmp = z
else if (z <= 9.2d-21) then
tmp = a
else
tmp = z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -6.5e+29) {
tmp = z;
} else if (z <= 9.2e-21) {
tmp = a;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -6.5e+29: tmp = z elif z <= 9.2e-21: tmp = a else: tmp = z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -6.5e+29) tmp = z; elseif (z <= 9.2e-21) tmp = a; else tmp = z; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -6.5e+29) tmp = z; elseif (z <= 9.2e-21) tmp = a; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -6.5e+29], z, If[LessEqual[z, 9.2e-21], a, z]]
\begin{array}{l}
\mathbf{if}\;z \leq -6.5 \cdot 10^{+29}:\\
\;\;\;\;z\\
\mathbf{elif}\;z \leq 9.2 \cdot 10^{-21}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
if z < -6.4999999999999997e29 or 9.2e-21 < z Initial program 61.0%
Taylor expanded in x around inf
Applied rewrites32.5%
if -6.4999999999999997e29 < z < 9.2e-21Initial program 61.0%
Taylor expanded in t around inf
Applied rewrites33.2%
(FPCore (x y z t a b) :precision binary64 a)
double code(double x, double y, double z, double t, double a, double b) {
return a;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = a
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return a;
}
def code(x, y, z, t, a, b): return a
function code(x, y, z, t, a, b) return a end
function tmp = code(x, y, z, t, a, b) tmp = a; end
code[x_, y_, z_, t_, a_, b_] := a
a
Initial program 61.0%
Taylor expanded in t around inf
Applied rewrites33.2%
herbie shell --seed 2025195
(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)))