
(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 (<= b 1.6e+117) (fma (fma b a y) z (fma a t x)) (fma (fma z b t) a x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= 1.6e+117) {
tmp = fma(fma(b, a, y), z, fma(a, t, x));
} else {
tmp = fma(fma(z, b, t), a, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= 1.6e+117) tmp = fma(fma(b, a, y), z, fma(a, t, x)); else tmp = fma(fma(z, b, t), a, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, 1.6e+117], N[(N[(b * a + y), $MachinePrecision] * z + N[(a * t + x), $MachinePrecision]), $MachinePrecision], N[(N[(z * b + t), $MachinePrecision] * a + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.6 \cdot 10^{+117}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, a, y\right), z, \mathsf{fma}\left(a, t, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(z, b, t\right), a, x\right)\\
\end{array}
\end{array}
if b < 1.60000000000000002e117Initial program 92.6%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
sub-flipN/A
+-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
associate-+r+N/A
Applied rewrites94.4%
if 1.60000000000000002e117 < 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
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
lift-+.f64N/A
*-commutativeN/A
lower-fma.f6475.2
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-*.f64N/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f6475.2
Applied rewrites75.2%
(FPCore (x y z t a b) :precision binary64 (if (<= b -1.6e+96) (+ (+ x (* a t)) (* (* a z) b)) (if (<= b 1.3e+117) (fma z y (fma t a x)) (fma (fma z b t) a x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -1.6e+96) {
tmp = (x + (a * t)) + ((a * z) * b);
} else if (b <= 1.3e+117) {
tmp = fma(z, y, fma(t, a, x));
} else {
tmp = fma(fma(z, b, t), a, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -1.6e+96) tmp = Float64(Float64(x + Float64(a * t)) + Float64(Float64(a * z) * b)); elseif (b <= 1.3e+117) tmp = fma(z, y, fma(t, a, x)); else tmp = fma(fma(z, b, t), a, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -1.6e+96], N[(N[(x + N[(a * t), $MachinePrecision]), $MachinePrecision] + N[(N[(a * z), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.3e+117], N[(z * y + N[(t * a + x), $MachinePrecision]), $MachinePrecision], N[(N[(z * b + t), $MachinePrecision] * a + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.6 \cdot 10^{+96}:\\
\;\;\;\;\left(x + a \cdot t\right) + \left(a \cdot z\right) \cdot b\\
\mathbf{elif}\;b \leq 1.3 \cdot 10^{+117}:\\
\;\;\;\;\mathsf{fma}\left(z, y, \mathsf{fma}\left(t, a, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(z, b, t\right), a, x\right)\\
\end{array}
\end{array}
if b < -1.60000000000000003e96Initial program 92.6%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f6472.5
Applied rewrites72.5%
if -1.60000000000000003e96 < b < 1.3e117Initial program 92.6%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
sub-flipN/A
+-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
associate-+r+N/A
Applied rewrites94.4%
Taylor expanded in b around 0
lower-+.f64N/A
lower-fma.f64N/A
lower-*.f6477.4
Applied rewrites77.4%
lift-+.f64N/A
lift-fma.f64N/A
associate-+r+N/A
+-commutativeN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
add-flipN/A
sub-negate-revN/A
sub-flip-reverseN/A
*-commutativeN/A
+-commutativeN/A
distribute-neg-inN/A
*-commutativeN/A
remove-double-negN/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f6477.4
Applied rewrites77.4%
if 1.3e117 < 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
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
lift-+.f64N/A
*-commutativeN/A
lower-fma.f6475.2
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-*.f64N/A
*-commutativeN/A
remove-double-negN/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 -5.4e+35) t_1 (if (<= y 1.02e-35) (fma (fma z b 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 <= -5.4e+35) {
tmp = t_1;
} else if (y <= 1.02e-35) {
tmp = fma(fma(z, b, 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 <= -5.4e+35) tmp = t_1; elseif (y <= 1.02e-35) tmp = fma(fma(z, b, 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, -5.4e+35], t$95$1, If[LessEqual[y, 1.02e-35], N[(N[(z * b + 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 -5.4 \cdot 10^{+35}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.02 \cdot 10^{-35}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(z, b, t\right), a, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -5.40000000000000005e35 or 1.01999999999999995e-35 < y Initial program 92.6%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
sub-flipN/A
+-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
associate-+r+N/A
Applied rewrites94.4%
Taylor expanded in b around 0
lower-+.f64N/A
lower-fma.f64N/A
lower-*.f6477.4
Applied rewrites77.4%
lift-+.f64N/A
lift-fma.f64N/A
associate-+r+N/A
+-commutativeN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
add-flipN/A
sub-negate-revN/A
sub-flip-reverseN/A
*-commutativeN/A
+-commutativeN/A
distribute-neg-inN/A
*-commutativeN/A
remove-double-negN/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f6477.4
Applied rewrites77.4%
if -5.40000000000000005e35 < y < 1.01999999999999995e-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
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
distribute-lft-outN/A
lift-+.f64N/A
*-commutativeN/A
lower-fma.f6475.2
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-*.f64N/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f6475.2
Applied rewrites75.2%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (fma (fma a b y) z x))) (if (<= z -2.7e-92) t_1 (if (<= z 2.16e+117) (fma z y (fma t a x)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(fma(a, b, y), z, x);
double tmp;
if (z <= -2.7e-92) {
tmp = t_1;
} else if (z <= 2.16e+117) {
tmp = fma(z, y, fma(t, a, x));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(fma(a, b, y), z, x) tmp = 0.0 if (z <= -2.7e-92) tmp = t_1; elseif (z <= 2.16e+117) tmp = fma(z, y, 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 * b + y), $MachinePrecision] * z + x), $MachinePrecision]}, If[LessEqual[z, -2.7e-92], t$95$1, If[LessEqual[z, 2.16e+117], N[(z * y + N[(t * a + x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\mathsf{fma}\left(a, b, y\right), z, x\right)\\
\mathbf{if}\;z \leq -2.7 \cdot 10^{-92}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.16 \cdot 10^{+117}:\\
\;\;\;\;\mathsf{fma}\left(z, y, \mathsf{fma}\left(t, a, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.69999999999999995e-92 or 2.16e117 < z Initial program 92.6%
Taylor expanded in t around 0
lower-+.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6471.0
Applied rewrites71.0%
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
lift-*.f64N/A
*-commutativeN/A
lift-fma.f64N/A
*-commutativeN/A
add-flipN/A
sub-flipN/A
lift-fma.f64N/A
*-commutativeN/A
lift-*.f64N/A
+-commutativeN/A
lift-+.f64N/A
remove-double-negN/A
lower-fma.f6474.4
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6474.4
Applied rewrites74.4%
if -2.69999999999999995e-92 < z < 2.16e117Initial program 92.6%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
sub-flipN/A
+-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
associate-+r+N/A
Applied rewrites94.4%
Taylor expanded in b around 0
lower-+.f64N/A
lower-fma.f64N/A
lower-*.f6477.4
Applied rewrites77.4%
lift-+.f64N/A
lift-fma.f64N/A
associate-+r+N/A
+-commutativeN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
add-flipN/A
sub-negate-revN/A
sub-flip-reverseN/A
*-commutativeN/A
+-commutativeN/A
distribute-neg-inN/A
*-commutativeN/A
remove-double-negN/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f6477.4
Applied rewrites77.4%
(FPCore (x y z t a b) :precision binary64 (if (<= b -5.3e+181) (fma (* a b) z x) (if (<= b 2.3e+120) (fma z y (fma t a x)) (+ x (* a (* b z))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -5.3e+181) {
tmp = fma((a * b), z, x);
} else if (b <= 2.3e+120) {
tmp = fma(z, y, fma(t, a, x));
} else {
tmp = x + (a * (b * z));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -5.3e+181) tmp = fma(Float64(a * b), z, x); elseif (b <= 2.3e+120) tmp = fma(z, y, fma(t, a, x)); else tmp = Float64(x + Float64(a * Float64(b * z))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -5.3e+181], N[(N[(a * b), $MachinePrecision] * z + x), $MachinePrecision], If[LessEqual[b, 2.3e+120], N[(z * y + N[(t * a + x), $MachinePrecision]), $MachinePrecision], N[(x + N[(a * N[(b * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5.3 \cdot 10^{+181}:\\
\;\;\;\;\mathsf{fma}\left(a \cdot b, z, x\right)\\
\mathbf{elif}\;b \leq 2.3 \cdot 10^{+120}:\\
\;\;\;\;\mathsf{fma}\left(z, y, \mathsf{fma}\left(t, a, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + a \cdot \left(b \cdot z\right)\\
\end{array}
\end{array}
if b < -5.2999999999999996e181Initial program 92.6%
Taylor expanded in t around 0
lower-+.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6471.0
Applied rewrites71.0%
lift-+.f64N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
lift-*.f64N/A
*-commutativeN/A
lift-fma.f64N/A
*-commutativeN/A
add-flipN/A
sub-flipN/A
lift-fma.f64N/A
*-commutativeN/A
lift-*.f64N/A
+-commutativeN/A
lift-+.f64N/A
remove-double-negN/A
lower-fma.f6474.4
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6474.4
Applied rewrites74.4%
Taylor expanded in y around 0
lower-*.f6450.9
Applied rewrites50.9%
if -5.2999999999999996e181 < b < 2.29999999999999993e120Initial program 92.6%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
sub-flipN/A
+-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
associate-+r+N/A
Applied rewrites94.4%
Taylor expanded in b around 0
lower-+.f64N/A
lower-fma.f64N/A
lower-*.f6477.4
Applied rewrites77.4%
lift-+.f64N/A
lift-fma.f64N/A
associate-+r+N/A
+-commutativeN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
add-flipN/A
sub-negate-revN/A
sub-flip-reverseN/A
*-commutativeN/A
+-commutativeN/A
distribute-neg-inN/A
*-commutativeN/A
remove-double-negN/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f6477.4
Applied rewrites77.4%
if 2.29999999999999993e120 < b Initial program 92.6%
Taylor expanded in t around 0
lower-+.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6471.0
Applied rewrites71.0%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6451.1
Applied rewrites51.1%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -8e-62)
(* z (+ y (* a b)))
(if (<= z 1.1e-74)
(+ x (* a t))
(if (<= z 3.5e+122) (+ x (* y z)) (* (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 <= 1.1e-74) {
tmp = x + (a * t);
} else if (z <= 3.5e+122) {
tmp = x + (y * z);
} 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 <= 1.1e-74) tmp = Float64(x + Float64(a * t)); elseif (z <= 3.5e+122) tmp = Float64(x + Float64(y * z)); 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, 1.1e-74], N[(x + N[(a * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.5e+122], N[(x + N[(y * z), $MachinePrecision]), $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 1.1 \cdot 10^{-74}:\\
\;\;\;\;x + a \cdot t\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{+122}:\\
\;\;\;\;x + y \cdot z\\
\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 < 1.10000000000000005e-74Initial program 92.6%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
sub-flipN/A
+-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
associate-+r+N/A
Applied rewrites94.4%
Taylor expanded in b around 0
lower-+.f64N/A
lower-fma.f64N/A
lower-*.f6477.4
Applied rewrites77.4%
Taylor expanded in y around 0
lower-*.f6452.9
Applied rewrites52.9%
if 1.10000000000000005e-74 < z < 3.50000000000000014e122Initial program 92.6%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
sub-flipN/A
+-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
associate-+r+N/A
Applied rewrites94.4%
Taylor expanded in a around 0
lower-+.f64N/A
lower-*.f6452.2
Applied rewrites52.2%
if 3.50000000000000014e122 < 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 1.1e-74)
(+ x (* a t))
(if (<= z 3.5e+122) (+ x (* y z)) 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 <= 1.1e-74) {
tmp = x + (a * t);
} else if (z <= 3.5e+122) {
tmp = x + (y * z);
} 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 <= 1.1e-74) tmp = Float64(x + Float64(a * t)); elseif (z <= 3.5e+122) 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[(N[(a * b + y), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -8e-62], t$95$1, If[LessEqual[z, 1.1e-74], N[(x + N[(a * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.5e+122], N[(x + N[(y * z), $MachinePrecision]), $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 1.1 \cdot 10^{-74}:\\
\;\;\;\;x + a \cdot t\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{+122}:\\
\;\;\;\;x + y \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -8.0000000000000003e-62 or 3.50000000000000014e122 < 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 < 1.10000000000000005e-74Initial program 92.6%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
sub-flipN/A
+-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
associate-+r+N/A
Applied rewrites94.4%
Taylor expanded in b around 0
lower-+.f64N/A
lower-fma.f64N/A
lower-*.f6477.4
Applied rewrites77.4%
Taylor expanded in y around 0
lower-*.f6452.9
Applied rewrites52.9%
if 1.10000000000000005e-74 < z < 3.50000000000000014e122Initial program 92.6%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
sub-flipN/A
+-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
associate-+r+N/A
Applied rewrites94.4%
Taylor expanded in a around 0
lower-+.f64N/A
lower-*.f6452.2
Applied rewrites52.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ x (* y z))))
(if (<= z -7.2e+264)
(* (* a b) z)
(if (<= z -8.5e+105) t_1 (if (<= z 1.1e-74) (+ x (* a t)) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (y * z);
double tmp;
if (z <= -7.2e+264) {
tmp = (a * b) * z;
} else if (z <= -8.5e+105) {
tmp = t_1;
} else if (z <= 1.1e-74) {
tmp = x + (a * t);
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_1 = x + (y * z)
if (z <= (-7.2d+264)) then
tmp = (a * b) * z
else if (z <= (-8.5d+105)) then
tmp = t_1
else if (z <= 1.1d-74) then
tmp = x + (a * t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (y * z);
double tmp;
if (z <= -7.2e+264) {
tmp = (a * b) * z;
} else if (z <= -8.5e+105) {
tmp = t_1;
} else if (z <= 1.1e-74) {
tmp = x + (a * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x + (y * z) tmp = 0 if z <= -7.2e+264: tmp = (a * b) * z elif z <= -8.5e+105: tmp = t_1 elif z <= 1.1e-74: tmp = x + (a * t) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x + Float64(y * z)) tmp = 0.0 if (z <= -7.2e+264) tmp = Float64(Float64(a * b) * z); elseif (z <= -8.5e+105) tmp = t_1; elseif (z <= 1.1e-74) tmp = Float64(x + Float64(a * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x + (y * z); tmp = 0.0; if (z <= -7.2e+264) tmp = (a * b) * z; elseif (z <= -8.5e+105) tmp = t_1; elseif (z <= 1.1e-74) tmp = x + (a * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7.2e+264], N[(N[(a * b), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[z, -8.5e+105], t$95$1, If[LessEqual[z, 1.1e-74], N[(x + N[(a * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot z\\
\mathbf{if}\;z \leq -7.2 \cdot 10^{+264}:\\
\;\;\;\;\left(a \cdot b\right) \cdot z\\
\mathbf{elif}\;z \leq -8.5 \cdot 10^{+105}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{-74}:\\
\;\;\;\;x + a \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.20000000000000023e264Initial 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-*.f6426.9
Applied rewrites26.9%
if -7.20000000000000023e264 < z < -8.49999999999999986e105 or 1.10000000000000005e-74 < z Initial program 92.6%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
sub-flipN/A
+-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
associate-+r+N/A
Applied rewrites94.4%
Taylor expanded in a around 0
lower-+.f64N/A
lower-*.f6452.2
Applied rewrites52.2%
if -8.49999999999999986e105 < z < 1.10000000000000005e-74Initial program 92.6%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
sub-flipN/A
+-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
associate-+r+N/A
Applied rewrites94.4%
Taylor expanded in b around 0
lower-+.f64N/A
lower-fma.f64N/A
lower-*.f6477.4
Applied rewrites77.4%
Taylor expanded in y around 0
lower-*.f6452.9
Applied rewrites52.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ x (* y z))))
(if (<= z -1.6e+265)
(* a (* b z))
(if (<= z -8.5e+105) t_1 (if (<= z 1.1e-74) (+ x (* a t)) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (y * z);
double tmp;
if (z <= -1.6e+265) {
tmp = a * (b * z);
} else if (z <= -8.5e+105) {
tmp = t_1;
} else if (z <= 1.1e-74) {
tmp = x + (a * t);
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_1 = x + (y * z)
if (z <= (-1.6d+265)) then
tmp = a * (b * z)
else if (z <= (-8.5d+105)) then
tmp = t_1
else if (z <= 1.1d-74) then
tmp = x + (a * t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (y * z);
double tmp;
if (z <= -1.6e+265) {
tmp = a * (b * z);
} else if (z <= -8.5e+105) {
tmp = t_1;
} else if (z <= 1.1e-74) {
tmp = x + (a * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x + (y * z) tmp = 0 if z <= -1.6e+265: tmp = a * (b * z) elif z <= -8.5e+105: tmp = t_1 elif z <= 1.1e-74: tmp = x + (a * t) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x + Float64(y * z)) tmp = 0.0 if (z <= -1.6e+265) tmp = Float64(a * Float64(b * z)); elseif (z <= -8.5e+105) tmp = t_1; elseif (z <= 1.1e-74) tmp = Float64(x + Float64(a * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x + (y * z); tmp = 0.0; if (z <= -1.6e+265) tmp = a * (b * z); elseif (z <= -8.5e+105) tmp = t_1; elseif (z <= 1.1e-74) tmp = x + (a * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.6e+265], N[(a * N[(b * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -8.5e+105], t$95$1, If[LessEqual[z, 1.1e-74], N[(x + N[(a * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot z\\
\mathbf{if}\;z \leq -1.6 \cdot 10^{+265}:\\
\;\;\;\;a \cdot \left(b \cdot z\right)\\
\mathbf{elif}\;z \leq -8.5 \cdot 10^{+105}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{-74}:\\
\;\;\;\;x + a \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.60000000000000007e265Initial 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-*.f64N/A
lower-*.f6427.0
Applied rewrites27.0%
if -1.60000000000000007e265 < z < -8.49999999999999986e105 or 1.10000000000000005e-74 < z Initial program 92.6%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
sub-flipN/A
+-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
associate-+r+N/A
Applied rewrites94.4%
Taylor expanded in a around 0
lower-+.f64N/A
lower-*.f6452.2
Applied rewrites52.2%
if -8.49999999999999986e105 < z < 1.10000000000000005e-74Initial program 92.6%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
sub-flipN/A
+-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
associate-+r+N/A
Applied rewrites94.4%
Taylor expanded in b around 0
lower-+.f64N/A
lower-fma.f64N/A
lower-*.f6477.4
Applied rewrites77.4%
Taylor expanded in y around 0
lower-*.f6452.9
Applied rewrites52.9%
(FPCore (x y z t a b) :precision binary64 (if (<= y -4.8e+35) (+ x (* y z)) (if (<= y 90.0) (+ x (* a t)) (fma z y (* a t)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -4.8e+35) {
tmp = x + (y * z);
} else if (y <= 90.0) {
tmp = x + (a * t);
} else {
tmp = fma(z, y, (a * t));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -4.8e+35) tmp = Float64(x + Float64(y * z)); elseif (y <= 90.0) tmp = Float64(x + Float64(a * t)); else tmp = fma(z, y, Float64(a * t)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -4.8e+35], N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 90.0], N[(x + N[(a * t), $MachinePrecision]), $MachinePrecision], N[(z * y + N[(a * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.8 \cdot 10^{+35}:\\
\;\;\;\;x + y \cdot z\\
\mathbf{elif}\;y \leq 90:\\
\;\;\;\;x + a \cdot t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, y, a \cdot t\right)\\
\end{array}
\end{array}
if y < -4.80000000000000029e35Initial program 92.6%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
sub-flipN/A
+-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
associate-+r+N/A
Applied rewrites94.4%
Taylor expanded in a around 0
lower-+.f64N/A
lower-*.f6452.2
Applied rewrites52.2%
if -4.80000000000000029e35 < y < 90Initial program 92.6%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
sub-flipN/A
+-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
associate-+r+N/A
Applied rewrites94.4%
Taylor expanded in b around 0
lower-+.f64N/A
lower-fma.f64N/A
lower-*.f6477.4
Applied rewrites77.4%
Taylor expanded in y around 0
lower-*.f6452.9
Applied rewrites52.9%
if 90 < y Initial program 92.6%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
sub-flipN/A
+-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
associate-+r+N/A
Applied rewrites94.4%
Taylor expanded in b around 0
lower-+.f64N/A
lower-fma.f64N/A
lower-*.f6477.4
Applied rewrites77.4%
lift-+.f64N/A
lift-fma.f64N/A
associate-+r+N/A
+-commutativeN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
add-flipN/A
sub-negate-revN/A
sub-flip-reverseN/A
*-commutativeN/A
+-commutativeN/A
distribute-neg-inN/A
*-commutativeN/A
remove-double-negN/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f6477.4
Applied rewrites77.4%
Taylor expanded in x around 0
lower-*.f6452.5
Applied rewrites52.5%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (+ x (* y z)))) (if (<= z -8.5e+105) t_1 (if (<= z 1.1e-74) (+ x (* a t)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (y * z);
double tmp;
if (z <= -8.5e+105) {
tmp = t_1;
} else if (z <= 1.1e-74) {
tmp = x + (a * t);
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_1 = x + (y * z)
if (z <= (-8.5d+105)) then
tmp = t_1
else if (z <= 1.1d-74) then
tmp = x + (a * t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (y * z);
double tmp;
if (z <= -8.5e+105) {
tmp = t_1;
} else if (z <= 1.1e-74) {
tmp = x + (a * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x + (y * z) tmp = 0 if z <= -8.5e+105: tmp = t_1 elif z <= 1.1e-74: tmp = x + (a * t) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x + Float64(y * z)) tmp = 0.0 if (z <= -8.5e+105) tmp = t_1; elseif (z <= 1.1e-74) tmp = Float64(x + Float64(a * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x + (y * z); tmp = 0.0; if (z <= -8.5e+105) tmp = t_1; elseif (z <= 1.1e-74) tmp = x + (a * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -8.5e+105], t$95$1, If[LessEqual[z, 1.1e-74], N[(x + N[(a * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot z\\
\mathbf{if}\;z \leq -8.5 \cdot 10^{+105}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{-74}:\\
\;\;\;\;x + a \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -8.49999999999999986e105 or 1.10000000000000005e-74 < z Initial program 92.6%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
sub-flipN/A
+-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
associate-+r+N/A
Applied rewrites94.4%
Taylor expanded in a around 0
lower-+.f64N/A
lower-*.f6452.2
Applied rewrites52.2%
if -8.49999999999999986e105 < z < 1.10000000000000005e-74Initial program 92.6%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
sub-flipN/A
+-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
associate-+r+N/A
Applied rewrites94.4%
Taylor expanded in b around 0
lower-+.f64N/A
lower-fma.f64N/A
lower-*.f6477.4
Applied rewrites77.4%
Taylor expanded in y around 0
lower-*.f6452.9
Applied rewrites52.9%
(FPCore (x y z t a b) :precision binary64 (+ x (* a t)))
double code(double x, double y, double z, double t, double a, double b) {
return x + (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 = x + (a * t)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x + (a * t);
}
def code(x, y, z, t, a, b): return x + (a * t)
function code(x, y, z, t, a, b) return Float64(x + Float64(a * t)) end
function tmp = code(x, y, z, t, a, b) tmp = x + (a * t); end
code[x_, y_, z_, t_, a_, b_] := N[(x + N[(a * t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + a \cdot t
\end{array}
Initial program 92.6%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
sub-flipN/A
+-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
associate-+r+N/A
Applied rewrites94.4%
Taylor expanded in b around 0
lower-+.f64N/A
lower-fma.f64N/A
lower-*.f6477.4
Applied rewrites77.4%
Taylor expanded in y around 0
lower-*.f6452.9
Applied rewrites52.9%
(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)))