
(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}
Sampling outcomes in binary64 precision:
Herbie found 14 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
(if (<= z -1850000000000.0)
(fma 3.13060547623 y x)
(if (<= z 5.4e-12)
(+ (/ (* (fma (fma t z a) z b) y) 0.607771387771) x)
(if (<= z 3.4e+74)
(fma
y
(*
z
(/
(fma (fma (fma 3.13060547623 z 11.1667541262) z t) z a)
(fma
(fma (fma (+ 15.234687407 z) z 31.4690115749) z 11.9400905721)
z
0.607771387771)))
x)
(+ x (* 3.13060547623 y))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1850000000000.0) {
tmp = fma(3.13060547623, y, x);
} else if (z <= 5.4e-12) {
tmp = ((fma(fma(t, z, a), z, b) * y) / 0.607771387771) + x;
} else if (z <= 3.4e+74) {
tmp = fma(y, (z * (fma(fma(fma(3.13060547623, z, 11.1667541262), z, t), z, a) / fma(fma(fma((15.234687407 + z), z, 31.4690115749), z, 11.9400905721), z, 0.607771387771))), x);
} else {
tmp = x + (3.13060547623 * y);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -1850000000000.0) tmp = fma(3.13060547623, y, x); elseif (z <= 5.4e-12) tmp = Float64(Float64(Float64(fma(fma(t, z, a), z, b) * y) / 0.607771387771) + x); elseif (z <= 3.4e+74) tmp = fma(y, Float64(z * Float64(fma(fma(fma(3.13060547623, z, 11.1667541262), z, t), z, a) / fma(fma(fma(Float64(15.234687407 + z), z, 31.4690115749), z, 11.9400905721), z, 0.607771387771))), x); else tmp = Float64(x + Float64(3.13060547623 * y)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1850000000000.0], N[(3.13060547623 * y + x), $MachinePrecision], If[LessEqual[z, 5.4e-12], N[(N[(N[(N[(N[(t * z + a), $MachinePrecision] * z + b), $MachinePrecision] * y), $MachinePrecision] / 0.607771387771), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 3.4e+74], N[(y * N[(z * N[(N[(N[(N[(3.13060547623 * z + 11.1667541262), $MachinePrecision] * z + t), $MachinePrecision] * z + a), $MachinePrecision] / N[(N[(N[(N[(15.234687407 + z), $MachinePrecision] * z + 31.4690115749), $MachinePrecision] * z + 11.9400905721), $MachinePrecision] * z + 0.607771387771), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(x + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1850000000000:\\
\;\;\;\;\mathsf{fma}\left(3.13060547623, y, x\right)\\
\mathbf{elif}\;z \leq 5.4 \cdot 10^{-12}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(t, z, a\right), z, b\right) \cdot y}{0.607771387771} + x\\
\mathbf{elif}\;z \leq 3.4 \cdot 10^{+74}:\\
\;\;\;\;\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)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(15.234687407 + z, z, 31.4690115749\right), z, 11.9400905721\right), z, 0.607771387771\right)}, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + 3.13060547623 \cdot y\\
\end{array}
\end{array}
if z < -1.85e12Initial program 17.3%
Taylor expanded in z around inf
+-commutativeN/A
lower-fma.f6489.8
Applied rewrites89.8%
if -1.85e12 < z < 5.39999999999999961e-12Initial program 99.7%
Taylor expanded in z around 0
Applied rewrites99.1%
Taylor expanded in z around 0
Applied rewrites99.1%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.1
Applied rewrites99.1%
if 5.39999999999999961e-12 < z < 3.3999999999999999e74Initial program 74.8%
Taylor expanded in b around 0
Applied rewrites88.5%
if 3.3999999999999999e74 < z Initial program 1.8%
Taylor expanded in z around inf
lower-*.f6498.2
Applied rewrites98.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* 1.6453555072203998 (* b 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))))
(if (<= t_2 -4e+69)
t_1
(if (<= t_2 4e+82)
x
(if (<= t_2 INFINITY) t_1 (+ x (* 3.13060547623 y)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 1.6453555072203998 * (b * 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 tmp;
if (t_2 <= -4e+69) {
tmp = t_1;
} else if (t_2 <= 4e+82) {
tmp = x;
} else if (t_2 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = x + (3.13060547623 * y);
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 1.6453555072203998 * (b * 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 tmp;
if (t_2 <= -4e+69) {
tmp = t_1;
} else if (t_2 <= 4e+82) {
tmp = x;
} else if (t_2 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = x + (3.13060547623 * y);
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = 1.6453555072203998 * (b * 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) tmp = 0 if t_2 <= -4e+69: tmp = t_1 elif t_2 <= 4e+82: tmp = x elif t_2 <= math.inf: tmp = t_1 else: tmp = x + (3.13060547623 * y) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(1.6453555072203998 * Float64(b * 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)) tmp = 0.0 if (t_2 <= -4e+69) tmp = t_1; elseif (t_2 <= 4e+82) tmp = x; elseif (t_2 <= Inf) tmp = t_1; else tmp = Float64(x + Float64(3.13060547623 * y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = 1.6453555072203998 * (b * 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); tmp = 0.0; if (t_2 <= -4e+69) tmp = t_1; elseif (t_2 <= 4e+82) tmp = x; elseif (t_2 <= Inf) tmp = t_1; else tmp = x + (3.13060547623 * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(1.6453555072203998 * N[(b * y), $MachinePrecision]), $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]}, If[LessEqual[t$95$2, -4e+69], t$95$1, If[LessEqual[t$95$2, 4e+82], x, If[LessEqual[t$95$2, Infinity], t$95$1, N[(x + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 1.6453555072203998 \cdot \left(b \cdot y\right)\\
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}\\
\mathbf{if}\;t\_2 \leq -4 \cdot 10^{+69}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+82}:\\
\;\;\;\;x\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x + 3.13060547623 \cdot y\\
\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))) < -4.0000000000000003e69 or 3.9999999999999999e82 < (/.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 89.1%
Taylor expanded in b around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
Applied rewrites55.2%
Taylor expanded in z around 0
lower-*.f64N/A
lower-*.f6452.6
Applied rewrites52.6%
if -4.0000000000000003e69 < (/.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.9999999999999999e82Initial program 99.8%
Taylor expanded in x around inf
Applied rewrites70.1%
if +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 0.0%
Taylor expanded in z around inf
lower-*.f6498.0
Applied rewrites98.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1
(+
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)))))
(if (<= t_1 INFINITY) t_1 (+ x (* 3.13060547623 y)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 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 tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = x + (3.13060547623 * y);
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 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 tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = x + (3.13060547623 * y);
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = 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)) tmp = 0 if t_1 <= math.inf: tmp = t_1 else: tmp = x + (3.13060547623 * y) return tmp
function code(x, y, z, t, a, b) t_1 = 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))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(x + Float64(3.13060547623 * y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = 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)); tmp = 0.0; if (t_1 <= Inf) tmp = t_1; else tmp = x + (3.13060547623 * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(x + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 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}\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x + 3.13060547623 \cdot y\\
\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 94.9%
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 0.0%
Taylor expanded in z around inf
lower-*.f6498.0
Applied rewrites98.0%
(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
y
(/
(fma (fma (* z z) (fma 3.13060547623 z 11.1667541262) a) z b)
(fma
(fma (fma (+ 15.234687407 z) z 31.4690115749) z 11.9400905721)
z
0.607771387771))
x)
(+ x (* 3.13060547623 y))))
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(y, (fma(fma((z * z), fma(3.13060547623, z, 11.1667541262), a), z, b) / fma(fma(fma((15.234687407 + z), z, 31.4690115749), z, 11.9400905721), z, 0.607771387771)), x);
} else {
tmp = x + (3.13060547623 * y);
}
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(y, Float64(fma(fma(Float64(z * z), fma(3.13060547623, z, 11.1667541262), a), z, b) / fma(fma(fma(Float64(15.234687407 + z), z, 31.4690115749), z, 11.9400905721), z, 0.607771387771)), x); else tmp = Float64(x + Float64(3.13060547623 * y)); 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[(y * N[(N[(N[(N[(z * z), $MachinePrecision] * N[(3.13060547623 * z + 11.1667541262), $MachinePrecision] + a), $MachinePrecision] * z + b), $MachinePrecision] / N[(N[(N[(N[(15.234687407 + z), $MachinePrecision] * z + 31.4690115749), $MachinePrecision] * z + 11.9400905721), $MachinePrecision] * z + 0.607771387771), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(x + N[(3.13060547623 * y), $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(y, \frac{\mathsf{fma}\left(\mathsf{fma}\left(z \cdot z, \mathsf{fma}\left(3.13060547623, z, 11.1667541262\right), a\right), z, b\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(15.234687407 + z, z, 31.4690115749\right), z, 11.9400905721\right), z, 0.607771387771\right)}, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + 3.13060547623 \cdot y\\
\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 94.9%
Taylor expanded in t around 0
Applied rewrites92.7%
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 0.0%
Taylor expanded in z around inf
lower-*.f6498.0
Applied rewrites98.0%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -1850000000000.0)
(fma 3.13060547623 y x)
(if (<= z 2.22e+27)
(+ (/ (* (fma (fma t z a) z b) y) 0.607771387771) x)
(+ x (* 3.13060547623 y)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1850000000000.0) {
tmp = fma(3.13060547623, y, x);
} else if (z <= 2.22e+27) {
tmp = ((fma(fma(t, z, a), z, b) * y) / 0.607771387771) + x;
} else {
tmp = x + (3.13060547623 * y);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -1850000000000.0) tmp = fma(3.13060547623, y, x); elseif (z <= 2.22e+27) tmp = Float64(Float64(Float64(fma(fma(t, z, a), z, b) * y) / 0.607771387771) + x); else tmp = Float64(x + Float64(3.13060547623 * y)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1850000000000.0], N[(3.13060547623 * y + x), $MachinePrecision], If[LessEqual[z, 2.22e+27], N[(N[(N[(N[(N[(t * z + a), $MachinePrecision] * z + b), $MachinePrecision] * y), $MachinePrecision] / 0.607771387771), $MachinePrecision] + x), $MachinePrecision], N[(x + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1850000000000:\\
\;\;\;\;\mathsf{fma}\left(3.13060547623, y, x\right)\\
\mathbf{elif}\;z \leq 2.22 \cdot 10^{+27}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(t, z, a\right), z, b\right) \cdot y}{0.607771387771} + x\\
\mathbf{else}:\\
\;\;\;\;x + 3.13060547623 \cdot y\\
\end{array}
\end{array}
if z < -1.85e12Initial program 17.3%
Taylor expanded in z around inf
+-commutativeN/A
lower-fma.f6489.8
Applied rewrites89.8%
if -1.85e12 < z < 2.22000000000000007e27Initial program 99.0%
Taylor expanded in z around 0
Applied rewrites96.5%
Taylor expanded in z around 0
Applied rewrites96.5%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6496.5
Applied rewrites96.5%
if 2.22000000000000007e27 < z Initial program 5.1%
Taylor expanded in z around inf
lower-*.f6494.1
Applied rewrites94.1%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -1850000000000.0)
(fma 3.13060547623 y x)
(if (<= z 2.22e+27)
(fma y (/ (fma (fma t z a) z b) 0.607771387771) x)
(+ x (* 3.13060547623 y)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1850000000000.0) {
tmp = fma(3.13060547623, y, x);
} else if (z <= 2.22e+27) {
tmp = fma(y, (fma(fma(t, z, a), z, b) / 0.607771387771), x);
} else {
tmp = x + (3.13060547623 * y);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -1850000000000.0) tmp = fma(3.13060547623, y, x); elseif (z <= 2.22e+27) tmp = fma(y, Float64(fma(fma(t, z, a), z, b) / 0.607771387771), x); else tmp = Float64(x + Float64(3.13060547623 * y)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1850000000000.0], N[(3.13060547623 * y + x), $MachinePrecision], If[LessEqual[z, 2.22e+27], N[(y * N[(N[(N[(t * z + a), $MachinePrecision] * z + b), $MachinePrecision] / 0.607771387771), $MachinePrecision] + x), $MachinePrecision], N[(x + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1850000000000:\\
\;\;\;\;\mathsf{fma}\left(3.13060547623, y, x\right)\\
\mathbf{elif}\;z \leq 2.22 \cdot 10^{+27}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{\mathsf{fma}\left(\mathsf{fma}\left(t, z, a\right), z, b\right)}{0.607771387771}, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + 3.13060547623 \cdot y\\
\end{array}
\end{array}
if z < -1.85e12Initial program 17.3%
Taylor expanded in z around inf
+-commutativeN/A
lower-fma.f6489.8
Applied rewrites89.8%
if -1.85e12 < z < 2.22000000000000007e27Initial program 99.0%
Taylor expanded in z around 0
Applied rewrites96.5%
Taylor expanded in z around 0
Applied rewrites96.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites96.4%
if 2.22000000000000007e27 < z Initial program 5.1%
Taylor expanded in z around inf
lower-*.f6494.1
Applied rewrites94.1%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -1200000000000.0)
(+ x (fma 3.13060547623 y (/ (* y 36.52704169880642) (- z))))
(if (<= z 1.12e+27)
(+ x (/ (* y (fma a z b)) 0.607771387771))
(+ x (* 3.13060547623 y)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1200000000000.0) {
tmp = x + fma(3.13060547623, y, ((y * 36.52704169880642) / -z));
} else if (z <= 1.12e+27) {
tmp = x + ((y * fma(a, z, b)) / 0.607771387771);
} else {
tmp = x + (3.13060547623 * y);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -1200000000000.0) tmp = Float64(x + fma(3.13060547623, y, Float64(Float64(y * 36.52704169880642) / Float64(-z)))); elseif (z <= 1.12e+27) tmp = Float64(x + Float64(Float64(y * fma(a, z, b)) / 0.607771387771)); else tmp = Float64(x + Float64(3.13060547623 * y)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1200000000000.0], N[(x + N[(3.13060547623 * y + N[(N[(y * 36.52704169880642), $MachinePrecision] / (-z)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.12e+27], N[(x + N[(N[(y * N[(a * z + b), $MachinePrecision]), $MachinePrecision] / 0.607771387771), $MachinePrecision]), $MachinePrecision], N[(x + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1200000000000:\\
\;\;\;\;x + \mathsf{fma}\left(3.13060547623, y, \frac{y \cdot 36.52704169880642}{-z}\right)\\
\mathbf{elif}\;z \leq 1.12 \cdot 10^{+27}:\\
\;\;\;\;x + \frac{y \cdot \mathsf{fma}\left(a, z, b\right)}{0.607771387771}\\
\mathbf{else}:\\
\;\;\;\;x + 3.13060547623 \cdot y\\
\end{array}
\end{array}
if z < -1.2e12Initial program 18.7%
Taylor expanded in z around -inf
+-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
metadata-eval88.5
Applied rewrites88.5%
if -1.2e12 < z < 1.12e27Initial program 99.0%
Taylor expanded in z around 0
Applied rewrites96.4%
Taylor expanded in z around 0
Applied rewrites96.4%
Taylor expanded in z around 0
*-commutativeN/A
+-commutativeN/A
lower-fma.f6493.9
Applied rewrites93.9%
if 1.12e27 < z Initial program 5.1%
Taylor expanded in z around inf
lower-*.f6494.1
Applied rewrites94.1%
Final simplification92.7%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -1200000000000.0)
(fma 3.13060547623 y x)
(if (<= z 1.12e+27)
(+ x (/ (* y (fma a z b)) 0.607771387771))
(+ x (* 3.13060547623 y)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1200000000000.0) {
tmp = fma(3.13060547623, y, x);
} else if (z <= 1.12e+27) {
tmp = x + ((y * fma(a, z, b)) / 0.607771387771);
} else {
tmp = x + (3.13060547623 * y);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -1200000000000.0) tmp = fma(3.13060547623, y, x); elseif (z <= 1.12e+27) tmp = Float64(x + Float64(Float64(y * fma(a, z, b)) / 0.607771387771)); else tmp = Float64(x + Float64(3.13060547623 * y)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1200000000000.0], N[(3.13060547623 * y + x), $MachinePrecision], If[LessEqual[z, 1.12e+27], N[(x + N[(N[(y * N[(a * z + b), $MachinePrecision]), $MachinePrecision] / 0.607771387771), $MachinePrecision]), $MachinePrecision], N[(x + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1200000000000:\\
\;\;\;\;\mathsf{fma}\left(3.13060547623, y, x\right)\\
\mathbf{elif}\;z \leq 1.12 \cdot 10^{+27}:\\
\;\;\;\;x + \frac{y \cdot \mathsf{fma}\left(a, z, b\right)}{0.607771387771}\\
\mathbf{else}:\\
\;\;\;\;x + 3.13060547623 \cdot y\\
\end{array}
\end{array}
if z < -1.2e12Initial program 18.7%
Taylor expanded in z around inf
+-commutativeN/A
lower-fma.f6488.5
Applied rewrites88.5%
if -1.2e12 < z < 1.12e27Initial program 99.0%
Taylor expanded in z around 0
Applied rewrites96.4%
Taylor expanded in z around 0
Applied rewrites96.4%
Taylor expanded in z around 0
*-commutativeN/A
+-commutativeN/A
lower-fma.f6493.9
Applied rewrites93.9%
if 1.12e27 < z Initial program 5.1%
Taylor expanded in z around inf
lower-*.f6494.1
Applied rewrites94.1%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -50000000000.0)
(fma 3.13060547623 y x)
(if (<= z 1.1e+27)
(+ x (* (* b y) 1.6453555072203998))
(+ x (* 3.13060547623 y)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -50000000000.0) {
tmp = fma(3.13060547623, y, x);
} else if (z <= 1.1e+27) {
tmp = x + ((b * y) * 1.6453555072203998);
} else {
tmp = x + (3.13060547623 * y);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -50000000000.0) tmp = fma(3.13060547623, y, x); elseif (z <= 1.1e+27) tmp = Float64(x + Float64(Float64(b * y) * 1.6453555072203998)); else tmp = Float64(x + Float64(3.13060547623 * y)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -50000000000.0], N[(3.13060547623 * y + x), $MachinePrecision], If[LessEqual[z, 1.1e+27], N[(x + N[(N[(b * y), $MachinePrecision] * 1.6453555072203998), $MachinePrecision]), $MachinePrecision], N[(x + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -50000000000:\\
\;\;\;\;\mathsf{fma}\left(3.13060547623, y, x\right)\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{+27}:\\
\;\;\;\;x + \left(b \cdot y\right) \cdot 1.6453555072203998\\
\mathbf{else}:\\
\;\;\;\;x + 3.13060547623 \cdot y\\
\end{array}
\end{array}
if z < -5e10Initial program 18.7%
Taylor expanded in z around inf
+-commutativeN/A
lower-fma.f6488.5
Applied rewrites88.5%
if -5e10 < z < 1.0999999999999999e27Initial program 99.0%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
lower-*.f6482.1
Applied rewrites82.1%
if 1.0999999999999999e27 < z Initial program 5.1%
Taylor expanded in z around inf
lower-*.f6494.1
Applied rewrites94.1%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -50000000000.0)
(fma 3.13060547623 y x)
(if (<= z 1.1e+27)
(fma (* b y) 1.6453555072203998 x)
(+ x (* 3.13060547623 y)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -50000000000.0) {
tmp = fma(3.13060547623, y, x);
} else if (z <= 1.1e+27) {
tmp = fma((b * y), 1.6453555072203998, x);
} else {
tmp = x + (3.13060547623 * y);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -50000000000.0) tmp = fma(3.13060547623, y, x); elseif (z <= 1.1e+27) tmp = fma(Float64(b * y), 1.6453555072203998, x); else tmp = Float64(x + Float64(3.13060547623 * y)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -50000000000.0], N[(3.13060547623 * y + x), $MachinePrecision], If[LessEqual[z, 1.1e+27], N[(N[(b * y), $MachinePrecision] * 1.6453555072203998 + x), $MachinePrecision], N[(x + N[(3.13060547623 * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -50000000000:\\
\;\;\;\;\mathsf{fma}\left(3.13060547623, y, x\right)\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{+27}:\\
\;\;\;\;\mathsf{fma}\left(b \cdot y, 1.6453555072203998, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + 3.13060547623 \cdot y\\
\end{array}
\end{array}
if z < -5e10Initial program 18.7%
Taylor expanded in z around inf
+-commutativeN/A
lower-fma.f6488.5
Applied rewrites88.5%
if -5e10 < z < 1.0999999999999999e27Initial program 99.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6482.1
Applied rewrites82.1%
if 1.0999999999999999e27 < z Initial program 5.1%
Taylor expanded in z around inf
lower-*.f6494.1
Applied rewrites94.1%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -1.76e+84) (not (<= y 1.02e+49))) (* 3.13060547623 y) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -1.76e+84) || !(y <= 1.02e+49)) {
tmp = 3.13060547623 * y;
} else {
tmp = x;
}
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 <= (-1.76d+84)) .or. (.not. (y <= 1.02d+49))) then
tmp = 3.13060547623d0 * y
else
tmp = x
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 <= -1.76e+84) || !(y <= 1.02e+49)) {
tmp = 3.13060547623 * y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -1.76e+84) or not (y <= 1.02e+49): tmp = 3.13060547623 * y else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -1.76e+84) || !(y <= 1.02e+49)) tmp = Float64(3.13060547623 * y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -1.76e+84) || ~((y <= 1.02e+49))) tmp = 3.13060547623 * y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -1.76e+84], N[Not[LessEqual[y, 1.02e+49]], $MachinePrecision]], N[(3.13060547623 * y), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.76 \cdot 10^{+84} \lor \neg \left(y \leq 1.02 \cdot 10^{+49}\right):\\
\;\;\;\;3.13060547623 \cdot y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.75999999999999999e84 or 1.02e49 < y Initial program 50.2%
Taylor expanded in z around inf
+-commutativeN/A
lower-fma.f6455.5
Applied rewrites55.5%
Taylor expanded in x around 0
lower-*.f6444.2
Applied rewrites44.2%
if -1.75999999999999999e84 < y < 1.02e49Initial program 61.5%
Taylor expanded in x around inf
Applied rewrites61.7%
Final simplification55.4%
(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 57.4%
Taylor expanded in z around inf
lower-*.f6465.2
Applied rewrites65.2%
(FPCore (x y z t a b) :precision binary64 (fma 3.13060547623 y x))
double code(double x, double y, double z, double t, double a, double b) {
return fma(3.13060547623, y, x);
}
function code(x, y, z, t, a, b) return fma(3.13060547623, y, x) end
code[x_, y_, z_, t_, a_, b_] := N[(3.13060547623 * y + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(3.13060547623, y, x\right)
\end{array}
Initial program 57.4%
Taylor expanded in z around inf
+-commutativeN/A
lower-fma.f6465.1
Applied rewrites65.1%
(FPCore (x y z t a b) :precision binary64 x)
double code(double x, double y, double z, double t, double a, double b) {
return x;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = x
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x;
}
def code(x, y, z, t, a, b): return x
function code(x, y, z, t, a, b) return x end
function tmp = code(x, y, z, t, a, b) tmp = x; end
code[x_, y_, z_, t_, a_, b_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 57.4%
Taylor expanded in x around inf
Applied rewrites45.0%
herbie shell --seed 2025085
(FPCore (x y z t a b)
:name "Numeric.SpecFunctions:logGamma from math-functions-0.1.5.2, D"
:precision binary64
:alt
(! :herbie-platform default (if (< z -649934499625263200000000000000000000000000000000000000) (+ x (* (+ (- 313060547623/100000000000 (/ 18263520849403207/500000000000000 z)) (/ t (* z z))) (/ y 1))) (if (< z 706696543691428700000000000000000000000000000000000000000000) (+ x (/ y (/ (+ (* (+ (* (+ (* (+ z 15234687407/1000000000) z) 314690115749/10000000000) z) 119400905721/10000000000) z) 607771387771/1000000000000) (+ (* (+ (* (+ (* (+ (* z 313060547623/100000000000) 55833770631/5000000000) z) t) z) a) z) b)))) (+ x (* (+ (- 313060547623/100000000000 (/ 18263520849403207/500000000000000 z)) (/ t (* z z))) (/ y 1))))))
(+ 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))))