
(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 (<= (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)) INFINITY) (fma (* a z) b (fma t a (fma y z x))) (* z (+ y (* a b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((((x + (y * z)) + (t * a)) + ((a * z) * b)) <= ((double) INFINITY)) {
tmp = fma((a * z), b, fma(t, a, fma(y, z, x)));
} else {
tmp = z * (y + (a * b));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(Float64(Float64(x + Float64(y * z)) + Float64(t * a)) + Float64(Float64(a * z) * b)) <= Inf) tmp = fma(Float64(a * z), b, fma(t, a, fma(y, z, x))); else tmp = Float64(z * Float64(y + Float64(a * b))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(N[(a * z), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(a * z), $MachinePrecision] * b + N[(t * a + N[(y * z + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(a \cdot z, b, \mathsf{fma}\left(t, a, \mathsf{fma}\left(y, z, x\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y + a \cdot b\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b)) < +inf.0Initial program 92.0%
Applied rewrites93.0%
if +inf.0 < (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b)) Initial program 92.0%
Taylor expanded in z around inf
Applied rewrites51.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ x (fma a t (* y z)))))
(if (<= y -4.1e+85)
t_1
(if (<= y -1.02e-31)
(fma a t (fma a (* b z) (* y z)))
(if (<= y 8.4e+99) (+ (+ x (* a t)) (* (* a z) b)) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + fma(a, t, (y * z));
double tmp;
if (y <= -4.1e+85) {
tmp = t_1;
} else if (y <= -1.02e-31) {
tmp = fma(a, t, fma(a, (b * z), (y * z)));
} else if (y <= 8.4e+99) {
tmp = (x + (a * t)) + ((a * z) * b);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(x + fma(a, t, Float64(y * z))) tmp = 0.0 if (y <= -4.1e+85) tmp = t_1; elseif (y <= -1.02e-31) tmp = fma(a, t, fma(a, Float64(b * z), Float64(y * z))); elseif (y <= 8.4e+99) tmp = Float64(Float64(x + Float64(a * t)) + Float64(Float64(a * z) * b)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(a * t + N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.1e+85], t$95$1, If[LessEqual[y, -1.02e-31], N[(a * t + N[(a * N[(b * z), $MachinePrecision] + N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.4e+99], N[(N[(x + N[(a * t), $MachinePrecision]), $MachinePrecision] + N[(N[(a * z), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \mathsf{fma}\left(a, t, y \cdot z\right)\\
\mathbf{if}\;y \leq -4.1 \cdot 10^{+85}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -1.02 \cdot 10^{-31}:\\
\;\;\;\;\mathsf{fma}\left(a, t, \mathsf{fma}\left(a, b \cdot z, y \cdot z\right)\right)\\
\mathbf{elif}\;y \leq 8.4 \cdot 10^{+99}:\\
\;\;\;\;\left(x + a \cdot t\right) + \left(a \cdot z\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -4.09999999999999978e85 or 8.40000000000000041e99 < y Initial program 92.0%
Taylor expanded in z around inf
Applied rewrites51.1%
Taylor expanded in y around 0
Applied rewrites27.3%
Taylor expanded in b around 0
Applied rewrites77.4%
if -4.09999999999999978e85 < y < -1.01999999999999999e-31Initial program 92.0%
Taylor expanded in x around 0
Applied rewrites70.1%
if -1.01999999999999999e-31 < y < 8.40000000000000041e99Initial program 92.0%
Taylor expanded in y around 0
Applied rewrites71.7%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (+ (+ x (* a t)) (* (* a z) b)))) (if (<= b -320.0) t_1 (if (<= b 6.5e+52) (+ 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 = (x + (a * t)) + ((a * z) * b);
double tmp;
if (b <= -320.0) {
tmp = t_1;
} else if (b <= 6.5e+52) {
tmp = x + fma(a, t, (y * z));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + Float64(a * t)) + Float64(Float64(a * z) * b)) tmp = 0.0 if (b <= -320.0) tmp = t_1; elseif (b <= 6.5e+52) 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[(x + N[(a * t), $MachinePrecision]), $MachinePrecision] + N[(N[(a * z), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -320.0], t$95$1, If[LessEqual[b, 6.5e+52], N[(x + N[(a * t + N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + a \cdot t\right) + \left(a \cdot z\right) \cdot b\\
\mathbf{if}\;b \leq -320:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 6.5 \cdot 10^{+52}:\\
\;\;\;\;x + \mathsf{fma}\left(a, t, y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -320 or 6.49999999999999996e52 < b Initial program 92.0%
Taylor expanded in y around 0
Applied rewrites71.7%
if -320 < b < 6.49999999999999996e52Initial program 92.0%
Taylor expanded in z around inf
Applied rewrites51.1%
Taylor expanded in y around 0
Applied rewrites27.3%
Taylor expanded in b around 0
Applied rewrites77.4%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (+ x (fma a t (* y z))))) (if (<= y -5.6e-11) t_1 (if (<= y 8.4e+99) (+ x (* a (+ t (* b z)))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + fma(a, t, (y * z));
double tmp;
if (y <= -5.6e-11) {
tmp = t_1;
} else if (y <= 8.4e+99) {
tmp = x + (a * (t + (b * z)));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(x + fma(a, t, Float64(y * z))) tmp = 0.0 if (y <= -5.6e-11) tmp = t_1; elseif (y <= 8.4e+99) tmp = Float64(x + Float64(a * Float64(t + Float64(b * z)))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(a * t + N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.6e-11], t$95$1, If[LessEqual[y, 8.4e+99], N[(x + N[(a * N[(t + N[(b * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \mathsf{fma}\left(a, t, y \cdot z\right)\\
\mathbf{if}\;y \leq -5.6 \cdot 10^{-11}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 8.4 \cdot 10^{+99}:\\
\;\;\;\;x + a \cdot \left(t + b \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -5.6e-11 or 8.40000000000000041e99 < y Initial program 92.0%
Taylor expanded in z around inf
Applied rewrites51.1%
Taylor expanded in y around 0
Applied rewrites27.3%
Taylor expanded in b around 0
Applied rewrites77.4%
if -5.6e-11 < y < 8.40000000000000041e99Initial program 92.0%
Taylor expanded in y around 0
Applied rewrites74.0%
Taylor expanded in a around 0
Applied rewrites74.6%
(FPCore (x y z t a b) :precision binary64 (if (<= b -1.15e+201) (* b (fma a z (/ x b))) (if (<= b 1.1e+49) (+ x (fma a t (* y z))) (* z (+ y (* a b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -1.15e+201) {
tmp = b * fma(a, z, (x / b));
} else if (b <= 1.1e+49) {
tmp = x + fma(a, t, (y * z));
} else {
tmp = z * (y + (a * b));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -1.15e+201) tmp = Float64(b * fma(a, z, Float64(x / b))); elseif (b <= 1.1e+49) tmp = Float64(x + fma(a, t, Float64(y * z))); else tmp = Float64(z * Float64(y + Float64(a * b))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -1.15e+201], N[(b * N[(a * z + N[(x / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.1e+49], N[(x + N[(a * t + N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.15 \cdot 10^{+201}:\\
\;\;\;\;b \cdot \mathsf{fma}\left(a, z, \frac{x}{b}\right)\\
\mathbf{elif}\;b \leq 1.1 \cdot 10^{+49}:\\
\;\;\;\;x + \mathsf{fma}\left(a, t, y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y + a \cdot b\right)\\
\end{array}
\end{array}
if b < -1.1500000000000001e201Initial program 92.0%
Taylor expanded in y around 0
Applied rewrites74.0%
Taylor expanded in t around 0
Applied rewrites50.5%
Taylor expanded in b around inf
Applied rewrites45.6%
if -1.1500000000000001e201 < b < 1.1e49Initial program 92.0%
Taylor expanded in z around inf
Applied rewrites51.1%
Taylor expanded in y around 0
Applied rewrites27.3%
Taylor expanded in b around 0
Applied rewrites77.4%
if 1.1e49 < b Initial program 92.0%
Taylor expanded in z around inf
Applied rewrites51.1%
(FPCore (x y z t a b) :precision binary64 (if (<= b -1.2e+201) (* a (+ t (* b z))) (if (<= b 1.1e+49) (+ x (fma a t (* y z))) (* z (+ y (* a b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -1.2e+201) {
tmp = a * (t + (b * z));
} else if (b <= 1.1e+49) {
tmp = x + fma(a, t, (y * z));
} else {
tmp = z * (y + (a * b));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -1.2e+201) tmp = Float64(a * Float64(t + Float64(b * z))); elseif (b <= 1.1e+49) tmp = Float64(x + fma(a, t, Float64(y * z))); else tmp = Float64(z * Float64(y + Float64(a * b))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -1.2e+201], N[(a * N[(t + N[(b * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.1e+49], N[(x + N[(a * t + N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.2 \cdot 10^{+201}:\\
\;\;\;\;a \cdot \left(t + b \cdot z\right)\\
\mathbf{elif}\;b \leq 1.1 \cdot 10^{+49}:\\
\;\;\;\;x + \mathsf{fma}\left(a, t, y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y + a \cdot b\right)\\
\end{array}
\end{array}
if b < -1.19999999999999996e201Initial program 92.0%
Taylor expanded in a around inf
Applied rewrites51.1%
if -1.19999999999999996e201 < b < 1.1e49Initial program 92.0%
Taylor expanded in z around inf
Applied rewrites51.1%
Taylor expanded in y around 0
Applied rewrites27.3%
Taylor expanded in b around 0
Applied rewrites77.4%
if 1.1e49 < b Initial program 92.0%
Taylor expanded in z around inf
Applied rewrites51.1%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* z (+ y (* a b))))) (if (<= z -1.45e+79) t_1 (if (<= z 4.7e-29) (+ x (* a t)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = z * (y + (a * b));
double tmp;
if (z <= -1.45e+79) {
tmp = t_1;
} else if (z <= 4.7e-29) {
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 = z * (y + (a * b))
if (z <= (-1.45d+79)) then
tmp = t_1
else if (z <= 4.7d-29) 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 = z * (y + (a * b));
double tmp;
if (z <= -1.45e+79) {
tmp = t_1;
} else if (z <= 4.7e-29) {
tmp = x + (a * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = z * (y + (a * b)) tmp = 0 if z <= -1.45e+79: tmp = t_1 elif z <= 4.7e-29: tmp = x + (a * t) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(z * Float64(y + Float64(a * b))) tmp = 0.0 if (z <= -1.45e+79) tmp = t_1; elseif (z <= 4.7e-29) 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 = z * (y + (a * b)); tmp = 0.0; if (z <= -1.45e+79) tmp = t_1; elseif (z <= 4.7e-29) 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[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.45e+79], t$95$1, If[LessEqual[z, 4.7e-29], N[(x + N[(a * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(y + a \cdot b\right)\\
\mathbf{if}\;z \leq -1.45 \cdot 10^{+79}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4.7 \cdot 10^{-29}:\\
\;\;\;\;x + a \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.44999999999999996e79 or 4.6999999999999998e-29 < z Initial program 92.0%
Taylor expanded in z around inf
Applied rewrites51.1%
if -1.44999999999999996e79 < z < 4.6999999999999998e-29Initial program 92.0%
Taylor expanded in z around inf
Applied rewrites51.1%
Taylor expanded in y around 0
Applied rewrites27.3%
Taylor expanded in z around 0
Applied rewrites52.1%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* a (+ t (* b z))))) (if (<= a -4.8e-39) t_1 (if (<= a 5.2e+42) (+ x (* y z)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a * (t + (b * z));
double tmp;
if (a <= -4.8e-39) {
tmp = t_1;
} else if (a <= 5.2e+42) {
tmp = x + (y * z);
} 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 = a * (t + (b * z))
if (a <= (-4.8d-39)) then
tmp = t_1
else if (a <= 5.2d+42) then
tmp = x + (y * z)
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 = a * (t + (b * z));
double tmp;
if (a <= -4.8e-39) {
tmp = t_1;
} else if (a <= 5.2e+42) {
tmp = x + (y * z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = a * (t + (b * z)) tmp = 0 if a <= -4.8e-39: tmp = t_1 elif a <= 5.2e+42: tmp = x + (y * z) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(a * Float64(t + Float64(b * z))) tmp = 0.0 if (a <= -4.8e-39) tmp = t_1; elseif (a <= 5.2e+42) tmp = Float64(x + Float64(y * z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = a * (t + (b * z)); tmp = 0.0; if (a <= -4.8e-39) tmp = t_1; elseif (a <= 5.2e+42) tmp = x + (y * z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * N[(t + N[(b * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -4.8e-39], t$95$1, If[LessEqual[a, 5.2e+42], N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \left(t + b \cdot z\right)\\
\mathbf{if}\;a \leq -4.8 \cdot 10^{-39}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 5.2 \cdot 10^{+42}:\\
\;\;\;\;x + y \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -4.80000000000000031e-39 or 5.1999999999999998e42 < a Initial program 92.0%
Taylor expanded in a around inf
Applied rewrites51.1%
if -4.80000000000000031e-39 < a < 5.1999999999999998e42Initial program 92.0%
Taylor expanded in z around inf
Applied rewrites51.1%
Taylor expanded in y around 0
Applied rewrites27.3%
Taylor expanded in a around 0
Applied rewrites52.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ x (* y z))))
(if (<= y -5.6e-11)
t_1
(if (<= y -4e-177)
(+ x (* a (* b z)))
(if (<= y 3.7e+99) (+ 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 (y <= -5.6e-11) {
tmp = t_1;
} else if (y <= -4e-177) {
tmp = x + (a * (b * z));
} else if (y <= 3.7e+99) {
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 (y <= (-5.6d-11)) then
tmp = t_1
else if (y <= (-4d-177)) then
tmp = x + (a * (b * z))
else if (y <= 3.7d+99) 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 (y <= -5.6e-11) {
tmp = t_1;
} else if (y <= -4e-177) {
tmp = x + (a * (b * z));
} else if (y <= 3.7e+99) {
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 y <= -5.6e-11: tmp = t_1 elif y <= -4e-177: tmp = x + (a * (b * z)) elif y <= 3.7e+99: 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 (y <= -5.6e-11) tmp = t_1; elseif (y <= -4e-177) tmp = Float64(x + Float64(a * Float64(b * z))); elseif (y <= 3.7e+99) 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 (y <= -5.6e-11) tmp = t_1; elseif (y <= -4e-177) tmp = x + (a * (b * z)); elseif (y <= 3.7e+99) 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[y, -5.6e-11], t$95$1, If[LessEqual[y, -4e-177], N[(x + N[(a * N[(b * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.7e+99], N[(x + N[(a * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot z\\
\mathbf{if}\;y \leq -5.6 \cdot 10^{-11}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -4 \cdot 10^{-177}:\\
\;\;\;\;x + a \cdot \left(b \cdot z\right)\\
\mathbf{elif}\;y \leq 3.7 \cdot 10^{+99}:\\
\;\;\;\;x + a \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -5.6e-11 or 3.7000000000000001e99 < y Initial program 92.0%
Taylor expanded in z around inf
Applied rewrites51.1%
Taylor expanded in y around 0
Applied rewrites27.3%
Taylor expanded in a around 0
Applied rewrites52.2%
if -5.6e-11 < y < -3.99999999999999981e-177Initial program 92.0%
Taylor expanded in y around 0
Applied rewrites74.0%
Taylor expanded in t around 0
Applied rewrites50.5%
if -3.99999999999999981e-177 < y < 3.7000000000000001e99Initial program 92.0%
Taylor expanded in z around inf
Applied rewrites51.1%
Taylor expanded in y around 0
Applied rewrites27.3%
Taylor expanded in z around 0
Applied rewrites52.1%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (+ x (* a t)))) (if (<= a -3.4e+47) t_1 (if (<= a 4.4e+33) (+ x (* y z)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (a * t);
double tmp;
if (a <= -3.4e+47) {
tmp = t_1;
} else if (a <= 4.4e+33) {
tmp = x + (y * z);
} 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 + (a * t)
if (a <= (-3.4d+47)) then
tmp = t_1
else if (a <= 4.4d+33) then
tmp = x + (y * z)
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 + (a * t);
double tmp;
if (a <= -3.4e+47) {
tmp = t_1;
} else if (a <= 4.4e+33) {
tmp = x + (y * z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x + (a * t) tmp = 0 if a <= -3.4e+47: tmp = t_1 elif a <= 4.4e+33: tmp = x + (y * z) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x + Float64(a * t)) tmp = 0.0 if (a <= -3.4e+47) tmp = t_1; elseif (a <= 4.4e+33) tmp = Float64(x + Float64(y * z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x + (a * t); tmp = 0.0; if (a <= -3.4e+47) tmp = t_1; elseif (a <= 4.4e+33) tmp = x + (y * z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(a * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -3.4e+47], t$95$1, If[LessEqual[a, 4.4e+33], N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + a \cdot t\\
\mathbf{if}\;a \leq -3.4 \cdot 10^{+47}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 4.4 \cdot 10^{+33}:\\
\;\;\;\;x + y \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -3.3999999999999998e47 or 4.39999999999999988e33 < a Initial program 92.0%
Taylor expanded in z around inf
Applied rewrites51.1%
Taylor expanded in y around 0
Applied rewrites27.3%
Taylor expanded in z around 0
Applied rewrites52.1%
if -3.3999999999999998e47 < a < 4.39999999999999988e33Initial program 92.0%
Taylor expanded in z around inf
Applied rewrites51.1%
Taylor expanded in y around 0
Applied rewrites27.3%
Taylor expanded in a around 0
Applied rewrites52.2%
(FPCore (x y z t a b) :precision binary64 (if (<= y -5.5e+123) (* y z) (if (<= y 8.5e+214) (+ x (* a t)) (* y z))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -5.5e+123) {
tmp = y * z;
} else if (y <= 8.5e+214) {
tmp = x + (a * t);
} 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 (y <= (-5.5d+123)) then
tmp = y * z
else if (y <= 8.5d+214) then
tmp = x + (a * t)
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 (y <= -5.5e+123) {
tmp = y * z;
} else if (y <= 8.5e+214) {
tmp = x + (a * t);
} else {
tmp = y * z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -5.5e+123: tmp = y * z elif y <= 8.5e+214: tmp = x + (a * t) else: tmp = y * z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -5.5e+123) tmp = Float64(y * z); elseif (y <= 8.5e+214) tmp = Float64(x + Float64(a * t)); else tmp = Float64(y * z); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y <= -5.5e+123) tmp = y * z; elseif (y <= 8.5e+214) tmp = x + (a * t); else tmp = y * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -5.5e+123], N[(y * z), $MachinePrecision], If[LessEqual[y, 8.5e+214], N[(x + N[(a * t), $MachinePrecision]), $MachinePrecision], N[(y * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.5 \cdot 10^{+123}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;y \leq 8.5 \cdot 10^{+214}:\\
\;\;\;\;x + a \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if y < -5.5000000000000002e123 or 8.50000000000000045e214 < y Initial program 92.0%
Taylor expanded in z around inf
Applied rewrites51.1%
Taylor expanded in y around 0
Applied rewrites27.3%
Taylor expanded in y around inf
Applied rewrites28.5%
if -5.5000000000000002e123 < y < 8.50000000000000045e214Initial program 92.0%
Taylor expanded in z around inf
Applied rewrites51.1%
Taylor expanded in y around 0
Applied rewrites27.3%
Taylor expanded in z around 0
Applied rewrites52.1%
(FPCore (x y z t a b) :precision binary64 (if (<= a -3.4e+47) (* a t) (if (<= a 4.4e+33) (* y z) (* a t))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -3.4e+47) {
tmp = a * t;
} else if (a <= 4.4e+33) {
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 (a <= (-3.4d+47)) then
tmp = a * t
else if (a <= 4.4d+33) 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 (a <= -3.4e+47) {
tmp = a * t;
} else if (a <= 4.4e+33) {
tmp = y * z;
} else {
tmp = a * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= -3.4e+47: tmp = a * t elif a <= 4.4e+33: tmp = y * z else: tmp = a * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -3.4e+47) tmp = Float64(a * t); elseif (a <= 4.4e+33) 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 (a <= -3.4e+47) tmp = a * t; elseif (a <= 4.4e+33) tmp = y * z; else tmp = a * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -3.4e+47], N[(a * t), $MachinePrecision], If[LessEqual[a, 4.4e+33], N[(y * z), $MachinePrecision], N[(a * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.4 \cdot 10^{+47}:\\
\;\;\;\;a \cdot t\\
\mathbf{elif}\;a \leq 4.4 \cdot 10^{+33}:\\
\;\;\;\;y \cdot z\\
\mathbf{else}:\\
\;\;\;\;a \cdot t\\
\end{array}
\end{array}
if a < -3.3999999999999998e47 or 4.39999999999999988e33 < a Initial program 92.0%
Taylor expanded in a around inf
Applied rewrites51.1%
Taylor expanded in z around 0
Applied rewrites28.3%
if -3.3999999999999998e47 < a < 4.39999999999999988e33Initial program 92.0%
Taylor expanded in z around inf
Applied rewrites51.1%
Taylor expanded in y around 0
Applied rewrites27.3%
Taylor expanded in y around inf
Applied rewrites28.5%
(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.0%
Taylor expanded in a around inf
Applied rewrites51.1%
Taylor expanded in z around 0
Applied rewrites28.3%
herbie shell --seed 2025160
(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)))