
(FPCore (x y z t a b)
:precision binary64
(+
x
(/
(*
y
(+ (* (+ (* (+ (* (+ (* z 3.13060547623) 11.1667541262) z) t) z) a) z) b))
(+
(* (+ (* (+ (* (+ z 15.234687407) z) 31.4690115749) z) 11.9400905721) z)
0.607771387771))))
double code(double x, double y, double z, double t, double a, double b) {
return x + ((y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771));
}
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 * 3.13060547623d0) + 11.1667541262d0) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407d0) * z) + 31.4690115749d0) * z) + 11.9400905721d0) * z) + 0.607771387771d0))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x + ((y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771));
}
def code(x, y, z, t, a, b): return x + ((y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771))
function code(x, y, z, t, a, b) return Float64(x + Float64(Float64(y * Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / Float64(Float64(Float64(Float64(Float64(Float64(Float64(z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771))) end
function tmp = code(x, y, z, t, a, b) tmp = x + ((y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771)); end
code[x_, y_, z_, t_, a_, b_] := N[(x + N[(N[(y * N[(N[(N[(N[(N[(N[(N[(N[(z * 3.13060547623), $MachinePrecision] + 11.1667541262), $MachinePrecision] * z), $MachinePrecision] + t), $MachinePrecision] * z), $MachinePrecision] + a), $MachinePrecision] * z), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[(N[(N[(N[(z + 15.234687407), $MachinePrecision] * z), $MachinePrecision] + 31.4690115749), $MachinePrecision] * z), $MachinePrecision] + 11.9400905721), $MachinePrecision] * z), $MachinePrecision] + 0.607771387771), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771}
\end{array}
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b)
:precision binary64
(+
x
(/
(*
y
(+ (* (+ (* (+ (* (+ (* z 3.13060547623) 11.1667541262) z) t) z) a) z) b))
(+
(* (+ (* (+ (* (+ z 15.234687407) z) 31.4690115749) z) 11.9400905721) z)
0.607771387771))))
double code(double x, double y, double z, double t, double a, double b) {
return x + ((y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771));
}
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 * 3.13060547623d0) + 11.1667541262d0) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407d0) * z) + 31.4690115749d0) * z) + 11.9400905721d0) * z) + 0.607771387771d0))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x + ((y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771));
}
def code(x, y, z, t, a, b): return x + ((y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771))
function code(x, y, z, t, a, b) return Float64(x + Float64(Float64(y * Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / Float64(Float64(Float64(Float64(Float64(Float64(Float64(z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771))) end
function tmp = code(x, y, z, t, a, b) tmp = x + ((y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771)); end
code[x_, y_, z_, t_, a_, b_] := N[(x + N[(N[(y * N[(N[(N[(N[(N[(N[(N[(N[(z * 3.13060547623), $MachinePrecision] + 11.1667541262), $MachinePrecision] * z), $MachinePrecision] + t), $MachinePrecision] * z), $MachinePrecision] + a), $MachinePrecision] * z), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[(N[(N[(N[(z + 15.234687407), $MachinePrecision] * z), $MachinePrecision] + 31.4690115749), $MachinePrecision] * z), $MachinePrecision] + 11.9400905721), $MachinePrecision] * z), $MachinePrecision] + 0.607771387771), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771}
\end{array}
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1
(fma
(fma (fma (- z -15.234687407) z 31.4690115749) z 11.9400905721)
z
0.607771387771)))
(if (<=
(+
x
(/
(*
y
(+
(* (+ (* (+ (* (+ (* z 3.13060547623) 11.1667541262) z) t) z) a) z)
b))
(+
(*
(+ (* (+ (* (+ z 15.234687407) z) 31.4690115749) z) 11.9400905721)
z)
0.607771387771)))
INFINITY)
(fma
y
(* z (/ (fma (fma (fma 3.13060547623 z 11.1667541262) z t) z a) t_1))
(fma b (/ y t_1) x))
(+
x
(-
(fma 3.13060547623 y (* 11.1667541262 (/ y z)))
(* 47.69379582500642 (/ y z)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(fma(fma((z - -15.234687407), z, 31.4690115749), z, 11.9400905721), z, 0.607771387771);
double tmp;
if ((x + ((y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771))) <= ((double) INFINITY)) {
tmp = fma(y, (z * (fma(fma(fma(3.13060547623, z, 11.1667541262), z, t), z, a) / t_1)), fma(b, (y / t_1), x));
} else {
tmp = x + (fma(3.13060547623, y, (11.1667541262 * (y / z))) - (47.69379582500642 * (y / z)));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(fma(fma(Float64(z - -15.234687407), z, 31.4690115749), z, 11.9400905721), z, 0.607771387771) tmp = 0.0 if (Float64(x + Float64(Float64(y * Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / Float64(Float64(Float64(Float64(Float64(Float64(Float64(z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771))) <= Inf) tmp = fma(y, Float64(z * Float64(fma(fma(fma(3.13060547623, z, 11.1667541262), z, t), z, a) / t_1)), fma(b, Float64(y / t_1), x)); else tmp = Float64(x + Float64(fma(3.13060547623, y, Float64(11.1667541262 * Float64(y / z))) - Float64(47.69379582500642 * Float64(y / z)))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(N[(z - -15.234687407), $MachinePrecision] * z + 31.4690115749), $MachinePrecision] * z + 11.9400905721), $MachinePrecision] * z + 0.607771387771), $MachinePrecision]}, If[LessEqual[N[(x + N[(N[(y * N[(N[(N[(N[(N[(N[(N[(N[(z * 3.13060547623), $MachinePrecision] + 11.1667541262), $MachinePrecision] * z), $MachinePrecision] + t), $MachinePrecision] * z), $MachinePrecision] + a), $MachinePrecision] * z), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[(N[(N[(N[(z + 15.234687407), $MachinePrecision] * z), $MachinePrecision] + 31.4690115749), $MachinePrecision] * z), $MachinePrecision] + 11.9400905721), $MachinePrecision] * z), $MachinePrecision] + 0.607771387771), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(y * N[(z * N[(N[(N[(N[(3.13060547623 * z + 11.1667541262), $MachinePrecision] * z + t), $MachinePrecision] * z + a), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] + N[(b * N[(y / t$95$1), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(3.13060547623 * y + N[(11.1667541262 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(47.69379582500642 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(z - -15.234687407, z, 31.4690115749\right), z, 11.9400905721\right), z, 0.607771387771\right)\\
\mathbf{if}\;x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(y, z \cdot \frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(3.13060547623, z, 11.1667541262\right), z, t\right), z, a\right)}{t\_1}, \mathsf{fma}\left(b, \frac{y}{t\_1}, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(\mathsf{fma}\left(3.13060547623, y, 11.1667541262 \cdot \frac{y}{z}\right) - 47.69379582500642 \cdot \frac{y}{z}\right)\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 y (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 z #s(literal 313060547623/100000000000 binary64)) #s(literal 55833770631/5000000000 binary64)) z) t) z) a) z) b)) (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 z #s(literal 15234687407/1000000000 binary64)) z) #s(literal 314690115749/10000000000 binary64)) z) #s(literal 119400905721/10000000000 binary64)) z) #s(literal 607771387771/1000000000000 binary64)))) < +inf.0Initial program 58.2%
Applied rewrites62.4%
if +inf.0 < (+.f64 x (/.f64 (*.f64 y (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 z #s(literal 313060547623/100000000000 binary64)) #s(literal 55833770631/5000000000 binary64)) z) t) z) a) z) b)) (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 z #s(literal 15234687407/1000000000 binary64)) z) #s(literal 314690115749/10000000000 binary64)) z) #s(literal 119400905721/10000000000 binary64)) z) #s(literal 607771387771/1000000000000 binary64)))) Initial program 58.2%
Taylor expanded in z around inf
lower--.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f6456.6
Applied rewrites56.6%
(FPCore (x y z t a b)
:precision binary64
(if (<=
(+
x
(/
(*
y
(+
(* (+ (* (+ (* (+ (* z 3.13060547623) 11.1667541262) z) t) z) a) z)
b))
(+
(*
(+ (* (+ (* (+ z 15.234687407) z) 31.4690115749) z) 11.9400905721)
z)
0.607771387771)))
INFINITY)
(fma
(/
(fma (fma (fma (fma 3.13060547623 z 11.1667541262) z t) z a) z b)
(fma
(fma (fma (- z -15.234687407) z 31.4690115749) z 11.9400905721)
z
0.607771387771))
y
x)
(+
x
(-
(fma 3.13060547623 y (* 11.1667541262 (/ y z)))
(* 47.69379582500642 (/ y z))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x + ((y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771))) <= ((double) INFINITY)) {
tmp = fma((fma(fma(fma(fma(3.13060547623, z, 11.1667541262), z, t), z, a), z, b) / fma(fma(fma((z - -15.234687407), z, 31.4690115749), z, 11.9400905721), z, 0.607771387771)), y, x);
} else {
tmp = x + (fma(3.13060547623, y, (11.1667541262 * (y / z))) - (47.69379582500642 * (y / z)));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(x + Float64(Float64(y * Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / Float64(Float64(Float64(Float64(Float64(Float64(Float64(z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771))) <= Inf) tmp = fma(Float64(fma(fma(fma(fma(3.13060547623, z, 11.1667541262), z, t), z, a), z, b) / fma(fma(fma(Float64(z - -15.234687407), z, 31.4690115749), z, 11.9400905721), z, 0.607771387771)), y, x); else tmp = Float64(x + Float64(fma(3.13060547623, y, Float64(11.1667541262 * Float64(y / z))) - Float64(47.69379582500642 * Float64(y / z)))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x + N[(N[(y * N[(N[(N[(N[(N[(N[(N[(N[(z * 3.13060547623), $MachinePrecision] + 11.1667541262), $MachinePrecision] * z), $MachinePrecision] + t), $MachinePrecision] * z), $MachinePrecision] + a), $MachinePrecision] * z), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[(N[(N[(N[(z + 15.234687407), $MachinePrecision] * z), $MachinePrecision] + 31.4690115749), $MachinePrecision] * z), $MachinePrecision] + 11.9400905721), $MachinePrecision] * z), $MachinePrecision] + 0.607771387771), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(N[(N[(N[(N[(3.13060547623 * z + 11.1667541262), $MachinePrecision] * z + t), $MachinePrecision] * z + a), $MachinePrecision] * z + b), $MachinePrecision] / N[(N[(N[(N[(z - -15.234687407), $MachinePrecision] * z + 31.4690115749), $MachinePrecision] * z + 11.9400905721), $MachinePrecision] * z + 0.607771387771), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision], N[(x + N[(N[(3.13060547623 * y + N[(11.1667541262 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(47.69379582500642 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771} \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(\frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(3.13060547623, z, 11.1667541262\right), z, t\right), z, a\right), z, b\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(z - -15.234687407, z, 31.4690115749\right), z, 11.9400905721\right), z, 0.607771387771\right)}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(\mathsf{fma}\left(3.13060547623, y, 11.1667541262 \cdot \frac{y}{z}\right) - 47.69379582500642 \cdot \frac{y}{z}\right)\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 y (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 z #s(literal 313060547623/100000000000 binary64)) #s(literal 55833770631/5000000000 binary64)) z) t) z) a) z) b)) (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 z #s(literal 15234687407/1000000000 binary64)) z) #s(literal 314690115749/10000000000 binary64)) z) #s(literal 119400905721/10000000000 binary64)) z) #s(literal 607771387771/1000000000000 binary64)))) < +inf.0Initial program 58.2%
Applied rewrites60.1%
if +inf.0 < (+.f64 x (/.f64 (*.f64 y (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 z #s(literal 313060547623/100000000000 binary64)) #s(literal 55833770631/5000000000 binary64)) z) t) z) a) z) b)) (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 z #s(literal 15234687407/1000000000 binary64)) z) #s(literal 314690115749/10000000000 binary64)) z) #s(literal 119400905721/10000000000 binary64)) z) #s(literal 607771387771/1000000000000 binary64)))) Initial program 58.2%
Taylor expanded in z around inf
lower--.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f6456.6
Applied rewrites56.6%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -8.2e+17)
(+ x (* 3.13060547623 y))
(if (<= z 7e+26)
(+
x
(/
(* y (+ (* (+ (* t z) a) z) b))
(+
(*
(+ (* (+ (* (+ z 15.234687407) z) 31.4690115749) z) 11.9400905721)
z)
0.607771387771)))
(+
x
(-
(fma 3.13060547623 y (* 11.1667541262 (/ y z)))
(* 47.69379582500642 (/ y z)))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -8.2e+17) {
tmp = x + (3.13060547623 * y);
} else if (z <= 7e+26) {
tmp = x + ((y * ((((t * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771));
} else {
tmp = x + (fma(3.13060547623, y, (11.1667541262 * (y / z))) - (47.69379582500642 * (y / z)));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -8.2e+17) tmp = Float64(x + Float64(3.13060547623 * y)); elseif (z <= 7e+26) tmp = Float64(x + Float64(Float64(y * Float64(Float64(Float64(Float64(t * z) + a) * z) + b)) / Float64(Float64(Float64(Float64(Float64(Float64(Float64(z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771))); else tmp = Float64(x + Float64(fma(3.13060547623, y, Float64(11.1667541262 * Float64(y / z))) - Float64(47.69379582500642 * Float64(y / z)))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -8.2e+17], N[(x + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7e+26], N[(x + N[(N[(y * N[(N[(N[(N[(t * z), $MachinePrecision] + a), $MachinePrecision] * z), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[(N[(N[(N[(z + 15.234687407), $MachinePrecision] * z), $MachinePrecision] + 31.4690115749), $MachinePrecision] * z), $MachinePrecision] + 11.9400905721), $MachinePrecision] * z), $MachinePrecision] + 0.607771387771), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(3.13060547623 * y + N[(11.1667541262 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(47.69379582500642 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.2 \cdot 10^{+17}:\\
\;\;\;\;x + 3.13060547623 \cdot y\\
\mathbf{elif}\;z \leq 7 \cdot 10^{+26}:\\
\;\;\;\;x + \frac{y \cdot \left(\left(t \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771}\\
\mathbf{else}:\\
\;\;\;\;x + \left(\mathsf{fma}\left(3.13060547623, y, 11.1667541262 \cdot \frac{y}{z}\right) - 47.69379582500642 \cdot \frac{y}{z}\right)\\
\end{array}
\end{array}
if z < -8.2e17Initial program 58.2%
Taylor expanded in z around inf
lower-*.f6463.0
Applied rewrites63.0%
if -8.2e17 < z < 6.9999999999999998e26Initial program 58.2%
Taylor expanded in z around 0
Applied rewrites61.3%
if 6.9999999999999998e26 < z Initial program 58.2%
Taylor expanded in z around inf
lower--.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f6456.6
Applied rewrites56.6%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -0.05)
(+ (* y (- 3.13060547623 (/ 36.52704169880642 z))) x)
(if (<= z 4.1e+20)
(+
x
(/
(*
y
(+
(* (+ (* (+ (* (+ (* z 3.13060547623) 11.1667541262) z) t) z) a) z)
b))
(+ (* 11.9400905721 z) 0.607771387771)))
(+
x
(-
(fma 3.13060547623 y (* 11.1667541262 (/ y z)))
(* 47.69379582500642 (/ y z)))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -0.05) {
tmp = (y * (3.13060547623 - (36.52704169880642 / z))) + x;
} else if (z <= 4.1e+20) {
tmp = x + ((y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / ((11.9400905721 * z) + 0.607771387771));
} else {
tmp = x + (fma(3.13060547623, y, (11.1667541262 * (y / z))) - (47.69379582500642 * (y / z)));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -0.05) tmp = Float64(Float64(y * Float64(3.13060547623 - Float64(36.52704169880642 / z))) + x); elseif (z <= 4.1e+20) tmp = Float64(x + Float64(Float64(y * Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / Float64(Float64(11.9400905721 * z) + 0.607771387771))); else tmp = Float64(x + Float64(fma(3.13060547623, y, Float64(11.1667541262 * Float64(y / z))) - Float64(47.69379582500642 * Float64(y / z)))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -0.05], N[(N[(y * N[(3.13060547623 - N[(36.52704169880642 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 4.1e+20], N[(x + N[(N[(y * N[(N[(N[(N[(N[(N[(N[(N[(z * 3.13060547623), $MachinePrecision] + 11.1667541262), $MachinePrecision] * z), $MachinePrecision] + t), $MachinePrecision] * z), $MachinePrecision] + a), $MachinePrecision] * z), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision] / N[(N[(11.9400905721 * z), $MachinePrecision] + 0.607771387771), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(3.13060547623 * y + N[(11.1667541262 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(47.69379582500642 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.05:\\
\;\;\;\;y \cdot \left(3.13060547623 - \frac{36.52704169880642}{z}\right) + x\\
\mathbf{elif}\;z \leq 4.1 \cdot 10^{+20}:\\
\;\;\;\;x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{11.9400905721 \cdot z + 0.607771387771}\\
\mathbf{else}:\\
\;\;\;\;x + \left(\mathsf{fma}\left(3.13060547623, y, 11.1667541262 \cdot \frac{y}{z}\right) - 47.69379582500642 \cdot \frac{y}{z}\right)\\
\end{array}
\end{array}
if z < -0.050000000000000003Initial program 58.2%
Taylor expanded in z around -inf
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6459.1
Applied rewrites59.1%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6459.1
Applied rewrites59.1%
if -0.050000000000000003 < z < 4.1e20Initial program 58.2%
Taylor expanded in z around 0
Applied rewrites54.2%
if 4.1e20 < z Initial program 58.2%
Taylor expanded in z around inf
lower--.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f6456.6
Applied rewrites56.6%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -11000000000.0)
(+ x (* 3.13060547623 y))
(if (<= z 4.1e+20)
(+
x
(/
(*
y
(+
(* (+ (* (+ (* (+ (* z 3.13060547623) 11.1667541262) z) t) z) a) z)
b))
0.607771387771))
(+
x
(-
(fma 3.13060547623 y (* 11.1667541262 (/ y z)))
(* 47.69379582500642 (/ y z)))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -11000000000.0) {
tmp = x + (3.13060547623 * y);
} else if (z <= 4.1e+20) {
tmp = x + ((y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / 0.607771387771);
} else {
tmp = x + (fma(3.13060547623, y, (11.1667541262 * (y / z))) - (47.69379582500642 * (y / z)));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -11000000000.0) tmp = Float64(x + Float64(3.13060547623 * y)); elseif (z <= 4.1e+20) tmp = Float64(x + Float64(Float64(y * Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / 0.607771387771)); else tmp = Float64(x + Float64(fma(3.13060547623, y, Float64(11.1667541262 * Float64(y / z))) - Float64(47.69379582500642 * Float64(y / z)))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -11000000000.0], N[(x + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.1e+20], N[(x + N[(N[(y * N[(N[(N[(N[(N[(N[(N[(N[(z * 3.13060547623), $MachinePrecision] + 11.1667541262), $MachinePrecision] * z), $MachinePrecision] + t), $MachinePrecision] * z), $MachinePrecision] + a), $MachinePrecision] * z), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision] / 0.607771387771), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(3.13060547623 * y + N[(11.1667541262 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(47.69379582500642 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -11000000000:\\
\;\;\;\;x + 3.13060547623 \cdot y\\
\mathbf{elif}\;z \leq 4.1 \cdot 10^{+20}:\\
\;\;\;\;x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{0.607771387771}\\
\mathbf{else}:\\
\;\;\;\;x + \left(\mathsf{fma}\left(3.13060547623, y, 11.1667541262 \cdot \frac{y}{z}\right) - 47.69379582500642 \cdot \frac{y}{z}\right)\\
\end{array}
\end{array}
if z < -1.1e10Initial program 58.2%
Taylor expanded in z around inf
lower-*.f6463.0
Applied rewrites63.0%
if -1.1e10 < z < 4.1e20Initial program 58.2%
Taylor expanded in z around 0
Applied rewrites54.9%
if 4.1e20 < z Initial program 58.2%
Taylor expanded in z around inf
lower--.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f6456.6
Applied rewrites56.6%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -0.55)
(+ (* y (- 3.13060547623 (/ 36.52704169880642 z))) x)
(if (<= z 2.8e+20)
(+
x
(/
(fma b y (* z (fma a y (* t (* y z)))))
(+ (* 11.9400905721 z) 0.607771387771)))
(+
x
(-
(fma 3.13060547623 y (* 11.1667541262 (/ y z)))
(* 47.69379582500642 (/ y z)))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -0.55) {
tmp = (y * (3.13060547623 - (36.52704169880642 / z))) + x;
} else if (z <= 2.8e+20) {
tmp = x + (fma(b, y, (z * fma(a, y, (t * (y * z))))) / ((11.9400905721 * z) + 0.607771387771));
} else {
tmp = x + (fma(3.13060547623, y, (11.1667541262 * (y / z))) - (47.69379582500642 * (y / z)));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -0.55) tmp = Float64(Float64(y * Float64(3.13060547623 - Float64(36.52704169880642 / z))) + x); elseif (z <= 2.8e+20) tmp = Float64(x + Float64(fma(b, y, Float64(z * fma(a, y, Float64(t * Float64(y * z))))) / Float64(Float64(11.9400905721 * z) + 0.607771387771))); else tmp = Float64(x + Float64(fma(3.13060547623, y, Float64(11.1667541262 * Float64(y / z))) - Float64(47.69379582500642 * Float64(y / z)))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -0.55], N[(N[(y * N[(3.13060547623 - N[(36.52704169880642 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 2.8e+20], N[(x + N[(N[(b * y + N[(z * N[(a * y + N[(t * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(11.9400905721 * z), $MachinePrecision] + 0.607771387771), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(3.13060547623 * y + N[(11.1667541262 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(47.69379582500642 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.55:\\
\;\;\;\;y \cdot \left(3.13060547623 - \frac{36.52704169880642}{z}\right) + x\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{+20}:\\
\;\;\;\;x + \frac{\mathsf{fma}\left(b, y, z \cdot \mathsf{fma}\left(a, y, t \cdot \left(y \cdot z\right)\right)\right)}{11.9400905721 \cdot z + 0.607771387771}\\
\mathbf{else}:\\
\;\;\;\;x + \left(\mathsf{fma}\left(3.13060547623, y, 11.1667541262 \cdot \frac{y}{z}\right) - 47.69379582500642 \cdot \frac{y}{z}\right)\\
\end{array}
\end{array}
if z < -0.55000000000000004Initial program 58.2%
Taylor expanded in z around -inf
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6459.1
Applied rewrites59.1%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6459.1
Applied rewrites59.1%
if -0.55000000000000004 < z < 2.8e20Initial program 58.2%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6462.4
Applied rewrites62.4%
Taylor expanded in z around 0
Applied rewrites56.7%
if 2.8e20 < z Initial program 58.2%
Taylor expanded in z around inf
lower--.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f6456.6
Applied rewrites56.6%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -4.1)
(+ (* y (- 3.13060547623 (/ 36.52704169880642 z))) x)
(if (<= z 2.65e+20)
(+ x (/ (fma b y (* z (fma a y (* t (* y z))))) 0.607771387771))
(+
x
(-
(fma 3.13060547623 y (* 11.1667541262 (/ y z)))
(* 47.69379582500642 (/ y z)))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -4.1) {
tmp = (y * (3.13060547623 - (36.52704169880642 / z))) + x;
} else if (z <= 2.65e+20) {
tmp = x + (fma(b, y, (z * fma(a, y, (t * (y * z))))) / 0.607771387771);
} else {
tmp = x + (fma(3.13060547623, y, (11.1667541262 * (y / z))) - (47.69379582500642 * (y / z)));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -4.1) tmp = Float64(Float64(y * Float64(3.13060547623 - Float64(36.52704169880642 / z))) + x); elseif (z <= 2.65e+20) tmp = Float64(x + Float64(fma(b, y, Float64(z * fma(a, y, Float64(t * Float64(y * z))))) / 0.607771387771)); else tmp = Float64(x + Float64(fma(3.13060547623, y, Float64(11.1667541262 * Float64(y / z))) - Float64(47.69379582500642 * Float64(y / z)))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -4.1], N[(N[(y * N[(3.13060547623 - N[(36.52704169880642 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 2.65e+20], N[(x + N[(N[(b * y + N[(z * N[(a * y + N[(t * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 0.607771387771), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(3.13060547623 * y + N[(11.1667541262 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(47.69379582500642 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.1:\\
\;\;\;\;y \cdot \left(3.13060547623 - \frac{36.52704169880642}{z}\right) + x\\
\mathbf{elif}\;z \leq 2.65 \cdot 10^{+20}:\\
\;\;\;\;x + \frac{\mathsf{fma}\left(b, y, z \cdot \mathsf{fma}\left(a, y, t \cdot \left(y \cdot z\right)\right)\right)}{0.607771387771}\\
\mathbf{else}:\\
\;\;\;\;x + \left(\mathsf{fma}\left(3.13060547623, y, 11.1667541262 \cdot \frac{y}{z}\right) - 47.69379582500642 \cdot \frac{y}{z}\right)\\
\end{array}
\end{array}
if z < -4.0999999999999996Initial program 58.2%
Taylor expanded in z around -inf
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6459.1
Applied rewrites59.1%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6459.1
Applied rewrites59.1%
if -4.0999999999999996 < z < 2.65e20Initial program 58.2%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6462.4
Applied rewrites62.4%
Taylor expanded in z around 0
Applied rewrites53.8%
if 2.65e20 < z Initial program 58.2%
Taylor expanded in z around inf
lower--.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f6456.6
Applied rewrites56.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (* y (- 3.13060547623 (/ 36.52704169880642 z))) x)))
(if (<= z -2.3)
t_1
(if (<= z 2.85e-43) (+ x (* 1.6453555072203998 (* b y))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (y * (3.13060547623 - (36.52704169880642 / z))) + x;
double tmp;
if (z <= -2.3) {
tmp = t_1;
} else if (z <= 2.85e-43) {
tmp = x + (1.6453555072203998 * (b * y));
} 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 = (y * (3.13060547623d0 - (36.52704169880642d0 / z))) + x
if (z <= (-2.3d0)) then
tmp = t_1
else if (z <= 2.85d-43) then
tmp = x + (1.6453555072203998d0 * (b * y))
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 = (y * (3.13060547623 - (36.52704169880642 / z))) + x;
double tmp;
if (z <= -2.3) {
tmp = t_1;
} else if (z <= 2.85e-43) {
tmp = x + (1.6453555072203998 * (b * y));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (y * (3.13060547623 - (36.52704169880642 / z))) + x tmp = 0 if z <= -2.3: tmp = t_1 elif z <= 2.85e-43: tmp = x + (1.6453555072203998 * (b * y)) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(y * Float64(3.13060547623 - Float64(36.52704169880642 / z))) + x) tmp = 0.0 if (z <= -2.3) tmp = t_1; elseif (z <= 2.85e-43) tmp = Float64(x + Float64(1.6453555072203998 * Float64(b * y))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (y * (3.13060547623 - (36.52704169880642 / z))) + x; tmp = 0.0; if (z <= -2.3) tmp = t_1; elseif (z <= 2.85e-43) tmp = x + (1.6453555072203998 * (b * y)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(y * N[(3.13060547623 - N[(36.52704169880642 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -2.3], t$95$1, If[LessEqual[z, 2.85e-43], N[(x + N[(1.6453555072203998 * N[(b * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(3.13060547623 - \frac{36.52704169880642}{z}\right) + x\\
\mathbf{if}\;z \leq -2.3:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.85 \cdot 10^{-43}:\\
\;\;\;\;x + 1.6453555072203998 \cdot \left(b \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.2999999999999998 or 2.85e-43 < z Initial program 58.2%
Taylor expanded in z around -inf
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6459.1
Applied rewrites59.1%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6459.1
Applied rewrites59.1%
if -2.2999999999999998 < z < 2.85e-43Initial program 58.2%
Taylor expanded in z around 0
lower-*.f64N/A
lower-*.f6459.8
Applied rewrites59.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ x (* 3.13060547623 y))))
(if (<= z -2.3)
t_1
(if (<= z 1.45e+15) (+ x (* 1.6453555072203998 (* b y))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (3.13060547623 * y);
double tmp;
if (z <= -2.3) {
tmp = t_1;
} else if (z <= 1.45e+15) {
tmp = x + (1.6453555072203998 * (b * y));
} 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 + (3.13060547623d0 * y)
if (z <= (-2.3d0)) then
tmp = t_1
else if (z <= 1.45d+15) then
tmp = x + (1.6453555072203998d0 * (b * y))
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 + (3.13060547623 * y);
double tmp;
if (z <= -2.3) {
tmp = t_1;
} else if (z <= 1.45e+15) {
tmp = x + (1.6453555072203998 * (b * y));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x + (3.13060547623 * y) tmp = 0 if z <= -2.3: tmp = t_1 elif z <= 1.45e+15: tmp = x + (1.6453555072203998 * (b * y)) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x + Float64(3.13060547623 * y)) tmp = 0.0 if (z <= -2.3) tmp = t_1; elseif (z <= 1.45e+15) tmp = Float64(x + Float64(1.6453555072203998 * Float64(b * y))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x + (3.13060547623 * y); tmp = 0.0; if (z <= -2.3) tmp = t_1; elseif (z <= 1.45e+15) tmp = x + (1.6453555072203998 * (b * y)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.3], t$95$1, If[LessEqual[z, 1.45e+15], N[(x + N[(1.6453555072203998 * N[(b * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + 3.13060547623 \cdot y\\
\mathbf{if}\;z \leq -2.3:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{+15}:\\
\;\;\;\;x + 1.6453555072203998 \cdot \left(b \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.2999999999999998 or 1.45e15 < z Initial program 58.2%
Taylor expanded in z around inf
lower-*.f6463.0
Applied rewrites63.0%
if -2.2999999999999998 < z < 1.45e15Initial program 58.2%
Taylor expanded in z around 0
lower-*.f64N/A
lower-*.f6459.8
Applied rewrites59.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1
(/
(*
y
(+
(* (+ (* (+ (* (+ (* z 3.13060547623) 11.1667541262) z) t) z) a) z)
b))
(+
(*
(+ (* (+ (* (+ z 15.234687407) z) 31.4690115749) z) 11.9400905721)
z)
0.607771387771)))
(t_2 (+ x (* 3.13060547623 y))))
(if (<= t_1 -4e+127)
(/ (* b y) 0.607771387771)
(if (<= t_1 5e+65)
t_2
(if (<= t_1 INFINITY) (* (/ b 0.607771387771) y) t_2)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771);
double t_2 = x + (3.13060547623 * y);
double tmp;
if (t_1 <= -4e+127) {
tmp = (b * y) / 0.607771387771;
} else if (t_1 <= 5e+65) {
tmp = t_2;
} else if (t_1 <= ((double) INFINITY)) {
tmp = (b / 0.607771387771) * y;
} else {
tmp = t_2;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771);
double t_2 = x + (3.13060547623 * y);
double tmp;
if (t_1 <= -4e+127) {
tmp = (b * y) / 0.607771387771;
} else if (t_1 <= 5e+65) {
tmp = t_2;
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = (b / 0.607771387771) * y;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771) t_2 = x + (3.13060547623 * y) tmp = 0 if t_1 <= -4e+127: tmp = (b * y) / 0.607771387771 elif t_1 <= 5e+65: tmp = t_2 elif t_1 <= math.inf: tmp = (b / 0.607771387771) * y else: tmp = t_2 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(y * Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / Float64(Float64(Float64(Float64(Float64(Float64(Float64(z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771)) t_2 = Float64(x + Float64(3.13060547623 * y)) tmp = 0.0 if (t_1 <= -4e+127) tmp = Float64(Float64(b * y) / 0.607771387771); elseif (t_1 <= 5e+65) tmp = t_2; elseif (t_1 <= Inf) tmp = Float64(Float64(b / 0.607771387771) * y); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771); t_2 = x + (3.13060547623 * y); tmp = 0.0; if (t_1 <= -4e+127) tmp = (b * y) / 0.607771387771; elseif (t_1 <= 5e+65) tmp = t_2; elseif (t_1 <= Inf) tmp = (b / 0.607771387771) * y; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(y * N[(N[(N[(N[(N[(N[(N[(N[(z * 3.13060547623), $MachinePrecision] + 11.1667541262), $MachinePrecision] * z), $MachinePrecision] + t), $MachinePrecision] * z), $MachinePrecision] + a), $MachinePrecision] * z), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[(N[(N[(N[(z + 15.234687407), $MachinePrecision] * z), $MachinePrecision] + 31.4690115749), $MachinePrecision] * z), $MachinePrecision] + 11.9400905721), $MachinePrecision] * z), $MachinePrecision] + 0.607771387771), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+127], N[(N[(b * y), $MachinePrecision] / 0.607771387771), $MachinePrecision], If[LessEqual[t$95$1, 5e+65], t$95$2, If[LessEqual[t$95$1, Infinity], N[(N[(b / 0.607771387771), $MachinePrecision] * y), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771}\\
t_2 := x + 3.13060547623 \cdot y\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+127}:\\
\;\;\;\;\frac{b \cdot y}{0.607771387771}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+65}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{b}{0.607771387771} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 z #s(literal 313060547623/100000000000 binary64)) #s(literal 55833770631/5000000000 binary64)) z) t) z) a) z) b)) (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 z #s(literal 15234687407/1000000000 binary64)) z) #s(literal 314690115749/10000000000 binary64)) z) #s(literal 119400905721/10000000000 binary64)) z) #s(literal 607771387771/1000000000000 binary64))) < -3.99999999999999982e127Initial program 58.2%
Taylor expanded in b around inf
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6421.7
Applied rewrites21.7%
Taylor expanded in z around 0
Applied rewrites21.5%
if -3.99999999999999982e127 < (/.f64 (*.f64 y (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 z #s(literal 313060547623/100000000000 binary64)) #s(literal 55833770631/5000000000 binary64)) z) t) z) a) z) b)) (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 z #s(literal 15234687407/1000000000 binary64)) z) #s(literal 314690115749/10000000000 binary64)) z) #s(literal 119400905721/10000000000 binary64)) z) #s(literal 607771387771/1000000000000 binary64))) < 4.99999999999999973e65 or +inf.0 < (/.f64 (*.f64 y (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 z #s(literal 313060547623/100000000000 binary64)) #s(literal 55833770631/5000000000 binary64)) z) t) z) a) z) b)) (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 z #s(literal 15234687407/1000000000 binary64)) z) #s(literal 314690115749/10000000000 binary64)) z) #s(literal 119400905721/10000000000 binary64)) z) #s(literal 607771387771/1000000000000 binary64))) Initial program 58.2%
Taylor expanded in z around inf
lower-*.f6463.0
Applied rewrites63.0%
if 4.99999999999999973e65 < (/.f64 (*.f64 y (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 z #s(literal 313060547623/100000000000 binary64)) #s(literal 55833770631/5000000000 binary64)) z) t) z) a) z) b)) (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 z #s(literal 15234687407/1000000000 binary64)) z) #s(literal 314690115749/10000000000 binary64)) z) #s(literal 119400905721/10000000000 binary64)) z) #s(literal 607771387771/1000000000000 binary64))) < +inf.0Initial program 58.2%
Taylor expanded in b around inf
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6421.7
Applied rewrites21.7%
Taylor expanded in z around 0
Applied rewrites21.5%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6421.5
Applied rewrites21.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1
(/
(*
y
(+
(* (+ (* (+ (* (+ (* z 3.13060547623) 11.1667541262) z) t) z) a) z)
b))
(+
(*
(+ (* (+ (* (+ z 15.234687407) z) 31.4690115749) z) 11.9400905721)
z)
0.607771387771)))
(t_2 (+ x (* 3.13060547623 y))))
(if (<= t_1 -4e+127)
(* (/ y 0.607771387771) b)
(if (<= t_1 5e+65)
t_2
(if (<= t_1 INFINITY) (* (/ b 0.607771387771) y) t_2)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771);
double t_2 = x + (3.13060547623 * y);
double tmp;
if (t_1 <= -4e+127) {
tmp = (y / 0.607771387771) * b;
} else if (t_1 <= 5e+65) {
tmp = t_2;
} else if (t_1 <= ((double) INFINITY)) {
tmp = (b / 0.607771387771) * y;
} else {
tmp = t_2;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771);
double t_2 = x + (3.13060547623 * y);
double tmp;
if (t_1 <= -4e+127) {
tmp = (y / 0.607771387771) * b;
} else if (t_1 <= 5e+65) {
tmp = t_2;
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = (b / 0.607771387771) * y;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771) t_2 = x + (3.13060547623 * y) tmp = 0 if t_1 <= -4e+127: tmp = (y / 0.607771387771) * b elif t_1 <= 5e+65: tmp = t_2 elif t_1 <= math.inf: tmp = (b / 0.607771387771) * y else: tmp = t_2 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(y * Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / Float64(Float64(Float64(Float64(Float64(Float64(Float64(z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771)) t_2 = Float64(x + Float64(3.13060547623 * y)) tmp = 0.0 if (t_1 <= -4e+127) tmp = Float64(Float64(y / 0.607771387771) * b); elseif (t_1 <= 5e+65) tmp = t_2; elseif (t_1 <= Inf) tmp = Float64(Float64(b / 0.607771387771) * y); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771); t_2 = x + (3.13060547623 * y); tmp = 0.0; if (t_1 <= -4e+127) tmp = (y / 0.607771387771) * b; elseif (t_1 <= 5e+65) tmp = t_2; elseif (t_1 <= Inf) tmp = (b / 0.607771387771) * y; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(y * N[(N[(N[(N[(N[(N[(N[(N[(z * 3.13060547623), $MachinePrecision] + 11.1667541262), $MachinePrecision] * z), $MachinePrecision] + t), $MachinePrecision] * z), $MachinePrecision] + a), $MachinePrecision] * z), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[(N[(N[(N[(z + 15.234687407), $MachinePrecision] * z), $MachinePrecision] + 31.4690115749), $MachinePrecision] * z), $MachinePrecision] + 11.9400905721), $MachinePrecision] * z), $MachinePrecision] + 0.607771387771), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+127], N[(N[(y / 0.607771387771), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[t$95$1, 5e+65], t$95$2, If[LessEqual[t$95$1, Infinity], N[(N[(b / 0.607771387771), $MachinePrecision] * y), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771}\\
t_2 := x + 3.13060547623 \cdot y\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+127}:\\
\;\;\;\;\frac{y}{0.607771387771} \cdot b\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+65}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{b}{0.607771387771} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 z #s(literal 313060547623/100000000000 binary64)) #s(literal 55833770631/5000000000 binary64)) z) t) z) a) z) b)) (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 z #s(literal 15234687407/1000000000 binary64)) z) #s(literal 314690115749/10000000000 binary64)) z) #s(literal 119400905721/10000000000 binary64)) z) #s(literal 607771387771/1000000000000 binary64))) < -3.99999999999999982e127Initial program 58.2%
Taylor expanded in b around inf
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6421.7
Applied rewrites21.7%
Taylor expanded in z around 0
Applied rewrites21.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6421.5
Applied rewrites21.5%
if -3.99999999999999982e127 < (/.f64 (*.f64 y (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 z #s(literal 313060547623/100000000000 binary64)) #s(literal 55833770631/5000000000 binary64)) z) t) z) a) z) b)) (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 z #s(literal 15234687407/1000000000 binary64)) z) #s(literal 314690115749/10000000000 binary64)) z) #s(literal 119400905721/10000000000 binary64)) z) #s(literal 607771387771/1000000000000 binary64))) < 4.99999999999999973e65 or +inf.0 < (/.f64 (*.f64 y (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 z #s(literal 313060547623/100000000000 binary64)) #s(literal 55833770631/5000000000 binary64)) z) t) z) a) z) b)) (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 z #s(literal 15234687407/1000000000 binary64)) z) #s(literal 314690115749/10000000000 binary64)) z) #s(literal 119400905721/10000000000 binary64)) z) #s(literal 607771387771/1000000000000 binary64))) Initial program 58.2%
Taylor expanded in z around inf
lower-*.f6463.0
Applied rewrites63.0%
if 4.99999999999999973e65 < (/.f64 (*.f64 y (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 z #s(literal 313060547623/100000000000 binary64)) #s(literal 55833770631/5000000000 binary64)) z) t) z) a) z) b)) (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 z #s(literal 15234687407/1000000000 binary64)) z) #s(literal 314690115749/10000000000 binary64)) z) #s(literal 119400905721/10000000000 binary64)) z) #s(literal 607771387771/1000000000000 binary64))) < +inf.0Initial program 58.2%
Taylor expanded in b around inf
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6421.7
Applied rewrites21.7%
Taylor expanded in z around 0
Applied rewrites21.5%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6421.5
Applied rewrites21.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (/ b 0.607771387771) y))
(t_2
(/
(*
y
(+
(* (+ (* (+ (* (+ (* z 3.13060547623) 11.1667541262) z) t) z) a) z)
b))
(+
(*
(+ (* (+ (* (+ z 15.234687407) z) 31.4690115749) z) 11.9400905721)
z)
0.607771387771)))
(t_3 (+ x (* 3.13060547623 y))))
(if (<= t_2 -4e+127)
t_1
(if (<= t_2 5e+65) t_3 (if (<= t_2 INFINITY) t_1 t_3)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (b / 0.607771387771) * y;
double t_2 = (y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771);
double t_3 = x + (3.13060547623 * y);
double tmp;
if (t_2 <= -4e+127) {
tmp = t_1;
} else if (t_2 <= 5e+65) {
tmp = t_3;
} else if (t_2 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = t_3;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (b / 0.607771387771) * y;
double t_2 = (y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771);
double t_3 = x + (3.13060547623 * y);
double tmp;
if (t_2 <= -4e+127) {
tmp = t_1;
} else if (t_2 <= 5e+65) {
tmp = t_3;
} else if (t_2 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = t_3;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (b / 0.607771387771) * y t_2 = (y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771) t_3 = x + (3.13060547623 * y) tmp = 0 if t_2 <= -4e+127: tmp = t_1 elif t_2 <= 5e+65: tmp = t_3 elif t_2 <= math.inf: tmp = t_1 else: tmp = t_3 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(b / 0.607771387771) * y) t_2 = Float64(Float64(y * Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / Float64(Float64(Float64(Float64(Float64(Float64(Float64(z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771)) t_3 = Float64(x + Float64(3.13060547623 * y)) tmp = 0.0 if (t_2 <= -4e+127) tmp = t_1; elseif (t_2 <= 5e+65) tmp = t_3; elseif (t_2 <= Inf) tmp = t_1; else tmp = t_3; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (b / 0.607771387771) * y; t_2 = (y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771); t_3 = x + (3.13060547623 * y); tmp = 0.0; if (t_2 <= -4e+127) tmp = t_1; elseif (t_2 <= 5e+65) tmp = t_3; elseif (t_2 <= Inf) tmp = t_1; else tmp = t_3; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b / 0.607771387771), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y * N[(N[(N[(N[(N[(N[(N[(N[(z * 3.13060547623), $MachinePrecision] + 11.1667541262), $MachinePrecision] * z), $MachinePrecision] + t), $MachinePrecision] * z), $MachinePrecision] + a), $MachinePrecision] * z), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[(N[(N[(N[(z + 15.234687407), $MachinePrecision] * z), $MachinePrecision] + 31.4690115749), $MachinePrecision] * z), $MachinePrecision] + 11.9400905721), $MachinePrecision] * z), $MachinePrecision] + 0.607771387771), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -4e+127], t$95$1, If[LessEqual[t$95$2, 5e+65], t$95$3, If[LessEqual[t$95$2, Infinity], t$95$1, t$95$3]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{b}{0.607771387771} \cdot y\\
t_2 := \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771}\\
t_3 := x + 3.13060547623 \cdot y\\
\mathbf{if}\;t\_2 \leq -4 \cdot 10^{+127}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+65}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 z #s(literal 313060547623/100000000000 binary64)) #s(literal 55833770631/5000000000 binary64)) z) t) z) a) z) b)) (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 z #s(literal 15234687407/1000000000 binary64)) z) #s(literal 314690115749/10000000000 binary64)) z) #s(literal 119400905721/10000000000 binary64)) z) #s(literal 607771387771/1000000000000 binary64))) < -3.99999999999999982e127 or 4.99999999999999973e65 < (/.f64 (*.f64 y (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 z #s(literal 313060547623/100000000000 binary64)) #s(literal 55833770631/5000000000 binary64)) z) t) z) a) z) b)) (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 z #s(literal 15234687407/1000000000 binary64)) z) #s(literal 314690115749/10000000000 binary64)) z) #s(literal 119400905721/10000000000 binary64)) z) #s(literal 607771387771/1000000000000 binary64))) < +inf.0Initial program 58.2%
Taylor expanded in b around inf
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6421.7
Applied rewrites21.7%
Taylor expanded in z around 0
Applied rewrites21.5%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6421.5
Applied rewrites21.5%
if -3.99999999999999982e127 < (/.f64 (*.f64 y (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 z #s(literal 313060547623/100000000000 binary64)) #s(literal 55833770631/5000000000 binary64)) z) t) z) a) z) b)) (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 z #s(literal 15234687407/1000000000 binary64)) z) #s(literal 314690115749/10000000000 binary64)) z) #s(literal 119400905721/10000000000 binary64)) z) #s(literal 607771387771/1000000000000 binary64))) < 4.99999999999999973e65 or +inf.0 < (/.f64 (*.f64 y (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 z #s(literal 313060547623/100000000000 binary64)) #s(literal 55833770631/5000000000 binary64)) z) t) z) a) z) b)) (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 z #s(literal 15234687407/1000000000 binary64)) z) #s(literal 314690115749/10000000000 binary64)) z) #s(literal 119400905721/10000000000 binary64)) z) #s(literal 607771387771/1000000000000 binary64))) Initial program 58.2%
Taylor expanded in z around inf
lower-*.f6463.0
Applied rewrites63.0%
(FPCore (x y z t a b) :precision binary64 (+ x (* 3.13060547623 y)))
double code(double x, double y, double z, double t, double a, double b) {
return x + (3.13060547623 * y);
}
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 + (3.13060547623d0 * y)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x + (3.13060547623 * y);
}
def code(x, y, z, t, a, b): return x + (3.13060547623 * y)
function code(x, y, z, t, a, b) return Float64(x + Float64(3.13060547623 * y)) end
function tmp = code(x, y, z, t, a, b) tmp = x + (3.13060547623 * y); end
code[x_, y_, z_, t_, a_, b_] := N[(x + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + 3.13060547623 \cdot y
\end{array}
Initial program 58.2%
Taylor expanded in z around inf
lower-*.f6463.0
Applied rewrites63.0%
herbie shell --seed 2025143
(FPCore (x y z t a b)
:name "Numeric.SpecFunctions:logGamma from math-functions-0.1.5.2, D"
:precision binary64
(+ x (/ (* y (+ (* (+ (* (+ (* (+ (* z 3.13060547623) 11.1667541262) z) t) z) a) z) b)) (+ (* (+ (* (+ (* (+ z 15.234687407) z) 31.4690115749) z) 11.9400905721) z) 0.607771387771))))