
(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 13 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 (if (<= t -1e+179) (fma z y (fma t a x)) (fma a (+ t (* b z)) (fma z y x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -1e+179) {
tmp = fma(z, y, fma(t, a, x));
} else {
tmp = fma(a, (t + (b * z)), fma(z, y, x));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -1e+179) tmp = fma(z, y, fma(t, a, x)); else tmp = fma(a, Float64(t + Float64(b * z)), fma(z, y, x)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -1e+179], N[(z * y + N[(t * a + x), $MachinePrecision]), $MachinePrecision], N[(a * N[(t + N[(b * z), $MachinePrecision]), $MachinePrecision] + N[(z * y + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1 \cdot 10^{+179}:\\
\;\;\;\;\mathsf{fma}\left(z, y, \mathsf{fma}\left(t, a, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, t + b \cdot z, \mathsf{fma}\left(z, y, x\right)\right)\\
\end{array}
\end{array}
if t < -9.9999999999999998e178Initial program 92.6%
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6495.9
Applied rewrites95.9%
Taylor expanded in z around 0
Applied rewrites77.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6477.4
Applied rewrites77.4%
if -9.9999999999999998e178 < t Initial program 92.6%
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6494.8
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6494.8
Applied rewrites94.8%
(FPCore (x y z t a b) :precision binary64 (fma z y (+ x (* a (+ t (* b z))))))
double code(double x, double y, double z, double t, double a, double b) {
return fma(z, y, (x + (a * (t + (b * z)))));
}
function code(x, y, z, t, a, b) return fma(z, y, Float64(x + Float64(a * Float64(t + Float64(b * z))))) end
code[x_, y_, z_, t_, a_, b_] := N[(z * y + N[(x + N[(a * N[(t + N[(b * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z, y, x + a \cdot \left(t + b \cdot z\right)\right)
\end{array}
Initial program 92.6%
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6495.9
Applied rewrites95.9%
(FPCore (x y z t a b) :precision binary64 (if (<= b -2e+95) (+ (+ x (* a t)) (* (* a z) b)) (if (<= b 1.25e+117) (fma z y (fma t a x)) (fma (fma b z t) a x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -2e+95) {
tmp = (x + (a * t)) + ((a * z) * b);
} else if (b <= 1.25e+117) {
tmp = fma(z, y, fma(t, a, x));
} else {
tmp = fma(fma(b, z, t), a, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -2e+95) tmp = Float64(Float64(x + Float64(a * t)) + Float64(Float64(a * z) * b)); elseif (b <= 1.25e+117) tmp = fma(z, y, fma(t, a, x)); else tmp = fma(fma(b, z, t), a, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -2e+95], N[(N[(x + N[(a * t), $MachinePrecision]), $MachinePrecision] + N[(N[(a * z), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.25e+117], N[(z * y + N[(t * a + x), $MachinePrecision]), $MachinePrecision], N[(N[(b * z + t), $MachinePrecision] * a + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2 \cdot 10^{+95}:\\
\;\;\;\;\left(x + a \cdot t\right) + \left(a \cdot z\right) \cdot b\\
\mathbf{elif}\;b \leq 1.25 \cdot 10^{+117}:\\
\;\;\;\;\mathsf{fma}\left(z, y, \mathsf{fma}\left(t, a, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, z, t\right), a, x\right)\\
\end{array}
\end{array}
if b < -2.00000000000000004e95Initial program 92.6%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f6472.5
Applied rewrites72.5%
if -2.00000000000000004e95 < b < 1.24999999999999996e117Initial program 92.6%
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6495.9
Applied rewrites95.9%
Taylor expanded in z around 0
Applied rewrites77.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6477.4
Applied rewrites77.4%
if 1.24999999999999996e117 < b Initial program 92.6%
Taylor expanded in y around 0
lower-+.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6474.5
Applied rewrites74.5%
lift-+.f64N/A
add-flipN/A
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
lift-+.f64N/A
lift-*.f64N/A
add-flipN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6475.2
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6475.2
Applied rewrites75.2%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (fma z y (fma t a x)))) (if (<= y -4.4e+35) t_1 (if (<= y 2.4e-35) (fma (fma b z t) a x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(z, y, fma(t, a, x));
double tmp;
if (y <= -4.4e+35) {
tmp = t_1;
} else if (y <= 2.4e-35) {
tmp = fma(fma(b, z, t), a, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(z, y, fma(t, a, x)) tmp = 0.0 if (y <= -4.4e+35) tmp = t_1; elseif (y <= 2.4e-35) tmp = fma(fma(b, z, t), a, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z * y + N[(t * a + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.4e+35], t$95$1, If[LessEqual[y, 2.4e-35], N[(N[(b * z + t), $MachinePrecision] * a + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z, y, \mathsf{fma}\left(t, a, x\right)\right)\\
\mathbf{if}\;y \leq -4.4 \cdot 10^{+35}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.4 \cdot 10^{-35}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, z, t\right), a, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -4.3999999999999997e35 or 2.4000000000000001e-35 < y Initial program 92.6%
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6495.9
Applied rewrites95.9%
Taylor expanded in z around 0
Applied rewrites77.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6477.4
Applied rewrites77.4%
if -4.3999999999999997e35 < y < 2.4000000000000001e-35Initial program 92.6%
Taylor expanded in y around 0
lower-+.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6474.5
Applied rewrites74.5%
lift-+.f64N/A
add-flipN/A
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
lift-+.f64N/A
lift-*.f64N/A
add-flipN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6475.2
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6475.2
Applied rewrites75.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (fma a b y) z)))
(if (<= z -1.25e+106)
t_1
(if (<= z 3.3e-16)
(fma (fma b z t) a x)
(if (<= z 2.55e+122) (fma y z x) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(a, b, y) * z;
double tmp;
if (z <= -1.25e+106) {
tmp = t_1;
} else if (z <= 3.3e-16) {
tmp = fma(fma(b, z, t), a, x);
} else if (z <= 2.55e+122) {
tmp = fma(y, z, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(fma(a, b, y) * z) tmp = 0.0 if (z <= -1.25e+106) tmp = t_1; elseif (z <= 3.3e-16) tmp = fma(fma(b, z, t), a, x); elseif (z <= 2.55e+122) tmp = 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[(a * b + y), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -1.25e+106], t$95$1, If[LessEqual[z, 3.3e-16], N[(N[(b * z + t), $MachinePrecision] * a + x), $MachinePrecision], If[LessEqual[z, 2.55e+122], N[(y * z + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, b, y\right) \cdot z\\
\mathbf{if}\;z \leq -1.25 \cdot 10^{+106}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{-16}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, z, t\right), a, x\right)\\
\mathbf{elif}\;z \leq 2.55 \cdot 10^{+122}:\\
\;\;\;\;\mathsf{fma}\left(y, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.25e106 or 2.55e122 < z Initial program 92.6%
Taylor expanded in z around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6450.1
Applied rewrites50.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6450.1
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6450.1
Applied rewrites50.1%
if -1.25e106 < z < 3.29999999999999988e-16Initial program 92.6%
Taylor expanded in y around 0
lower-+.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6474.5
Applied rewrites74.5%
lift-+.f64N/A
add-flipN/A
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
lift-+.f64N/A
lift-*.f64N/A
add-flipN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6475.2
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6475.2
Applied rewrites75.2%
if 3.29999999999999988e-16 < z < 2.55e122Initial program 92.6%
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6495.9
Applied rewrites95.9%
lift-fma.f64N/A
+-commutativeN/A
lift-+.f64N/A
sum-to-multN/A
lower-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6484.6
Applied rewrites84.6%
Taylor expanded in a around 0
lower-+.f64N/A
lower-*.f6452.2
Applied rewrites52.2%
Applied rewrites52.2%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -8e-62)
(* z (+ y (* a b)))
(if (<= z 6e-77)
(+ x (* a t))
(if (<= z 2.55e+122) (fma y z x) (* (fma a b y) z)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -8e-62) {
tmp = z * (y + (a * b));
} else if (z <= 6e-77) {
tmp = x + (a * t);
} else if (z <= 2.55e+122) {
tmp = fma(y, z, x);
} else {
tmp = fma(a, b, y) * z;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -8e-62) tmp = Float64(z * Float64(y + Float64(a * b))); elseif (z <= 6e-77) tmp = Float64(x + Float64(a * t)); elseif (z <= 2.55e+122) tmp = fma(y, z, x); else tmp = Float64(fma(a, b, y) * z); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -8e-62], N[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6e-77], N[(x + N[(a * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.55e+122], N[(y * z + x), $MachinePrecision], N[(N[(a * b + y), $MachinePrecision] * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8 \cdot 10^{-62}:\\
\;\;\;\;z \cdot \left(y + a \cdot b\right)\\
\mathbf{elif}\;z \leq 6 \cdot 10^{-77}:\\
\;\;\;\;x + a \cdot t\\
\mathbf{elif}\;z \leq 2.55 \cdot 10^{+122}:\\
\;\;\;\;\mathsf{fma}\left(y, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, b, y\right) \cdot z\\
\end{array}
\end{array}
if z < -8.0000000000000003e-62Initial program 92.6%
Taylor expanded in z around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6450.1
Applied rewrites50.1%
if -8.0000000000000003e-62 < z < 6.00000000000000033e-77Initial program 92.6%
Taylor expanded in a around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6450.8
Applied rewrites50.8%
Taylor expanded in z around 0
Applied rewrites28.3%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f6452.9
Applied rewrites52.9%
if 6.00000000000000033e-77 < z < 2.55e122Initial program 92.6%
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6495.9
Applied rewrites95.9%
lift-fma.f64N/A
+-commutativeN/A
lift-+.f64N/A
sum-to-multN/A
lower-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6484.6
Applied rewrites84.6%
Taylor expanded in a around 0
lower-+.f64N/A
lower-*.f6452.2
Applied rewrites52.2%
Applied rewrites52.2%
if 2.55e122 < z Initial program 92.6%
Taylor expanded in z around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6450.1
Applied rewrites50.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6450.1
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6450.1
Applied rewrites50.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (fma a b y) z)))
(if (<= z -8e-62)
t_1
(if (<= z 6e-77) (+ x (* a t)) (if (<= z 2.55e+122) (fma y z x) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(a, b, y) * z;
double tmp;
if (z <= -8e-62) {
tmp = t_1;
} else if (z <= 6e-77) {
tmp = x + (a * t);
} else if (z <= 2.55e+122) {
tmp = fma(y, z, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(fma(a, b, y) * z) tmp = 0.0 if (z <= -8e-62) tmp = t_1; elseif (z <= 6e-77) tmp = Float64(x + Float64(a * t)); elseif (z <= 2.55e+122) tmp = 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[(a * b + y), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -8e-62], t$95$1, If[LessEqual[z, 6e-77], N[(x + N[(a * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.55e+122], N[(y * z + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, b, y\right) \cdot z\\
\mathbf{if}\;z \leq -8 \cdot 10^{-62}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 6 \cdot 10^{-77}:\\
\;\;\;\;x + a \cdot t\\
\mathbf{elif}\;z \leq 2.55 \cdot 10^{+122}:\\
\;\;\;\;\mathsf{fma}\left(y, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -8.0000000000000003e-62 or 2.55e122 < z Initial program 92.6%
Taylor expanded in z around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6450.1
Applied rewrites50.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6450.1
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6450.1
Applied rewrites50.1%
if -8.0000000000000003e-62 < z < 6.00000000000000033e-77Initial program 92.6%
Taylor expanded in a around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6450.8
Applied rewrites50.8%
Taylor expanded in z around 0
Applied rewrites28.3%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f6452.9
Applied rewrites52.9%
if 6.00000000000000033e-77 < z < 2.55e122Initial program 92.6%
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6495.9
Applied rewrites95.9%
lift-fma.f64N/A
+-commutativeN/A
lift-+.f64N/A
sum-to-multN/A
lower-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6484.6
Applied rewrites84.6%
Taylor expanded in a around 0
lower-+.f64N/A
lower-*.f6452.2
Applied rewrites52.2%
Applied rewrites52.2%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -6.3e+271)
(* z (* a b))
(if (<= z -8.5e+105)
(fma y z x)
(if (<= z 6e-77) (+ x (* a t)) (fma y z x)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -6.3e+271) {
tmp = z * (a * b);
} else if (z <= -8.5e+105) {
tmp = fma(y, z, x);
} else if (z <= 6e-77) {
tmp = x + (a * t);
} else {
tmp = fma(y, z, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -6.3e+271) tmp = Float64(z * Float64(a * b)); elseif (z <= -8.5e+105) tmp = fma(y, z, x); elseif (z <= 6e-77) tmp = Float64(x + Float64(a * t)); else tmp = fma(y, z, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -6.3e+271], N[(z * N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -8.5e+105], N[(y * z + x), $MachinePrecision], If[LessEqual[z, 6e-77], N[(x + N[(a * t), $MachinePrecision]), $MachinePrecision], N[(y * z + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.3 \cdot 10^{+271}:\\
\;\;\;\;z \cdot \left(a \cdot b\right)\\
\mathbf{elif}\;z \leq -8.5 \cdot 10^{+105}:\\
\;\;\;\;\mathsf{fma}\left(y, z, x\right)\\
\mathbf{elif}\;z \leq 6 \cdot 10^{-77}:\\
\;\;\;\;x + a \cdot t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, z, x\right)\\
\end{array}
\end{array}
if z < -6.2999999999999999e271Initial program 92.6%
Taylor expanded in z around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6450.1
Applied rewrites50.1%
Taylor expanded in y around 0
lower-*.f6426.9
Applied rewrites26.9%
if -6.2999999999999999e271 < z < -8.49999999999999986e105 or 6.00000000000000033e-77 < z Initial program 92.6%
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6495.9
Applied rewrites95.9%
lift-fma.f64N/A
+-commutativeN/A
lift-+.f64N/A
sum-to-multN/A
lower-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6484.6
Applied rewrites84.6%
Taylor expanded in a around 0
lower-+.f64N/A
lower-*.f6452.2
Applied rewrites52.2%
Applied rewrites52.2%
if -8.49999999999999986e105 < z < 6.00000000000000033e-77Initial program 92.6%
Taylor expanded in a around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6450.8
Applied rewrites50.8%
Taylor expanded in z around 0
Applied rewrites28.3%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f6452.9
Applied rewrites52.9%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -3.5e+272)
(* a (* b z))
(if (<= z -8.5e+105)
(fma y z x)
(if (<= z 6e-77) (+ x (* a t)) (fma y z x)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -3.5e+272) {
tmp = a * (b * z);
} else if (z <= -8.5e+105) {
tmp = fma(y, z, x);
} else if (z <= 6e-77) {
tmp = x + (a * t);
} else {
tmp = fma(y, z, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -3.5e+272) tmp = Float64(a * Float64(b * z)); elseif (z <= -8.5e+105) tmp = fma(y, z, x); elseif (z <= 6e-77) tmp = Float64(x + Float64(a * t)); else tmp = fma(y, z, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -3.5e+272], N[(a * N[(b * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -8.5e+105], N[(y * z + x), $MachinePrecision], If[LessEqual[z, 6e-77], N[(x + N[(a * t), $MachinePrecision]), $MachinePrecision], N[(y * z + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{+272}:\\
\;\;\;\;a \cdot \left(b \cdot z\right)\\
\mathbf{elif}\;z \leq -8.5 \cdot 10^{+105}:\\
\;\;\;\;\mathsf{fma}\left(y, z, x\right)\\
\mathbf{elif}\;z \leq 6 \cdot 10^{-77}:\\
\;\;\;\;x + a \cdot t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, z, x\right)\\
\end{array}
\end{array}
if z < -3.50000000000000023e272Initial program 92.6%
Taylor expanded in z around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6450.1
Applied rewrites50.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6450.1
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6450.1
Applied rewrites50.1%
Taylor expanded in y around 0
lower-*.f64N/A
lower-*.f6427.0
Applied rewrites27.0%
if -3.50000000000000023e272 < z < -8.49999999999999986e105 or 6.00000000000000033e-77 < z Initial program 92.6%
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6495.9
Applied rewrites95.9%
lift-fma.f64N/A
+-commutativeN/A
lift-+.f64N/A
sum-to-multN/A
lower-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6484.6
Applied rewrites84.6%
Taylor expanded in a around 0
lower-+.f64N/A
lower-*.f6452.2
Applied rewrites52.2%
Applied rewrites52.2%
if -8.49999999999999986e105 < z < 6.00000000000000033e-77Initial program 92.6%
Taylor expanded in a around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6450.8
Applied rewrites50.8%
Taylor expanded in z around 0
Applied rewrites28.3%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f6452.9
Applied rewrites52.9%
(FPCore (x y z t a b) :precision binary64 (if (<= z -8.5e+105) (fma y z x) (if (<= z 6e-77) (+ x (* a t)) (fma y z x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -8.5e+105) {
tmp = fma(y, z, x);
} else if (z <= 6e-77) {
tmp = x + (a * t);
} else {
tmp = fma(y, z, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -8.5e+105) tmp = fma(y, z, x); elseif (z <= 6e-77) tmp = Float64(x + Float64(a * t)); else tmp = fma(y, z, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -8.5e+105], N[(y * z + x), $MachinePrecision], If[LessEqual[z, 6e-77], N[(x + N[(a * t), $MachinePrecision]), $MachinePrecision], N[(y * z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.5 \cdot 10^{+105}:\\
\;\;\;\;\mathsf{fma}\left(y, z, x\right)\\
\mathbf{elif}\;z \leq 6 \cdot 10^{-77}:\\
\;\;\;\;x + a \cdot t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, z, x\right)\\
\end{array}
\end{array}
if z < -8.49999999999999986e105 or 6.00000000000000033e-77 < z Initial program 92.6%
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6495.9
Applied rewrites95.9%
lift-fma.f64N/A
+-commutativeN/A
lift-+.f64N/A
sum-to-multN/A
lower-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6484.6
Applied rewrites84.6%
Taylor expanded in a around 0
lower-+.f64N/A
lower-*.f6452.2
Applied rewrites52.2%
Applied rewrites52.2%
if -8.49999999999999986e105 < z < 6.00000000000000033e-77Initial program 92.6%
Taylor expanded in a around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6450.8
Applied rewrites50.8%
Taylor expanded in z around 0
Applied rewrites28.3%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f6452.9
Applied rewrites52.9%
(FPCore (x y z t a b) :precision binary64 (if (<= a -5.5e+107) (* a t) (if (<= a 1.8e+178) (fma y z x) (* a t))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -5.5e+107) {
tmp = a * t;
} else if (a <= 1.8e+178) {
tmp = fma(y, z, x);
} else {
tmp = a * t;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -5.5e+107) tmp = Float64(a * t); elseif (a <= 1.8e+178) tmp = fma(y, z, x); else tmp = Float64(a * t); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -5.5e+107], N[(a * t), $MachinePrecision], If[LessEqual[a, 1.8e+178], N[(y * z + x), $MachinePrecision], N[(a * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.5 \cdot 10^{+107}:\\
\;\;\;\;a \cdot t\\
\mathbf{elif}\;a \leq 1.8 \cdot 10^{+178}:\\
\;\;\;\;\mathsf{fma}\left(y, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot t\\
\end{array}
\end{array}
if a < -5.5000000000000003e107 or 1.7999999999999999e178 < a Initial program 92.6%
Taylor expanded in a around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6450.8
Applied rewrites50.8%
Taylor expanded in z around 0
Applied rewrites28.3%
if -5.5000000000000003e107 < a < 1.7999999999999999e178Initial program 92.6%
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6495.9
Applied rewrites95.9%
lift-fma.f64N/A
+-commutativeN/A
lift-+.f64N/A
sum-to-multN/A
lower-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6484.6
Applied rewrites84.6%
Taylor expanded in a around 0
lower-+.f64N/A
lower-*.f6452.2
Applied rewrites52.2%
Applied rewrites52.2%
(FPCore (x y z t a b) :precision binary64 (if (<= z -8.5e+105) (* z y) (if (<= z 6.5e-79) (* a t) (* z y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -8.5e+105) {
tmp = z * y;
} else if (z <= 6.5e-79) {
tmp = a * t;
} 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 <= (-8.5d+105)) then
tmp = z * y
else if (z <= 6.5d-79) then
tmp = a * t
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 <= -8.5e+105) {
tmp = z * y;
} else if (z <= 6.5e-79) {
tmp = a * t;
} else {
tmp = z * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -8.5e+105: tmp = z * y elif z <= 6.5e-79: tmp = a * t else: tmp = z * y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -8.5e+105) tmp = Float64(z * y); elseif (z <= 6.5e-79) tmp = Float64(a * t); else tmp = Float64(z * y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -8.5e+105) tmp = z * y; elseif (z <= 6.5e-79) tmp = a * t; else tmp = z * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -8.5e+105], N[(z * y), $MachinePrecision], If[LessEqual[z, 6.5e-79], N[(a * t), $MachinePrecision], N[(z * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.5 \cdot 10^{+105}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{-79}:\\
\;\;\;\;a \cdot t\\
\mathbf{else}:\\
\;\;\;\;z \cdot y\\
\end{array}
\end{array}
if z < -8.49999999999999986e105 or 6.5000000000000003e-79 < z Initial program 92.6%
Taylor expanded in z around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6450.1
Applied rewrites50.1%
lift-*.f64N/A
lift-+.f64N/A
sum-to-multN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6446.5
Applied rewrites46.5%
Taylor expanded in y around inf
Applied rewrites27.6%
if -8.49999999999999986e105 < z < 6.5000000000000003e-79Initial program 92.6%
Taylor expanded in a around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6450.8
Applied rewrites50.8%
Taylor expanded in z around 0
Applied rewrites28.3%
(FPCore (x y z t a b) :precision binary64 (* a t))
double code(double x, double y, double z, double t, double a, double b) {
return a * t;
}
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 * t
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return a * t;
}
def code(x, y, z, t, a, b): return a * t
function code(x, y, z, t, a, b) return Float64(a * t) end
function tmp = code(x, y, z, t, a, b) tmp = a * t; end
code[x_, y_, z_, t_, a_, b_] := N[(a * t), $MachinePrecision]
\begin{array}{l}
\\
a \cdot t
\end{array}
Initial program 92.6%
Taylor expanded in a around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6450.8
Applied rewrites50.8%
Taylor expanded in z around 0
Applied rewrites28.3%
herbie shell --seed 2025156
(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)))