
(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]
\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b
Herbie found 12 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]
\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b
(FPCore (x y z t a b) :precision binary64 (if (<= a 2.3e+163) (fma t a (fma z (fma b a y) 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 (a <= 2.3e+163) {
tmp = fma(t, a, fma(z, fma(b, a, y), x));
} else {
tmp = fma(fma(b, z, t), a, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= 2.3e+163) tmp = fma(t, a, fma(z, fma(b, a, y), x)); else tmp = fma(fma(b, z, t), a, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, 2.3e+163], N[(t * a + N[(z * N[(b * a + y), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], N[(N[(b * z + t), $MachinePrecision] * a + x), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;a \leq 2.3 \cdot 10^{+163}:\\
\;\;\;\;\mathsf{fma}\left(t, a, \mathsf{fma}\left(z, \mathsf{fma}\left(b, a, y\right), x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, z, t\right), a, x\right)\\
\end{array}
if a < 2.30000000000000002e163Initial program 92.3%
lift-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
distribute-rgt-outN/A
lower-fma.f64N/A
lower-fma.f6495.8
Applied rewrites95.8%
if 2.30000000000000002e163 < a Initial program 92.3%
Taylor expanded in y around 0
lower-+.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6475.0
Applied rewrites75.0%
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
lift-+.f64N/A
*-commutativeN/A
lower-fma.f6475.8
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6475.8
Applied rewrites75.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma (fma b z t) a x)))
(if (<= a -1.12e+63)
t_1
(if (<= a 6e+68)
(+ x (fma a t (* y z)))
(if (<= a 1.1e+163) (+ x (* z (+ y (* a b)))) 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 <= -1.12e+63) {
tmp = t_1;
} else if (a <= 6e+68) {
tmp = x + fma(a, t, (y * z));
} else if (a <= 1.1e+163) {
tmp = x + (z * (y + (a * b)));
} 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 <= -1.12e+63) tmp = t_1; elseif (a <= 6e+68) tmp = Float64(x + fma(a, t, Float64(y * z))); elseif (a <= 1.1e+163) tmp = Float64(x + Float64(z * Float64(y + Float64(a * b)))); 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, -1.12e+63], t$95$1, If[LessEqual[a, 6e+68], N[(x + N[(a * t + N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.1e+163], N[(x + N[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_1 := \mathsf{fma}\left(\mathsf{fma}\left(b, z, t\right), a, x\right)\\
\mathbf{if}\;a \leq -1.12 \cdot 10^{+63}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 6 \cdot 10^{+68}:\\
\;\;\;\;x + \mathsf{fma}\left(a, t, y \cdot z\right)\\
\mathbf{elif}\;a \leq 1.1 \cdot 10^{+163}:\\
\;\;\;\;x + z \cdot \left(y + a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if a < -1.12000000000000006e63 or 1.09999999999999993e163 < a Initial program 92.3%
Taylor expanded in y around 0
lower-+.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6475.0
Applied rewrites75.0%
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
lift-+.f64N/A
*-commutativeN/A
lower-fma.f6475.8
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6475.8
Applied rewrites75.8%
if -1.12000000000000006e63 < a < 6.0000000000000004e68Initial program 92.3%
lift-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
distribute-rgt-outN/A
lower-fma.f64N/A
lower-fma.f6495.8
Applied rewrites95.8%
Taylor expanded in x around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6471.1
Applied rewrites71.1%
Taylor expanded in b around 0
lower-+.f64N/A
lower-fma.f64N/A
lower-*.f6477.2
Applied rewrites77.2%
if 6.0000000000000004e68 < a < 1.09999999999999993e163Initial program 92.3%
lift-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
distribute-rgt-outN/A
lower-fma.f64N/A
lower-fma.f6495.8
Applied rewrites95.8%
Taylor expanded in x around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6471.1
Applied rewrites71.1%
Taylor expanded in b around 0
lower-+.f64N/A
lower-fma.f64N/A
lower-*.f6477.2
Applied rewrites77.2%
Taylor expanded in t around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6474.3
Applied rewrites74.3%
(FPCore (x y z t a b) :precision binary64 (if (<= z -2.1e-36) (fma t a (* (fma b a y) z)) (if (<= z 1.25e+27) (+ x (fma a t (* y z))) (+ x (* z (+ y (* a b)))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -2.1e-36) {
tmp = fma(t, a, (fma(b, a, y) * z));
} else if (z <= 1.25e+27) {
tmp = x + fma(a, t, (y * z));
} else {
tmp = x + (z * (y + (a * b)));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -2.1e-36) tmp = fma(t, a, Float64(fma(b, a, y) * z)); elseif (z <= 1.25e+27) tmp = Float64(x + fma(a, t, Float64(y * z))); else tmp = Float64(x + Float64(z * Float64(y + Float64(a * b)))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -2.1e-36], N[(t * a + N[(N[(b * a + y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.25e+27], N[(x + N[(a * t + N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -2.1 \cdot 10^{-36}:\\
\;\;\;\;\mathsf{fma}\left(t, a, \mathsf{fma}\left(b, a, y\right) \cdot z\right)\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{+27}:\\
\;\;\;\;x + \mathsf{fma}\left(a, t, y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(y + a \cdot b\right)\\
\end{array}
if z < -2.09999999999999991e-36Initial program 92.3%
lift-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
distribute-rgt-outN/A
lower-fma.f64N/A
lower-fma.f6495.8
Applied rewrites95.8%
Taylor expanded in x around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6471.1
Applied rewrites71.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.1
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6471.1
Applied rewrites71.1%
if -2.09999999999999991e-36 < z < 1.24999999999999995e27Initial program 92.3%
lift-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
distribute-rgt-outN/A
lower-fma.f64N/A
lower-fma.f6495.8
Applied rewrites95.8%
Taylor expanded in x around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6471.1
Applied rewrites71.1%
Taylor expanded in b around 0
lower-+.f64N/A
lower-fma.f64N/A
lower-*.f6477.2
Applied rewrites77.2%
if 1.24999999999999995e27 < z Initial program 92.3%
lift-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
distribute-rgt-outN/A
lower-fma.f64N/A
lower-fma.f6495.8
Applied rewrites95.8%
Taylor expanded in x around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6471.1
Applied rewrites71.1%
Taylor expanded in b around 0
lower-+.f64N/A
lower-fma.f64N/A
lower-*.f6477.2
Applied rewrites77.2%
Taylor expanded in t around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6474.3
Applied rewrites74.3%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (fma (fma b z t) a x))) (if (<= a -1.12e+63) t_1 (if (<= a 2.95) (+ x (fma a t (* y z))) 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 <= -1.12e+63) {
tmp = t_1;
} else if (a <= 2.95) {
tmp = x + fma(a, t, (y * z));
} 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 <= -1.12e+63) tmp = t_1; elseif (a <= 2.95) tmp = Float64(x + fma(a, t, Float64(y * z))); 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, -1.12e+63], t$95$1, If[LessEqual[a, 2.95], N[(x + N[(a * t + N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \mathsf{fma}\left(\mathsf{fma}\left(b, z, t\right), a, x\right)\\
\mathbf{if}\;a \leq -1.12 \cdot 10^{+63}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 2.95:\\
\;\;\;\;x + \mathsf{fma}\left(a, t, y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if a < -1.12000000000000006e63 or 2.9500000000000002 < a Initial program 92.3%
Taylor expanded in y around 0
lower-+.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6475.0
Applied rewrites75.0%
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
lift-+.f64N/A
*-commutativeN/A
lower-fma.f6475.8
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6475.8
Applied rewrites75.8%
if -1.12000000000000006e63 < a < 2.9500000000000002Initial program 92.3%
lift-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
distribute-rgt-outN/A
lower-fma.f64N/A
lower-fma.f6495.8
Applied rewrites95.8%
Taylor expanded in x around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6471.1
Applied rewrites71.1%
Taylor expanded in b around 0
lower-+.f64N/A
lower-fma.f64N/A
lower-*.f6477.2
Applied rewrites77.2%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (fma a t (* y z)))) (if (<= y -3.7e+136) t_1 (if (<= y 1.72e+59) (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(a, t, (y * z));
double tmp;
if (y <= -3.7e+136) {
tmp = t_1;
} else if (y <= 1.72e+59) {
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(a, t, Float64(y * z)) tmp = 0.0 if (y <= -3.7e+136) tmp = t_1; elseif (y <= 1.72e+59) 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[(a * t + N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.7e+136], t$95$1, If[LessEqual[y, 1.72e+59], N[(N[(b * z + t), $MachinePrecision] * a + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, t, y \cdot z\right)\\
\mathbf{if}\;y \leq -3.7 \cdot 10^{+136}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.72 \cdot 10^{+59}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, z, t\right), a, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if y < -3.7000000000000001e136 or 1.71999999999999996e59 < y Initial program 92.3%
lift-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
distribute-rgt-outN/A
lower-fma.f64N/A
lower-fma.f6495.8
Applied rewrites95.8%
Taylor expanded in x around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6471.1
Applied rewrites71.1%
Taylor expanded in b around 0
lower-+.f64N/A
lower-fma.f64N/A
lower-*.f6477.2
Applied rewrites77.2%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-*.f6452.5
Applied rewrites52.5%
if -3.7000000000000001e136 < y < 1.71999999999999996e59Initial program 92.3%
Taylor expanded in y around 0
lower-+.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6475.0
Applied rewrites75.0%
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
lift-+.f64N/A
*-commutativeN/A
lower-fma.f6475.8
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6475.8
Applied rewrites75.8%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (fma b a y) z))) (if (<= z -1.6e-29) t_1 (if (<= z 1.25e-9) (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 <= -1.6e-29) {
tmp = t_1;
} else if (z <= 1.25e-9) {
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 <= -1.6e-29) tmp = t_1; elseif (z <= 1.25e-9) 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, -1.6e-29], t$95$1, If[LessEqual[z, 1.25e-9], N[(t * a + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \mathsf{fma}\left(b, a, y\right) \cdot z\\
\mathbf{if}\;z \leq -1.6 \cdot 10^{-29}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{-9}:\\
\;\;\;\;\mathsf{fma}\left(t, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if z < -1.6e-29 or 1.25e-9 < z Initial program 92.3%
Taylor expanded in z around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6449.9
Applied rewrites49.9%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6449.9
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-fma.f6449.9
Applied rewrites49.9%
if -1.6e-29 < z < 1.25e-9Initial program 92.3%
lift-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
distribute-rgt-outN/A
lower-fma.f64N/A
lower-fma.f6495.8
Applied rewrites95.8%
Taylor expanded in x around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6471.1
Applied rewrites71.1%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f6453.0
Applied rewrites53.0%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f6453.0
Applied rewrites53.0%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (fma a t (* y z)))) (if (<= t -1.8e+53) t_1 (if (<= t 1.35e+53) (+ x (* y z)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(a, t, (y * z));
double tmp;
if (t <= -1.8e+53) {
tmp = t_1;
} else if (t <= 1.35e+53) {
tmp = x + (y * z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(a, t, Float64(y * z)) tmp = 0.0 if (t <= -1.8e+53) tmp = t_1; elseif (t <= 1.35e+53) tmp = Float64(x + Float64(y * z)); 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), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.8e+53], t$95$1, If[LessEqual[t, 1.35e+53], N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, t, y \cdot z\right)\\
\mathbf{if}\;t \leq -1.8 \cdot 10^{+53}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.35 \cdot 10^{+53}:\\
\;\;\;\;x + y \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if t < -1.8e53 or 1.3500000000000001e53 < t Initial program 92.3%
lift-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
distribute-rgt-outN/A
lower-fma.f64N/A
lower-fma.f6495.8
Applied rewrites95.8%
Taylor expanded in x around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6471.1
Applied rewrites71.1%
Taylor expanded in b around 0
lower-+.f64N/A
lower-fma.f64N/A
lower-*.f6477.2
Applied rewrites77.2%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-*.f6452.5
Applied rewrites52.5%
if -1.8e53 < t < 1.3500000000000001e53Initial program 92.3%
lift-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
distribute-rgt-outN/A
lower-fma.f64N/A
lower-fma.f6495.8
Applied rewrites95.8%
Taylor expanded in x around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6471.1
Applied rewrites71.1%
Taylor expanded in a around 0
lower-+.f64N/A
lower-*.f6451.7
Applied rewrites51.7%
(FPCore (x y z t a b) :precision binary64 (if (<= t -4.6e+53) (fma t a x) (if (<= t 66000000000000.0) (+ x (* y z)) (fma t a x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -4.6e+53) {
tmp = fma(t, a, x);
} else if (t <= 66000000000000.0) {
tmp = x + (y * z);
} else {
tmp = fma(t, a, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -4.6e+53) tmp = fma(t, a, x); elseif (t <= 66000000000000.0) tmp = Float64(x + Float64(y * z)); else tmp = fma(t, a, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -4.6e+53], N[(t * a + x), $MachinePrecision], If[LessEqual[t, 66000000000000.0], N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision], N[(t * a + x), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;t \leq -4.6 \cdot 10^{+53}:\\
\;\;\;\;\mathsf{fma}\left(t, a, x\right)\\
\mathbf{elif}\;t \leq 66000000000000:\\
\;\;\;\;x + y \cdot z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t, a, x\right)\\
\end{array}
if t < -4.60000000000000039e53 or 6.6e13 < t Initial program 92.3%
lift-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
distribute-rgt-outN/A
lower-fma.f64N/A
lower-fma.f6495.8
Applied rewrites95.8%
Taylor expanded in x around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6471.1
Applied rewrites71.1%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f6453.0
Applied rewrites53.0%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f6453.0
Applied rewrites53.0%
if -4.60000000000000039e53 < t < 6.6e13Initial program 92.3%
lift-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
distribute-rgt-outN/A
lower-fma.f64N/A
lower-fma.f6495.8
Applied rewrites95.8%
Taylor expanded in x around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6471.1
Applied rewrites71.1%
Taylor expanded in a around 0
lower-+.f64N/A
lower-*.f6451.7
Applied rewrites51.7%
(FPCore (x y z t a b) :precision binary64 (if (<= y -6.8e+118) (* y z) (if (<= y 2.15e+119) (fma t a x) (* y z))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -6.8e+118) {
tmp = y * z;
} else if (y <= 2.15e+119) {
tmp = fma(t, a, x);
} else {
tmp = y * z;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -6.8e+118) tmp = Float64(y * z); elseif (y <= 2.15e+119) tmp = fma(t, a, x); else tmp = Float64(y * z); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -6.8e+118], N[(y * z), $MachinePrecision], If[LessEqual[y, 2.15e+119], N[(t * a + x), $MachinePrecision], N[(y * z), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;y \leq -6.8 \cdot 10^{+118}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;y \leq 2.15 \cdot 10^{+119}:\\
\;\;\;\;\mathsf{fma}\left(t, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
if y < -6.79999999999999973e118 or 2.15000000000000016e119 < y Initial program 92.3%
lift-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
distribute-rgt-outN/A
lower-fma.f64N/A
lower-fma.f6495.8
Applied rewrites95.8%
Taylor expanded in y around inf
lower-*.f6427.2
Applied rewrites27.2%
if -6.79999999999999973e118 < y < 2.15000000000000016e119Initial program 92.3%
lift-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
distribute-rgt-outN/A
lower-fma.f64N/A
lower-fma.f6495.8
Applied rewrites95.8%
Taylor expanded in x around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6471.1
Applied rewrites71.1%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f6453.0
Applied rewrites53.0%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
+-commutativeN/A
lower-fma.f6453.0
Applied rewrites53.0%
(FPCore (x y z t a b) :precision binary64 (if (<= t -4.6e+53) (* a t) (if (<= t 66000000000000.0) (* y z) (* a t))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -4.6e+53) {
tmp = a * t;
} else if (t <= 66000000000000.0) {
tmp = y * z;
} else {
tmp = a * t;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (t <= (-4.6d+53)) then
tmp = a * t
else if (t <= 66000000000000.0d0) then
tmp = y * z
else
tmp = a * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -4.6e+53) {
tmp = a * t;
} else if (t <= 66000000000000.0) {
tmp = y * z;
} else {
tmp = a * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -4.6e+53: tmp = a * t elif t <= 66000000000000.0: tmp = y * z else: tmp = a * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -4.6e+53) tmp = Float64(a * t); elseif (t <= 66000000000000.0) tmp = Float64(y * z); else tmp = Float64(a * t); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -4.6e+53) tmp = a * t; elseif (t <= 66000000000000.0) tmp = y * z; else tmp = a * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -4.6e+53], N[(a * t), $MachinePrecision], If[LessEqual[t, 66000000000000.0], N[(y * z), $MachinePrecision], N[(a * t), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;t \leq -4.6 \cdot 10^{+53}:\\
\;\;\;\;a \cdot t\\
\mathbf{elif}\;t \leq 66000000000000:\\
\;\;\;\;y \cdot z\\
\mathbf{else}:\\
\;\;\;\;a \cdot t\\
\end{array}
if t < -4.60000000000000039e53 or 6.6e13 < t Initial program 92.3%
Taylor expanded in a around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6451.5
Applied rewrites51.5%
Taylor expanded in z around 0
Applied rewrites28.6%
if -4.60000000000000039e53 < t < 6.6e13Initial program 92.3%
lift-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
distribute-rgt-outN/A
lower-fma.f64N/A
lower-fma.f6495.8
Applied rewrites95.8%
Taylor expanded in y around inf
lower-*.f6427.2
Applied rewrites27.2%
(FPCore (x y z t a b) :precision binary64 (if (<= z -4.5e-11) (* y z) (if (<= z 2.9e-91) x (* y z))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -4.5e-11) {
tmp = y * z;
} else if (z <= 2.9e-91) {
tmp = x;
} else {
tmp = y * 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 <= (-4.5d-11)) then
tmp = y * z
else if (z <= 2.9d-91) then
tmp = x
else
tmp = y * 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 <= -4.5e-11) {
tmp = y * z;
} else if (z <= 2.9e-91) {
tmp = x;
} else {
tmp = y * z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -4.5e-11: tmp = y * z elif z <= 2.9e-91: tmp = x else: tmp = y * z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -4.5e-11) tmp = Float64(y * z); elseif (z <= 2.9e-91) tmp = x; else tmp = Float64(y * z); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -4.5e-11) tmp = y * z; elseif (z <= 2.9e-91) tmp = x; else tmp = y * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -4.5e-11], N[(y * z), $MachinePrecision], If[LessEqual[z, 2.9e-91], x, N[(y * z), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -4.5 \cdot 10^{-11}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{-91}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
if z < -4.5e-11 or 2.9000000000000001e-91 < z Initial program 92.3%
lift-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
distribute-rgt-outN/A
lower-fma.f64N/A
lower-fma.f6495.8
Applied rewrites95.8%
Taylor expanded in y around inf
lower-*.f6427.2
Applied rewrites27.2%
if -4.5e-11 < z < 2.9000000000000001e-91Initial program 92.3%
lift-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
distribute-rgt-outN/A
lower-fma.f64N/A
lower-fma.f6495.8
Applied rewrites95.8%
Taylor expanded in x around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6471.1
Applied rewrites71.1%
Taylor expanded in x around inf
Applied rewrites26.6%
(FPCore (x y z t a b) :precision binary64 x)
double code(double x, double y, double z, double t, double a, double b) {
return 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 = x
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x;
}
def code(x, y, z, t, a, b): return x
function code(x, y, z, t, a, b) return x end
function tmp = code(x, y, z, t, a, b) tmp = x; end
code[x_, y_, z_, t_, a_, b_] := x
x
Initial program 92.3%
lift-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
distribute-rgt-outN/A
lower-fma.f64N/A
lower-fma.f6495.8
Applied rewrites95.8%
Taylor expanded in x around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6471.1
Applied rewrites71.1%
Taylor expanded in x around inf
Applied rewrites26.6%
herbie shell --seed 2025167
(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)))