
(FPCore (x y z t a b) :precision binary64 (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x + (y * z)) + (t * a)) + ((a * z) * b);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((x + (y * z)) + (t * a)) + ((a * z) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x + (y * z)) + (t * a)) + ((a * z) * b);
}
def code(x, y, z, t, a, b): return ((x + (y * z)) + (t * a)) + ((a * z) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x + Float64(y * z)) + Float64(t * a)) + Float64(Float64(a * z) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x + (y * z)) + (t * a)) + ((a * z) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(N[(a * z), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b
\end{array}
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x + (y * z)) + (t * a)) + ((a * z) * b);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((x + (y * z)) + (t * a)) + ((a * z) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x + (y * z)) + (t * a)) + ((a * z) * b);
}
def code(x, y, z, t, a, b): return ((x + (y * z)) + (t * a)) + ((a * z) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x + Float64(y * z)) + Float64(t * a)) + Float64(Float64(a * z) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x + (y * z)) + (t * a)) + ((a * z) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(N[(a * z), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b
\end{array}
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma (fma b a y) z x)))
(if (<= z -2.15e+204)
t_1
(if (<= z 2.5e+128) (+ (fma z y x) (* (fma b z t) a)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(fma(b, a, y), z, x);
double tmp;
if (z <= -2.15e+204) {
tmp = t_1;
} else if (z <= 2.5e+128) {
tmp = fma(z, y, x) + (fma(b, z, t) * a);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(fma(b, a, y), z, x) tmp = 0.0 if (z <= -2.15e+204) tmp = t_1; elseif (z <= 2.5e+128) tmp = Float64(fma(z, y, x) + Float64(fma(b, z, t) * a)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b * a + y), $MachinePrecision] * z + x), $MachinePrecision]}, If[LessEqual[z, -2.15e+204], t$95$1, If[LessEqual[z, 2.5e+128], N[(N[(z * y + x), $MachinePrecision] + N[(N[(b * z + t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\mathsf{fma}\left(b, a, y\right), z, x\right)\\
\mathbf{if}\;z \leq -2.15 \cdot 10^{+204}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{+128}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right) + \mathsf{fma}\left(b, z, t\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.15e204 or 2.5e128 < z Initial program 92.6%
Taylor expanded in t around 0
+-commutativeN/A
+-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6474.4
Applied rewrites74.4%
if -2.15e204 < z < 2.5e128Initial program 92.6%
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-+l+N/A
associate-*l*N/A
*-commutativeN/A
*-commutativeN/A
distribute-rgt-inN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6494.0
Applied rewrites94.0%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))) (if (<= t_1 INFINITY) t_1 (* (fma b a y) z))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((x + (y * z)) + (t * a)) + ((a * z) * b);
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = fma(b, a, y) * z;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(x + Float64(y * z)) + Float64(t * a)) + Float64(Float64(a * z) * b)) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(fma(b, a, y) * z); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(N[(a * z), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(N[(b * a + y), $MachinePrecision] * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b, a, y\right) \cdot z\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b)) < +inf.0Initial program 92.6%
if +inf.0 < (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b)) Initial program 92.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6450.2
Applied rewrites50.2%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (fma (fma b z t) a x))) (if (<= a -3.05e-66) t_1 (if (<= a 1.4e-44) (fma (fma b a y) z x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(fma(b, z, t), a, x);
double tmp;
if (a <= -3.05e-66) {
tmp = t_1;
} else if (a <= 1.4e-44) {
tmp = fma(fma(b, a, y), z, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(fma(b, z, t), a, x) tmp = 0.0 if (a <= -3.05e-66) tmp = t_1; elseif (a <= 1.4e-44) tmp = fma(fma(b, a, y), z, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b * z + t), $MachinePrecision] * a + x), $MachinePrecision]}, If[LessEqual[a, -3.05e-66], t$95$1, If[LessEqual[a, 1.4e-44], N[(N[(b * a + y), $MachinePrecision] * z + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\mathsf{fma}\left(b, z, t\right), a, x\right)\\
\mathbf{if}\;a \leq -3.05 \cdot 10^{-66}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.4 \cdot 10^{-44}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, a, y\right), z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -3.04999999999999997e-66 or 1.4e-44 < a Initial program 92.6%
Taylor expanded in y around 0
distribute-lft-outN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6475.1
Applied rewrites75.1%
if -3.04999999999999997e-66 < a < 1.4e-44Initial program 92.6%
Taylor expanded in t around 0
+-commutativeN/A
+-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6474.4
Applied rewrites74.4%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (fma a t (fma y z x)))) (if (<= t -2.05e+113) t_1 (if (<= t 6.8e-23) (fma (fma b a y) z x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(a, t, fma(y, z, x));
double tmp;
if (t <= -2.05e+113) {
tmp = t_1;
} else if (t <= 6.8e-23) {
tmp = fma(fma(b, a, y), z, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(a, t, fma(y, z, x)) tmp = 0.0 if (t <= -2.05e+113) tmp = t_1; elseif (t <= 6.8e-23) tmp = fma(fma(b, a, y), z, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * t + N[(y * z + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -2.05e+113], t$95$1, If[LessEqual[t, 6.8e-23], N[(N[(b * a + y), $MachinePrecision] * z + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, t, \mathsf{fma}\left(y, z, x\right)\right)\\
\mathbf{if}\;t \leq -2.05 \cdot 10^{+113}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 6.8 \cdot 10^{-23}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, a, y\right), z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.04999999999999996e113 or 6.8000000000000001e-23 < t Initial program 92.6%
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-+l+N/A
associate-*l*N/A
*-commutativeN/A
*-commutativeN/A
distribute-rgt-inN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6494.0
Applied rewrites94.0%
Taylor expanded in b around 0
+-commutativeN/A
*-commutativeN/A
associate-+l+N/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f6477.5
Applied rewrites77.5%
if -2.04999999999999996e113 < t < 6.8000000000000001e-23Initial program 92.6%
Taylor expanded in t around 0
+-commutativeN/A
+-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6474.4
Applied rewrites74.4%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (fma b z t) a))) (if (<= a -2.35e+52) t_1 (if (<= a 1.25e+41) (fma a t (fma y z x)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(b, z, t) * a;
double tmp;
if (a <= -2.35e+52) {
tmp = t_1;
} else if (a <= 1.25e+41) {
tmp = fma(a, t, fma(y, z, x));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(fma(b, z, t) * a) tmp = 0.0 if (a <= -2.35e+52) tmp = t_1; elseif (a <= 1.25e+41) tmp = fma(a, t, fma(y, z, x)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b * z + t), $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[a, -2.35e+52], t$95$1, If[LessEqual[a, 1.25e+41], N[(a * t + N[(y * z + x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(b, z, t\right) \cdot a\\
\mathbf{if}\;a \leq -2.35 \cdot 10^{+52}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.25 \cdot 10^{+41}:\\
\;\;\;\;\mathsf{fma}\left(a, t, \mathsf{fma}\left(y, z, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -2.35e52 or 1.25000000000000006e41 < a Initial program 92.6%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6450.7
Applied rewrites50.7%
if -2.35e52 < a < 1.25000000000000006e41Initial program 92.6%
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-+l+N/A
associate-*l*N/A
*-commutativeN/A
*-commutativeN/A
distribute-rgt-inN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6494.0
Applied rewrites94.0%
Taylor expanded in b around 0
+-commutativeN/A
*-commutativeN/A
associate-+l+N/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f6477.5
Applied rewrites77.5%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (fma b z t) a))) (if (<= a -1.56e-75) t_1 (if (<= a 7e+39) (fma z y x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(b, z, t) * a;
double tmp;
if (a <= -1.56e-75) {
tmp = t_1;
} else if (a <= 7e+39) {
tmp = fma(z, y, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(fma(b, z, t) * a) tmp = 0.0 if (a <= -1.56e-75) tmp = t_1; elseif (a <= 7e+39) tmp = fma(z, y, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b * z + t), $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[a, -1.56e-75], t$95$1, If[LessEqual[a, 7e+39], N[(z * y + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(b, z, t\right) \cdot a\\
\mathbf{if}\;a \leq -1.56 \cdot 10^{-75}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 7 \cdot 10^{+39}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.5600000000000001e-75 or 7.0000000000000003e39 < a Initial program 92.6%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6450.7
Applied rewrites50.7%
if -1.5600000000000001e-75 < a < 7.0000000000000003e39Initial program 92.6%
Taylor expanded in y around 0
distribute-lft-outN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6475.1
Applied rewrites75.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
+-commutativeN/A
lower-/.f64N/A
lift-fma.f6466.8
Applied rewrites66.8%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6452.3
Applied rewrites52.3%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (fma b a y) z))) (if (<= z -9.5e-55) t_1 (if (<= z 3.3e+83) (fma t a x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(b, a, y) * z;
double tmp;
if (z <= -9.5e-55) {
tmp = t_1;
} else if (z <= 3.3e+83) {
tmp = fma(t, a, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(fma(b, a, y) * z) tmp = 0.0 if (z <= -9.5e-55) tmp = t_1; elseif (z <= 3.3e+83) tmp = fma(t, a, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b * a + y), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -9.5e-55], t$95$1, If[LessEqual[z, 3.3e+83], N[(t * a + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(b, a, y\right) \cdot z\\
\mathbf{if}\;z \leq -9.5 \cdot 10^{-55}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{+83}:\\
\;\;\;\;\mathsf{fma}\left(t, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -9.5000000000000006e-55 or 3.29999999999999985e83 < z Initial program 92.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6450.2
Applied rewrites50.2%
if -9.5000000000000006e-55 < z < 3.29999999999999985e83Initial program 92.6%
Taylor expanded in y around 0
distribute-lft-outN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6475.1
Applied rewrites75.1%
Taylor expanded in z around 0
Applied rewrites52.7%
(FPCore (x y z t a b)
:precision binary64
(if (<= a -2e+52)
(* (* a z) b)
(if (<= a 5.5e-72)
(fma z y x)
(if (<= a 1.4e+207) (fma a t (* y z)) (* (* b z) a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -2e+52) {
tmp = (a * z) * b;
} else if (a <= 5.5e-72) {
tmp = fma(z, y, x);
} else if (a <= 1.4e+207) {
tmp = fma(a, t, (y * z));
} else {
tmp = (b * z) * a;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -2e+52) tmp = Float64(Float64(a * z) * b); elseif (a <= 5.5e-72) tmp = fma(z, y, x); elseif (a <= 1.4e+207) tmp = fma(a, t, Float64(y * z)); else tmp = Float64(Float64(b * z) * a); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -2e+52], N[(N[(a * z), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[a, 5.5e-72], N[(z * y + x), $MachinePrecision], If[LessEqual[a, 1.4e+207], N[(a * t + N[(y * z), $MachinePrecision]), $MachinePrecision], N[(N[(b * z), $MachinePrecision] * a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2 \cdot 10^{+52}:\\
\;\;\;\;\left(a \cdot z\right) \cdot b\\
\mathbf{elif}\;a \leq 5.5 \cdot 10^{-72}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{elif}\;a \leq 1.4 \cdot 10^{+207}:\\
\;\;\;\;\mathsf{fma}\left(a, t, y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(b \cdot z\right) \cdot a\\
\end{array}
\end{array}
if a < -2e52Initial program 92.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6450.2
Applied rewrites50.2%
Taylor expanded in y around 0
lower-*.f6426.8
Applied rewrites26.8%
Taylor expanded in y around 0
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f6427.7
Applied rewrites27.7%
if -2e52 < a < 5.49999999999999994e-72Initial program 92.6%
Taylor expanded in y around 0
distribute-lft-outN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6475.1
Applied rewrites75.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
+-commutativeN/A
lower-/.f64N/A
lift-fma.f6466.8
Applied rewrites66.8%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6452.3
Applied rewrites52.3%
if 5.49999999999999994e-72 < a < 1.40000000000000005e207Initial program 92.6%
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-+l+N/A
associate-*l*N/A
*-commutativeN/A
*-commutativeN/A
distribute-rgt-inN/A
lower-+.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6494.0
Applied rewrites94.0%
Taylor expanded in b around 0
+-commutativeN/A
*-commutativeN/A
associate-+l+N/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f6477.5
Applied rewrites77.5%
Taylor expanded in x around 0
lower-*.f6452.6
Applied rewrites52.6%
if 1.40000000000000005e207 < a Initial program 92.6%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6450.7
Applied rewrites50.7%
Taylor expanded in z around inf
lower-*.f6426.9
Applied rewrites26.9%
(FPCore (x y z t a b)
:precision binary64
(if (<= a -2e+52)
(* (* a z) b)
(if (<= a 1.2e-44)
(fma z y x)
(if (<= a 1.35e+207) (fma t a x) (* (* b z) a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -2e+52) {
tmp = (a * z) * b;
} else if (a <= 1.2e-44) {
tmp = fma(z, y, x);
} else if (a <= 1.35e+207) {
tmp = fma(t, a, x);
} else {
tmp = (b * z) * a;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -2e+52) tmp = Float64(Float64(a * z) * b); elseif (a <= 1.2e-44) tmp = fma(z, y, x); elseif (a <= 1.35e+207) tmp = fma(t, a, x); else tmp = Float64(Float64(b * z) * a); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -2e+52], N[(N[(a * z), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[a, 1.2e-44], N[(z * y + x), $MachinePrecision], If[LessEqual[a, 1.35e+207], N[(t * a + x), $MachinePrecision], N[(N[(b * z), $MachinePrecision] * a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2 \cdot 10^{+52}:\\
\;\;\;\;\left(a \cdot z\right) \cdot b\\
\mathbf{elif}\;a \leq 1.2 \cdot 10^{-44}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{elif}\;a \leq 1.35 \cdot 10^{+207}:\\
\;\;\;\;\mathsf{fma}\left(t, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(b \cdot z\right) \cdot a\\
\end{array}
\end{array}
if a < -2e52Initial program 92.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6450.2
Applied rewrites50.2%
Taylor expanded in y around 0
lower-*.f6426.8
Applied rewrites26.8%
Taylor expanded in y around 0
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f6427.7
Applied rewrites27.7%
if -2e52 < a < 1.20000000000000004e-44Initial program 92.6%
Taylor expanded in y around 0
distribute-lft-outN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6475.1
Applied rewrites75.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
+-commutativeN/A
lower-/.f64N/A
lift-fma.f6466.8
Applied rewrites66.8%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6452.3
Applied rewrites52.3%
if 1.20000000000000004e-44 < a < 1.35000000000000012e207Initial program 92.6%
Taylor expanded in y around 0
distribute-lft-outN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6475.1
Applied rewrites75.1%
Taylor expanded in z around 0
Applied rewrites52.7%
if 1.35000000000000012e207 < a Initial program 92.6%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6450.7
Applied rewrites50.7%
Taylor expanded in z around inf
lower-*.f6426.9
Applied rewrites26.9%
(FPCore (x y z t a b)
:precision binary64
(if (<= a -2e+52)
(* (* a z) b)
(if (<= a 1.2e-44)
(fma z y x)
(if (<= a 1.4e+207) (fma t a x) (* (* a b) z)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -2e+52) {
tmp = (a * z) * b;
} else if (a <= 1.2e-44) {
tmp = fma(z, y, x);
} else if (a <= 1.4e+207) {
tmp = fma(t, a, x);
} else {
tmp = (a * b) * z;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -2e+52) tmp = Float64(Float64(a * z) * b); elseif (a <= 1.2e-44) tmp = fma(z, y, x); elseif (a <= 1.4e+207) tmp = fma(t, a, x); else tmp = Float64(Float64(a * b) * z); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -2e+52], N[(N[(a * z), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[a, 1.2e-44], N[(z * y + x), $MachinePrecision], If[LessEqual[a, 1.4e+207], N[(t * a + x), $MachinePrecision], N[(N[(a * b), $MachinePrecision] * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2 \cdot 10^{+52}:\\
\;\;\;\;\left(a \cdot z\right) \cdot b\\
\mathbf{elif}\;a \leq 1.2 \cdot 10^{-44}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{elif}\;a \leq 1.4 \cdot 10^{+207}:\\
\;\;\;\;\mathsf{fma}\left(t, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot b\right) \cdot z\\
\end{array}
\end{array}
if a < -2e52Initial program 92.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6450.2
Applied rewrites50.2%
Taylor expanded in y around 0
lower-*.f6426.8
Applied rewrites26.8%
Taylor expanded in y around 0
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f6427.7
Applied rewrites27.7%
if -2e52 < a < 1.20000000000000004e-44Initial program 92.6%
Taylor expanded in y around 0
distribute-lft-outN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6475.1
Applied rewrites75.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
+-commutativeN/A
lower-/.f64N/A
lift-fma.f6466.8
Applied rewrites66.8%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6452.3
Applied rewrites52.3%
if 1.20000000000000004e-44 < a < 1.40000000000000005e207Initial program 92.6%
Taylor expanded in y around 0
distribute-lft-outN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6475.1
Applied rewrites75.1%
Taylor expanded in z around 0
Applied rewrites52.7%
if 1.40000000000000005e207 < a Initial program 92.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6450.2
Applied rewrites50.2%
Taylor expanded in y around 0
lower-*.f6426.8
Applied rewrites26.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (* a z) b)))
(if (<= a -2e+52)
t_1
(if (<= a 1.2e-44) (fma z y x) (if (<= a 1.35e+207) (fma t a x) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a * z) * b;
double tmp;
if (a <= -2e+52) {
tmp = t_1;
} else if (a <= 1.2e-44) {
tmp = fma(z, y, x);
} else if (a <= 1.35e+207) {
tmp = fma(t, a, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a * z) * b) tmp = 0.0 if (a <= -2e+52) tmp = t_1; elseif (a <= 1.2e-44) tmp = fma(z, y, x); elseif (a <= 1.35e+207) tmp = fma(t, a, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a * z), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[a, -2e+52], t$95$1, If[LessEqual[a, 1.2e-44], N[(z * y + x), $MachinePrecision], If[LessEqual[a, 1.35e+207], N[(t * a + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a \cdot z\right) \cdot b\\
\mathbf{if}\;a \leq -2 \cdot 10^{+52}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.2 \cdot 10^{-44}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{elif}\;a \leq 1.35 \cdot 10^{+207}:\\
\;\;\;\;\mathsf{fma}\left(t, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -2e52 or 1.35000000000000012e207 < a Initial program 92.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6450.2
Applied rewrites50.2%
Taylor expanded in y around 0
lower-*.f6426.8
Applied rewrites26.8%
Taylor expanded in y around 0
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f6427.7
Applied rewrites27.7%
if -2e52 < a < 1.20000000000000004e-44Initial program 92.6%
Taylor expanded in y around 0
distribute-lft-outN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6475.1
Applied rewrites75.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
+-commutativeN/A
lower-/.f64N/A
lift-fma.f6466.8
Applied rewrites66.8%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6452.3
Applied rewrites52.3%
if 1.20000000000000004e-44 < a < 1.35000000000000012e207Initial program 92.6%
Taylor expanded in y around 0
distribute-lft-outN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6475.1
Applied rewrites75.1%
Taylor expanded in z around 0
Applied rewrites52.7%
(FPCore (x y z t a b) :precision binary64 (if (<= t -3.3e-14) (fma t a x) (if (<= t 3.7e+36) (fma z y x) (fma t a x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -3.3e-14) {
tmp = fma(t, a, x);
} else if (t <= 3.7e+36) {
tmp = fma(z, y, x);
} else {
tmp = fma(t, a, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -3.3e-14) tmp = fma(t, a, x); elseif (t <= 3.7e+36) tmp = fma(z, y, x); else tmp = fma(t, a, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -3.3e-14], N[(t * a + x), $MachinePrecision], If[LessEqual[t, 3.7e+36], N[(z * y + x), $MachinePrecision], N[(t * a + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.3 \cdot 10^{-14}:\\
\;\;\;\;\mathsf{fma}\left(t, a, x\right)\\
\mathbf{elif}\;t \leq 3.7 \cdot 10^{+36}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t, a, x\right)\\
\end{array}
\end{array}
if t < -3.2999999999999998e-14 or 3.70000000000000029e36 < t Initial program 92.6%
Taylor expanded in y around 0
distribute-lft-outN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6475.1
Applied rewrites75.1%
Taylor expanded in z around 0
Applied rewrites52.7%
if -3.2999999999999998e-14 < t < 3.70000000000000029e36Initial program 92.6%
Taylor expanded in y around 0
distribute-lft-outN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6475.1
Applied rewrites75.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
+-commutativeN/A
lower-/.f64N/A
lift-fma.f6466.8
Applied rewrites66.8%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6452.3
Applied rewrites52.3%
(FPCore (x y z t a b) :precision binary64 (if (<= a -5.2e+183) (* t a) (if (<= a 1.1e+99) (fma z y x) (* t a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -5.2e+183) {
tmp = t * a;
} else if (a <= 1.1e+99) {
tmp = fma(z, y, x);
} else {
tmp = t * a;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -5.2e+183) tmp = Float64(t * a); elseif (a <= 1.1e+99) tmp = fma(z, y, x); else tmp = Float64(t * a); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -5.2e+183], N[(t * a), $MachinePrecision], If[LessEqual[a, 1.1e+99], N[(z * y + x), $MachinePrecision], N[(t * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.2 \cdot 10^{+183}:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;a \leq 1.1 \cdot 10^{+99}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot a\\
\end{array}
\end{array}
if a < -5.1999999999999999e183 or 1.09999999999999989e99 < a Initial program 92.6%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6450.7
Applied rewrites50.7%
Taylor expanded in z around 0
Applied rewrites28.1%
if -5.1999999999999999e183 < a < 1.09999999999999989e99Initial program 92.6%
Taylor expanded in y around 0
distribute-lft-outN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6475.1
Applied rewrites75.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
+-commutativeN/A
lower-/.f64N/A
lift-fma.f6466.8
Applied rewrites66.8%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6452.3
Applied rewrites52.3%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -2.4e-45)
(* z y)
(if (<= z -6.5e-178)
(* t a)
(if (<= z 1.8e-141) (* 1.0 x) (if (<= z 3.75e+130) (* t a) (* z y))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -2.4e-45) {
tmp = z * y;
} else if (z <= -6.5e-178) {
tmp = t * a;
} else if (z <= 1.8e-141) {
tmp = 1.0 * x;
} else if (z <= 3.75e+130) {
tmp = t * a;
} else {
tmp = z * y;
}
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 <= (-2.4d-45)) then
tmp = z * y
else if (z <= (-6.5d-178)) then
tmp = t * a
else if (z <= 1.8d-141) then
tmp = 1.0d0 * x
else if (z <= 3.75d+130) then
tmp = t * a
else
tmp = z * y
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 <= -2.4e-45) {
tmp = z * y;
} else if (z <= -6.5e-178) {
tmp = t * a;
} else if (z <= 1.8e-141) {
tmp = 1.0 * x;
} else if (z <= 3.75e+130) {
tmp = t * a;
} else {
tmp = z * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -2.4e-45: tmp = z * y elif z <= -6.5e-178: tmp = t * a elif z <= 1.8e-141: tmp = 1.0 * x elif z <= 3.75e+130: tmp = t * a else: tmp = z * y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -2.4e-45) tmp = Float64(z * y); elseif (z <= -6.5e-178) tmp = Float64(t * a); elseif (z <= 1.8e-141) tmp = Float64(1.0 * x); elseif (z <= 3.75e+130) tmp = Float64(t * a); else tmp = Float64(z * y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -2.4e-45) tmp = z * y; elseif (z <= -6.5e-178) tmp = t * a; elseif (z <= 1.8e-141) tmp = 1.0 * x; elseif (z <= 3.75e+130) tmp = t * a; else tmp = z * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -2.4e-45], N[(z * y), $MachinePrecision], If[LessEqual[z, -6.5e-178], N[(t * a), $MachinePrecision], If[LessEqual[z, 1.8e-141], N[(1.0 * x), $MachinePrecision], If[LessEqual[z, 3.75e+130], N[(t * a), $MachinePrecision], N[(z * y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.4 \cdot 10^{-45}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;z \leq -6.5 \cdot 10^{-178}:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{-141}:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;z \leq 3.75 \cdot 10^{+130}:\\
\;\;\;\;t \cdot a\\
\mathbf{else}:\\
\;\;\;\;z \cdot y\\
\end{array}
\end{array}
if z < -2.3999999999999999e-45 or 3.7500000000000002e130 < z Initial program 92.6%
Taylor expanded in y around 0
distribute-lft-outN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6475.1
Applied rewrites75.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
+-commutativeN/A
lower-/.f64N/A
lift-fma.f6466.8
Applied rewrites66.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6427.7
Applied rewrites27.7%
if -2.3999999999999999e-45 < z < -6.5000000000000002e-178 or 1.80000000000000007e-141 < z < 3.7500000000000002e130Initial program 92.6%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6450.7
Applied rewrites50.7%
Taylor expanded in z around 0
Applied rewrites28.1%
if -6.5000000000000002e-178 < z < 1.80000000000000007e-141Initial program 92.6%
Taylor expanded in y around 0
distribute-lft-outN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6475.1
Applied rewrites75.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
+-commutativeN/A
lower-/.f64N/A
lift-fma.f6466.8
Applied rewrites66.8%
Taylor expanded in x around inf
Applied rewrites26.6%
(FPCore (x y z t a b) :precision binary64 (if (<= x -3.3e+75) (* 1.0 x) (if (<= x 1.15e+121) (* z y) (* 1.0 x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -3.3e+75) {
tmp = 1.0 * x;
} else if (x <= 1.15e+121) {
tmp = z * y;
} else {
tmp = 1.0 * x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (x <= (-3.3d+75)) then
tmp = 1.0d0 * x
else if (x <= 1.15d+121) then
tmp = z * y
else
tmp = 1.0d0 * x
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 <= -3.3e+75) {
tmp = 1.0 * x;
} else if (x <= 1.15e+121) {
tmp = z * y;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -3.3e+75: tmp = 1.0 * x elif x <= 1.15e+121: tmp = z * y else: tmp = 1.0 * x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -3.3e+75) tmp = Float64(1.0 * x); elseif (x <= 1.15e+121) tmp = Float64(z * y); else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (x <= -3.3e+75) tmp = 1.0 * x; elseif (x <= 1.15e+121) tmp = z * y; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -3.3e+75], N[(1.0 * x), $MachinePrecision], If[LessEqual[x, 1.15e+121], N[(z * y), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.3 \cdot 10^{+75}:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{+121}:\\
\;\;\;\;z \cdot y\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
\end{array}
if x < -3.29999999999999998e75 or 1.1499999999999999e121 < x Initial program 92.6%
Taylor expanded in y around 0
distribute-lft-outN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6475.1
Applied rewrites75.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
+-commutativeN/A
lower-/.f64N/A
lift-fma.f6466.8
Applied rewrites66.8%
Taylor expanded in x around inf
Applied rewrites26.6%
if -3.29999999999999998e75 < x < 1.1499999999999999e121Initial program 92.6%
Taylor expanded in y around 0
distribute-lft-outN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6475.1
Applied rewrites75.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
+-commutativeN/A
lower-/.f64N/A
lift-fma.f6466.8
Applied rewrites66.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6427.7
Applied rewrites27.7%
(FPCore (x y z t a b) :precision binary64 (* 1.0 x))
double code(double x, double y, double z, double t, double a, double b) {
return 1.0 * x;
}
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 = 1.0d0 * x
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return 1.0 * x;
}
def code(x, y, z, t, a, b): return 1.0 * x
function code(x, y, z, t, a, b) return Float64(1.0 * x) end
function tmp = code(x, y, z, t, a, b) tmp = 1.0 * x; end
code[x_, y_, z_, t_, a_, b_] := N[(1.0 * x), $MachinePrecision]
\begin{array}{l}
\\
1 \cdot x
\end{array}
Initial program 92.6%
Taylor expanded in y around 0
distribute-lft-outN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6475.1
Applied rewrites75.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
+-commutativeN/A
lower-/.f64N/A
lift-fma.f6466.8
Applied rewrites66.8%
Taylor expanded in x around inf
Applied rewrites26.6%
herbie shell --seed 2025136
(FPCore (x y z t a b)
:name "Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1"
:precision binary64
(+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))