/* Generated by Cython 0.29.22 */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
    #error Cython requires Python 2.6+ or Python 3.3+.
#else
#define CYTHON_ABI "0_29_22"
#define CYTHON_HEX_VERSION 0x001D16F0
#define CYTHON_FUTURE_DIVISION 1
#include <stddef.h>
#ifndef offsetof
  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif
#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#define __PYX_COMMA ,
#ifndef HAVE_LONG_LONG
  #if PY_VERSION_HEX >= 0x02070000
    #define HAVE_LONG_LONG
  #endif
#endif
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
  #define CYTHON_COMPILING_IN_PYPY 1
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #if PY_VERSION_HEX < 0x03050000
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #undef CYTHON_AVOID_BORROWED_REFS
  #define CYTHON_AVOID_BORROWED_REFS 1
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
#elif defined(PYSTON_VERSION)
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 1
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_ASYNC_SLOTS
  #define CYTHON_USE_ASYNC_SLOTS 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
#else
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 1
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYTYPE_LOOKUP
    #define CYTHON_USE_PYTYPE_LOOKUP 0
  #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
    #define CYTHON_USE_PYTYPE_LOOKUP 1
  #endif
  #if PY_MAJOR_VERSION < 3
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYLONG_INTERNALS
    #define CYTHON_USE_PYLONG_INTERNALS 0
  #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
    #define CYTHON_USE_PYLONG_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_PYLIST_INTERNALS
    #define CYTHON_USE_PYLIST_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #if PY_VERSION_HEX < 0x030300F0
    #undef CYTHON_USE_UNICODE_WRITER
    #define CYTHON_USE_UNICODE_WRITER 0
  #elif !defined(CYTHON_USE_UNICODE_WRITER)
    #define CYTHON_USE_UNICODE_WRITER 1
  #endif
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #ifndef CYTHON_FAST_THREAD_STATE
    #define CYTHON_FAST_THREAD_STATE 1
  #endif
  #ifndef CYTHON_FAST_PYCALL
    #define CYTHON_FAST_PYCALL 1
  #endif
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
  #endif
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
  #endif
  #ifndef CYTHON_USE_DICT_VERSIONS
    #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
  #endif
  #ifndef CYTHON_USE_EXC_INFO_STACK
    #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
  #endif
#endif
#if !defined(CYTHON_FAST_PYCCALL)
#define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
#endif
#if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
  #undef SHIFT
  #undef BASE
  #undef MASK
  #ifdef SIZEOF_VOID_P
    enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
  #endif
#endif
#ifndef __has_attribute
  #define __has_attribute(x) 0
#endif
#ifndef __has_cpp_attribute
  #define __has_cpp_attribute(x) 0
#endif
#ifndef CYTHON_RESTRICT
  #if defined(__GNUC__)
    #define CYTHON_RESTRICT __restrict__
  #elif defined(_MSC_VER) && _MSC_VER >= 1400
    #define CYTHON_RESTRICT __restrict
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_RESTRICT restrict
  #else
    #define CYTHON_RESTRICT
  #endif
#endif
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif
#ifndef CYTHON_MAYBE_UNUSED_VAR
#  if defined(__cplusplus)
     template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
#  else
#    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
#  endif
#endif
#ifndef CYTHON_NCP_UNUSED
# if CYTHON_COMPILING_IN_CPYTHON
#  define CYTHON_NCP_UNUSED
# else
#  define CYTHON_NCP_UNUSED CYTHON_UNUSED
# endif
#endif
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
#ifdef _MSC_VER
    #ifndef _MSC_STDINT_H_
        #if _MSC_VER < 1300
           typedef unsigned char     uint8_t;
           typedef unsigned int      uint32_t;
        #else
           typedef unsigned __int8   uint8_t;
           typedef unsigned __int32  uint32_t;
        #endif
    #endif
#else
   #include <stdint.h>
#endif
#ifndef CYTHON_FALLTHROUGH
  #if defined(__cplusplus) && __cplusplus >= 201103L
    #if __has_cpp_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH [[fallthrough]]
    #elif __has_cpp_attribute(clang::fallthrough)
      #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
    #elif __has_cpp_attribute(gnu::fallthrough)
      #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
    #endif
  #endif
  #ifndef CYTHON_FALLTHROUGH
    #if __has_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
    #else
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
  #if defined(__clang__ ) && defined(__apple_build_version__)
    #if __apple_build_version__ < 7000000
      #undef  CYTHON_FALLTHROUGH
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
#endif

#ifndef CYTHON_INLINE
  #if defined(__clang__)
    #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  #elif defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif

#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
  #define Py_OptimizeFlag 0
#endif
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyClass_Type
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
#if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#else
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#endif
  #define __Pyx_DefaultClassType PyType_Type
#endif
#ifndef Py_TPFLAGS_CHECKTYPES
  #define Py_TPFLAGS_CHECKTYPES 0
#endif
#ifndef Py_TPFLAGS_HAVE_INDEX
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#ifndef Py_TPFLAGS_HAVE_FINALIZE
  #define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#ifndef METH_STACKLESS
  #define METH_STACKLESS 0
#endif
#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
  #ifndef METH_FASTCALL
     #define METH_FASTCALL 0x80
  #endif
  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
                                                          Py_ssize_t nargs, PyObject *kwnames);
#else
  #define __Pyx_PyCFunctionFast _PyCFunctionFast
  #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
#endif
#if CYTHON_FAST_PYCCALL
#define __Pyx_PyFastCFunction_Check(func)\
    ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
#else
#define __Pyx_PyFastCFunction_Check(func) 0
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  #define PyObject_Malloc(s)   PyMem_Malloc(s)
  #define PyObject_Free(p)     PyMem_Free(p)
  #define PyObject_Realloc(p)  PyMem_Realloc(p)
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
  #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
  #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
  #define PyMem_RawFree(p)             PyMem_Free(p)
#endif
#if CYTHON_COMPILING_IN_PYSTON
  #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
#else
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
#endif
#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#elif PY_VERSION_HEX >= 0x03060000
  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
#elif PY_VERSION_HEX >= 0x03000000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#else
  #define __Pyx_PyThreadState_Current _PyThreadState_Current
#endif
#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
#include "pythread.h"
#define Py_tss_NEEDS_INIT 0
typedef int Py_tss_t;
static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
  *key = PyThread_create_key();
  return 0;
}
static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
  Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
  *key = Py_tss_NEEDS_INIT;
  return key;
}
static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
  PyObject_Free(key);
}
static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
  return *key != Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
  PyThread_delete_key(*key);
  *key = Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
  return PyThread_set_key_value(*key, value);
}
static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
  return PyThread_get_key_value(*key);
}
#endif
#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
#define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
#else
#define __Pyx_PyDict_NewPresized(n)  PyDict_New()
#endif
#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
#define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
#else
#define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  #define CYTHON_PEP393_ENABLED 1
  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
                                              0 : _PyUnicode_Ready((PyObject *)(op)))
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
  #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
  #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
  #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
  #else
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_LENGTH(u))
  #endif
#else
  #define CYTHON_PEP393_ENABLED 0
  #define PyUnicode_1BYTE_KIND  1
  #define PyUnicode_2BYTE_KIND  2
  #define PyUnicode_4BYTE_KIND  4
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
  #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
#endif
#if CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
#else
  #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
      PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
  #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
  #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
  #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
#endif
#define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
#else
  #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
#endif
#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
  #define PyObject_ASCII(o)            PyObject_Repr(o)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
#ifndef PyObject_Unicode
  #define PyObject_Unicode             PyObject_Str
#endif
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif
#if PY_VERSION_HEX >= 0x030900A4
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
#else
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
#endif
#if CYTHON_ASSUME_SAFE_MACROS
  #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
#else
  #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  #define PyNumber_Int                 PyNumber_Long
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif
#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  #ifndef PyUnicode_InternFromString
    #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  #endif
#endif
#if PY_VERSION_HEX < 0x030200A4
  typedef long Py_hash_t;
  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
#else
  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
#endif
#if CYTHON_USE_ASYNC_SLOTS
  #if PY_VERSION_HEX >= 0x030500B1
    #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
    #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
  #else
    #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
  #endif
#else
  #define __Pyx_PyType_AsAsync(obj) NULL
#endif
#ifndef __Pyx_PyAsyncMethodsStruct
    typedef struct {
        unaryfunc am_await;
        unaryfunc am_aiter;
        unaryfunc am_anext;
    } __Pyx_PyAsyncMethodsStruct;
#endif

#if defined(WIN32) || defined(MS_WINDOWS)
  #define _USE_MATH_DEFINES
#endif
#include <math.h>
#ifdef NAN
#define __PYX_NAN() ((float) NAN)
#else
static CYTHON_INLINE float __PYX_NAN() {
  float value;
  memset(&value, 0xFF, sizeof(value));
  return value;
}
#endif
#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
#define __Pyx_truncl trunc
#else
#define __Pyx_truncl truncl
#endif

#define __PYX_MARK_ERR_POS(f_index, lineno) \
    { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
#define __PYX_ERR(f_index, lineno, Ln_error) \
    { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }

#ifndef __PYX_EXTERN_C
  #ifdef __cplusplus
    #define __PYX_EXTERN_C extern "C"
  #else
    #define __PYX_EXTERN_C extern
  #endif
#endif

#define __PYX_HAVE__mathics__builtin__numeric
#define __PYX_HAVE_API__mathics__builtin__numeric
/* Early includes */
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
#define CYTHON_WITHOUT_ASSERTIONS
#endif

typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;

#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
#define __PYX_DEFAULT_STRING_ENCODING ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#define __Pyx_uchar_cast(c) ((unsigned char)c)
#define __Pyx_long_cast(x) ((long)x)
#define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
    (sizeof(type) < sizeof(Py_ssize_t))  ||\
    (sizeof(type) > sizeof(Py_ssize_t) &&\
          likely(v < (type)PY_SSIZE_T_MAX ||\
                 v == (type)PY_SSIZE_T_MAX)  &&\
          (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
                                v == (type)PY_SSIZE_T_MIN)))  ||\
    (sizeof(type) == sizeof(Py_ssize_t) &&\
          (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
                               v == (type)PY_SSIZE_T_MAX)))  )
static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
    return (size_t) i < (size_t) limit;
}
#if defined (__cplusplus) && __cplusplus >= 201103L
    #include <cstdlib>
    #define __Pyx_sst_abs(value) std::abs(value)
#elif SIZEOF_INT >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) abs(value)
#elif SIZEOF_LONG >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) labs(value)
#elif defined (_MSC_VER)
    #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define __Pyx_sst_abs(value) llabs(value)
#elif defined (__GNUC__)
    #define __Pyx_sst_abs(value) __builtin_llabs(value)
#else
    #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString        PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#if PY_MAJOR_VERSION < 3
    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#else
    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#endif
#define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
    const Py_UNICODE *u_end = u;
    while (*u_end++) ;
    return (size_t)(u_end - u - 1);
}
#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
#define __Pyx_PySequence_Tuple(obj)\
    (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
#if CYTHON_ASSUME_SAFE_MACROS
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
#else
#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
#endif
#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
static int __Pyx_sys_getdefaultencoding_not_ascii;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    PyObject* ascii_chars_u = NULL;
    PyObject* ascii_chars_b = NULL;
    const char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    if (strcmp(default_encoding_c, "ascii") == 0) {
        __Pyx_sys_getdefaultencoding_not_ascii = 0;
    } else {
        char ascii_chars[128];
        int c;
        for (c = 0; c < 128; c++) {
            ascii_chars[c] = c;
        }
        __Pyx_sys_getdefaultencoding_not_ascii = 1;
        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
        if (!ascii_chars_u) goto bad;
        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
        if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
            PyErr_Format(
                PyExc_ValueError,
                "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
                default_encoding_c);
            goto bad;
        }
        Py_DECREF(ascii_chars_u);
        Py_DECREF(ascii_chars_b);
    }
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    Py_XDECREF(ascii_chars_u);
    Py_XDECREF(ascii_chars_b);
    return -1;
}
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#else
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
static char* __PYX_DEFAULT_STRING_ENCODING;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
    if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    return -1;
}
#endif
#endif


/* Test for GCC > 2.95 */
#if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  #define likely(x)   __builtin_expect(!!(x), 1)
  #define unlikely(x) __builtin_expect(!!(x), 0)
#else /* !__GNUC__ or GCC < 2.95 */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */
static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }

static PyObject *__pyx_m = NULL;
static PyObject *__pyx_d;
static PyObject *__pyx_b;
static PyObject *__pyx_cython_runtime = NULL;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static PyObject *__pyx_empty_unicode;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;


static const char *__pyx_f[] = {
  "mathics/builtin/numeric.py",
};

/*--- Type declarations ---*/
struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface;
struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule;
struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini;
struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral;
struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain;
struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply;
struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_6_test;
struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr;
struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal;
struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr;
struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold;
struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision;
struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands;
struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr;
struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr;
struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr;
struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr;
struct __pyx_defaults;
typedef struct __pyx_defaults __pyx_defaults;
struct __pyx_defaults {
  PyObject *__pyx_arg_delta;
};

/* "mathics/builtin/numeric.py":236
 * 
 * 
 * def _scipy_interface(integrator, options_map, mandatory=None, adapt_func=None):             # <<<<<<<<<<<<<<
 *     """
 *     This function provides a proxy for scipy.integrate
 */
struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface {
  PyObject_HEAD
  PyObject *__pyx_v_adapt_func;
  PyObject *__pyx_v_integrator;
  PyObject *__pyx_v_mandatory;
  PyObject *__pyx_v_options_map;
};


/* "mathics/builtin/numeric.py":269
 * 
 * 
 * def _internal_adaptative_simpsons_rule(f, a, b, **opts):             # <<<<<<<<<<<<<<
 *     """
 *     1D adaptative Simpson's rule integrator
 */
struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule {
  PyObject_HEAD
  PyObject *__pyx_v__quad_asr;
  PyObject *__pyx_v__quad_simpsons_mem;
  double __pyx_v_wsr;
};


/* "mathics/builtin/numeric.py":355
 * 
 * 
 * def _fubini(func, ranges, **opts):             # <<<<<<<<<<<<<<
 *     if not ranges:
 *         return 0.0
 */
struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini {
  PyObject_HEAD
  PyObject *__pyx_v_func;
  PyObject *__pyx_v_opts;
  PyObject *__pyx_v_ranges;
};


/* "mathics/builtin/numeric.py":367
 *     if len(ranges) > 1:
 * 
 *         def subintegral(*u):             # <<<<<<<<<<<<<<
 *             def ff(*z):
 *                 return func(*(u + z))
 */
struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral {
  PyObject_HEAD
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini *__pyx_outer_scope;
  PyObject *__pyx_v_u;
};


/* "mathics/builtin/numeric.py":523
 *         return None
 * 
 *     def apply_with_func_domain(self, func, domain, evaluation, options):             # <<<<<<<<<<<<<<
 *         "%(name)s[func_, domain__, OptionsPattern[%(name)s]]"
 *         method = options["System`Method"].evaluate(evaluation)
 */
struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain {
  PyObject_HEAD
  PyObject *__pyx_v_a;
  PyObject *__pyx_v_b;
  PyObject *__pyx_v_coordtransform;
  PyObject *__pyx_v_i;
  PyObject *__pyx_v_integrand;
  PyObject *__pyx_v_x;
  PyObject *__pyx_v_z;
};


/* "mathics/builtin/numeric.py":1175
 *     """
 * 
 *     def apply(self, expr, evaluation):             # <<<<<<<<<<<<<<
 *         "NumericQ[expr_]"
 * 
 */
struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply {
  PyObject_HEAD
  PyObject *__pyx_v_evaluation;
  PyObject *__pyx_v_test;
};


/* "mathics/builtin/numeric.py":1178
 *         "NumericQ[expr_]"
 * 
 *         def test(expr):             # <<<<<<<<<<<<<<
 *             if isinstance(expr, Expression):
 *                 attr = evaluation.definitions.get_attributes(expr.head.get_name())
 */
struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_6_test {
  PyObject_HEAD
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply *__pyx_outer_scope;
  PyObject *__pyx_v_expr;
};


/* "mathics/builtin/numeric.py":1182
 *                 attr = evaluation.definitions.get_attributes(expr.head.get_name())
 *                 return "System`NumericFunction" in attr and all(
 *                     test(leaf) for leaf in expr.leaves             # <<<<<<<<<<<<<<
 *                 )
 *             else:
 */
struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr {
  PyObject_HEAD
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_6_test *__pyx_outer_scope;
  PyObject *__pyx_v_leaf;
};


/* "mathics/builtin/numeric.py":1306
 * 
 * 
 * def convert_repeating_decimal(numerator, denominator, base):             # <<<<<<<<<<<<<<
 *     head = [x for x in str(numerator // denominator)]
 *     tails = []
 */
struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal {
  PyObject_HEAD
  PyObject *__pyx_v_head;
};


/* "mathics/builtin/numeric.py":1332
 * 
 *     # truncate all leading 0's
 *     if all(elem == "0" for elem in head):             # <<<<<<<<<<<<<<
 *         for i in range(0, len(tails)):
 *             if tails[0] == "0":
 */
struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr {
  PyObject_HEAD
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal *__pyx_outer_scope;
  PyObject *__pyx_v_elem;
};


/* "mathics/builtin/numeric.py":1783
 *         return spans
 * 
 *     def fold(self, x, ll):             # <<<<<<<<<<<<<<
 *         # computes fold(x, ll) with the internal _fold function. will start
 *         # its evaluation machine precision, and will escalate to arbitrary
 */
struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold {
  PyObject_HEAD
  PyObject *__pyx_v_as_operand;
  PyObject *__pyx_v_c_init;
  PyObject *__pyx_v_c_operands;
  PyObject *__pyx_v_converted_operands;
  PyObject *__pyx_v_generator;
  PyObject *__pyx_v_genexpr;
  PyObject *__pyx_v_init;
  PyObject *__pyx_v_ll;
  PyObject *__pyx_v_min_prec;
  PyObject *__pyx_v_mode;
  PyObject *__pyx_v_operands;
  PyObject *__pyx_v_out;
  PyObject *__pyx_v_precision;
  PyObject *__pyx_v_s_operands;
  PyObject *__pyx_v_self;
  PyObject *__pyx_v_spans;
  PyObject *__pyx_9genexpr14__pyx_v_t;
  PyObject *__pyx_v_working_precision;
  PyObject *__pyx_v_x;
  PyObject *__pyx_9genexpr13__pyx_v_y;
  PyObject *__pyx_v_y;
  PyObject *__pyx_t_0;
  PyObject *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5;
  PyObject *__pyx_t_6;
  PyObject *__pyx_t_7;
  PyObject *__pyx_t_8;
};


/* "mathics/builtin/numeric.py":1809
 * 
 *                 @contextmanager
 *                 def working_precision(_):             # <<<<<<<<<<<<<<
 *                     yield
 * 
 */
struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision {
  PyObject_HEAD
  PyObject *__pyx_v__;
};


/* "mathics/builtin/numeric.py":1831
 *             as_operand = self.operands.get(mode)
 * 
 *             def converted_operands():             # <<<<<<<<<<<<<<
 *                 for y in s_operands:
 *                     yield tuple(as_operand(t) for t in y)
 */
struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands {
  PyObject_HEAD
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold *__pyx_outer_scope;
  PyObject *__pyx_v_genexpr;
  PyObject *__pyx_v_y;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
};


/* "mathics/builtin/numeric.py":1833
 *             def converted_operands():
 *                 for y in s_operands:
 *                     yield tuple(as_operand(t) for t in y)             # <<<<<<<<<<<<<<
 * 
 *             with working_precision(precision):
 */
struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr {
  PyObject_HEAD
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands *__pyx_outer_scope;
  PyObject *__pyx_v_t;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "mathics/builtin/numeric.py":1840
 *                 if init is not None:
 *                     c_init = tuple(
 *                         (None if t is None else as_operand(from_python(t)))             # <<<<<<<<<<<<<<
 *                         for t in init
 *                     )
 */
struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr {
  PyObject_HEAD
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold *__pyx_outer_scope;
  PyObject *__pyx_v_t;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
};


/* "mathics/builtin/numeric.py":1845
 *                 else:
 *                     c_init = next(c_operands)
 *                     init = tuple((None if t is None else out(t)) for t in c_init)             # <<<<<<<<<<<<<<
 * 
 *                 generator = self._fold(c_init, c_operands, self.math.get(mode))
 */
struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr {
  PyObject_HEAD
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold *__pyx_outer_scope;
  PyObject *__pyx_v_t;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "mathics/builtin/numeric.py":1850
 * 
 *                 for y in generator:
 *                     y = tuple(out(t) for t in y)             # <<<<<<<<<<<<<<
 *                     yield y
 *                     init = y
 */
struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr {
  PyObject_HEAD
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold *__pyx_outer_scope;
  PyObject *__pyx_v_t;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* --- Runtime support code (head) --- */
/* Refnanny.proto */
#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, int);
    void (*DECREF)(void*, PyObject*, int);
    void (*GOTREF)(void*, PyObject*, int);
    void (*GIVEREF)(void*, PyObject*, int);
    void* (*SetupContext)(const char*, int, const char*);
    void (*FinishContext)(void**);
  } __Pyx_RefNannyAPIStruct;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
#ifdef WITH_THREAD
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          if (acquire_gil) {\
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
              PyGILState_Release(__pyx_gilstate_save);\
          } else {\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
          }
#else
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
#endif
  #define __Pyx_RefNannyFinishContext()\
          __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name, acquire_gil)
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XINCREF(r) Py_XINCREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
  #define __Pyx_XGOTREF(r)
  #define __Pyx_XGIVEREF(r)
#endif
#define __Pyx_XDECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_XDECREF(tmp);\
    } while (0)
#define __Pyx_DECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_DECREF(tmp);\
    } while (0)
#define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)

/* PyObjectGetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif

/* GetBuiltinName.proto */
static PyObject *__Pyx_GetBuiltinName(PyObject *name);

/* RaiseArgTupleInvalid.proto */
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);

/* RaiseDoubleKeywords.proto */
static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);

/* ParseKeywords.proto */
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
    PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
    const char* function_name);

/* PyIntCompare.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_NeObjC(PyObject *op1, PyObject *op2, long intval, long inplace);

/* PyDictVersioning.proto */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
#define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
#define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
    (version_var) = __PYX_GET_DICT_VERSION(dict);\
    (cache_var) = (value);
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
        (VAR) = __pyx_dict_cached_value;\
    } else {\
        (VAR) = __pyx_dict_cached_value = (LOOKUP);\
        __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
    }\
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
#else
#define __PYX_GET_DICT_VERSION(dict)  (0)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
#endif

/* GetModuleGlobalName.proto */
#if CYTHON_USE_DICT_VERSIONS
#define __Pyx_GetModuleGlobalName(var, name)  {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
        (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
        __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
}
#define __Pyx_GetModuleGlobalNameUncached(var, name)  {\
    PY_UINT64_T __pyx_dict_version;\
    PyObject *__pyx_dict_cached_value;\
    (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
}
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
#else
#define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
#define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
#endif

/* PyFunctionFastCall.proto */
#if CYTHON_FAST_PYCALL
#define __Pyx_PyFunction_FastCall(func, args, nargs)\
    __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
#else
#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
#endif
#define __Pyx_BUILD_ASSERT_EXPR(cond)\
    (sizeof(char [1 - 2*!(cond)]) - 1)
#ifndef Py_MEMBER_SIZE
#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
#endif
  static size_t __pyx_pyframe_localsplus_offset = 0;
  #include "frameobject.h"
  #define __Pxy_PyFrame_Initialize_Offsets()\
    ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
     (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
  #define __Pyx_PyFrame_GetLocalsplus(frame)\
    (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
#endif

/* PyCFunctionFastCall.proto */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
#else
#define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
#endif

/* PyObjectCall.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
#else
#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
#endif

/* PyObjectCall2Args.proto */
static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);

/* PyObjectCallMethO.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
#endif

/* PyObjectCallOneArg.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);

/* GetTopmostException.proto */
#if CYTHON_USE_EXC_INFO_STACK
static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
#endif

/* PyThreadStateGet.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
#define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
#define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
#else
#define __Pyx_PyThreadState_declare
#define __Pyx_PyThreadState_assign
#define __Pyx_PyErr_Occurred()  PyErr_Occurred()
#endif

/* SaveResetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
#else
#define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
#define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
#endif

/* PyErrFetchRestore.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
#define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
#else
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#endif
#else
#define __Pyx_PyErr_Clear() PyErr_Clear()
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
#endif

/* FastTypeChecks.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
#else
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
#endif
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)

/* GetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* PyObjectCallNoArg.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
#else
#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
#endif

/* IncludeStringH.proto */
#include <string.h>

/* BytesEquals.proto */
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);

/* UnicodeEquals.proto */
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);

/* ListCompAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len)) {
        Py_INCREF(x);
        PyList_SET_ITEM(list, len, x);
        __Pyx_SET_SIZE(list, len + 1);
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
#endif

/* PySequenceContains.proto */
static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
    int result = PySequence_Contains(seq, item);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* GetItemInt.proto */
#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
               __Pyx_GetItemInt_Generic(o, to_py_func(i))))
#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
    (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
    (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck);

/* ObjectGetItem.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
#else
#define __Pyx_PyObject_GetItem(obj, key)  PyObject_GetItem(obj, key)
#endif

/* None.proto */
static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname);

/* UnpackUnboundCMethod.proto */
typedef struct {
    PyObject *type;
    PyObject **method_name;
    PyCFunction func;
    PyObject *method;
    int flag;
} __Pyx_CachedCFunction;

/* CallUnboundCMethod1.proto */
static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg);
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg);
#else
#define __Pyx_CallUnboundCMethod1(cfunc, self, arg)  __Pyx__CallUnboundCMethod1(cfunc, self, arg)
#endif

/* IterFinish.proto */
static CYTHON_INLINE int __Pyx_IterFinish(void);

/* PyObjectGetMethod.proto */
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);

/* PyObjectCallMethod0.proto */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);

/* RaiseNeedMoreValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

/* RaiseTooManyValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

/* UnpackItemEndCheck.proto */
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);

/* RaiseNoneIterError.proto */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

/* UnpackTupleError.proto */
static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index);

/* UnpackTuple2.proto */
#define __Pyx_unpack_tuple2(tuple, value1, value2, is_tuple, has_known_size, decref_tuple)\
    (likely(is_tuple || PyTuple_Check(tuple)) ?\
        (likely(has_known_size || PyTuple_GET_SIZE(tuple) == 2) ?\
            __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple) :\
            (__Pyx_UnpackTupleError(tuple, 2), -1)) :\
        __Pyx_unpack_tuple2_generic(tuple, value1, value2, has_known_size, decref_tuple))
static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
    PyObject* tuple, PyObject** value1, PyObject** value2, int decref_tuple);
static int __Pyx_unpack_tuple2_generic(
    PyObject* tuple, PyObject** value1, PyObject** value2, int has_known_size, int decref_tuple);

/* dict_iter.proto */
static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_is_dict);
static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos,
                                              PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict);

/* FetchCommonType.proto */
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);

/* CythonFunctionShared.proto */
#define __Pyx_CyFunction_USED 1
#define __Pyx_CYFUNCTION_STATICMETHOD  0x01
#define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
#define __Pyx_CYFUNCTION_CCLASS        0x04
#define __Pyx_CyFunction_GetClosure(f)\
    (((__pyx_CyFunctionObject *) (f))->func_closure)
#define __Pyx_CyFunction_GetClassObj(f)\
    (((__pyx_CyFunctionObject *) (f))->func_classobj)
#define __Pyx_CyFunction_Defaults(type, f)\
    ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
    ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
typedef struct {
    PyCFunctionObject func;
#if PY_VERSION_HEX < 0x030500A0
    PyObject *func_weakreflist;
#endif
    PyObject *func_dict;
    PyObject *func_name;
    PyObject *func_qualname;
    PyObject *func_doc;
    PyObject *func_globals;
    PyObject *func_code;
    PyObject *func_closure;
    PyObject *func_classobj;
    void *defaults;
    int defaults_pyobjects;
    size_t defaults_size;  // used by FusedFunction for copying defaults
    int flags;
    PyObject *defaults_tuple;
    PyObject *defaults_kwdict;
    PyObject *(*defaults_getter)(PyObject *);
    PyObject *func_annotations;
} __pyx_CyFunctionObject;
static PyTypeObject *__pyx_CyFunctionType = 0;
#define __Pyx_CyFunction_Check(obj)  (__Pyx_TypeCheck(obj, __pyx_CyFunctionType))
static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *self,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
                                                         size_t size,
                                                         int pyobjects);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
                                                            PyObject *tuple);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
                                                             PyObject *dict);
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
                                                              PyObject *dict);
static int __pyx_CyFunction_init(void);

/* CythonFunction.proto */
static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *closure,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);

/* PyErrExceptionMatches.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
#else
#define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
#endif

/* PyFloatBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_AddObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyFloat_AddObjC(op1, op2, floatval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
#endif

/* py_abs.proto */
#if CYTHON_USE_PYLONG_INTERNALS
static PyObject *__Pyx_PyLong_AbsNeg(PyObject *num);
#define __Pyx_PyNumber_Absolute(x)\
    ((likely(PyLong_CheckExact(x))) ?\
         (likely(Py_SIZE(x) >= 0) ? (Py_INCREF(x), (x)) : __Pyx_PyLong_AbsNeg(x)) :\
         PyNumber_Absolute(x))
#else
#define __Pyx_PyNumber_Absolute(x)  PyNumber_Absolute(x)
#endif

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyInt_SubtractObjC(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
#endif

/* PyIntCompare.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, long inplace);

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_TrueDivideObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyInt_TrueDivideObjC(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceTrueDivide(op1, op2) : PyNumber_TrueDivide(op1, op2))
#endif

/* dict_getitem_default.proto */
static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value);

/* CallUnboundCMethod2.proto */
static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2);
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1
static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2);
#else
#define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2)  __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2)
#endif

/* PyFloatBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_AddCObj(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyFloat_AddCObj(op1, op2, floatval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
#endif

/* PyObjectFormatSimple.proto */
#if CYTHON_COMPILING_IN_PYPY
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        PyObject_Format(s, f))
#elif PY_MAJOR_VERSION < 3
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        likely(PyString_CheckExact(s)) ? PyUnicode_FromEncodedObject(s, NULL, "strict") :\
        PyObject_Format(s, f))
#elif CYTHON_USE_TYPE_SLOTS
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        likely(PyLong_CheckExact(s)) ? PyLong_Type.tp_str(s) :\
        likely(PyFloat_CheckExact(s)) ? PyFloat_Type.tp_str(s) :\
        PyObject_Format(s, f))
#else
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        PyObject_Format(s, f))
#endif

/* JoinPyUnicode.proto */
static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength,
                                      Py_UCS4 max_char);

/* RaiseException.proto */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);

/* PyFloatBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_SubtractCObj(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyFloat_SubtractCObj(op1, op2, floatval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
#endif

/* KeywordStringCheck.proto */
static int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed);

/* SliceObject.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
        PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
        int has_cstart, int has_cstop, int wraparound);

/* DictGetItem.proto */
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
#define __Pyx_PyObject_Dict_GetItem(obj, name)\
    (likely(PyDict_CheckExact(obj)) ?\
     __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
#else
#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#define __Pyx_PyObject_Dict_GetItem(obj, name)  PyObject_GetItem(obj, name)
#endif

/* PyNumberPow2.proto */
#define __Pyx_PyNumber_InPlacePowerOf2(a, b, c) __Pyx__PyNumber_PowerOf2(a, b, c, 1)
#define __Pyx_PyNumber_PowerOf2(a, b, c) __Pyx__PyNumber_PowerOf2(a, b, c, 0)
static PyObject* __Pyx__PyNumber_PowerOf2(PyObject *two, PyObject *exp, PyObject *none, int inplace);

/* Import.proto */
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);

/* ImportFrom.proto */
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);

/* ListAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
        Py_INCREF(x);
        PyList_SET_ITEM(list, len, x);
        __Pyx_SET_SIZE(list, len + 1);
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
#endif

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
#endif

/* PyFloatBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_TrueDivideCObj(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyFloat_TrueDivideCObj(op1, op2, floatval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceTrueDivide(op1, op2) : PyNumber_TrueDivide(op1, op2))
#endif

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_SubtractCObj(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyInt_SubtractCObj(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
#endif

/* MergeKeywords.proto */
static int __Pyx_MergeKeywords(PyObject *kwdict, PyObject *source_mapping);

/* None.proto */
static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);

/* IterNext.proto */
#define __Pyx_PyIter_Next(obj) __Pyx_PyIter_Next2(obj, NULL)
static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject *, PyObject *);

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_RemainderObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyInt_RemainderObjC(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceRemainder(op1, op2) : PyNumber_Remainder(op1, op2))
#endif

/* unicode_iter.proto */
static CYTHON_INLINE int __Pyx_init_unicode_iteration(
    PyObject* ustring, Py_ssize_t *length, void** data, int *kind);

/* DelItemInt.proto */
#define __Pyx_DelItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_DelItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound) :\
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
               __Pyx_DelItem_Generic(o, to_py_func(i))))
static int __Pyx_DelItem_Generic(PyObject *o, PyObject *j);
static CYTHON_INLINE int __Pyx_DelItemInt_Fast(PyObject *o, Py_ssize_t i,
                                               int is_list, int wraparound);

/* SliceTupleAndList.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop);
static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop);
#else
#define __Pyx_PyList_GetSlice(seq, start, stop)   PySequence_GetSlice(seq, start, stop)
#define __Pyx_PyTuple_GetSlice(seq, start, stop)  PySequence_GetSlice(seq, start, stop)
#endif

/* PyObjectCallMethod1.proto */
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);

/* append.proto */
static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x);

/* PyObjectSetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL)
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value);
#else
#define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif

/* PyObjectLookupSpecial.proto */
#if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name) {
    PyObject *res;
    PyTypeObject *tp = Py_TYPE(obj);
#if PY_MAJOR_VERSION < 3
    if (unlikely(PyInstance_Check(obj)))
        return __Pyx_PyObject_GetAttrStr(obj, attr_name);
#endif
    res = _PyType_Lookup(tp, attr_name);
    if (likely(res)) {
        descrgetfunc f = Py_TYPE(res)->tp_descr_get;
        if (!f) {
            Py_INCREF(res);
        } else {
            res = f(res, obj, (PyObject *)tp);
        }
    } else {
        PyErr_SetObject(PyExc_AttributeError, attr_name);
    }
    return res;
}
#else
#define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n)
#endif

/* PyObject_GenericGetAttrNoDict.proto */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
#endif

/* CalculateMetaclass.proto */
static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);

/* SetNameInClass.proto */
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
#define __Pyx_SetNameInClass(ns, name, value)\
    (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value))
#elif CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_SetNameInClass(ns, name, value)\
    (likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value))
#else
#define __Pyx_SetNameInClass(ns, name, value)  PyObject_SetItem(ns, name, value)
#endif

/* Py3ClassCreate.proto */
static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
                                           PyObject *mkw, PyObject *modname, PyObject *doc);
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
                                      PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);

/* CyFunctionClassCell.proto */
static int __Pyx_CyFunction_InitClassCell(PyObject *cyfunctions, PyObject *classobj);

/* CLineInTraceback.proto */
#ifdef CYTHON_CLINE_IN_TRACEBACK
#define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
#else
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
#endif

/* CodeObjectCache.proto */
typedef struct {
    PyCodeObject* code_object;
    int code_line;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
    int count;
    int max_count;
    __Pyx_CodeObjectCacheEntry* entries;
};
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static PyCodeObject *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);

/* AddTraceback.proto */
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename);

/* GCCDiagnostics.proto */
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
#define __Pyx_HAS_GCC_DIAGNOSTIC
#endif

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);

/* CIntFromPy.proto */
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);

/* SwapException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSwap(type, value, tb)  __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* CoroutineBase.proto */
typedef PyObject *(*__pyx_coroutine_body_t)(PyObject *, PyThreadState *, PyObject *);
#if CYTHON_USE_EXC_INFO_STACK
#define __Pyx_ExcInfoStruct  _PyErr_StackItem
#else
typedef struct {
    PyObject *exc_type;
    PyObject *exc_value;
    PyObject *exc_traceback;
} __Pyx_ExcInfoStruct;
#endif
typedef struct {
    PyObject_HEAD
    __pyx_coroutine_body_t body;
    PyObject *closure;
    __Pyx_ExcInfoStruct gi_exc_state;
    PyObject *gi_weakreflist;
    PyObject *classobj;
    PyObject *yieldfrom;
    PyObject *gi_name;
    PyObject *gi_qualname;
    PyObject *gi_modulename;
    PyObject *gi_code;
    int resume_label;
    char is_running;
} __pyx_CoroutineObject;
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
    PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
    PyObject *name, PyObject *qualname, PyObject *module_name);
static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
            __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name);
static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self);
static int __Pyx_Coroutine_clear(PyObject *self);
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value);
static PyObject *__Pyx_Coroutine_Close(PyObject *self);
static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args);
#if CYTHON_USE_EXC_INFO_STACK
#define __Pyx_Coroutine_SwapException(self)
#define __Pyx_Coroutine_ResetAndClearException(self)  __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state)
#else
#define __Pyx_Coroutine_SwapException(self) {\
    __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\
    __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\
    }
#define __Pyx_Coroutine_ResetAndClearException(self) {\
    __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\
    (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\
    }
#endif
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
    __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue)
#else
#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
    __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue)
#endif
static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue);
static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state);

/* PatchModuleWithCoroutine.proto */
static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code);

/* PatchGeneratorABC.proto */
static int __Pyx_patch_abc(void);

/* Generator.proto */
#define __Pyx_Generator_USED
static PyTypeObject *__pyx_GeneratorType = 0;
#define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType)
#define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\
    __Pyx__Coroutine_New(__pyx_GeneratorType, body, code, closure, name, qualname, module_name)
static PyObject *__Pyx_Generator_Next(PyObject *self);
static int __pyx_Generator_init(void);

/* CheckBinaryVersion.proto */
static int __Pyx_check_binary_version(void);

/* InitStrings.proto */
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);


/* Module declarations from 'mathics.builtin.numeric' */
static PyTypeObject *__pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface = 0;
static PyTypeObject *__pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule = 0;
static PyTypeObject *__pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini = 0;
static PyTypeObject *__pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral = 0;
static PyTypeObject *__pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain = 0;
static PyTypeObject *__pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply = 0;
static PyTypeObject *__pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_6_test = 0;
static PyTypeObject *__pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr = 0;
static PyTypeObject *__pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal = 0;
static PyTypeObject *__pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr = 0;
static PyTypeObject *__pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold = 0;
static PyTypeObject *__pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision = 0;
static PyTypeObject *__pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands = 0;
static PyTypeObject *__pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr = 0;
static PyTypeObject *__pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr = 0;
static PyTypeObject *__pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr = 0;
static PyTypeObject *__pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr = 0;
#define __Pyx_MODULE_NAME "mathics.builtin.numeric"
extern int __pyx_module_is_main_mathics__builtin__numeric;
int __pyx_module_is_main_mathics__builtin__numeric = 0;

/* Implementation of 'mathics.builtin.numeric' */
static PyObject *__pyx_builtin_staticmethod;
static PyObject *__pyx_builtin_object;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_ZeroDivisionError;
static PyObject *__pyx_builtin_super;
static PyObject *__pyx_builtin_any;
static PyObject *__pyx_builtin_enumerate;
static PyObject *__pyx_builtin_sum;
static PyObject *__pyx_builtin_round;
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_format;
static PyObject *__pyx_builtin_NotImplementedError;
static const char __pyx_k_0[] = "0";
static const char __pyx_k_E[] = "E";
static const char __pyx_k_N[] = "N";
static const char __pyx_k_a[] = "a";
static const char __pyx_k_b[] = "b";
static const char __pyx_k_c[] = "c";
static const char __pyx_k_d[] = "d";
static const char __pyx_k_e[] = "e";
static const char __pyx_k_f[] = "f";
static const char __pyx_k_h[] = "h";
static const char __pyx_k_i[] = "i";
static const char __pyx_k_j[] = "j";
static const char __pyx_k_k[] = "k";
static const char __pyx_k_m[] = "m";
static const char __pyx_k_n[] = "n";
static const char __pyx_k_p[] = "p";
static const char __pyx_k_q[] = "q";
static const char __pyx_k_r[] = "r";
static const char __pyx_k_t[] = "t";
static const char __pyx_k_u[] = "u";
static const char __pyx_k_x[] = "x";
static const char __pyx_k_y[] = "y";
static const char __pyx_k_z[] = "z";
static const char __pyx_k_10[] = "10";
static const char __pyx_k__2[] = "";
static const char __pyx_k_dx[] = "dx";
static const char __pyx_k_fa[] = "fa";
static const char __pyx_k_fb[] = "fb";
static const char __pyx_k_ff[] = "ff";
static const char __pyx_k_fm[] = "fm";
static const char __pyx_k_fn[] = "fn";
static const char __pyx_k_it[] = "it";
static const char __pyx_k_le[] = "le";
static const char __pyx_k_ll[] = "ll";
static const char __pyx_k_lm[] = "lm";
static const char __pyx_k_np[] = "np";
static const char __pyx_k_rm[] = "rm";
static const char __pyx_k_Cos[] = "Cos";
static const char __pyx_k_Log[] = "Log";
static const char __pyx_k_MD5[] = "MD5";
static const char __pyx_k_SHA[] = "SHA";
static const char __pyx_k_Sin[] = "Sin";
static const char __pyx_k__22[] = "`, `";
static const char __pyx_k__36[] = ".";
static const char __pyx_k__38[] = "_";
static const char __pyx_k_any[] = "any";
static const char __pyx_k_cos[] = "cos";
static const char __pyx_k_doc[] = "__doc__";
static const char __pyx_k_dps[] = "dps";
static const char __pyx_k_eps[] = "eps";
static const char __pyx_k_err[] = "err";
static const char __pyx_k_exp[] = "exp";
static const char __pyx_k_flm[] = "flm";
static const char __pyx_k_frm[] = "frm";
static const char __pyx_k_fun[] = "fun";
static const char __pyx_k_get[] = "get";
static const char __pyx_k_int[] = "int";
static const char __pyx_k_log[] = "log";
static const char __pyx_k_md5[] = "md5";
static const char __pyx_k_nan[] = "nan";
static const char __pyx_k_opt[] = "opt";
static const char __pyx_k_out[] = "out";
static const char __pyx_k_pos[] = "pos";
static const char __pyx_k_res[] = "res";
static const char __pyx_k_sin[] = "sin";
static const char __pyx_k_sum[] = "sum";
static const char __pyx_k_tol[] = "tol";
static const char __pyx_k_val[] = "val";
static const char __pyx_k_var[] = "var";
static const char __pyx_k_wsr[] = "wsr";
static const char __pyx_k_1_10[] = "1*^-10";
static const char __pyx_k_Chop[] = "Chop";
static const char __pyx_k_Fold[] = "Fold";
static const char __pyx_k_Hash[] = "Hash";
static const char __pyx_k_List[] = "List";
static const char __pyx_k_Real[] = "Real";
static const char __pyx_k_Root[] = "Root";
static const char __pyx_k_True[] = "True";
static const char __pyx_k_acur[] = "acur";
static const char __pyx_k_args[] = "args";
static const char __pyx_k_attr[] = "attr";
static const char __pyx_k_axis[] = "axis";
static const char __pyx_k_base[] = "base";
static const char __pyx_k_ceil[] = "ceil";
static const char __pyx_k_chop[] = "chop";
static const char __pyx_k_exit[] = "__exit__";
static const char __pyx_k_expr[] = "expr";
static const char __pyx_k_fn_2[] = "_fn";
static const char __pyx_k_fold[] = "fold";
static const char __pyx_k_func[] = "func";
static const char __pyx_k_head[] = "head";
static const char __pyx_k_ilim[] = "ilim";
static const char __pyx_k_imag[] = "imag";
static const char __pyx_k_init[] = "__init__";
static const char __pyx_k_intm[] = "intm";
static const char __pyx_k_leaf[] = "leaf";
static const char __pyx_k_left[] = "left";
static const char __pyx_k_main[] = "__main__";
static const char __pyx_k_math[] = "math";
static const char __pyx_k_mode[] = "mode";
static const char __pyx_k_move[] = "move";
static const char __pyx_k_name[] = "name";
static const char __pyx_k_ndig[] = "ndig";
static const char __pyx_k_nlim[] = "nlim";
static const char __pyx_k_opts[] = "opts";
static const char __pyx_k_prec[] = "prec";
static const char __pyx_k_prod[] = "prod";
static const char __pyx_k_py_b[] = "py_b";
static const char __pyx_k_py_n[] = "py_n";
static const char __pyx_k_py_x[] = "py_x";
static const char __pyx_k_quad[] = "quad";
static const char __pyx_k_real[] = "real";
static const char __pyx_k_self[] = "self";
static const char __pyx_k_send[] = "send";
static const char __pyx_k_sha1[] = "sha1";
static const char __pyx_k_temp[] = "temp";
static const char __pyx_k_test[] = "test";
static const char __pyx_k_xmax[] = "xmax";
static const char __pyx_k_xmin[] = "xmin";
static const char __pyx_k_zlib[] = "zlib";
static const char __pyx_k_Blank[] = "Blank";
static const char __pyx_k_CRC32[] = "CRC32";
static const char __pyx_k_FLOAT[] = "FLOAT";
static const char __pyx_k_False[] = "False";
static const char __pyx_k_Float[] = "Float";
static const char __pyx_k_Round[] = "Round";
static const char __pyx_k_Times[] = "Times";
static const char __pyx_k_a_gen[] = "a_gen";
static const char __pyx_k_apply[] = "apply";
static const char __pyx_k_b_gen[] = "b_gen";
static const char __pyx_k_bdmtd[] = "bdmtd";
static const char __pyx_k_bytes[] = "_bytes";
static const char __pyx_k_cfunc[] = "cfunc";
static const char __pyx_k_chain[] = "chain";
static const char __pyx_k_close[] = "close";
static const char __pyx_k_crc32[] = "crc32";
static const char __pyx_k_delta[] = "delta";
static const char __pyx_k_enter[] = "__enter__";
static const char __pyx_k_floor[] = "floor";
static const char __pyx_k_func2[] = "func2";
static const char __pyx_k_ibase[] = "ibase";
static const char __pyx_k_index[] = "index";
static const char __pyx_k_intnm[] = "intnm";
static const char __pyx_k_intnn[] = "intnn";
static const char __pyx_k_inumr[] = "inumr";
static const char __pyx_k_isinf[] = "isinf";
static const char __pyx_k_items[] = "items";
static const char __pyx_k_limit[] = "limit";
static const char __pyx_k_nexpr[] = "nexpr";
static const char __pyx_k_nquad[] = "nquad";
static const char __pyx_k_numpy[] = "numpy";
static const char __pyx_k_py_dx[] = "py_dx";
static const char __pyx_k_range[] = "range";
static const char __pyx_k_rbase[] = "rbase";
static const char __pyx_k_realx[] = "realx";
static const char __pyx_k_right[] = "right";
static const char __pyx_k_round[] = "round";
static const char __pyx_k_rules[] = "rules";
static const char __pyx_k_sameQ[] = "sameQ";
static const char __pyx_k_spans[] = "_spans";
static const char __pyx_k_state[] = "state";
static const char __pyx_k_steps[] = "steps";
static const char __pyx_k_super[] = "super";
static const char __pyx_k_sym_x[] = "sym_x";
static const char __pyx_k_sympy[] = "sympy";
static const char __pyx_k_tails[] = "tails";
static const char __pyx_k_throw[] = "throw";
static const char __pyx_k_tolnn[] = "tolnn";
static const char __pyx_k_value[] = "value";
static const char __pyx_k_whole[] = "whole";
static const char __pyx_k_Divide[] = "Divide";
static const char __pyx_k_MPMATH[] = "MPMATH";
static const char __pyx_k_Method[] = "Method";
static const char __pyx_k_N_expr[] = "N[expr_]";
static const char __pyx_k_Number[] = "Number";
static const char __pyx_k_SHA224[] = "SHA224";
static const char __pyx_k_SHA256[] = "SHA256";
static const char __pyx_k_SHA384[] = "SHA384";
static const char __pyx_k_SHA512[] = "SHA512";
static const char __pyx_k_String[] = "String";
static const char __pyx_k_Symbol[] = "Symbol";
static const char __pyx_k_System[] = "System`";
static const char __pyx_k_append[] = "append";
static const char __pyx_k_c_init[] = "c_init";
static const char __pyx_k_cmpint[] = "cmpint";
static const char __pyx_k_coords[] = "coords";
static const char __pyx_k_digits[] = "digits";
static const char __pyx_k_divmax[] = "divmax";
static const char __pyx_k_domain[] = "domain";
static const char __pyx_k_epsabs[] = "epsabs";
static const char __pyx_k_fold_2[] = "_fold";
static const char __pyx_k_format[] = "format";
static const char __pyx_k_fubini[] = "_fubini";
static const char __pyx_k_import[] = "__import__";
static const char __pyx_k_init_2[] = "init";
static const char __pyx_k_intvar[] = "intvar";
static const char __pyx_k_inumer[] = "inumer";
static const char __pyx_k_kwargs[] = "kwargs";
static const char __pyx_k_leaves[] = "leaves";
static const char __pyx_k_length[] = "length";
static const char __pyx_k_maxrec[] = "maxrec";
static const char __pyx_k_method[] = "method";
static const char __pyx_k_module[] = "__module__";
static const char __pyx_k_mpmath[] = "mpmath";
static const char __pyx_k_name_2[] = "__name__";
static const char __pyx_k_object[] = "object";
static const char __pyx_k_precbd[] = "precbd";
static const char __pyx_k_preclg[] = "preclg";
static const char __pyx_k_precsm[] = "precsm";
static const char __pyx_k_ranges[] = "ranges";
static const char __pyx_k_result[] = "result";
static const char __pyx_k_return[] = "return";
static const char __pyx_k_sha224[] = "sha224";
static const char __pyx_k_sha256[] = "sha256";
static const char __pyx_k_sha384[] = "sha384";
static const char __pyx_k_sha512[] = "sha512";
static const char __pyx_k_test_2[] = "__test__";
static const char __pyx_k_update[] = "update";
static const char __pyx_k_Adler32[] = "Adler32";
static const char __pyx_k_Builtin[] = "Builtin";
static const char __pyx_k_Compile[] = "Compile";
static const char __pyx_k_Complex[] = "Complex";
static const char __pyx_k_Integer[] = "Integer";
static const char __pyx_k_Romberg[] = "Romberg";
static const char __pyx_k_Simpson[] = "Simpson";
static const char __pyx_k_SymbolN[] = "SymbolN";
static const char __pyx_k_adler32[] = "adler32";
static const char __pyx_k_arctanh[] = "arctanh";
static const char __pyx_k_bytes_2[] = "bytes";
static const char __pyx_k_compute[] = "compute";
static const char __pyx_k_context[] = "context";
static const char __pyx_k_genexpr[] = "genexpr";
static const char __pyx_k_hashlib[] = "hashlib";
static const char __pyx_k_intvars[] = "intvars";
static const char __pyx_k_is_atom[] = "is_atom";
static const char __pyx_k_is_real[] = "is_real";
static const char __pyx_k_is_zero[] = "is_zero";
static const char __pyx_k_log_n_b[] = "log_n_b";
static const char __pyx_k_maxsize[] = "maxsize";
static const char __pyx_k_message[] = "message";
static const char __pyx_k_methods[] = "methods";
static const char __pyx_k_mtdfail[] = "mtdfail";
static const char __pyx_k_ntheory[] = "ntheory";
static const char __pyx_k_operand[] = "operand";
static const char __pyx_k_options[] = "options";
static const char __pyx_k_pos_len[] = "pos_len";
static const char __pyx_k_preccon[] = "preccon";
static const char __pyx_k_precset[] = "precset";
static const char __pyx_k_prepare[] = "__prepare__";
static const char __pyx_k_product[] = "product";
static const char __pyx_k_results[] = "results";
static const char __pyx_k_romberg[] = "romberg";
static const char __pyx_k_spans_2[] = "spans";
static const char __pyx_k_version[] = "__version__";
static const char __pyx_k_Accuracy[] = "Accuracy";
static const char __pyx_k_Infinity[] = "Infinity";
static const char __pyx_k_Integer0[] = "Integer0";
static const char __pyx_k_Internal[] = "Internal";
static const char __pyx_k_Listable[] = "Listable";
static const char __pyx_k_NumericQ[] = "NumericQ";
static const char __pyx_k_Rational[] = "Rational";
static const char __pyx_k_SYMBOLIC[] = "SYMBOLIC";
static const char __pyx_k_ZLibHash[] = "_ZLibHash";
static const char __pyx_k_accuracy[] = "accuracy";
static const char __pyx_k_apply_dx[] = "apply_dx";
static const char __pyx_k_evaluate[] = "evaluate";
static const char __pyx_k_get_name[] = "get_name";
static const char __pyx_k_has_form[] = "has_form";
static const char __pyx_k_hashtype[] = "hashtype";
static const char __pyx_k_int_part[] = "int_part";
static const char __pyx_k_interval[] = "interval";
static const char __pyx_k_list_str[] = "list_str";
static const char __pyx_k_messages[] = "messages";
static const char __pyx_k_min_prec[] = "min_prec";
static const char __pyx_k_operands[] = "operands";
static const char __pyx_k_quad_asr[] = "_quad_asr";
static const char __pyx_k_qualname[] = "__qualname__";
static const char __pyx_k_to_sympy[] = "to_sympy";
static const char __pyx_k_workprec[] = "workprec";
static const char __pyx_k_Automatic[] = "Automatic";
static const char __pyx_k_ByteArray[] = "ByteArray";
static const char __pyx_k_Chop_expr[] = "Chop[expr_]";
static const char __pyx_k_Fold_fold[] = "Fold.fold";
static const char __pyx_k_Hash_expr[] = "Hash[expr_]";
static const char __pyx_k_HexString[] = "HexString";
static const char __pyx_k_Precision[] = "Precision";
static const char __pyx_k_Protected[] = "Protected";
static const char __pyx_k_Tolerance[] = "Tolerance";
static const char __pyx_k_TypeError[] = "TypeError";
static const char __pyx_k_apply_len[] = "apply_len";
static const char __pyx_k_enumerate[] = "enumerate";
static const char __pyx_k_exponents[] = "exponents";
static const char __pyx_k_functools[] = "functools";
static const char __pyx_k_generator[] = "generator";
static const char __pyx_k_get_value[] = "get_value";
static const char __pyx_k_hash_func[] = "hash_func";
static const char __pyx_k_hexdigest[] = "hexdigest";
static const char __pyx_k_integrand[] = "integrand";
static const char __pyx_k_intervals[] = "intervals";
static const char __pyx_k_is_number[] = "is_number";
static const char __pyx_k_itertools[] = "itertools";
static const char __pyx_k_lru_cache[] = "lru_cache";
static const char __pyx_k_mandatory[] = "mandatory";
static const char __pyx_k_metaclass[] = "__metaclass__";
static const char __pyx_k_numerator[] = "numerator";
static const char __pyx_k_outformat[] = "outformat";
static const char __pyx_k_precision[] = "precision";
static const char __pyx_k_py_format[] = "py_format";
static const char __pyx_k_real_part[] = "real_part";
static const char __pyx_k_subdomain[] = "subdomain";
static const char __pyx_k_to_mpmath[] = "to_mpmath";
static const char __pyx_k_to_python[] = "to_python";
static const char __pyx_k_tolerance[] = "tolerance";
static const char __pyx_k_user_hash[] = "user_hash";
static const char __pyx_k_Chop_apply[] = "Chop.apply";
static const char __pyx_k_Expression[] = "Expression";
static const char __pyx_k_Fold__fold[] = "Fold._fold";
static const char __pyx_k_Hash_apply[] = "Hash.apply";
static const char __pyx_k_Internal_2[] = "Internal`";
static const char __pyx_k_NIntegrate[] = "NIntegrate";
static const char __pyx_k_Predefined[] = "Predefined";
static const char __pyx_k_Quadrature[] = "Quadrature";
static const char __pyx_k_RealDigits[] = "RealDigits";
static const char __pyx_k_SymbolList[] = "SymbolList";
static const char __pyx_k_SymbolTrue[] = "SymbolTrue";
static const char __pyx_k_adapt_func[] = "adapt_func";
static const char __pyx_k_as_operand[] = "as_operand";
static const char __pyx_k_attributes[] = "attributes";
static const char __pyx_k_boundaries[] = "boundaries";
static const char __pyx_k_c_operands[] = "c_operands";
static const char __pyx_k_contextlib[] = "contextlib";
static const char __pyx_k_eval_range[] = "eval_range";
static const char __pyx_k_evaluation[] = "evaluation";
static const char __pyx_k_find_exact[] = "find_exact";
static const char __pyx_k_from_sympy[] = "from_sympy";
static const char __pyx_k_integrator[] = "integrator";
static const char __pyx_k_is_inexact[] = "is_inexact";
static const char __pyx_k_is_numeric[] = "is_numeric";
static const char __pyx_k_namedtuple[] = "namedtuple";
static const char __pyx_k_native_opt[] = "native_opt";
static const char __pyx_k_nulldomain[] = "nulldomain";
static const char __pyx_k_operands_2[] = "_operands";
static const char __pyx_k_s_operands[] = "s_operands";
static const char __pyx_k_startswith[] = "startswith";
static const char __pyx_k_subdomain2[] = "subdomain2";
static const char __pyx_k_subresults[] = "subresults";
static const char __pyx_k_Automatic_2[] = "\"Automatic\"";
static const char __pyx_k_Fold__spans[] = "Fold._spans";
static const char __pyx_k_Fold_lambda[] = "Fold.<lambda>";
static const char __pyx_k_Hash_lambda[] = "Hash.<lambda>";
static const char __pyx_k_MachineReal[] = "MachineReal";
static const char __pyx_k_NQuadrature[] = "NQuadrature";
static const char __pyx_k_Rationalize[] = "Rationalize";
static const char __pyx_k_Round_apply[] = "Round.apply";
static const char __pyx_k_SymbolFalse[] = "SymbolFalse";
static const char __pyx_k_System_List[] = "System`List";
static const char __pyx_k_System_Rule[] = "System`Rule";
static const char __pyx_k_collections[] = "collections";
static const char __pyx_k_convert_int[] = "convert_int";
static const char __pyx_k_definitions[] = "definitions";
static const char __pyx_k_denominator[] = "denominator";
static const char __pyx_k_display_len[] = "display_len";
static const char __pyx_k_from_python[] = "from_python";
static const char __pyx_k_full_output[] = "full_output";
static const char __pyx_k_is_negative[] = "is_negative";
static const char __pyx_k_native_opts[] = "native_opts";
static const char __pyx_k_nr_elements[] = "nr_elements";
static const char __pyx_k_options_map[] = "options_map";
static const char __pyx_k_py_hashtype[] = "py_hashtype";
static const char __pyx_k_rational_no[] = "rational_no";
static const char __pyx_k_subintegral[] = "subintegral";
static const char __pyx_k_Hash_compute[] = "Hash.compute";
static const char __pyx_k_MaxPrecision[] = "MaxPrecision";
static const char __pyx_k_MaxRecursion[] = "MaxRecursion";
static const char __pyx_k_MinPrecision[] = "MinPrecision";
static const char __pyx_k_maxrecursion[] = "maxrecursion";
static const char __pyx_k_result_digit[] = "result_digit";
static const char __pyx_k_staticmethod[] = "staticmethod";
static const char __pyx_k_DecimalString[] = "DecimalString";
static const char __pyx_k_Head_N_x_Real[] = "Head[N[x]] === Real";
static const char __pyx_k_Indeterminate[] = "Indeterminate";
static const char __pyx_k_IntegerDigits[] = "IntegerDigits";
static const char __pyx_k_ReadProtected[] = "ReadProtected";
static const char __pyx_k_System_Method[] = "System`Method";
static const char __pyx_k_apply_complex[] = "apply_complex";
static const char __pyx_k_convert_float[] = "convert_float";
static const char __pyx_k_get_head_name[] = "get_head_name";
static const char __pyx_k_get_int_value[] = "get_int_value";
static const char __pyx_k_get_precision[] = "get_precision";
static const char __pyx_k_length_of_int[] = "length_of_int";
static const char __pyx_k_Fold__operands[] = "Fold._operands";
static const char __pyx_k_MachineEpsilon[] = "MachineEpsilon_";
static const char __pyx_k_MaxPrecision_2[] = "$MaxPrecision";
static const char __pyx_k_MinPrecision_2[] = "$MinPrecision";
static const char __pyx_k_NumericQ_apply[] = "NumericQ.apply";
static const char __pyx_k_System_Complex[] = "System`Complex";
static const char __pyx_k_System_NValues[] = "System`NValues";
static const char __pyx_k_TypeEscalation[] = "TypeEscalation";
static const char __pyx_k_as_numer_denom[] = "as_numer_denom";
static const char __pyx_k_contextmanager[] = "contextmanager";
static const char __pyx_k_coordtransform[] = "coordtransform";
static const char __pyx_k_get_attributes[] = "get_attributes";
static const char __pyx_k_inner_interval[] = "inner_interval";
static const char __pyx_k_method_options[] = "method_options";
static const char __pyx_k_permit_complex[] = "permit_complex";
static const char __pyx_k_round_to_float[] = "round_to_float";
static const char __pyx_k_Chop_expr_10_10[] = "Chop[expr, 10^-10]";
static const char __pyx_k_IntegerDigits_n[] = "IntegerDigits[n_]";
static const char __pyx_k_NumericFunction[] = "NumericFunction";
static const char __pyx_k_Precision_apply[] = "Precision.apply";
static const char __pyx_k_System_Accuracy[] = "System`Accuracy";
static const char __pyx_k_System_NHoldAll[] = "System`NHoldAll";
static const char __pyx_k_System_Sequence[] = "System`Sequence";
static const char __pyx_k_Using_Automatic[] = "`}. Using `Automatic`";
static const char __pyx_k_ZLibHash___init[] = "_ZLibHash.__init__";
static const char __pyx_k_ZLibHash_update[] = "_ZLibHash.update";
static const char __pyx_k_apply_with_base[] = "apply_with_base";
static const char __pyx_k_apply_with_prec[] = "apply_with_prec";
static const char __pyx_k_get_float_value[] = "get_float_value";
static const char __pyx_k_get_lookup_name[] = "get_lookup_name";
static const char __pyx_k_invert_interval[] = "invert_interval";
static const char __pyx_k_machine_epsilon[] = "machine_epsilon";
static const char __pyx_k_mathics_version[] = "mathics.version";
static const char __pyx_k_scipy_integrate[] = "scipy.integrate";
static const char __pyx_k_scipy_interface[] = "_scipy_interface";
static const char __pyx_k_Cannot_integrate[] = ". Cannot integrate";
static const char __pyx_k_MachineEpsilon_2[] = "$MachineEpsilon";
static const char __pyx_k_MachinePrecision[] = "MachinePrecision";
static const char __pyx_k_RealDigits_apply[] = "RealDigits.apply";
static const char __pyx_k_System_NHoldRest[] = "System`NHoldRest";
static const char __pyx_k_System_Tolerance[] = "System`Tolerance";
static const char __pyx_k_decompose_domain[] = "decompose_domain";
static const char __pyx_k_find_approximant[] = "find_approximant";
static const char __pyx_k_get_string_value[] = "get_string_value";
static const char __pyx_k_scipy_proxy_func[] = "_scipy_proxy_func";
static const char __pyx_k_supported_hashes[] = "_supported_hashes";
static const char __pyx_k_NIntegrate___init[] = "NIntegrate.__init__";
static const char __pyx_k_N_Log_10_2_i_prec[] = "N[Log[10, 2] * %i, prec]";
static const char __pyx_k_N_apply_with_prec[] = "N.apply_with_prec";
static const char __pyx_k_Rationalize_apply[] = "Rationalize.apply";
static const char __pyx_k_RealValuedNumberQ[] = "RealValuedNumberQ";
static const char __pyx_k_System_NHoldFirst[] = "System`NHoldFirst";
static const char __pyx_k_ZeroDivisionError[] = "ZeroDivisionError";
static const char __pyx_k_ensure_evaluation[] = "ensure_evaluation";
static const char __pyx_k_get_option_values[] = "get_option_values";
static const char __pyx_k_machine_precision[] = "machine_precision";
static const char __pyx_k_nintegrate_method[] = "nintegrate_method";
static const char __pyx_k_quad_simpsons_mem[] = "_quad_simpsons_mem";
static const char __pyx_k_working_precision[] = "working_precision";
static const char __pyx_k_IntegerDigits_n_10[] = "IntegerDigits[n, 10]";
static const char __pyx_k_MachinePrecision_2[] = "MachinePrecision_";
static const char __pyx_k_MachinePrecision_3[] = "$MachinePrecision";
static const char __pyx_k_N_MachinePrecision[] = "N[MachinePrecision]";
static const char __pyx_k_RealValuedNumericQ[] = "RealValuedNumericQ";
static const char __pyx_k_ZLibHash_hexdigest[] = "_ZLibHash.hexdigest";
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
static const char __pyx_k_convert_float_base[] = "convert_float_base";
static const char __pyx_k_converted_operands[] = "converted_operands";
static const char __pyx_k_get_mutable_leaves[] = "get_mutable_leaves";
static const char __pyx_k_IntegerDigits_apply[] = "IntegerDigits.apply";
static const char __pyx_k_NotImplementedError[] = "NotImplementedError";
static const char __pyx_k_PrecisionValueError[] = "PrecisionValueError";
static const char __pyx_k_System_MaxRecursion[] = "System`MaxRecursion";
static const char __pyx_k_is_multidimensional[] = "is_multidimensional";
static const char __pyx_k_ComputationFunctions[] = "ComputationFunctions";
static const char __pyx_k_Fold_fold_locals_out[] = "Fold.fold.<locals>.out";
static const char __pyx_k_Rationalize_apply_dx[] = "Rationalize.apply_dx";
static const char __pyx_k_Round_expr__NumericQ[] = "Round[expr_?NumericQ]";
static const char __pyx_k_check_finite_decimal[] = "check_finite_decimal";
static const char __pyx_k_mathics_builtin_base[] = "mathics.builtin.base";
static const char __pyx_k_mathics_core_convert[] = "mathics.core.convert";
static const char __pyx_k_mathics_core_numbers[] = "mathics.core.numbers";
static const char __pyx_k_Hash_expr_MD5_Integer[] = "Hash[expr, \"MD5\", \"Integer\"]";
static const char __pyx_k_HexStringLittleEndian[] = "HexStringLittleEndian";
static const char __pyx_k_Rationalize_z_Complex[] = "Rationalize[z_Complex]";
static const char __pyx_k_TypeEscalation___init[] = "TypeEscalation.__init__";
static const char __pyx_k_Hash_expr__type_String[] = "Hash[expr_, type_String]";
static const char __pyx_k_Hash_expr_type_Integer[] = "Hash[expr, type, \"Integer\"]";
static const char __pyx_k_Rationalize_find_exact[] = "Rationalize.find_exact";
static const char __pyx_k_System_NumericFunction[] = "System`NumericFunction";
static const char __pyx_k_apply_with_func_domain[] = "apply_with_func_domain";
static const char __pyx_k_IntegerDigits_apply_len[] = "IntegerDigits.apply_len";
static const char __pyx_k_N_MachinePrecision_prec[] = "N[MachinePrecision, prec_]";
static const char __pyx_k_N_expr_MachinePrecision[] = "N[expr, MachinePrecision]";
static const char __pyx_k_System_DirectedInfinity[] = "System`DirectedInfinity";
static const char __pyx_k_mathics_builtin_numeric[] = "mathics.builtin.numeric";
static const char __pyx_k_mathics_core_expression[] = "mathics.core.expression";
static const char __pyx_k_scipy_proxy_func_filter[] = "_scipy_proxy_func_filter";
static const char __pyx_k_Fold_fold_locals_genexpr[] = "Fold.fold.<locals>.genexpr";
static const char __pyx_k_MachineEpsilon__evaluate[] = "MachineEpsilon_.evaluate";
static const char __pyx_k_RealDigits_apply_complex[] = "RealDigits.apply_complex";
static const char __pyx_k_apply_rational_with_base[] = "apply_rational_with_base";
static const char __pyx_k_Function_undefined_around[] = "Function undefined around ";
static const char __pyx_k_continued_fraction_reduce[] = "continued_fraction_reduce";
static const char __pyx_k_convert_int_to_digit_list[] = "convert_int_to_digit_list";
static const char __pyx_k_convert_repeating_decimal[] = "convert_repeating_decimal";
static const char __pyx_k_fubini_locals_subintegral[] = "_fubini.<locals>.subintegral";
static const char __pyx_k_NumericQ_apply_locals_test[] = "NumericQ.apply.<locals>.test";
static const char __pyx_k_RealDigits_apply_with_base[] = "RealDigits.apply_with_base";
static const char __pyx_k_apply_with_base_and_length[] = "apply_with_base_and_length";
static const char __pyx_k_mathics_builtin_numeric_py[] = "mathics/builtin/numeric.py";
static const char __pyx_k_NIntegrate_decompose_domain[] = "NIntegrate.decompose_domain";
static const char __pyx_k_Precision_z__MachineNumberQ[] = "Precision[z_?MachineNumberQ]";
static const char __pyx_k_apply_rational_without_base[] = "apply_rational_without_base";
static const char __pyx_k_continued_fraction_iterator[] = "continued_fraction_iterator";
static const char __pyx_k_Internal_RealValuedNumberQ_x[] = "Internal`RealValuedNumberQ[x_]";
static const char __pyx_k_Rationalize_find_approximant[] = "Rationalize.find_approximant";
static const char __pyx_k_Internal_RealValuedNumericQ_x[] = "Internal`RealValuedNumericQ[x_]";
static const char __pyx_k_continued_fraction_convergents[] = "continued_fraction_convergents";
static const char __pyx_k_dl_dt_MachineEpsilon_dd_is_the[] = "\n    <dl>\n    <dt>'$MachineEpsilon'\n        <dd>is the distance between '1.0' and the next\n            nearest representable machine-precision number.\n    </dl>\n\n    >> $MachineEpsilon\n     = 2.22045*^-16\n\n    >> x = 1.0 + {0.4, 0.5, 0.6} $MachineEpsilon;\n    >> x - 1\n     = {0., 0., 2.22045*^-16}\n    ";
static const char __pyx_k_dl_dt_NIntegrate_expr_interval[] = "\n    <dl>\n       <dt>'NIntegrate[$expr$, $interval$]'\n       <dd>returns a numeric approximation to the definite integral of $expr$ with limits $interval$ and with a precision of $prec$ digits.\n\n        <dt>'NIntegrate[$expr$, $interval1$, $interval2$, ...]'\n        <dd>returns a numeric approximation to the multiple integral of $expr$ with limits $interval1$, $interval2$ and with a precision of $prec$ digits.\n    </dl>\n\n    >> NIntegrate[Exp[-x],{x,0,Infinity},Tolerance->1*^-6]\n     = 1.\n    >> NIntegrate[Exp[x],{x,-Infinity, 0},Tolerance->1*^-6]\n     = 1.\n    >> NIntegrate[Exp[-x^2/2.],{x,-Infinity, Infinity},Tolerance->1*^-6]\n     = 2.50663\n\n    >> Table[1./NIntegrate[x^k,{x,0,1},Tolerance->1*^-6], {k,0,6}]\n     : The specified method failed to return a number. Falling back into the internal evaluator.\n     = {1., 2., 3., 4., 5., 6., 7.}\n\n    >> NIntegrate[1 / z, {z, -1 - I, 1 - I, 1 + I, -1 + I, -1 - I}, Tolerance->1.*^-4]\n     : Integration over a complex domain is not implemented yet\n     = NIntegrate[1 / z, {z, -1 - I, 1 - I, 1 + I, -1 + I, -1 - I}, Tolerance -> 0.0001]\n     ## = 6.2832 I\n\n    Integrate singularities with weak divergences:\n    >> Table[ NIntegrate[x^(1./k-1.), {x,0,1.}, Tolerance->1*^-6], {k,1,7.} ]\n     = {1., 2., 3., 4., 5., 6., 7.}\n\n    Mutiple Integrals :\n    >> NIntegrate[x * y,{x, 0, 1}, {y, 0, 1}]\n     = 0.25\n\n    ";
static const char __pyx_k_dl_dt_N_expr_prec_dd_evaluates[] = "\n    <dl>\n    <dt>'N[$expr$, $prec$]'\n        <dd>evaluates $expr$ numerically with a precision of $prec$ digits.\n    </dl>\n    >> N[Pi, 50]\n     = 3.1415926535897932384626433832795028841971693993751\n\n    >> N[1/7]\n     = 0.142857\n\n    >> N[1/7, 5]\n     = 0.14286\n\n    You can manually assign numerical values to symbols.\n    When you do not specify a precision, 'MachinePrecision' is taken.\n    >> N[a] = 10.9\n     = 10.9\n    >> a\n     = a\n\n    'N' automatically threads over expressions, except when a symbol has\n     attributes 'NHoldAll', 'NHoldFirst', or 'NHoldRest'.\n    >> N[a + b]\n     = 10.9 + b\n    >> N[a, 20]\n     = a\n    >> N[a, 20] = 11;\n    >> N[a + b, 20]\n     = 11.000000000000000000 + b\n    >> N[f[a, b]]\n     = f[10.9, b]\n    >> SetAttributes[f, NHoldAll]\n    >> N[f[a, b]]\n     = f[a, b]\n\n    The precision can be a pattern:\n    >> N[c, p_?(#>10&)] := p\n    >> N[c, 3]\n     = c\n    >> N[c, 11]\n     = 11.000000000\n\n    You can also use 'UpSet' or 'TagSet' to specify values for 'N':\n    >> N[d] ^= 5;\n    However, the value will not be stored in 'UpValues', but\n    in 'NValues' (as for 'Set'):\n    >> UpValues[d]\n     = {}\n    >> NValues[d]\n     = {HoldPattern[N[d, MachinePrecision]] :> 5}\n    >> e /: N[e] = 6;\n    >> N[e]\n     = 6.\n\n    Values for 'N[$expr$]' must be associated with the head of $expr$:\n    >> f /: N[e[f]] = 7;\n     : Tag f not found or too deep for an assigned rule.\n\n    You can use 'Condition':\n    >> N[g[x_, y_], p_] := x + y * Pi /; x + y > 3\n    >> SetAttributes[g, NHoldRest]\n    >> N[g[1, 1]]\n     = g[1., 1]\n    >> N[g[2, 2]] // InputForm\n     = 8.283185307179586\n\n    The precision of the result is no higher than the precision of the input\n    >> N[Exp[0.1], 100]\n     = 1.10517\n    >> % // Precision\n     = MachinePrecision\n    >> N[Exp[1/10], 100]\n     = 1.105170918075647624811707826490246668224547194737518718792863289440967966747654302989143318970748654\n    >> % // P""recision\n     = 100.\n    >> N[Exp[1.0`20], 100]\n     = 2.7182818284590452354\n    >> % // Precision\n     = 20.\n\n    #> p=N[Pi,100]\n     = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117068\n    #> ToString[p]\n     = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117068\n\n    #> N[1.012345678901234567890123, 20]\n     = 1.0123456789012345679\n\n    #> N[I, 30]\n     = 1.00000000000000000000000000000 I\n\n    #> N[1.012345678901234567890123, 50]\n     = 1.01234567890123456789012\n    #> % // Precision\n     = 24.\n    ";
static const char __pyx_k_1_2_is_not_a_valid_limit_of_int[] = "`1` = `2` is not a valid limit of integration.";
static const char __pyx_k_Cannot_set_1_to_2_value_must_be[] = "Cannot set `1` to `2`; value must be a non-negative number.";
static const char __pyx_k_Invalid_integration_variable_or[] = "Invalid integration variable or limit(s) in `1`.";
static const char __pyx_k_Numeric_Evaluation_and_Precisio[] = "\nNumeric Evaluation and Precision\n\nSupport for numeric evaluation with arbitrary precision is just a proof-of-concept.\n\nPrecision is not \"guarded\" through the evaluation process. Only integer precision is supported.\nHowever, things like 'N[Pi, 100]' should work as expected.\n";
static const char __pyx_k_Requested_precision_1_is_larger[] = "Requested precision `1` is larger than $MaxPrecision. Using current $MaxPrecision of `2` instead. $MaxPrecision = Infinity specifies that any precision should be allowed.";
static const char __pyx_k_Round_Re_expr_1_I_Round_Im_expr[] = "Round[Re[expr], 1] + I * Round[Im[expr], 1]";
static const char __pyx_k_Round_Re_expr_k_I_Round_Im_expr[] = "Round[Re[expr], k] + I * Round[Im[expr], k]";
static const char __pyx_k_dl_dt_Chop_expr_dd_replaces_flo[] = "\n    <dl>\n    <dt>'Chop[$expr$]'\n        <dd>replaces floating point numbers close to 0 by 0.\n    <dt>'Chop[$expr$, $delta$]'\n        <dd>uses a tolerance of $delta$. The default tolerance is '10^-10'.\n    </dl>\n\n    >> Chop[10.0 ^ -16]\n     = 0\n    >> Chop[10.0 ^ -9]\n     = 1.*^-9\n    >> Chop[10 ^ -11 I]\n     = I / 100000000000\n    >> Chop[0. + 10 ^ -11 I]\n     = 0\n    ";
static const char __pyx_k_dl_dt_Hash_expr_dd_returns_an_i[] = "\n    <dl>\n    <dt>'Hash[$expr$]'\n      <dd>returns an integer hash for the given $expr$.\n    <dt>'Hash[$expr$, $type$]'\n      <dd>returns an integer hash of the specified $type$ for the given $expr$.</dd>\n      <dd>The types supported are \"MD5\", \"Adler32\", \"CRC32\", \"SHA\", \"SHA224\", \"SHA256\", \"SHA384\", and \"SHA512\".</dd>\n    <dt>'Hash[$expr$, $type$, $format$]'\n      <dd>Returns the hash in the specified format.</dd>\n    </dl>\n\n    > Hash[\"The Adventures of Huckleberry Finn\"]\n    = 213425047836523694663619736686226550816\n\n    > Hash[\"The Adventures of Huckleberry Finn\", \"SHA256\"]\n    = 95092649594590384288057183408609254918934351811669818342876362244564858646638\n\n    > Hash[1/3]\n    = 56073172797010645108327809727054836008\n\n    > Hash[{a, b, {c, {d, e, f}}}]\n    = 135682164776235407777080772547528225284\n\n    > Hash[SomeHead[3.1415]]\n    = 58042316473471877315442015469706095084\n\n    >> Hash[{a, b, c}, \"xyzstr\"]\n     = Hash[{a, b, c}, xyzstr, Integer]\n    ";
static const char __pyx_k_dl_dt_IntegerDigits_n_dd_return[] = "\n    <dl>\n    <dt>'IntegerDigits[$n$]'\n        <dd>returns a list of the base-10 digits in the integer $n$.\n    <dt>'IntegerDigits[$n$, $base$]'\n        <dd>returns a list of the base-$base$ digits in $n$.\n    <dt>'IntegerDigits[$n$, $base$, $length$]'\n        <dd>returns a list of length $length$, truncating or padding\n        with zeroes on the left as necessary.\n    </dl>\n\n    >> IntegerDigits[76543]\n     = {7, 6, 5, 4, 3}\n\n    The sign of $n$ is discarded:\n    >> IntegerDigits[-76543]\n     = {7, 6, 5, 4, 3}\n\n    >> IntegerDigits[15, 16]\n     = {15}\n    >> IntegerDigits[1234, 16]\n     = {4, 13, 2}\n    >> IntegerDigits[1234, 10, 5]\n     = {0, 1, 2, 3, 4}\n\n    #> IntegerDigits[1000, 10]\n     = {1, 0, 0, 0}\n\n    #> IntegerDigits[0]\n     = {0}\n    ";
static const char __pyx_k_dl_dt_MachinePrecision_dd_is_th[] = "\n    <dl>\n    <dt>'$MachinePrecision'\n        <dd>is the number of decimal digits of precision for\n            machine-precision numbers.\n    </dl>\n\n    >> $MachinePrecision\n     = 15.9546\n    ";
static const char __pyx_k_dl_dt_MachinePrecision_dd_repre[] = "\n    <dl>\n    <dt>'MachinePrecision'\n        <dd>represents the precision of machine precision numbers.\n    </dl>\n\n    >> N[MachinePrecision]\n     = 15.9546\n    >> N[MachinePrecision, 30]\n     = 15.9545897701910033463281614204\n\n    #> N[E, MachinePrecision]\n     = 2.71828\n\n    #> Round[MachinePrecision]\n     = 16\n    ";
static const char __pyx_k_dl_dt_MaxPrecision_dd_represent[] = "\n    <dl>\n    <dt>'$MaxPrecision'\n      <dd>represents the maximum number of digits of precision\n          permitted in abitrary-precision numbers.\n    </dl>\n\n    >> $MaxPrecision\n     = Infinity\n\n    >> $MaxPrecision = 10;\n\n    >> N[Pi, 11]\n     : Requested precision 11 is larger than $MaxPrecision. Using current $MaxPrecision of 10. instead. $MaxPrecision = Infinity specifies that any precision should be allowed.\n     = 3.141592654\n\n    #> N[Pi, 10]\n     = 3.141592654\n\n    #> $MaxPrecision = x\n     : Cannot set $MaxPrecision to x; value must be a positive number or Infinity.\n     = x\n    #> $MaxPrecision = -Infinity\n     : Cannot set $MaxPrecision to -Infinity; value must be a positive number or Infinity.\n     = -Infinity\n    #> $MaxPrecision = 0\n     : Cannot set $MaxPrecision to 0; value must be a positive number or Infinity.\n     = 0\n    #> $MaxPrecision = Infinity;\n\n    #> $MinPrecision = 15;\n    #> $MaxPrecision = 10\n     : Cannot set $MaxPrecision such that $MaxPrecision < $MinPrecision.\n     = 10\n    #> $MaxPrecision\n     = Infinity\n    #> $MinPrecision = 0;\n    ";
static const char __pyx_k_dl_dt_MinPrecision_dd_represent[] = "\n    <dl>\n    <dt>'$MinPrecision'\n      <dd>represents the minimum number of digits of precision\n          permitted in abitrary-precision numbers.\n    </dl>\n\n    >> $MinPrecision\n     = 0\n\n    >> $MinPrecision = 10;\n\n    >> N[Pi, 9]\n     : Requested precision 9 is smaller than $MinPrecision. Using current $MinPrecision of 10. instead.\n     = 3.141592654\n\n    #> N[Pi, 10]\n     = 3.141592654\n\n    #> $MinPrecision = x\n     : Cannot set $MinPrecision to x; value must be a non-negative number.\n     = x\n    #> $MinPrecision = -Infinity\n     : Cannot set $MinPrecision to -Infinity; value must be a non-negative number.\n     = -Infinity\n    #> $MinPrecision = -1\n     : Cannot set $MinPrecision to -1; value must be a non-negative number.\n     = -1\n    #> $MinPrecision = 0;\n\n    #> $MaxPrecision = 10;\n    #> $MinPrecision = 15\n     : Cannot set $MinPrecision such that $MaxPrecision < $MinPrecision.\n     = 15\n    #> $MinPrecision\n     = 0\n    #> $MaxPrecision = Infinity;\n    ";
static const char __pyx_k_dl_dt_NumericQ_expr_dd_tests_wh[] = "\n    <dl>\n    <dt>'NumericQ[$expr$]'\n        <dd>tests whether $expr$ represents a numeric quantity.\n    </dl>\n\n    >> NumericQ[2]\n     = True\n    >> NumericQ[Sqrt[Pi]]\n     = True\n    >> NumberQ[Sqrt[Pi]]\n     = False\n    ";
static const char __pyx_k_dl_dt_Precision_expr_dd_examine[] = "\n    <dl>\n    <dt>'Precision[$expr$]'\n        <dd>examines the number of significant digits of $expr$.\n    </dl>\n    This is rather a proof-of-concept than a full implementation.\n    Precision of compound expression is not supported yet.\n    >> Precision[1]\n     = Infinity\n    >> Precision[1/2]\n     = Infinity\n    >> Precision[0.5]\n     = MachinePrecision\n\n    #> Precision[0.0]\n     = MachinePrecision\n    #> Precision[0.000000000000000000000000000000000000]\n     = 0.\n    #> Precision[-0.0]\n     = MachinePrecision\n    #> Precision[-0.000000000000000000000000000000000000]\n     = 0.\n\n    #> 1.0000000000000000 // Precision\n     = MachinePrecision\n    #> 1.00000000000000000 // Precision\n     = 17.\n\n    #> 0.4 + 2.4 I // Precision\n     = MachinePrecision\n    #> Precision[2 + 3 I]\n     = Infinity\n\n    #> Precision[\"abc\"]\n     = Infinity\n    ";
static const char __pyx_k_dl_dt_Rationalize_x_dd_converts[] = "\n    <dl>\n    <dt>'Rationalize[$x$]'\n        <dd>converts a real number $x$ to a nearby rational number.\n    <dt>'Rationalize[$x$, $dx$]'\n        <dd>finds the rational number within $dx$ of $x$ with the smallest denominator.\n    </dl>\n\n    >> Rationalize[2.2]\n    = 11 / 5\n\n    Not all numbers can be well approximated.\n    >> Rationalize[N[Pi]]\n     = 3.14159\n\n    Find the exact rational representation of 'N[Pi]'\n    >> Rationalize[N[Pi], 0]\n     = 245850922 / 78256779\n\n    #> Rationalize[1.6 + 0.8 I]\n     = 8 / 5 + 4 I / 5\n\n    #> Rationalize[N[Pi] + 0.8 I, 1*^-6]\n     = 355 / 113 + 4 I / 5\n\n    #> Rationalize[N[Pi] + 0.8 I, x]\n     : Tolerance specification x must be a non-negative number.\n     = Rationalize[3.14159 + 0.8 I, x]\n\n    #> Rationalize[N[Pi] + 0.8 I, -1]\n     : Tolerance specification -1 must be a non-negative number.\n     = Rationalize[3.14159 + 0.8 I, -1]\n\n    #> Rationalize[N[Pi] + 0.8 I, 0]\n     = 245850922 / 78256779 + 4 I / 5\n\n    #> Rationalize[17 / 7]\n     = 17 / 7\n\n    #> Rationalize[x]\n     = x\n\n    #> Table[Rationalize[E, 0.1^n], {n, 1, 10}]\n     = {8 / 3, 19 / 7, 87 / 32, 193 / 71, 1071 / 394, 2721 / 1001, 15062 / 5541, 23225 / 8544, 49171 / 18089, 419314 / 154257}\n\n    #> Rationalize[x, y]\n     : Tolerance specification y must be a non-negative number.\n     = Rationalize[x, y]\n    ";
static const char __pyx_k_dl_dt_RealDigits_n_dd_returns_t[] = "\n    <dl>\n    <dt>'RealDigits[$n$]'\n        <dd>returns the decimal representation of the real number $n$ as list of digits, together with the number of digits that are to the left of the decimal point.\n\n    <dt>'RealDigits[$n$, $b$]'\n        <dd>returns a list of base_$b$ representation of the real number $n$.\n\n    <dt>'RealDigits[$n$, $b$, $len$]'\n        <dd>returns a list of $len$ digits.\n\n    <dt>'RealDigits[$n$, $b$, $len$, $p$]'\n        <dd>return $len$ digits starting with the coefficient of $b$^$p$\n    </dl>\n\n    Return the list of digits and exponent:\n    >> RealDigits[123.55555]\n     = {{1, 2, 3, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0}, 3}\n\n    Return an explicit recurring decimal form:\n    >> RealDigits[19 / 7]\n     = {{2, {7, 1, 4, 2, 8, 5}}, 1}\n\n    The 10000th digit of  is an 8:\n    >> RealDigits[Pi, 10, 1, -10000]\n    = {{8}, -9999}\n\n    20 digits starting with the coefficient of 10^-5:\n    >> RealDigits[Pi, 10, 20, -5]\n     = {{9, 2, 6, 5, 3, 5, 8, 9, 7, 9, 3, 2, 3, 8, 4, 6, 2, 6, 4, 3}, -4}\n\n    RealDigits gives Indeterminate if more digits than the precision are requested:\n    >> RealDigits[123.45, 10, 18]\n     = {{1, 2, 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Indeterminate, Indeterminate}, 3}\n\n    #> RealDigits[-1.25, -1]\n     : Base -1 is not a real number greater than 1.\n     = RealDigits[-1.25, -1]\n\n    Return 25 digits of in base 10:\n    >> RealDigits[Pi, 10, 25]\n     = {{3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8, 9, 7, 9, 3, 2, 3, 8, 4, 6, 2, 6, 4, 3}, 1}\n\n    #> RealDigits[-Pi]\n     : The number of digits to return cannot be determined.\n     = RealDigits[-Pi]\n\n    #> RealDigits[I, 7]\n     : The value I is not a real number.\n    = RealDigits[I, 7]\n\n    #> RealDigits[Pi]\n     : The number of digits to return cannot be determined.\n     = RealDigits[Pi]\n\n    #> RealDigits[3 + 4 I]\n     : The value 3 + 4 I is not a real number.\n     = RealDigits[3 + 4 I]\n\n\n    #> RealDigits[3.14, 10, 1.5]""\n     : Non-negative machine-sized integer expected at position 3 in RealDigits[3.14, 10, 1.5].\n     = RealDigits[3.14, 10, 1.5]\n\n    #> RealDigits[3.14, 10, 1, 1.5]\n     : Machine-sized integer expected at position 4 in RealDigits[3.14, 10, 1, 1.5].\n     = RealDigits[3.14, 10, 1, 1.5]\n\n    ";
static const char __pyx_k_dl_dt_Round_expr_dd_rounds_expr[] = "\n    <dl>\n    <dt>'Round[$expr$]'\n        <dd>rounds $expr$ to the nearest integer.\n    <dt>'Round[$expr$, $k$]'\n        <dd>rounds $expr$ to the closest multiple of $k$.\n    </dl>\n\n    >> Round[10.6]\n     = 11\n    >> Round[0.06, 0.1]\n     = 0.1\n    >> Round[0.04, 0.1]\n     = 0.\n\n    Constants can be rounded too\n    >> Round[Pi, .5]\n     = 3.\n    >> Round[Pi^2]\n     = 10\n\n    Round to exact value\n    >> Round[2.6, 1/3]\n     = 8 / 3\n    >> Round[10, Pi]\n     = 3 Pi\n\n    Round complex numbers\n    >> Round[6/(2 + 3 I)]\n     = 1 - I\n    >> Round[1 + 2 I, 2 I]\n     = 2 I\n\n    Round Negative numbers too\n    >> Round[-1.4]\n     = -1\n\n    Expressions other than numbers remain unevaluated:\n    >> Round[x]\n     = Round[x]\n    >> Round[1.5, k]\n     = Round[1.5, k]\n    ";
static const char __pyx_k_fubini_locals_subintegral_local[] = "_fubini.<locals>.subintegral.<locals>.ff";
static const char __pyx_k_internal_adaptative_simpsons_ru[] = "_internal_adaptative_simpsons_rule.<locals>._quad_simpsons_mem";
static const char __pyx_k_scipy_interface_locals__scipy_p[] = "_scipy_interface.<locals>._scipy_proxy_func_filter";
static const char __pyx_k_Base_1_is_not_a_real_number_grea[] = "Base `1` is not a real number greater than 1.";
static const char __pyx_k_Base_1_is_not_an_integer_greater[] = "Base `1` is not an integer greater than 1.";
static const char __pyx_k_Cannot_set_1_such_that_MaxPrecis[] = "Cannot set `1` such that $MaxPrecision < $MinPrecision.";
static const char __pyx_k_Fold_fold_locals_converted_opera[] = "Fold.fold.<locals>.converted_operands.<locals>.genexpr";
static const char __pyx_k_Fold_fold_locals_working_precisi[] = "Fold.fold.<locals>.working_precision";
static const char __pyx_k_Integer_expected_at_position_1_i[] = "Integer expected at position 1 in `1`";
static const char __pyx_k_Integration_over_a_complex_domai[] = "Integration over a complex domain is not implemented yet";
static const char __pyx_k_Internal_RealValuedNumberQ_x_Int[] = "Internal`RealValuedNumberQ[x_Integer]";
static const char __pyx_k_Internal_RealValuedNumberQ_x_Rat[] = "Internal`RealValuedNumberQ[x_Rational]";
static const char __pyx_k_Internal_RealValuedNumberQ_x_Rea[] = "Internal`RealValuedNumberQ[x_Real]";
static const char __pyx_k_Machine_sized_integer_expected_a[] = "Machine-sized integer expected at position 4 in `1`.";
static const char __pyx_k_NIntegrate___init___locals_lambd[] = "NIntegrate.__init__.<locals>.<lambda>";
static const char __pyx_k_NIntegrate_apply_with_func_domai[] = "NIntegrate.apply_with_func_domain.<locals>.<lambda>";
static const char __pyx_k_Non_negative_machine_sized_integ[] = "Non-negative machine-sized integer expected at position 3 in `1`.";
static const char __pyx_k_NumericQ_apply_locals_test_local[] = "NumericQ.apply.<locals>.test.<locals>.genexpr";
static const char __pyx_k_Rationalize_Re_z_I_Rationalize_I[] = "Rationalize[Re[z]] + I Rationalize[Im[z]]";
static const char __pyx_k_Rationalize_Re_z_dx_I_Rationaliz[] = "Rationalize[Re[z], dx] + I Rationalize[Im[z], dx]";
static const char __pyx_k_Rationalize_approx_interval_cont[] = "Rationalize.approx_interval_continued_fraction";
static const char __pyx_k_Rationalize_z_Complex_dx__Intern[] = "Rationalize[z_Complex, dx_?Internal`RealValuedNumberQ]/;dx >= 0";
static const char __pyx_k_RealDigits_apply_rational_with_b[] = "RealDigits.apply_rational_with_base";
static const char __pyx_k_RealDigits_apply_rational_withou[] = "RealDigits.apply_rational_without_base";
static const char __pyx_k_RealDigits_apply_with_base_and_l[] = "RealDigits.apply_with_base_and_length";
static const char __pyx_k_RealDigits_apply_with_base_lengt[] = "RealDigits.apply_with_base_length_and_precision";
static const char __pyx_k_Requested_precision_1_is_not_a_m[] = "Requested precision `1` is not a machine-sized real number.";
static const char __pyx_k_Requested_precision_1_is_smaller[] = "Requested precision `1` is smaller than $MinPrecision. Using current $MinPrecision of `2` instead.";
static const char __pyx_k_Round_expr_Complex_k__RealNumber[] = "Round[expr_Complex, k_?RealNumberQ]";
static const char __pyx_k_The_Method_option_should_be_a_bu[] = "The Method option should be a built-in method name in {`";
static const char __pyx_k_The_integrand_1_has_evaluated_to[] = "The integrand `1` has evaluated to non-numerical values for all sampling points in the region with boundaries `2`";
static const char __pyx_k_The_number_of_digits_to_return_c[] = "The number of digits to return cannot be determined.";
static const char __pyx_k_The_specified_method_failed_to_r[] = "The specified method failed to return a number. Falling back into the internal evaluator.";
static const char __pyx_k_The_value_1_is_not_a_real_number[] = "The value `1` is not a real number.";
static const char __pyx_k_Tolerance_specification_1_must_b[] = "Tolerance specification `1` must be a non-negative number.";
static const char __pyx_k_Tolerance_specification_a_must_b[] = "Tolerance specification a must be a non-negative number.";
static const char __pyx_k_apply_with_base_length_and_preci[] = "apply_with_base_length_and_precision";
static const char __pyx_k_approx_interval_continued_fracti[] = "approx_interval_continued_fraction";
static const char __pyx_k_convert_float_base_locals_conver[] = "convert_float_base.<locals>.convert_int";
static const char __pyx_k_convert_repeating_decimal_locals[] = "convert_repeating_decimal.<locals>.genexpr";
static const char __pyx_k_Cannot_set_1_to_2_value_must_be_2[] = "Cannot set `1` to `2`; value must be a positive number or Infinity.";
static const char __pyx_k_internal_adaptative_simpsons_ru_2[] = "_internal_adaptative_simpsons_rule.<locals>._quad_asr";
static const char __pyx_k_internal_adaptative_simpsons_ru_3[] = "_internal_adaptative_simpsons_rule.<locals>.ensure_evaluation";
static const char __pyx_k_internal_adaptative_simpsons_ru_4[] = "_internal_adaptative_simpsons_rule";
static const char __pyx_k_scipy_interface_locals__scipy_p_2[] = "_scipy_interface.<locals>._scipy_proxy_func";
static const char __pyx_k_Fold_fold_locals_converted_opera_2[] = "Fold.fold.<locals>.converted_operands";
static const char __pyx_k_NIntegrate_apply_with_func_domai_2[] = "NIntegrate.apply_with_func_domain";
static const char __pyx_k_The_Method_option_should_be_a_bu_2[] = "The Method option should be a built-in method name.";
static const char __pyx_k_convert_float_base_locals_conver_2[] = "convert_float_base.<locals>.convert_float";
static PyObject *__pyx_kp_u_0;
static PyObject *__pyx_kp_u_10;
static PyObject *__pyx_kp_u_1_10;
static PyObject *__pyx_kp_u_1_2_is_not_a_valid_limit_of_int;
static PyObject *__pyx_n_u_Accuracy;
static PyObject *__pyx_n_u_Adler32;
static PyObject *__pyx_n_u_Automatic;
static PyObject *__pyx_kp_u_Automatic_2;
static PyObject *__pyx_kp_u_Base_1_is_not_a_real_number_grea;
static PyObject *__pyx_kp_u_Base_1_is_not_an_integer_greater;
static PyObject *__pyx_n_u_Blank;
static PyObject *__pyx_n_s_Builtin;
static PyObject *__pyx_n_u_ByteArray;
static PyObject *__pyx_n_u_CRC32;
static PyObject *__pyx_kp_u_Cannot_integrate;
static PyObject *__pyx_kp_u_Cannot_set_1_such_that_MaxPrecis;
static PyObject *__pyx_kp_u_Cannot_set_1_to_2_value_must_be;
static PyObject *__pyx_kp_u_Cannot_set_1_to_2_value_must_be_2;
static PyObject *__pyx_n_s_Chop;
static PyObject *__pyx_n_u_Chop;
static PyObject *__pyx_n_s_Chop_apply;
static PyObject *__pyx_kp_u_Chop_expr;
static PyObject *__pyx_kp_u_Chop_expr_10_10;
static PyObject *__pyx_n_u_Compile;
static PyObject *__pyx_n_s_Complex;
static PyObject *__pyx_n_u_Complex;
static PyObject *__pyx_n_s_ComputationFunctions;
static PyObject *__pyx_n_u_ComputationFunctions;
static PyObject *__pyx_n_u_Cos;
static PyObject *__pyx_n_u_DecimalString;
static PyObject *__pyx_n_u_Divide;
static PyObject *__pyx_n_u_E;
static PyObject *__pyx_n_s_Expression;
static PyObject *__pyx_n_s_FLOAT;
static PyObject *__pyx_n_u_False;
static PyObject *__pyx_n_s_Float;
static PyObject *__pyx_n_s_Fold;
static PyObject *__pyx_n_s_Fold__fold;
static PyObject *__pyx_n_s_Fold__operands;
static PyObject *__pyx_n_s_Fold__spans;
static PyObject *__pyx_n_s_Fold_fold;
static PyObject *__pyx_n_s_Fold_fold_locals_converted_opera;
static PyObject *__pyx_n_s_Fold_fold_locals_converted_opera_2;
static PyObject *__pyx_n_s_Fold_fold_locals_genexpr;
static PyObject *__pyx_n_s_Fold_fold_locals_out;
static PyObject *__pyx_n_s_Fold_fold_locals_working_precisi;
static PyObject *__pyx_n_s_Fold_lambda;
static PyObject *__pyx_kp_u_Function_undefined_around;
static PyObject *__pyx_n_s_Hash;
static PyObject *__pyx_n_s_Hash_apply;
static PyObject *__pyx_n_s_Hash_compute;
static PyObject *__pyx_kp_u_Hash_expr;
static PyObject *__pyx_kp_u_Hash_expr_MD5_Integer;
static PyObject *__pyx_kp_u_Hash_expr__type_String;
static PyObject *__pyx_kp_u_Hash_expr_type_Integer;
static PyObject *__pyx_n_s_Hash_lambda;
static PyObject *__pyx_kp_u_Head_N_x_Real;
static PyObject *__pyx_n_u_HexString;
static PyObject *__pyx_n_u_HexStringLittleEndian;
static PyObject *__pyx_n_u_Indeterminate;
static PyObject *__pyx_n_u_Infinity;
static PyObject *__pyx_n_s_Integer;
static PyObject *__pyx_n_s_Integer0;
static PyObject *__pyx_n_s_IntegerDigits;
static PyObject *__pyx_n_u_IntegerDigits;
static PyObject *__pyx_n_s_IntegerDigits_apply;
static PyObject *__pyx_n_s_IntegerDigits_apply_len;
static PyObject *__pyx_kp_u_IntegerDigits_n;
static PyObject *__pyx_kp_u_IntegerDigits_n_10;
static PyObject *__pyx_kp_u_Integer_expected_at_position_1_i;
static PyObject *__pyx_kp_u_Integration_over_a_complex_domai;
static PyObject *__pyx_n_u_Internal;
static PyObject *__pyx_kp_u_Internal_2;
static PyObject *__pyx_kp_u_Internal_RealValuedNumberQ_x;
static PyObject *__pyx_kp_u_Internal_RealValuedNumberQ_x_Int;
static PyObject *__pyx_kp_u_Internal_RealValuedNumberQ_x_Rat;
static PyObject *__pyx_kp_u_Internal_RealValuedNumberQ_x_Rea;
static PyObject *__pyx_kp_u_Internal_RealValuedNumericQ_x;
static PyObject *__pyx_kp_u_Invalid_integration_variable_or;
static PyObject *__pyx_n_u_List;
static PyObject *__pyx_n_u_Listable;
static PyObject *__pyx_n_u_Log;
static PyObject *__pyx_n_u_MD5;
static PyObject *__pyx_n_s_MPMATH;
static PyObject *__pyx_n_s_MachineEpsilon;
static PyObject *__pyx_kp_u_MachineEpsilon_2;
static PyObject *__pyx_n_s_MachineEpsilon__evaluate;
static PyObject *__pyx_n_s_MachinePrecision;
static PyObject *__pyx_n_u_MachinePrecision;
static PyObject *__pyx_n_s_MachinePrecision_2;
static PyObject *__pyx_kp_u_MachinePrecision_3;
static PyObject *__pyx_n_s_MachineReal;
static PyObject *__pyx_kp_u_Machine_sized_integer_expected_a;
static PyObject *__pyx_n_s_MaxPrecision;
static PyObject *__pyx_kp_u_MaxPrecision_2;
static PyObject *__pyx_n_u_MaxRecursion;
static PyObject *__pyx_n_u_Method;
static PyObject *__pyx_n_s_MinPrecision;
static PyObject *__pyx_kp_u_MinPrecision_2;
static PyObject *__pyx_n_s_N;
static PyObject *__pyx_n_u_N;
static PyObject *__pyx_n_s_NIntegrate;
static PyObject *__pyx_n_u_NIntegrate;
static PyObject *__pyx_n_s_NIntegrate___init;
static PyObject *__pyx_n_s_NIntegrate___init___locals_lambd;
static PyObject *__pyx_n_s_NIntegrate_apply_with_func_domai;
static PyObject *__pyx_n_s_NIntegrate_apply_with_func_domai_2;
static PyObject *__pyx_n_s_NIntegrate_decompose_domain;
static PyObject *__pyx_n_u_NQuadrature;
static PyObject *__pyx_kp_u_N_Log_10_2_i_prec;
static PyObject *__pyx_kp_u_N_MachinePrecision;
static PyObject *__pyx_kp_u_N_MachinePrecision_prec;
static PyObject *__pyx_n_s_N_apply_with_prec;
static PyObject *__pyx_kp_u_N_expr;
static PyObject *__pyx_kp_u_N_expr_MachinePrecision;
static PyObject *__pyx_kp_u_Non_negative_machine_sized_integ;
static PyObject *__pyx_n_s_NotImplementedError;
static PyObject *__pyx_n_s_Number;
static PyObject *__pyx_n_u_NumericFunction;
static PyObject *__pyx_n_s_NumericQ;
static PyObject *__pyx_n_s_NumericQ_apply;
static PyObject *__pyx_n_s_NumericQ_apply_locals_test;
static PyObject *__pyx_n_s_NumericQ_apply_locals_test_local;
static PyObject *__pyx_n_s_Precision;
static PyObject *__pyx_n_u_Precision;
static PyObject *__pyx_n_s_PrecisionValueError;
static PyObject *__pyx_n_s_Precision_apply;
static PyObject *__pyx_kp_u_Precision_z__MachineNumberQ;
static PyObject *__pyx_n_s_Predefined;
static PyObject *__pyx_n_u_Protected;
static PyObject *__pyx_n_u_Quadrature;
static PyObject *__pyx_n_s_Rational;
static PyObject *__pyx_n_s_Rationalize;
static PyObject *__pyx_n_u_Rationalize;
static PyObject *__pyx_kp_u_Rationalize_Re_z_I_Rationalize_I;
static PyObject *__pyx_kp_u_Rationalize_Re_z_dx_I_Rationaliz;
static PyObject *__pyx_n_s_Rationalize_apply;
static PyObject *__pyx_n_s_Rationalize_apply_dx;
static PyObject *__pyx_n_s_Rationalize_approx_interval_cont;
static PyObject *__pyx_n_s_Rationalize_find_approximant;
static PyObject *__pyx_n_s_Rationalize_find_exact;
static PyObject *__pyx_kp_u_Rationalize_z_Complex;
static PyObject *__pyx_kp_u_Rationalize_z_Complex_dx__Intern;
static PyObject *__pyx_n_u_ReadProtected;
static PyObject *__pyx_n_s_Real;
static PyObject *__pyx_n_s_RealDigits;
static PyObject *__pyx_n_u_RealDigits;
static PyObject *__pyx_n_s_RealDigits_apply;
static PyObject *__pyx_n_s_RealDigits_apply_complex;
static PyObject *__pyx_n_s_RealDigits_apply_rational_with_b;
static PyObject *__pyx_n_s_RealDigits_apply_rational_withou;
static PyObject *__pyx_n_s_RealDigits_apply_with_base;
static PyObject *__pyx_n_s_RealDigits_apply_with_base_and_l;
static PyObject *__pyx_n_s_RealDigits_apply_with_base_lengt;
static PyObject *__pyx_n_s_RealValuedNumberQ;
static PyObject *__pyx_n_s_RealValuedNumericQ;
static PyObject *__pyx_kp_u_Requested_precision_1_is_larger;
static PyObject *__pyx_kp_u_Requested_precision_1_is_not_a_m;
static PyObject *__pyx_kp_u_Requested_precision_1_is_smaller;
static PyObject *__pyx_n_u_Romberg;
static PyObject *__pyx_n_u_Root;
static PyObject *__pyx_n_s_Round;
static PyObject *__pyx_n_u_Round;
static PyObject *__pyx_kp_u_Round_Re_expr_1_I_Round_Im_expr;
static PyObject *__pyx_kp_u_Round_Re_expr_k_I_Round_Im_expr;
static PyObject *__pyx_n_s_Round_apply;
static PyObject *__pyx_kp_u_Round_expr_Complex_k__RealNumber;
static PyObject *__pyx_kp_u_Round_expr__NumericQ;
static PyObject *__pyx_n_u_SHA;
static PyObject *__pyx_n_u_SHA224;
static PyObject *__pyx_n_u_SHA256;
static PyObject *__pyx_n_u_SHA384;
static PyObject *__pyx_n_u_SHA512;
static PyObject *__pyx_n_s_SYMBOLIC;
static PyObject *__pyx_n_u_Simpson;
static PyObject *__pyx_n_u_Sin;
static PyObject *__pyx_n_s_String;
static PyObject *__pyx_n_s_Symbol;
static PyObject *__pyx_n_s_SymbolFalse;
static PyObject *__pyx_n_s_SymbolList;
static PyObject *__pyx_n_s_SymbolN;
static PyObject *__pyx_n_s_SymbolTrue;
static PyObject *__pyx_kp_u_System;
static PyObject *__pyx_kp_u_System_Accuracy;
static PyObject *__pyx_kp_u_System_Complex;
static PyObject *__pyx_kp_u_System_DirectedInfinity;
static PyObject *__pyx_kp_u_System_List;
static PyObject *__pyx_kp_u_System_MaxRecursion;
static PyObject *__pyx_kp_u_System_Method;
static PyObject *__pyx_kp_u_System_NHoldAll;
static PyObject *__pyx_kp_u_System_NHoldFirst;
static PyObject *__pyx_kp_u_System_NHoldRest;
static PyObject *__pyx_kp_u_System_NValues;
static PyObject *__pyx_kp_u_System_NumericFunction;
static PyObject *__pyx_kp_u_System_Rule;
static PyObject *__pyx_kp_u_System_Sequence;
static PyObject *__pyx_kp_u_System_Tolerance;
static PyObject *__pyx_kp_u_The_Method_option_should_be_a_bu;
static PyObject *__pyx_kp_u_The_Method_option_should_be_a_bu_2;
static PyObject *__pyx_kp_u_The_integrand_1_has_evaluated_to;
static PyObject *__pyx_kp_u_The_number_of_digits_to_return_c;
static PyObject *__pyx_kp_u_The_specified_method_failed_to_r;
static PyObject *__pyx_kp_u_The_value_1_is_not_a_real_number;
static PyObject *__pyx_n_u_Times;
static PyObject *__pyx_n_u_Tolerance;
static PyObject *__pyx_kp_u_Tolerance_specification_1_must_b;
static PyObject *__pyx_kp_u_Tolerance_specification_a_must_b;
static PyObject *__pyx_n_u_True;
static PyObject *__pyx_n_s_TypeError;
static PyObject *__pyx_n_s_TypeEscalation;
static PyObject *__pyx_n_s_TypeEscalation___init;
static PyObject *__pyx_kp_u_Using_Automatic;
static PyObject *__pyx_n_s_ZLibHash;
static PyObject *__pyx_n_s_ZLibHash___init;
static PyObject *__pyx_n_s_ZLibHash_hexdigest;
static PyObject *__pyx_n_s_ZLibHash_update;
static PyObject *__pyx_n_s_ZeroDivisionError;
static PyObject *__pyx_kp_b__2;
static PyObject *__pyx_kp_u__2;
static PyObject *__pyx_kp_u__22;
static PyObject *__pyx_kp_u__36;
static PyObject *__pyx_n_s__38;
static PyObject *__pyx_n_s_a;
static PyObject *__pyx_n_s_a_gen;
static PyObject *__pyx_n_s_accuracy;
static PyObject *__pyx_n_u_acur;
static PyObject *__pyx_n_s_adapt_func;
static PyObject *__pyx_n_s_adler32;
static PyObject *__pyx_n_s_any;
static PyObject *__pyx_n_s_append;
static PyObject *__pyx_n_s_apply;
static PyObject *__pyx_n_s_apply_complex;
static PyObject *__pyx_n_s_apply_dx;
static PyObject *__pyx_n_s_apply_len;
static PyObject *__pyx_n_s_apply_rational_with_base;
static PyObject *__pyx_n_s_apply_rational_without_base;
static PyObject *__pyx_n_s_apply_with_base;
static PyObject *__pyx_n_s_apply_with_base_and_length;
static PyObject *__pyx_n_s_apply_with_base_length_and_preci;
static PyObject *__pyx_n_s_apply_with_func_domain;
static PyObject *__pyx_n_s_apply_with_prec;
static PyObject *__pyx_n_s_approx_interval_continued_fracti;
static PyObject *__pyx_n_s_arctanh;
static PyObject *__pyx_n_s_args;
static PyObject *__pyx_n_s_as_numer_denom;
static PyObject *__pyx_n_s_as_operand;
static PyObject *__pyx_n_s_attr;
static PyObject *__pyx_n_s_attributes;
static PyObject *__pyx_n_s_axis;
static PyObject *__pyx_n_s_b;
static PyObject *__pyx_n_s_b_gen;
static PyObject *__pyx_n_s_base;
static PyObject *__pyx_n_u_bdmtd;
static PyObject *__pyx_n_s_boundaries;
static PyObject *__pyx_n_s_bytes;
static PyObject *__pyx_n_s_bytes_2;
static PyObject *__pyx_n_s_c;
static PyObject *__pyx_n_s_c_init;
static PyObject *__pyx_n_s_c_operands;
static PyObject *__pyx_n_s_ceil;
static PyObject *__pyx_n_s_cfunc;
static PyObject *__pyx_n_s_chain;
static PyObject *__pyx_n_s_check_finite_decimal;
static PyObject *__pyx_n_s_chop;
static PyObject *__pyx_n_s_cline_in_traceback;
static PyObject *__pyx_n_s_close;
static PyObject *__pyx_n_u_cmpint;
static PyObject *__pyx_n_s_collections;
static PyObject *__pyx_n_s_compute;
static PyObject *__pyx_n_s_context;
static PyObject *__pyx_n_s_contextlib;
static PyObject *__pyx_n_s_contextmanager;
static PyObject *__pyx_n_s_continued_fraction_convergents;
static PyObject *__pyx_n_s_continued_fraction_iterator;
static PyObject *__pyx_n_s_continued_fraction_reduce;
static PyObject *__pyx_n_s_convert_float;
static PyObject *__pyx_n_s_convert_float_base;
static PyObject *__pyx_n_s_convert_float_base_locals_conver;
static PyObject *__pyx_n_s_convert_float_base_locals_conver_2;
static PyObject *__pyx_n_s_convert_int;
static PyObject *__pyx_n_s_convert_int_to_digit_list;
static PyObject *__pyx_n_s_convert_repeating_decimal;
static PyObject *__pyx_n_s_convert_repeating_decimal_locals;
static PyObject *__pyx_n_s_converted_operands;
static PyObject *__pyx_n_s_coords;
static PyObject *__pyx_n_s_coordtransform;
static PyObject *__pyx_n_s_cos;
static PyObject *__pyx_n_u_cos;
static PyObject *__pyx_n_s_crc32;
static PyObject *__pyx_n_s_d;
static PyObject *__pyx_n_s_decompose_domain;
static PyObject *__pyx_n_s_definitions;
static PyObject *__pyx_n_s_delta;
static PyObject *__pyx_n_s_denominator;
static PyObject *__pyx_n_s_digits;
static PyObject *__pyx_n_s_display_len;
static PyObject *__pyx_n_u_divmax;
static PyObject *__pyx_kp_s_dl_dt_Chop_expr_dd_replaces_flo;
static PyObject *__pyx_kp_s_dl_dt_Hash_expr_dd_returns_an_i;
static PyObject *__pyx_kp_s_dl_dt_IntegerDigits_n_dd_return;
static PyObject *__pyx_kp_s_dl_dt_MachineEpsilon_dd_is_the;
static PyObject *__pyx_kp_s_dl_dt_MachinePrecision_dd_is_th;
static PyObject *__pyx_kp_s_dl_dt_MachinePrecision_dd_repre;
static PyObject *__pyx_kp_s_dl_dt_MaxPrecision_dd_represent;
static PyObject *__pyx_kp_s_dl_dt_MinPrecision_dd_represent;
static PyObject *__pyx_kp_s_dl_dt_NIntegrate_expr_interval;
static PyObject *__pyx_kp_s_dl_dt_N_expr_prec_dd_evaluates;
static PyObject *__pyx_kp_s_dl_dt_NumericQ_expr_dd_tests_wh;
static PyObject *__pyx_kp_s_dl_dt_Precision_expr_dd_examine;
static PyObject *__pyx_kp_s_dl_dt_Rationalize_x_dd_converts;
static PyObject *__pyx_kp_s_dl_dt_RealDigits_n_dd_returns_t;
static PyObject *__pyx_kp_s_dl_dt_Round_expr_dd_rounds_expr;
static PyObject *__pyx_n_s_doc;
static PyObject *__pyx_n_s_domain;
static PyObject *__pyx_n_s_dps;
static PyObject *__pyx_n_s_dx;
static PyObject *__pyx_n_s_e;
static PyObject *__pyx_n_u_e;
static PyObject *__pyx_n_s_ensure_evaluation;
static PyObject *__pyx_n_s_enter;
static PyObject *__pyx_n_s_enumerate;
static PyObject *__pyx_n_s_eps;
static PyObject *__pyx_n_u_epsabs;
static PyObject *__pyx_n_s_err;
static PyObject *__pyx_n_s_eval_range;
static PyObject *__pyx_n_s_evaluate;
static PyObject *__pyx_n_s_evaluation;
static PyObject *__pyx_n_s_exit;
static PyObject *__pyx_n_s_exp;
static PyObject *__pyx_n_s_exponents;
static PyObject *__pyx_n_s_expr;
static PyObject *__pyx_n_s_f;
static PyObject *__pyx_n_s_fa;
static PyObject *__pyx_n_s_fb;
static PyObject *__pyx_n_s_ff;
static PyObject *__pyx_n_s_find_approximant;
static PyObject *__pyx_n_s_find_exact;
static PyObject *__pyx_n_s_flm;
static PyObject *__pyx_n_s_floor;
static PyObject *__pyx_n_s_fm;
static PyObject *__pyx_n_s_fn;
static PyObject *__pyx_n_s_fn_2;
static PyObject *__pyx_n_s_fold;
static PyObject *__pyx_n_s_fold_2;
static PyObject *__pyx_n_s_format;
static PyObject *__pyx_n_s_frm;
static PyObject *__pyx_n_s_from_python;
static PyObject *__pyx_n_s_from_sympy;
static PyObject *__pyx_n_s_fubini;
static PyObject *__pyx_n_s_fubini_locals_subintegral;
static PyObject *__pyx_n_s_fubini_locals_subintegral_local;
static PyObject *__pyx_n_u_full_output;
static PyObject *__pyx_n_s_fun;
static PyObject *__pyx_n_s_func;
static PyObject *__pyx_n_s_func2;
static PyObject *__pyx_n_s_functools;
static PyObject *__pyx_n_s_generator;
static PyObject *__pyx_n_s_genexpr;
static PyObject *__pyx_n_s_get;
static PyObject *__pyx_n_s_get_attributes;
static PyObject *__pyx_n_s_get_float_value;
static PyObject *__pyx_n_s_get_head_name;
static PyObject *__pyx_n_s_get_int_value;
static PyObject *__pyx_n_s_get_lookup_name;
static PyObject *__pyx_n_s_get_mutable_leaves;
static PyObject *__pyx_n_s_get_name;
static PyObject *__pyx_n_s_get_option_values;
static PyObject *__pyx_n_s_get_precision;
static PyObject *__pyx_n_s_get_string_value;
static PyObject *__pyx_n_s_get_value;
static PyObject *__pyx_n_s_h;
static PyObject *__pyx_n_s_has_form;
static PyObject *__pyx_n_s_hash_func;
static PyObject *__pyx_n_s_hashlib;
static PyObject *__pyx_n_s_hashtype;
static PyObject *__pyx_n_s_head;
static PyObject *__pyx_n_s_hexdigest;
static PyObject *__pyx_n_s_i;
static PyObject *__pyx_n_u_ibase;
static PyObject *__pyx_n_u_ilim;
static PyObject *__pyx_n_s_imag;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_index;
static PyObject *__pyx_n_s_init;
static PyObject *__pyx_n_s_init_2;
static PyObject *__pyx_n_s_inner_interval;
static PyObject *__pyx_n_u_int;
static PyObject *__pyx_n_s_int_part;
static PyObject *__pyx_n_s_integrand;
static PyObject *__pyx_n_s_integrator;
static PyObject *__pyx_n_u_integrator;
static PyObject *__pyx_n_s_internal_adaptative_simpsons_ru;
static PyObject *__pyx_n_s_internal_adaptative_simpsons_ru_2;
static PyObject *__pyx_n_s_internal_adaptative_simpsons_ru_3;
static PyObject *__pyx_n_s_internal_adaptative_simpsons_ru_4;
static PyObject *__pyx_n_s_interval;
static PyObject *__pyx_n_s_intervals;
static PyObject *__pyx_n_u_intm;
static PyObject *__pyx_n_u_intnm;
static PyObject *__pyx_n_u_intnn;
static PyObject *__pyx_n_s_intvar;
static PyObject *__pyx_n_s_intvars;
static PyObject *__pyx_n_u_inumer;
static PyObject *__pyx_n_u_inumr;
static PyObject *__pyx_n_s_invert_interval;
static PyObject *__pyx_n_s_is_atom;
static PyObject *__pyx_n_s_is_inexact;
static PyObject *__pyx_n_s_is_multidimensional;
static PyObject *__pyx_n_s_is_negative;
static PyObject *__pyx_n_s_is_number;
static PyObject *__pyx_n_s_is_numeric;
static PyObject *__pyx_n_s_is_real;
static PyObject *__pyx_n_s_is_zero;
static PyObject *__pyx_n_s_isinf;
static PyObject *__pyx_n_s_it;
static PyObject *__pyx_n_s_items;
static PyObject *__pyx_n_s_itertools;
static PyObject *__pyx_n_s_j;
static PyObject *__pyx_n_s_k;
static PyObject *__pyx_n_s_kwargs;
static PyObject *__pyx_n_s_le;
static PyObject *__pyx_n_s_leaf;
static PyObject *__pyx_n_s_leaves;
static PyObject *__pyx_n_s_left;
static PyObject *__pyx_n_s_length;
static PyObject *__pyx_n_s_length_of_int;
static PyObject *__pyx_n_u_limit;
static PyObject *__pyx_n_s_list_str;
static PyObject *__pyx_n_s_ll;
static PyObject *__pyx_n_s_lm;
static PyObject *__pyx_n_s_log;
static PyObject *__pyx_n_s_log_n_b;
static PyObject *__pyx_n_s_lru_cache;
static PyObject *__pyx_n_s_m;
static PyObject *__pyx_n_s_machine_epsilon;
static PyObject *__pyx_n_s_machine_precision;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_mandatory;
static PyObject *__pyx_n_s_math;
static PyObject *__pyx_n_s_mathics_builtin_base;
static PyObject *__pyx_n_s_mathics_builtin_numeric;
static PyObject *__pyx_kp_s_mathics_builtin_numeric_py;
static PyObject *__pyx_n_s_mathics_core_convert;
static PyObject *__pyx_n_s_mathics_core_expression;
static PyObject *__pyx_n_s_mathics_core_numbers;
static PyObject *__pyx_n_s_mathics_version;
static PyObject *__pyx_n_s_maxrec;
static PyObject *__pyx_n_u_maxrec;
static PyObject *__pyx_n_s_maxrecursion;
static PyObject *__pyx_n_s_maxsize;
static PyObject *__pyx_n_s_md5;
static PyObject *__pyx_n_s_message;
static PyObject *__pyx_n_s_messages;
static PyObject *__pyx_n_s_metaclass;
static PyObject *__pyx_n_s_method;
static PyObject *__pyx_n_s_method_options;
static PyObject *__pyx_n_s_methods;
static PyObject *__pyx_n_s_min_prec;
static PyObject *__pyx_n_s_mode;
static PyObject *__pyx_n_s_module;
static PyObject *__pyx_n_s_move;
static PyObject *__pyx_n_s_mpmath;
static PyObject *__pyx_n_u_mtdfail;
static PyObject *__pyx_n_s_n;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_n_s_name_2;
static PyObject *__pyx_n_s_namedtuple;
static PyObject *__pyx_n_s_nan;
static PyObject *__pyx_n_s_native_opt;
static PyObject *__pyx_n_s_native_opts;
static PyObject *__pyx_n_u_ndig;
static PyObject *__pyx_n_s_nexpr;
static PyObject *__pyx_n_s_nintegrate_method;
static PyObject *__pyx_n_u_nlim;
static PyObject *__pyx_n_s_np;
static PyObject *__pyx_n_s_nquad;
static PyObject *__pyx_n_s_nr_elements;
static PyObject *__pyx_n_s_ntheory;
static PyObject *__pyx_n_s_nulldomain;
static PyObject *__pyx_n_s_numerator;
static PyObject *__pyx_n_s_numpy;
static PyObject *__pyx_n_s_object;
static PyObject *__pyx_n_s_operand;
static PyObject *__pyx_n_s_operands;
static PyObject *__pyx_n_s_operands_2;
static PyObject *__pyx_n_s_opt;
static PyObject *__pyx_n_s_options;
static PyObject *__pyx_n_s_options_map;
static PyObject *__pyx_n_s_opts;
static PyObject *__pyx_n_s_out;
static PyObject *__pyx_n_s_outformat;
static PyObject *__pyx_n_s_p;
static PyObject *__pyx_n_s_permit_complex;
static PyObject *__pyx_n_s_pos;
static PyObject *__pyx_n_s_pos_len;
static PyObject *__pyx_n_s_prec;
static PyObject *__pyx_n_u_precbd;
static PyObject *__pyx_n_u_preccon;
static PyObject *__pyx_n_s_precision;
static PyObject *__pyx_n_u_preclg;
static PyObject *__pyx_n_u_precset;
static PyObject *__pyx_n_u_precsm;
static PyObject *__pyx_n_s_prepare;
static PyObject *__pyx_n_s_prod;
static PyObject *__pyx_n_s_product;
static PyObject *__pyx_n_s_py_b;
static PyObject *__pyx_n_s_py_dx;
static PyObject *__pyx_n_s_py_format;
static PyObject *__pyx_n_s_py_hashtype;
static PyObject *__pyx_n_s_py_n;
static PyObject *__pyx_n_s_py_x;
static PyObject *__pyx_n_s_q;
static PyObject *__pyx_n_s_quad;
static PyObject *__pyx_n_s_quad_asr;
static PyObject *__pyx_n_s_quad_simpsons_mem;
static PyObject *__pyx_n_s_qualname;
static PyObject *__pyx_n_s_r;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_ranges;
static PyObject *__pyx_n_s_rational_no;
static PyObject *__pyx_n_u_rbase;
static PyObject *__pyx_n_s_real;
static PyObject *__pyx_n_s_real_part;
static PyObject *__pyx_n_u_realx;
static PyObject *__pyx_n_s_res;
static PyObject *__pyx_n_s_result;
static PyObject *__pyx_n_s_result_digit;
static PyObject *__pyx_n_s_results;
static PyObject *__pyx_n_s_return;
static PyObject *__pyx_n_s_right;
static PyObject *__pyx_n_s_rm;
static PyObject *__pyx_n_s_romberg;
static PyObject *__pyx_n_s_round;
static PyObject *__pyx_n_s_round_to_float;
static PyObject *__pyx_n_s_rules;
static PyObject *__pyx_n_s_s_operands;
static PyObject *__pyx_n_s_sameQ;
static PyObject *__pyx_n_s_scipy_integrate;
static PyObject *__pyx_n_s_scipy_interface;
static PyObject *__pyx_n_s_scipy_interface_locals__scipy_p;
static PyObject *__pyx_n_s_scipy_interface_locals__scipy_p_2;
static PyObject *__pyx_n_s_scipy_proxy_func;
static PyObject *__pyx_n_s_scipy_proxy_func_filter;
static PyObject *__pyx_n_s_self;
static PyObject *__pyx_n_s_send;
static PyObject *__pyx_n_s_sha1;
static PyObject *__pyx_n_s_sha224;
static PyObject *__pyx_n_s_sha256;
static PyObject *__pyx_n_s_sha384;
static PyObject *__pyx_n_s_sha512;
static PyObject *__pyx_n_s_sin;
static PyObject *__pyx_n_u_sin;
static PyObject *__pyx_n_s_spans;
static PyObject *__pyx_n_s_spans_2;
static PyObject *__pyx_n_s_startswith;
static PyObject *__pyx_n_s_state;
static PyObject *__pyx_n_s_staticmethod;
static PyObject *__pyx_n_s_steps;
static PyObject *__pyx_n_s_subdomain;
static PyObject *__pyx_n_s_subdomain2;
static PyObject *__pyx_n_s_subintegral;
static PyObject *__pyx_n_s_subresults;
static PyObject *__pyx_n_s_sum;
static PyObject *__pyx_n_s_super;
static PyObject *__pyx_n_s_supported_hashes;
static PyObject *__pyx_n_s_sym_x;
static PyObject *__pyx_n_s_sympy;
static PyObject *__pyx_n_s_t;
static PyObject *__pyx_n_s_tails;
static PyObject *__pyx_n_s_temp;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_test_2;
static PyObject *__pyx_n_s_throw;
static PyObject *__pyx_n_s_to_mpmath;
static PyObject *__pyx_n_s_to_python;
static PyObject *__pyx_n_s_to_sympy;
static PyObject *__pyx_n_s_tol;
static PyObject *__pyx_n_u_tol;
static PyObject *__pyx_n_s_tolerance;
static PyObject *__pyx_n_u_tolnn;
static PyObject *__pyx_n_s_u;
static PyObject *__pyx_n_s_update;
static PyObject *__pyx_n_s_user_hash;
static PyObject *__pyx_n_s_val;
static PyObject *__pyx_n_s_value;
static PyObject *__pyx_n_s_var;
static PyObject *__pyx_n_s_version;
static PyObject *__pyx_n_s_whole;
static PyObject *__pyx_n_s_working_precision;
static PyObject *__pyx_n_s_workprec;
static PyObject *__pyx_n_s_wsr;
static PyObject *__pyx_n_s_x;
static PyObject *__pyx_n_u_x;
static PyObject *__pyx_n_s_xmax;
static PyObject *__pyx_n_s_xmin;
static PyObject *__pyx_n_s_y;
static PyObject *__pyx_n_s_z;
static PyObject *__pyx_n_s_zlib;
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_log_n_b(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_py_n, PyObject *__pyx_v_py_b); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_1N_apply_with_prec(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_expr, PyObject *__pyx_v_prec, PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_16_scipy_interface__scipy_proxy_func_filter(PyObject *__pyx_self, PyObject *__pyx_v_fun, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_opts); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_16_scipy_interface_2_scipy_proxy_func(PyObject *__pyx_self, PyObject *__pyx_v_fun, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_opts); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_2_scipy_interface(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_integrator, PyObject *__pyx_v_options_map, PyObject *__pyx_v_mandatory, PyObject *__pyx_v_adapt_func); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_34_internal_adaptative_simpsons_rule__quad_simpsons_mem(PyObject *__pyx_self, PyObject *__pyx_v_f, PyObject *__pyx_v_a, PyObject *__pyx_v_fa, PyObject *__pyx_v_b, PyObject *__pyx_v_fb); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_34_internal_adaptative_simpsons_rule_2_quad_asr(PyObject *__pyx_self, PyObject *__pyx_v_f, PyObject *__pyx_v_a, PyObject *__pyx_v_fa, PyObject *__pyx_v_b, PyObject *__pyx_v_fb, PyObject *__pyx_v_eps, PyObject *__pyx_v_whole, PyObject *__pyx_v_m, PyObject *__pyx_v_fm, PyObject *__pyx_v_maxrec); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_34_internal_adaptative_simpsons_rule_4ensure_evaluation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_f, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_4_internal_adaptative_simpsons_rule(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_f, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_opts); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_7_fubini_11subintegral_ff(PyObject *__pyx_self, PyObject *__pyx_v_z); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_7_fubini_subintegral(PyObject *__pyx_self, PyObject *__pyx_v_u); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_6_fubini(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_func, PyObject *__pyx_v_ranges, PyObject *__pyx_v_opts); /* proto */
static PyObject *__pyx_lambda_funcdef_lambda(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_res); /* proto */
static PyObject *__pyx_lambda_funcdef_lambda1(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_maxrec); /* proto */
static PyObject *__pyx_lambda_funcdef_lambda2(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_res); /* proto */
static PyObject *__pyx_lambda_funcdef_lambda3(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_10NIntegrate___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_10NIntegrate_2decompose_domain(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_interval, PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_lambda_funcdef_lambda4(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_u); /* proto */
static PyObject *__pyx_lambda_funcdef_lambda5(PyObject *__pyx_self, PyObject *__pyx_v_u); /* proto */
static PyObject *__pyx_lambda_funcdef_lambda6(PyObject *__pyx_self, PyObject *__pyx_v_u); /* proto */
static PyObject *__pyx_lambda_funcdef_lambda7(PyObject *__pyx_self, PyObject *__pyx_v_u); /* proto */
static PyObject *__pyx_lambda_funcdef_lambda8(PyObject *__pyx_self, PyObject *__pyx_v_u); /* proto */
static PyObject *__pyx_lambda_funcdef_lambda9(PyObject *__pyx_self, PyObject *__pyx_v_u); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_10NIntegrate_4apply_with_func_domain(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_func, PyObject *__pyx_v_domain, PyObject *__pyx_v_evaluation, PyObject *__pyx_v_options); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_15MachineEpsilon__evaluate(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_9Precision_apply(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_z, CYTHON_UNUSED PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_5Round_apply(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_expr, PyObject *__pyx_v_k, PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_11Rationalize_apply(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_11Rationalize_2find_approximant(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_11Rationalize_4find_exact(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_11Rationalize_6apply_dx(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_dx, PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_11Rationalize_8approx_interval_continued_fraction(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_xmin, PyObject *__pyx_v_xmax); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_16__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_8chop(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_expr, PyObject *__pyx_v_delta); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_4Chop_apply(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_expr, PyObject *__pyx_v_delta, PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_8NumericQ_5apply_4test_genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_8NumericQ_5apply_test(PyObject *__pyx_self, PyObject *__pyx_v_expr); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_8NumericQ_apply(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_expr, PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_13IntegerDigits_apply_len(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_n, PyObject *__pyx_v_base, PyObject *__pyx_v_length, PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_13IntegerDigits_2apply(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_n, PyObject *__pyx_v_base, PyObject *__pyx_v_evaluation, PyObject *__pyx_v_nr_elements); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_10check_finite_decimal(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_denominator); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_25convert_repeating_decimal_genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_12convert_repeating_decimal(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_numerator, PyObject *__pyx_v_denominator, PyObject *__pyx_v_base); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_18convert_float_base_convert_int(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_base, PyObject *__pyx_v_exponents); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_18convert_float_base_2convert_float(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_base, PyObject *__pyx_v_exponents); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_14convert_float_base(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_base, PyObject *__pyx_v_precision); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_10RealDigits_apply_complex(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_n, CYTHON_UNUSED PyObject *__pyx_v_var, PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_10RealDigits_2apply_rational_with_base(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_n, PyObject *__pyx_v_b, PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_10RealDigits_4apply_rational_without_base(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_n, PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_10RealDigits_6apply(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_n, PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_10RealDigits_8apply_with_base(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_n, PyObject *__pyx_v_b, PyObject *__pyx_v_evaluation, PyObject *__pyx_v_nr_elements, PyObject *__pyx_v_pos); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_10RealDigits_10apply_with_base_and_length(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_n, PyObject *__pyx_v_b, PyObject *__pyx_v_length, PyObject *__pyx_v_evaluation, PyObject *__pyx_v_pos); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_10RealDigits_12apply_with_base_length_and_precision(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_n, PyObject *__pyx_v_b, PyObject *__pyx_v_length, PyObject *__pyx_v_p, PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_9_ZLibHash___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_fn); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_9_ZLibHash_2update(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_bytes); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_9_ZLibHash_4hexdigest(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_lambda_funcdef_7mathics_7builtin_7numeric_4Hash_lambda12(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_lambda_funcdef_7mathics_7builtin_7numeric_4Hash_lambda13(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_4Hash_compute(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_user_hash, PyObject *__pyx_v_py_hashtype, PyObject *__pyx_v_py_format); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_4Hash_2apply(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_expr, PyObject *__pyx_v_hashtype, PyObject *__pyx_v_outformat, CYTHON_UNUSED PyObject *__pyx_v_evaluation); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_14TypeEscalation___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_mode); /* proto */
static PyObject *__pyx_lambda_funcdef_7mathics_7builtin_7numeric_4Fold_lambda14(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_lambda_funcdef_7mathics_7builtin_7numeric_4Fold_lambda15(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_lambda_funcdef_7mathics_7builtin_7numeric_4Fold_lambda16(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_lambda_funcdef_7mathics_7builtin_7numeric_4Fold_lambda17(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_lambda_funcdef_7mathics_7builtin_7numeric_4Fold_lambda18(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_4Fold__operands(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_state, CYTHON_UNUSED PyObject *__pyx_v_steps); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_4Fold_2_fold(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_state, CYTHON_UNUSED PyObject *__pyx_v_steps, CYTHON_UNUSED PyObject *__pyx_v_math); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_4Fold_4_spans(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_operands); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_4Fold_4fold_12genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_4Fold_4fold_15genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_4Fold_4fold_18genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_4Fold_6fold(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_ll); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_4Fold_4fold_working_precision(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v__); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_4Fold_4fold_3out(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_z); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_4Fold_4fold_5out(PyObject *__pyx_self, PyObject *__pyx_v_z); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_4Fold_4fold_7out(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_z); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_4Fold_4fold_18converted_operands_genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7mathics_7builtin_7numeric_4Fold_4fold_9converted_operands(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_6_test(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_get = {0, &__pyx_n_s_get, 0, 0, 0};
static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_update = {0, &__pyx_n_s_update, 0, 0, 0};
static PyObject *__pyx_float_0_0;
static PyObject *__pyx_float_0_5;
static PyObject *__pyx_float_1_0;
static PyObject *__pyx_float_4_0;
static PyObject *__pyx_float_10_0;
static PyObject *__pyx_float_1eneg_10;
static PyObject *__pyx_float_1_0eneg_10;
static PyObject *__pyx_float_neg_2_0;
static PyObject *__pyx_float_neg_10_0;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_3;
static PyObject *__pyx_int_5;
static PyObject *__pyx_int_10;
static PyObject *__pyx_int_15;
static PyObject *__pyx_int_16;
static PyObject *__pyx_int_150;
static PyObject *__pyx_int_1024;
static PyObject *__pyx_tuple_;
static PyObject *__pyx_tuple__3;
static PyObject *__pyx_tuple__4;
static PyObject *__pyx_tuple__6;
static PyObject *__pyx_tuple__8;
static PyObject *__pyx_slice__16;
static PyObject *__pyx_tuple__10;
static PyObject *__pyx_tuple__12;
static PyObject *__pyx_tuple__14;
static PyObject *__pyx_tuple__17;
static PyObject *__pyx_tuple__19;
static PyObject *__pyx_tuple__20;
static PyObject *__pyx_tuple__21;
static PyObject *__pyx_tuple__23;
static PyObject *__pyx_tuple__24;
static PyObject *__pyx_tuple__25;
static PyObject *__pyx_tuple__26;
static PyObject *__pyx_tuple__27;
static PyObject *__pyx_tuple__28;
static PyObject *__pyx_tuple__29;
static PyObject *__pyx_tuple__31;
static PyObject *__pyx_tuple__32;
static PyObject *__pyx_tuple__34;
static PyObject *__pyx_tuple__39;
static PyObject *__pyx_tuple__41;
static PyObject *__pyx_tuple__43;
static PyObject *__pyx_tuple__45;
static PyObject *__pyx_tuple__47;
static PyObject *__pyx_tuple__49;
static PyObject *__pyx_tuple__50;
static PyObject *__pyx_tuple__52;
static PyObject *__pyx_tuple__54;
static PyObject *__pyx_tuple__56;
static PyObject *__pyx_tuple__57;
static PyObject *__pyx_tuple__59;
static PyObject *__pyx_tuple__61;
static PyObject *__pyx_tuple__62;
static PyObject *__pyx_tuple__64;
static PyObject *__pyx_tuple__66;
static PyObject *__pyx_tuple__68;
static PyObject *__pyx_tuple__70;
static PyObject *__pyx_tuple__72;
static PyObject *__pyx_tuple__73;
static PyObject *__pyx_tuple__75;
static PyObject *__pyx_tuple__77;
static PyObject *__pyx_tuple__79;
static PyObject *__pyx_tuple__81;
static PyObject *__pyx_tuple__83;
static PyObject *__pyx_tuple__85;
static PyObject *__pyx_tuple__87;
static PyObject *__pyx_tuple__89;
static PyObject *__pyx_tuple__91;
static PyObject *__pyx_tuple__92;
static PyObject *__pyx_tuple__94;
static PyObject *__pyx_tuple__96;
static PyObject *__pyx_tuple__97;
static PyObject *__pyx_tuple__99;
static PyObject *__pyx_codeobj__5;
static PyObject *__pyx_codeobj__7;
static PyObject *__pyx_codeobj__9;
static PyObject *__pyx_tuple__101;
static PyObject *__pyx_tuple__103;
static PyObject *__pyx_tuple__104;
static PyObject *__pyx_tuple__106;
static PyObject *__pyx_tuple__108;
static PyObject *__pyx_tuple__110;
static PyObject *__pyx_tuple__112;
static PyObject *__pyx_tuple__114;
static PyObject *__pyx_tuple__115;
static PyObject *__pyx_tuple__117;
static PyObject *__pyx_tuple__118;
static PyObject *__pyx_tuple__120;
static PyObject *__pyx_tuple__122;
static PyObject *__pyx_tuple__124;
static PyObject *__pyx_tuple__126;
static PyObject *__pyx_tuple__127;
static PyObject *__pyx_tuple__129;
static PyObject *__pyx_tuple__131;
static PyObject *__pyx_tuple__133;
static PyObject *__pyx_tuple__134;
static PyObject *__pyx_tuple__135;
static PyObject *__pyx_tuple__136;
static PyObject *__pyx_tuple__138;
static PyObject *__pyx_tuple__140;
static PyObject *__pyx_tuple__142;
static PyObject *__pyx_codeobj__11;
static PyObject *__pyx_codeobj__13;
static PyObject *__pyx_codeobj__15;
static PyObject *__pyx_codeobj__18;
static PyObject *__pyx_codeobj__30;
static PyObject *__pyx_codeobj__33;
static PyObject *__pyx_codeobj__35;
static PyObject *__pyx_codeobj__37;
static PyObject *__pyx_codeobj__40;
static PyObject *__pyx_codeobj__42;
static PyObject *__pyx_codeobj__44;
static PyObject *__pyx_codeobj__46;
static PyObject *__pyx_codeobj__48;
static PyObject *__pyx_codeobj__51;
static PyObject *__pyx_codeobj__53;
static PyObject *__pyx_codeobj__55;
static PyObject *__pyx_codeobj__58;
static PyObject *__pyx_codeobj__60;
static PyObject *__pyx_codeobj__63;
static PyObject *__pyx_codeobj__65;
static PyObject *__pyx_codeobj__67;
static PyObject *__pyx_codeobj__69;
static PyObject *__pyx_codeobj__71;
static PyObject *__pyx_codeobj__74;
static PyObject *__pyx_codeobj__76;
static PyObject *__pyx_codeobj__78;
static PyObject *__pyx_codeobj__80;
static PyObject *__pyx_codeobj__82;
static PyObject *__pyx_codeobj__84;
static PyObject *__pyx_codeobj__86;
static PyObject *__pyx_codeobj__88;
static PyObject *__pyx_codeobj__90;
static PyObject *__pyx_codeobj__93;
static PyObject *__pyx_codeobj__95;
static PyObject *__pyx_codeobj__98;
static PyObject *__pyx_codeobj__100;
static PyObject *__pyx_codeobj__102;
static PyObject *__pyx_codeobj__105;
static PyObject *__pyx_codeobj__107;
static PyObject *__pyx_codeobj__109;
static PyObject *__pyx_codeobj__111;
static PyObject *__pyx_codeobj__113;
static PyObject *__pyx_codeobj__116;
static PyObject *__pyx_codeobj__119;
static PyObject *__pyx_codeobj__121;
static PyObject *__pyx_codeobj__123;
static PyObject *__pyx_codeobj__125;
static PyObject *__pyx_codeobj__128;
static PyObject *__pyx_codeobj__130;
static PyObject *__pyx_codeobj__132;
static PyObject *__pyx_codeobj__137;
static PyObject *__pyx_codeobj__139;
static PyObject *__pyx_codeobj__141;
/* Late includes */

/* "mathics/builtin/numeric.py":58
 * 
 * @lru_cache(maxsize=1024)
 * def log_n_b(py_n, py_b) -> int:             # <<<<<<<<<<<<<<
 *     return int(mpmath.ceil(mpmath.log(py_n, py_b))) if py_n != 0 and py_n != 1 else 1
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_1log_n_b(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_1log_n_b = {"log_n_b", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_1log_n_b, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_1log_n_b(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_py_n = 0;
  PyObject *__pyx_v_py_b = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("log_n_b (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_py_n,&__pyx_n_s_py_b,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_py_n)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_py_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("log_n_b", 1, 2, 2, 1); __PYX_ERR(0, 58, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "log_n_b") < 0)) __PYX_ERR(0, 58, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_py_n = values[0];
    __pyx_v_py_b = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("log_n_b", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 58, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.log_n_b", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_log_n_b(__pyx_self, __pyx_v_py_n, __pyx_v_py_b);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_log_n_b(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_py_n, PyObject *__pyx_v_py_b) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("log_n_b", 0);

  /* "mathics/builtin/numeric.py":59
 * @lru_cache(maxsize=1024)
 * def log_n_b(py_n, py_b) -> int:
 *     return int(mpmath.ceil(mpmath.log(py_n, py_b))) if py_n != 0 and py_n != 1 else 1             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_NeObjC(__pyx_v_py_n, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 59, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_PyInt_NeObjC(__pyx_v_py_n, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 59, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_2 = __pyx_t_4;
  __pyx_L3_bool_binop_done:;
  if (__pyx_t_2) {
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_mpmath); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 59, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ceil); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 59, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_mpmath); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 59, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_log); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 59, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_8)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_py_n, __pyx_v_py_b};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 59, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_py_n, __pyx_v_py_b};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 59, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    {
      __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 59, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_INCREF(__pyx_v_py_n);
      __Pyx_GIVEREF(__pyx_v_py_n);
      PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_v_py_n);
      __Pyx_INCREF(__pyx_v_py_b);
      __Pyx_GIVEREF(__pyx_v_py_b);
      PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_v_py_b);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_10, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 59, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_3 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_8, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 59, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyNumber_Int(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 59, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_1 = __pyx_t_6;
    __pyx_t_6 = 0;
  } else {
    __Pyx_INCREF(__pyx_int_1);
    __pyx_t_1 = __pyx_int_1;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/builtin/numeric.py":58
 * 
 * @lru_cache(maxsize=1024)
 * def log_n_b(py_n, py_b) -> int:             # <<<<<<<<<<<<<<
 *     return int(mpmath.ceil(mpmath.log(py_n, py_b))) if py_n != 0 and py_n != 1 else 1
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("mathics.builtin.numeric.log_n_b", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":180
 *     }
 * 
 *     def apply_with_prec(self, expr, prec, evaluation):             # <<<<<<<<<<<<<<
 *         "N[expr_, prec_]"
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_1N_1apply_with_prec(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_7builtin_7numeric_1N_apply_with_prec[] = "N[expr_, prec_]";
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_1N_1apply_with_prec = {"apply_with_prec", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_1N_1apply_with_prec, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_7builtin_7numeric_1N_apply_with_prec};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_1N_1apply_with_prec(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_expr = 0;
  PyObject *__pyx_v_prec = 0;
  PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("apply_with_prec (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_expr,&__pyx_n_s_prec,&__pyx_n_s_evaluation,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_expr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_with_prec", 1, 4, 4, 1); __PYX_ERR(0, 180, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_prec)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_with_prec", 1, 4, 4, 2); __PYX_ERR(0, 180, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_with_prec", 1, 4, 4, 3); __PYX_ERR(0, 180, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply_with_prec") < 0)) __PYX_ERR(0, 180, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_self = values[0];
    __pyx_v_expr = values[1];
    __pyx_v_prec = values[2];
    __pyx_v_evaluation = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("apply_with_prec", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 180, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.N.apply_with_prec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_1N_apply_with_prec(__pyx_self, __pyx_v_self, __pyx_v_expr, __pyx_v_prec, __pyx_v_evaluation);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_1N_apply_with_prec(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_expr, PyObject *__pyx_v_prec, PyObject *__pyx_v_evaluation) {
  PyObject *__pyx_v_d = NULL;
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_v_nexpr = NULL;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_v_attributes = NULL;
  PyObject *__pyx_v_eval_range = NULL;
  PyObject *__pyx_v_head = NULL;
  PyObject *__pyx_v_leaves = NULL;
  PyObject *__pyx_v_index = NULL;
  PyObject *__pyx_7genexpr__pyx_v_leaf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  Py_ssize_t __pyx_t_12;
  PyObject *(*__pyx_t_13)(PyObject *);
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("apply_with_prec", 0);

  /* "mathics/builtin/numeric.py":183
 *         "N[expr_, prec_]"
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             d = get_precision(prec, evaluation)
 *         except PrecisionValueError:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "mathics/builtin/numeric.py":184
 * 
 *         try:
 *             d = get_precision(prec, evaluation)             # <<<<<<<<<<<<<<
 *         except PrecisionValueError:
 *             return
 */
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_get_precision); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 184, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_7 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_prec, __pyx_v_evaluation};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 184, __pyx_L3_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_prec, __pyx_v_evaluation};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 184, __pyx_L3_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 184, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_8);
        if (__pyx_t_6) {
          __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
        }
        __Pyx_INCREF(__pyx_v_prec);
        __Pyx_GIVEREF(__pyx_v_prec);
        PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_prec);
        __Pyx_INCREF(__pyx_v_evaluation);
        __Pyx_GIVEREF(__pyx_v_evaluation);
        PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_evaluation);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 184, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_d = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "mathics/builtin/numeric.py":183
 *         "N[expr_, prec_]"
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             d = get_precision(prec, evaluation)
 *         except PrecisionValueError:
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "mathics/builtin/numeric.py":185
 *         try:
 *             d = get_precision(prec, evaluation)
 *         except PrecisionValueError:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
    __Pyx_ErrFetch(&__pyx_t_4, &__pyx_t_5, &__pyx_t_8);
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_PrecisionValueError); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 185, __pyx_L5_except_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_4, __pyx_t_6);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_ErrRestore(__pyx_t_4, __pyx_t_5, __pyx_t_8);
    __pyx_t_4 = 0; __pyx_t_5 = 0; __pyx_t_8 = 0;
    if (__pyx_t_7) {
      __Pyx_AddTraceback("mathics.builtin.numeric.N.apply_with_prec", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_5, &__pyx_t_4) < 0) __PYX_ERR(0, 185, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_4);

      /* "mathics/builtin/numeric.py":186
 *             d = get_precision(prec, evaluation)
 *         except PrecisionValueError:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         if expr.get_head_name() in ("System`List", "System`Rule"):
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "mathics/builtin/numeric.py":183
 *         "N[expr_, prec_]"
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             d = get_precision(prec, evaluation)
 *         except PrecisionValueError:
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L8_try_end:;
  }

  /* "mathics/builtin/numeric.py":188
 *             return
 * 
 *         if expr.get_head_name() in ("System`List", "System`Rule"):             # <<<<<<<<<<<<<<
 *             return Expression(
 *                 expr.head,
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_get_head_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 188, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_4 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 188, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_10 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_kp_u_System_List, Py_EQ)); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 188, __pyx_L1_error)
  if (!__pyx_t_10) {
  } else {
    __pyx_t_9 = __pyx_t_10;
    goto __pyx_L12_bool_binop_done;
  }
  __pyx_t_10 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_kp_u_System_Rule, Py_EQ)); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 188, __pyx_L1_error)
  __pyx_t_9 = __pyx_t_10;
  __pyx_L12_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_10 = (__pyx_t_9 != 0);
  if (__pyx_t_10) {

    /* "mathics/builtin/numeric.py":189
 * 
 *         if expr.get_head_name() in ("System`List", "System`Rule"):
 *             return Expression(             # <<<<<<<<<<<<<<
 *                 expr.head,
 *                 *[self.apply_with_prec(leaf, prec, evaluation) for leaf in expr.leaves],
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Expression); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 189, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "mathics/builtin/numeric.py":190
 *         if expr.get_head_name() in ("System`List", "System`Rule"):
 *             return Expression(
 *                 expr.head,             # <<<<<<<<<<<<<<
 *                 *[self.apply_with_prec(leaf, prec, evaluation) for leaf in expr.leaves],
 *             )
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_head); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 190, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);

    /* "mathics/builtin/numeric.py":189
 * 
 *         if expr.get_head_name() in ("System`List", "System`Rule"):
 *             return Expression(             # <<<<<<<<<<<<<<
 *                 expr.head,
 *                 *[self.apply_with_prec(leaf, prec, evaluation) for leaf in expr.leaves],
 */
    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 189, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5);
    __pyx_t_5 = 0;
    { /* enter inner scope */

      /* "mathics/builtin/numeric.py":191
 *             return Expression(
 *                 expr.head,
 *                 *[self.apply_with_prec(leaf, prec, evaluation) for leaf in expr.leaves],             # <<<<<<<<<<<<<<
 *             )
 * 
 */
      __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 191, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_leaves); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 191, __pyx_L16_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) {
        __pyx_t_11 = __pyx_t_6; __Pyx_INCREF(__pyx_t_11); __pyx_t_12 = 0;
        __pyx_t_13 = NULL;
      } else {
        __pyx_t_12 = -1; __pyx_t_11 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 191, __pyx_L16_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_13 = Py_TYPE(__pyx_t_11)->tp_iternext; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 191, __pyx_L16_error)
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      for (;;) {
        if (likely(!__pyx_t_13)) {
          if (likely(PyList_CheckExact(__pyx_t_11))) {
            if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_11)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_6 = PyList_GET_ITEM(__pyx_t_11, __pyx_t_12); __Pyx_INCREF(__pyx_t_6); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 191, __pyx_L16_error)
            #else
            __pyx_t_6 = PySequence_ITEM(__pyx_t_11, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 191, __pyx_L16_error)
            __Pyx_GOTREF(__pyx_t_6);
            #endif
          } else {
            if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_11)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_11, __pyx_t_12); __Pyx_INCREF(__pyx_t_6); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 191, __pyx_L16_error)
            #else
            __pyx_t_6 = PySequence_ITEM(__pyx_t_11, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 191, __pyx_L16_error)
            __Pyx_GOTREF(__pyx_t_6);
            #endif
          }
        } else {
          __pyx_t_6 = __pyx_t_13(__pyx_t_11);
          if (unlikely(!__pyx_t_6)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 191, __pyx_L16_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_6);
        }
        __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_leaf, __pyx_t_6);
        __pyx_t_6 = 0;
        __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apply_with_prec); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 191, __pyx_L16_error)
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_15 = NULL;
        __pyx_t_7 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) {
          __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14);
          if (likely(__pyx_t_15)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
            __Pyx_INCREF(__pyx_t_15);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_14, function);
            __pyx_t_7 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_14)) {
          PyObject *__pyx_temp[4] = {__pyx_t_15, __pyx_7genexpr__pyx_v_leaf, __pyx_v_prec, __pyx_v_evaluation};
          __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 191, __pyx_L16_error)
          __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
          __Pyx_GOTREF(__pyx_t_6);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
          PyObject *__pyx_temp[4] = {__pyx_t_15, __pyx_7genexpr__pyx_v_leaf, __pyx_v_prec, __pyx_v_evaluation};
          __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 191, __pyx_L16_error)
          __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
          __Pyx_GOTREF(__pyx_t_6);
        } else
        #endif
        {
          __pyx_t_16 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 191, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_16);
          if (__pyx_t_15) {
            __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_15); __pyx_t_15 = NULL;
          }
          __Pyx_INCREF(__pyx_7genexpr__pyx_v_leaf);
          __Pyx_GIVEREF(__pyx_7genexpr__pyx_v_leaf);
          PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_7, __pyx_7genexpr__pyx_v_leaf);
          __Pyx_INCREF(__pyx_v_prec);
          __Pyx_GIVEREF(__pyx_v_prec);
          PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_7, __pyx_v_prec);
          __Pyx_INCREF(__pyx_v_evaluation);
          __Pyx_GIVEREF(__pyx_v_evaluation);
          PyTuple_SET_ITEM(__pyx_t_16, 2+__pyx_t_7, __pyx_v_evaluation);
          __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_16, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 191, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        }
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 191, __pyx_L16_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_7genexpr__pyx_v_leaf); __pyx_7genexpr__pyx_v_leaf = 0;
      goto __pyx_L19_exit_scope;
      __pyx_L16_error:;
      __Pyx_XDECREF(__pyx_7genexpr__pyx_v_leaf); __pyx_7genexpr__pyx_v_leaf = 0;
      goto __pyx_L1_error;
      __pyx_L19_exit_scope:;
    } /* exit inner scope */

    /* "mathics/builtin/numeric.py":189
 * 
 *         if expr.get_head_name() in ("System`List", "System`Rule"):
 *             return Expression(             # <<<<<<<<<<<<<<
 *                 expr.head,
 *                 *[self.apply_with_prec(leaf, prec, evaluation) for leaf in expr.leaves],
 */
    __pyx_t_11 = PySequence_Tuple(__pyx_t_5); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 189, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Add(__pyx_t_8, __pyx_t_11); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 189, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 189, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_11;
    __pyx_t_11 = 0;
    goto __pyx_L0;

    /* "mathics/builtin/numeric.py":188
 *             return
 * 
 *         if expr.get_head_name() in ("System`List", "System`Rule"):             # <<<<<<<<<<<<<<
 *             return Expression(
 *                 expr.head,
 */
  }

  /* "mathics/builtin/numeric.py":195
 * 
 *         # Special case for the Root builtin
 *         if expr.has_form("Root", 2):             # <<<<<<<<<<<<<<
 *             return from_sympy(sympy.N(expr.to_sympy(), d))
 * 
 */
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_has_form); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 195, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_10) {

    /* "mathics/builtin/numeric.py":196
 *         # Special case for the Root builtin
 *         if expr.has_form("Root", 2):
 *             return from_sympy(sympy.N(expr.to_sympy(), d))             # <<<<<<<<<<<<<<
 * 
 *         if isinstance(expr, Number):
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_from_sympy); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 196, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_sympy); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 196, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_N); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 196, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_to_sympy); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 196, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_16 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) {
      __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_14);
      if (likely(__pyx_t_16)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
        __Pyx_INCREF(__pyx_t_16);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_14, function);
      }
    }
    __pyx_t_8 = (__pyx_t_16) ? __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_16) : __Pyx_PyObject_CallNoArg(__pyx_t_14);
    __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
    if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 196, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_14)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_14);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[3] = {__pyx_t_14, __pyx_t_8, __pyx_v_d};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 196, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[3] = {__pyx_t_14, __pyx_t_8, __pyx_v_d};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 196, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    {
      __pyx_t_16 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 196, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      if (__pyx_t_14) {
        __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_14); __pyx_t_14 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_7, __pyx_t_8);
      __Pyx_INCREF(__pyx_v_d);
      __Pyx_GIVEREF(__pyx_v_d);
      PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_7, __pyx_v_d);
      __pyx_t_8 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_16, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 196, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_11);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_11, function);
      }
    }
    __pyx_t_5 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_6, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 196, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "mathics/builtin/numeric.py":195
 * 
 *         # Special case for the Root builtin
 *         if expr.has_form("Root", 2):             # <<<<<<<<<<<<<<
 *             return from_sympy(sympy.N(expr.to_sympy(), d))
 * 
 */
  }

  /* "mathics/builtin/numeric.py":198
 *             return from_sympy(sympy.N(expr.to_sympy(), d))
 * 
 *         if isinstance(expr, Number):             # <<<<<<<<<<<<<<
 *             return expr.round(d)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_Number); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_10 = PyObject_IsInstance(__pyx_v_expr, __pyx_t_5); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 198, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_9 = (__pyx_t_10 != 0);
  if (__pyx_t_9) {

    /* "mathics/builtin/numeric.py":199
 * 
 *         if isinstance(expr, Number):
 *             return expr.round(d)             # <<<<<<<<<<<<<<
 * 
 *         name = expr.get_lookup_name()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_round); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 199, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_11);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_11, function);
      }
    }
    __pyx_t_5 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_4, __pyx_v_d) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_v_d);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 199, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "mathics/builtin/numeric.py":198
 *             return from_sympy(sympy.N(expr.to_sympy(), d))
 * 
 *         if isinstance(expr, Number):             # <<<<<<<<<<<<<<
 *             return expr.round(d)
 * 
 */
  }

  /* "mathics/builtin/numeric.py":201
 *             return expr.round(d)
 * 
 *         name = expr.get_lookup_name()             # <<<<<<<<<<<<<<
 *         if name != "":
 *             nexpr = Expression(SymbolN, expr, prec)
 */
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_get_lookup_name); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_11);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_11, function);
    }
  }
  __pyx_t_5 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_v_name = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "mathics/builtin/numeric.py":202
 * 
 *         name = expr.get_lookup_name()
 *         if name != "":             # <<<<<<<<<<<<<<
 *             nexpr = Expression(SymbolN, expr, prec)
 *             result = evaluation.definitions.get_value(
 */
  __pyx_t_9 = (__Pyx_PyUnicode_Equals(__pyx_v_name, __pyx_kp_u__2, Py_NE)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 202, __pyx_L1_error)
  if (__pyx_t_9) {

    /* "mathics/builtin/numeric.py":203
 *         name = expr.get_lookup_name()
 *         if name != "":
 *             nexpr = Expression(SymbolN, expr, prec)             # <<<<<<<<<<<<<<
 *             result = evaluation.definitions.get_value(
 *                 name, "System`NValues", nexpr, evaluation
 */
    __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_Expression); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 203, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_SymbolN); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 203, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_11);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_11, function);
        __pyx_t_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_11)) {
      PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_4, __pyx_v_expr, __pyx_v_prec};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 203, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
      PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_4, __pyx_v_expr, __pyx_v_prec};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 203, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_16 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 203, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      if (__pyx_t_6) {
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_7, __pyx_t_4);
      __Pyx_INCREF(__pyx_v_expr);
      __Pyx_GIVEREF(__pyx_v_expr);
      PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_7, __pyx_v_expr);
      __Pyx_INCREF(__pyx_v_prec);
      __Pyx_GIVEREF(__pyx_v_prec);
      PyTuple_SET_ITEM(__pyx_t_16, 2+__pyx_t_7, __pyx_v_prec);
      __pyx_t_4 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_16, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 203, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    }
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_v_nexpr = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "mathics/builtin/numeric.py":204
 *         if name != "":
 *             nexpr = Expression(SymbolN, expr, prec)
 *             result = evaluation.definitions.get_value(             # <<<<<<<<<<<<<<
 *                 name, "System`NValues", nexpr, evaluation
 *             )
 */
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_definitions); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 204, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_get_value); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 204, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

    /* "mathics/builtin/numeric.py":205
 *             nexpr = Expression(SymbolN, expr, prec)
 *             result = evaluation.definitions.get_value(
 *                 name, "System`NValues", nexpr, evaluation             # <<<<<<<<<<<<<<
 *             )
 *             if result is not None:
 */
    __pyx_t_11 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_16))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_16);
      if (likely(__pyx_t_11)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_16, function);
        __pyx_t_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_16)) {
      PyObject *__pyx_temp[5] = {__pyx_t_11, __pyx_v_name, __pyx_kp_u_System_NValues, __pyx_v_nexpr, __pyx_v_evaluation};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 204, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_16)) {
      PyObject *__pyx_temp[5] = {__pyx_t_11, __pyx_v_name, __pyx_kp_u_System_NValues, __pyx_v_nexpr, __pyx_v_evaluation};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 204, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(4+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 204, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__pyx_t_11) {
        __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_11); __pyx_t_11 = NULL;
      }
      __Pyx_INCREF(__pyx_v_name);
      __Pyx_GIVEREF(__pyx_v_name);
      PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_7, __pyx_v_name);
      __Pyx_INCREF(__pyx_kp_u_System_NValues);
      __Pyx_GIVEREF(__pyx_kp_u_System_NValues);
      PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_7, __pyx_kp_u_System_NValues);
      __Pyx_INCREF(__pyx_v_nexpr);
      __Pyx_GIVEREF(__pyx_v_nexpr);
      PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_7, __pyx_v_nexpr);
      __Pyx_INCREF(__pyx_v_evaluation);
      __Pyx_GIVEREF(__pyx_v_evaluation);
      PyTuple_SET_ITEM(__pyx_t_4, 3+__pyx_t_7, __pyx_v_evaluation);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 204, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __pyx_v_result = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "mathics/builtin/numeric.py":207
 *                 name, "System`NValues", nexpr, evaluation
 *             )
 *             if result is not None:             # <<<<<<<<<<<<<<
 *                 if not result.sameQ(nexpr):
 *                     result = Expression(SymbolN, result, prec).evaluate(evaluation)
 */
    __pyx_t_9 = (__pyx_v_result != Py_None);
    __pyx_t_10 = (__pyx_t_9 != 0);
    if (__pyx_t_10) {

      /* "mathics/builtin/numeric.py":208
 *             )
 *             if result is not None:
 *                 if not result.sameQ(nexpr):             # <<<<<<<<<<<<<<
 *                     result = Expression(SymbolN, result, prec).evaluate(evaluation)
 *                 return result
 */
      __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_n_s_sameQ); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 208, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_16))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_16);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_16, function);
        }
      }
      __pyx_t_5 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_16, __pyx_t_4, __pyx_v_nexpr) : __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_v_nexpr);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 208, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 208, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_9 = ((!__pyx_t_10) != 0);
      if (__pyx_t_9) {

        /* "mathics/builtin/numeric.py":209
 *             if result is not None:
 *                 if not result.sameQ(nexpr):
 *                     result = Expression(SymbolN, result, prec).evaluate(evaluation)             # <<<<<<<<<<<<<<
 *                 return result
 * 
 */
        __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Expression); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 209, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_SymbolN); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 209, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_6 = NULL;
        __pyx_t_7 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_6)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
            __pyx_t_7 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_11, __pyx_v_result, __pyx_v_prec};
          __pyx_t_16 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 209, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_16);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_11, __pyx_v_result, __pyx_v_prec};
          __pyx_t_16 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 209, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_16);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        } else
        #endif
        {
          __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 209, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          if (__pyx_t_6) {
            __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
          }
          __Pyx_GIVEREF(__pyx_t_11);
          PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_11);
          __Pyx_INCREF(__pyx_v_result);
          __Pyx_GIVEREF(__pyx_v_result);
          PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_result);
          __Pyx_INCREF(__pyx_v_prec);
          __Pyx_GIVEREF(__pyx_v_prec);
          PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_v_prec);
          __pyx_t_11 = 0;
          __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 209, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_16);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_evaluate); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 209, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __pyx_t_16 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_16)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_16);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
          }
        }
        __pyx_t_5 = (__pyx_t_16) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_16, __pyx_v_evaluation) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_evaluation);
        __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 209, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_5);
        __pyx_t_5 = 0;

        /* "mathics/builtin/numeric.py":208
 *             )
 *             if result is not None:
 *                 if not result.sameQ(nexpr):             # <<<<<<<<<<<<<<
 *                     result = Expression(SymbolN, result, prec).evaluate(evaluation)
 *                 return result
 */
      }

      /* "mathics/builtin/numeric.py":210
 *                 if not result.sameQ(nexpr):
 *                     result = Expression(SymbolN, result, prec).evaluate(evaluation)
 *                 return result             # <<<<<<<<<<<<<<
 * 
 *         if expr.is_atom():
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_result);
      __pyx_r = __pyx_v_result;
      goto __pyx_L0;

      /* "mathics/builtin/numeric.py":207
 *                 name, "System`NValues", nexpr, evaluation
 *             )
 *             if result is not None:             # <<<<<<<<<<<<<<
 *                 if not result.sameQ(nexpr):
 *                     result = Expression(SymbolN, result, prec).evaluate(evaluation)
 */
    }

    /* "mathics/builtin/numeric.py":202
 * 
 *         name = expr.get_lookup_name()
 *         if name != "":             # <<<<<<<<<<<<<<
 *             nexpr = Expression(SymbolN, expr, prec)
 *             result = evaluation.definitions.get_value(
 */
  }

  /* "mathics/builtin/numeric.py":212
 *                 return result
 * 
 *         if expr.is_atom():             # <<<<<<<<<<<<<<
 *             return expr
 *         else:
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_is_atom); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_16 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_16)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_16);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_5 = (__pyx_t_16) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_16) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 212, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_9) {

    /* "mathics/builtin/numeric.py":213
 * 
 *         if expr.is_atom():
 *             return expr             # <<<<<<<<<<<<<<
 *         else:
 *             attributes = expr.head.get_attributes(evaluation.definitions)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_expr);
    __pyx_r = __pyx_v_expr;
    goto __pyx_L0;

    /* "mathics/builtin/numeric.py":212
 *                 return result
 * 
 *         if expr.is_atom():             # <<<<<<<<<<<<<<
 *             return expr
 *         else:
 */
  }

  /* "mathics/builtin/numeric.py":215
 *             return expr
 *         else:
 *             attributes = expr.head.get_attributes(evaluation.definitions)             # <<<<<<<<<<<<<<
 *             if "System`NHoldAll" in attributes:
 *                 eval_range = ()
 */
  /*else*/ {
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_head); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 215, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_get_attributes); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 215, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_definitions); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 215, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_16))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_16);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_16, function);
      }
    }
    __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_16, __pyx_t_8, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 215, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __pyx_v_attributes = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "mathics/builtin/numeric.py":216
 *         else:
 *             attributes = expr.head.get_attributes(evaluation.definitions)
 *             if "System`NHoldAll" in attributes:             # <<<<<<<<<<<<<<
 *                 eval_range = ()
 *             elif "System`NHoldFirst" in attributes:
 */
    __pyx_t_9 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u_System_NHoldAll, __pyx_v_attributes, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 216, __pyx_L1_error)
    __pyx_t_10 = (__pyx_t_9 != 0);
    if (__pyx_t_10) {

      /* "mathics/builtin/numeric.py":217
 *             attributes = expr.head.get_attributes(evaluation.definitions)
 *             if "System`NHoldAll" in attributes:
 *                 eval_range = ()             # <<<<<<<<<<<<<<
 *             elif "System`NHoldFirst" in attributes:
 *                 eval_range = range(1, len(expr.leaves))
 */
      __Pyx_INCREF(__pyx_empty_tuple);
      __pyx_v_eval_range = __pyx_empty_tuple;

      /* "mathics/builtin/numeric.py":216
 *         else:
 *             attributes = expr.head.get_attributes(evaluation.definitions)
 *             if "System`NHoldAll" in attributes:             # <<<<<<<<<<<<<<
 *                 eval_range = ()
 *             elif "System`NHoldFirst" in attributes:
 */
      goto __pyx_L26;
    }

    /* "mathics/builtin/numeric.py":218
 *             if "System`NHoldAll" in attributes:
 *                 eval_range = ()
 *             elif "System`NHoldFirst" in attributes:             # <<<<<<<<<<<<<<
 *                 eval_range = range(1, len(expr.leaves))
 *             elif "System`NHoldRest" in attributes:
 */
    __pyx_t_10 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u_System_NHoldFirst, __pyx_v_attributes, Py_EQ)); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 218, __pyx_L1_error)
    __pyx_t_9 = (__pyx_t_10 != 0);
    if (__pyx_t_9) {

      /* "mathics/builtin/numeric.py":219
 *                 eval_range = ()
 *             elif "System`NHoldFirst" in attributes:
 *                 eval_range = range(1, len(expr.leaves))             # <<<<<<<<<<<<<<
 *             elif "System`NHoldRest" in attributes:
 *                 if len(expr.leaves) > 0:
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_leaves); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 219, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_12 = PyObject_Length(__pyx_t_5); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(0, 219, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 219, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 219, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_int_1);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_16, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 219, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      __pyx_v_eval_range = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "mathics/builtin/numeric.py":218
 *             if "System`NHoldAll" in attributes:
 *                 eval_range = ()
 *             elif "System`NHoldFirst" in attributes:             # <<<<<<<<<<<<<<
 *                 eval_range = range(1, len(expr.leaves))
 *             elif "System`NHoldRest" in attributes:
 */
      goto __pyx_L26;
    }

    /* "mathics/builtin/numeric.py":220
 *             elif "System`NHoldFirst" in attributes:
 *                 eval_range = range(1, len(expr.leaves))
 *             elif "System`NHoldRest" in attributes:             # <<<<<<<<<<<<<<
 *                 if len(expr.leaves) > 0:
 *                     eval_range = (0,)
 */
    __pyx_t_9 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u_System_NHoldRest, __pyx_v_attributes, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 220, __pyx_L1_error)
    __pyx_t_10 = (__pyx_t_9 != 0);
    if (__pyx_t_10) {

      /* "mathics/builtin/numeric.py":221
 *                 eval_range = range(1, len(expr.leaves))
 *             elif "System`NHoldRest" in attributes:
 *                 if len(expr.leaves) > 0:             # <<<<<<<<<<<<<<
 *                     eval_range = (0,)
 *                 else:
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_leaves); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 221, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_12 = PyObject_Length(__pyx_t_5); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(0, 221, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_10 = ((__pyx_t_12 > 0) != 0);
      if (__pyx_t_10) {

        /* "mathics/builtin/numeric.py":222
 *             elif "System`NHoldRest" in attributes:
 *                 if len(expr.leaves) > 0:
 *                     eval_range = (0,)             # <<<<<<<<<<<<<<
 *                 else:
 *                     eval_range = ()
 */
        __Pyx_INCREF(__pyx_tuple__3);
        __pyx_v_eval_range = __pyx_tuple__3;

        /* "mathics/builtin/numeric.py":221
 *                 eval_range = range(1, len(expr.leaves))
 *             elif "System`NHoldRest" in attributes:
 *                 if len(expr.leaves) > 0:             # <<<<<<<<<<<<<<
 *                     eval_range = (0,)
 *                 else:
 */
        goto __pyx_L27;
      }

      /* "mathics/builtin/numeric.py":224
 *                     eval_range = (0,)
 *                 else:
 *                     eval_range = ()             # <<<<<<<<<<<<<<
 *             else:
 *                 eval_range = range(len(expr.leaves))
 */
      /*else*/ {
        __Pyx_INCREF(__pyx_empty_tuple);
        __pyx_v_eval_range = __pyx_empty_tuple;
      }
      __pyx_L27:;

      /* "mathics/builtin/numeric.py":220
 *             elif "System`NHoldFirst" in attributes:
 *                 eval_range = range(1, len(expr.leaves))
 *             elif "System`NHoldRest" in attributes:             # <<<<<<<<<<<<<<
 *                 if len(expr.leaves) > 0:
 *                     eval_range = (0,)
 */
      goto __pyx_L26;
    }

    /* "mathics/builtin/numeric.py":226
 *                     eval_range = ()
 *             else:
 *                 eval_range = range(len(expr.leaves))             # <<<<<<<<<<<<<<
 *             head = Expression(SymbolN, expr.head, prec).evaluate(evaluation)
 *             leaves = expr.get_mutable_leaves()
 */
    /*else*/ {
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_leaves); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 226, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_12 = PyObject_Length(__pyx_t_5); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(0, 226, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 226, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_16 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_5); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 226, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_eval_range = __pyx_t_16;
      __pyx_t_16 = 0;
    }
    __pyx_L26:;

    /* "mathics/builtin/numeric.py":227
 *             else:
 *                 eval_range = range(len(expr.leaves))
 *             head = Expression(SymbolN, expr.head, prec).evaluate(evaluation)             # <<<<<<<<<<<<<<
 *             leaves = expr.get_mutable_leaves()
 *             for index in eval_range:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Expression); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 227, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_SymbolN); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 227, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_head); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 227, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_6 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_8, __pyx_t_11, __pyx_v_prec};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 227, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_8, __pyx_t_11, __pyx_v_prec};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 227, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    } else
    #endif
    {
      __pyx_t_14 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 227, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      if (__pyx_t_6) {
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_7, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_7, __pyx_t_11);
      __Pyx_INCREF(__pyx_v_prec);
      __Pyx_GIVEREF(__pyx_v_prec);
      PyTuple_SET_ITEM(__pyx_t_14, 2+__pyx_t_7, __pyx_v_prec);
      __pyx_t_8 = 0;
      __pyx_t_11 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_14, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 227, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_evaluate); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 227, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_16 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_evaluation) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_evaluation);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 227, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_head = __pyx_t_16;
    __pyx_t_16 = 0;

    /* "mathics/builtin/numeric.py":228
 *                 eval_range = range(len(expr.leaves))
 *             head = Expression(SymbolN, expr.head, prec).evaluate(evaluation)
 *             leaves = expr.get_mutable_leaves()             # <<<<<<<<<<<<<<
 *             for index in eval_range:
 *                 leaves[index] = Expression(SymbolN, leaves[index], prec).evaluate(
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_get_mutable_leaves); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 228, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_16 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 228, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_leaves = __pyx_t_16;
    __pyx_t_16 = 0;

    /* "mathics/builtin/numeric.py":229
 *             head = Expression(SymbolN, expr.head, prec).evaluate(evaluation)
 *             leaves = expr.get_mutable_leaves()
 *             for index in eval_range:             # <<<<<<<<<<<<<<
 *                 leaves[index] = Expression(SymbolN, leaves[index], prec).evaluate(
 *                     evaluation
 */
    if (likely(PyList_CheckExact(__pyx_v_eval_range)) || PyTuple_CheckExact(__pyx_v_eval_range)) {
      __pyx_t_16 = __pyx_v_eval_range; __Pyx_INCREF(__pyx_t_16); __pyx_t_12 = 0;
      __pyx_t_13 = NULL;
    } else {
      __pyx_t_12 = -1; __pyx_t_16 = PyObject_GetIter(__pyx_v_eval_range); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 229, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __pyx_t_13 = Py_TYPE(__pyx_t_16)->tp_iternext; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 229, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_13)) {
        if (likely(PyList_CheckExact(__pyx_t_16))) {
          if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_16)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_4 = PyList_GET_ITEM(__pyx_t_16, __pyx_t_12); __Pyx_INCREF(__pyx_t_4); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 229, __pyx_L1_error)
          #else
          __pyx_t_4 = PySequence_ITEM(__pyx_t_16, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 229, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          #endif
        } else {
          if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_16)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_16, __pyx_t_12); __Pyx_INCREF(__pyx_t_4); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 229, __pyx_L1_error)
          #else
          __pyx_t_4 = PySequence_ITEM(__pyx_t_16, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 229, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          #endif
        }
      } else {
        __pyx_t_4 = __pyx_t_13(__pyx_t_16);
        if (unlikely(!__pyx_t_4)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 229, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_4);
      }
      __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "mathics/builtin/numeric.py":230
 *             leaves = expr.get_mutable_leaves()
 *             for index in eval_range:
 *                 leaves[index] = Expression(SymbolN, leaves[index], prec).evaluate(             # <<<<<<<<<<<<<<
 *                     evaluation
 *                 )
 */
      __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_Expression); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 230, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_SymbolN); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 230, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_leaves, __pyx_v_index); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 230, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_6 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_14);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_14, function);
          __pyx_t_7 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_14)) {
        PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_11, __pyx_t_8, __pyx_v_prec};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 230, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
        PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_11, __pyx_t_8, __pyx_v_prec};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 230, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else
      #endif
      {
        __pyx_t_15 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 230, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        if (__pyx_t_6) {
          __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_6); __pyx_t_6 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_11);
        PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_7, __pyx_t_11);
        __Pyx_GIVEREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_7, __pyx_t_8);
        __Pyx_INCREF(__pyx_v_prec);
        __Pyx_GIVEREF(__pyx_v_prec);
        PyTuple_SET_ITEM(__pyx_t_15, 2+__pyx_t_7, __pyx_v_prec);
        __pyx_t_11 = 0;
        __pyx_t_8 = 0;
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_15, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 230, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      }
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_evaluate); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 230, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "mathics/builtin/numeric.py":231
 *             for index in eval_range:
 *                 leaves[index] = Expression(SymbolN, leaves[index], prec).evaluate(
 *                     evaluation             # <<<<<<<<<<<<<<
 *                 )
 *             return Expression(head, *leaves)
 */
      __pyx_t_5 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_14);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_14, function);
        }
      }
      __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_5, __pyx_v_evaluation) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_v_evaluation);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 230, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

      /* "mathics/builtin/numeric.py":230
 *             leaves = expr.get_mutable_leaves()
 *             for index in eval_range:
 *                 leaves[index] = Expression(SymbolN, leaves[index], prec).evaluate(             # <<<<<<<<<<<<<<
 *                     evaluation
 *                 )
 */
      if (unlikely(PyObject_SetItem(__pyx_v_leaves, __pyx_v_index, __pyx_t_4) < 0)) __PYX_ERR(0, 230, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "mathics/builtin/numeric.py":229
 *             head = Expression(SymbolN, expr.head, prec).evaluate(evaluation)
 *             leaves = expr.get_mutable_leaves()
 *             for index in eval_range:             # <<<<<<<<<<<<<<
 *                 leaves[index] = Expression(SymbolN, leaves[index], prec).evaluate(
 *                     evaluation
 */
    }
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;

    /* "mathics/builtin/numeric.py":233
 *                     evaluation
 *                 )
 *             return Expression(head, *leaves)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_n_s_Expression); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_head);
    __Pyx_GIVEREF(__pyx_v_head);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_head);
    __pyx_t_14 = __Pyx_PySequence_Tuple(__pyx_v_leaves); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_5 = PyNumber_Add(__pyx_t_4, __pyx_t_14); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_5, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_14;
    __pyx_t_14 = 0;
    goto __pyx_L0;
  }

  /* "mathics/builtin/numeric.py":180
 *     }
 * 
 *     def apply_with_prec(self, expr, prec, evaluation):             # <<<<<<<<<<<<<<
 *         "N[expr_, prec_]"
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("mathics.builtin.numeric.N.apply_with_prec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_nexpr);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_attributes);
  __Pyx_XDECREF(__pyx_v_eval_range);
  __Pyx_XDECREF(__pyx_v_head);
  __Pyx_XDECREF(__pyx_v_leaves);
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_XDECREF(__pyx_7genexpr__pyx_v_leaf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":236
 * 
 * 
 * def _scipy_interface(integrator, options_map, mandatory=None, adapt_func=None):             # <<<<<<<<<<<<<<
 *     """
 *     This function provides a proxy for scipy.integrate
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_3_scipy_interface(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_7builtin_7numeric_2_scipy_interface[] = "\n    This function provides a proxy for scipy.integrate\n    functions, adapting the parameters.\n    ";
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_3_scipy_interface = {"_scipy_interface", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_3_scipy_interface, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_7builtin_7numeric_2_scipy_interface};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_3_scipy_interface(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_integrator = 0;
  PyObject *__pyx_v_options_map = 0;
  PyObject *__pyx_v_mandatory = 0;
  PyObject *__pyx_v_adapt_func = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_scipy_interface (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_integrator,&__pyx_n_s_options_map,&__pyx_n_s_mandatory,&__pyx_n_s_adapt_func,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((PyObject *)((PyObject *)Py_None));
    values[3] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_integrator)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options_map)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_scipy_interface", 0, 2, 4, 1); __PYX_ERR(0, 236, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mandatory);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_adapt_func);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_scipy_interface") < 0)) __PYX_ERR(0, 236, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_integrator = values[0];
    __pyx_v_options_map = values[1];
    __pyx_v_mandatory = values[2];
    __pyx_v_adapt_func = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_scipy_interface", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 236, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric._scipy_interface", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_2_scipy_interface(__pyx_self, __pyx_v_integrator, __pyx_v_options_map, __pyx_v_mandatory, __pyx_v_adapt_func);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":242
 *     """
 * 
 *     def _scipy_proxy_func_filter(fun, a, b, **opts):             # <<<<<<<<<<<<<<
 *         native_opts = {}
 *         if mandatory:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_16_scipy_interface_1_scipy_proxy_func_filter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_16_scipy_interface_1_scipy_proxy_func_filter = {"_scipy_proxy_func_filter", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_16_scipy_interface_1_scipy_proxy_func_filter, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_16_scipy_interface_1_scipy_proxy_func_filter(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_fun = 0;
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_v_b = 0;
  PyObject *__pyx_v_opts = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_scipy_proxy_func_filter (wrapper)", 0);
  __pyx_v_opts = PyDict_New(); if (unlikely(!__pyx_v_opts)) return NULL;
  __Pyx_GOTREF(__pyx_v_opts);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fun,&__pyx_n_s_a,&__pyx_n_s_b,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fun)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_a)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_scipy_proxy_func_filter", 1, 3, 3, 1); __PYX_ERR(0, 242, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_scipy_proxy_func_filter", 1, 3, 3, 2); __PYX_ERR(0, 242, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_opts, values, pos_args, "_scipy_proxy_func_filter") < 0)) __PYX_ERR(0, 242, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_fun = values[0];
    __pyx_v_a = values[1];
    __pyx_v_b = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_scipy_proxy_func_filter", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 242, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_opts); __pyx_v_opts = 0;
  __Pyx_AddTraceback("mathics.builtin.numeric._scipy_interface._scipy_proxy_func_filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_16_scipy_interface__scipy_proxy_func_filter(__pyx_self, __pyx_v_fun, __pyx_v_a, __pyx_v_b, __pyx_v_opts);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_opts);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_16_scipy_interface__scipy_proxy_func_filter(PyObject *__pyx_self, PyObject *__pyx_v_fun, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_opts) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface *__pyx_cur_scope;
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface *__pyx_outer_scope;
  PyObject *__pyx_v_native_opts = NULL;
  PyObject *__pyx_v_opt = NULL;
  PyObject *__pyx_v_val = NULL;
  PyObject *__pyx_v_native_opt = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_scipy_proxy_func_filter", 0);
  __pyx_outer_scope = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "mathics/builtin/numeric.py":243
 * 
 *     def _scipy_proxy_func_filter(fun, a, b, **opts):
 *         native_opts = {}             # <<<<<<<<<<<<<<
 *         if mandatory:
 *             native_opts.update(mandatory)
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 243, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_native_opts = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":244
 *     def _scipy_proxy_func_filter(fun, a, b, **opts):
 *         native_opts = {}
 *         if mandatory:             # <<<<<<<<<<<<<<
 *             native_opts.update(mandatory)
 *         for opt, val in opts.items():
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_mandatory)) { __Pyx_RaiseClosureNameError("mandatory"); __PYX_ERR(0, 244, __pyx_L1_error) }
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_mandatory); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 244, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "mathics/builtin/numeric.py":245
 *         native_opts = {}
 *         if mandatory:
 *             native_opts.update(mandatory)             # <<<<<<<<<<<<<<
 *         for opt, val in opts.items():
 *             native_opt = options_map.get(opt, None)
 */
    if (unlikely(!__pyx_cur_scope->__pyx_v_mandatory)) { __Pyx_RaiseClosureNameError("mandatory"); __PYX_ERR(0, 245, __pyx_L1_error) }
    __pyx_t_1 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_update, __pyx_v_native_opts, __pyx_cur_scope->__pyx_v_mandatory); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 245, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "mathics/builtin/numeric.py":244
 *     def _scipy_proxy_func_filter(fun, a, b, **opts):
 *         native_opts = {}
 *         if mandatory:             # <<<<<<<<<<<<<<
 *             native_opts.update(mandatory)
 *         for opt, val in opts.items():
 */
  }

  /* "mathics/builtin/numeric.py":246
 *         if mandatory:
 *             native_opts.update(mandatory)
 *         for opt, val in opts.items():             # <<<<<<<<<<<<<<
 *             native_opt = options_map.get(opt, None)
 *             if native_opt:
 */
  __pyx_t_3 = 0;
  __pyx_t_6 = __Pyx_dict_iterator(__pyx_v_opts, 1, __pyx_n_s_items, (&__pyx_t_4), (&__pyx_t_5)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 246, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_6;
  __pyx_t_6 = 0;
  while (1) {
    __pyx_t_8 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_4, &__pyx_t_3, &__pyx_t_6, &__pyx_t_7, NULL, __pyx_t_5);
    if (unlikely(__pyx_t_8 == 0)) break;
    if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 246, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_XDECREF_SET(__pyx_v_opt, __pyx_t_6);
    __pyx_t_6 = 0;
    __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "mathics/builtin/numeric.py":247
 *             native_opts.update(mandatory)
 *         for opt, val in opts.items():
 *             native_opt = options_map.get(opt, None)             # <<<<<<<<<<<<<<
 *             if native_opt:
 *                 if native_opt[1]:
 */
    if (unlikely(!__pyx_cur_scope->__pyx_v_options_map)) { __Pyx_RaiseClosureNameError("options_map"); __PYX_ERR(0, 247, __pyx_L1_error) }
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_options_map, __pyx_n_s_get); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 247, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_9 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_v_opt, Py_None};
      __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 247, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_7);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_v_opt, Py_None};
      __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 247, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_7);
    } else
    #endif
    {
      __pyx_t_10 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 247, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (__pyx_t_9) {
        __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL;
      }
      __Pyx_INCREF(__pyx_v_opt);
      __Pyx_GIVEREF(__pyx_v_opt);
      PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_8, __pyx_v_opt);
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_8, Py_None);
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_10, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 247, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF_SET(__pyx_v_native_opt, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "mathics/builtin/numeric.py":248
 *         for opt, val in opts.items():
 *             native_opt = options_map.get(opt, None)
 *             if native_opt:             # <<<<<<<<<<<<<<
 *                 if native_opt[1]:
 *                     val = native_opt[1](val)
 */
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_native_opt); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 248, __pyx_L1_error)
    if (__pyx_t_2) {

      /* "mathics/builtin/numeric.py":249
 *             native_opt = options_map.get(opt, None)
 *             if native_opt:
 *                 if native_opt[1]:             # <<<<<<<<<<<<<<
 *                     val = native_opt[1](val)
 *                 native_opts[native_opt[0]] = val
 */
      __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_native_opt, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 249, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 249, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (__pyx_t_2) {

        /* "mathics/builtin/numeric.py":250
 *             if native_opt:
 *                 if native_opt[1]:
 *                     val = native_opt[1](val)             # <<<<<<<<<<<<<<
 *                 native_opts[native_opt[0]] = val
 *         return adapt_func(integrator(fun, a, b, **native_opts))
 */
        __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_native_opt, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 250, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_10 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
          __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6);
          if (likely(__pyx_t_10)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
            __Pyx_INCREF(__pyx_t_10);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_6, function);
          }
        }
        __pyx_t_7 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_10, __pyx_v_val) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_val);
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 250, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF_SET(__pyx_v_val, __pyx_t_7);
        __pyx_t_7 = 0;

        /* "mathics/builtin/numeric.py":249
 *             native_opt = options_map.get(opt, None)
 *             if native_opt:
 *                 if native_opt[1]:             # <<<<<<<<<<<<<<
 *                     val = native_opt[1](val)
 *                 native_opts[native_opt[0]] = val
 */
      }

      /* "mathics/builtin/numeric.py":251
 *                 if native_opt[1]:
 *                     val = native_opt[1](val)
 *                 native_opts[native_opt[0]] = val             # <<<<<<<<<<<<<<
 *         return adapt_func(integrator(fun, a, b, **native_opts))
 * 
 */
      __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_native_opt, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 251, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (unlikely(PyDict_SetItem(__pyx_v_native_opts, __pyx_t_7, __pyx_v_val) < 0)) __PYX_ERR(0, 251, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "mathics/builtin/numeric.py":248
 *         for opt, val in opts.items():
 *             native_opt = options_map.get(opt, None)
 *             if native_opt:             # <<<<<<<<<<<<<<
 *                 if native_opt[1]:
 *                     val = native_opt[1](val)
 */
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":252
 *                     val = native_opt[1](val)
 *                 native_opts[native_opt[0]] = val
 *         return adapt_func(integrator(fun, a, b, **native_opts))             # <<<<<<<<<<<<<<
 * 
 *     def _scipy_proxy_func(fun, a, b, **opts):
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_cur_scope->__pyx_v_adapt_func)) { __Pyx_RaiseClosureNameError("adapt_func"); __PYX_ERR(0, 252, __pyx_L1_error) }
  if (unlikely(!__pyx_cur_scope->__pyx_v_integrator)) { __Pyx_RaiseClosureNameError("integrator"); __PYX_ERR(0, 252, __pyx_L1_error) }
  __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 252, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_v_fun);
  __Pyx_GIVEREF(__pyx_v_fun);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_fun);
  __Pyx_INCREF(__pyx_v_a);
  __Pyx_GIVEREF(__pyx_v_a);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_a);
  __Pyx_INCREF(__pyx_v_b);
  __Pyx_GIVEREF(__pyx_v_b);
  PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_v_b);
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_cur_scope->__pyx_v_integrator, __pyx_t_7, __pyx_v_native_opts); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 252, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_adapt_func);
  __pyx_t_7 = __pyx_cur_scope->__pyx_v_adapt_func; __pyx_t_10 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_10)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  __pyx_t_1 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_10, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
  __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 252, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/builtin/numeric.py":242
 *     """
 * 
 *     def _scipy_proxy_func_filter(fun, a, b, **opts):             # <<<<<<<<<<<<<<
 *         native_opts = {}
 *         if mandatory:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("mathics.builtin.numeric._scipy_interface._scipy_proxy_func_filter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_native_opts);
  __Pyx_XDECREF(__pyx_v_opt);
  __Pyx_XDECREF(__pyx_v_val);
  __Pyx_XDECREF(__pyx_v_native_opt);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":254
 *         return adapt_func(integrator(fun, a, b, **native_opts))
 * 
 *     def _scipy_proxy_func(fun, a, b, **opts):             # <<<<<<<<<<<<<<
 *         native_opts = {}
 *         if mandatory:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_16_scipy_interface_3_scipy_proxy_func(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_16_scipy_interface_3_scipy_proxy_func = {"_scipy_proxy_func", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_16_scipy_interface_3_scipy_proxy_func, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_16_scipy_interface_3_scipy_proxy_func(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_fun = 0;
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_v_b = 0;
  PyObject *__pyx_v_opts = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_scipy_proxy_func (wrapper)", 0);
  __pyx_v_opts = PyDict_New(); if (unlikely(!__pyx_v_opts)) return NULL;
  __Pyx_GOTREF(__pyx_v_opts);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fun,&__pyx_n_s_a,&__pyx_n_s_b,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fun)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_a)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_scipy_proxy_func", 1, 3, 3, 1); __PYX_ERR(0, 254, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_scipy_proxy_func", 1, 3, 3, 2); __PYX_ERR(0, 254, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_opts, values, pos_args, "_scipy_proxy_func") < 0)) __PYX_ERR(0, 254, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_fun = values[0];
    __pyx_v_a = values[1];
    __pyx_v_b = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_scipy_proxy_func", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 254, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_opts); __pyx_v_opts = 0;
  __Pyx_AddTraceback("mathics.builtin.numeric._scipy_interface._scipy_proxy_func", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_16_scipy_interface_2_scipy_proxy_func(__pyx_self, __pyx_v_fun, __pyx_v_a, __pyx_v_b, __pyx_v_opts);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_opts);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_16_scipy_interface_2_scipy_proxy_func(PyObject *__pyx_self, PyObject *__pyx_v_fun, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_opts) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface *__pyx_cur_scope;
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface *__pyx_outer_scope;
  PyObject *__pyx_v_native_opts = NULL;
  PyObject *__pyx_v_opt = NULL;
  PyObject *__pyx_v_val = NULL;
  PyObject *__pyx_v_native_opt = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_scipy_proxy_func", 0);
  __pyx_outer_scope = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "mathics/builtin/numeric.py":255
 * 
 *     def _scipy_proxy_func(fun, a, b, **opts):
 *         native_opts = {}             # <<<<<<<<<<<<<<
 *         if mandatory:
 *             native_opts.update(mandatory)
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_native_opts = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":256
 *     def _scipy_proxy_func(fun, a, b, **opts):
 *         native_opts = {}
 *         if mandatory:             # <<<<<<<<<<<<<<
 *             native_opts.update(mandatory)
 *         for opt, val in opts.items():
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_mandatory)) { __Pyx_RaiseClosureNameError("mandatory"); __PYX_ERR(0, 256, __pyx_L1_error) }
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_mandatory); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 256, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "mathics/builtin/numeric.py":257
 *         native_opts = {}
 *         if mandatory:
 *             native_opts.update(mandatory)             # <<<<<<<<<<<<<<
 *         for opt, val in opts.items():
 *             native_opt = options_map.get(opt, None)
 */
    if (unlikely(!__pyx_cur_scope->__pyx_v_mandatory)) { __Pyx_RaiseClosureNameError("mandatory"); __PYX_ERR(0, 257, __pyx_L1_error) }
    __pyx_t_1 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_update, __pyx_v_native_opts, __pyx_cur_scope->__pyx_v_mandatory); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 257, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "mathics/builtin/numeric.py":256
 *     def _scipy_proxy_func(fun, a, b, **opts):
 *         native_opts = {}
 *         if mandatory:             # <<<<<<<<<<<<<<
 *             native_opts.update(mandatory)
 *         for opt, val in opts.items():
 */
  }

  /* "mathics/builtin/numeric.py":258
 *         if mandatory:
 *             native_opts.update(mandatory)
 *         for opt, val in opts.items():             # <<<<<<<<<<<<<<
 *             native_opt = options_map.get(opt, None)
 *             if native_opt:
 */
  __pyx_t_3 = 0;
  __pyx_t_6 = __Pyx_dict_iterator(__pyx_v_opts, 1, __pyx_n_s_items, (&__pyx_t_4), (&__pyx_t_5)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_6;
  __pyx_t_6 = 0;
  while (1) {
    __pyx_t_8 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_4, &__pyx_t_3, &__pyx_t_6, &__pyx_t_7, NULL, __pyx_t_5);
    if (unlikely(__pyx_t_8 == 0)) break;
    if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 258, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_XDECREF_SET(__pyx_v_opt, __pyx_t_6);
    __pyx_t_6 = 0;
    __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "mathics/builtin/numeric.py":259
 *             native_opts.update(mandatory)
 *         for opt, val in opts.items():
 *             native_opt = options_map.get(opt, None)             # <<<<<<<<<<<<<<
 *             if native_opt:
 *                 if native_opt[1]:
 */
    if (unlikely(!__pyx_cur_scope->__pyx_v_options_map)) { __Pyx_RaiseClosureNameError("options_map"); __PYX_ERR(0, 259, __pyx_L1_error) }
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_options_map, __pyx_n_s_get); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 259, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_9 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_v_opt, Py_None};
      __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 259, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_7);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_v_opt, Py_None};
      __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 259, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_7);
    } else
    #endif
    {
      __pyx_t_10 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 259, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (__pyx_t_9) {
        __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL;
      }
      __Pyx_INCREF(__pyx_v_opt);
      __Pyx_GIVEREF(__pyx_v_opt);
      PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_8, __pyx_v_opt);
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_8, Py_None);
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_10, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 259, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF_SET(__pyx_v_native_opt, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "mathics/builtin/numeric.py":260
 *         for opt, val in opts.items():
 *             native_opt = options_map.get(opt, None)
 *             if native_opt:             # <<<<<<<<<<<<<<
 *                 if native_opt[1]:
 *                     val = native_opt[1](val)
 */
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_native_opt); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 260, __pyx_L1_error)
    if (__pyx_t_2) {

      /* "mathics/builtin/numeric.py":261
 *             native_opt = options_map.get(opt, None)
 *             if native_opt:
 *                 if native_opt[1]:             # <<<<<<<<<<<<<<
 *                     val = native_opt[1](val)
 *                 native_opts[native_opt[0]] = val
 */
      __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_native_opt, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 261, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 261, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (__pyx_t_2) {

        /* "mathics/builtin/numeric.py":262
 *             if native_opt:
 *                 if native_opt[1]:
 *                     val = native_opt[1](val)             # <<<<<<<<<<<<<<
 *                 native_opts[native_opt[0]] = val
 *         return integrator(fun, a, b, **native_opts)
 */
        __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_native_opt, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 262, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_10 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
          __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6);
          if (likely(__pyx_t_10)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
            __Pyx_INCREF(__pyx_t_10);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_6, function);
          }
        }
        __pyx_t_7 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_10, __pyx_v_val) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_val);
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 262, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF_SET(__pyx_v_val, __pyx_t_7);
        __pyx_t_7 = 0;

        /* "mathics/builtin/numeric.py":261
 *             native_opt = options_map.get(opt, None)
 *             if native_opt:
 *                 if native_opt[1]:             # <<<<<<<<<<<<<<
 *                     val = native_opt[1](val)
 *                 native_opts[native_opt[0]] = val
 */
      }

      /* "mathics/builtin/numeric.py":263
 *                 if native_opt[1]:
 *                     val = native_opt[1](val)
 *                 native_opts[native_opt[0]] = val             # <<<<<<<<<<<<<<
 *         return integrator(fun, a, b, **native_opts)
 * 
 */
      __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_native_opt, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 263, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (unlikely(PyDict_SetItem(__pyx_v_native_opts, __pyx_t_7, __pyx_v_val) < 0)) __PYX_ERR(0, 263, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "mathics/builtin/numeric.py":260
 *         for opt, val in opts.items():
 *             native_opt = options_map.get(opt, None)
 *             if native_opt:             # <<<<<<<<<<<<<<
 *                 if native_opt[1]:
 *                     val = native_opt[1](val)
 */
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":264
 *                     val = native_opt[1](val)
 *                 native_opts[native_opt[0]] = val
 *         return integrator(fun, a, b, **native_opts)             # <<<<<<<<<<<<<<
 * 
 *     return _scipy_proxy_func_filter if adapt_func else _scipy_proxy_func
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_cur_scope->__pyx_v_integrator)) { __Pyx_RaiseClosureNameError("integrator"); __PYX_ERR(0, 264, __pyx_L1_error) }
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 264, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_fun);
  __Pyx_GIVEREF(__pyx_v_fun);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_fun);
  __Pyx_INCREF(__pyx_v_a);
  __Pyx_GIVEREF(__pyx_v_a);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_a);
  __Pyx_INCREF(__pyx_v_b);
  __Pyx_GIVEREF(__pyx_v_b);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_b);
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_cur_scope->__pyx_v_integrator, __pyx_t_1, __pyx_v_native_opts); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 264, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "mathics/builtin/numeric.py":254
 *         return adapt_func(integrator(fun, a, b, **native_opts))
 * 
 *     def _scipy_proxy_func(fun, a, b, **opts):             # <<<<<<<<<<<<<<
 *         native_opts = {}
 *         if mandatory:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("mathics.builtin.numeric._scipy_interface._scipy_proxy_func", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_native_opts);
  __Pyx_XDECREF(__pyx_v_opt);
  __Pyx_XDECREF(__pyx_v_val);
  __Pyx_XDECREF(__pyx_v_native_opt);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":236
 * 
 * 
 * def _scipy_interface(integrator, options_map, mandatory=None, adapt_func=None):             # <<<<<<<<<<<<<<
 *     """
 *     This function provides a proxy for scipy.integrate
 */

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_2_scipy_interface(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_integrator, PyObject *__pyx_v_options_map, PyObject *__pyx_v_mandatory, PyObject *__pyx_v_adapt_func) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface *__pyx_cur_scope;
  PyObject *__pyx_v__scipy_proxy_func_filter = 0;
  PyObject *__pyx_v__scipy_proxy_func = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_scipy_interface", 0);
  __pyx_cur_scope = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface *)__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface(__pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 236, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_integrator = __pyx_v_integrator;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_integrator);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_integrator);
  __pyx_cur_scope->__pyx_v_options_map = __pyx_v_options_map;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_options_map);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_options_map);
  __pyx_cur_scope->__pyx_v_mandatory = __pyx_v_mandatory;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_mandatory);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_mandatory);
  __pyx_cur_scope->__pyx_v_adapt_func = __pyx_v_adapt_func;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_adapt_func);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_adapt_func);

  /* "mathics/builtin/numeric.py":242
 *     """
 * 
 *     def _scipy_proxy_func_filter(fun, a, b, **opts):             # <<<<<<<<<<<<<<
 *         native_opts = {}
 *         if mandatory:
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_16_scipy_interface_1_scipy_proxy_func_filter, 0, __pyx_n_s_scipy_interface_locals__scipy_p, ((PyObject*)__pyx_cur_scope), __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__5)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__scipy_proxy_func_filter = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":254
 *         return adapt_func(integrator(fun, a, b, **native_opts))
 * 
 *     def _scipy_proxy_func(fun, a, b, **opts):             # <<<<<<<<<<<<<<
 *         native_opts = {}
 *         if mandatory:
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_16_scipy_interface_3_scipy_proxy_func, 0, __pyx_n_s_scipy_interface_locals__scipy_p_2, ((PyObject*)__pyx_cur_scope), __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__7)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__scipy_proxy_func = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":266
 *         return integrator(fun, a, b, **native_opts)
 * 
 *     return _scipy_proxy_func_filter if adapt_func else _scipy_proxy_func             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_adapt_func); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 266, __pyx_L1_error)
  if (__pyx_t_2) {
    __Pyx_INCREF(__pyx_v__scipy_proxy_func_filter);
    __pyx_t_1 = __pyx_v__scipy_proxy_func_filter;
  } else {
    __Pyx_INCREF(__pyx_v__scipy_proxy_func);
    __pyx_t_1 = __pyx_v__scipy_proxy_func;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/builtin/numeric.py":236
 * 
 * 
 * def _scipy_interface(integrator, options_map, mandatory=None, adapt_func=None):             # <<<<<<<<<<<<<<
 *     """
 *     This function provides a proxy for scipy.integrate
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("mathics.builtin.numeric._scipy_interface", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v__scipy_proxy_func_filter);
  __Pyx_XDECREF(__pyx_v__scipy_proxy_func);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":269
 * 
 * 
 * def _internal_adaptative_simpsons_rule(f, a, b, **opts):             # <<<<<<<<<<<<<<
 *     """
 *     1D adaptative Simpson's rule integrator
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_5_internal_adaptative_simpsons_rule(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_7builtin_7numeric_4_internal_adaptative_simpsons_rule[] = "\n    1D adaptative Simpson's rule integrator\n    Adapted from https://en.wikipedia.org/wiki/Adaptive_Simpson%27s_method\n       by @mmatera\n\n    TODO: handle weak divergences\n    ";
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_5_internal_adaptative_simpsons_rule = {"_internal_adaptative_simpsons_rule", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_5_internal_adaptative_simpsons_rule, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_7builtin_7numeric_4_internal_adaptative_simpsons_rule};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_5_internal_adaptative_simpsons_rule(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_f = 0;
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_v_b = 0;
  PyObject *__pyx_v_opts = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_internal_adaptative_simpsons_rule (wrapper)", 0);
  __pyx_v_opts = PyDict_New(); if (unlikely(!__pyx_v_opts)) return NULL;
  __Pyx_GOTREF(__pyx_v_opts);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_f,&__pyx_n_s_a,&__pyx_n_s_b,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_f)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_a)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_internal_adaptative_simpsons_rule", 1, 3, 3, 1); __PYX_ERR(0, 269, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_internal_adaptative_simpsons_rule", 1, 3, 3, 2); __PYX_ERR(0, 269, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_opts, values, pos_args, "_internal_adaptative_simpsons_rule") < 0)) __PYX_ERR(0, 269, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_f = values[0];
    __pyx_v_a = values[1];
    __pyx_v_b = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_internal_adaptative_simpsons_rule", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 269, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_opts); __pyx_v_opts = 0;
  __Pyx_AddTraceback("mathics.builtin.numeric._internal_adaptative_simpsons_rule", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_4_internal_adaptative_simpsons_rule(__pyx_self, __pyx_v_f, __pyx_v_a, __pyx_v_b, __pyx_v_opts);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_opts);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":287
 *         maxrec = 150
 * 
 *     def _quad_simpsons_mem(f, a, fa, b, fb):             # <<<<<<<<<<<<<<
 *         """Evaluates the Simpson's Rule, also returning m and f(m) to reuse"""
 *         m = 0.5 * (a + b)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_34_internal_adaptative_simpsons_rule_1_quad_simpsons_mem(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_7builtin_7numeric_34_internal_adaptative_simpsons_rule__quad_simpsons_mem[] = "Evaluates the Simpson's Rule, also returning m and f(m) to reuse";
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_34_internal_adaptative_simpsons_rule_1_quad_simpsons_mem = {"_quad_simpsons_mem", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_34_internal_adaptative_simpsons_rule_1_quad_simpsons_mem, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_7builtin_7numeric_34_internal_adaptative_simpsons_rule__quad_simpsons_mem};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_34_internal_adaptative_simpsons_rule_1_quad_simpsons_mem(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_f = 0;
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_v_fa = 0;
  PyObject *__pyx_v_b = 0;
  PyObject *__pyx_v_fb = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_quad_simpsons_mem (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_f,&__pyx_n_s_a,&__pyx_n_s_fa,&__pyx_n_s_b,&__pyx_n_s_fb,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_f)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_a)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_quad_simpsons_mem", 1, 5, 5, 1); __PYX_ERR(0, 287, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fa)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_quad_simpsons_mem", 1, 5, 5, 2); __PYX_ERR(0, 287, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_quad_simpsons_mem", 1, 5, 5, 3); __PYX_ERR(0, 287, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fb)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_quad_simpsons_mem", 1, 5, 5, 4); __PYX_ERR(0, 287, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_quad_simpsons_mem") < 0)) __PYX_ERR(0, 287, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
    }
    __pyx_v_f = values[0];
    __pyx_v_a = values[1];
    __pyx_v_fa = values[2];
    __pyx_v_b = values[3];
    __pyx_v_fb = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_quad_simpsons_mem", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 287, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric._internal_adaptative_simpsons_rule._quad_simpsons_mem", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_34_internal_adaptative_simpsons_rule__quad_simpsons_mem(__pyx_self, __pyx_v_f, __pyx_v_a, __pyx_v_fa, __pyx_v_b, __pyx_v_fb);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_34_internal_adaptative_simpsons_rule__quad_simpsons_mem(PyObject *__pyx_self, PyObject *__pyx_v_f, PyObject *__pyx_v_a, PyObject *__pyx_v_fa, PyObject *__pyx_v_b, PyObject *__pyx_v_fb) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule *__pyx_cur_scope;
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule *__pyx_outer_scope;
  PyObject *__pyx_v_m = NULL;
  PyObject *__pyx_v_fm = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_quad_simpsons_mem", 0);
  __pyx_outer_scope = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "mathics/builtin/numeric.py":289
 *     def _quad_simpsons_mem(f, a, fa, b, fb):
 *         """Evaluates the Simpson's Rule, also returning m and f(m) to reuse"""
 *         m = 0.5 * (a + b)             # <<<<<<<<<<<<<<
 *         try:
 *             fm = f(m)
 */
  __pyx_t_1 = PyNumber_Add(__pyx_v_a, __pyx_v_b); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Multiply(__pyx_float_0_5, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_m = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":290
 *         """Evaluates the Simpson's Rule, also returning m and f(m) to reuse"""
 *         m = 0.5 * (a + b)
 *         try:             # <<<<<<<<<<<<<<
 *             fm = f(m)
 *         except ZeroDivisionError:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "mathics/builtin/numeric.py":291
 *         m = 0.5 * (a + b)
 *         try:
 *             fm = f(m)             # <<<<<<<<<<<<<<
 *         except ZeroDivisionError:
 *             fm = None
 */
      __Pyx_INCREF(__pyx_v_f);
      __pyx_t_1 = __pyx_v_f; __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_v_m) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_m);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 291, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_fm = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "mathics/builtin/numeric.py":290
 *         """Evaluates the Simpson's Rule, also returning m and f(m) to reuse"""
 *         m = 0.5 * (a + b)
 *         try:             # <<<<<<<<<<<<<<
 *             fm = f(m)
 *         except ZeroDivisionError:
 */
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "mathics/builtin/numeric.py":292
 *         try:
 *             fm = f(m)
 *         except ZeroDivisionError:             # <<<<<<<<<<<<<<
 *             fm = None
 * 
 */
    __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ZeroDivisionError);
    if (__pyx_t_7) {
      __Pyx_AddTraceback("mathics.builtin.numeric._internal_adaptative_simpsons_rule._quad_simpsons_mem", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_6) < 0) __PYX_ERR(0, 292, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_6);

      /* "mathics/builtin/numeric.py":293
 *             fm = f(m)
 *         except ZeroDivisionError:
 *             fm = None             # <<<<<<<<<<<<<<
 * 
 *         if fm is None or np.isinf(fm):
 */
      __Pyx_INCREF(Py_None);
      __Pyx_XDECREF_SET(__pyx_v_fm, Py_None);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "mathics/builtin/numeric.py":290
 *         """Evaluates the Simpson's Rule, also returning m and f(m) to reuse"""
 *         m = 0.5 * (a + b)
 *         try:             # <<<<<<<<<<<<<<
 *             fm = f(m)
 *         except ZeroDivisionError:
 */
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    __pyx_L8_try_end:;
  }

  /* "mathics/builtin/numeric.py":295
 *             fm = None
 * 
 *         if fm is None or np.isinf(fm):             # <<<<<<<<<<<<<<
 *             m = m + 1e-10
 *             fm = f(m)
 */
  __pyx_t_9 = (__pyx_v_fm == Py_None);
  __pyx_t_10 = (__pyx_t_9 != 0);
  if (!__pyx_t_10) {
  } else {
    __pyx_t_8 = __pyx_t_10;
    goto __pyx_L12_bool_binop_done;
  }
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_isinf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_6 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_v_fm) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_fm);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 295, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_8 = __pyx_t_10;
  __pyx_L12_bool_binop_done:;
  if (__pyx_t_8) {

    /* "mathics/builtin/numeric.py":296
 * 
 *         if fm is None or np.isinf(fm):
 *             m = m + 1e-10             # <<<<<<<<<<<<<<
 *             fm = f(m)
 *         return (m, fm, wsr * abs(b - a) * (fa + 4.0 * fm + fb))
 */
    __pyx_t_6 = __Pyx_PyFloat_AddObjC(__pyx_v_m, __pyx_float_1eneg_10, 1e-10, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 296, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF_SET(__pyx_v_m, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "mathics/builtin/numeric.py":297
 *         if fm is None or np.isinf(fm):
 *             m = m + 1e-10
 *             fm = f(m)             # <<<<<<<<<<<<<<
 *         return (m, fm, wsr * abs(b - a) * (fa + 4.0 * fm + fb))
 * 
 */
    __Pyx_INCREF(__pyx_v_f);
    __pyx_t_2 = __pyx_v_f; __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_6 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_v_m) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_m);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 297, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_fm, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "mathics/builtin/numeric.py":295
 *             fm = None
 * 
 *         if fm is None or np.isinf(fm):             # <<<<<<<<<<<<<<
 *             m = m + 1e-10
 *             fm = f(m)
 */
  }

  /* "mathics/builtin/numeric.py":298
 *             m = m + 1e-10
 *             fm = f(m)
 *         return (m, fm, wsr * abs(b - a) * (fa + 4.0 * fm + fb))             # <<<<<<<<<<<<<<
 * 
 *     def _quad_asr(f, a, fa, b, fb, eps, whole, m, fm, maxrec):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = PyFloat_FromDouble(__pyx_cur_scope->__pyx_v_wsr); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = PyNumber_Subtract(__pyx_v_b, __pyx_v_a); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyNumber_Absolute(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Multiply(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Multiply(__pyx_float_4_0, __pyx_v_fm); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = PyNumber_Add(__pyx_v_fa, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_t_6, __pyx_v_fb); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyNumber_Multiply(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_m);
  __Pyx_GIVEREF(__pyx_v_m);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_m);
  __Pyx_INCREF(__pyx_v_fm);
  __Pyx_GIVEREF(__pyx_v_fm);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_fm);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/builtin/numeric.py":287
 *         maxrec = 150
 * 
 *     def _quad_simpsons_mem(f, a, fa, b, fb):             # <<<<<<<<<<<<<<
 *         """Evaluates the Simpson's Rule, also returning m and f(m) to reuse"""
 *         m = 0.5 * (a + b)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("mathics.builtin.numeric._internal_adaptative_simpsons_rule._quad_simpsons_mem", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_m);
  __Pyx_XDECREF(__pyx_v_fm);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":300
 *         return (m, fm, wsr * abs(b - a) * (fa + 4.0 * fm + fb))
 * 
 *     def _quad_asr(f, a, fa, b, fb, eps, whole, m, fm, maxrec):             # <<<<<<<<<<<<<<
 *         """
 *         Efficient recursive implementation of adaptive Simpson's rule.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_34_internal_adaptative_simpsons_rule_3_quad_asr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_7builtin_7numeric_34_internal_adaptative_simpsons_rule_2_quad_asr[] = "\n        Efficient recursive implementation of adaptive Simpson's rule.\n        Function values at the start, middle, end of the intervals\n        are retained.\n        ";
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_34_internal_adaptative_simpsons_rule_3_quad_asr = {"_quad_asr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_34_internal_adaptative_simpsons_rule_3_quad_asr, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_7builtin_7numeric_34_internal_adaptative_simpsons_rule_2_quad_asr};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_34_internal_adaptative_simpsons_rule_3_quad_asr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_f = 0;
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_v_fa = 0;
  PyObject *__pyx_v_b = 0;
  PyObject *__pyx_v_fb = 0;
  PyObject *__pyx_v_eps = 0;
  PyObject *__pyx_v_whole = 0;
  PyObject *__pyx_v_m = 0;
  PyObject *__pyx_v_fm = 0;
  PyObject *__pyx_v_maxrec = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_quad_asr (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_f,&__pyx_n_s_a,&__pyx_n_s_fa,&__pyx_n_s_b,&__pyx_n_s_fb,&__pyx_n_s_eps,&__pyx_n_s_whole,&__pyx_n_s_m,&__pyx_n_s_fm,&__pyx_n_s_maxrec,0};
    PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_f)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_a)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_quad_asr", 1, 10, 10, 1); __PYX_ERR(0, 300, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fa)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_quad_asr", 1, 10, 10, 2); __PYX_ERR(0, 300, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_quad_asr", 1, 10, 10, 3); __PYX_ERR(0, 300, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fb)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_quad_asr", 1, 10, 10, 4); __PYX_ERR(0, 300, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_eps)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_quad_asr", 1, 10, 10, 5); __PYX_ERR(0, 300, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_whole)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_quad_asr", 1, 10, 10, 6); __PYX_ERR(0, 300, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_m)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_quad_asr", 1, 10, 10, 7); __PYX_ERR(0, 300, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fm)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_quad_asr", 1, 10, 10, 8); __PYX_ERR(0, 300, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxrec)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_quad_asr", 1, 10, 10, 9); __PYX_ERR(0, 300, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_quad_asr") < 0)) __PYX_ERR(0, 300, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 10) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
      values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
      values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
    }
    __pyx_v_f = values[0];
    __pyx_v_a = values[1];
    __pyx_v_fa = values[2];
    __pyx_v_b = values[3];
    __pyx_v_fb = values[4];
    __pyx_v_eps = values[5];
    __pyx_v_whole = values[6];
    __pyx_v_m = values[7];
    __pyx_v_fm = values[8];
    __pyx_v_maxrec = values[9];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_quad_asr", 1, 10, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 300, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric._internal_adaptative_simpsons_rule._quad_asr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_34_internal_adaptative_simpsons_rule_2_quad_asr(__pyx_self, __pyx_v_f, __pyx_v_a, __pyx_v_fa, __pyx_v_b, __pyx_v_fb, __pyx_v_eps, __pyx_v_whole, __pyx_v_m, __pyx_v_fm, __pyx_v_maxrec);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_34_internal_adaptative_simpsons_rule_2_quad_asr(PyObject *__pyx_self, PyObject *__pyx_v_f, PyObject *__pyx_v_a, PyObject *__pyx_v_fa, PyObject *__pyx_v_b, PyObject *__pyx_v_fb, PyObject *__pyx_v_eps, PyObject *__pyx_v_whole, PyObject *__pyx_v_m, PyObject *__pyx_v_fm, PyObject *__pyx_v_maxrec) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule *__pyx_cur_scope;
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule *__pyx_outer_scope;
  PyObject *__pyx_v_left = NULL;
  PyObject *__pyx_v_lm = NULL;
  PyObject *__pyx_v_flm = NULL;
  PyObject *__pyx_v_right = NULL;
  PyObject *__pyx_v_rm = NULL;
  PyObject *__pyx_v_frm = NULL;
  PyObject *__pyx_v_delta = NULL;
  PyObject *__pyx_v_err = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_quad_asr", 0);
  __pyx_outer_scope = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;
  __Pyx_INCREF(__pyx_v_maxrec);

  /* "mathics/builtin/numeric.py":306
 *         are retained.
 *         """
 *         maxrec = maxrec - 1             # <<<<<<<<<<<<<<
 *         try:
 *             left = _quad_simpsons_mem(f, a, fa, m, fm)
 */
  __pyx_t_1 = __Pyx_PyInt_SubtractObjC(__pyx_v_maxrec, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_maxrec, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":307
 *         """
 *         maxrec = maxrec - 1
 *         try:             # <<<<<<<<<<<<<<
 *             left = _quad_simpsons_mem(f, a, fa, m, fm)
 *             lm, flm, left = left
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    /*try:*/ {

      /* "mathics/builtin/numeric.py":308
 *         maxrec = maxrec - 1
 *         try:
 *             left = _quad_simpsons_mem(f, a, fa, m, fm)             # <<<<<<<<<<<<<<
 *             lm, flm, left = left
 *             right = _quad_simpsons_mem(f, m, fm, b, fb)
 */
      if (unlikely(!__pyx_cur_scope->__pyx_v__quad_simpsons_mem)) { __Pyx_RaiseClosureNameError("_quad_simpsons_mem"); __PYX_ERR(0, 308, __pyx_L3_error) }
      __pyx_t_1 = __pyx_pf_7mathics_7builtin_7numeric_34_internal_adaptative_simpsons_rule__quad_simpsons_mem(__pyx_cur_scope->__pyx_v__quad_simpsons_mem, __pyx_v_f, __pyx_v_a, __pyx_v_fa, __pyx_v_m, __pyx_v_fm); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 308, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_left = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "mathics/builtin/numeric.py":309
 *         try:
 *             left = _quad_simpsons_mem(f, a, fa, m, fm)
 *             lm, flm, left = left             # <<<<<<<<<<<<<<
 *             right = _quad_simpsons_mem(f, m, fm, b, fb)
 *             rm, frm, right = right
 */
      if ((likely(PyTuple_CheckExact(__pyx_v_left))) || (PyList_CheckExact(__pyx_v_left))) {
        PyObject* sequence = __pyx_v_left;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 3)) {
          if (size > 3) __Pyx_RaiseTooManyValuesError(3);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 309, __pyx_L3_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
          __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
        } else {
          __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
          __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
        }
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        #else
        __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 309, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 309, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 309, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_6);
        #endif
      } else {
        Py_ssize_t index = -1;
        __pyx_t_7 = PyObject_GetIter(__pyx_v_left); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 309, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
        index = 0; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L9_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_1);
        index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L9_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_5);
        index = 2; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L9_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_6);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 3) < 0) __PYX_ERR(0, 309, __pyx_L3_error)
        __pyx_t_8 = NULL;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L10_unpacking_done;
        __pyx_L9_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_8 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 309, __pyx_L3_error)
        __pyx_L10_unpacking_done:;
      }
      __pyx_v_lm = __pyx_t_1;
      __pyx_t_1 = 0;
      __pyx_v_flm = __pyx_t_5;
      __pyx_t_5 = 0;
      __Pyx_DECREF_SET(__pyx_v_left, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "mathics/builtin/numeric.py":310
 *             left = _quad_simpsons_mem(f, a, fa, m, fm)
 *             lm, flm, left = left
 *             right = _quad_simpsons_mem(f, m, fm, b, fb)             # <<<<<<<<<<<<<<
 *             rm, frm, right = right
 * 
 */
      if (unlikely(!__pyx_cur_scope->__pyx_v__quad_simpsons_mem)) { __Pyx_RaiseClosureNameError("_quad_simpsons_mem"); __PYX_ERR(0, 310, __pyx_L3_error) }
      __pyx_t_6 = __pyx_pf_7mathics_7builtin_7numeric_34_internal_adaptative_simpsons_rule__quad_simpsons_mem(__pyx_cur_scope->__pyx_v__quad_simpsons_mem, __pyx_v_f, __pyx_v_m, __pyx_v_fm, __pyx_v_b, __pyx_v_fb); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 310, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_v_right = __pyx_t_6;
      __pyx_t_6 = 0;

      /* "mathics/builtin/numeric.py":311
 *             lm, flm, left = left
 *             right = _quad_simpsons_mem(f, m, fm, b, fb)
 *             rm, frm, right = right             # <<<<<<<<<<<<<<
 * 
 *             delta = left + right - whole
 */
      if ((likely(PyTuple_CheckExact(__pyx_v_right))) || (PyList_CheckExact(__pyx_v_right))) {
        PyObject* sequence = __pyx_v_right;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 3)) {
          if (size > 3) __Pyx_RaiseTooManyValuesError(3);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 311, __pyx_L3_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
          __pyx_t_1 = PyTuple_GET_ITEM(sequence, 2); 
        } else {
          __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
          __pyx_t_1 = PyList_GET_ITEM(sequence, 2); 
        }
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_1);
        #else
        __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 311, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 311, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_1 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 311, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        Py_ssize_t index = -1;
        __pyx_t_7 = PyObject_GetIter(__pyx_v_right); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 311, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
        index = 0; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_6);
        index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_5);
        index = 2; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_1);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 3) < 0) __PYX_ERR(0, 311, __pyx_L3_error)
        __pyx_t_8 = NULL;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L12_unpacking_done;
        __pyx_L11_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_8 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 311, __pyx_L3_error)
        __pyx_L12_unpacking_done:;
      }
      __pyx_v_rm = __pyx_t_6;
      __pyx_t_6 = 0;
      __pyx_v_frm = __pyx_t_5;
      __pyx_t_5 = 0;
      __Pyx_DECREF_SET(__pyx_v_right, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "mathics/builtin/numeric.py":313
 *             rm, frm, right = right
 * 
 *             delta = left + right - whole             # <<<<<<<<<<<<<<
 *             err = abs(delta)
 *             if err <= 15 * eps or maxrec == 0:
 */
      __pyx_t_1 = PyNumber_Add(__pyx_v_left, __pyx_v_right); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 313, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = PyNumber_Subtract(__pyx_t_1, __pyx_v_whole); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 313, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_delta = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "mathics/builtin/numeric.py":314
 * 
 *             delta = left + right - whole
 *             err = abs(delta)             # <<<<<<<<<<<<<<
 *             if err <= 15 * eps or maxrec == 0:
 *                 return (left + right + delta / 15, err)
 */
      __pyx_t_5 = __Pyx_PyNumber_Absolute(__pyx_v_delta); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 314, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_v_err = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "mathics/builtin/numeric.py":315
 *             delta = left + right - whole
 *             err = abs(delta)
 *             if err <= 15 * eps or maxrec == 0:             # <<<<<<<<<<<<<<
 *                 return (left + right + delta / 15, err)
 *             left = _quad_asr(f, a, fa, m, fm, 0.5 * eps, left, lm, flm, maxrec)
 */
      __pyx_t_5 = PyNumber_Multiply(__pyx_int_15, __pyx_v_eps); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 315, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = PyObject_RichCompare(__pyx_v_err, __pyx_t_5, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 315, __pyx_L3_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 315, __pyx_L3_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (!__pyx_t_10) {
      } else {
        __pyx_t_9 = __pyx_t_10;
        goto __pyx_L14_bool_binop_done;
      }
      __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_maxrec, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 315, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 315, __pyx_L3_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_9 = __pyx_t_10;
      __pyx_L14_bool_binop_done:;
      if (__pyx_t_9) {

        /* "mathics/builtin/numeric.py":316
 *             err = abs(delta)
 *             if err <= 15 * eps or maxrec == 0:
 *                 return (left + right + delta / 15, err)             # <<<<<<<<<<<<<<
 *             left = _quad_asr(f, a, fa, m, fm, 0.5 * eps, left, lm, flm, maxrec)
 *             right = _quad_asr(f, m, fm, b, fb, 0.5 * eps, right, rm, frm, maxrec)
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_1 = PyNumber_Add(__pyx_v_left, __pyx_v_right); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 316, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_5 = __Pyx_PyInt_TrueDivideObjC(__pyx_v_delta, __pyx_int_15, 15, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 316, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = PyNumber_Add(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 316, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 316, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6);
        __Pyx_INCREF(__pyx_v_err);
        __Pyx_GIVEREF(__pyx_v_err);
        PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_err);
        __pyx_t_6 = 0;
        __pyx_r = __pyx_t_5;
        __pyx_t_5 = 0;
        goto __pyx_L7_try_return;

        /* "mathics/builtin/numeric.py":315
 *             delta = left + right - whole
 *             err = abs(delta)
 *             if err <= 15 * eps or maxrec == 0:             # <<<<<<<<<<<<<<
 *                 return (left + right + delta / 15, err)
 *             left = _quad_asr(f, a, fa, m, fm, 0.5 * eps, left, lm, flm, maxrec)
 */
      }

      /* "mathics/builtin/numeric.py":317
 *             if err <= 15 * eps or maxrec == 0:
 *                 return (left + right + delta / 15, err)
 *             left = _quad_asr(f, a, fa, m, fm, 0.5 * eps, left, lm, flm, maxrec)             # <<<<<<<<<<<<<<
 *             right = _quad_asr(f, m, fm, b, fb, 0.5 * eps, right, rm, frm, maxrec)
 *             return (left[0] + right[0], left[1] + right[1])
 */
      __pyx_t_5 = PyNumber_Multiply(__pyx_float_0_5, __pyx_v_eps); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 317, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (unlikely(!__pyx_cur_scope->__pyx_v__quad_asr)) { __Pyx_RaiseClosureNameError("_quad_asr"); __PYX_ERR(0, 317, __pyx_L3_error) }
      __pyx_t_6 = __pyx_pf_7mathics_7builtin_7numeric_34_internal_adaptative_simpsons_rule_2_quad_asr(__pyx_cur_scope->__pyx_v__quad_asr, __pyx_v_f, __pyx_v_a, __pyx_v_fa, __pyx_v_m, __pyx_v_fm, __pyx_t_5, __pyx_v_left, __pyx_v_lm, __pyx_v_flm, __pyx_v_maxrec); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 317, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF_SET(__pyx_v_left, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "mathics/builtin/numeric.py":318
 *                 return (left + right + delta / 15, err)
 *             left = _quad_asr(f, a, fa, m, fm, 0.5 * eps, left, lm, flm, maxrec)
 *             right = _quad_asr(f, m, fm, b, fb, 0.5 * eps, right, rm, frm, maxrec)             # <<<<<<<<<<<<<<
 *             return (left[0] + right[0], left[1] + right[1])
 *         except Exception:
 */
      __pyx_t_6 = PyNumber_Multiply(__pyx_float_0_5, __pyx_v_eps); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 318, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (unlikely(!__pyx_cur_scope->__pyx_v__quad_asr)) { __Pyx_RaiseClosureNameError("_quad_asr"); __PYX_ERR(0, 318, __pyx_L3_error) }
      __pyx_t_5 = __pyx_pf_7mathics_7builtin_7numeric_34_internal_adaptative_simpsons_rule_2_quad_asr(__pyx_cur_scope->__pyx_v__quad_asr, __pyx_v_f, __pyx_v_m, __pyx_v_fm, __pyx_v_b, __pyx_v_fb, __pyx_t_6, __pyx_v_right, __pyx_v_rm, __pyx_v_frm, __pyx_v_maxrec); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 318, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF_SET(__pyx_v_right, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "mathics/builtin/numeric.py":319
 *             left = _quad_asr(f, a, fa, m, fm, 0.5 * eps, left, lm, flm, maxrec)
 *             right = _quad_asr(f, m, fm, b, fb, 0.5 * eps, right, rm, frm, maxrec)
 *             return (left[0] + right[0], left[1] + right[1])             # <<<<<<<<<<<<<<
 *         except Exception:
 *             raise
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_left, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 319, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_right, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 319, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_1 = PyNumber_Add(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 319, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_left, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 319, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_right, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 319, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = PyNumber_Add(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 319, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 319, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7);
      __pyx_t_1 = 0;
      __pyx_t_7 = 0;
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L7_try_return;

      /* "mathics/builtin/numeric.py":307
 *         """
 *         maxrec = maxrec - 1
 *         try:             # <<<<<<<<<<<<<<
 *             left = _quad_simpsons_mem(f, a, fa, m, fm)
 *             lm, flm, left = left
 */
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "mathics/builtin/numeric.py":320
 *             right = _quad_asr(f, m, fm, b, fb, 0.5 * eps, right, rm, frm, maxrec)
 *             return (left[0] + right[0], left[1] + right[1])
 *         except Exception:             # <<<<<<<<<<<<<<
 *             raise
 * 
 */
    __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_11) {
      __Pyx_AddTraceback("mathics.builtin.numeric._internal_adaptative_simpsons_rule._quad_asr", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_7, &__pyx_t_1) < 0) __PYX_ERR(0, 320, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_1);

      /* "mathics/builtin/numeric.py":321
 *             return (left[0] + right[0], left[1] + right[1])
 *         except Exception:
 *             raise             # <<<<<<<<<<<<<<
 * 
 *     def ensure_evaluation(f, x):
 */
      __Pyx_GIVEREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_1);
      __Pyx_ErrRestoreWithState(__pyx_t_5, __pyx_t_7, __pyx_t_1);
      __pyx_t_5 = 0; __pyx_t_7 = 0; __pyx_t_1 = 0; 
      __PYX_ERR(0, 321, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "mathics/builtin/numeric.py":307
 *         """
 *         maxrec = maxrec - 1
 *         try:             # <<<<<<<<<<<<<<
 *             left = _quad_simpsons_mem(f, a, fa, m, fm)
 *             lm, flm, left = left
 */
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L1_error;
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L0;
  }

  /* "mathics/builtin/numeric.py":300
 *         return (m, fm, wsr * abs(b - a) * (fa + 4.0 * fm + fb))
 * 
 *     def _quad_asr(f, a, fa, b, fb, eps, whole, m, fm, maxrec):             # <<<<<<<<<<<<<<
 *         """
 *         Efficient recursive implementation of adaptive Simpson's rule.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("mathics.builtin.numeric._internal_adaptative_simpsons_rule._quad_asr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_left);
  __Pyx_XDECREF(__pyx_v_lm);
  __Pyx_XDECREF(__pyx_v_flm);
  __Pyx_XDECREF(__pyx_v_right);
  __Pyx_XDECREF(__pyx_v_rm);
  __Pyx_XDECREF(__pyx_v_frm);
  __Pyx_XDECREF(__pyx_v_delta);
  __Pyx_XDECREF(__pyx_v_err);
  __Pyx_XDECREF(__pyx_v_maxrec);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":323
 *             raise
 * 
 *     def ensure_evaluation(f, x):             # <<<<<<<<<<<<<<
 *         try:
 *             val = f(x)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_34_internal_adaptative_simpsons_rule_5ensure_evaluation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_34_internal_adaptative_simpsons_rule_5ensure_evaluation = {"ensure_evaluation", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_34_internal_adaptative_simpsons_rule_5ensure_evaluation, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_34_internal_adaptative_simpsons_rule_5ensure_evaluation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_f = 0;
  PyObject *__pyx_v_x = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ensure_evaluation (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_f,&__pyx_n_s_x,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_f)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ensure_evaluation", 1, 2, 2, 1); __PYX_ERR(0, 323, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ensure_evaluation") < 0)) __PYX_ERR(0, 323, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_f = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ensure_evaluation", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 323, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric._internal_adaptative_simpsons_rule.ensure_evaluation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_34_internal_adaptative_simpsons_rule_4ensure_evaluation(__pyx_self, __pyx_v_f, __pyx_v_x);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_34_internal_adaptative_simpsons_rule_4ensure_evaluation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_f, PyObject *__pyx_v_x) {
  PyObject *__pyx_v_val = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ensure_evaluation", 0);

  /* "mathics/builtin/numeric.py":324
 * 
 *     def ensure_evaluation(f, x):
 *         try:             # <<<<<<<<<<<<<<
 *             val = f(x)
 *         except ZeroDivisionError:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "mathics/builtin/numeric.py":325
 *     def ensure_evaluation(f, x):
 *         try:
 *             val = f(x)             # <<<<<<<<<<<<<<
 *         except ZeroDivisionError:
 *             return None
 */
      __Pyx_INCREF(__pyx_v_f);
      __pyx_t_5 = __pyx_v_f; __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_v_x) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_x);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 325, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_val = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "mathics/builtin/numeric.py":324
 * 
 *     def ensure_evaluation(f, x):
 *         try:             # <<<<<<<<<<<<<<
 *             val = f(x)
 *         except ZeroDivisionError:
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "mathics/builtin/numeric.py":326
 *         try:
 *             val = f(x)
 *         except ZeroDivisionError:             # <<<<<<<<<<<<<<
 *             return None
 *         if np.isinf(val):
 */
    __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ZeroDivisionError);
    if (__pyx_t_7) {
      __Pyx_AddTraceback("mathics.builtin.numeric._internal_adaptative_simpsons_rule.ensure_evaluation", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6) < 0) __PYX_ERR(0, 326, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);

      /* "mathics/builtin/numeric.py":327
 *             val = f(x)
 *         except ZeroDivisionError:
 *             return None             # <<<<<<<<<<<<<<
 *         if np.isinf(val):
 *             return None
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "mathics/builtin/numeric.py":324
 * 
 *     def ensure_evaluation(f, x):
 *         try:             # <<<<<<<<<<<<<<
 *             val = f(x)
 *         except ZeroDivisionError:
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L8_try_end:;
  }

  /* "mathics/builtin/numeric.py":328
 *         except ZeroDivisionError:
 *             return None
 *         if np.isinf(val):             # <<<<<<<<<<<<<<
 *             return None
 *         return val
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 328, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_isinf); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 328, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_6 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_val) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_val);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 328, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 328, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__pyx_t_8) {

    /* "mathics/builtin/numeric.py":329
 *             return None
 *         if np.isinf(val):
 *             return None             # <<<<<<<<<<<<<<
 *         return val
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "mathics/builtin/numeric.py":328
 *         except ZeroDivisionError:
 *             return None
 *         if np.isinf(val):             # <<<<<<<<<<<<<<
 *             return None
 *         return val
 */
  }

  /* "mathics/builtin/numeric.py":330
 *         if np.isinf(val):
 *             return None
 *         return val             # <<<<<<<<<<<<<<
 * 
 *     invert_interval = False
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_val);
  __pyx_r = __pyx_v_val;
  goto __pyx_L0;

  /* "mathics/builtin/numeric.py":323
 *             raise
 * 
 *     def ensure_evaluation(f, x):             # <<<<<<<<<<<<<<
 *         try:
 *             val = f(x)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("mathics.builtin.numeric._internal_adaptative_simpsons_rule.ensure_evaluation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_val);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":269
 * 
 * 
 * def _internal_adaptative_simpsons_rule(f, a, b, **opts):             # <<<<<<<<<<<<<<
 *     """
 *     1D adaptative Simpson's rule integrator
 */

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_4_internal_adaptative_simpsons_rule(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_f, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_opts) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule *__pyx_cur_scope;
  PyObject *__pyx_v_tol = NULL;
  PyObject *__pyx_v_maxrec = NULL;
  PyObject *__pyx_v_ensure_evaluation = 0;
  int __pyx_v_invert_interval;
  PyObject *__pyx_v_fa = NULL;
  PyObject *__pyx_v_fb = NULL;
  PyObject *__pyx_v_x = NULL;
  PyObject *__pyx_v_m = NULL;
  PyObject *__pyx_v_fm = NULL;
  PyObject *__pyx_v_whole = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  Py_UCS4 __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *(*__pyx_t_10)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_internal_adaptative_simpsons_rule", 0);
  __pyx_cur_scope = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule *)__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule(__pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 269, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __Pyx_INCREF(__pyx_v_a);
  __Pyx_INCREF(__pyx_v_b);

  /* "mathics/builtin/numeric.py":277
 *     TODO: handle weak divergences
 *     """
 *     wsr = 1.0 / 6.0             # <<<<<<<<<<<<<<
 * 
 *     tol = opts.get("tol")
 */
  __pyx_cur_scope->__pyx_v_wsr = (1.0 / 6.0);

  /* "mathics/builtin/numeric.py":279
 *     wsr = 1.0 / 6.0
 * 
 *     tol = opts.get("tol")             # <<<<<<<<<<<<<<
 *     if not tol:
 *         tol = 1.0e-10
 */
  __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_opts, __pyx_n_u_tol, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 279, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_tol = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":280
 * 
 *     tol = opts.get("tol")
 *     if not tol:             # <<<<<<<<<<<<<<
 *         tol = 1.0e-10
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_tol); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 280, __pyx_L1_error)
  __pyx_t_3 = ((!__pyx_t_2) != 0);
  if (__pyx_t_3) {

    /* "mathics/builtin/numeric.py":281
 *     tol = opts.get("tol")
 *     if not tol:
 *         tol = 1.0e-10             # <<<<<<<<<<<<<<
 * 
 *     maxrec = opts.get("maxrec")
 */
    __Pyx_INCREF(__pyx_float_1_0eneg_10);
    __Pyx_DECREF_SET(__pyx_v_tol, __pyx_float_1_0eneg_10);

    /* "mathics/builtin/numeric.py":280
 * 
 *     tol = opts.get("tol")
 *     if not tol:             # <<<<<<<<<<<<<<
 *         tol = 1.0e-10
 * 
 */
  }

  /* "mathics/builtin/numeric.py":283
 *         tol = 1.0e-10
 * 
 *     maxrec = opts.get("maxrec")             # <<<<<<<<<<<<<<
 *     if not maxrec:
 *         maxrec = 150
 */
  __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_opts, __pyx_n_u_maxrec, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 283, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_maxrec = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":284
 * 
 *     maxrec = opts.get("maxrec")
 *     if not maxrec:             # <<<<<<<<<<<<<<
 *         maxrec = 150
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_maxrec); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 284, __pyx_L1_error)
  __pyx_t_2 = ((!__pyx_t_3) != 0);
  if (__pyx_t_2) {

    /* "mathics/builtin/numeric.py":285
 *     maxrec = opts.get("maxrec")
 *     if not maxrec:
 *         maxrec = 150             # <<<<<<<<<<<<<<
 * 
 *     def _quad_simpsons_mem(f, a, fa, b, fb):
 */
    __Pyx_INCREF(__pyx_int_150);
    __Pyx_DECREF_SET(__pyx_v_maxrec, __pyx_int_150);

    /* "mathics/builtin/numeric.py":284
 * 
 *     maxrec = opts.get("maxrec")
 *     if not maxrec:             # <<<<<<<<<<<<<<
 *         maxrec = 150
 * 
 */
  }

  /* "mathics/builtin/numeric.py":287
 *         maxrec = 150
 * 
 *     def _quad_simpsons_mem(f, a, fa, b, fb):             # <<<<<<<<<<<<<<
 *         """Evaluates the Simpson's Rule, also returning m and f(m) to reuse"""
 *         m = 0.5 * (a + b)
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_34_internal_adaptative_simpsons_rule_1_quad_simpsons_mem, 0, __pyx_n_s_internal_adaptative_simpsons_ru, ((PyObject*)__pyx_cur_scope), __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__9)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v__quad_simpsons_mem = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":300
 *         return (m, fm, wsr * abs(b - a) * (fa + 4.0 * fm + fb))
 * 
 *     def _quad_asr(f, a, fa, b, fb, eps, whole, m, fm, maxrec):             # <<<<<<<<<<<<<<
 *         """
 *         Efficient recursive implementation of adaptive Simpson's rule.
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_34_internal_adaptative_simpsons_rule_3_quad_asr, 0, __pyx_n_s_internal_adaptative_simpsons_ru_2, ((PyObject*)__pyx_cur_scope), __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__11)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v__quad_asr = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":323
 *             raise
 * 
 *     def ensure_evaluation(f, x):             # <<<<<<<<<<<<<<
 *         try:
 *             val = f(x)
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_34_internal_adaptative_simpsons_rule_5ensure_evaluation, 0, __pyx_n_s_internal_adaptative_simpsons_ru_3, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__13)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 323, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ensure_evaluation = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":332
 *         return val
 * 
 *     invert_interval = False             # <<<<<<<<<<<<<<
 *     if a > b:
 *         b, a, invert_interval = a, b, True
 */
  __pyx_v_invert_interval = 0;

  /* "mathics/builtin/numeric.py":333
 * 
 *     invert_interval = False
 *     if a > b:             # <<<<<<<<<<<<<<
 *         b, a, invert_interval = a, b, True
 * 
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_a, __pyx_v_b, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 333, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 333, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "mathics/builtin/numeric.py":334
 *     invert_interval = False
 *     if a > b:
 *         b, a, invert_interval = a, b, True             # <<<<<<<<<<<<<<
 * 
 *     fa, fb = ensure_evaluation(f, a), ensure_evaluation(f, b)
 */
    __pyx_t_1 = __pyx_v_a;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_4 = __pyx_v_b;
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_2 = 1;
    __Pyx_DECREF_SET(__pyx_v_b, __pyx_t_1);
    __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_v_invert_interval = __pyx_t_2;

    /* "mathics/builtin/numeric.py":333
 * 
 *     invert_interval = False
 *     if a > b:             # <<<<<<<<<<<<<<
 *         b, a, invert_interval = a, b, True
 * 
 */
  }

  /* "mathics/builtin/numeric.py":336
 *         b, a, invert_interval = a, b, True
 * 
 *     fa, fb = ensure_evaluation(f, a), ensure_evaluation(f, b)             # <<<<<<<<<<<<<<
 *     if fa is None:
 *         x = 10.0 * machine_epsilon if a == 0 else a * (1.0 + 10.0 * machine_epsilon)
 */
  __pyx_t_4 = __pyx_pf_7mathics_7builtin_7numeric_34_internal_adaptative_simpsons_rule_4ensure_evaluation(__pyx_v_ensure_evaluation, __pyx_v_f, __pyx_v_a); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 336, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __pyx_pf_7mathics_7builtin_7numeric_34_internal_adaptative_simpsons_rule_4ensure_evaluation(__pyx_v_ensure_evaluation, __pyx_v_f, __pyx_v_b); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 336, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_fa = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_fb = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":337
 * 
 *     fa, fb = ensure_evaluation(f, a), ensure_evaluation(f, b)
 *     if fa is None:             # <<<<<<<<<<<<<<
 *         x = 10.0 * machine_epsilon if a == 0 else a * (1.0 + 10.0 * machine_epsilon)
 *         fa = ensure_evaluation(f, x)
 */
  __pyx_t_2 = (__pyx_v_fa == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "mathics/builtin/numeric.py":338
 *     fa, fb = ensure_evaluation(f, a), ensure_evaluation(f, b)
 *     if fa is None:
 *         x = 10.0 * machine_epsilon if a == 0 else a * (1.0 + 10.0 * machine_epsilon)             # <<<<<<<<<<<<<<
 *         fa = ensure_evaluation(f, x)
 *         if fa is None:
 */
    __pyx_t_4 = __Pyx_PyInt_EqObjC(__pyx_v_a, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 338, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 338, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_3) {
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_machine_epsilon); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 338, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyNumber_Multiply(__pyx_float_10_0, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 338, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_1 = __pyx_t_5;
      __pyx_t_5 = 0;
    } else {
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_machine_epsilon); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 338, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyNumber_Multiply(__pyx_float_10_0, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 338, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyFloat_AddCObj(__pyx_float_1_0, __pyx_t_4, 1.0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 338, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyNumber_Multiply(__pyx_v_a, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 338, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_1 = __pyx_t_4;
      __pyx_t_4 = 0;
    }
    __pyx_v_x = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "mathics/builtin/numeric.py":339
 *     if fa is None:
 *         x = 10.0 * machine_epsilon if a == 0 else a * (1.0 + 10.0 * machine_epsilon)
 *         fa = ensure_evaluation(f, x)             # <<<<<<<<<<<<<<
 *         if fa is None:
 *             raise Exception(f"Function undefined around {a}. Cannot integrate")
 */
    __pyx_t_1 = __pyx_pf_7mathics_7builtin_7numeric_34_internal_adaptative_simpsons_rule_4ensure_evaluation(__pyx_v_ensure_evaluation, __pyx_v_f, __pyx_v_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 339, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_fa, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "mathics/builtin/numeric.py":340
 *         x = 10.0 * machine_epsilon if a == 0 else a * (1.0 + 10.0 * machine_epsilon)
 *         fa = ensure_evaluation(f, x)
 *         if fa is None:             # <<<<<<<<<<<<<<
 *             raise Exception(f"Function undefined around {a}. Cannot integrate")
 *     if fb is None:
 */
    __pyx_t_3 = (__pyx_v_fa == Py_None);
    __pyx_t_2 = (__pyx_t_3 != 0);
    if (unlikely(__pyx_t_2)) {

      /* "mathics/builtin/numeric.py":341
 *         fa = ensure_evaluation(f, x)
 *         if fa is None:
 *             raise Exception(f"Function undefined around {a}. Cannot integrate")             # <<<<<<<<<<<<<<
 *     if fb is None:
 *         x = -10.0 * machine_epsilon if b == 0 else b * (1.0 - 10.0 * machine_epsilon)
 */
      __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 341, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = 0;
      __pyx_t_7 = 127;
      __Pyx_INCREF(__pyx_kp_u_Function_undefined_around);
      __pyx_t_6 += 26;
      __Pyx_GIVEREF(__pyx_kp_u_Function_undefined_around);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_Function_undefined_around);
      __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_a, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 341, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_7;
      __pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
      __pyx_t_4 = 0;
      __Pyx_INCREF(__pyx_kp_u_Cannot_integrate);
      __pyx_t_6 += 18;
      __Pyx_GIVEREF(__pyx_kp_u_Cannot_integrate);
      PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_Cannot_integrate);
      __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 3, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 341, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 341, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(0, 341, __pyx_L1_error)

      /* "mathics/builtin/numeric.py":340
 *         x = 10.0 * machine_epsilon if a == 0 else a * (1.0 + 10.0 * machine_epsilon)
 *         fa = ensure_evaluation(f, x)
 *         if fa is None:             # <<<<<<<<<<<<<<
 *             raise Exception(f"Function undefined around {a}. Cannot integrate")
 *     if fb is None:
 */
    }

    /* "mathics/builtin/numeric.py":337
 * 
 *     fa, fb = ensure_evaluation(f, a), ensure_evaluation(f, b)
 *     if fa is None:             # <<<<<<<<<<<<<<
 *         x = 10.0 * machine_epsilon if a == 0 else a * (1.0 + 10.0 * machine_epsilon)
 *         fa = ensure_evaluation(f, x)
 */
  }

  /* "mathics/builtin/numeric.py":342
 *         if fa is None:
 *             raise Exception(f"Function undefined around {a}. Cannot integrate")
 *     if fb is None:             # <<<<<<<<<<<<<<
 *         x = -10.0 * machine_epsilon if b == 0 else b * (1.0 - 10.0 * machine_epsilon)
 *         fb = ensure_evaluation(f, x)
 */
  __pyx_t_2 = (__pyx_v_fb == Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "mathics/builtin/numeric.py":343
 *             raise Exception(f"Function undefined around {a}. Cannot integrate")
 *     if fb is None:
 *         x = -10.0 * machine_epsilon if b == 0 else b * (1.0 - 10.0 * machine_epsilon)             # <<<<<<<<<<<<<<
 *         fb = ensure_evaluation(f, x)
 *         if fb is None:
 */
    __pyx_t_4 = __Pyx_PyInt_EqObjC(__pyx_v_b, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 343, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_3) {
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_machine_epsilon); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 343, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyNumber_Multiply(__pyx_float_neg_10_0, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 343, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_1 = __pyx_t_5;
      __pyx_t_5 = 0;
    } else {
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_machine_epsilon); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 343, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyNumber_Multiply(__pyx_float_10_0, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 343, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyFloat_SubtractCObj(__pyx_float_1_0, __pyx_t_4, 1.0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 343, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyNumber_Multiply(__pyx_v_b, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 343, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_1 = __pyx_t_4;
      __pyx_t_4 = 0;
    }
    __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "mathics/builtin/numeric.py":344
 *     if fb is None:
 *         x = -10.0 * machine_epsilon if b == 0 else b * (1.0 - 10.0 * machine_epsilon)
 *         fb = ensure_evaluation(f, x)             # <<<<<<<<<<<<<<
 *         if fb is None:
 *             raise Exception(f"Function undefined around {b}. Cannot integrate")
 */
    __pyx_t_1 = __pyx_pf_7mathics_7builtin_7numeric_34_internal_adaptative_simpsons_rule_4ensure_evaluation(__pyx_v_ensure_evaluation, __pyx_v_f, __pyx_v_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 344, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_fb, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "mathics/builtin/numeric.py":345
 *         x = -10.0 * machine_epsilon if b == 0 else b * (1.0 - 10.0 * machine_epsilon)
 *         fb = ensure_evaluation(f, x)
 *         if fb is None:             # <<<<<<<<<<<<<<
 *             raise Exception(f"Function undefined around {b}. Cannot integrate")
 * 
 */
    __pyx_t_3 = (__pyx_v_fb == Py_None);
    __pyx_t_2 = (__pyx_t_3 != 0);
    if (unlikely(__pyx_t_2)) {

      /* "mathics/builtin/numeric.py":346
 *         fb = ensure_evaluation(f, x)
 *         if fb is None:
 *             raise Exception(f"Function undefined around {b}. Cannot integrate")             # <<<<<<<<<<<<<<
 * 
 *     m, fm, whole = _quad_simpsons_mem(f, a, fa, b, fb)
 */
      __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 346, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = 0;
      __pyx_t_7 = 127;
      __Pyx_INCREF(__pyx_kp_u_Function_undefined_around);
      __pyx_t_6 += 26;
      __Pyx_GIVEREF(__pyx_kp_u_Function_undefined_around);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_Function_undefined_around);
      __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_b, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 346, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) > __pyx_t_7) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_4) : __pyx_t_7;
      __pyx_t_6 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
      __pyx_t_4 = 0;
      __Pyx_INCREF(__pyx_kp_u_Cannot_integrate);
      __pyx_t_6 += 18;
      __Pyx_GIVEREF(__pyx_kp_u_Cannot_integrate);
      PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_Cannot_integrate);
      __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 3, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 346, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 346, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(0, 346, __pyx_L1_error)

      /* "mathics/builtin/numeric.py":345
 *         x = -10.0 * machine_epsilon if b == 0 else b * (1.0 - 10.0 * machine_epsilon)
 *         fb = ensure_evaluation(f, x)
 *         if fb is None:             # <<<<<<<<<<<<<<
 *             raise Exception(f"Function undefined around {b}. Cannot integrate")
 * 
 */
    }

    /* "mathics/builtin/numeric.py":342
 *         if fa is None:
 *             raise Exception(f"Function undefined around {a}. Cannot integrate")
 *     if fb is None:             # <<<<<<<<<<<<<<
 *         x = -10.0 * machine_epsilon if b == 0 else b * (1.0 - 10.0 * machine_epsilon)
 *         fb = ensure_evaluation(f, x)
 */
  }

  /* "mathics/builtin/numeric.py":348
 *             raise Exception(f"Function undefined around {b}. Cannot integrate")
 * 
 *     m, fm, whole = _quad_simpsons_mem(f, a, fa, b, fb)             # <<<<<<<<<<<<<<
 *     if invert_interval:
 *         return -_quad_asr(f, a, fa, b, fb, tol, whole, m, fm, maxrec)
 */
  __pyx_t_1 = __pyx_pf_7mathics_7builtin_7numeric_34_internal_adaptative_simpsons_rule__quad_simpsons_mem(__pyx_cur_scope->__pyx_v__quad_simpsons_mem, __pyx_v_f, __pyx_v_a, __pyx_v_fa, __pyx_v_b, __pyx_v_fb); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 348, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_8 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_8);
    #else
    __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 348, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 348, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 348, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_9 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 348, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext;
    index = 0; __pyx_t_4 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_4)) goto __pyx_L10_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    index = 1; __pyx_t_5 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_5)) goto __pyx_L10_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    index = 2; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L10_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_8);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 3) < 0) __PYX_ERR(0, 348, __pyx_L1_error)
    __pyx_t_10 = NULL;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L11_unpacking_done;
    __pyx_L10_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_10 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 348, __pyx_L1_error)
    __pyx_L11_unpacking_done:;
  }
  __pyx_v_m = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_fm = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_whole = __pyx_t_8;
  __pyx_t_8 = 0;

  /* "mathics/builtin/numeric.py":349
 * 
 *     m, fm, whole = _quad_simpsons_mem(f, a, fa, b, fb)
 *     if invert_interval:             # <<<<<<<<<<<<<<
 *         return -_quad_asr(f, a, fa, b, fb, tol, whole, m, fm, maxrec)
 *     else:
 */
  __pyx_t_2 = (__pyx_v_invert_interval != 0);
  if (__pyx_t_2) {

    /* "mathics/builtin/numeric.py":350
 *     m, fm, whole = _quad_simpsons_mem(f, a, fa, b, fb)
 *     if invert_interval:
 *         return -_quad_asr(f, a, fa, b, fb, tol, whole, m, fm, maxrec)             # <<<<<<<<<<<<<<
 *     else:
 *         return _quad_asr(f, a, fa, b, fb, tol, whole, m, fm, maxrec)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __pyx_pf_7mathics_7builtin_7numeric_34_internal_adaptative_simpsons_rule_2_quad_asr(__pyx_cur_scope->__pyx_v__quad_asr, __pyx_v_f, __pyx_v_a, __pyx_v_fa, __pyx_v_b, __pyx_v_fb, __pyx_v_tol, __pyx_v_whole, __pyx_v_m, __pyx_v_fm, __pyx_v_maxrec); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 350, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = PyNumber_Negative(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 350, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_8;
    __pyx_t_8 = 0;
    goto __pyx_L0;

    /* "mathics/builtin/numeric.py":349
 * 
 *     m, fm, whole = _quad_simpsons_mem(f, a, fa, b, fb)
 *     if invert_interval:             # <<<<<<<<<<<<<<
 *         return -_quad_asr(f, a, fa, b, fb, tol, whole, m, fm, maxrec)
 *     else:
 */
  }

  /* "mathics/builtin/numeric.py":352
 *         return -_quad_asr(f, a, fa, b, fb, tol, whole, m, fm, maxrec)
 *     else:
 *         return _quad_asr(f, a, fa, b, fb, tol, whole, m, fm, maxrec)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_8 = __pyx_pf_7mathics_7builtin_7numeric_34_internal_adaptative_simpsons_rule_2_quad_asr(__pyx_cur_scope->__pyx_v__quad_asr, __pyx_v_f, __pyx_v_a, __pyx_v_fa, __pyx_v_b, __pyx_v_fb, __pyx_v_tol, __pyx_v_whole, __pyx_v_m, __pyx_v_fm, __pyx_v_maxrec); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 352, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_r = __pyx_t_8;
    __pyx_t_8 = 0;
    goto __pyx_L0;
  }

  /* "mathics/builtin/numeric.py":269
 * 
 * 
 * def _internal_adaptative_simpsons_rule(f, a, b, **opts):             # <<<<<<<<<<<<<<
 *     """
 *     1D adaptative Simpson's rule integrator
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("mathics.builtin.numeric._internal_adaptative_simpsons_rule", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tol);
  __Pyx_XDECREF(__pyx_v_maxrec);
  __Pyx_XDECREF(__pyx_v_ensure_evaluation);
  __Pyx_XDECREF(__pyx_v_fa);
  __Pyx_XDECREF(__pyx_v_fb);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_m);
  __Pyx_XDECREF(__pyx_v_fm);
  __Pyx_XDECREF(__pyx_v_whole);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":355
 * 
 * 
 * def _fubini(func, ranges, **opts):             # <<<<<<<<<<<<<<
 *     if not ranges:
 *         return 0.0
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_7_fubini(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_7_fubini = {"_fubini", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_7_fubini, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_7_fubini(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_func = 0;
  PyObject *__pyx_v_ranges = 0;
  PyObject *__pyx_v_opts = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_fubini (wrapper)", 0);
  __pyx_v_opts = PyDict_New(); if (unlikely(!__pyx_v_opts)) return NULL;
  __Pyx_GOTREF(__pyx_v_opts);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_func,&__pyx_n_s_ranges,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_func)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ranges)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_fubini", 1, 2, 2, 1); __PYX_ERR(0, 355, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_opts, values, pos_args, "_fubini") < 0)) __PYX_ERR(0, 355, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_func = values[0];
    __pyx_v_ranges = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_fubini", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 355, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_CLEAR(__pyx_v_opts);
  __Pyx_AddTraceback("mathics.builtin.numeric._fubini", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_6_fubini(__pyx_self, __pyx_v_func, __pyx_v_ranges, __pyx_v_opts);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_opts);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":367
 *     if len(ranges) > 1:
 * 
 *         def subintegral(*u):             # <<<<<<<<<<<<<<
 *             def ff(*z):
 *                 return func(*(u + z))
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_7_fubini_1subintegral(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_7_fubini_1subintegral = {"subintegral", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_7_fubini_1subintegral, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_7_fubini_1subintegral(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_u = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("subintegral (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "subintegral", 0))) return NULL;
  __Pyx_INCREF(__pyx_args);
  __pyx_v_u = __pyx_args;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_7_fubini_subintegral(__pyx_self, __pyx_v_u);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_u);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":368
 * 
 *         def subintegral(*u):
 *             def ff(*z):             # <<<<<<<<<<<<<<
 *                 return func(*(u + z))
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_7_fubini_11subintegral_1ff(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_7_fubini_11subintegral_1ff = {"ff", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_7_fubini_11subintegral_1ff, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_7_fubini_11subintegral_1ff(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_z = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ff (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "ff", 0))) return NULL;
  __Pyx_INCREF(__pyx_args);
  __pyx_v_z = __pyx_args;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_7_fubini_11subintegral_ff(__pyx_self, __pyx_v_z);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_z);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_7_fubini_11subintegral_ff(PyObject *__pyx_self, PyObject *__pyx_v_z) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral *__pyx_cur_scope;
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral *__pyx_outer_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ff", 0);
  __pyx_outer_scope = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "mathics/builtin/numeric.py":369
 *         def subintegral(*u):
 *             def ff(*z):
 *                 return func(*(u + z))             # <<<<<<<<<<<<<<
 * 
 *             val = _fubini(ff, ranges[1:], **opts)[0]
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_func)) { __Pyx_RaiseClosureNameError("func"); __PYX_ERR(0, 369, __pyx_L1_error) }
  if (unlikely(!__pyx_cur_scope->__pyx_v_u)) { __Pyx_RaiseClosureNameError("u"); __PYX_ERR(0, 369, __pyx_L1_error) }
  __pyx_t_1 = PyNumber_Add(__pyx_cur_scope->__pyx_v_u, __pyx_v_z); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 369, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_func, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 369, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "mathics/builtin/numeric.py":368
 * 
 *         def subintegral(*u):
 *             def ff(*z):             # <<<<<<<<<<<<<<
 *                 return func(*(u + z))
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("mathics.builtin.numeric._fubini.subintegral.ff", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":367
 *     if len(ranges) > 1:
 * 
 *         def subintegral(*u):             # <<<<<<<<<<<<<<
 *             def ff(*z):
 *                 return func(*(u + z))
 */

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_7_fubini_subintegral(PyObject *__pyx_self, PyObject *__pyx_v_u) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral *__pyx_cur_scope;
  PyObject *__pyx_v_ff = 0;
  PyObject *__pyx_v_val = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("subintegral", 0);
  __pyx_cur_scope = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral *)__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral(__pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 367, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  __pyx_cur_scope->__pyx_v_u = __pyx_v_u;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_u);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_u);

  /* "mathics/builtin/numeric.py":368
 * 
 *         def subintegral(*u):
 *             def ff(*z):             # <<<<<<<<<<<<<<
 *                 return func(*(u + z))
 * 
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_7_fubini_11subintegral_1ff, 0, __pyx_n_s_fubini_locals_subintegral_local, ((PyObject*)__pyx_cur_scope), __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__15)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 368, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ff = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":371
 *                 return func(*(u + z))
 * 
 *             val = _fubini(ff, ranges[1:], **opts)[0]             # <<<<<<<<<<<<<<
 *             return val
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_fubini); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 371, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_ranges)) { __Pyx_RaiseClosureNameError("ranges"); __PYX_ERR(0, 371, __pyx_L1_error) }
  __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_ranges, 1, 0, NULL, NULL, &__pyx_slice__16, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 371, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 371, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_ff);
  __Pyx_GIVEREF(__pyx_v_ff);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_ff);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __pyx_t_2 = 0;
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_opts)) { __Pyx_RaiseClosureNameError("opts"); __PYX_ERR(0, 371, __pyx_L1_error) }
  if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_opts == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
    __PYX_ERR(0, 371, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_cur_scope->__pyx_outer_scope->__pyx_v_opts); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 371, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 371, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_val = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "mathics/builtin/numeric.py":372
 * 
 *             val = _fubini(ff, ranges[1:], **opts)[0]
 *             return val             # <<<<<<<<<<<<<<
 * 
 *         opts["tol"] = 4.0 * tol
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_val);
  __pyx_r = __pyx_v_val;
  goto __pyx_L0;

  /* "mathics/builtin/numeric.py":367
 *     if len(ranges) > 1:
 * 
 *         def subintegral(*u):             # <<<<<<<<<<<<<<
 *             def ff(*z):
 *                 return func(*(u + z))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.builtin.numeric._fubini.subintegral", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ff);
  __Pyx_XDECREF(__pyx_v_val);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":355
 * 
 * 
 * def _fubini(func, ranges, **opts):             # <<<<<<<<<<<<<<
 *     if not ranges:
 *         return 0.0
 */

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_6_fubini(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_func, PyObject *__pyx_v_ranges, PyObject *__pyx_v_opts) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini *__pyx_cur_scope;
  PyObject *__pyx_v_a = NULL;
  PyObject *__pyx_v_b = NULL;
  PyObject *__pyx_v_integrator = NULL;
  PyObject *__pyx_v_tol = NULL;
  PyObject *__pyx_v_subintegral = 0;
  PyObject *__pyx_v_val = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  Py_ssize_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_fubini", 0);
  __pyx_cur_scope = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini *)__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini(__pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 355, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_func = __pyx_v_func;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_func);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_func);
  __pyx_cur_scope->__pyx_v_ranges = __pyx_v_ranges;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_ranges);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_ranges);
  __pyx_cur_scope->__pyx_v_opts = __pyx_v_opts;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_opts);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_opts);

  /* "mathics/builtin/numeric.py":356
 * 
 * def _fubini(func, ranges, **opts):
 *     if not ranges:             # <<<<<<<<<<<<<<
 *         return 0.0
 *     a, b = ranges[0]
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_ranges); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 356, __pyx_L1_error)
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {

    /* "mathics/builtin/numeric.py":357
 * def _fubini(func, ranges, **opts):
 *     if not ranges:
 *         return 0.0             # <<<<<<<<<<<<<<
 *     a, b = ranges[0]
 *     integrator = opts["integrator"]
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_float_0_0);
    __pyx_r = __pyx_float_0_0;
    goto __pyx_L0;

    /* "mathics/builtin/numeric.py":356
 * 
 * def _fubini(func, ranges, **opts):
 *     if not ranges:             # <<<<<<<<<<<<<<
 *         return 0.0
 *     a, b = ranges[0]
 */
  }

  /* "mathics/builtin/numeric.py":358
 *     if not ranges:
 *         return 0.0
 *     a, b = ranges[0]             # <<<<<<<<<<<<<<
 *     integrator = opts["integrator"]
 *     tol = opts.get("tol")
 */
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_ranges, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 358, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
    PyObject* sequence = __pyx_t_3;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 358, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 358, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 358, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 358, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
    index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(0, 358, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L5_unpacking_done;
    __pyx_L4_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 358, __pyx_L1_error)
    __pyx_L5_unpacking_done:;
  }
  __pyx_v_a = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_b = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "mathics/builtin/numeric.py":359
 *         return 0.0
 *     a, b = ranges[0]
 *     integrator = opts["integrator"]             # <<<<<<<<<<<<<<
 *     tol = opts.get("tol")
 *     if tol is None:
 */
  __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_opts, __pyx_n_u_integrator); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 359, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_integrator = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "mathics/builtin/numeric.py":360
 *     a, b = ranges[0]
 *     integrator = opts["integrator"]
 *     tol = opts.get("tol")             # <<<<<<<<<<<<<<
 *     if tol is None:
 *         opts["tol"] = 1.0e-10
 */
  __pyx_t_3 = __Pyx_PyDict_GetItemDefault(__pyx_cur_scope->__pyx_v_opts, __pyx_n_u_tol, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 360, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_tol = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "mathics/builtin/numeric.py":361
 *     integrator = opts["integrator"]
 *     tol = opts.get("tol")
 *     if tol is None:             # <<<<<<<<<<<<<<
 *         opts["tol"] = 1.0e-10
 *         tol = 1.0e-10
 */
  __pyx_t_2 = (__pyx_v_tol == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "mathics/builtin/numeric.py":362
 *     tol = opts.get("tol")
 *     if tol is None:
 *         opts["tol"] = 1.0e-10             # <<<<<<<<<<<<<<
 *         tol = 1.0e-10
 * 
 */
    if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_opts, __pyx_n_u_tol, __pyx_float_1_0eneg_10) < 0)) __PYX_ERR(0, 362, __pyx_L1_error)

    /* "mathics/builtin/numeric.py":363
 *     if tol is None:
 *         opts["tol"] = 1.0e-10
 *         tol = 1.0e-10             # <<<<<<<<<<<<<<
 * 
 *     if len(ranges) > 1:
 */
    __Pyx_INCREF(__pyx_float_1_0eneg_10);
    __Pyx_DECREF_SET(__pyx_v_tol, __pyx_float_1_0eneg_10);

    /* "mathics/builtin/numeric.py":361
 *     integrator = opts["integrator"]
 *     tol = opts.get("tol")
 *     if tol is None:             # <<<<<<<<<<<<<<
 *         opts["tol"] = 1.0e-10
 *         tol = 1.0e-10
 */
  }

  /* "mathics/builtin/numeric.py":365
 *         tol = 1.0e-10
 * 
 *     if len(ranges) > 1:             # <<<<<<<<<<<<<<
 * 
 *         def subintegral(*u):
 */
  __pyx_t_3 = __pyx_cur_scope->__pyx_v_ranges;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_8 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 365, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = ((__pyx_t_8 > 1) != 0);
  if (__pyx_t_1) {

    /* "mathics/builtin/numeric.py":367
 *     if len(ranges) > 1:
 * 
 *         def subintegral(*u):             # <<<<<<<<<<<<<<
 *             def ff(*z):
 *                 return func(*(u + z))
 */
    __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_7_fubini_1subintegral, 0, __pyx_n_s_fubini_locals_subintegral, ((PyObject*)__pyx_cur_scope), __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__18)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 367, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_subintegral = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "mathics/builtin/numeric.py":374
 *             return val
 * 
 *         opts["tol"] = 4.0 * tol             # <<<<<<<<<<<<<<
 *         val = integrator(subintegral, a, b, **opts)
 *         return val
 */
    __pyx_t_3 = PyNumber_Multiply(__pyx_float_4_0, __pyx_v_tol); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 374, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_opts, __pyx_n_u_tol, __pyx_t_3) < 0)) __PYX_ERR(0, 374, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "mathics/builtin/numeric.py":375
 * 
 *         opts["tol"] = 4.0 * tol
 *         val = integrator(subintegral, a, b, **opts)             # <<<<<<<<<<<<<<
 *         return val
 *     else:
 */
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 375, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_subintegral);
    __Pyx_GIVEREF(__pyx_v_subintegral);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_subintegral);
    __Pyx_INCREF(__pyx_v_a);
    __Pyx_GIVEREF(__pyx_v_a);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_a);
    __Pyx_INCREF(__pyx_v_b);
    __Pyx_GIVEREF(__pyx_v_b);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_b);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_v_integrator, __pyx_t_3, __pyx_cur_scope->__pyx_v_opts); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 375, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_val = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "mathics/builtin/numeric.py":376
 *         opts["tol"] = 4.0 * tol
 *         val = integrator(subintegral, a, b, **opts)
 *         return val             # <<<<<<<<<<<<<<
 *     else:
 *         val = integrator(func, a, b, **opts)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_val);
    __pyx_r = __pyx_v_val;
    goto __pyx_L0;

    /* "mathics/builtin/numeric.py":365
 *         tol = 1.0e-10
 * 
 *     if len(ranges) > 1:             # <<<<<<<<<<<<<<
 * 
 *         def subintegral(*u):
 */
  }

  /* "mathics/builtin/numeric.py":378
 *         return val
 *     else:
 *         val = integrator(func, a, b, **opts)             # <<<<<<<<<<<<<<
 *         return val
 * 
 */
  /*else*/ {
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 378, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_func);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_func);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_cur_scope->__pyx_v_func);
    __Pyx_INCREF(__pyx_v_a);
    __Pyx_GIVEREF(__pyx_v_a);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_a);
    __Pyx_INCREF(__pyx_v_b);
    __Pyx_GIVEREF(__pyx_v_b);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_b);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_v_integrator, __pyx_t_5, __pyx_cur_scope->__pyx_v_opts); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 378, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_val = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "mathics/builtin/numeric.py":379
 *     else:
 *         val = integrator(func, a, b, **opts)
 *         return val             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_val);
    __pyx_r = __pyx_v_val;
    goto __pyx_L0;
  }

  /* "mathics/builtin/numeric.py":355
 * 
 * 
 * def _fubini(func, ranges, **opts):             # <<<<<<<<<<<<<<
 *     if not ranges:
 *         return 0.0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("mathics.builtin.numeric._fubini", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XDECREF(__pyx_v_integrator);
  __Pyx_XDECREF(__pyx_v_tol);
  __Pyx_XDECREF(__pyx_v_subintegral);
  __Pyx_XDECREF(__pyx_v_val);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":446
 *     }
 * 
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         super().__init__(*args, **kwargs)
 *         self.methods["Internal"] = (_internal_adaptative_simpsons_rule, False)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_10NIntegrate_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_10NIntegrate_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_10NIntegrate_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_10NIntegrate_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwargs = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  if (PyTuple_GET_SIZE(__pyx_args) > 1) {
    __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args));
    if (unlikely(!__pyx_v_args)) {
      __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
      __Pyx_RefNannyFinishContext();
      return NULL;
    }
    __Pyx_GOTREF(__pyx_v_args);
  } else {
    __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        default:
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (pos_args < 1) ? pos_args : 1;
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "__init__") < 0)) __PYX_ERR(0, 446, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) < 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_self = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 446, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("mathics.builtin.numeric.NIntegrate.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_10NIntegrate___init__(__pyx_self, __pyx_v_self, __pyx_v_args, __pyx_v_kwargs);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":454
 *             self.methods["NQuadrature"] = (
 *                 _scipy_interface(
 *                     nquad, {}, {"full_output": 1}, lambda res: (res[0], res[1])             # <<<<<<<<<<<<<<
 *                 ),
 *                 True,
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_10NIntegrate_8__init___lambda(PyObject *__pyx_self, PyObject *__pyx_v_res); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_10NIntegrate_8__init___lambda = {"lambda", (PyCFunction)__pyx_pw_7mathics_7builtin_7numeric_10NIntegrate_8__init___lambda, METH_O, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_10NIntegrate_8__init___lambda(PyObject *__pyx_self, PyObject *__pyx_v_res) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lambda (wrapper)", 0);
  __pyx_r = __pyx_lambda_funcdef_lambda(__pyx_self, ((PyObject *)__pyx_v_res));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_lambda_funcdef_lambda(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_res) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lambda", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_res, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 454, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_res, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 454, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 454, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.builtin.numeric.NIntegrate.__init__.lambda", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":463
 *                     {
 *                         "tol": ("epsabs", None),
 *                         "maxrec": ("limit", lambda maxrec: int(2 ** maxrec)),             # <<<<<<<<<<<<<<
 *                     },
 *                     {"full_output": 1},
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_10NIntegrate_8__init___1lambda1(PyObject *__pyx_self, PyObject *__pyx_v_maxrec); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_10NIntegrate_8__init___1lambda1 = {"lambda1", (PyCFunction)__pyx_pw_7mathics_7builtin_7numeric_10NIntegrate_8__init___1lambda1, METH_O, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_10NIntegrate_8__init___1lambda1(PyObject *__pyx_self, PyObject *__pyx_v_maxrec) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lambda1 (wrapper)", 0);
  __pyx_r = __pyx_lambda_funcdef_lambda1(__pyx_self, ((PyObject *)__pyx_v_maxrec));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_lambda_funcdef_lambda1(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_maxrec) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lambda1", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyNumber_PowerOf2(__pyx_int_2, __pyx_v_maxrec, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 463, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 463, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("mathics.builtin.numeric.NIntegrate.__init__.lambda1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":466
 *                     },
 *                     {"full_output": 1},
 *                     lambda res: (res[0], res[1]),             # <<<<<<<<<<<<<<
 *                 ),
 *                 False,
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_10NIntegrate_8__init___2lambda2(PyObject *__pyx_self, PyObject *__pyx_v_res); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_10NIntegrate_8__init___2lambda2 = {"lambda2", (PyCFunction)__pyx_pw_7mathics_7builtin_7numeric_10NIntegrate_8__init___2lambda2, METH_O, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_10NIntegrate_8__init___2lambda2(PyObject *__pyx_self, PyObject *__pyx_v_res) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lambda2 (wrapper)", 0);
  __pyx_r = __pyx_lambda_funcdef_lambda2(__pyx_self, ((PyObject *)__pyx_v_res));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_lambda_funcdef_lambda2(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_res) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lambda2", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_res, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_res, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.builtin.numeric.NIntegrate.__init__.lambda2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":475
 *                     {"tol": ("tol", None), "maxrec": ("divmax", None)},
 *                     None,
 *                     lambda x: (x, np.nan),             # <<<<<<<<<<<<<<
 *                 ),
 *                 False,
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_10NIntegrate_8__init___3lambda3(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_10NIntegrate_8__init___3lambda3 = {"lambda3", (PyCFunction)__pyx_pw_7mathics_7builtin_7numeric_10NIntegrate_8__init___3lambda3, METH_O, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_10NIntegrate_8__init___3lambda3(PyObject *__pyx_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lambda3 (wrapper)", 0);
  __pyx_r = __pyx_lambda_funcdef_lambda3(__pyx_self, ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_lambda_funcdef_lambda3(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lambda3", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 475, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_nan); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 475, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 475, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_x);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("mathics.builtin.numeric.NIntegrate.__init__.lambda3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":446
 *     }
 * 
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         super().__init__(*args, **kwargs)
 *         self.methods["Internal"] = (_internal_adaptative_simpsons_rule, False)
 */

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_10NIntegrate___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_romberg = NULL;
  PyObject *__pyx_v_quad = NULL;
  PyObject *__pyx_v_nquad = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "mathics/builtin/numeric.py":447
 * 
 *     def __init__(self, *args, **kwargs):
 *         super().__init__(*args, **kwargs)             # <<<<<<<<<<<<<<
 *         self.methods["Internal"] = (_internal_adaptative_simpsons_rule, False)
 *         try:
 */
  __pyx_t_1 = __Pyx_CyFunction_GetClassObj(__pyx_self);
  if (!__pyx_t_1) { PyErr_SetString(PyExc_SystemError, "super(): empty __class__ cell"); __PYX_ERR(0, 447, __pyx_L1_error) }
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 447, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_INCREF(__pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_self);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 447, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 447, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_v_args, __pyx_v_kwargs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 447, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":448
 *     def __init__(self, *args, **kwargs):
 *         super().__init__(*args, **kwargs)
 *         self.methods["Internal"] = (_internal_adaptative_simpsons_rule, False)             # <<<<<<<<<<<<<<
 *         try:
 *             from scipy.integrate import romberg, quad, nquad
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_internal_adaptative_simpsons_ru_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 448, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 448, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_INCREF(Py_False);
  __Pyx_GIVEREF(Py_False);
  PyTuple_SET_ITEM(__pyx_t_2, 1, Py_False);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_methods); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 448, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_n_u_Internal, __pyx_t_2) < 0)) __PYX_ERR(0, 448, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":449
 *         super().__init__(*args, **kwargs)
 *         self.methods["Internal"] = (_internal_adaptative_simpsons_rule, False)
 *         try:             # <<<<<<<<<<<<<<
 *             from scipy.integrate import romberg, quad, nquad
 * 
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "mathics/builtin/numeric.py":450
 *         self.methods["Internal"] = (_internal_adaptative_simpsons_rule, False)
 *         try:
 *             from scipy.integrate import romberg, quad, nquad             # <<<<<<<<<<<<<<
 * 
 *             self.methods["NQuadrature"] = (
 */
      __pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 450, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_n_s_romberg);
      __Pyx_GIVEREF(__pyx_n_s_romberg);
      PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_romberg);
      __Pyx_INCREF(__pyx_n_s_quad);
      __Pyx_GIVEREF(__pyx_n_s_quad);
      PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_quad);
      __Pyx_INCREF(__pyx_n_s_nquad);
      __Pyx_GIVEREF(__pyx_n_s_nquad);
      PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_nquad);
      __pyx_t_1 = __Pyx_Import(__pyx_n_s_scipy_integrate, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 450, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_romberg); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 450, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_2);
      __pyx_v_romberg = __pyx_t_2;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_quad); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 450, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_2);
      __pyx_v_quad = __pyx_t_2;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_nquad); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 450, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_2);
      __pyx_v_nquad = __pyx_t_2;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "mathics/builtin/numeric.py":453
 * 
 *             self.methods["NQuadrature"] = (
 *                 _scipy_interface(             # <<<<<<<<<<<<<<
 *                     nquad, {}, {"full_output": 1}, lambda res: (res[0], res[1])
 *                 ),
 */
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_scipy_interface); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 453, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_2);

      /* "mathics/builtin/numeric.py":454
 *             self.methods["NQuadrature"] = (
 *                 _scipy_interface(
 *                     nquad, {}, {"full_output": 1}, lambda res: (res[0], res[1])             # <<<<<<<<<<<<<<
 *                 ),
 *                 True,
 */
      __pyx_t_6 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 454, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 454, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (PyDict_SetItem(__pyx_t_7, __pyx_n_u_full_output, __pyx_int_1) < 0) __PYX_ERR(0, 454, __pyx_L3_error)
      __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_10NIntegrate_8__init___lambda, 0, __pyx_n_s_NIntegrate___init___locals_lambd, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 454, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = NULL;
      __pyx_t_10 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_10 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[5] = {__pyx_t_9, __pyx_v_nquad, __pyx_t_6, __pyx_t_7, __pyx_t_8};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_10, 4+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 453, __pyx_L3_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[5] = {__pyx_t_9, __pyx_v_nquad, __pyx_t_6, __pyx_t_7, __pyx_t_8};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_10, 4+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 453, __pyx_L3_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else
      #endif
      {
        __pyx_t_11 = PyTuple_New(4+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 453, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_11);
        if (__pyx_t_9) {
          __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __pyx_t_9 = NULL;
        }
        __Pyx_INCREF(__pyx_v_nquad);
        __Pyx_GIVEREF(__pyx_v_nquad);
        PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_v_nquad);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_10, __pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_11, 3+__pyx_t_10, __pyx_t_8);
        __pyx_t_6 = 0;
        __pyx_t_7 = 0;
        __pyx_t_8 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 453, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "mathics/builtin/numeric.py":453
 * 
 *             self.methods["NQuadrature"] = (
 *                 _scipy_interface(             # <<<<<<<<<<<<<<
 *                     nquad, {}, {"full_output": 1}, lambda res: (res[0], res[1])
 *                 ),
 */
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 453, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
      __Pyx_INCREF(Py_True);
      __Pyx_GIVEREF(Py_True);
      PyTuple_SET_ITEM(__pyx_t_2, 1, Py_True);
      __pyx_t_1 = 0;

      /* "mathics/builtin/numeric.py":452
 *             from scipy.integrate import romberg, quad, nquad
 * 
 *             self.methods["NQuadrature"] = (             # <<<<<<<<<<<<<<
 *                 _scipy_interface(
 *                     nquad, {}, {"full_output": 1}, lambda res: (res[0], res[1])
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_methods); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 452, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_n_u_NQuadrature, __pyx_t_2) < 0)) __PYX_ERR(0, 452, __pyx_L3_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "mathics/builtin/numeric.py":459
 *             )
 *             self.methods["Quadrature"] = (
 *                 _scipy_interface(             # <<<<<<<<<<<<<<
 *                     quad,
 *                     {
 */
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_scipy_interface); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 459, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);

      /* "mathics/builtin/numeric.py":462
 *                     quad,
 *                     {
 *                         "tol": ("epsabs", None),             # <<<<<<<<<<<<<<
 *                         "maxrec": ("limit", lambda maxrec: int(2 ** maxrec)),
 *                     },
 */
      __pyx_t_11 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 462, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_11);
      if (PyDict_SetItem(__pyx_t_11, __pyx_n_u_tol, __pyx_tuple__19) < 0) __PYX_ERR(0, 462, __pyx_L3_error)

      /* "mathics/builtin/numeric.py":463
 *                     {
 *                         "tol": ("epsabs", None),
 *                         "maxrec": ("limit", lambda maxrec: int(2 ** maxrec)),             # <<<<<<<<<<<<<<
 *                     },
 *                     {"full_output": 1},
 */
      __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_10NIntegrate_8__init___1lambda1, 0, __pyx_n_s_NIntegrate___init___locals_lambd, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 463, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 463, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_n_u_limit);
      __Pyx_GIVEREF(__pyx_n_u_limit);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_n_u_limit);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_8);
      __pyx_t_8 = 0;
      if (PyDict_SetItem(__pyx_t_11, __pyx_n_u_maxrec, __pyx_t_7) < 0) __PYX_ERR(0, 462, __pyx_L3_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "mathics/builtin/numeric.py":465
 *                         "maxrec": ("limit", lambda maxrec: int(2 ** maxrec)),
 *                     },
 *                     {"full_output": 1},             # <<<<<<<<<<<<<<
 *                     lambda res: (res[0], res[1]),
 *                 ),
 */
      __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 465, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (PyDict_SetItem(__pyx_t_7, __pyx_n_u_full_output, __pyx_int_1) < 0) __PYX_ERR(0, 465, __pyx_L3_error)

      /* "mathics/builtin/numeric.py":466
 *                     },
 *                     {"full_output": 1},
 *                     lambda res: (res[0], res[1]),             # <<<<<<<<<<<<<<
 *                 ),
 *                 False,
 */
      __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_10NIntegrate_8__init___2lambda2, 0, __pyx_n_s_NIntegrate___init___locals_lambd, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 466, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_6 = NULL;
      __pyx_t_10 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
          __pyx_t_10 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[5] = {__pyx_t_6, __pyx_v_quad, __pyx_t_11, __pyx_t_7, __pyx_t_8};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_10, 4+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 459, __pyx_L3_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[5] = {__pyx_t_6, __pyx_v_quad, __pyx_t_11, __pyx_t_7, __pyx_t_8};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_10, 4+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 459, __pyx_L3_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else
      #endif
      {
        __pyx_t_9 = PyTuple_New(4+__pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 459, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_9);
        if (__pyx_t_6) {
          __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); __pyx_t_6 = NULL;
        }
        __Pyx_INCREF(__pyx_v_quad);
        __Pyx_GIVEREF(__pyx_v_quad);
        PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_10, __pyx_v_quad);
        __Pyx_GIVEREF(__pyx_t_11);
        PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_10, __pyx_t_11);
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_10, __pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_10, __pyx_t_8);
        __pyx_t_11 = 0;
        __pyx_t_7 = 0;
        __pyx_t_8 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 459, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "mathics/builtin/numeric.py":459
 *             )
 *             self.methods["Quadrature"] = (
 *                 _scipy_interface(             # <<<<<<<<<<<<<<
 *                     quad,
 *                     {
 */
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 459, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
      __Pyx_INCREF(Py_False);
      __Pyx_GIVEREF(Py_False);
      PyTuple_SET_ITEM(__pyx_t_1, 1, Py_False);
      __pyx_t_2 = 0;

      /* "mathics/builtin/numeric.py":458
 *                 True,
 *             )
 *             self.methods["Quadrature"] = (             # <<<<<<<<<<<<<<
 *                 _scipy_interface(
 *                     quad,
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_methods); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 458, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (unlikely(PyObject_SetItem(__pyx_t_2, __pyx_n_u_Quadrature, __pyx_t_1) < 0)) __PYX_ERR(0, 458, __pyx_L3_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "mathics/builtin/numeric.py":471
 *             )
 *             self.methods["Romberg"] = (
 *                 _scipy_interface(             # <<<<<<<<<<<<<<
 *                     romberg,
 *                     {"tol": ("tol", None), "maxrec": ("divmax", None)},
 */
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_scipy_interface); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 471, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_2);

      /* "mathics/builtin/numeric.py":473
 *                 _scipy_interface(
 *                     romberg,
 *                     {"tol": ("tol", None), "maxrec": ("divmax", None)},             # <<<<<<<<<<<<<<
 *                     None,
 *                     lambda x: (x, np.nan),
 */
      __pyx_t_9 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 473, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (PyDict_SetItem(__pyx_t_9, __pyx_n_u_tol, __pyx_tuple__20) < 0) __PYX_ERR(0, 473, __pyx_L3_error)
      if (PyDict_SetItem(__pyx_t_9, __pyx_n_u_maxrec, __pyx_tuple__21) < 0) __PYX_ERR(0, 473, __pyx_L3_error)

      /* "mathics/builtin/numeric.py":475
 *                     {"tol": ("tol", None), "maxrec": ("divmax", None)},
 *                     None,
 *                     lambda x: (x, np.nan),             # <<<<<<<<<<<<<<
 *                 ),
 *                 False,
 */
      __pyx_t_8 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_10NIntegrate_8__init___3lambda3, 0, __pyx_n_s_NIntegrate___init___locals_lambd, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 475, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_7 = NULL;
      __pyx_t_10 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_10 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_v_romberg, __pyx_t_9, Py_None, __pyx_t_8};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_10, 4+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 471, __pyx_L3_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[5] = {__pyx_t_7, __pyx_v_romberg, __pyx_t_9, Py_None, __pyx_t_8};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_10, 4+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 471, __pyx_L3_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else
      #endif
      {
        __pyx_t_11 = PyTuple_New(4+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 471, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_11);
        if (__pyx_t_7) {
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_7); __pyx_t_7 = NULL;
        }
        __Pyx_INCREF(__pyx_v_romberg);
        __Pyx_GIVEREF(__pyx_v_romberg);
        PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_v_romberg);
        __Pyx_GIVEREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_t_9);
        __Pyx_INCREF(Py_None);
        __Pyx_GIVEREF(Py_None);
        PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_10, Py_None);
        __Pyx_GIVEREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_11, 3+__pyx_t_10, __pyx_t_8);
        __pyx_t_9 = 0;
        __pyx_t_8 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 471, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "mathics/builtin/numeric.py":471
 *             )
 *             self.methods["Romberg"] = (
 *                 _scipy_interface(             # <<<<<<<<<<<<<<
 *                     romberg,
 *                     {"tol": ("tol", None), "maxrec": ("divmax", None)},
 */
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 471, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
      __Pyx_INCREF(Py_False);
      __Pyx_GIVEREF(Py_False);
      PyTuple_SET_ITEM(__pyx_t_2, 1, Py_False);
      __pyx_t_1 = 0;

      /* "mathics/builtin/numeric.py":470
 *                 False,
 *             )
 *             self.methods["Romberg"] = (             # <<<<<<<<<<<<<<
 *                 _scipy_interface(
 *                     romberg,
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_methods); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 470, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_n_u_Romberg, __pyx_t_2) < 0)) __PYX_ERR(0, 470, __pyx_L3_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "mathics/builtin/numeric.py":479
 *                 False,
 *             )
 *             self.methods["Automatic"] = self.methods["Quadrature"]             # <<<<<<<<<<<<<<
 *         except Exception:
 *             self.methods["Automatic"] = self.methods["Internal"]
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_methods); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 479, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_t_2, __pyx_n_u_Quadrature); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 479, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_methods); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 479, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (unlikely(PyObject_SetItem(__pyx_t_2, __pyx_n_u_Automatic, __pyx_t_1) < 0)) __PYX_ERR(0, 479, __pyx_L3_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "mathics/builtin/numeric.py":449
 *         super().__init__(*args, **kwargs)
 *         self.methods["Internal"] = (_internal_adaptative_simpsons_rule, False)
 *         try:             # <<<<<<<<<<<<<<
 *             from scipy.integrate import romberg, quad, nquad
 * 
 */
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "mathics/builtin/numeric.py":480
 *             )
 *             self.methods["Automatic"] = self.methods["Quadrature"]
 *         except Exception:             # <<<<<<<<<<<<<<
 *             self.methods["Automatic"] = self.methods["Internal"]
 *             self.methods["Simpson"] = self.methods["Internal"]
 */
    __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_10) {
      __Pyx_AddTraceback("mathics.builtin.numeric.NIntegrate.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_11) < 0) __PYX_ERR(0, 480, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_11);

      /* "mathics/builtin/numeric.py":481
 *             self.methods["Automatic"] = self.methods["Quadrature"]
 *         except Exception:
 *             self.methods["Automatic"] = self.methods["Internal"]             # <<<<<<<<<<<<<<
 *             self.methods["Simpson"] = self.methods["Internal"]
 * 
 */
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_methods); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 481, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_t_8, __pyx_n_u_Internal); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 481, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_methods); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 481, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (unlikely(PyObject_SetItem(__pyx_t_8, __pyx_n_u_Automatic, __pyx_t_9) < 0)) __PYX_ERR(0, 481, __pyx_L5_except_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "mathics/builtin/numeric.py":482
 *         except Exception:
 *             self.methods["Automatic"] = self.methods["Internal"]
 *             self.methods["Simpson"] = self.methods["Internal"]             # <<<<<<<<<<<<<<
 * 
 *         self.messages["bdmtd"] = (
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_methods); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 482, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_t_9, __pyx_n_u_Internal); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 482, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_methods); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 482, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (unlikely(PyObject_SetItem(__pyx_t_9, __pyx_n_u_Simpson, __pyx_t_8) < 0)) __PYX_ERR(0, 482, __pyx_L5_except_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "mathics/builtin/numeric.py":449
 *         super().__init__(*args, **kwargs)
 *         self.methods["Internal"] = (_internal_adaptative_simpsons_rule, False)
 *         try:             # <<<<<<<<<<<<<<
 *             from scipy.integrate import romberg, quad, nquad
 * 
 */
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    __pyx_L8_try_end:;
  }

  /* "mathics/builtin/numeric.py":487
 *             "The Method option should be a "
 *             + "built-in method name in {`"
 *             + "`, `".join(list(self.methods))             # <<<<<<<<<<<<<<
 *             + "`}. Using `Automatic`"
 *         )
 */
  __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_methods); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_2 = PySequence_List(__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = PyUnicode_Join(__pyx_kp_u__22, __pyx_t_2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_The_Method_option_should_be_a_bu, __pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "mathics/builtin/numeric.py":488
 *             + "built-in method name in {`"
 *             + "`, `".join(list(self.methods))
 *             + "`}. Using `Automatic`"             # <<<<<<<<<<<<<<
 *         )
 * 
 */
  __pyx_t_11 = __Pyx_PyUnicode_Concat(__pyx_t_2, __pyx_kp_u_Using_Automatic); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 488, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":484
 *             self.methods["Simpson"] = self.methods["Internal"]
 * 
 *         self.messages["bdmtd"] = (             # <<<<<<<<<<<<<<
 *             "The Method option should be a "
 *             + "built-in method name in {`"
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_messages); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 484, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(PyObject_SetItem(__pyx_t_2, __pyx_n_u_bdmtd, __pyx_t_11) < 0)) __PYX_ERR(0, 484, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "mathics/builtin/numeric.py":446
 *     }
 * 
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         super().__init__(*args, **kwargs)
 *         self.methods["Internal"] = (_internal_adaptative_simpsons_rule, False)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("mathics.builtin.numeric.NIntegrate.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_romberg);
  __Pyx_XDECREF(__pyx_v_quad);
  __Pyx_XDECREF(__pyx_v_nquad);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":492
 * 
 *     @staticmethod
 *     def decompose_domain(interval, evaluation):             # <<<<<<<<<<<<<<
 *         if interval.has_form("System`Sequence", 1, None):
 *             intervals = []
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_10NIntegrate_3decompose_domain(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_10NIntegrate_3decompose_domain = {"decompose_domain", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_10NIntegrate_3decompose_domain, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_10NIntegrate_3decompose_domain(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_interval = 0;
  PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("decompose_domain (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_interval,&__pyx_n_s_evaluation,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_interval)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("decompose_domain", 1, 2, 2, 1); __PYX_ERR(0, 492, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decompose_domain") < 0)) __PYX_ERR(0, 492, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_interval = values[0];
    __pyx_v_evaluation = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("decompose_domain", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 492, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.NIntegrate.decompose_domain", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_10NIntegrate_2decompose_domain(__pyx_self, __pyx_v_interval, __pyx_v_evaluation);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_10NIntegrate_2decompose_domain(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_interval, PyObject *__pyx_v_evaluation) {
  PyObject *__pyx_v_intervals = NULL;
  PyObject *__pyx_v_leaf = NULL;
  PyObject *__pyx_v_inner_interval = NULL;
  PyObject *__pyx_v_intvar = NULL;
  PyObject *__pyx_v_boundaries = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_8genexpr1__pyx_v_a = NULL;
  PyObject *__pyx_8genexpr2__pyx_v_b = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("decompose_domain", 0);

  /* "mathics/builtin/numeric.py":493
 *     @staticmethod
 *     def decompose_domain(interval, evaluation):
 *         if interval.has_form("System`Sequence", 1, None):             # <<<<<<<<<<<<<<
 *             intervals = []
 *             for leaf in interval.leaves:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_interval, __pyx_n_s_has_form); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 493, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 493, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 493, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "mathics/builtin/numeric.py":494
 *     def decompose_domain(interval, evaluation):
 *         if interval.has_form("System`Sequence", 1, None):
 *             intervals = []             # <<<<<<<<<<<<<<
 *             for leaf in interval.leaves:
 *                 inner_interval = NIntegrate.decompose_domain(leaf, evaluation)
 */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 494, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_intervals = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "mathics/builtin/numeric.py":495
 *         if interval.has_form("System`Sequence", 1, None):
 *             intervals = []
 *             for leaf in interval.leaves:             # <<<<<<<<<<<<<<
 *                 inner_interval = NIntegrate.decompose_domain(leaf, evaluation)
 *                 if inner_interval:
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_interval, __pyx_n_s_leaves); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 495, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
      __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
      __pyx_t_5 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 495, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 495, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    for (;;) {
      if (likely(!__pyx_t_5)) {
        if (likely(PyList_CheckExact(__pyx_t_1))) {
          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 495, __pyx_L1_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 495, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        } else {
          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 495, __pyx_L1_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 495, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        }
      } else {
        __pyx_t_2 = __pyx_t_5(__pyx_t_1);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 495, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_XDECREF_SET(__pyx_v_leaf, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "mathics/builtin/numeric.py":496
 *             intervals = []
 *             for leaf in interval.leaves:
 *                 inner_interval = NIntegrate.decompose_domain(leaf, evaluation)             # <<<<<<<<<<<<<<
 *                 if inner_interval:
 *                     intervals.append(inner_interval)
 */
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_NIntegrate); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 496, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_decompose_domain); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 496, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
          __pyx_t_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_leaf, __pyx_v_evaluation};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 496, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_leaf, __pyx_v_evaluation};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 496, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else
      #endif
      {
        __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 496, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        if (__pyx_t_6) {
          __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); __pyx_t_6 = NULL;
        }
        __Pyx_INCREF(__pyx_v_leaf);
        __Pyx_GIVEREF(__pyx_v_leaf);
        PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_v_leaf);
        __Pyx_INCREF(__pyx_v_evaluation);
        __Pyx_GIVEREF(__pyx_v_evaluation);
        PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_evaluation);
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 496, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF_SET(__pyx_v_inner_interval, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "mathics/builtin/numeric.py":497
 *             for leaf in interval.leaves:
 *                 inner_interval = NIntegrate.decompose_domain(leaf, evaluation)
 *                 if inner_interval:             # <<<<<<<<<<<<<<
 *                     intervals.append(inner_interval)
 *                 else:
 */
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_inner_interval); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 497, __pyx_L1_error)
      if (__pyx_t_3) {

        /* "mathics/builtin/numeric.py":498
 *                 inner_interval = NIntegrate.decompose_domain(leaf, evaluation)
 *                 if inner_interval:
 *                     intervals.append(inner_interval)             # <<<<<<<<<<<<<<
 *                 else:
 *                     evaluation.message("ilim", leaf)
 */
        __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_intervals, __pyx_v_inner_interval); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 498, __pyx_L1_error)

        /* "mathics/builtin/numeric.py":497
 *             for leaf in interval.leaves:
 *                 inner_interval = NIntegrate.decompose_domain(leaf, evaluation)
 *                 if inner_interval:             # <<<<<<<<<<<<<<
 *                     intervals.append(inner_interval)
 *                 else:
 */
        goto __pyx_L6;
      }

      /* "mathics/builtin/numeric.py":500
 *                     intervals.append(inner_interval)
 *                 else:
 *                     evaluation.message("ilim", leaf)             # <<<<<<<<<<<<<<
 *                     return None
 *             return intervals
 */
      /*else*/ {
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_message); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 500, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_9 = NULL;
        __pyx_t_8 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7);
          if (likely(__pyx_t_9)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_9);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_7, function);
            __pyx_t_8 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_7)) {
          PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_n_u_ilim, __pyx_v_leaf};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 500, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
          PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_n_u_ilim, __pyx_v_leaf};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 500, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 500, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_9) {
            __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_9); __pyx_t_9 = NULL;
          }
          __Pyx_INCREF(__pyx_n_u_ilim);
          __Pyx_GIVEREF(__pyx_n_u_ilim);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_8, __pyx_n_u_ilim);
          __Pyx_INCREF(__pyx_v_leaf);
          __Pyx_GIVEREF(__pyx_v_leaf);
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_8, __pyx_v_leaf);
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 500, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "mathics/builtin/numeric.py":501
 *                 else:
 *                     evaluation.message("ilim", leaf)
 *                     return None             # <<<<<<<<<<<<<<
 *             return intervals
 * 
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_r = Py_None; __Pyx_INCREF(Py_None);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      __pyx_L6:;

      /* "mathics/builtin/numeric.py":495
 *         if interval.has_form("System`Sequence", 1, None):
 *             intervals = []
 *             for leaf in interval.leaves:             # <<<<<<<<<<<<<<
 *                 inner_interval = NIntegrate.decompose_domain(leaf, evaluation)
 *                 if inner_interval:
 */
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "mathics/builtin/numeric.py":502
 *                     evaluation.message("ilim", leaf)
 *                     return None
 *             return intervals             # <<<<<<<<<<<<<<
 * 
 *         if interval.has_form("System`List", 3, None):
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_intervals);
    __pyx_r = __pyx_v_intervals;
    goto __pyx_L0;

    /* "mathics/builtin/numeric.py":493
 *     @staticmethod
 *     def decompose_domain(interval, evaluation):
 *         if interval.has_form("System`Sequence", 1, None):             # <<<<<<<<<<<<<<
 *             intervals = []
 *             for leaf in interval.leaves:
 */
  }

  /* "mathics/builtin/numeric.py":504
 *             return intervals
 * 
 *         if interval.has_form("System`List", 3, None):             # <<<<<<<<<<<<<<
 *             intervals = []
 *             intvar = interval.leaves[0]
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_interval, __pyx_n_s_has_form); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 504, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 504, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 504, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "mathics/builtin/numeric.py":505
 * 
 *         if interval.has_form("System`List", 3, None):
 *             intervals = []             # <<<<<<<<<<<<<<
 *             intvar = interval.leaves[0]
 *             if not isinstance(intvar, Symbol):
 */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 505, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_intervals = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "mathics/builtin/numeric.py":506
 *         if interval.has_form("System`List", 3, None):
 *             intervals = []
 *             intvar = interval.leaves[0]             # <<<<<<<<<<<<<<
 *             if not isinstance(intvar, Symbol):
 *                 evaluation.message("ilim", interval)
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_interval, __pyx_n_s_leaves); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 506, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 506, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_intvar = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "mathics/builtin/numeric.py":507
 *             intervals = []
 *             intvar = interval.leaves[0]
 *             if not isinstance(intvar, Symbol):             # <<<<<<<<<<<<<<
 *                 evaluation.message("ilim", interval)
 *                 return None
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 507, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyObject_IsInstance(__pyx_v_intvar, __pyx_t_1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 507, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_11 = ((!(__pyx_t_3 != 0)) != 0);
    if (__pyx_t_11) {

      /* "mathics/builtin/numeric.py":508
 *             intvar = interval.leaves[0]
 *             if not isinstance(intvar, Symbol):
 *                 evaluation.message("ilim", interval)             # <<<<<<<<<<<<<<
 *                 return None
 *             boundaries = [a for a in interval.leaves[1:]]
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_message); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 508, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_n_u_ilim, __pyx_v_interval};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 508, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_n_u_ilim, __pyx_v_interval};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 508, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 508, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        if (__pyx_t_7) {
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); __pyx_t_7 = NULL;
        }
        __Pyx_INCREF(__pyx_n_u_ilim);
        __Pyx_GIVEREF(__pyx_n_u_ilim);
        PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_8, __pyx_n_u_ilim);
        __Pyx_INCREF(__pyx_v_interval);
        __Pyx_GIVEREF(__pyx_v_interval);
        PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_8, __pyx_v_interval);
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 508, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "mathics/builtin/numeric.py":509
 *             if not isinstance(intvar, Symbol):
 *                 evaluation.message("ilim", interval)
 *                 return None             # <<<<<<<<<<<<<<
 *             boundaries = [a for a in interval.leaves[1:]]
 *             if any([b.get_head_name() == "System`Complex" for b in boundaries]):
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;

      /* "mathics/builtin/numeric.py":507
 *             intervals = []
 *             intvar = interval.leaves[0]
 *             if not isinstance(intvar, Symbol):             # <<<<<<<<<<<<<<
 *                 evaluation.message("ilim", interval)
 *                 return None
 */
    }

    /* "mathics/builtin/numeric.py":510
 *                 evaluation.message("ilim", interval)
 *                 return None
 *             boundaries = [a for a in interval.leaves[1:]]             # <<<<<<<<<<<<<<
 *             if any([b.get_head_name() == "System`Complex" for b in boundaries]):
 *                 intvar = Expression(
 */
    { /* enter inner scope */
      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 510, __pyx_L11_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_interval, __pyx_n_s_leaves); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 510, __pyx_L11_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __Pyx_PyObject_GetSlice(__pyx_t_2, 1, 0, NULL, NULL, &__pyx_slice__16, 1, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 510, __pyx_L11_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) {
        __pyx_t_2 = __pyx_t_6; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
        __pyx_t_5 = NULL;
      } else {
        __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 510, __pyx_L11_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 510, __pyx_L11_error)
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      for (;;) {
        if (likely(!__pyx_t_5)) {
          if (likely(PyList_CheckExact(__pyx_t_2))) {
            if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_6 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 510, __pyx_L11_error)
            #else
            __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 510, __pyx_L11_error)
            __Pyx_GOTREF(__pyx_t_6);
            #endif
          } else {
            if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 510, __pyx_L11_error)
            #else
            __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 510, __pyx_L11_error)
            __Pyx_GOTREF(__pyx_t_6);
            #endif
          }
        } else {
          __pyx_t_6 = __pyx_t_5(__pyx_t_2);
          if (unlikely(!__pyx_t_6)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 510, __pyx_L11_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_6);
        }
        __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_a, __pyx_t_6);
        __pyx_t_6 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_8genexpr1__pyx_v_a))) __PYX_ERR(0, 510, __pyx_L11_error)
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_a); __pyx_8genexpr1__pyx_v_a = 0;
      goto __pyx_L14_exit_scope;
      __pyx_L11_error:;
      __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_a); __pyx_8genexpr1__pyx_v_a = 0;
      goto __pyx_L1_error;
      __pyx_L14_exit_scope:;
    } /* exit inner scope */
    __pyx_v_boundaries = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "mathics/builtin/numeric.py":511
 *                 return None
 *             boundaries = [a for a in interval.leaves[1:]]
 *             if any([b.get_head_name() == "System`Complex" for b in boundaries]):             # <<<<<<<<<<<<<<
 *                 intvar = Expression(
 *                     "List", intvar, Expression("Blank", Symbol("Complex"))
 */
    { /* enter inner scope */
      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 511, __pyx_L18_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __pyx_v_boundaries; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
      for (;;) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_6 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 511, __pyx_L18_error)
        #else
        __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 511, __pyx_L18_error)
        __Pyx_GOTREF(__pyx_t_6);
        #endif
        __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_b, __pyx_t_6);
        __pyx_t_6 = 0;
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr2__pyx_v_b, __pyx_n_s_get_head_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 511, __pyx_L18_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_9 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7);
          if (likely(__pyx_t_9)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_9);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_7, function);
          }
        }
        __pyx_t_6 = (__pyx_t_9) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_9) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 511, __pyx_L18_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, __pyx_kp_u_System_Complex, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 511, __pyx_L18_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 511, __pyx_L18_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_b); __pyx_8genexpr2__pyx_v_b = 0;
      goto __pyx_L21_exit_scope;
      __pyx_L18_error:;
      __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_b); __pyx_8genexpr2__pyx_v_b = 0;
      goto __pyx_L1_error;
      __pyx_L21_exit_scope:;
    } /* exit inner scope */
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_any, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 511, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 511, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_11) {

      /* "mathics/builtin/numeric.py":512
 *             boundaries = [a for a in interval.leaves[1:]]
 *             if any([b.get_head_name() == "System`Complex" for b in boundaries]):
 *                 intvar = Expression(             # <<<<<<<<<<<<<<
 *                     "List", intvar, Expression("Blank", Symbol("Complex"))
 *                 )
 */
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Expression); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 512, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);

      /* "mathics/builtin/numeric.py":513
 *             if any([b.get_head_name() == "System`Complex" for b in boundaries]):
 *                 intvar = Expression(
 *                     "List", intvar, Expression("Blank", Symbol("Complex"))             # <<<<<<<<<<<<<<
 *                 )
 *             for i in range(len(boundaries) - 1):
 */
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_Expression); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 513, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 513, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_13 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
        __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_12);
        if (likely(__pyx_t_13)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
          __Pyx_INCREF(__pyx_t_13);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_12, function);
        }
      }
      __pyx_t_9 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_13, __pyx_n_u_Complex) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_n_u_Complex);
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 513, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
          __pyx_t_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_n_u_Blank, __pyx_t_9};
        __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 513, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_n_u_Blank, __pyx_t_9};
        __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 513, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else
      #endif
      {
        __pyx_t_13 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 513, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        if (__pyx_t_12) {
          __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12); __pyx_t_12 = NULL;
        }
        __Pyx_INCREF(__pyx_n_u_Blank);
        __Pyx_GIVEREF(__pyx_n_u_Blank);
        PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_8, __pyx_n_u_Blank);
        __Pyx_GIVEREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_8, __pyx_t_9);
        __pyx_t_9 = 0;
        __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_13, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 513, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
          __pyx_t_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_n_u_List, __pyx_v_intvar, __pyx_t_7};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 512, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_n_u_List, __pyx_v_intvar, __pyx_t_7};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 512, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else
      #endif
      {
        __pyx_t_13 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 512, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        if (__pyx_t_6) {
          __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_6); __pyx_t_6 = NULL;
        }
        __Pyx_INCREF(__pyx_n_u_List);
        __Pyx_GIVEREF(__pyx_n_u_List);
        PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_8, __pyx_n_u_List);
        __Pyx_INCREF(__pyx_v_intvar);
        __Pyx_GIVEREF(__pyx_v_intvar);
        PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_8, __pyx_v_intvar);
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_13, 2+__pyx_t_8, __pyx_t_7);
        __pyx_t_7 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_13, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 512, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF_SET(__pyx_v_intvar, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "mathics/builtin/numeric.py":511
 *                 return None
 *             boundaries = [a for a in interval.leaves[1:]]
 *             if any([b.get_head_name() == "System`Complex" for b in boundaries]):             # <<<<<<<<<<<<<<
 *                 intvar = Expression(
 *                     "List", intvar, Expression("Blank", Symbol("Complex"))
 */
    }

    /* "mathics/builtin/numeric.py":515
 *                     "List", intvar, Expression("Blank", Symbol("Complex"))
 *                 )
 *             for i in range(len(boundaries) - 1):             # <<<<<<<<<<<<<<
 *                 intervals.append((boundaries[i], boundaries[i + 1]))
 *             if len(intervals) > 0:
 */
    __pyx_t_4 = PyList_GET_SIZE(__pyx_v_boundaries); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 515, __pyx_L1_error)
    __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_4 - 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 515, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 515, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
      __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
      __pyx_t_5 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 515, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 515, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    for (;;) {
      if (likely(!__pyx_t_5)) {
        if (likely(PyList_CheckExact(__pyx_t_2))) {
          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 515, __pyx_L1_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 515, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        } else {
          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 515, __pyx_L1_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 515, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        }
      } else {
        __pyx_t_1 = __pyx_t_5(__pyx_t_2);
        if (unlikely(!__pyx_t_1)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 515, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "mathics/builtin/numeric.py":516
 *                 )
 *             for i in range(len(boundaries) - 1):
 *                 intervals.append((boundaries[i], boundaries[i + 1]))             # <<<<<<<<<<<<<<
 *             if len(intervals) > 0:
 *                 return (intvar, intervals)
 */
      __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_boundaries, __pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 516, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_13 = __Pyx_PyInt_AddObjC(__pyx_v_i, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 516, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_boundaries, __pyx_t_13); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 516, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 516, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_7);
      __pyx_t_1 = 0;
      __pyx_t_7 = 0;
      __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_intervals, __pyx_t_13); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 516, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

      /* "mathics/builtin/numeric.py":515
 *                     "List", intvar, Expression("Blank", Symbol("Complex"))
 *                 )
 *             for i in range(len(boundaries) - 1):             # <<<<<<<<<<<<<<
 *                 intervals.append((boundaries[i], boundaries[i + 1]))
 *             if len(intervals) > 0:
 */
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "mathics/builtin/numeric.py":517
 *             for i in range(len(boundaries) - 1):
 *                 intervals.append((boundaries[i], boundaries[i + 1]))
 *             if len(intervals) > 0:             # <<<<<<<<<<<<<<
 *                 return (intvar, intervals)
 * 
 */
    __pyx_t_4 = PyList_GET_SIZE(__pyx_v_intervals); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 517, __pyx_L1_error)
    __pyx_t_11 = ((__pyx_t_4 > 0) != 0);
    if (__pyx_t_11) {

      /* "mathics/builtin/numeric.py":518
 *                 intervals.append((boundaries[i], boundaries[i + 1]))
 *             if len(intervals) > 0:
 *                 return (intvar, intervals)             # <<<<<<<<<<<<<<
 * 
 *         evaluation.message("ilim", interval)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 518, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_intvar);
      __Pyx_GIVEREF(__pyx_v_intvar);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_intvar);
      __Pyx_INCREF(__pyx_v_intervals);
      __Pyx_GIVEREF(__pyx_v_intervals);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_intervals);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* "mathics/builtin/numeric.py":517
 *             for i in range(len(boundaries) - 1):
 *                 intervals.append((boundaries[i], boundaries[i + 1]))
 *             if len(intervals) > 0:             # <<<<<<<<<<<<<<
 *                 return (intvar, intervals)
 * 
 */
    }

    /* "mathics/builtin/numeric.py":504
 *             return intervals
 * 
 *         if interval.has_form("System`List", 3, None):             # <<<<<<<<<<<<<<
 *             intervals = []
 *             intvar = interval.leaves[0]
 */
  }

  /* "mathics/builtin/numeric.py":520
 *                 return (intvar, intervals)
 * 
 *         evaluation.message("ilim", interval)             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_message); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 520, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_7 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_13);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_13, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_13)) {
    PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_n_u_ilim, __pyx_v_interval};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 520, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) {
    PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_n_u_ilim, __pyx_v_interval};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 520, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  {
    __pyx_t_1 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 520, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_INCREF(__pyx_n_u_ilim);
    __Pyx_GIVEREF(__pyx_n_u_ilim);
    PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_8, __pyx_n_u_ilim);
    __Pyx_INCREF(__pyx_v_interval);
    __Pyx_GIVEREF(__pyx_v_interval);
    PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_8, __pyx_v_interval);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 520, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":521
 * 
 *         evaluation.message("ilim", interval)
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     def apply_with_func_domain(self, func, domain, evaluation, options):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "mathics/builtin/numeric.py":492
 * 
 *     @staticmethod
 *     def decompose_domain(interval, evaluation):             # <<<<<<<<<<<<<<
 *         if interval.has_form("System`Sequence", 1, None):
 *             intervals = []
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("mathics.builtin.numeric.NIntegrate.decompose_domain", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_intervals);
  __Pyx_XDECREF(__pyx_v_leaf);
  __Pyx_XDECREF(__pyx_v_inner_interval);
  __Pyx_XDECREF(__pyx_v_intvar);
  __Pyx_XDECREF(__pyx_v_boundaries);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_a);
  __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_b);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":523
 *         return None
 * 
 *     def apply_with_func_domain(self, func, domain, evaluation, options):             # <<<<<<<<<<<<<<
 *         "%(name)s[func_, domain__, OptionsPattern[%(name)s]]"
 *         method = options["System`Method"].evaluate(evaluation)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_10NIntegrate_5apply_with_func_domain(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_7builtin_7numeric_10NIntegrate_4apply_with_func_domain[] = "%(name)s[func_, domain__, OptionsPattern[%(name)s]]";
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_10NIntegrate_5apply_with_func_domain = {"apply_with_func_domain", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_10NIntegrate_5apply_with_func_domain, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_7builtin_7numeric_10NIntegrate_4apply_with_func_domain};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_10NIntegrate_5apply_with_func_domain(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_func = 0;
  PyObject *__pyx_v_domain = 0;
  PyObject *__pyx_v_evaluation = 0;
  PyObject *__pyx_v_options = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("apply_with_func_domain (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_func,&__pyx_n_s_domain,&__pyx_n_s_evaluation,&__pyx_n_s_options,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_func)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_with_func_domain", 1, 5, 5, 1); __PYX_ERR(0, 523, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_domain)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_with_func_domain", 1, 5, 5, 2); __PYX_ERR(0, 523, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_with_func_domain", 1, 5, 5, 3); __PYX_ERR(0, 523, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_with_func_domain", 1, 5, 5, 4); __PYX_ERR(0, 523, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply_with_func_domain") < 0)) __PYX_ERR(0, 523, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
    }
    __pyx_v_self = values[0];
    __pyx_v_func = values[1];
    __pyx_v_domain = values[2];
    __pyx_v_evaluation = values[3];
    __pyx_v_options = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("apply_with_func_domain", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 523, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.NIntegrate.apply_with_func_domain", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_10NIntegrate_4apply_with_func_domain(__pyx_self, __pyx_v_self, __pyx_v_func, __pyx_v_domain, __pyx_v_evaluation, __pyx_v_options);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":600
 *                             subdomain2.append([le, -le])
 *                         coordtransform.append(
 *                             (np.arctanh, lambda u: 1.0 / (1.0 - u ** 2))             # <<<<<<<<<<<<<<
 *                         )
 *                     else:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_10NIntegrate_22apply_with_func_domain_lambda4(PyObject *__pyx_self, PyObject *__pyx_v_u); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_10NIntegrate_22apply_with_func_domain_lambda4 = {"lambda4", (PyCFunction)__pyx_pw_7mathics_7builtin_7numeric_10NIntegrate_22apply_with_func_domain_lambda4, METH_O, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_10NIntegrate_22apply_with_func_domain_lambda4(PyObject *__pyx_self, PyObject *__pyx_v_u) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lambda4 (wrapper)", 0);
  __pyx_r = __pyx_lambda_funcdef_lambda4(__pyx_self, ((PyObject *)__pyx_v_u));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_lambda_funcdef_lambda4(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_u) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lambda4", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyNumber_Power(__pyx_v_u, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyFloat_SubtractCObj(__pyx_float_1_0, __pyx_t_1, 1.0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyFloat_TrueDivideCObj(__pyx_float_1_0, __pyx_t_2, 1.0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("mathics.builtin.numeric.NIntegrate.apply_with_func_domain.lambda4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":610
 *                         subdomain2.append([machine_epsilon, 1.0])
 *                         coordtransform.append(
 *                             (lambda u: b - z + z / u, lambda u: -z * u ** (-2.0))             # <<<<<<<<<<<<<<
 *                         )
 *                 elif b.get_head_name() == "System`DirectedInfinity":
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_10NIntegrate_22apply_with_func_domain_1lambda5(PyObject *__pyx_self, PyObject *__pyx_v_u); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_10NIntegrate_22apply_with_func_domain_1lambda5 = {"lambda5", (PyCFunction)__pyx_pw_7mathics_7builtin_7numeric_10NIntegrate_22apply_with_func_domain_1lambda5, METH_O, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_10NIntegrate_22apply_with_func_domain_1lambda5(PyObject *__pyx_self, PyObject *__pyx_v_u) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lambda5 (wrapper)", 0);
  __pyx_r = __pyx_lambda_funcdef_lambda5(__pyx_self, ((PyObject *)__pyx_v_u));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_lambda_funcdef_lambda5(PyObject *__pyx_self, PyObject *__pyx_v_u) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain *__pyx_cur_scope;
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain *__pyx_outer_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lambda5", 0);
  __pyx_outer_scope = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_cur_scope->__pyx_v_b)) { __Pyx_RaiseClosureNameError("b"); __PYX_ERR(0, 610, __pyx_L1_error) }
  if (unlikely(!__pyx_cur_scope->__pyx_v_z)) { __Pyx_RaiseClosureNameError("z"); __PYX_ERR(0, 610, __pyx_L1_error) }
  __pyx_t_1 = PyNumber_Subtract(__pyx_cur_scope->__pyx_v_b, __pyx_cur_scope->__pyx_v_z); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(!__pyx_cur_scope->__pyx_v_z)) { __Pyx_RaiseClosureNameError("z"); __PYX_ERR(0, 610, __pyx_L1_error) }
  __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_cur_scope->__pyx_v_z, __pyx_v_u); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.builtin.numeric.NIntegrate.apply_with_func_domain.lambda5", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_10NIntegrate_22apply_with_func_domain_2lambda6(PyObject *__pyx_self, PyObject *__pyx_v_u); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_10NIntegrate_22apply_with_func_domain_2lambda6 = {"lambda6", (PyCFunction)__pyx_pw_7mathics_7builtin_7numeric_10NIntegrate_22apply_with_func_domain_2lambda6, METH_O, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_10NIntegrate_22apply_with_func_domain_2lambda6(PyObject *__pyx_self, PyObject *__pyx_v_u) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lambda6 (wrapper)", 0);
  __pyx_r = __pyx_lambda_funcdef_lambda6(__pyx_self, ((PyObject *)__pyx_v_u));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_lambda_funcdef_lambda6(PyObject *__pyx_self, PyObject *__pyx_v_u) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain *__pyx_cur_scope;
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain *__pyx_outer_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lambda6", 0);
  __pyx_outer_scope = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_cur_scope->__pyx_v_z)) { __Pyx_RaiseClosureNameError("z"); __PYX_ERR(0, 610, __pyx_L1_error) }
  __pyx_t_1 = PyNumber_Negative(__pyx_cur_scope->__pyx_v_z); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Power(__pyx_v_u, __pyx_float_neg_2_0, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.builtin.numeric.NIntegrate.apply_with_func_domain.lambda6", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":620
 *                     subdomain2.append([machine_epsilon, 1.0])
 *                     coordtransform.append(
 *                         (lambda u: a - z + z / u, lambda u: z * u ** (-2.0))             # <<<<<<<<<<<<<<
 *                     )
 *                 elif a.is_numeric() and b.is_numeric():
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_10NIntegrate_22apply_with_func_domain_3lambda7(PyObject *__pyx_self, PyObject *__pyx_v_u); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_10NIntegrate_22apply_with_func_domain_3lambda7 = {"lambda7", (PyCFunction)__pyx_pw_7mathics_7builtin_7numeric_10NIntegrate_22apply_with_func_domain_3lambda7, METH_O, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_10NIntegrate_22apply_with_func_domain_3lambda7(PyObject *__pyx_self, PyObject *__pyx_v_u) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lambda7 (wrapper)", 0);
  __pyx_r = __pyx_lambda_funcdef_lambda7(__pyx_self, ((PyObject *)__pyx_v_u));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_lambda_funcdef_lambda7(PyObject *__pyx_self, PyObject *__pyx_v_u) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain *__pyx_cur_scope;
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain *__pyx_outer_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lambda7", 0);
  __pyx_outer_scope = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_cur_scope->__pyx_v_a)) { __Pyx_RaiseClosureNameError("a"); __PYX_ERR(0, 620, __pyx_L1_error) }
  if (unlikely(!__pyx_cur_scope->__pyx_v_z)) { __Pyx_RaiseClosureNameError("z"); __PYX_ERR(0, 620, __pyx_L1_error) }
  __pyx_t_1 = PyNumber_Subtract(__pyx_cur_scope->__pyx_v_a, __pyx_cur_scope->__pyx_v_z); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 620, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(!__pyx_cur_scope->__pyx_v_z)) { __Pyx_RaiseClosureNameError("z"); __PYX_ERR(0, 620, __pyx_L1_error) }
  __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_cur_scope->__pyx_v_z, __pyx_v_u); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 620, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 620, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.builtin.numeric.NIntegrate.apply_with_func_domain.lambda7", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_10NIntegrate_22apply_with_func_domain_4lambda8(PyObject *__pyx_self, PyObject *__pyx_v_u); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_10NIntegrate_22apply_with_func_domain_4lambda8 = {"lambda8", (PyCFunction)__pyx_pw_7mathics_7builtin_7numeric_10NIntegrate_22apply_with_func_domain_4lambda8, METH_O, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_10NIntegrate_22apply_with_func_domain_4lambda8(PyObject *__pyx_self, PyObject *__pyx_v_u) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lambda8 (wrapper)", 0);
  __pyx_r = __pyx_lambda_funcdef_lambda8(__pyx_self, ((PyObject *)__pyx_v_u));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_lambda_funcdef_lambda8(PyObject *__pyx_self, PyObject *__pyx_v_u) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain *__pyx_cur_scope;
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain *__pyx_outer_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lambda8", 0);
  __pyx_outer_scope = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_cur_scope->__pyx_v_z)) { __Pyx_RaiseClosureNameError("z"); __PYX_ERR(0, 620, __pyx_L1_error) }
  __pyx_t_1 = PyNumber_Power(__pyx_v_u, __pyx_float_neg_2_0, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 620, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Multiply(__pyx_cur_scope->__pyx_v_z, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 620, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("mathics.builtin.numeric.NIntegrate.apply_with_func_domain.lambda8", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":637
 * 
 *             if any(coordtransform):
 *                 func2 = lambda *u: (             # <<<<<<<<<<<<<<
 *                     integrand(
 *                         *[
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_10NIntegrate_22apply_with_func_domain_5lambda9(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_10NIntegrate_22apply_with_func_domain_5lambda9 = {"lambda9", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_10NIntegrate_22apply_with_func_domain_5lambda9, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_10NIntegrate_22apply_with_func_domain_5lambda9(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_u = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lambda9 (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "lambda9", 0))) return NULL;
  __Pyx_INCREF(__pyx_args);
  __pyx_v_u = __pyx_args;
  __pyx_r = __pyx_lambda_funcdef_lambda9(__pyx_self, __pyx_v_u);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_u);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_lambda_funcdef_lambda9(PyObject *__pyx_self, PyObject *__pyx_v_u) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain *__pyx_cur_scope;
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain *__pyx_outer_scope;
  PyObject *__pyx_8genexpr6__pyx_v_i = NULL;
  PyObject *__pyx_8genexpr6__pyx_v_x = NULL;
  PyObject *__pyx_8genexpr7__pyx_v_i = NULL;
  PyObject *__pyx_8genexpr7__pyx_v_jac = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lambda9", 0);
  __pyx_outer_scope = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "mathics/builtin/numeric.py":644
 *                         ]
 *                     )
 *                     * np.prod(             # <<<<<<<<<<<<<<
 *                         [jac[1](u[i]) for i, jac in enumerate(coordtransform) if jac]
 *                     )
 */
  __Pyx_XDECREF(__pyx_r);

  /* "mathics/builtin/numeric.py":638
 *             if any(coordtransform):
 *                 func2 = lambda *u: (
 *                     integrand(             # <<<<<<<<<<<<<<
 *                         *[
 *                             x[0](u[i]) if x else u[i]
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_integrand)) { __Pyx_RaiseClosureNameError("integrand"); __PYX_ERR(0, 638, __pyx_L1_error) }
  { /* enter inner scope */

    /* "mathics/builtin/numeric.py":639
 *                 func2 = lambda *u: (
 *                     integrand(
 *                         *[             # <<<<<<<<<<<<<<
 *                             x[0](u[i]) if x else u[i]
 *                             for i, x in enumerate(coordtransform)
 */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 639, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_t_2 = __pyx_int_0;

    /* "mathics/builtin/numeric.py":641
 *                         *[
 *                             x[0](u[i]) if x else u[i]
 *                             for i, x in enumerate(coordtransform)             # <<<<<<<<<<<<<<
 *                         ]
 *                     )
 */
    if (unlikely(!__pyx_cur_scope->__pyx_v_coordtransform)) { __Pyx_RaiseClosureNameError("coordtransform"); __PYX_ERR(0, 641, __pyx_L5_error) }
    __pyx_t_3 = __pyx_cur_scope->__pyx_v_coordtransform; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
    for (;;) {
      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 641, __pyx_L5_error)
      #else
      __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 641, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_XDECREF_SET(__pyx_8genexpr6__pyx_v_x, __pyx_t_5);
      __pyx_t_5 = 0;
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_XDECREF_SET(__pyx_8genexpr6__pyx_v_i, __pyx_t_2);
      __pyx_t_5 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 641, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2);
      __pyx_t_2 = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "mathics/builtin/numeric.py":640
 *                     integrand(
 *                         *[
 *                             x[0](u[i]) if x else u[i]             # <<<<<<<<<<<<<<
 *                             for i, x in enumerate(coordtransform)
 *                         ]
 */
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_8genexpr6__pyx_v_x); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 640, __pyx_L5_error)
      if (__pyx_t_6) {
        __pyx_t_8 = __Pyx_GetItemInt(__pyx_8genexpr6__pyx_v_x, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 640, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_v_u, __pyx_8genexpr6__pyx_v_i); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 640, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_10 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
          __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_8);
          if (likely(__pyx_t_10)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
            __Pyx_INCREF(__pyx_t_10);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_8, function);
          }
        }
        __pyx_t_7 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_10, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9);
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 640, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_5 = __pyx_t_7;
        __pyx_t_7 = 0;
      } else {
        __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_u, __pyx_8genexpr6__pyx_v_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 640, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = __pyx_t_7;
        __pyx_t_7 = 0;
      }
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 639, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "mathics/builtin/numeric.py":641
 *                         *[
 *                             x[0](u[i]) if x else u[i]
 *                             for i, x in enumerate(coordtransform)             # <<<<<<<<<<<<<<
 *                         ]
 *                     )
 */
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_i); __pyx_8genexpr6__pyx_v_i = 0;
    __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_x); __pyx_8genexpr6__pyx_v_x = 0;
    goto __pyx_L8_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_i); __pyx_8genexpr6__pyx_v_i = 0;
    __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_x); __pyx_8genexpr6__pyx_v_x = 0;
    goto __pyx_L1_error;
    __pyx_L8_exit_scope:;
  } /* exit inner scope */

  /* "mathics/builtin/numeric.py":638
 *             if any(coordtransform):
 *                 func2 = lambda *u: (
 *                     integrand(             # <<<<<<<<<<<<<<
 *                         *[
 *                             x[0](u[i]) if x else u[i]
 */
  __pyx_t_2 = PySequence_Tuple(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_cur_scope->__pyx_v_integrand, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":644
 *                         ]
 *                     )
 *                     * np.prod(             # <<<<<<<<<<<<<<
 *                         [jac[1](u[i]) for i, jac in enumerate(coordtransform) if jac]
 *                     )
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 644, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_prod); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 644, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  { /* enter inner scope */

    /* "mathics/builtin/numeric.py":645
 *                     )
 *                     * np.prod(
 *                         [jac[1](u[i]) for i, jac in enumerate(coordtransform) if jac]             # <<<<<<<<<<<<<<
 *                     )
 *                 )
 */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 645, __pyx_L11_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_t_7 = __pyx_int_0;
    if (unlikely(!__pyx_cur_scope->__pyx_v_coordtransform)) { __Pyx_RaiseClosureNameError("coordtransform"); __PYX_ERR(0, 645, __pyx_L11_error) }
    __pyx_t_8 = __pyx_cur_scope->__pyx_v_coordtransform; __Pyx_INCREF(__pyx_t_8); __pyx_t_4 = 0;
    for (;;) {
      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_8)) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_9 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_4); __Pyx_INCREF(__pyx_t_9); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 645, __pyx_L11_error)
      #else
      __pyx_t_9 = PySequence_ITEM(__pyx_t_8, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 645, __pyx_L11_error)
      __Pyx_GOTREF(__pyx_t_9);
      #endif
      __Pyx_XDECREF_SET(__pyx_8genexpr7__pyx_v_jac, __pyx_t_9);
      __pyx_t_9 = 0;
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_XDECREF_SET(__pyx_8genexpr7__pyx_v_i, __pyx_t_7);
      __pyx_t_9 = __Pyx_PyInt_AddObjC(__pyx_t_7, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 645, __pyx_L11_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_7);
      __pyx_t_7 = __pyx_t_9;
      __pyx_t_9 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_8genexpr7__pyx_v_jac); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 645, __pyx_L11_error)
      if (__pyx_t_6) {
        __pyx_t_10 = __Pyx_GetItemInt(__pyx_8genexpr7__pyx_v_jac, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 645, __pyx_L11_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_u, __pyx_8genexpr7__pyx_v_i); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 645, __pyx_L11_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_12 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
          __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_10);
          if (likely(__pyx_t_12)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
            __Pyx_INCREF(__pyx_t_12);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_10, function);
          }
        }
        __pyx_t_9 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_12, __pyx_t_11) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_11);
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 645, __pyx_L11_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_9))) __PYX_ERR(0, 645, __pyx_L11_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_i); __pyx_8genexpr7__pyx_v_i = 0;
    __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_jac); __pyx_8genexpr7__pyx_v_jac = 0;
    goto __pyx_L15_exit_scope;
    __pyx_L11_error:;
    __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_i); __pyx_8genexpr7__pyx_v_i = 0;
    __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_jac); __pyx_8genexpr7__pyx_v_jac = 0;
    goto __pyx_L1_error;
    __pyx_L15_exit_scope:;
  } /* exit inner scope */
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_2 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 644, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/builtin/numeric.py":644
 *                         ]
 *                     )
 *                     * np.prod(             # <<<<<<<<<<<<<<
 *                         [jac[1](u[i]) for i, jac in enumerate(coordtransform) if jac]
 *                     )
 */
  __pyx_t_5 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 644, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "mathics/builtin/numeric.py":637
 * 
 *             if any(coordtransform):
 *                 func2 = lambda *u: (             # <<<<<<<<<<<<<<
 *                     integrand(
 *                         *[
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("mathics.builtin.numeric.NIntegrate.apply_with_func_domain.lambda9", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_i);
  __Pyx_XDECREF(__pyx_8genexpr6__pyx_v_x);
  __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_i);
  __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_jac);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":523
 *         return None
 * 
 *     def apply_with_func_domain(self, func, domain, evaluation, options):             # <<<<<<<<<<<<<<
 *         "%(name)s[func_, domain__, OptionsPattern[%(name)s]]"
 *         method = options["System`Method"].evaluate(evaluation)
 */

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_10NIntegrate_4apply_with_func_domain(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_func, PyObject *__pyx_v_domain, PyObject *__pyx_v_evaluation, PyObject *__pyx_v_options) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain *__pyx_cur_scope;
  PyObject *__pyx_v_method = NULL;
  PyObject *__pyx_v_method_options = NULL;
  PyObject *__pyx_v_tolerance = NULL;
  PyObject *__pyx_v_accuracy = NULL;
  PyObject *__pyx_v_maxrecursion = NULL;
  PyObject *__pyx_v_nintegrate_method = NULL;
  PyObject *__pyx_v_is_multidimensional = NULL;
  PyObject *__pyx_v_coords = NULL;
  PyObject *__pyx_v_intvars = NULL;
  PyObject *__pyx_v_results = NULL;
  PyObject *__pyx_v_subdomain = NULL;
  PyObject *__pyx_v_func2 = NULL;
  PyObject *__pyx_v_subdomain2 = NULL;
  int __pyx_v_nulldomain;
  PyObject *__pyx_v_r = NULL;
  PyObject *__pyx_v_le = NULL;
  PyObject *__pyx_v_opts = NULL;
  PyObject *__pyx_v_val = NULL;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_8genexpr3__pyx_v_axis = NULL;
  PyObject *__pyx_8genexpr4__pyx_v_c = NULL;
  PyObject *__pyx_8genexpr5__pyx_v_axis = NULL;
  PyObject *__pyx_8genexpr8__pyx_v_r = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  Py_ssize_t __pyx_t_9;
  PyObject *(*__pyx_t_10)(PyObject *);
  PyObject *__pyx_t_11 = NULL;
  Py_ssize_t __pyx_t_12;
  PyObject *(*__pyx_t_13)(PyObject *);
  PyObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  Py_ssize_t __pyx_t_19;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  PyObject *__pyx_t_22 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("apply_with_func_domain", 0);
  __pyx_cur_scope = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain *)__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain(__pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 523, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __Pyx_INCREF(__pyx_v_domain);

  /* "mathics/builtin/numeric.py":525
 *     def apply_with_func_domain(self, func, domain, evaluation, options):
 *         "%(name)s[func_, domain__, OptionsPattern[%(name)s]]"
 *         method = options["System`Method"].evaluate(evaluation)             # <<<<<<<<<<<<<<
 *         method_options = {}
 *         if method.has_form("System`List", 2):
 */
  __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_options, __pyx_kp_u_System_Method); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_evaluate); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_evaluation) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_evaluation);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_method = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":526
 *         "%(name)s[func_, domain__, OptionsPattern[%(name)s]]"
 *         method = options["System`Method"].evaluate(evaluation)
 *         method_options = {}             # <<<<<<<<<<<<<<
 *         if method.has_form("System`List", 2):
 *             method = method.leaves[0]
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_method_options = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":527
 *         method = options["System`Method"].evaluate(evaluation)
 *         method_options = {}
 *         if method.has_form("System`List", 2):             # <<<<<<<<<<<<<<
 *             method = method.leaves[0]
 *             method_options.update(method.leaves[1].get_option_values())
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_method, __pyx_n_s_has_form); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 527, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 527, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 527, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_4) {

    /* "mathics/builtin/numeric.py":528
 *         method_options = {}
 *         if method.has_form("System`List", 2):
 *             method = method.leaves[0]             # <<<<<<<<<<<<<<
 *             method_options.update(method.leaves[1].get_option_values())
 *         if isinstance(method, String):
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_method, __pyx_n_s_leaves); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 528, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 528, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_method, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "mathics/builtin/numeric.py":529
 *         if method.has_form("System`List", 2):
 *             method = method.leaves[0]
 *             method_options.update(method.leaves[1].get_option_values())             # <<<<<<<<<<<<<<
 *         if isinstance(method, String):
 *             method = method.value
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_method, __pyx_n_s_leaves); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 529, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 529, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get_option_values); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 529, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 529, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_update, __pyx_v_method_options, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 529, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "mathics/builtin/numeric.py":527
 *         method = options["System`Method"].evaluate(evaluation)
 *         method_options = {}
 *         if method.has_form("System`List", 2):             # <<<<<<<<<<<<<<
 *             method = method.leaves[0]
 *             method_options.update(method.leaves[1].get_option_values())
 */
  }

  /* "mathics/builtin/numeric.py":530
 *             method = method.leaves[0]
 *             method_options.update(method.leaves[1].get_option_values())
 *         if isinstance(method, String):             # <<<<<<<<<<<<<<
 *             method = method.value
 *         elif isinstance(method, Symbol):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_String); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 530, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_IsInstance(__pyx_v_method, __pyx_t_3); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 530, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "mathics/builtin/numeric.py":531
 *             method_options.update(method.leaves[1].get_option_values())
 *         if isinstance(method, String):
 *             method = method.value             # <<<<<<<<<<<<<<
 *         elif isinstance(method, Symbol):
 *             method = method.get_name()
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_method, __pyx_n_s_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 531, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_method, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "mathics/builtin/numeric.py":530
 *             method = method.leaves[0]
 *             method_options.update(method.leaves[1].get_option_values())
 *         if isinstance(method, String):             # <<<<<<<<<<<<<<
 *             method = method.value
 *         elif isinstance(method, Symbol):
 */
    goto __pyx_L4;
  }

  /* "mathics/builtin/numeric.py":532
 *         if isinstance(method, String):
 *             method = method.value
 *         elif isinstance(method, Symbol):             # <<<<<<<<<<<<<<
 *             method = method.get_name()
 *         else:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 532, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyObject_IsInstance(__pyx_v_method, __pyx_t_3); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 532, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = (__pyx_t_5 != 0);
  if (__pyx_t_4) {

    /* "mathics/builtin/numeric.py":533
 *             method = method.value
 *         elif isinstance(method, Symbol):
 *             method = method.get_name()             # <<<<<<<<<<<<<<
 *         else:
 *             evaluation.message("NIntegrate", "bdmtd", method)
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_method, __pyx_n_s_get_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 533, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 533, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_method, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "mathics/builtin/numeric.py":532
 *         if isinstance(method, String):
 *             method = method.value
 *         elif isinstance(method, Symbol):             # <<<<<<<<<<<<<<
 *             method = method.get_name()
 *         else:
 */
    goto __pyx_L4;
  }

  /* "mathics/builtin/numeric.py":535
 *             method = method.get_name()
 *         else:
 *             evaluation.message("NIntegrate", "bdmtd", method)             # <<<<<<<<<<<<<<
 *             return
 *         tolerance = options["System`Tolerance"].evaluate(evaluation)
 */
  /*else*/ {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_message); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 535, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_n_u_NIntegrate, __pyx_n_u_bdmtd, __pyx_v_method};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 535, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_n_u_NIntegrate, __pyx_n_u_bdmtd, __pyx_v_method};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 535, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 535, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_2) {
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); __pyx_t_2 = NULL;
      }
      __Pyx_INCREF(__pyx_n_u_NIntegrate);
      __Pyx_GIVEREF(__pyx_n_u_NIntegrate);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_n_u_NIntegrate);
      __Pyx_INCREF(__pyx_n_u_bdmtd);
      __Pyx_GIVEREF(__pyx_n_u_bdmtd);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_n_u_bdmtd);
      __Pyx_INCREF(__pyx_v_method);
      __Pyx_GIVEREF(__pyx_v_method);
      PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_v_method);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 535, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "mathics/builtin/numeric.py":536
 *         else:
 *             evaluation.message("NIntegrate", "bdmtd", method)
 *             return             # <<<<<<<<<<<<<<
 *         tolerance = options["System`Tolerance"].evaluate(evaluation)
 *         tolerance = float(tolerance.value)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }
  __pyx_L4:;

  /* "mathics/builtin/numeric.py":537
 *             evaluation.message("NIntegrate", "bdmtd", method)
 *             return
 *         tolerance = options["System`Tolerance"].evaluate(evaluation)             # <<<<<<<<<<<<<<
 *         tolerance = float(tolerance.value)
 *         accuracy = options["System`Accuracy"].evaluate(evaluation)
 */
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_options, __pyx_kp_u_System_Tolerance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 537, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_evaluate); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 537, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_1, __pyx_v_evaluation) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_evaluation);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 537, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_tolerance = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "mathics/builtin/numeric.py":538
 *             return
 *         tolerance = options["System`Tolerance"].evaluate(evaluation)
 *         tolerance = float(tolerance.value)             # <<<<<<<<<<<<<<
 *         accuracy = options["System`Accuracy"].evaluate(evaluation)
 *         accuracy = accuracy.value
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_tolerance, __pyx_n_s_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 538, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = __Pyx_PyNumber_Float(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 538, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF_SET(__pyx_v_tolerance, __pyx_t_7);
  __pyx_t_7 = 0;

  /* "mathics/builtin/numeric.py":539
 *         tolerance = options["System`Tolerance"].evaluate(evaluation)
 *         tolerance = float(tolerance.value)
 *         accuracy = options["System`Accuracy"].evaluate(evaluation)             # <<<<<<<<<<<<<<
 *         accuracy = accuracy.value
 *         maxrecursion = options["System`MaxRecursion"].evaluate(evaluation)
 */
  __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_options, __pyx_kp_u_System_Accuracy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_evaluate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_7 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_3, __pyx_v_evaluation) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_evaluation);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_accuracy = __pyx_t_7;
  __pyx_t_7 = 0;

  /* "mathics/builtin/numeric.py":540
 *         tolerance = float(tolerance.value)
 *         accuracy = options["System`Accuracy"].evaluate(evaluation)
 *         accuracy = accuracy.value             # <<<<<<<<<<<<<<
 *         maxrecursion = options["System`MaxRecursion"].evaluate(evaluation)
 *         maxrecursion = maxrecursion.value
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_accuracy, __pyx_n_s_value); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 540, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF_SET(__pyx_v_accuracy, __pyx_t_7);
  __pyx_t_7 = 0;

  /* "mathics/builtin/numeric.py":541
 *         accuracy = options["System`Accuracy"].evaluate(evaluation)
 *         accuracy = accuracy.value
 *         maxrecursion = options["System`MaxRecursion"].evaluate(evaluation)             # <<<<<<<<<<<<<<
 *         maxrecursion = maxrecursion.value
 *         nintegrate_method = self.methods.get(method, None)
 */
  __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_options, __pyx_kp_u_System_MaxRecursion); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_evaluate); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_7 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_v_evaluation) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_evaluation);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_maxrecursion = __pyx_t_7;
  __pyx_t_7 = 0;

  /* "mathics/builtin/numeric.py":542
 *         accuracy = accuracy.value
 *         maxrecursion = options["System`MaxRecursion"].evaluate(evaluation)
 *         maxrecursion = maxrecursion.value             # <<<<<<<<<<<<<<
 *         nintegrate_method = self.methods.get(method, None)
 *         if nintegrate_method is None:
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_maxrecursion, __pyx_n_s_value); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 542, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF_SET(__pyx_v_maxrecursion, __pyx_t_7);
  __pyx_t_7 = 0;

  /* "mathics/builtin/numeric.py":543
 *         maxrecursion = options["System`MaxRecursion"].evaluate(evaluation)
 *         maxrecursion = maxrecursion.value
 *         nintegrate_method = self.methods.get(method, None)             # <<<<<<<<<<<<<<
 *         if nintegrate_method is None:
 *             evaluation.message("NIntegrate", "bdmtd", method)
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_methods); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 543, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 543, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_method, Py_None};
    __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 543, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_7);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_method, Py_None};
    __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 543, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_7);
  } else
  #endif
  {
    __pyx_t_2 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 543, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_method);
    __Pyx_GIVEREF(__pyx_v_method);
    PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_6, __pyx_v_method);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_6, Py_None);
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 543, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_nintegrate_method = __pyx_t_7;
  __pyx_t_7 = 0;

  /* "mathics/builtin/numeric.py":544
 *         maxrecursion = maxrecursion.value
 *         nintegrate_method = self.methods.get(method, None)
 *         if nintegrate_method is None:             # <<<<<<<<<<<<<<
 *             evaluation.message("NIntegrate", "bdmtd", method)
 *             nintegrate_method = self.methods.get("Automatic")
 */
  __pyx_t_4 = (__pyx_v_nintegrate_method == Py_None);
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "mathics/builtin/numeric.py":545
 *         nintegrate_method = self.methods.get(method, None)
 *         if nintegrate_method is None:
 *             evaluation.message("NIntegrate", "bdmtd", method)             # <<<<<<<<<<<<<<
 *             nintegrate_method = self.methods.get("Automatic")
 *         if type(nintegrate_method) is tuple:
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_message); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 545, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_n_u_NIntegrate, __pyx_n_u_bdmtd, __pyx_v_method};
      __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 545, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_7);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_n_u_NIntegrate, __pyx_n_u_bdmtd, __pyx_v_method};
      __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 545, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_7);
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 545, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (__pyx_t_2) {
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL;
      }
      __Pyx_INCREF(__pyx_n_u_NIntegrate);
      __Pyx_GIVEREF(__pyx_n_u_NIntegrate);
      PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_6, __pyx_n_u_NIntegrate);
      __Pyx_INCREF(__pyx_n_u_bdmtd);
      __Pyx_GIVEREF(__pyx_n_u_bdmtd);
      PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_6, __pyx_n_u_bdmtd);
      __Pyx_INCREF(__pyx_v_method);
      __Pyx_GIVEREF(__pyx_v_method);
      PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_6, __pyx_v_method);
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 545, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "mathics/builtin/numeric.py":546
 *         if nintegrate_method is None:
 *             evaluation.message("NIntegrate", "bdmtd", method)
 *             nintegrate_method = self.methods.get("Automatic")             # <<<<<<<<<<<<<<
 *         if type(nintegrate_method) is tuple:
 *             nintegrate_method, is_multidimensional = nintegrate_method
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_methods); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 546, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 546, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_7 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_n_u_Automatic) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_n_u_Automatic);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 546, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_nintegrate_method, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "mathics/builtin/numeric.py":544
 *         maxrecursion = maxrecursion.value
 *         nintegrate_method = self.methods.get(method, None)
 *         if nintegrate_method is None:             # <<<<<<<<<<<<<<
 *             evaluation.message("NIntegrate", "bdmtd", method)
 *             nintegrate_method = self.methods.get("Automatic")
 */
  }

  /* "mathics/builtin/numeric.py":547
 *             evaluation.message("NIntegrate", "bdmtd", method)
 *             nintegrate_method = self.methods.get("Automatic")
 *         if type(nintegrate_method) is tuple:             # <<<<<<<<<<<<<<
 *             nintegrate_method, is_multidimensional = nintegrate_method
 *         else:
 */
  __pyx_t_5 = (((PyObject *)Py_TYPE(__pyx_v_nintegrate_method)) == ((PyObject *)(&PyTuple_Type)));
  __pyx_t_4 = (__pyx_t_5 != 0);
  if (__pyx_t_4) {

    /* "mathics/builtin/numeric.py":548
 *             nintegrate_method = self.methods.get("Automatic")
 *         if type(nintegrate_method) is tuple:
 *             nintegrate_method, is_multidimensional = nintegrate_method             # <<<<<<<<<<<<<<
 *         else:
 *             is_multidimensional = False
 */
    if ((likely(PyTuple_CheckExact(__pyx_v_nintegrate_method))) || (PyList_CheckExact(__pyx_v_nintegrate_method))) {
      PyObject* sequence = __pyx_v_nintegrate_method;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 548, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_3);
      #else
      __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 548, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 548, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      #endif
    } else {
      Py_ssize_t index = -1;
      __pyx_t_1 = PyObject_GetIter(__pyx_v_nintegrate_method); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 548, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_8 = Py_TYPE(__pyx_t_1)->tp_iternext;
      index = 0; __pyx_t_7 = __pyx_t_8(__pyx_t_1); if (unlikely(!__pyx_t_7)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 1; __pyx_t_3 = __pyx_t_8(__pyx_t_1); if (unlikely(!__pyx_t_3)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_1), 2) < 0) __PYX_ERR(0, 548, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L8_unpacking_done;
      __pyx_L7_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 548, __pyx_L1_error)
      __pyx_L8_unpacking_done:;
    }
    __Pyx_DECREF_SET(__pyx_v_nintegrate_method, __pyx_t_7);
    __pyx_t_7 = 0;
    __pyx_v_is_multidimensional = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "mathics/builtin/numeric.py":547
 *             evaluation.message("NIntegrate", "bdmtd", method)
 *             nintegrate_method = self.methods.get("Automatic")
 *         if type(nintegrate_method) is tuple:             # <<<<<<<<<<<<<<
 *             nintegrate_method, is_multidimensional = nintegrate_method
 *         else:
 */
    goto __pyx_L6;
  }

  /* "mathics/builtin/numeric.py":550
 *             nintegrate_method, is_multidimensional = nintegrate_method
 *         else:
 *             is_multidimensional = False             # <<<<<<<<<<<<<<
 * 
 *         domain = self.decompose_domain(domain, evaluation)
 */
  /*else*/ {
    __Pyx_INCREF(Py_False);
    __pyx_v_is_multidimensional = Py_False;
  }
  __pyx_L6:;

  /* "mathics/builtin/numeric.py":552
 *             is_multidimensional = False
 * 
 *         domain = self.decompose_domain(domain, evaluation)             # <<<<<<<<<<<<<<
 *         if not domain:
 *             return
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_decompose_domain); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 552, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_7)) {
    PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_domain, __pyx_v_evaluation};
    __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 552, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
    PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_domain, __pyx_v_evaluation};
    __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 552, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else
  #endif
  {
    __pyx_t_2 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 552, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__pyx_t_1) {
      __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = NULL;
    }
    __Pyx_INCREF(__pyx_v_domain);
    __Pyx_GIVEREF(__pyx_v_domain);
    PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_6, __pyx_v_domain);
    __Pyx_INCREF(__pyx_v_evaluation);
    __Pyx_GIVEREF(__pyx_v_evaluation);
    PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_6, __pyx_v_evaluation);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 552, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF_SET(__pyx_v_domain, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "mathics/builtin/numeric.py":553
 * 
 *         domain = self.decompose_domain(domain, evaluation)
 *         if not domain:             # <<<<<<<<<<<<<<
 *             return
 *         if not isinstance(domain, list):
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_domain); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 553, __pyx_L1_error)
  __pyx_t_5 = ((!__pyx_t_4) != 0);
  if (__pyx_t_5) {

    /* "mathics/builtin/numeric.py":554
 *         domain = self.decompose_domain(domain, evaluation)
 *         if not domain:
 *             return             # <<<<<<<<<<<<<<
 *         if not isinstance(domain, list):
 *             domain = [domain]
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "mathics/builtin/numeric.py":553
 * 
 *         domain = self.decompose_domain(domain, evaluation)
 *         if not domain:             # <<<<<<<<<<<<<<
 *             return
 *         if not isinstance(domain, list):
 */
  }

  /* "mathics/builtin/numeric.py":555
 *         if not domain:
 *             return
 *         if not isinstance(domain, list):             # <<<<<<<<<<<<<<
 *             domain = [domain]
 * 
 */
  __pyx_t_5 = PyList_Check(__pyx_v_domain); 
  __pyx_t_4 = ((!(__pyx_t_5 != 0)) != 0);
  if (__pyx_t_4) {

    /* "mathics/builtin/numeric.py":556
 *             return
 *         if not isinstance(domain, list):
 *             domain = [domain]             # <<<<<<<<<<<<<<
 * 
 *         coords = [axis[0] for axis in domain]
 */
    __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 556, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_domain);
    __Pyx_GIVEREF(__pyx_v_domain);
    PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_domain);
    __Pyx_DECREF_SET(__pyx_v_domain, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "mathics/builtin/numeric.py":555
 *         if not domain:
 *             return
 *         if not isinstance(domain, list):             # <<<<<<<<<<<<<<
 *             domain = [domain]
 * 
 */
  }

  /* "mathics/builtin/numeric.py":558
 *             domain = [domain]
 * 
 *         coords = [axis[0] for axis in domain]             # <<<<<<<<<<<<<<
 *         # If any of the points in the integration domain is complex,
 *         # stop the evaluation...
 */
  { /* enter inner scope */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 558, __pyx_L13_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (likely(PyList_CheckExact(__pyx_v_domain)) || PyTuple_CheckExact(__pyx_v_domain)) {
      __pyx_t_7 = __pyx_v_domain; __Pyx_INCREF(__pyx_t_7); __pyx_t_9 = 0;
      __pyx_t_10 = NULL;
    } else {
      __pyx_t_9 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_domain); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 558, __pyx_L13_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_10 = Py_TYPE(__pyx_t_7)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 558, __pyx_L13_error)
    }
    for (;;) {
      if (likely(!__pyx_t_10)) {
        if (likely(PyList_CheckExact(__pyx_t_7))) {
          if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_7)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_9); __Pyx_INCREF(__pyx_t_2); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 558, __pyx_L13_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_7, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 558, __pyx_L13_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        } else {
          if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_7)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_9); __Pyx_INCREF(__pyx_t_2); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 558, __pyx_L13_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_7, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 558, __pyx_L13_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        }
      } else {
        __pyx_t_2 = __pyx_t_10(__pyx_t_7);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 558, __pyx_L13_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_XDECREF_SET(__pyx_8genexpr3__pyx_v_axis, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_8genexpr3__pyx_v_axis, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 558, __pyx_L13_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 558, __pyx_L13_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_axis); __pyx_8genexpr3__pyx_v_axis = 0;
    goto __pyx_L16_exit_scope;
    __pyx_L13_error:;
    __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_axis); __pyx_8genexpr3__pyx_v_axis = 0;
    goto __pyx_L1_error;
    __pyx_L16_exit_scope:;
  } /* exit inner scope */
  __pyx_v_coords = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "mathics/builtin/numeric.py":561
 *         # If any of the points in the integration domain is complex,
 *         # stop the evaluation...
 *         if any([c.get_head_name() == "System`List" for c in coords]):             # <<<<<<<<<<<<<<
 *             evaluation.message("NIntegrate", "cmpint")
 *             return
 */
  { /* enter inner scope */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 561, __pyx_L20_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __pyx_v_coords; __Pyx_INCREF(__pyx_t_7); __pyx_t_9 = 0;
    for (;;) {
      if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_7)) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_9); __Pyx_INCREF(__pyx_t_2); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 561, __pyx_L20_error)
      #else
      __pyx_t_2 = PySequence_ITEM(__pyx_t_7, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 561, __pyx_L20_error)
      __Pyx_GOTREF(__pyx_t_2);
      #endif
      __Pyx_XDECREF_SET(__pyx_8genexpr4__pyx_v_c, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr4__pyx_v_c, __pyx_n_s_get_head_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 561, __pyx_L20_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_11 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_11) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_11) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 561, __pyx_L20_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_kp_u_System_List, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 561, __pyx_L20_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 561, __pyx_L20_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_c); __pyx_8genexpr4__pyx_v_c = 0;
    goto __pyx_L23_exit_scope;
    __pyx_L20_error:;
    __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_c); __pyx_8genexpr4__pyx_v_c = 0;
    goto __pyx_L1_error;
    __pyx_L23_exit_scope:;
  } /* exit inner scope */
  __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_any, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 561, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 561, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_4) {

    /* "mathics/builtin/numeric.py":562
 *         # stop the evaluation...
 *         if any([c.get_head_name() == "System`List" for c in coords]):
 *             evaluation.message("NIntegrate", "cmpint")             # <<<<<<<<<<<<<<
 *             return
 * 
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_message); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 562, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 562, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "mathics/builtin/numeric.py":563
 *         if any([c.get_head_name() == "System`List" for c in coords]):
 *             evaluation.message("NIntegrate", "cmpint")
 *             return             # <<<<<<<<<<<<<<
 * 
 *         intvars = Expression(SymbolList, *coords)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "mathics/builtin/numeric.py":561
 *         # If any of the points in the integration domain is complex,
 *         # stop the evaluation...
 *         if any([c.get_head_name() == "System`List" for c in coords]):             # <<<<<<<<<<<<<<
 *             evaluation.message("NIntegrate", "cmpint")
 *             return
 */
  }

  /* "mathics/builtin/numeric.py":565
 *             return
 * 
 *         intvars = Expression(SymbolList, *coords)             # <<<<<<<<<<<<<<
 *         integrand = Expression("Compile", intvars, func).evaluate(evaluation)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Expression); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 565, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_SymbolList); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 565, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 565, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7);
  __pyx_t_7 = 0;
  __pyx_t_7 = PySequence_Tuple(__pyx_v_coords); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 565, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 565, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 565, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_intvars = __pyx_t_7;
  __pyx_t_7 = 0;

  /* "mathics/builtin/numeric.py":566
 * 
 *         intvars = Expression(SymbolList, *coords)
 *         integrand = Expression("Compile", intvars, func).evaluate(evaluation)             # <<<<<<<<<<<<<<
 * 
 *         if len(integrand.leaves) >= 3:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Expression); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_1, __pyx_n_u_Compile, __pyx_v_intvars, __pyx_v_func};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 566, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_1, __pyx_n_u_Compile, __pyx_v_intvars, __pyx_v_func};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 566, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  {
    __pyx_t_11 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 566, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    if (__pyx_t_1) {
      __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_1); __pyx_t_1 = NULL;
    }
    __Pyx_INCREF(__pyx_n_u_Compile);
    __Pyx_GIVEREF(__pyx_n_u_Compile);
    PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_6, __pyx_n_u_Compile);
    __Pyx_INCREF(__pyx_v_intvars);
    __Pyx_GIVEREF(__pyx_v_intvars);
    PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_6, __pyx_v_intvars);
    __Pyx_INCREF(__pyx_v_func);
    __Pyx_GIVEREF(__pyx_v_func);
    PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_6, __pyx_v_func);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_11, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 566, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_evaluate); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_7 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_evaluation) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_evaluation);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_cur_scope->__pyx_v_integrand = __pyx_t_7;
  __pyx_t_7 = 0;

  /* "mathics/builtin/numeric.py":568
 *         integrand = Expression("Compile", intvars, func).evaluate(evaluation)
 * 
 *         if len(integrand.leaves) >= 3:             # <<<<<<<<<<<<<<
 *             integrand = integrand.leaves[2].cfunc
 *         else:
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_integrand, __pyx_n_s_leaves); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 568, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_9 = PyObject_Length(__pyx_t_7); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 568, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_4 = ((__pyx_t_9 >= 3) != 0);
  if (__pyx_t_4) {

    /* "mathics/builtin/numeric.py":569
 * 
 *         if len(integrand.leaves) >= 3:
 *             integrand = integrand.leaves[2].cfunc             # <<<<<<<<<<<<<<
 *         else:
 *             evaluation.message("inumer", func, domain)
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_integrand, __pyx_n_s_leaves); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 569, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_7, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 569, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_cfunc); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 569, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_integrand);
    __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_integrand, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    __pyx_t_7 = 0;

    /* "mathics/builtin/numeric.py":568
 *         integrand = Expression("Compile", intvars, func).evaluate(evaluation)
 * 
 *         if len(integrand.leaves) >= 3:             # <<<<<<<<<<<<<<
 *             integrand = integrand.leaves[2].cfunc
 *         else:
 */
    goto __pyx_L24;
  }

  /* "mathics/builtin/numeric.py":571
 *             integrand = integrand.leaves[2].cfunc
 *         else:
 *             evaluation.message("inumer", func, domain)             # <<<<<<<<<<<<<<
 *             return
 *         results = []
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_message); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 571, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_n_u_inumer, __pyx_v_func, __pyx_v_domain};
      __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 571, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_7);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_n_u_inumer, __pyx_v_func, __pyx_v_domain};
      __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 571, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_7);
    } else
    #endif
    {
      __pyx_t_11 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 571, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      if (__pyx_t_2) {
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_2); __pyx_t_2 = NULL;
      }
      __Pyx_INCREF(__pyx_n_u_inumer);
      __Pyx_GIVEREF(__pyx_n_u_inumer);
      PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_6, __pyx_n_u_inumer);
      __Pyx_INCREF(__pyx_v_func);
      __Pyx_GIVEREF(__pyx_v_func);
      PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_6, __pyx_v_func);
      __Pyx_INCREF(__pyx_v_domain);
      __Pyx_GIVEREF(__pyx_v_domain);
      PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_6, __pyx_v_domain);
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_11, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 571, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "mathics/builtin/numeric.py":572
 *         else:
 *             evaluation.message("inumer", func, domain)
 *             return             # <<<<<<<<<<<<<<
 *         results = []
 *         for subdomain in product(*[axis[1] for axis in domain]):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
  }
  __pyx_L24:;

  /* "mathics/builtin/numeric.py":573
 *             evaluation.message("inumer", func, domain)
 *             return
 *         results = []             # <<<<<<<<<<<<<<
 *         for subdomain in product(*[axis[1] for axis in domain]):
 *             # On each subdomain, check if the region is bounded.
 */
  __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 573, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_v_results = ((PyObject*)__pyx_t_7);
  __pyx_t_7 = 0;

  /* "mathics/builtin/numeric.py":574
 *             return
 *         results = []
 *         for subdomain in product(*[axis[1] for axis in domain]):             # <<<<<<<<<<<<<<
 *             # On each subdomain, check if the region is bounded.
 *             # If not, implement a coordinate map
 */
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_product); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  { /* enter inner scope */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 574, __pyx_L29_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (likely(PyList_CheckExact(__pyx_v_domain)) || PyTuple_CheckExact(__pyx_v_domain)) {
      __pyx_t_11 = __pyx_v_domain; __Pyx_INCREF(__pyx_t_11); __pyx_t_9 = 0;
      __pyx_t_10 = NULL;
    } else {
      __pyx_t_9 = -1; __pyx_t_11 = PyObject_GetIter(__pyx_v_domain); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 574, __pyx_L29_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_10 = Py_TYPE(__pyx_t_11)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 574, __pyx_L29_error)
    }
    for (;;) {
      if (likely(!__pyx_t_10)) {
        if (likely(PyList_CheckExact(__pyx_t_11))) {
          if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_11)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_11, __pyx_t_9); __Pyx_INCREF(__pyx_t_2); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 574, __pyx_L29_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_11, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 574, __pyx_L29_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        } else {
          if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_11)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_11, __pyx_t_9); __Pyx_INCREF(__pyx_t_2); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 574, __pyx_L29_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_11, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 574, __pyx_L29_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        }
      } else {
        __pyx_t_2 = __pyx_t_10(__pyx_t_11);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 574, __pyx_L29_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_XDECREF_SET(__pyx_8genexpr5__pyx_v_axis, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_8genexpr5__pyx_v_axis, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 574, __pyx_L29_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 574, __pyx_L29_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_axis); __pyx_8genexpr5__pyx_v_axis = 0;
    goto __pyx_L32_exit_scope;
    __pyx_L29_error:;
    __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_axis); __pyx_8genexpr5__pyx_v_axis = 0;
    goto __pyx_L1_error;
    __pyx_L32_exit_scope:;
  } /* exit inner scope */
  __pyx_t_11 = PySequence_Tuple(__pyx_t_3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
    __pyx_t_11 = __pyx_t_3; __Pyx_INCREF(__pyx_t_11); __pyx_t_9 = 0;
    __pyx_t_10 = NULL;
  } else {
    __pyx_t_9 = -1; __pyx_t_11 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 574, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_10 = Py_TYPE(__pyx_t_11)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 574, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    if (likely(!__pyx_t_10)) {
      if (likely(PyList_CheckExact(__pyx_t_11))) {
        if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_11)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_11, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 574, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_11, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 574, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      } else {
        if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_11)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_11, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 574, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_11, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 574, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      }
    } else {
      __pyx_t_3 = __pyx_t_10(__pyx_t_11);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 574, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_XDECREF_SET(__pyx_v_subdomain, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "mathics/builtin/numeric.py":577
 *             # On each subdomain, check if the region is bounded.
 *             # If not, implement a coordinate map
 *             func2 = integrand             # <<<<<<<<<<<<<<
 *             subdomain2 = []
 *             coordtransform = []
 */
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_integrand);
    __Pyx_XDECREF_SET(__pyx_v_func2, __pyx_cur_scope->__pyx_v_integrand);

    /* "mathics/builtin/numeric.py":578
 *             # If not, implement a coordinate map
 *             func2 = integrand
 *             subdomain2 = []             # <<<<<<<<<<<<<<
 *             coordtransform = []
 *             nulldomain = False
 */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 578, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_subdomain2, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "mathics/builtin/numeric.py":579
 *             func2 = integrand
 *             subdomain2 = []
 *             coordtransform = []             # <<<<<<<<<<<<<<
 *             nulldomain = False
 *             for i, r in enumerate(subdomain):
 */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 579, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_coordtransform);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_coordtransform, ((PyObject*)__pyx_t_3));
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;

    /* "mathics/builtin/numeric.py":580
 *             subdomain2 = []
 *             coordtransform = []
 *             nulldomain = False             # <<<<<<<<<<<<<<
 *             for i, r in enumerate(subdomain):
 *                 a = r[0].evaluate(evaluation)
 */
    __pyx_v_nulldomain = 0;

    /* "mathics/builtin/numeric.py":581
 *             coordtransform = []
 *             nulldomain = False
 *             for i, r in enumerate(subdomain):             # <<<<<<<<<<<<<<
 *                 a = r[0].evaluate(evaluation)
 *                 b = r[1].evaluate(evaluation)
 */
    __Pyx_INCREF(__pyx_int_0);
    __pyx_t_3 = __pyx_int_0;
    if (likely(PyList_CheckExact(__pyx_v_subdomain)) || PyTuple_CheckExact(__pyx_v_subdomain)) {
      __pyx_t_7 = __pyx_v_subdomain; __Pyx_INCREF(__pyx_t_7); __pyx_t_12 = 0;
      __pyx_t_13 = NULL;
    } else {
      __pyx_t_12 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_subdomain); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 581, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_13 = Py_TYPE(__pyx_t_7)->tp_iternext; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 581, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_13)) {
        if (likely(PyList_CheckExact(__pyx_t_7))) {
          if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_7)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_12); __Pyx_INCREF(__pyx_t_2); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 581, __pyx_L1_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_7, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 581, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        } else {
          if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_7)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_12); __Pyx_INCREF(__pyx_t_2); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 581, __pyx_L1_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_7, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 581, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        }
      } else {
        __pyx_t_2 = __pyx_t_13(__pyx_t_7);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 581, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_XDECREF_SET(__pyx_v_r, __pyx_t_2);
      __pyx_t_2 = 0;
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_i);
      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_i, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 581, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3);
      __pyx_t_3 = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "mathics/builtin/numeric.py":582
 *             nulldomain = False
 *             for i, r in enumerate(subdomain):
 *                 a = r[0].evaluate(evaluation)             # <<<<<<<<<<<<<<
 *                 b = r[1].evaluate(evaluation)
 *                 if a == b:
 */
      __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_r, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 582, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_evaluate); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 582, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_14);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_14, function);
        }
      }
      __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_1, __pyx_v_evaluation) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_v_evaluation);
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 582, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_a);
      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_a, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;

      /* "mathics/builtin/numeric.py":583
 *             for i, r in enumerate(subdomain):
 *                 a = r[0].evaluate(evaluation)
 *                 b = r[1].evaluate(evaluation)             # <<<<<<<<<<<<<<
 *                 if a == b:
 *                     nulldomain = True
 */
      __pyx_t_14 = __Pyx_GetItemInt(__pyx_v_r, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 583, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_evaluate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 583, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_14 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_14)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_14);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_14, __pyx_v_evaluation) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_evaluation);
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 583, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_b);
      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_b, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;

      /* "mathics/builtin/numeric.py":584
 *                 a = r[0].evaluate(evaluation)
 *                 b = r[1].evaluate(evaluation)
 *                 if a == b:             # <<<<<<<<<<<<<<
 *                     nulldomain = True
 *                     break
 */
      __pyx_t_2 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_a, __pyx_cur_scope->__pyx_v_b, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 584, __pyx_L1_error)
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 584, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_4) {

        /* "mathics/builtin/numeric.py":585
 *                 b = r[1].evaluate(evaluation)
 *                 if a == b:
 *                     nulldomain = True             # <<<<<<<<<<<<<<
 *                     break
 *                 elif a.get_head_name() == "System`DirectedInfinity":
 */
        __pyx_v_nulldomain = 1;

        /* "mathics/builtin/numeric.py":586
 *                 if a == b:
 *                     nulldomain = True
 *                     break             # <<<<<<<<<<<<<<
 *                 elif a.get_head_name() == "System`DirectedInfinity":
 *                     if b.get_head_name() == "System`DirectedInfinity":
 */
        goto __pyx_L34_break;

        /* "mathics/builtin/numeric.py":584
 *                 a = r[0].evaluate(evaluation)
 *                 b = r[1].evaluate(evaluation)
 *                 if a == b:             # <<<<<<<<<<<<<<
 *                     nulldomain = True
 *                     break
 */
      }

      /* "mathics/builtin/numeric.py":587
 *                     nulldomain = True
 *                     break
 *                 elif a.get_head_name() == "System`DirectedInfinity":             # <<<<<<<<<<<<<<
 *                     if b.get_head_name() == "System`DirectedInfinity":
 *                         a = a.to_python()
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_a, __pyx_n_s_get_head_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 587, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_14 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_14)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_14);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_14) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_14) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 587, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_kp_u_System_DirectedInfinity, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 587, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_4) {

        /* "mathics/builtin/numeric.py":588
 *                     break
 *                 elif a.get_head_name() == "System`DirectedInfinity":
 *                     if b.get_head_name() == "System`DirectedInfinity":             # <<<<<<<<<<<<<<
 *                         a = a.to_python()
 *                         b = b.to_python()
 */
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_b, __pyx_n_s_get_head_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 588, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_14 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
          __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_1);
          if (likely(__pyx_t_14)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_14);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_1, function);
          }
        }
        __pyx_t_2 = (__pyx_t_14) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_14) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 588, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_kp_u_System_DirectedInfinity, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 588, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (__pyx_t_4) {

          /* "mathics/builtin/numeric.py":589
 *                 elif a.get_head_name() == "System`DirectedInfinity":
 *                     if b.get_head_name() == "System`DirectedInfinity":
 *                         a = a.to_python()             # <<<<<<<<<<<<<<
 *                         b = b.to_python()
 *                         le = 1 - machine_epsilon
 */
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_a, __pyx_n_s_to_python); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 589, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_14 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
            __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_1);
            if (likely(__pyx_t_14)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
              __Pyx_INCREF(__pyx_t_14);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_1, function);
            }
          }
          __pyx_t_2 = (__pyx_t_14) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_14) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
          __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 589, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_a);
          __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_a, __pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_2);
          __pyx_t_2 = 0;

          /* "mathics/builtin/numeric.py":590
 *                     if b.get_head_name() == "System`DirectedInfinity":
 *                         a = a.to_python()
 *                         b = b.to_python()             # <<<<<<<<<<<<<<
 *                         le = 1 - machine_epsilon
 *                         if a == b:
 */
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_b, __pyx_n_s_to_python); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 590, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_14 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
            __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_1);
            if (likely(__pyx_t_14)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
              __Pyx_INCREF(__pyx_t_14);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_1, function);
            }
          }
          __pyx_t_2 = (__pyx_t_14) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_14) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
          __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
          if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 590, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_b);
          __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_b, __pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_2);
          __pyx_t_2 = 0;

          /* "mathics/builtin/numeric.py":591
 *                         a = a.to_python()
 *                         b = b.to_python()
 *                         le = 1 - machine_epsilon             # <<<<<<<<<<<<<<
 *                         if a == b:
 *                             nulldomain = True
 */
          __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_machine_epsilon); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 591, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_1 = __Pyx_PyInt_SubtractCObj(__pyx_int_1, __pyx_t_2, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 591, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_XDECREF_SET(__pyx_v_le, __pyx_t_1);
          __pyx_t_1 = 0;

          /* "mathics/builtin/numeric.py":592
 *                         b = b.to_python()
 *                         le = 1 - machine_epsilon
 *                         if a == b:             # <<<<<<<<<<<<<<
 *                             nulldomain = True
 *                             break
 */
          __pyx_t_1 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_a, __pyx_cur_scope->__pyx_v_b, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 592, __pyx_L1_error)
          __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 592, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (__pyx_t_4) {

            /* "mathics/builtin/numeric.py":593
 *                         le = 1 - machine_epsilon
 *                         if a == b:
 *                             nulldomain = True             # <<<<<<<<<<<<<<
 *                             break
 *                         elif a < b:
 */
            __pyx_v_nulldomain = 1;

            /* "mathics/builtin/numeric.py":594
 *                         if a == b:
 *                             nulldomain = True
 *                             break             # <<<<<<<<<<<<<<
 *                         elif a < b:
 *                             subdomain2.append([-le, le])
 */
            goto __pyx_L34_break;

            /* "mathics/builtin/numeric.py":592
 *                         b = b.to_python()
 *                         le = 1 - machine_epsilon
 *                         if a == b:             # <<<<<<<<<<<<<<
 *                             nulldomain = True
 *                             break
 */
          }

          /* "mathics/builtin/numeric.py":595
 *                             nulldomain = True
 *                             break
 *                         elif a < b:             # <<<<<<<<<<<<<<
 *                             subdomain2.append([-le, le])
 *                         else:
 */
          __pyx_t_1 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_a, __pyx_cur_scope->__pyx_v_b, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 595, __pyx_L1_error)
          __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 595, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (__pyx_t_4) {

            /* "mathics/builtin/numeric.py":596
 *                             break
 *                         elif a < b:
 *                             subdomain2.append([-le, le])             # <<<<<<<<<<<<<<
 *                         else:
 *                             subdomain2.append([le, -le])
 */
            __pyx_t_1 = PyNumber_Negative(__pyx_v_le); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 596, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
            __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 596, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_GIVEREF(__pyx_t_1);
            PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
            __Pyx_INCREF(__pyx_v_le);
            __Pyx_GIVEREF(__pyx_v_le);
            PyList_SET_ITEM(__pyx_t_2, 1, __pyx_v_le);
            __pyx_t_1 = 0;
            __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_subdomain2, __pyx_t_2); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 596, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

            /* "mathics/builtin/numeric.py":595
 *                             nulldomain = True
 *                             break
 *                         elif a < b:             # <<<<<<<<<<<<<<
 *                             subdomain2.append([-le, le])
 *                         else:
 */
            goto __pyx_L37;
          }

          /* "mathics/builtin/numeric.py":598
 *                             subdomain2.append([-le, le])
 *                         else:
 *                             subdomain2.append([le, -le])             # <<<<<<<<<<<<<<
 *                         coordtransform.append(
 *                             (np.arctanh, lambda u: 1.0 / (1.0 - u ** 2))
 */
          /*else*/ {
            __pyx_t_2 = PyNumber_Negative(__pyx_v_le); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 598, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 598, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_INCREF(__pyx_v_le);
            __Pyx_GIVEREF(__pyx_v_le);
            PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_le);
            __Pyx_GIVEREF(__pyx_t_2);
            PyList_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
            __pyx_t_2 = 0;
            __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_subdomain2, __pyx_t_1); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 598, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          }
          __pyx_L37:;

          /* "mathics/builtin/numeric.py":600
 *                             subdomain2.append([le, -le])
 *                         coordtransform.append(
 *                             (np.arctanh, lambda u: 1.0 / (1.0 - u ** 2))             # <<<<<<<<<<<<<<
 *                         )
 *                     else:
 */
          __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 600, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_arctanh); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 600, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_10NIntegrate_22apply_with_func_domain_lambda4, 0, __pyx_n_s_NIntegrate_apply_with_func_domai, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 600, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 600, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_1);
          PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_1);
          __pyx_t_2 = 0;
          __pyx_t_1 = 0;

          /* "mathics/builtin/numeric.py":599
 *                         else:
 *                             subdomain2.append([le, -le])
 *                         coordtransform.append(             # <<<<<<<<<<<<<<
 *                             (np.arctanh, lambda u: 1.0 / (1.0 - u ** 2))
 *                         )
 */
          __pyx_t_15 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_coordtransform, __pyx_t_14); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 599, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

          /* "mathics/builtin/numeric.py":588
 *                     break
 *                 elif a.get_head_name() == "System`DirectedInfinity":
 *                     if b.get_head_name() == "System`DirectedInfinity":             # <<<<<<<<<<<<<<
 *                         a = a.to_python()
 *                         b = b.to_python()
 */
          goto __pyx_L36;
        }

        /* "mathics/builtin/numeric.py":603
 *                         )
 *                     else:
 *                         if not b.is_numeric():             # <<<<<<<<<<<<<<
 *                             evaluation.message("nlim", coords[i], b)
 *                             return
 */
        /*else*/ {
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_b, __pyx_n_s_is_numeric); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 603, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_2 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
            __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
            if (likely(__pyx_t_2)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
              __Pyx_INCREF(__pyx_t_2);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_1, function);
            }
          }
          __pyx_t_14 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 603, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 603, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __pyx_t_5 = ((!__pyx_t_4) != 0);
          if (__pyx_t_5) {

            /* "mathics/builtin/numeric.py":604
 *                     else:
 *                         if not b.is_numeric():
 *                             evaluation.message("nlim", coords[i], b)             # <<<<<<<<<<<<<<
 *                             return
 *                         z = a.leaves[0].value
 */
            __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_message); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 604, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
            __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_coords, __pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 604, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __pyx_t_16 = NULL;
            __pyx_t_6 = 0;
            if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
              __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_1);
              if (likely(__pyx_t_16)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
                __Pyx_INCREF(__pyx_t_16);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_1, function);
                __pyx_t_6 = 1;
              }
            }
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_1)) {
              PyObject *__pyx_temp[4] = {__pyx_t_16, __pyx_n_u_nlim, __pyx_t_2, __pyx_cur_scope->__pyx_v_b};
              __pyx_t_14 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 604, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
              __Pyx_GOTREF(__pyx_t_14);
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
              PyObject *__pyx_temp[4] = {__pyx_t_16, __pyx_n_u_nlim, __pyx_t_2, __pyx_cur_scope->__pyx_v_b};
              __pyx_t_14 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 604, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
              __Pyx_GOTREF(__pyx_t_14);
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            } else
            #endif
            {
              __pyx_t_17 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 604, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_17);
              if (__pyx_t_16) {
                __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_16); __pyx_t_16 = NULL;
              }
              __Pyx_INCREF(__pyx_n_u_nlim);
              __Pyx_GIVEREF(__pyx_n_u_nlim);
              PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_6, __pyx_n_u_nlim);
              __Pyx_GIVEREF(__pyx_t_2);
              PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_6, __pyx_t_2);
              __Pyx_INCREF(__pyx_cur_scope->__pyx_v_b);
              __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_b);
              PyTuple_SET_ITEM(__pyx_t_17, 2+__pyx_t_6, __pyx_cur_scope->__pyx_v_b);
              __pyx_t_2 = 0;
              __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_17, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 604, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_14);
              __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
            }
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

            /* "mathics/builtin/numeric.py":605
 *                         if not b.is_numeric():
 *                             evaluation.message("nlim", coords[i], b)
 *                             return             # <<<<<<<<<<<<<<
 *                         z = a.leaves[0].value
 *                         b = b.value
 */
            __Pyx_XDECREF(__pyx_r);
            __pyx_r = Py_None; __Pyx_INCREF(Py_None);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            goto __pyx_L0;

            /* "mathics/builtin/numeric.py":603
 *                         )
 *                     else:
 *                         if not b.is_numeric():             # <<<<<<<<<<<<<<
 *                             evaluation.message("nlim", coords[i], b)
 *                             return
 */
          }

          /* "mathics/builtin/numeric.py":606
 *                             evaluation.message("nlim", coords[i], b)
 *                             return
 *                         z = a.leaves[0].value             # <<<<<<<<<<<<<<
 *                         b = b.value
 *                         subdomain2.append([machine_epsilon, 1.0])
 */
          __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_a, __pyx_n_s_leaves); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 606, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_14, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 606, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_value); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 606, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_z);
          __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_z, __pyx_t_14);
          __Pyx_GIVEREF(__pyx_t_14);
          __pyx_t_14 = 0;

          /* "mathics/builtin/numeric.py":607
 *                             return
 *                         z = a.leaves[0].value
 *                         b = b.value             # <<<<<<<<<<<<<<
 *                         subdomain2.append([machine_epsilon, 1.0])
 *                         coordtransform.append(
 */
          __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_b, __pyx_n_s_value); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 607, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_b);
          __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_b, __pyx_t_14);
          __Pyx_GIVEREF(__pyx_t_14);
          __pyx_t_14 = 0;

          /* "mathics/builtin/numeric.py":608
 *                         z = a.leaves[0].value
 *                         b = b.value
 *                         subdomain2.append([machine_epsilon, 1.0])             # <<<<<<<<<<<<<<
 *                         coordtransform.append(
 *                             (lambda u: b - z + z / u, lambda u: -z * u ** (-2.0))
 */
          __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_machine_epsilon); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 608, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 608, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GIVEREF(__pyx_t_14);
          PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_14);
          __Pyx_INCREF(__pyx_float_1_0);
          __Pyx_GIVEREF(__pyx_float_1_0);
          PyList_SET_ITEM(__pyx_t_1, 1, __pyx_float_1_0);
          __pyx_t_14 = 0;
          __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_subdomain2, __pyx_t_1); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 608, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

          /* "mathics/builtin/numeric.py":610
 *                         subdomain2.append([machine_epsilon, 1.0])
 *                         coordtransform.append(
 *                             (lambda u: b - z + z / u, lambda u: -z * u ** (-2.0))             # <<<<<<<<<<<<<<
 *                         )
 *                 elif b.get_head_name() == "System`DirectedInfinity":
 */
          __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_10NIntegrate_22apply_with_func_domain_1lambda5, 0, __pyx_n_s_NIntegrate_apply_with_func_domai, ((PyObject*)__pyx_cur_scope), __pyx_n_s_mathics_builtin_numeric, __pyx_d, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 610, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_10NIntegrate_22apply_with_func_domain_2lambda6, 0, __pyx_n_s_NIntegrate_apply_with_func_domai, ((PyObject*)__pyx_cur_scope), __pyx_n_s_mathics_builtin_numeric, __pyx_d, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 610, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 610, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_17);
          __Pyx_GIVEREF(__pyx_t_1);
          PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_1);
          __Pyx_GIVEREF(__pyx_t_14);
          PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_14);
          __pyx_t_1 = 0;
          __pyx_t_14 = 0;

          /* "mathics/builtin/numeric.py":609
 *                         b = b.value
 *                         subdomain2.append([machine_epsilon, 1.0])
 *                         coordtransform.append(             # <<<<<<<<<<<<<<
 *                             (lambda u: b - z + z / u, lambda u: -z * u ** (-2.0))
 *                         )
 */
          __pyx_t_15 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_coordtransform, __pyx_t_17); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 609, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        }
        __pyx_L36:;

        /* "mathics/builtin/numeric.py":587
 *                     nulldomain = True
 *                     break
 *                 elif a.get_head_name() == "System`DirectedInfinity":             # <<<<<<<<<<<<<<
 *                     if b.get_head_name() == "System`DirectedInfinity":
 *                         a = a.to_python()
 */
        goto __pyx_L35;
      }

      /* "mathics/builtin/numeric.py":612
 *                             (lambda u: b - z + z / u, lambda u: -z * u ** (-2.0))
 *                         )
 *                 elif b.get_head_name() == "System`DirectedInfinity":             # <<<<<<<<<<<<<<
 *                     if not a.is_numeric():
 *                         evaluation.message("nlim", coords[i], a)
 */
      __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_b, __pyx_n_s_get_head_name); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 612, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_1 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_14);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_14, function);
        }
      }
      __pyx_t_17 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_14);
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 612, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_17, __pyx_kp_u_System_DirectedInfinity, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 612, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      if (__pyx_t_5) {

        /* "mathics/builtin/numeric.py":613
 *                         )
 *                 elif b.get_head_name() == "System`DirectedInfinity":
 *                     if not a.is_numeric():             # <<<<<<<<<<<<<<
 *                         evaluation.message("nlim", coords[i], a)
 *                         return
 */
        __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_a, __pyx_n_s_is_numeric); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 613, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_1 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) {
          __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_14);
          if (likely(__pyx_t_1)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
            __Pyx_INCREF(__pyx_t_1);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_14, function);
          }
        }
        __pyx_t_17 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_14);
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 613, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_17);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_17); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 613, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        __pyx_t_4 = ((!__pyx_t_5) != 0);
        if (__pyx_t_4) {

          /* "mathics/builtin/numeric.py":614
 *                 elif b.get_head_name() == "System`DirectedInfinity":
 *                     if not a.is_numeric():
 *                         evaluation.message("nlim", coords[i], a)             # <<<<<<<<<<<<<<
 *                         return
 *                     a = a.value
 */
          __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_message); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 614, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_coords, __pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 614, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_2 = NULL;
          __pyx_t_6 = 0;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) {
            __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_14);
            if (likely(__pyx_t_2)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
              __Pyx_INCREF(__pyx_t_2);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_14, function);
              __pyx_t_6 = 1;
            }
          }
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_14)) {
            PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_n_u_nlim, __pyx_t_1, __pyx_cur_scope->__pyx_v_a};
            __pyx_t_17 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 614, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
            __Pyx_GOTREF(__pyx_t_17);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
            PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_n_u_nlim, __pyx_t_1, __pyx_cur_scope->__pyx_v_a};
            __pyx_t_17 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 614, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
            __Pyx_GOTREF(__pyx_t_17);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          } else
          #endif
          {
            __pyx_t_16 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 614, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_16);
            if (__pyx_t_2) {
              __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_2); __pyx_t_2 = NULL;
            }
            __Pyx_INCREF(__pyx_n_u_nlim);
            __Pyx_GIVEREF(__pyx_n_u_nlim);
            PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_6, __pyx_n_u_nlim);
            __Pyx_GIVEREF(__pyx_t_1);
            PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_6, __pyx_t_1);
            __Pyx_INCREF(__pyx_cur_scope->__pyx_v_a);
            __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_a);
            PyTuple_SET_ITEM(__pyx_t_16, 2+__pyx_t_6, __pyx_cur_scope->__pyx_v_a);
            __pyx_t_1 = 0;
            __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_16, NULL); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 614, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_17);
            __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
          }
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

          /* "mathics/builtin/numeric.py":615
 *                     if not a.is_numeric():
 *                         evaluation.message("nlim", coords[i], a)
 *                         return             # <<<<<<<<<<<<<<
 *                     a = a.value
 *                     z = b.leaves[0].value
 */
          __Pyx_XDECREF(__pyx_r);
          __pyx_r = Py_None; __Pyx_INCREF(Py_None);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          goto __pyx_L0;

          /* "mathics/builtin/numeric.py":613
 *                         )
 *                 elif b.get_head_name() == "System`DirectedInfinity":
 *                     if not a.is_numeric():             # <<<<<<<<<<<<<<
 *                         evaluation.message("nlim", coords[i], a)
 *                         return
 */
        }

        /* "mathics/builtin/numeric.py":616
 *                         evaluation.message("nlim", coords[i], a)
 *                         return
 *                     a = a.value             # <<<<<<<<<<<<<<
 *                     z = b.leaves[0].value
 *                     subdomain2.append([machine_epsilon, 1.0])
 */
        __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_a, __pyx_n_s_value); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 616, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_17);
        __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_a);
        __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_a, __pyx_t_17);
        __Pyx_GIVEREF(__pyx_t_17);
        __pyx_t_17 = 0;

        /* "mathics/builtin/numeric.py":617
 *                         return
 *                     a = a.value
 *                     z = b.leaves[0].value             # <<<<<<<<<<<<<<
 *                     subdomain2.append([machine_epsilon, 1.0])
 *                     coordtransform.append(
 */
        __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_b, __pyx_n_s_leaves); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 617, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_17);
        __pyx_t_14 = __Pyx_GetItemInt(__pyx_t_17, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 617, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_value); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 617, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_17);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_z);
        __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_z, __pyx_t_17);
        __Pyx_GIVEREF(__pyx_t_17);
        __pyx_t_17 = 0;

        /* "mathics/builtin/numeric.py":618
 *                     a = a.value
 *                     z = b.leaves[0].value
 *                     subdomain2.append([machine_epsilon, 1.0])             # <<<<<<<<<<<<<<
 *                     coordtransform.append(
 *                         (lambda u: a - z + z / u, lambda u: z * u ** (-2.0))
 */
        __Pyx_GetModuleGlobalName(__pyx_t_17, __pyx_n_s_machine_epsilon); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 618, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_17);
        __pyx_t_14 = PyList_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 618, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_GIVEREF(__pyx_t_17);
        PyList_SET_ITEM(__pyx_t_14, 0, __pyx_t_17);
        __Pyx_INCREF(__pyx_float_1_0);
        __Pyx_GIVEREF(__pyx_float_1_0);
        PyList_SET_ITEM(__pyx_t_14, 1, __pyx_float_1_0);
        __pyx_t_17 = 0;
        __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_subdomain2, __pyx_t_14); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 618, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

        /* "mathics/builtin/numeric.py":620
 *                     subdomain2.append([machine_epsilon, 1.0])
 *                     coordtransform.append(
 *                         (lambda u: a - z + z / u, lambda u: z * u ** (-2.0))             # <<<<<<<<<<<<<<
 *                     )
 *                 elif a.is_numeric() and b.is_numeric():
 */
        __pyx_t_14 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_10NIntegrate_22apply_with_func_domain_3lambda7, 0, __pyx_n_s_NIntegrate_apply_with_func_domai, ((PyObject*)__pyx_cur_scope), __pyx_n_s_mathics_builtin_numeric, __pyx_d, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 620, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_17 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_10NIntegrate_22apply_with_func_domain_4lambda8, 0, __pyx_n_s_NIntegrate_apply_with_func_domai, ((PyObject*)__pyx_cur_scope), __pyx_n_s_mathics_builtin_numeric, __pyx_d, NULL); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 620, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_17);
        __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 620, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_GIVEREF(__pyx_t_14);
        PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_14);
        __Pyx_GIVEREF(__pyx_t_17);
        PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_17);
        __pyx_t_14 = 0;
        __pyx_t_17 = 0;

        /* "mathics/builtin/numeric.py":619
 *                     z = b.leaves[0].value
 *                     subdomain2.append([machine_epsilon, 1.0])
 *                     coordtransform.append(             # <<<<<<<<<<<<<<
 *                         (lambda u: a - z + z / u, lambda u: z * u ** (-2.0))
 *                     )
 */
        __pyx_t_15 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_coordtransform, __pyx_t_16); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 619, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;

        /* "mathics/builtin/numeric.py":612
 *                             (lambda u: b - z + z / u, lambda u: -z * u ** (-2.0))
 *                         )
 *                 elif b.get_head_name() == "System`DirectedInfinity":             # <<<<<<<<<<<<<<
 *                     if not a.is_numeric():
 *                         evaluation.message("nlim", coords[i], a)
 */
        goto __pyx_L35;
      }

      /* "mathics/builtin/numeric.py":622
 *                         (lambda u: a - z + z / u, lambda u: z * u ** (-2.0))
 *                     )
 *                 elif a.is_numeric() and b.is_numeric():             # <<<<<<<<<<<<<<
 *                     a = Expression(SymbolN, a).evaluate(evaluation).value
 *                     b = Expression(SymbolN, b).evaluate(evaluation).value
 */
      __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_a, __pyx_n_s_is_numeric); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 622, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      __pyx_t_14 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_17))) {
        __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_17);
        if (likely(__pyx_t_14)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17);
          __Pyx_INCREF(__pyx_t_14);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_17, function);
        }
      }
      __pyx_t_16 = (__pyx_t_14) ? __Pyx_PyObject_CallOneArg(__pyx_t_17, __pyx_t_14) : __Pyx_PyObject_CallNoArg(__pyx_t_17);
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 622, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_16); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 622, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      if (__pyx_t_5) {
      } else {
        __pyx_t_4 = __pyx_t_5;
        goto __pyx_L40_bool_binop_done;
      }
      __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_b, __pyx_n_s_is_numeric); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 622, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      __pyx_t_14 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_17))) {
        __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_17);
        if (likely(__pyx_t_14)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17);
          __Pyx_INCREF(__pyx_t_14);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_17, function);
        }
      }
      __pyx_t_16 = (__pyx_t_14) ? __Pyx_PyObject_CallOneArg(__pyx_t_17, __pyx_t_14) : __Pyx_PyObject_CallNoArg(__pyx_t_17);
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 622, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_16); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 622, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      __pyx_t_4 = __pyx_t_5;
      __pyx_L40_bool_binop_done:;
      if (__pyx_t_4) {

        /* "mathics/builtin/numeric.py":623
 *                     )
 *                 elif a.is_numeric() and b.is_numeric():
 *                     a = Expression(SymbolN, a).evaluate(evaluation).value             # <<<<<<<<<<<<<<
 *                     b = Expression(SymbolN, b).evaluate(evaluation).value
 *                     subdomain2.append([a, b])
 */
        __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_Expression); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 623, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_SymbolN); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 623, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = NULL;
        __pyx_t_6 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
          __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_14);
          if (likely(__pyx_t_2)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
            __Pyx_INCREF(__pyx_t_2);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_14, function);
            __pyx_t_6 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_14)) {
          PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_1, __pyx_cur_scope->__pyx_v_a};
          __pyx_t_17 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 623, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_17);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
          PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_1, __pyx_cur_scope->__pyx_v_a};
          __pyx_t_17 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 623, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_17);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        } else
        #endif
        {
          __pyx_t_18 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 623, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_18);
          if (__pyx_t_2) {
            __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_2); __pyx_t_2 = NULL;
          }
          __Pyx_GIVEREF(__pyx_t_1);
          PyTuple_SET_ITEM(__pyx_t_18, 0+__pyx_t_6, __pyx_t_1);
          __Pyx_INCREF(__pyx_cur_scope->__pyx_v_a);
          __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_a);
          PyTuple_SET_ITEM(__pyx_t_18, 1+__pyx_t_6, __pyx_cur_scope->__pyx_v_a);
          __pyx_t_1 = 0;
          __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_18, NULL); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 623, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_17);
          __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
        }
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s_evaluate); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 623, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        __pyx_t_17 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) {
          __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_14);
          if (likely(__pyx_t_17)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
            __Pyx_INCREF(__pyx_t_17);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_14, function);
          }
        }
        __pyx_t_16 = (__pyx_t_17) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_17, __pyx_v_evaluation) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_v_evaluation);
        __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
        if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 623, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_value); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 623, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_a);
        __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_a, __pyx_t_14);
        __Pyx_GIVEREF(__pyx_t_14);
        __pyx_t_14 = 0;

        /* "mathics/builtin/numeric.py":624
 *                 elif a.is_numeric() and b.is_numeric():
 *                     a = Expression(SymbolN, a).evaluate(evaluation).value
 *                     b = Expression(SymbolN, b).evaluate(evaluation).value             # <<<<<<<<<<<<<<
 *                     subdomain2.append([a, b])
 *                     coordtransform.append(None)
 */
        __Pyx_GetModuleGlobalName(__pyx_t_17, __pyx_n_s_Expression); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 624, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_17);
        __Pyx_GetModuleGlobalName(__pyx_t_18, __pyx_n_s_SymbolN); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 624, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_18);
        __pyx_t_1 = NULL;
        __pyx_t_6 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_17))) {
          __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_17);
          if (likely(__pyx_t_1)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17);
            __Pyx_INCREF(__pyx_t_1);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_17, function);
            __pyx_t_6 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_17)) {
          PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_t_18, __pyx_cur_scope->__pyx_v_b};
          __pyx_t_16 = __Pyx_PyFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 624, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_GOTREF(__pyx_t_16);
          __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_17)) {
          PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_t_18, __pyx_cur_scope->__pyx_v_b};
          __pyx_t_16 = __Pyx_PyCFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 624, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_GOTREF(__pyx_t_16);
          __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
        } else
        #endif
        {
          __pyx_t_2 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 624, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          if (__pyx_t_1) {
            __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = NULL;
          }
          __Pyx_GIVEREF(__pyx_t_18);
          PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_6, __pyx_t_18);
          __Pyx_INCREF(__pyx_cur_scope->__pyx_v_b);
          __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_b);
          PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_6, __pyx_cur_scope->__pyx_v_b);
          __pyx_t_18 = 0;
          __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_t_2, NULL); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 624, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_16);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        }
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_evaluate); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 624, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_17);
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __pyx_t_16 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_17))) {
          __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_17);
          if (likely(__pyx_t_16)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17);
            __Pyx_INCREF(__pyx_t_16);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_17, function);
          }
        }
        __pyx_t_14 = (__pyx_t_16) ? __Pyx_PyObject_Call2Args(__pyx_t_17, __pyx_t_16, __pyx_v_evaluation) : __Pyx_PyObject_CallOneArg(__pyx_t_17, __pyx_v_evaluation);
        __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
        if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 624, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_value); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 624, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_17);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_b);
        __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_b, __pyx_t_17);
        __Pyx_GIVEREF(__pyx_t_17);
        __pyx_t_17 = 0;

        /* "mathics/builtin/numeric.py":625
 *                     a = Expression(SymbolN, a).evaluate(evaluation).value
 *                     b = Expression(SymbolN, b).evaluate(evaluation).value
 *                     subdomain2.append([a, b])             # <<<<<<<<<<<<<<
 *                     coordtransform.append(None)
 *                 else:
 */
        __pyx_t_17 = PyList_New(2); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 625, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_17);
        __Pyx_INCREF(__pyx_cur_scope->__pyx_v_a);
        __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_a);
        PyList_SET_ITEM(__pyx_t_17, 0, __pyx_cur_scope->__pyx_v_a);
        __Pyx_INCREF(__pyx_cur_scope->__pyx_v_b);
        __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_b);
        PyList_SET_ITEM(__pyx_t_17, 1, __pyx_cur_scope->__pyx_v_b);
        __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_subdomain2, __pyx_t_17); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 625, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

        /* "mathics/builtin/numeric.py":626
 *                     b = Expression(SymbolN, b).evaluate(evaluation).value
 *                     subdomain2.append([a, b])
 *                     coordtransform.append(None)             # <<<<<<<<<<<<<<
 *                 else:
 *                     for x in (a, b):
 */
        __pyx_t_15 = __Pyx_PyList_Append(__pyx_cur_scope->__pyx_v_coordtransform, Py_None); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 626, __pyx_L1_error)

        /* "mathics/builtin/numeric.py":622
 *                         (lambda u: a - z + z / u, lambda u: z * u ** (-2.0))
 *                     )
 *                 elif a.is_numeric() and b.is_numeric():             # <<<<<<<<<<<<<<
 *                     a = Expression(SymbolN, a).evaluate(evaluation).value
 *                     b = Expression(SymbolN, b).evaluate(evaluation).value
 */
        goto __pyx_L35;
      }

      /* "mathics/builtin/numeric.py":628
 *                     coordtransform.append(None)
 *                 else:
 *                     for x in (a, b):             # <<<<<<<<<<<<<<
 *                         if not x.is_numeric():
 *                             evaluation.message("nlim", coords[i], x)
 */
      /*else*/ {
        __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 628, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_17);
        __Pyx_INCREF(__pyx_cur_scope->__pyx_v_a);
        __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_a);
        PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_cur_scope->__pyx_v_a);
        __Pyx_INCREF(__pyx_cur_scope->__pyx_v_b);
        __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_b);
        PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_cur_scope->__pyx_v_b);
        __pyx_t_14 = __pyx_t_17; __Pyx_INCREF(__pyx_t_14); __pyx_t_19 = 0;
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        for (;;) {
          if (__pyx_t_19 >= 2) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_17 = PyTuple_GET_ITEM(__pyx_t_14, __pyx_t_19); __Pyx_INCREF(__pyx_t_17); __pyx_t_19++; if (unlikely(0 < 0)) __PYX_ERR(0, 628, __pyx_L1_error)
          #else
          __pyx_t_17 = PySequence_ITEM(__pyx_t_14, __pyx_t_19); __pyx_t_19++; if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 628, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_17);
          #endif
          __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_x);
          __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_x, __pyx_t_17);
          __Pyx_GIVEREF(__pyx_t_17);
          __pyx_t_17 = 0;

          /* "mathics/builtin/numeric.py":629
 *                 else:
 *                     for x in (a, b):
 *                         if not x.is_numeric():             # <<<<<<<<<<<<<<
 *                             evaluation.message("nlim", coords[i], x)
 *                     return
 */
          __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_x, __pyx_n_s_is_numeric); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 629, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_16);
          __pyx_t_2 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_16))) {
            __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_16);
            if (likely(__pyx_t_2)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
              __Pyx_INCREF(__pyx_t_2);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_16, function);
            }
          }
          __pyx_t_17 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_16);
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 629, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_17);
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
          __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_17); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 629, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
          __pyx_t_5 = ((!__pyx_t_4) != 0);
          if (__pyx_t_5) {

            /* "mathics/builtin/numeric.py":630
 *                     for x in (a, b):
 *                         if not x.is_numeric():
 *                             evaluation.message("nlim", coords[i], x)             # <<<<<<<<<<<<<<
 *                     return
 * 
 */
            __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_message); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 630, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_16);
            __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_coords, __pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 630, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __pyx_t_18 = NULL;
            __pyx_t_6 = 0;
            if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_16))) {
              __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_16);
              if (likely(__pyx_t_18)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
                __Pyx_INCREF(__pyx_t_18);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_16, function);
                __pyx_t_6 = 1;
              }
            }
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_16)) {
              PyObject *__pyx_temp[4] = {__pyx_t_18, __pyx_n_u_nlim, __pyx_t_2, __pyx_cur_scope->__pyx_v_x};
              __pyx_t_17 = __Pyx_PyFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 630, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
              __Pyx_GOTREF(__pyx_t_17);
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_16)) {
              PyObject *__pyx_temp[4] = {__pyx_t_18, __pyx_n_u_nlim, __pyx_t_2, __pyx_cur_scope->__pyx_v_x};
              __pyx_t_17 = __Pyx_PyCFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 630, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
              __Pyx_GOTREF(__pyx_t_17);
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            } else
            #endif
            {
              __pyx_t_1 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 630, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_1);
              if (__pyx_t_18) {
                __Pyx_GIVEREF(__pyx_t_18); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_18); __pyx_t_18 = NULL;
              }
              __Pyx_INCREF(__pyx_n_u_nlim);
              __Pyx_GIVEREF(__pyx_n_u_nlim);
              PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_6, __pyx_n_u_nlim);
              __Pyx_GIVEREF(__pyx_t_2);
              PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_6, __pyx_t_2);
              __Pyx_INCREF(__pyx_cur_scope->__pyx_v_x);
              __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_x);
              PyTuple_SET_ITEM(__pyx_t_1, 2+__pyx_t_6, __pyx_cur_scope->__pyx_v_x);
              __pyx_t_2 = 0;
              __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_1, NULL); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 630, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_17);
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            }
            __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
            __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;

            /* "mathics/builtin/numeric.py":629
 *                 else:
 *                     for x in (a, b):
 *                         if not x.is_numeric():             # <<<<<<<<<<<<<<
 *                             evaluation.message("nlim", coords[i], x)
 *                     return
 */
          }

          /* "mathics/builtin/numeric.py":628
 *                     coordtransform.append(None)
 *                 else:
 *                     for x in (a, b):             # <<<<<<<<<<<<<<
 *                         if not x.is_numeric():
 *                             evaluation.message("nlim", coords[i], x)
 */
        }
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

        /* "mathics/builtin/numeric.py":631
 *                         if not x.is_numeric():
 *                             evaluation.message("nlim", coords[i], x)
 *                     return             # <<<<<<<<<<<<<<
 * 
 *             if nulldomain:
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_r = Py_None; __Pyx_INCREF(Py_None);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        goto __pyx_L0;
      }
      __pyx_L35:;

      /* "mathics/builtin/numeric.py":581
 *             coordtransform = []
 *             nulldomain = False
 *             for i, r in enumerate(subdomain):             # <<<<<<<<<<<<<<
 *                 a = r[0].evaluate(evaluation)
 *                 b = r[1].evaluate(evaluation)
 */
    }
    __pyx_L34_break:;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "mathics/builtin/numeric.py":633
 *                     return
 * 
 *             if nulldomain:             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
    __pyx_t_5 = (__pyx_v_nulldomain != 0);
    if (__pyx_t_5) {

      /* "mathics/builtin/numeric.py":634
 * 
 *             if nulldomain:
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             if any(coordtransform):
 */
      goto __pyx_L25_continue;

      /* "mathics/builtin/numeric.py":633
 *                     return
 * 
 *             if nulldomain:             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
    }

    /* "mathics/builtin/numeric.py":636
 *                 continue
 * 
 *             if any(coordtransform):             # <<<<<<<<<<<<<<
 *                 func2 = lambda *u: (
 *                     integrand(
 */
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_any, __pyx_cur_scope->__pyx_v_coordtransform); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 636, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 636, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_5) {

      /* "mathics/builtin/numeric.py":637
 * 
 *             if any(coordtransform):
 *                 func2 = lambda *u: (             # <<<<<<<<<<<<<<
 *                     integrand(
 *                         *[
 */
      __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_10NIntegrate_22apply_with_func_domain_5lambda9, 0, __pyx_n_s_NIntegrate_apply_with_func_domai, ((PyObject*)__pyx_cur_scope), __pyx_n_s_mathics_builtin_numeric, __pyx_d, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 637, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_func2, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "mathics/builtin/numeric.py":636
 *                 continue
 * 
 *             if any(coordtransform):             # <<<<<<<<<<<<<<
 *                 func2 = lambda *u: (
 *                     integrand(
 */
    }

    /* "mathics/builtin/numeric.py":649
 *                 )
 *             opts = {
 *                 "acur": accuracy,             # <<<<<<<<<<<<<<
 *                 "tol": tolerance,
 *                 "maxrec": maxrecursion,
 */
    __pyx_t_3 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 649, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_acur, __pyx_v_accuracy) < 0) __PYX_ERR(0, 649, __pyx_L1_error)

    /* "mathics/builtin/numeric.py":650
 *             opts = {
 *                 "acur": accuracy,
 *                 "tol": tolerance,             # <<<<<<<<<<<<<<
 *                 "maxrec": maxrecursion,
 *             }
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_tol, __pyx_v_tolerance) < 0) __PYX_ERR(0, 649, __pyx_L1_error)

    /* "mathics/builtin/numeric.py":651
 *                 "acur": accuracy,
 *                 "tol": tolerance,
 *                 "maxrec": maxrecursion,             # <<<<<<<<<<<<<<
 *             }
 *             opts.update(method_options)
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_maxrec, __pyx_v_maxrecursion) < 0) __PYX_ERR(0, 649, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_opts, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "mathics/builtin/numeric.py":653
 *                 "maxrec": maxrecursion,
 *             }
 *             opts.update(method_options)             # <<<<<<<<<<<<<<
 *             try:
 *                 if len(subdomain2) > 1:
 */
    __pyx_t_3 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_update, __pyx_v_opts, __pyx_v_method_options); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 653, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "mathics/builtin/numeric.py":654
 *             }
 *             opts.update(method_options)
 *             try:             # <<<<<<<<<<<<<<
 *                 if len(subdomain2) > 1:
 *                     if is_multidimensional:
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22);
      __Pyx_XGOTREF(__pyx_t_20);
      __Pyx_XGOTREF(__pyx_t_21);
      __Pyx_XGOTREF(__pyx_t_22);
      /*try:*/ {

        /* "mathics/builtin/numeric.py":655
 *             opts.update(method_options)
 *             try:
 *                 if len(subdomain2) > 1:             # <<<<<<<<<<<<<<
 *                     if is_multidimensional:
 *                         nintegrate_method(func2, subdomain2, **opts)
 */
        __pyx_t_12 = PyList_GET_SIZE(__pyx_v_subdomain2); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(0, 655, __pyx_L47_error)
        __pyx_t_5 = ((__pyx_t_12 > 1) != 0);
        if (__pyx_t_5) {

          /* "mathics/builtin/numeric.py":656
 *             try:
 *                 if len(subdomain2) > 1:
 *                     if is_multidimensional:             # <<<<<<<<<<<<<<
 *                         nintegrate_method(func2, subdomain2, **opts)
 *                     else:
 */
          __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_is_multidimensional); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 656, __pyx_L47_error)
          if (__pyx_t_5) {

            /* "mathics/builtin/numeric.py":657
 *                 if len(subdomain2) > 1:
 *                     if is_multidimensional:
 *                         nintegrate_method(func2, subdomain2, **opts)             # <<<<<<<<<<<<<<
 *                     else:
 *                         val = _fubini(
 */
            __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 657, __pyx_L47_error)
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_INCREF(__pyx_v_func2);
            __Pyx_GIVEREF(__pyx_v_func2);
            PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_func2);
            __Pyx_INCREF(__pyx_v_subdomain2);
            __Pyx_GIVEREF(__pyx_v_subdomain2);
            PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_subdomain2);
            __pyx_t_7 = __Pyx_PyObject_Call(__pyx_v_nintegrate_method, __pyx_t_3, __pyx_v_opts); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 657, __pyx_L47_error)
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

            /* "mathics/builtin/numeric.py":656
 *             try:
 *                 if len(subdomain2) > 1:
 *                     if is_multidimensional:             # <<<<<<<<<<<<<<
 *                         nintegrate_method(func2, subdomain2, **opts)
 *                     else:
 */
            goto __pyx_L56;
          }

          /* "mathics/builtin/numeric.py":659
 *                         nintegrate_method(func2, subdomain2, **opts)
 *                     else:
 *                         val = _fubini(             # <<<<<<<<<<<<<<
 *                             func2, subdomain2, integrator=nintegrate_method, **opts
 *                         )
 */
          /*else*/ {
            __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_fubini); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 659, __pyx_L47_error)
            __Pyx_GOTREF(__pyx_t_7);

            /* "mathics/builtin/numeric.py":660
 *                     else:
 *                         val = _fubini(
 *                             func2, subdomain2, integrator=nintegrate_method, **opts             # <<<<<<<<<<<<<<
 *                         )
 *                 else:
 */
            __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 659, __pyx_L47_error)
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_INCREF(__pyx_v_func2);
            __Pyx_GIVEREF(__pyx_v_func2);
            PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_func2);
            __Pyx_INCREF(__pyx_v_subdomain2);
            __Pyx_GIVEREF(__pyx_v_subdomain2);
            PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_subdomain2);

            /* "mathics/builtin/numeric.py":659
 *                         nintegrate_method(func2, subdomain2, **opts)
 *                     else:
 *                         val = _fubini(             # <<<<<<<<<<<<<<
 *                             func2, subdomain2, integrator=nintegrate_method, **opts
 *                         )
 */
            __pyx_t_17 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 660, __pyx_L47_error)
            __Pyx_GOTREF(__pyx_t_17);

            /* "mathics/builtin/numeric.py":660
 *                     else:
 *                         val = _fubini(
 *                             func2, subdomain2, integrator=nintegrate_method, **opts             # <<<<<<<<<<<<<<
 *                         )
 *                 else:
 */
            if (PyDict_SetItem(__pyx_t_17, __pyx_n_s_integrator, __pyx_v_nintegrate_method) < 0) __PYX_ERR(0, 660, __pyx_L47_error)
            __pyx_t_14 = __pyx_t_17;
            __pyx_t_17 = 0;
            if (__Pyx_MergeKeywords(__pyx_t_14, __pyx_v_opts) < 0) __PYX_ERR(0, 660, __pyx_L47_error)

            /* "mathics/builtin/numeric.py":659
 *                         nintegrate_method(func2, subdomain2, **opts)
 *                     else:
 *                         val = _fubini(             # <<<<<<<<<<<<<<
 *                             func2, subdomain2, integrator=nintegrate_method, **opts
 *                         )
 */
            __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_3, __pyx_t_14); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 659, __pyx_L47_error)
            __Pyx_GOTREF(__pyx_t_17);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
            __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_17);
            __pyx_t_17 = 0;
          }
          __pyx_L56:;

          /* "mathics/builtin/numeric.py":655
 *             opts.update(method_options)
 *             try:
 *                 if len(subdomain2) > 1:             # <<<<<<<<<<<<<<
 *                     if is_multidimensional:
 *                         nintegrate_method(func2, subdomain2, **opts)
 */
          goto __pyx_L55;
        }

        /* "mathics/builtin/numeric.py":663
 *                         )
 *                 else:
 *                     val = nintegrate_method(func2, *(subdomain2[0]), **opts)             # <<<<<<<<<<<<<<
 *             except Exception:
 *                 val = None
 */
        /*else*/ {
          __pyx_t_17 = PyTuple_New(1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 663, __pyx_L47_error)
          __Pyx_GOTREF(__pyx_t_17);
          __Pyx_INCREF(__pyx_v_func2);
          __Pyx_GIVEREF(__pyx_v_func2);
          PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_v_func2);
          __pyx_t_14 = __Pyx_GetItemInt_List(__pyx_v_subdomain2, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 663, __pyx_L47_error)
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 663, __pyx_L47_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __pyx_t_14 = PyNumber_Add(__pyx_t_17, __pyx_t_3); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 663, __pyx_L47_error)
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = __Pyx_PyObject_Call(__pyx_v_nintegrate_method, __pyx_t_14, __pyx_v_opts); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 663, __pyx_L47_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_3);
          __pyx_t_3 = 0;
        }
        __pyx_L55:;

        /* "mathics/builtin/numeric.py":654
 *             }
 *             opts.update(method_options)
 *             try:             # <<<<<<<<<<<<<<
 *                 if len(subdomain2) > 1:
 *                     if is_multidimensional:
 */
      }
      __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
      __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
      __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
      goto __pyx_L54_try_end;
      __pyx_L47_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
      __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "mathics/builtin/numeric.py":664
 *                 else:
 *                     val = nintegrate_method(func2, *(subdomain2[0]), **opts)
 *             except Exception:             # <<<<<<<<<<<<<<
 *                 val = None
 * 
 */
      __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
      if (__pyx_t_6) {
        __Pyx_AddTraceback("mathics.builtin.numeric.NIntegrate.apply_with_func_domain", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_14, &__pyx_t_17) < 0) __PYX_ERR(0, 664, __pyx_L49_except_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_GOTREF(__pyx_t_17);

        /* "mathics/builtin/numeric.py":665
 *                     val = nintegrate_method(func2, *(subdomain2[0]), **opts)
 *             except Exception:
 *                 val = None             # <<<<<<<<<<<<<<
 * 
 *             if val is None:
 */
        __Pyx_INCREF(Py_None);
        __Pyx_XDECREF_SET(__pyx_v_val, Py_None);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
        goto __pyx_L48_exception_handled;
      }
      goto __pyx_L49_except_error;
      __pyx_L49_except_error:;

      /* "mathics/builtin/numeric.py":654
 *             }
 *             opts.update(method_options)
 *             try:             # <<<<<<<<<<<<<<
 *                 if len(subdomain2) > 1:
 *                     if is_multidimensional:
 */
      __Pyx_XGIVEREF(__pyx_t_20);
      __Pyx_XGIVEREF(__pyx_t_21);
      __Pyx_XGIVEREF(__pyx_t_22);
      __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_21, __pyx_t_22);
      goto __pyx_L1_error;
      __pyx_L48_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_20);
      __Pyx_XGIVEREF(__pyx_t_21);
      __Pyx_XGIVEREF(__pyx_t_22);
      __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_21, __pyx_t_22);
      __pyx_L54_try_end:;
    }

    /* "mathics/builtin/numeric.py":667
 *                 val = None
 * 
 *             if val is None:             # <<<<<<<<<<<<<<
 *                 evaluation.message("NIntegrate", "mtdfail")
 *                 if len(subdomain2) > 1:
 */
    if (unlikely(!__pyx_v_val)) { __Pyx_RaiseUnboundLocalError("val"); __PYX_ERR(0, 667, __pyx_L1_error) }
    __pyx_t_5 = (__pyx_v_val == Py_None);
    __pyx_t_4 = (__pyx_t_5 != 0);
    if (__pyx_t_4) {

      /* "mathics/builtin/numeric.py":668
 * 
 *             if val is None:
 *                 evaluation.message("NIntegrate", "mtdfail")             # <<<<<<<<<<<<<<
 *                 if len(subdomain2) > 1:
 *                     val = _fubini(
 */
      __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_message); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 668, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 668, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

      /* "mathics/builtin/numeric.py":669
 *             if val is None:
 *                 evaluation.message("NIntegrate", "mtdfail")
 *                 if len(subdomain2) > 1:             # <<<<<<<<<<<<<<
 *                     val = _fubini(
 *                         func2,
 */
      __pyx_t_12 = PyList_GET_SIZE(__pyx_v_subdomain2); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(0, 669, __pyx_L1_error)
      __pyx_t_4 = ((__pyx_t_12 > 1) != 0);
      if (__pyx_t_4) {

        /* "mathics/builtin/numeric.py":670
 *                 evaluation.message("NIntegrate", "mtdfail")
 *                 if len(subdomain2) > 1:
 *                     val = _fubini(             # <<<<<<<<<<<<<<
 *                         func2,
 *                         subdomain2,
 */
        __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_fubini); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 670, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);

        /* "mathics/builtin/numeric.py":672
 *                     val = _fubini(
 *                         func2,
 *                         subdomain2,             # <<<<<<<<<<<<<<
 *                         integrator=_internal_adaptative_simpsons_rule,
 *                         **opts,
 */
        __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 670, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_17);
        __Pyx_INCREF(__pyx_v_func2);
        __Pyx_GIVEREF(__pyx_v_func2);
        PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_v_func2);
        __Pyx_INCREF(__pyx_v_subdomain2);
        __Pyx_GIVEREF(__pyx_v_subdomain2);
        PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_v_subdomain2);

        /* "mathics/builtin/numeric.py":673
 *                         func2,
 *                         subdomain2,
 *                         integrator=_internal_adaptative_simpsons_rule,             # <<<<<<<<<<<<<<
 *                         **opts,
 *                     )
 */
        __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 673, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_n_s_internal_adaptative_simpsons_ru_4); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 673, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_integrator, __pyx_t_16) < 0) __PYX_ERR(0, 673, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __pyx_t_3 = __pyx_t_7;
        __pyx_t_7 = 0;

        /* "mathics/builtin/numeric.py":674
 *                         subdomain2,
 *                         integrator=_internal_adaptative_simpsons_rule,
 *                         **opts,             # <<<<<<<<<<<<<<
 *                     )
 *                 else:
 */
        if (__Pyx_MergeKeywords(__pyx_t_3, __pyx_v_opts) < 0) __PYX_ERR(0, 674, __pyx_L1_error)

        /* "mathics/builtin/numeric.py":670
 *                 evaluation.message("NIntegrate", "mtdfail")
 *                 if len(subdomain2) > 1:
 *                     val = _fubini(             # <<<<<<<<<<<<<<
 *                         func2,
 *                         subdomain2,
 */
        __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_17, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 670, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_7);
        __pyx_t_7 = 0;

        /* "mathics/builtin/numeric.py":669
 *             if val is None:
 *                 evaluation.message("NIntegrate", "mtdfail")
 *                 if len(subdomain2) > 1:             # <<<<<<<<<<<<<<
 *                     val = _fubini(
 *                         func2,
 */
        goto __pyx_L60;
      }

      /* "mathics/builtin/numeric.py":677
 *                     )
 *                 else:
 *                     val = _internal_adaptative_simpsons_rule(             # <<<<<<<<<<<<<<
 *                         func2, *(subdomain2[0]), **opts
 *                     )
 */
      /*else*/ {
        __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_internal_adaptative_simpsons_ru_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 677, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);

        /* "mathics/builtin/numeric.py":678
 *                 else:
 *                     val = _internal_adaptative_simpsons_rule(
 *                         func2, *(subdomain2[0]), **opts             # <<<<<<<<<<<<<<
 *                     )
 *             results.append(val)
 */
        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 677, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_v_func2);
        __Pyx_GIVEREF(__pyx_v_func2);
        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_func2);
        __pyx_t_17 = __Pyx_GetItemInt_List(__pyx_v_subdomain2, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 678, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_17);

        /* "mathics/builtin/numeric.py":677
 *                     )
 *                 else:
 *                     val = _internal_adaptative_simpsons_rule(             # <<<<<<<<<<<<<<
 *                         func2, *(subdomain2[0]), **opts
 *                     )
 */
        __pyx_t_14 = __Pyx_PySequence_Tuple(__pyx_t_17); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 677, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        __pyx_t_17 = PyNumber_Add(__pyx_t_3, __pyx_t_14); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 677, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_17);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

        /* "mathics/builtin/numeric.py":678
 *                 else:
 *                     val = _internal_adaptative_simpsons_rule(
 *                         func2, *(subdomain2[0]), **opts             # <<<<<<<<<<<<<<
 *                     )
 *             results.append(val)
 */
        __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_17, __pyx_v_opts); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 677, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_14);
        __pyx_t_14 = 0;
      }
      __pyx_L60:;

      /* "mathics/builtin/numeric.py":667
 *                 val = None
 * 
 *             if val is None:             # <<<<<<<<<<<<<<
 *                 evaluation.message("NIntegrate", "mtdfail")
 *                 if len(subdomain2) > 1:
 */
    }

    /* "mathics/builtin/numeric.py":680
 *                         func2, *(subdomain2[0]), **opts
 *                     )
 *             results.append(val)             # <<<<<<<<<<<<<<
 * 
 *         result = sum([r[0] for r in results])
 */
    if (unlikely(!__pyx_v_val)) { __Pyx_RaiseUnboundLocalError("val"); __PYX_ERR(0, 680, __pyx_L1_error) }
    __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_results, __pyx_v_val); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 680, __pyx_L1_error)

    /* "mathics/builtin/numeric.py":574
 *             return
 *         results = []
 *         for subdomain in product(*[axis[1] for axis in domain]):             # <<<<<<<<<<<<<<
 *             # On each subdomain, check if the region is bounded.
 *             # If not, implement a coordinate map
 */
    __pyx_L25_continue:;
  }
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "mathics/builtin/numeric.py":682
 *             results.append(val)
 * 
 *         result = sum([r[0] for r in results])             # <<<<<<<<<<<<<<
 *         # error = sum([r[1] for r in results]) -> use it when accuracy
 *         #                                         be implemented...
 */
  { /* enter inner scope */
    __pyx_t_11 = PyList_New(0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 682, __pyx_L63_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_14 = __pyx_v_results; __Pyx_INCREF(__pyx_t_14); __pyx_t_9 = 0;
    for (;;) {
      if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_14)) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_17 = PyList_GET_ITEM(__pyx_t_14, __pyx_t_9); __Pyx_INCREF(__pyx_t_17); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 682, __pyx_L63_error)
      #else
      __pyx_t_17 = PySequence_ITEM(__pyx_t_14, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 682, __pyx_L63_error)
      __Pyx_GOTREF(__pyx_t_17);
      #endif
      __Pyx_XDECREF_SET(__pyx_8genexpr8__pyx_v_r, __pyx_t_17);
      __pyx_t_17 = 0;
      __pyx_t_17 = __Pyx_GetItemInt(__pyx_8genexpr8__pyx_v_r, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 682, __pyx_L63_error)
      __Pyx_GOTREF(__pyx_t_17);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_11, (PyObject*)__pyx_t_17))) __PYX_ERR(0, 682, __pyx_L63_error)
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    }
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_r); __pyx_8genexpr8__pyx_v_r = 0;
    goto __pyx_L66_exit_scope;
    __pyx_L63_error:;
    __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_r); __pyx_8genexpr8__pyx_v_r = 0;
    goto __pyx_L1_error;
    __pyx_L66_exit_scope:;
  } /* exit inner scope */
  __pyx_t_14 = __Pyx_PyObject_CallOneArg(__pyx_builtin_sum, __pyx_t_11); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 682, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_v_result = __pyx_t_14;
  __pyx_t_14 = 0;

  /* "mathics/builtin/numeric.py":685
 *         # error = sum([r[1] for r in results]) -> use it when accuracy
 *         #                                         be implemented...
 *         return from_python(result)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_from_python); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 685, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_17 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
    __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_11);
    if (likely(__pyx_t_17)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
      __Pyx_INCREF(__pyx_t_17);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_11, function);
    }
  }
  __pyx_t_14 = (__pyx_t_17) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_17, __pyx_v_result) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_v_result);
  __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
  if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 685, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_r = __pyx_t_14;
  __pyx_t_14 = 0;
  goto __pyx_L0;

  /* "mathics/builtin/numeric.py":523
 *         return None
 * 
 *     def apply_with_func_domain(self, func, domain, evaluation, options):             # <<<<<<<<<<<<<<
 *         "%(name)s[func_, domain__, OptionsPattern[%(name)s]]"
 *         method = options["System`Method"].evaluate(evaluation)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_XDECREF(__pyx_t_18);
  __Pyx_AddTraceback("mathics.builtin.numeric.NIntegrate.apply_with_func_domain", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_method);
  __Pyx_XDECREF(__pyx_v_method_options);
  __Pyx_XDECREF(__pyx_v_tolerance);
  __Pyx_XDECREF(__pyx_v_accuracy);
  __Pyx_XDECREF(__pyx_v_maxrecursion);
  __Pyx_XDECREF(__pyx_v_nintegrate_method);
  __Pyx_XDECREF(__pyx_v_is_multidimensional);
  __Pyx_XDECREF(__pyx_v_coords);
  __Pyx_XDECREF(__pyx_v_intvars);
  __Pyx_XDECREF(__pyx_v_results);
  __Pyx_XDECREF(__pyx_v_subdomain);
  __Pyx_XDECREF(__pyx_v_func2);
  __Pyx_XDECREF(__pyx_v_subdomain2);
  __Pyx_XDECREF(__pyx_v_r);
  __Pyx_XDECREF(__pyx_v_le);
  __Pyx_XDECREF(__pyx_v_opts);
  __Pyx_XDECREF(__pyx_v_val);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_axis);
  __Pyx_XDECREF(__pyx_8genexpr4__pyx_v_c);
  __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_axis);
  __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_r);
  __Pyx_XDECREF(__pyx_v_domain);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":730
 *     name = "$MachineEpsilon"
 * 
 *     def evaluate(self, evaluation):             # <<<<<<<<<<<<<<
 *         return MachineReal(machine_epsilon)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_15MachineEpsilon__1evaluate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_15MachineEpsilon__1evaluate = {"evaluate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_15MachineEpsilon__1evaluate, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_15MachineEpsilon__1evaluate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("evaluate (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_evaluation,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("evaluate", 1, 2, 2, 1); __PYX_ERR(0, 730, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluate") < 0)) __PYX_ERR(0, 730, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_evaluation = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("evaluate", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 730, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.MachineEpsilon_.evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_15MachineEpsilon__evaluate(__pyx_self, __pyx_v_self, __pyx_v_evaluation);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_15MachineEpsilon__evaluate(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_evaluation) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("evaluate", 0);

  /* "mathics/builtin/numeric.py":731
 * 
 *     def evaluate(self, evaluation):
 *         return MachineReal(machine_epsilon)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_MachineReal); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 731, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_machine_epsilon); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 731, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 731, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/builtin/numeric.py":730
 *     name = "$MachineEpsilon"
 * 
 *     def evaluate(self, evaluation):             # <<<<<<<<<<<<<<
 *         return MachineReal(machine_epsilon)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("mathics.builtin.numeric.MachineEpsilon_.evaluate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":795
 *     }
 * 
 *     def apply(self, z, evaluation):             # <<<<<<<<<<<<<<
 *         "Precision[z_]"
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_9Precision_1apply(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_7builtin_7numeric_9Precision_apply[] = "Precision[z_]";
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_9Precision_1apply = {"apply", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_9Precision_1apply, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_7builtin_7numeric_9Precision_apply};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_9Precision_1apply(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_z = 0;
  CYTHON_UNUSED PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("apply (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_z,&__pyx_n_s_evaluation,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_z)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply", 1, 3, 3, 1); __PYX_ERR(0, 795, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply", 1, 3, 3, 2); __PYX_ERR(0, 795, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply") < 0)) __PYX_ERR(0, 795, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_z = values[1];
    __pyx_v_evaluation = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("apply", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 795, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.Precision.apply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_9Precision_apply(__pyx_self, __pyx_v_self, __pyx_v_z, __pyx_v_evaluation);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_9Precision_apply(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_z, CYTHON_UNUSED PyObject *__pyx_v_evaluation) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("apply", 0);

  /* "mathics/builtin/numeric.py":798
 *         "Precision[z_]"
 * 
 *         if not z.is_inexact():             # <<<<<<<<<<<<<<
 *             return Symbol("Infinity")
 *         elif z.to_sympy().is_zero:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_z, __pyx_n_s_is_inexact); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 798, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 798, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 798, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = ((!__pyx_t_4) != 0);
  if (__pyx_t_5) {

    /* "mathics/builtin/numeric.py":799
 * 
 *         if not z.is_inexact():
 *             return Symbol("Infinity")             # <<<<<<<<<<<<<<
 *         elif z.to_sympy().is_zero:
 *             return Real(0)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 799, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_n_u_Infinity) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_n_u_Infinity);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 799, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "mathics/builtin/numeric.py":798
 *         "Precision[z_]"
 * 
 *         if not z.is_inexact():             # <<<<<<<<<<<<<<
 *             return Symbol("Infinity")
 *         elif z.to_sympy().is_zero:
 */
  }

  /* "mathics/builtin/numeric.py":800
 *         if not z.is_inexact():
 *             return Symbol("Infinity")
 *         elif z.to_sympy().is_zero:             # <<<<<<<<<<<<<<
 *             return Real(0)
 *         else:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_z, __pyx_n_s_to_sympy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 800, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 800, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_is_zero); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 800, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 800, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_5) {

    /* "mathics/builtin/numeric.py":801
 *             return Symbol("Infinity")
 *         elif z.to_sympy().is_zero:
 *             return Real(0)             # <<<<<<<<<<<<<<
 *         else:
 *             return Real(dps(z.get_precision()))
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Real); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 801, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_3, __pyx_int_0) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_int_0);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 801, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "mathics/builtin/numeric.py":800
 *         if not z.is_inexact():
 *             return Symbol("Infinity")
 *         elif z.to_sympy().is_zero:             # <<<<<<<<<<<<<<
 *             return Real(0)
 *         else:
 */
  }

  /* "mathics/builtin/numeric.py":803
 *             return Real(0)
 *         else:
 *             return Real(dps(z.get_precision()))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Real); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 803, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_dps); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 803, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_z, __pyx_n_s_get_precision); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 803, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_7 = (__pyx_t_9) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9) : __Pyx_PyObject_CallNoArg(__pyx_t_8);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 803, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_3 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 803, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 803, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "mathics/builtin/numeric.py":795
 *     }
 * 
 *     def apply(self, z, evaluation):             # <<<<<<<<<<<<<<
 *         "Precision[z_]"
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("mathics.builtin.numeric.Precision.apply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":963
 *     }
 * 
 *     def apply(self, expr, k, evaluation):             # <<<<<<<<<<<<<<
 *         "Round[expr_?NumericQ, k_?NumericQ]"
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_5Round_1apply(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_7builtin_7numeric_5Round_apply[] = "Round[expr_?NumericQ, k_?NumericQ]";
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_5Round_1apply = {"apply", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_5Round_1apply, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_7builtin_7numeric_5Round_apply};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_5Round_1apply(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_expr = 0;
  PyObject *__pyx_v_k = 0;
  PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("apply (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_expr,&__pyx_n_s_k,&__pyx_n_s_evaluation,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_expr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply", 1, 4, 4, 1); __PYX_ERR(0, 963, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_k)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply", 1, 4, 4, 2); __PYX_ERR(0, 963, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply", 1, 4, 4, 3); __PYX_ERR(0, 963, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply") < 0)) __PYX_ERR(0, 963, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_self = values[0];
    __pyx_v_expr = values[1];
    __pyx_v_k = values[2];
    __pyx_v_evaluation = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("apply", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 963, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.Round.apply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_5Round_apply(__pyx_self, __pyx_v_self, __pyx_v_expr, __pyx_v_k, __pyx_v_evaluation);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_5Round_apply(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_expr, PyObject *__pyx_v_k, PyObject *__pyx_v_evaluation) {
  PyObject *__pyx_v_n = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("apply", 0);

  /* "mathics/builtin/numeric.py":966
 *         "Round[expr_?NumericQ, k_?NumericQ]"
 * 
 *         n = Expression("Divide", expr, k).round_to_float(             # <<<<<<<<<<<<<<
 *             evaluation, permit_complex=True
 *         )
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Expression); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 966, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_n_u_Divide, __pyx_v_expr, __pyx_v_k};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 966, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_n_u_Divide, __pyx_v_expr, __pyx_v_k};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 966, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 966, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_n_u_Divide);
    __Pyx_GIVEREF(__pyx_n_u_Divide);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_n_u_Divide);
    __Pyx_INCREF(__pyx_v_expr);
    __Pyx_GIVEREF(__pyx_v_expr);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_expr);
    __Pyx_INCREF(__pyx_v_k);
    __Pyx_GIVEREF(__pyx_v_k);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_k);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 966, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_round_to_float); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 966, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":967
 * 
 *         n = Expression("Divide", expr, k).round_to_float(
 *             evaluation, permit_complex=True             # <<<<<<<<<<<<<<
 *         )
 *         if n is None:
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 966, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_evaluation);
  __Pyx_GIVEREF(__pyx_v_evaluation);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_evaluation);
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 967, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_permit_complex, Py_True) < 0) __PYX_ERR(0, 967, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":966
 *         "Round[expr_?NumericQ, k_?NumericQ]"
 * 
 *         n = Expression("Divide", expr, k).round_to_float(             # <<<<<<<<<<<<<<
 *             evaluation, permit_complex=True
 *         )
 */
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 966, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_n = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "mathics/builtin/numeric.py":969
 *             evaluation, permit_complex=True
 *         )
 *         if n is None:             # <<<<<<<<<<<<<<
 *             return
 *         elif isinstance(n, complex):
 */
  __pyx_t_6 = (__pyx_v_n == Py_None);
  __pyx_t_7 = (__pyx_t_6 != 0);
  if (__pyx_t_7) {

    /* "mathics/builtin/numeric.py":970
 *         )
 *         if n is None:
 *             return             # <<<<<<<<<<<<<<
 *         elif isinstance(n, complex):
 *             n = round(n.real)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "mathics/builtin/numeric.py":969
 *             evaluation, permit_complex=True
 *         )
 *         if n is None:             # <<<<<<<<<<<<<<
 *             return
 *         elif isinstance(n, complex):
 */
  }

  /* "mathics/builtin/numeric.py":971
 *         if n is None:
 *             return
 *         elif isinstance(n, complex):             # <<<<<<<<<<<<<<
 *             n = round(n.real)
 *         else:
 */
  __pyx_t_7 = PyComplex_Check(__pyx_v_n); 
  __pyx_t_6 = (__pyx_t_7 != 0);
  if (__pyx_t_6) {

    /* "mathics/builtin/numeric.py":972
 *             return
 *         elif isinstance(n, complex):
 *             n = round(n.real)             # <<<<<<<<<<<<<<
 *         else:
 *             n = round(n)
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_n, __pyx_n_s_real); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 972, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_round, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 972, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "mathics/builtin/numeric.py":971
 *         if n is None:
 *             return
 *         elif isinstance(n, complex):             # <<<<<<<<<<<<<<
 *             n = round(n.real)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "mathics/builtin/numeric.py":974
 *             n = round(n.real)
 *         else:
 *             n = round(n)             # <<<<<<<<<<<<<<
 *         n = int(n)
 *         return Expression("Times", Integer(n), k)
 */
  /*else*/ {
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_round, __pyx_v_n); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 974, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_5);
    __pyx_t_5 = 0;
  }
  __pyx_L3:;

  /* "mathics/builtin/numeric.py":975
 *         else:
 *             n = round(n)
 *         n = int(n)             # <<<<<<<<<<<<<<
 *         return Expression("Times", Integer(n), k)
 * 
 */
  __pyx_t_5 = __Pyx_PyNumber_Int(__pyx_v_n); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 975, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_5);
  __pyx_t_5 = 0;

  /* "mathics/builtin/numeric.py":976
 *             n = round(n)
 *         n = int(n)
 *         return Expression("Times", Integer(n), k)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Expression); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 976, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Integer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 976, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_8, __pyx_v_n) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_n);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 976, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_n_u_Times, __pyx_t_1, __pyx_v_k};
    __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 976, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_n_u_Times, __pyx_t_1, __pyx_v_k};
    __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 976, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 976, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(__pyx_n_u_Times);
    __Pyx_GIVEREF(__pyx_n_u_Times);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_4, __pyx_n_u_Times);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_4, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_k);
    __Pyx_GIVEREF(__pyx_v_k);
    PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_4, __pyx_v_k);
    __pyx_t_1 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 976, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "mathics/builtin/numeric.py":963
 *     }
 * 
 *     def apply(self, expr, k, evaluation):             # <<<<<<<<<<<<<<
 *         "Round[expr_?NumericQ, k_?NumericQ]"
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("mathics.builtin.numeric.Round.apply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1039
 *     }
 * 
 *     def apply(self, x, evaluation):             # <<<<<<<<<<<<<<
 *         "Rationalize[x_]"
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_11Rationalize_1apply(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_7builtin_7numeric_11Rationalize_apply[] = "Rationalize[x_]";
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_11Rationalize_1apply = {"apply", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_11Rationalize_1apply, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_7builtin_7numeric_11Rationalize_apply};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_11Rationalize_1apply(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_x = 0;
  CYTHON_UNUSED PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("apply (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_x,&__pyx_n_s_evaluation,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply", 1, 3, 3, 1); __PYX_ERR(0, 1039, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply", 1, 3, 3, 2); __PYX_ERR(0, 1039, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply") < 0)) __PYX_ERR(0, 1039, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_x = values[1];
    __pyx_v_evaluation = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("apply", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1039, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.Rationalize.apply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_11Rationalize_apply(__pyx_self, __pyx_v_self, __pyx_v_x, __pyx_v_evaluation);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_11Rationalize_apply(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *__pyx_v_evaluation) {
  PyObject *__pyx_v_py_x = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("apply", 0);

  /* "mathics/builtin/numeric.py":1042
 *         "Rationalize[x_]"
 * 
 *         py_x = x.to_sympy()             # <<<<<<<<<<<<<<
 *         if py_x is None or (not py_x.is_number) or (not py_x.is_real):
 *             return x
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_x, __pyx_n_s_to_sympy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_py_x = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":1043
 * 
 *         py_x = x.to_sympy()
 *         if py_x is None or (not py_x.is_number) or (not py_x.is_real):             # <<<<<<<<<<<<<<
 *             return x
 *         return from_sympy(self.find_approximant(py_x))
 */
  __pyx_t_5 = (__pyx_v_py_x == Py_None);
  __pyx_t_6 = (__pyx_t_5 != 0);
  if (!__pyx_t_6) {
  } else {
    __pyx_t_4 = __pyx_t_6;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_py_x, __pyx_n_s_is_number); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1043, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1043, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = ((!__pyx_t_6) != 0);
  if (!__pyx_t_5) {
  } else {
    __pyx_t_4 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_py_x, __pyx_n_s_is_real); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1043, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1043, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = ((!__pyx_t_5) != 0);
  __pyx_t_4 = __pyx_t_6;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_4) {

    /* "mathics/builtin/numeric.py":1044
 *         py_x = x.to_sympy()
 *         if py_x is None or (not py_x.is_number) or (not py_x.is_real):
 *             return x             # <<<<<<<<<<<<<<
 *         return from_sympy(self.find_approximant(py_x))
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_x);
    __pyx_r = __pyx_v_x;
    goto __pyx_L0;

    /* "mathics/builtin/numeric.py":1043
 * 
 *         py_x = x.to_sympy()
 *         if py_x is None or (not py_x.is_number) or (not py_x.is_real):             # <<<<<<<<<<<<<<
 *             return x
 *         return from_sympy(self.find_approximant(py_x))
 */
  }

  /* "mathics/builtin/numeric.py":1045
 *         if py_x is None or (not py_x.is_number) or (not py_x.is_real):
 *             return x
 *         return from_sympy(self.find_approximant(py_x))             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_from_sympy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1045, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_find_approximant); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1045, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  __pyx_t_3 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_v_py_x) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_py_x);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1045, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_7, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1045, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/builtin/numeric.py":1039
 *     }
 * 
 *     def apply(self, x, evaluation):             # <<<<<<<<<<<<<<
 *         "Rationalize[x_]"
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("mathics.builtin.numeric.Rationalize.apply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_py_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1048
 * 
 *     @staticmethod
 *     def find_approximant(x):             # <<<<<<<<<<<<<<
 *         c = 1e-4
 *         it = sympy.ntheory.continued_fraction_convergents(
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_11Rationalize_3find_approximant(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_11Rationalize_3find_approximant = {"find_approximant", (PyCFunction)__pyx_pw_7mathics_7builtin_7numeric_11Rationalize_3find_approximant, METH_O, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_11Rationalize_3find_approximant(PyObject *__pyx_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("find_approximant (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_11Rationalize_2find_approximant(__pyx_self, ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_11Rationalize_2find_approximant(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x) {
  double __pyx_v_c;
  PyObject *__pyx_v_it = NULL;
  PyObject *__pyx_v_i = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_p = NULL;
  PyObject *__pyx_v_q = NULL;
  PyObject *__pyx_v_tol = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("find_approximant", 0);

  /* "mathics/builtin/numeric.py":1049
 *     @staticmethod
 *     def find_approximant(x):
 *         c = 1e-4             # <<<<<<<<<<<<<<
 *         it = sympy.ntheory.continued_fraction_convergents(
 *             sympy.ntheory.continued_fraction_iterator(x)
 */
  __pyx_v_c = 1e-4;

  /* "mathics/builtin/numeric.py":1050
 *     def find_approximant(x):
 *         c = 1e-4
 *         it = sympy.ntheory.continued_fraction_convergents(             # <<<<<<<<<<<<<<
 *             sympy.ntheory.continued_fraction_iterator(x)
 *         )
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sympy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1050, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ntheory); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1050, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_continued_fraction_convergents); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1050, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "mathics/builtin/numeric.py":1051
 *         c = 1e-4
 *         it = sympy.ntheory.continued_fraction_convergents(
 *             sympy.ntheory.continued_fraction_iterator(x)             # <<<<<<<<<<<<<<
 *         )
 *         for i in it:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_sympy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1051, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ntheory); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1051, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_continued_fraction_iterator); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1051, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_x) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_x);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1051, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1050, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_it = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":1053
 *             sympy.ntheory.continued_fraction_iterator(x)
 *         )
 *         for i in it:             # <<<<<<<<<<<<<<
 *             p, q = i.as_numer_denom()
 *             tol = c / q ** 2
 */
  if (likely(PyList_CheckExact(__pyx_v_it)) || PyTuple_CheckExact(__pyx_v_it)) {
    __pyx_t_1 = __pyx_v_it; __Pyx_INCREF(__pyx_t_1); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_it); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1053, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1053, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 1053, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1053, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 1053, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1053, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_7(__pyx_t_1);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1053, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "mathics/builtin/numeric.py":1054
 *         )
 *         for i in it:
 *             p, q = i.as_numer_denom()             # <<<<<<<<<<<<<<
 *             tol = c / q ** 2
 *             if abs(i - x) <= tol:
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_i, __pyx_n_s_as_numer_denom); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1054, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1054, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1054, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1054, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1054, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1054, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_5)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_4 = __pyx_t_8(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_5), 2) < 0) __PYX_ERR(0, 1054, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1054, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_p, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_q, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "mathics/builtin/numeric.py":1055
 *         for i in it:
 *             p, q = i.as_numer_denom()
 *             tol = c / q ** 2             # <<<<<<<<<<<<<<
 *             if abs(i - x) <= tol:
 *                 return i
 */
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_c); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1055, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyNumber_Power(__pyx_v_q, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1055, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1055, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF_SET(__pyx_v_tol, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "mathics/builtin/numeric.py":1056
 *             p, q = i.as_numer_denom()
 *             tol = c / q ** 2
 *             if abs(i - x) <= tol:             # <<<<<<<<<<<<<<
 *                 return i
 *             if tol < machine_epsilon:
 */
    __pyx_t_3 = PyNumber_Subtract(__pyx_v_i, __pyx_v_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1056, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyNumber_Absolute(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1056, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_v_tol, Py_LE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1056, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 1056, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_9) {

      /* "mathics/builtin/numeric.py":1057
 *             tol = c / q ** 2
 *             if abs(i - x) <= tol:
 *                 return i             # <<<<<<<<<<<<<<
 *             if tol < machine_epsilon:
 *                 break
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_i);
      __pyx_r = __pyx_v_i;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;

      /* "mathics/builtin/numeric.py":1056
 *             p, q = i.as_numer_denom()
 *             tol = c / q ** 2
 *             if abs(i - x) <= tol:             # <<<<<<<<<<<<<<
 *                 return i
 *             if tol < machine_epsilon:
 */
    }

    /* "mathics/builtin/numeric.py":1058
 *             if abs(i - x) <= tol:
 *                 return i
 *             if tol < machine_epsilon:             # <<<<<<<<<<<<<<
 *                 break
 *         return x
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_machine_epsilon); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1058, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_RichCompare(__pyx_v_tol, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1058, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 1058, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_9) {

      /* "mathics/builtin/numeric.py":1059
 *                 return i
 *             if tol < machine_epsilon:
 *                 break             # <<<<<<<<<<<<<<
 *         return x
 * 
 */
      goto __pyx_L4_break;

      /* "mathics/builtin/numeric.py":1058
 *             if abs(i - x) <= tol:
 *                 return i
 *             if tol < machine_epsilon:             # <<<<<<<<<<<<<<
 *                 break
 *         return x
 */
    }

    /* "mathics/builtin/numeric.py":1053
 *             sympy.ntheory.continued_fraction_iterator(x)
 *         )
 *         for i in it:             # <<<<<<<<<<<<<<
 *             p, q = i.as_numer_denom()
 *             tol = c / q ** 2
 */
  }
  __pyx_L4_break:;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":1060
 *             if tol < machine_epsilon:
 *                 break
 *         return x             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_x);
  __pyx_r = __pyx_v_x;
  goto __pyx_L0;

  /* "mathics/builtin/numeric.py":1048
 * 
 *     @staticmethod
 *     def find_approximant(x):             # <<<<<<<<<<<<<<
 *         c = 1e-4
 *         it = sympy.ntheory.continued_fraction_convergents(
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("mathics.builtin.numeric.Rationalize.find_approximant", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_it);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XDECREF(__pyx_v_q);
  __Pyx_XDECREF(__pyx_v_tol);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1063
 * 
 *     @staticmethod
 *     def find_exact(x):             # <<<<<<<<<<<<<<
 *         p, q = x.as_numer_denom()
 *         it = sympy.ntheory.continued_fraction_convergents(
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_11Rationalize_5find_exact(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_11Rationalize_5find_exact = {"find_exact", (PyCFunction)__pyx_pw_7mathics_7builtin_7numeric_11Rationalize_5find_exact, METH_O, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_11Rationalize_5find_exact(PyObject *__pyx_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("find_exact (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_11Rationalize_4find_exact(__pyx_self, ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_11Rationalize_4find_exact(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x) {
  CYTHON_UNUSED PyObject *__pyx_v_p = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_q = NULL;
  PyObject *__pyx_v_it = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("find_exact", 0);

  /* "mathics/builtin/numeric.py":1064
 *     @staticmethod
 *     def find_exact(x):
 *         p, q = x.as_numer_denom()             # <<<<<<<<<<<<<<
 *         it = sympy.ntheory.continued_fraction_convergents(
 *             sympy.ntheory.continued_fraction_iterator(x)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_x, __pyx_n_s_as_numer_denom); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1064, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1064, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1064, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1064, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1064, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1064, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 1064, __pyx_L1_error)
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1064, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_p = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_q = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "mathics/builtin/numeric.py":1065
 *     def find_exact(x):
 *         p, q = x.as_numer_denom()
 *         it = sympy.ntheory.continued_fraction_convergents(             # <<<<<<<<<<<<<<
 *             sympy.ntheory.continued_fraction_iterator(x)
 *         )
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_sympy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1065, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_ntheory); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1065, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_continued_fraction_convergents); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1065, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":1066
 *         p, q = x.as_numer_denom()
 *         it = sympy.ntheory.continued_fraction_convergents(
 *             sympy.ntheory.continued_fraction_iterator(x)             # <<<<<<<<<<<<<<
 *         )
 *         for i in it:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_sympy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1066, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ntheory); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1066, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_continued_fraction_iterator); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1066, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_v_x) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_x);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1066, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1065, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_it = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":1068
 *             sympy.ntheory.continued_fraction_iterator(x)
 *         )
 *         for i in it:             # <<<<<<<<<<<<<<
 *             p, q = i.as_numer_denom()
 *             if abs(x - i) < machine_epsilon:
 */
  if (likely(PyList_CheckExact(__pyx_v_it)) || PyTuple_CheckExact(__pyx_v_it)) {
    __pyx_t_1 = __pyx_v_it; __Pyx_INCREF(__pyx_t_1); __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
  } else {
    __pyx_t_7 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_it); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1068, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1068, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_8)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 1068, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1068, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      } else {
        if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 1068, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1068, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      }
    } else {
      __pyx_t_3 = __pyx_t_8(__pyx_t_1);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1068, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "mathics/builtin/numeric.py":1069
 *         )
 *         for i in it:
 *             p, q = i.as_numer_denom()             # <<<<<<<<<<<<<<
 *             if abs(x - i) < machine_epsilon:
 *                 return i
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_i, __pyx_n_s_as_numer_denom); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1069, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1069, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
      PyObject* sequence = __pyx_t_3;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1069, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1069, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1069, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1069, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_5 = Py_TYPE(__pyx_t_6)->tp_iternext;
      index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_2);
      index = 1; __pyx_t_4 = __pyx_t_5(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_6), 2) < 0) __PYX_ERR(0, 1069, __pyx_L1_error)
      __pyx_t_5 = NULL;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L8_unpacking_done;
      __pyx_L7_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_5 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1069, __pyx_L1_error)
      __pyx_L8_unpacking_done:;
    }
    __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_2);
    __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_q, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "mathics/builtin/numeric.py":1070
 *         for i in it:
 *             p, q = i.as_numer_denom()
 *             if abs(x - i) < machine_epsilon:             # <<<<<<<<<<<<<<
 *                 return i
 * 
 */
    __pyx_t_3 = PyNumber_Subtract(__pyx_v_x, __pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1070, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyNumber_Absolute(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1070, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_machine_epsilon); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1070, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1070, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 1070, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_9) {

      /* "mathics/builtin/numeric.py":1071
 *             p, q = i.as_numer_denom()
 *             if abs(x - i) < machine_epsilon:
 *                 return i             # <<<<<<<<<<<<<<
 * 
 *     def apply_dx(self, x, dx, evaluation):
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_i);
      __pyx_r = __pyx_v_i;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;

      /* "mathics/builtin/numeric.py":1070
 *         for i in it:
 *             p, q = i.as_numer_denom()
 *             if abs(x - i) < machine_epsilon:             # <<<<<<<<<<<<<<
 *                 return i
 * 
 */
    }

    /* "mathics/builtin/numeric.py":1068
 *             sympy.ntheory.continued_fraction_iterator(x)
 *         )
 *         for i in it:             # <<<<<<<<<<<<<<
 *             p, q = i.as_numer_denom()
 *             if abs(x - i) < machine_epsilon:
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":1063
 * 
 *     @staticmethod
 *     def find_exact(x):             # <<<<<<<<<<<<<<
 *         p, q = x.as_numer_denom()
 *         it = sympy.ntheory.continued_fraction_convergents(
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("mathics.builtin.numeric.Rationalize.find_exact", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XDECREF(__pyx_v_q);
  __Pyx_XDECREF(__pyx_v_it);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1073
 *                 return i
 * 
 *     def apply_dx(self, x, dx, evaluation):             # <<<<<<<<<<<<<<
 *         "Rationalize[x_, dx_]"
 *         py_x = x.to_sympy()
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_11Rationalize_7apply_dx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_7builtin_7numeric_11Rationalize_6apply_dx[] = "Rationalize[x_, dx_]";
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_11Rationalize_7apply_dx = {"apply_dx", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_11Rationalize_7apply_dx, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_7builtin_7numeric_11Rationalize_6apply_dx};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_11Rationalize_7apply_dx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_dx = 0;
  PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("apply_dx (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_x,&__pyx_n_s_dx,&__pyx_n_s_evaluation,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_dx", 1, 4, 4, 1); __PYX_ERR(0, 1073, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_dx", 1, 4, 4, 2); __PYX_ERR(0, 1073, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_dx", 1, 4, 4, 3); __PYX_ERR(0, 1073, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply_dx") < 0)) __PYX_ERR(0, 1073, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_self = values[0];
    __pyx_v_x = values[1];
    __pyx_v_dx = values[2];
    __pyx_v_evaluation = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("apply_dx", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1073, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.Rationalize.apply_dx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_11Rationalize_6apply_dx(__pyx_self, __pyx_v_self, __pyx_v_x, __pyx_v_dx, __pyx_v_evaluation);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_11Rationalize_6apply_dx(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_dx, PyObject *__pyx_v_evaluation) {
  PyObject *__pyx_v_py_x = NULL;
  PyObject *__pyx_v_py_dx = NULL;
  PyObject *__pyx_v_a = NULL;
  PyObject *__pyx_v_sym_x = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("apply_dx", 0);

  /* "mathics/builtin/numeric.py":1075
 *     def apply_dx(self, x, dx, evaluation):
 *         "Rationalize[x_, dx_]"
 *         py_x = x.to_sympy()             # <<<<<<<<<<<<<<
 *         if py_x is None:
 *             return x
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_x, __pyx_n_s_to_sympy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1075, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1075, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_py_x = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":1076
 *         "Rationalize[x_, dx_]"
 *         py_x = x.to_sympy()
 *         if py_x is None:             # <<<<<<<<<<<<<<
 *             return x
 *         py_dx = dx.to_sympy()
 */
  __pyx_t_4 = (__pyx_v_py_x == Py_None);
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "mathics/builtin/numeric.py":1077
 *         py_x = x.to_sympy()
 *         if py_x is None:
 *             return x             # <<<<<<<<<<<<<<
 *         py_dx = dx.to_sympy()
 *         if (
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_x);
    __pyx_r = __pyx_v_x;
    goto __pyx_L0;

    /* "mathics/builtin/numeric.py":1076
 *         "Rationalize[x_, dx_]"
 *         py_x = x.to_sympy()
 *         if py_x is None:             # <<<<<<<<<<<<<<
 *             return x
 *         py_dx = dx.to_sympy()
 */
  }

  /* "mathics/builtin/numeric.py":1078
 *         if py_x is None:
 *             return x
 *         py_dx = dx.to_sympy()             # <<<<<<<<<<<<<<
 *         if (
 *             py_dx is None
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dx, __pyx_n_s_to_sympy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1078, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1078, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_py_dx = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":1080
 *         py_dx = dx.to_sympy()
 *         if (
 *             py_dx is None             # <<<<<<<<<<<<<<
 *             or (not py_dx.is_number)
 *             or (not py_dx.is_real)
 */
  __pyx_t_4 = (__pyx_v_py_dx == Py_None);
  __pyx_t_6 = (__pyx_t_4 != 0);
  if (!__pyx_t_6) {
  } else {
    __pyx_t_5 = __pyx_t_6;
    goto __pyx_L5_bool_binop_done;
  }

  /* "mathics/builtin/numeric.py":1081
 *         if (
 *             py_dx is None
 *             or (not py_dx.is_number)             # <<<<<<<<<<<<<<
 *             or (not py_dx.is_real)
 *             or py_dx.is_negative
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_py_dx, __pyx_n_s_is_number); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1081, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1081, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = ((!__pyx_t_6) != 0);
  if (!__pyx_t_4) {
  } else {
    __pyx_t_5 = __pyx_t_4;
    goto __pyx_L5_bool_binop_done;
  }

  /* "mathics/builtin/numeric.py":1082
 *             py_dx is None
 *             or (not py_dx.is_number)
 *             or (not py_dx.is_real)             # <<<<<<<<<<<<<<
 *             or py_dx.is_negative
 *         ):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_py_dx, __pyx_n_s_is_real); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1082, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1082, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = ((!__pyx_t_4) != 0);
  if (!__pyx_t_6) {
  } else {
    __pyx_t_5 = __pyx_t_6;
    goto __pyx_L5_bool_binop_done;
  }

  /* "mathics/builtin/numeric.py":1083
 *             or (not py_dx.is_number)
 *             or (not py_dx.is_real)
 *             or py_dx.is_negative             # <<<<<<<<<<<<<<
 *         ):
 *             return evaluation.message("Rationalize", "tolnn", dx)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_py_dx, __pyx_n_s_is_negative); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1083, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1083, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __pyx_t_6;
  __pyx_L5_bool_binop_done:;

  /* "mathics/builtin/numeric.py":1079
 *             return x
 *         py_dx = dx.to_sympy()
 *         if (             # <<<<<<<<<<<<<<
 *             py_dx is None
 *             or (not py_dx.is_number)
 */
  if (__pyx_t_5) {

    /* "mathics/builtin/numeric.py":1085
 *             or py_dx.is_negative
 *         ):
 *             return evaluation.message("Rationalize", "tolnn", dx)             # <<<<<<<<<<<<<<
 *         elif py_dx == 0:
 *             return from_sympy(self.find_exact(py_x))
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_message); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1085, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_n_u_Rationalize, __pyx_n_u_tolnn, __pyx_v_dx};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1085, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_n_u_Rationalize, __pyx_n_u_tolnn, __pyx_v_dx};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1085, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1085, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_3) {
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); __pyx_t_3 = NULL;
      }
      __Pyx_INCREF(__pyx_n_u_Rationalize);
      __Pyx_GIVEREF(__pyx_n_u_Rationalize);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_n_u_Rationalize);
      __Pyx_INCREF(__pyx_n_u_tolnn);
      __Pyx_GIVEREF(__pyx_n_u_tolnn);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_n_u_tolnn);
      __Pyx_INCREF(__pyx_v_dx);
      __Pyx_GIVEREF(__pyx_v_dx);
      PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_v_dx);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1085, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "mathics/builtin/numeric.py":1079
 *             return x
 *         py_dx = dx.to_sympy()
 *         if (             # <<<<<<<<<<<<<<
 *             py_dx is None
 *             or (not py_dx.is_number)
 */
  }

  /* "mathics/builtin/numeric.py":1086
 *         ):
 *             return evaluation.message("Rationalize", "tolnn", dx)
 *         elif py_dx == 0:             # <<<<<<<<<<<<<<
 *             return from_sympy(self.find_exact(py_x))
 *         a = self.approx_interval_continued_fraction(py_x - py_dx, py_x + py_dx)
 */
  __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_py_dx, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1086, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1086, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_5) {

    /* "mathics/builtin/numeric.py":1087
 *             return evaluation.message("Rationalize", "tolnn", dx)
 *         elif py_dx == 0:
 *             return from_sympy(self.find_exact(py_x))             # <<<<<<<<<<<<<<
 *         a = self.approx_interval_continued_fraction(py_x - py_dx, py_x + py_dx)
 *         sym_x = sympy.ntheory.continued_fraction_reduce(a)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_from_sympy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1087, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_find_exact); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1087, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_8 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_9, __pyx_v_py_x) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_py_x);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1087, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_8);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1087, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "mathics/builtin/numeric.py":1086
 *         ):
 *             return evaluation.message("Rationalize", "tolnn", dx)
 *         elif py_dx == 0:             # <<<<<<<<<<<<<<
 *             return from_sympy(self.find_exact(py_x))
 *         a = self.approx_interval_continued_fraction(py_x - py_dx, py_x + py_dx)
 */
  }

  /* "mathics/builtin/numeric.py":1088
 *         elif py_dx == 0:
 *             return from_sympy(self.find_exact(py_x))
 *         a = self.approx_interval_continued_fraction(py_x - py_dx, py_x + py_dx)             # <<<<<<<<<<<<<<
 *         sym_x = sympy.ntheory.continued_fraction_reduce(a)
 *         return Rational(sym_x)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_approx_interval_continued_fracti); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1088, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = PyNumber_Subtract(__pyx_v_py_x, __pyx_v_py_dx); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1088, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_3 = PyNumber_Add(__pyx_v_py_x, __pyx_v_py_dx); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1088, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_9 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_8, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1088, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_8, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1088, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_10 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1088, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (__pyx_t_9) {
      __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_7, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_7, __pyx_t_3);
    __pyx_t_8 = 0;
    __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1088, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_a = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":1089
 *             return from_sympy(self.find_exact(py_x))
 *         a = self.approx_interval_continued_fraction(py_x - py_dx, py_x + py_dx)
 *         sym_x = sympy.ntheory.continued_fraction_reduce(a)             # <<<<<<<<<<<<<<
 *         return Rational(sym_x)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sympy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1089, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ntheory); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1089, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_continued_fraction_reduce); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1089, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_10)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_10, __pyx_v_a) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_a);
  __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1089, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_sym_x = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":1090
 *         a = self.approx_interval_continued_fraction(py_x - py_dx, py_x + py_dx)
 *         sym_x = sympy.ntheory.continued_fraction_reduce(a)
 *         return Rational(sym_x)             # <<<<<<<<<<<<<<
 * 
 *     @staticmethod
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Rational); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1090, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_10 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_10)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_10, __pyx_v_sym_x) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_sym_x);
  __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1090, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/builtin/numeric.py":1073
 *                 return i
 * 
 *     def apply_dx(self, x, dx, evaluation):             # <<<<<<<<<<<<<<
 *         "Rationalize[x_, dx_]"
 *         py_x = x.to_sympy()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("mathics.builtin.numeric.Rationalize.apply_dx", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_py_x);
  __Pyx_XDECREF(__pyx_v_py_dx);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XDECREF(__pyx_v_sym_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1093
 * 
 *     @staticmethod
 *     def approx_interval_continued_fraction(xmin, xmax):             # <<<<<<<<<<<<<<
 *         result = []
 *         a_gen = sympy.ntheory.continued_fraction_iterator(xmin)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_11Rationalize_9approx_interval_continued_fraction(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_11Rationalize_9approx_interval_continued_fraction = {"approx_interval_continued_fraction", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_11Rationalize_9approx_interval_continued_fraction, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_11Rationalize_9approx_interval_continued_fraction(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_xmin = 0;
  PyObject *__pyx_v_xmax = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("approx_interval_continued_fraction (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xmin,&__pyx_n_s_xmax,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xmin)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xmax)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("approx_interval_continued_fraction", 1, 2, 2, 1); __PYX_ERR(0, 1093, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "approx_interval_continued_fraction") < 0)) __PYX_ERR(0, 1093, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_xmin = values[0];
    __pyx_v_xmax = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("approx_interval_continued_fraction", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1093, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.Rationalize.approx_interval_continued_fraction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_11Rationalize_8approx_interval_continued_fraction(__pyx_self, __pyx_v_xmin, __pyx_v_xmax);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_11Rationalize_8approx_interval_continued_fraction(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_xmin, PyObject *__pyx_v_xmax) {
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_v_a_gen = NULL;
  PyObject *__pyx_v_b_gen = NULL;
  PyObject *__pyx_v_a = NULL;
  PyObject *__pyx_v_b = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("approx_interval_continued_fraction", 0);

  /* "mathics/builtin/numeric.py":1094
 *     @staticmethod
 *     def approx_interval_continued_fraction(xmin, xmax):
 *         result = []             # <<<<<<<<<<<<<<
 *         a_gen = sympy.ntheory.continued_fraction_iterator(xmin)
 *         b_gen = sympy.ntheory.continued_fraction_iterator(xmax)
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1094, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_result = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":1095
 *     def approx_interval_continued_fraction(xmin, xmax):
 *         result = []
 *         a_gen = sympy.ntheory.continued_fraction_iterator(xmin)             # <<<<<<<<<<<<<<
 *         b_gen = sympy.ntheory.continued_fraction_iterator(xmax)
 *         while True:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sympy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1095, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ntheory); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1095, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_continued_fraction_iterator); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1095, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_xmin) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_xmin);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1095, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_a_gen = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":1096
 *         result = []
 *         a_gen = sympy.ntheory.continued_fraction_iterator(xmin)
 *         b_gen = sympy.ntheory.continued_fraction_iterator(xmax)             # <<<<<<<<<<<<<<
 *         while True:
 *             a, b = next(a_gen), next(b_gen)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sympy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1096, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ntheory); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1096, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_continued_fraction_iterator); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1096, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_xmax) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_xmax);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1096, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_b_gen = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":1097
 *         a_gen = sympy.ntheory.continued_fraction_iterator(xmin)
 *         b_gen = sympy.ntheory.continued_fraction_iterator(xmax)
 *         while True:             # <<<<<<<<<<<<<<
 *             a, b = next(a_gen), next(b_gen)
 *             if a == b:
 */
  while (1) {

    /* "mathics/builtin/numeric.py":1098
 *         b_gen = sympy.ntheory.continued_fraction_iterator(xmax)
 *         while True:
 *             a, b = next(a_gen), next(b_gen)             # <<<<<<<<<<<<<<
 *             if a == b:
 *                 result.append(a)
 */
    __pyx_t_1 = __Pyx_PyIter_Next(__pyx_v_a_gen); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1098, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyIter_Next(__pyx_v_b_gen); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1098, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_a, __pyx_t_1);
    __pyx_t_1 = 0;
    __Pyx_XDECREF_SET(__pyx_v_b, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "mathics/builtin/numeric.py":1099
 *         while True:
 *             a, b = next(a_gen), next(b_gen)
 *             if a == b:             # <<<<<<<<<<<<<<
 *                 result.append(a)
 *             else:
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_a, __pyx_v_b, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1099, __pyx_L1_error)
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1099, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_4) {

      /* "mathics/builtin/numeric.py":1100
 *             a, b = next(a_gen), next(b_gen)
 *             if a == b:
 *                 result.append(a)             # <<<<<<<<<<<<<<
 *             else:
 *                 result.append(min(a, b) + 1)
 */
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_a); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 1100, __pyx_L1_error)

      /* "mathics/builtin/numeric.py":1099
 *         while True:
 *             a, b = next(a_gen), next(b_gen)
 *             if a == b:             # <<<<<<<<<<<<<<
 *                 result.append(a)
 *             else:
 */
      goto __pyx_L5;
    }

    /* "mathics/builtin/numeric.py":1102
 *                 result.append(a)
 *             else:
 *                 result.append(min(a, b) + 1)             # <<<<<<<<<<<<<<
 *                 break
 *         return result
 */
    /*else*/ {
      __Pyx_INCREF(__pyx_v_b);
      __pyx_t_2 = __pyx_v_b;
      __Pyx_INCREF(__pyx_v_a);
      __pyx_t_1 = __pyx_v_a;
      __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1102, __pyx_L1_error)
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1102, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (__pyx_t_4) {
        __Pyx_INCREF(__pyx_t_2);
        __pyx_t_3 = __pyx_t_2;
      } else {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_3 = __pyx_t_1;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1102, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_2); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 1102, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "mathics/builtin/numeric.py":1103
 *             else:
 *                 result.append(min(a, b) + 1)
 *                 break             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
      goto __pyx_L4_break;
    }
    __pyx_L5:;
  }
  __pyx_L4_break:;

  /* "mathics/builtin/numeric.py":1104
 *                 result.append(min(a, b) + 1)
 *                 break
 *         return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "mathics/builtin/numeric.py":1093
 * 
 *     @staticmethod
 *     def approx_interval_continued_fraction(xmin, xmax):             # <<<<<<<<<<<<<<
 *         result = []
 *         a_gen = sympy.ntheory.continued_fraction_iterator(xmin)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("mathics.builtin.numeric.Rationalize.approx_interval_continued_fraction", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_a_gen);
  __Pyx_XDECREF(__pyx_v_b_gen);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1107
 * 
 * 
 * def chop(expr, delta=10.0 ** (-10.0)):             # <<<<<<<<<<<<<<
 *     if isinstance(expr, Real):
 *         if -delta < expr.get_float_value() < delta:
 */

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_16__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__defaults__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_delta);
  __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_delta);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self)->__pyx_arg_delta);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None);
  __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("mathics.builtin.numeric.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_9chop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_9chop = {"chop", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_9chop, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_9chop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_expr = 0;
  PyObject *__pyx_v_delta = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("chop (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_expr,&__pyx_n_s_delta,0};
    PyObject* values[2] = {0,0};
    __pyx_defaults *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_self);
    values[1] = __pyx_dynamic_args->__pyx_arg_delta;
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_expr)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_delta);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "chop") < 0)) __PYX_ERR(0, 1107, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_expr = values[0];
    __pyx_v_delta = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("chop", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1107, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.chop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_8chop(__pyx_self, __pyx_v_expr, __pyx_v_delta);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_8chop(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_expr, PyObject *__pyx_v_delta) {
  PyObject *__pyx_v_real = NULL;
  PyObject *__pyx_v_imag = NULL;
  PyObject *__pyx_8genexpr9__pyx_v_leaf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  Py_ssize_t __pyx_t_10;
  PyObject *(*__pyx_t_11)(PyObject *);
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("chop", 0);

  /* "mathics/builtin/numeric.py":1108
 * 
 * def chop(expr, delta=10.0 ** (-10.0)):
 *     if isinstance(expr, Real):             # <<<<<<<<<<<<<<
 *         if -delta < expr.get_float_value() < delta:
 *             return Integer0
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Real); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_expr, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 1108, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "mathics/builtin/numeric.py":1109
 * def chop(expr, delta=10.0 ** (-10.0)):
 *     if isinstance(expr, Real):
 *         if -delta < expr.get_float_value() < delta:             # <<<<<<<<<<<<<<
 *             return Integer0
 *     elif isinstance(expr, Complex) and expr.is_inexact():
 */
    __pyx_t_1 = PyNumber_Negative(__pyx_v_delta); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1109, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_get_float_value); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1109, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1109, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1109, __pyx_L1_error)
    if (__Pyx_PyObject_IsTrue(__pyx_t_5)) {
      __Pyx_DECREF(__pyx_t_5);
      __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_v_delta, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1109, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1109, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_3) {

      /* "mathics/builtin/numeric.py":1110
 *     if isinstance(expr, Real):
 *         if -delta < expr.get_float_value() < delta:
 *             return Integer0             # <<<<<<<<<<<<<<
 *     elif isinstance(expr, Complex) and expr.is_inexact():
 *         real, imag = expr.real, expr.imag
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_Integer0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1110, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L0;

      /* "mathics/builtin/numeric.py":1109
 * def chop(expr, delta=10.0 ** (-10.0)):
 *     if isinstance(expr, Real):
 *         if -delta < expr.get_float_value() < delta:             # <<<<<<<<<<<<<<
 *             return Integer0
 *     elif isinstance(expr, Complex) and expr.is_inexact():
 */
    }

    /* "mathics/builtin/numeric.py":1108
 * 
 * def chop(expr, delta=10.0 ** (-10.0)):
 *     if isinstance(expr, Real):             # <<<<<<<<<<<<<<
 *         if -delta < expr.get_float_value() < delta:
 *             return Integer0
 */
    goto __pyx_L3;
  }

  /* "mathics/builtin/numeric.py":1111
 *         if -delta < expr.get_float_value() < delta:
 *             return Integer0
 *     elif isinstance(expr, Complex) and expr.is_inexact():             # <<<<<<<<<<<<<<
 *         real, imag = expr.real, expr.imag
 *         if -delta < real.get_float_value() < delta:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_Complex); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_expr, __pyx_t_5); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 1111, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_7 = (__pyx_t_2 != 0);
  if (__pyx_t_7) {
  } else {
    __pyx_t_3 = __pyx_t_7;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_is_inexact); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_5 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1111, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = __pyx_t_7;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_3) {

    /* "mathics/builtin/numeric.py":1112
 *             return Integer0
 *     elif isinstance(expr, Complex) and expr.is_inexact():
 *         real, imag = expr.real, expr.imag             # <<<<<<<<<<<<<<
 *         if -delta < real.get_float_value() < delta:
 *             real = Integer0
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_real); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1112, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_imag); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1112, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_real = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_v_imag = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "mathics/builtin/numeric.py":1113
 *     elif isinstance(expr, Complex) and expr.is_inexact():
 *         real, imag = expr.real, expr.imag
 *         if -delta < real.get_float_value() < delta:             # <<<<<<<<<<<<<<
 *             real = Integer0
 *         if -delta < imag.get_float_value() < delta:
 */
    __pyx_t_4 = PyNumber_Negative(__pyx_v_delta); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1113, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_real, __pyx_n_s_get_float_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1113, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_5 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1113, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1113, __pyx_L1_error)
    if (__Pyx_PyObject_IsTrue(__pyx_t_1)) {
      __Pyx_DECREF(__pyx_t_1);
      __pyx_t_1 = PyObject_RichCompare(__pyx_t_5, __pyx_v_delta, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1113, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1113, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_3) {

      /* "mathics/builtin/numeric.py":1114
 *         real, imag = expr.real, expr.imag
 *         if -delta < real.get_float_value() < delta:
 *             real = Integer0             # <<<<<<<<<<<<<<
 *         if -delta < imag.get_float_value() < delta:
 *             imag = Integer0
 */
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Integer0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1114, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF_SET(__pyx_v_real, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "mathics/builtin/numeric.py":1113
 *     elif isinstance(expr, Complex) and expr.is_inexact():
 *         real, imag = expr.real, expr.imag
 *         if -delta < real.get_float_value() < delta:             # <<<<<<<<<<<<<<
 *             real = Integer0
 *         if -delta < imag.get_float_value() < delta:
 */
    }

    /* "mathics/builtin/numeric.py":1115
 *         if -delta < real.get_float_value() < delta:
 *             real = Integer0
 *         if -delta < imag.get_float_value() < delta:             # <<<<<<<<<<<<<<
 *             imag = Integer0
 *         return Complex(real, imag)
 */
    __pyx_t_1 = PyNumber_Negative(__pyx_v_delta); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1115, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_imag, __pyx_n_s_get_float_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1115, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_5 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1115, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1115, __pyx_L1_error)
    if (__Pyx_PyObject_IsTrue(__pyx_t_4)) {
      __Pyx_DECREF(__pyx_t_4);
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_v_delta, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1115, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1115, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_3) {

      /* "mathics/builtin/numeric.py":1116
 *             real = Integer0
 *         if -delta < imag.get_float_value() < delta:
 *             imag = Integer0             # <<<<<<<<<<<<<<
 *         return Complex(real, imag)
 *     elif isinstance(expr, Expression):
 */
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Integer0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1116, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF_SET(__pyx_v_imag, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "mathics/builtin/numeric.py":1115
 *         if -delta < real.get_float_value() < delta:
 *             real = Integer0
 *         if -delta < imag.get_float_value() < delta:             # <<<<<<<<<<<<<<
 *             imag = Integer0
 *         return Complex(real, imag)
 */
    }

    /* "mathics/builtin/numeric.py":1117
 *         if -delta < imag.get_float_value() < delta:
 *             imag = Integer0
 *         return Complex(real, imag)             # <<<<<<<<<<<<<<
 *     elif isinstance(expr, Expression):
 *         return Expression(chop(expr.head), *[chop(leaf) for leaf in expr.leaves])
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_Complex); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1117, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_real, __pyx_v_imag};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1117, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_real, __pyx_v_imag};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1117, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1117, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_1) {
        __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); __pyx_t_1 = NULL;
      }
      __Pyx_INCREF(__pyx_v_real);
      __Pyx_GIVEREF(__pyx_v_real);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_8, __pyx_v_real);
      __Pyx_INCREF(__pyx_v_imag);
      __Pyx_GIVEREF(__pyx_v_imag);
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_8, __pyx_v_imag);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1117, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "mathics/builtin/numeric.py":1111
 *         if -delta < expr.get_float_value() < delta:
 *             return Integer0
 *     elif isinstance(expr, Complex) and expr.is_inexact():             # <<<<<<<<<<<<<<
 *         real, imag = expr.real, expr.imag
 *         if -delta < real.get_float_value() < delta:
 */
  }

  /* "mathics/builtin/numeric.py":1118
 *             imag = Integer0
 *         return Complex(real, imag)
 *     elif isinstance(expr, Expression):             # <<<<<<<<<<<<<<
 *         return Expression(chop(expr.head), *[chop(leaf) for leaf in expr.leaves])
 *     return expr
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Expression); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyObject_IsInstance(__pyx_v_expr, __pyx_t_4); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 1118, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_7 = (__pyx_t_3 != 0);
  if (__pyx_t_7) {

    /* "mathics/builtin/numeric.py":1119
 *         return Complex(real, imag)
 *     elif isinstance(expr, Expression):
 *         return Expression(chop(expr.head), *[chop(leaf) for leaf in expr.leaves])             # <<<<<<<<<<<<<<
 *     return expr
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Expression); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_chop); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_head); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_5 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_9, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_1);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
    __pyx_t_5 = 0;
    { /* enter inner scope */
      __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1119, __pyx_L11_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_leaves); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1119, __pyx_L11_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
        __pyx_t_9 = __pyx_t_1; __Pyx_INCREF(__pyx_t_9); __pyx_t_10 = 0;
        __pyx_t_11 = NULL;
      } else {
        __pyx_t_10 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1119, __pyx_L11_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_11 = Py_TYPE(__pyx_t_9)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1119, __pyx_L11_error)
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      for (;;) {
        if (likely(!__pyx_t_11)) {
          if (likely(PyList_CheckExact(__pyx_t_9))) {
            if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_9)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_1 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 1119, __pyx_L11_error)
            #else
            __pyx_t_1 = PySequence_ITEM(__pyx_t_9, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1119, __pyx_L11_error)
            __Pyx_GOTREF(__pyx_t_1);
            #endif
          } else {
            if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_9)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 1119, __pyx_L11_error)
            #else
            __pyx_t_1 = PySequence_ITEM(__pyx_t_9, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1119, __pyx_L11_error)
            __Pyx_GOTREF(__pyx_t_1);
            #endif
          }
        } else {
          __pyx_t_1 = __pyx_t_11(__pyx_t_9);
          if (unlikely(!__pyx_t_1)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 1119, __pyx_L11_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_1);
        }
        __Pyx_XDECREF_SET(__pyx_8genexpr9__pyx_v_leaf, __pyx_t_1);
        __pyx_t_1 = 0;
        __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_chop); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1119, __pyx_L11_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_13 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
          __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_12);
          if (likely(__pyx_t_13)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
            __Pyx_INCREF(__pyx_t_13);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_12, function);
          }
        }
        __pyx_t_1 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_13, __pyx_8genexpr9__pyx_v_leaf) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_8genexpr9__pyx_v_leaf);
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1119, __pyx_L11_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 1119, __pyx_L11_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_leaf); __pyx_8genexpr9__pyx_v_leaf = 0;
      goto __pyx_L14_exit_scope;
      __pyx_L11_error:;
      __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_leaf); __pyx_8genexpr9__pyx_v_leaf = 0;
      goto __pyx_L1_error;
      __pyx_L14_exit_scope:;
    } /* exit inner scope */
    __pyx_t_9 = PySequence_Tuple(__pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Add(__pyx_t_6, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1119, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_9;
    __pyx_t_9 = 0;
    goto __pyx_L0;

    /* "mathics/builtin/numeric.py":1118
 *             imag = Integer0
 *         return Complex(real, imag)
 *     elif isinstance(expr, Expression):             # <<<<<<<<<<<<<<
 *         return Expression(chop(expr.head), *[chop(leaf) for leaf in expr.leaves])
 *     return expr
 */
  }
  __pyx_L3:;

  /* "mathics/builtin/numeric.py":1120
 *     elif isinstance(expr, Expression):
 *         return Expression(chop(expr.head), *[chop(leaf) for leaf in expr.leaves])
 *     return expr             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_expr);
  __pyx_r = __pyx_v_expr;
  goto __pyx_L0;

  /* "mathics/builtin/numeric.py":1107
 * 
 * 
 * def chop(expr, delta=10.0 ** (-10.0)):             # <<<<<<<<<<<<<<
 *     if isinstance(expr, Real):
 *         if -delta < expr.get_float_value() < delta:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("mathics.builtin.numeric.chop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_real);
  __Pyx_XDECREF(__pyx_v_imag);
  __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_leaf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1150
 *     }
 * 
 *     def apply(self, expr, delta, evaluation):             # <<<<<<<<<<<<<<
 *         "Chop[expr_, delta_:(10^-10)]"
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_4Chop_1apply(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_7builtin_7numeric_4Chop_apply[] = "Chop[expr_, delta_:(10^-10)]";
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_4Chop_1apply = {"apply", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_4Chop_1apply, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_7builtin_7numeric_4Chop_apply};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_4Chop_1apply(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_expr = 0;
  PyObject *__pyx_v_delta = 0;
  PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("apply (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_expr,&__pyx_n_s_delta,&__pyx_n_s_evaluation,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_expr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply", 1, 4, 4, 1); __PYX_ERR(0, 1150, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_delta)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply", 1, 4, 4, 2); __PYX_ERR(0, 1150, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply", 1, 4, 4, 3); __PYX_ERR(0, 1150, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply") < 0)) __PYX_ERR(0, 1150, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_self = values[0];
    __pyx_v_expr = values[1];
    __pyx_v_delta = values[2];
    __pyx_v_evaluation = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("apply", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1150, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.Chop.apply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_4Chop_apply(__pyx_self, __pyx_v_self, __pyx_v_expr, __pyx_v_delta, __pyx_v_evaluation);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_4Chop_apply(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_expr, PyObject *__pyx_v_delta, PyObject *__pyx_v_evaluation) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("apply", 0);
  __Pyx_INCREF(__pyx_v_delta);

  /* "mathics/builtin/numeric.py":1153
 *         "Chop[expr_, delta_:(10^-10)]"
 * 
 *         delta = delta.round_to_float(evaluation)             # <<<<<<<<<<<<<<
 *         if delta is None or delta < 0:
 *             return evaluation.message("Chop", "tolnn")
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_delta, __pyx_n_s_round_to_float); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_evaluation) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_evaluation);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_delta, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":1154
 * 
 *         delta = delta.round_to_float(evaluation)
 *         if delta is None or delta < 0:             # <<<<<<<<<<<<<<
 *             return evaluation.message("Chop", "tolnn")
 * 
 */
  __pyx_t_5 = (__pyx_v_delta == Py_None);
  __pyx_t_6 = (__pyx_t_5 != 0);
  if (!__pyx_t_6) {
  } else {
    __pyx_t_4 = __pyx_t_6;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_delta, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1154, __pyx_L1_error)
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1154, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = __pyx_t_6;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_4) {

    /* "mathics/builtin/numeric.py":1155
 *         delta = delta.round_to_float(evaluation)
 *         if delta is None or delta < 0:
 *             return evaluation.message("Chop", "tolnn")             # <<<<<<<<<<<<<<
 * 
 *         return chop(expr, delta=delta)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_message); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1155, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1155, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "mathics/builtin/numeric.py":1154
 * 
 *         delta = delta.round_to_float(evaluation)
 *         if delta is None or delta < 0:             # <<<<<<<<<<<<<<
 *             return evaluation.message("Chop", "tolnn")
 * 
 */
  }

  /* "mathics/builtin/numeric.py":1157
 *             return evaluation.message("Chop", "tolnn")
 * 
 *         return chop(expr, delta=delta)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_chop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1157, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1157, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_expr);
  __Pyx_GIVEREF(__pyx_v_expr);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_expr);
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1157, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_delta, __pyx_v_delta) < 0) __PYX_ERR(0, 1157, __pyx_L1_error)
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1157, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "mathics/builtin/numeric.py":1150
 *     }
 * 
 *     def apply(self, expr, delta, evaluation):             # <<<<<<<<<<<<<<
 *         "Chop[expr_, delta_:(10^-10)]"
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("mathics.builtin.numeric.Chop.apply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_delta);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1175
 *     """
 * 
 *     def apply(self, expr, evaluation):             # <<<<<<<<<<<<<<
 *         "NumericQ[expr_]"
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_8NumericQ_1apply(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_7builtin_7numeric_8NumericQ_apply[] = "NumericQ[expr_]";
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_8NumericQ_1apply = {"apply", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_8NumericQ_1apply, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_7builtin_7numeric_8NumericQ_apply};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_8NumericQ_1apply(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_expr = 0;
  PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("apply (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_expr,&__pyx_n_s_evaluation,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_expr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply", 1, 3, 3, 1); __PYX_ERR(0, 1175, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply", 1, 3, 3, 2); __PYX_ERR(0, 1175, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply") < 0)) __PYX_ERR(0, 1175, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_expr = values[1];
    __pyx_v_evaluation = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("apply", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1175, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.NumericQ.apply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_8NumericQ_apply(__pyx_self, __pyx_v_self, __pyx_v_expr, __pyx_v_evaluation);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1178
 *         "NumericQ[expr_]"
 * 
 *         def test(expr):             # <<<<<<<<<<<<<<
 *             if isinstance(expr, Expression):
 *                 attr = evaluation.definitions.get_attributes(expr.head.get_name())
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_8NumericQ_5apply_1test(PyObject *__pyx_self, PyObject *__pyx_v_expr); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_8NumericQ_5apply_1test = {"test", (PyCFunction)__pyx_pw_7mathics_7builtin_7numeric_8NumericQ_5apply_1test, METH_O, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_8NumericQ_5apply_1test(PyObject *__pyx_self, PyObject *__pyx_v_expr) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("test (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_8NumericQ_5apply_test(__pyx_self, ((PyObject *)__pyx_v_expr));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7mathics_7builtin_7numeric_8NumericQ_5apply_4test_2generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "mathics/builtin/numeric.py":1182
 *                 attr = evaluation.definitions.get_attributes(expr.head.get_name())
 *                 return "System`NumericFunction" in attr and all(
 *                     test(leaf) for leaf in expr.leaves             # <<<<<<<<<<<<<<
 *                 )
 *             else:
 */

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_8NumericQ_5apply_4test_genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr *)__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr(__pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1182, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_6_test *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7mathics_7builtin_7numeric_8NumericQ_5apply_4test_2generator1, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_NumericQ_apply_locals_test_local, __pyx_n_s_mathics_builtin_numeric); if (unlikely(!gen)) __PYX_ERR(0, 1182, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.NumericQ.apply.test.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_7mathics_7builtin_7numeric_8NumericQ_5apply_4test_2generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1182, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_expr)) { __Pyx_RaiseClosureNameError("expr"); __PYX_ERR(0, 1182, __pyx_L1_error) }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_expr, __pyx_n_s_leaves); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1182, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1182, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1182, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1182, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1182, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1182, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1182, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_leaf);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_leaf, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_outer_scope->__pyx_v_test)) { __Pyx_RaiseClosureNameError("test"); __PYX_ERR(0, 1182, __pyx_L1_error) }
    __pyx_t_1 = __pyx_pf_7mathics_7builtin_7numeric_8NumericQ_5apply_test(__pyx_cur_scope->__pyx_outer_scope->__pyx_outer_scope->__pyx_v_test, __pyx_cur_scope->__pyx_v_leaf); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1182, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1182, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = ((!__pyx_t_5) != 0);
    if (__pyx_t_6) {

      /* "mathics/builtin/numeric.py":1181
 *             if isinstance(expr, Expression):
 *                 attr = evaluation.definitions.get_attributes(expr.head.get_name())
 *                 return "System`NumericFunction" in attr and all(             # <<<<<<<<<<<<<<
 *                     test(leaf) for leaf in expr.leaves
 *                 )
 */
      __Pyx_XDECREF(__pyx_r);

      /* "mathics/builtin/numeric.py":1182
 *                 attr = evaluation.definitions.get_attributes(expr.head.get_name())
 *                 return "System`NumericFunction" in attr and all(
 *                     test(leaf) for leaf in expr.leaves             # <<<<<<<<<<<<<<
 *                 )
 *             else:
 */
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L0;
    }
  }
  /*else*/ {

    /* "mathics/builtin/numeric.py":1181
 *             if isinstance(expr, Expression):
 *                 attr = evaluation.definitions.get_attributes(expr.head.get_name())
 *                 return "System`NumericFunction" in attr and all(             # <<<<<<<<<<<<<<
 *                     test(leaf) for leaf in expr.leaves
 *                 )
 */
    __Pyx_XDECREF(__pyx_r);

    /* "mathics/builtin/numeric.py":1182
 *                 attr = evaluation.definitions.get_attributes(expr.head.get_name())
 *                 return "System`NumericFunction" in attr and all(
 *                     test(leaf) for leaf in expr.leaves             # <<<<<<<<<<<<<<
 *                 )
 *             else:
 */
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1178
 *         "NumericQ[expr_]"
 * 
 *         def test(expr):             # <<<<<<<<<<<<<<
 *             if isinstance(expr, Expression):
 *                 attr = evaluation.definitions.get_attributes(expr.head.get_name())
 */

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_8NumericQ_5apply_test(PyObject *__pyx_self, PyObject *__pyx_v_expr) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_6_test *__pyx_cur_scope;
  PyObject *__pyx_v_attr = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("test", 0);
  __pyx_cur_scope = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_6_test *)__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_6_test(__pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_6_test, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_6_test *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1178, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  __pyx_cur_scope->__pyx_v_expr = __pyx_v_expr;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_expr);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_expr);

  /* "mathics/builtin/numeric.py":1179
 * 
 *         def test(expr):
 *             if isinstance(expr, Expression):             # <<<<<<<<<<<<<<
 *                 attr = evaluation.definitions.get_attributes(expr.head.get_name())
 *                 return "System`NumericFunction" in attr and all(
 */
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_expr;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Expression); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1179, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_IsInstance(__pyx_t_1, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 1179, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "mathics/builtin/numeric.py":1180
 *         def test(expr):
 *             if isinstance(expr, Expression):
 *                 attr = evaluation.definitions.get_attributes(expr.head.get_name())             # <<<<<<<<<<<<<<
 *                 return "System`NumericFunction" in attr and all(
 *                     test(leaf) for leaf in expr.leaves
 */
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_evaluation)) { __Pyx_RaiseClosureNameError("evaluation"); __PYX_ERR(0, 1180, __pyx_L1_error) }
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_evaluation, __pyx_n_s_definitions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1180, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_get_attributes); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1180, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_expr, __pyx_n_s_head); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1180, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_get_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1180, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1180, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_2 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1180, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_attr = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "mathics/builtin/numeric.py":1181
 *             if isinstance(expr, Expression):
 *                 attr = evaluation.definitions.get_attributes(expr.head.get_name())
 *                 return "System`NumericFunction" in attr and all(             # <<<<<<<<<<<<<<
 *                     test(leaf) for leaf in expr.leaves
 *                 )
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u_System_NumericFunction, __pyx_v_attr, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1181, __pyx_L1_error)
    if (__pyx_t_4) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1181, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_2 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L4_bool_binop_done;
    }

    /* "mathics/builtin/numeric.py":1182
 *                 attr = evaluation.definitions.get_attributes(expr.head.get_name())
 *                 return "System`NumericFunction" in attr and all(
 *                     test(leaf) for leaf in expr.leaves             # <<<<<<<<<<<<<<
 *                 )
 *             else:
 */
    __pyx_t_5 = __pyx_pf_7mathics_7builtin_7numeric_8NumericQ_5apply_4test_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1182, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = __Pyx_Generator_Next(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1182, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = __pyx_t_1;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_L4_bool_binop_done:;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "mathics/builtin/numeric.py":1179
 * 
 *         def test(expr):
 *             if isinstance(expr, Expression):             # <<<<<<<<<<<<<<
 *                 attr = evaluation.definitions.get_attributes(expr.head.get_name())
 *                 return "System`NumericFunction" in attr and all(
 */
  }

  /* "mathics/builtin/numeric.py":1185
 *                 )
 *             else:
 *                 return expr.is_numeric()             # <<<<<<<<<<<<<<
 * 
 *         return SymbolTrue if test(expr) else SymbolFalse
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_expr, __pyx_n_s_is_numeric); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1185, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1185, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "mathics/builtin/numeric.py":1178
 *         "NumericQ[expr_]"
 * 
 *         def test(expr):             # <<<<<<<<<<<<<<
 *             if isinstance(expr, Expression):
 *                 attr = evaluation.definitions.get_attributes(expr.head.get_name())
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("mathics.builtin.numeric.NumericQ.apply.test", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_attr);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1175
 *     """
 * 
 *     def apply(self, expr, evaluation):             # <<<<<<<<<<<<<<
 *         "NumericQ[expr_]"
 * 
 */

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_8NumericQ_apply(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_expr, PyObject *__pyx_v_evaluation) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("apply", 0);
  __pyx_cur_scope = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply *)__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply(__pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1175, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_evaluation = __pyx_v_evaluation;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_evaluation);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_evaluation);

  /* "mathics/builtin/numeric.py":1178
 *         "NumericQ[expr_]"
 * 
 *         def test(expr):             # <<<<<<<<<<<<<<
 *             if isinstance(expr, Expression):
 *                 attr = evaluation.definitions.get_attributes(expr.head.get_name())
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_8NumericQ_5apply_1test, 0, __pyx_n_s_NumericQ_apply_locals_test, ((PyObject*)__pyx_cur_scope), __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__30)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_test = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":1187
 *                 return expr.is_numeric()
 * 
 *         return SymbolTrue if test(expr) else SymbolFalse             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_pf_7mathics_7builtin_7numeric_8NumericQ_5apply_test(__pyx_cur_scope->__pyx_v_test, __pyx_v_expr); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1187, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_SymbolTrue); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1187, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
    __pyx_t_2 = 0;
  } else {
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_SymbolFalse); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1187, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
    __pyx_t_2 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/builtin/numeric.py":1175
 *     """
 * 
 *     def apply(self, expr, evaluation):             # <<<<<<<<<<<<<<
 *         "NumericQ[expr_]"
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("mathics.builtin.numeric.NumericQ.apply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1259
 *     }
 * 
 *     def apply_len(self, n, base, length, evaluation):             # <<<<<<<<<<<<<<
 *         "IntegerDigits[n_, base_, length_]"
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_13IntegerDigits_1apply_len(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_7builtin_7numeric_13IntegerDigits_apply_len[] = "IntegerDigits[n_, base_, length_]";
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_13IntegerDigits_1apply_len = {"apply_len", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_13IntegerDigits_1apply_len, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_7builtin_7numeric_13IntegerDigits_apply_len};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_13IntegerDigits_1apply_len(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_n = 0;
  PyObject *__pyx_v_base = 0;
  PyObject *__pyx_v_length = 0;
  PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("apply_len (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_n,&__pyx_n_s_base,&__pyx_n_s_length,&__pyx_n_s_evaluation,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_len", 1, 5, 5, 1); __PYX_ERR(0, 1259, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_base)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_len", 1, 5, 5, 2); __PYX_ERR(0, 1259, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_length)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_len", 1, 5, 5, 3); __PYX_ERR(0, 1259, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_len", 1, 5, 5, 4); __PYX_ERR(0, 1259, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply_len") < 0)) __PYX_ERR(0, 1259, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
    }
    __pyx_v_self = values[0];
    __pyx_v_n = values[1];
    __pyx_v_base = values[2];
    __pyx_v_length = values[3];
    __pyx_v_evaluation = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("apply_len", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1259, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.IntegerDigits.apply_len", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_13IntegerDigits_apply_len(__pyx_self, __pyx_v_self, __pyx_v_n, __pyx_v_base, __pyx_v_length, __pyx_v_evaluation);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_13IntegerDigits_apply_len(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_n, PyObject *__pyx_v_base, PyObject *__pyx_v_length, PyObject *__pyx_v_evaluation) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("apply_len", 0);

  /* "mathics/builtin/numeric.py":1262
 *         "IntegerDigits[n_, base_, length_]"
 * 
 *         if not (isinstance(length, Integer) and length.get_int_value() >= 0):             # <<<<<<<<<<<<<<
 *             return evaluation.message("IntegerDigits", "intnn")
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Integer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_IsInstance(__pyx_v_length, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 1262, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_1 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_length, __pyx_n_s_get_int_value); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_GE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1262, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1262, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_1 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  __pyx_t_4 = ((!__pyx_t_1) != 0);
  if (__pyx_t_4) {

    /* "mathics/builtin/numeric.py":1263
 * 
 *         if not (isinstance(length, Integer) and length.get_int_value() >= 0):
 *             return evaluation.message("IntegerDigits", "intnn")             # <<<<<<<<<<<<<<
 * 
 *         return self.apply(n, base, evaluation, nr_elements=length.get_int_value())
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_message); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1263, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1263, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "mathics/builtin/numeric.py":1262
 *         "IntegerDigits[n_, base_, length_]"
 * 
 *         if not (isinstance(length, Integer) and length.get_int_value() >= 0):             # <<<<<<<<<<<<<<
 *             return evaluation.message("IntegerDigits", "intnn")
 * 
 */
  }

  /* "mathics/builtin/numeric.py":1265
 *             return evaluation.message("IntegerDigits", "intnn")
 * 
 *         return self.apply(n, base, evaluation, nr_elements=length.get_int_value())             # <<<<<<<<<<<<<<
 * 
 *     def apply(self, n, base, evaluation, nr_elements=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apply); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_n);
  __Pyx_GIVEREF(__pyx_v_n);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_n);
  __Pyx_INCREF(__pyx_v_base);
  __Pyx_GIVEREF(__pyx_v_base);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_base);
  __Pyx_INCREF(__pyx_v_evaluation);
  __Pyx_GIVEREF(__pyx_v_evaluation);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_evaluation);
  __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_length, __pyx_n_s_get_int_value); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  __pyx_t_7 = (__pyx_t_9) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9) : __Pyx_PyObject_CallNoArg(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_nr_elements, __pyx_t_7) < 0) __PYX_ERR(0, 1265, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "mathics/builtin/numeric.py":1259
 *     }
 * 
 *     def apply_len(self, n, base, length, evaluation):             # <<<<<<<<<<<<<<
 *         "IntegerDigits[n_, base_, length_]"
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("mathics.builtin.numeric.IntegerDigits.apply_len", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1267
 *         return self.apply(n, base, evaluation, nr_elements=length.get_int_value())
 * 
 *     def apply(self, n, base, evaluation, nr_elements=None):             # <<<<<<<<<<<<<<
 *         "IntegerDigits[n_, base_]"
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_13IntegerDigits_3apply(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_7builtin_7numeric_13IntegerDigits_2apply[] = "IntegerDigits[n_, base_]";
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_13IntegerDigits_3apply = {"apply", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_13IntegerDigits_3apply, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_7builtin_7numeric_13IntegerDigits_2apply};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_13IntegerDigits_3apply(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_n = 0;
  PyObject *__pyx_v_base = 0;
  PyObject *__pyx_v_evaluation = 0;
  PyObject *__pyx_v_nr_elements = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("apply (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_n,&__pyx_n_s_base,&__pyx_n_s_evaluation,&__pyx_n_s_nr_elements,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[4] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply", 0, 4, 5, 1); __PYX_ERR(0, 1267, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_base)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply", 0, 4, 5, 2); __PYX_ERR(0, 1267, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply", 0, 4, 5, 3); __PYX_ERR(0, 1267, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nr_elements);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply") < 0)) __PYX_ERR(0, 1267, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_n = values[1];
    __pyx_v_base = values[2];
    __pyx_v_evaluation = values[3];
    __pyx_v_nr_elements = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("apply", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1267, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.IntegerDigits.apply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_13IntegerDigits_2apply(__pyx_self, __pyx_v_self, __pyx_v_n, __pyx_v_base, __pyx_v_evaluation, __pyx_v_nr_elements);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_13IntegerDigits_2apply(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_n, PyObject *__pyx_v_base, PyObject *__pyx_v_evaluation, PyObject *__pyx_v_nr_elements) {
  PyObject *__pyx_v_digits = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("apply", 0);

  /* "mathics/builtin/numeric.py":1270
 *         "IntegerDigits[n_, base_]"
 * 
 *         if not (isinstance(n, Integer)):             # <<<<<<<<<<<<<<
 *             return evaluation.message(
 *                 "IntegerDigits", "int", Expression("IntegerDigits", n, base)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Integer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_n, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 1270, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = ((!(__pyx_t_2 != 0)) != 0);
  if (__pyx_t_3) {

    /* "mathics/builtin/numeric.py":1271
 * 
 *         if not (isinstance(n, Integer)):
 *             return evaluation.message(             # <<<<<<<<<<<<<<
 *                 "IntegerDigits", "int", Expression("IntegerDigits", n, base)
 *             )
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_message); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1271, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "mathics/builtin/numeric.py":1272
 *         if not (isinstance(n, Integer)):
 *             return evaluation.message(
 *                 "IntegerDigits", "int", Expression("IntegerDigits", n, base)             # <<<<<<<<<<<<<<
 *             )
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_Expression); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1272, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_n_u_IntegerDigits, __pyx_v_n, __pyx_v_base};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1272, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_n_u_IntegerDigits, __pyx_v_n, __pyx_v_base};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1272, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1272, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_INCREF(__pyx_n_u_IntegerDigits);
      __Pyx_GIVEREF(__pyx_n_u_IntegerDigits);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_n_u_IntegerDigits);
      __Pyx_INCREF(__pyx_v_n);
      __Pyx_GIVEREF(__pyx_v_n);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_n);
      __Pyx_INCREF(__pyx_v_base);
      __Pyx_GIVEREF(__pyx_v_base);
      PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_v_base);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1272, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_n_u_IntegerDigits, __pyx_n_u_int, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1271, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_n_u_IntegerDigits, __pyx_n_u_int, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1271, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1271, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_6) {
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_INCREF(__pyx_n_u_IntegerDigits);
      __Pyx_GIVEREF(__pyx_n_u_IntegerDigits);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_n_u_IntegerDigits);
      __Pyx_INCREF(__pyx_n_u_int);
      __Pyx_GIVEREF(__pyx_n_u_int);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_n_u_int);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1271, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "mathics/builtin/numeric.py":1270
 *         "IntegerDigits[n_, base_]"
 * 
 *         if not (isinstance(n, Integer)):             # <<<<<<<<<<<<<<
 *             return evaluation.message(
 *                 "IntegerDigits", "int", Expression("IntegerDigits", n, base)
 */
  }

  /* "mathics/builtin/numeric.py":1275
 *             )
 * 
 *         if not (isinstance(base, Integer) and base.get_int_value() > 1):             # <<<<<<<<<<<<<<
 *             return evaluation.message("IntegerDigits", "ibase", base)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Integer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_base, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 1275, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_10 = (__pyx_t_2 != 0);
  if (__pyx_t_10) {
  } else {
    __pyx_t_3 = __pyx_t_10;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_base, __pyx_n_s_get_int_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_9 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_9) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1275, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1275, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_3 = __pyx_t_10;
  __pyx_L5_bool_binop_done:;
  __pyx_t_10 = ((!__pyx_t_3) != 0);
  if (__pyx_t_10) {

    /* "mathics/builtin/numeric.py":1276
 * 
 *         if not (isinstance(base, Integer) and base.get_int_value() > 1):
 *             return evaluation.message("IntegerDigits", "ibase", base)             # <<<<<<<<<<<<<<
 * 
 *         if nr_elements == 0:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_message); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1276, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[4] = {__pyx_t_9, __pyx_n_u_IntegerDigits, __pyx_n_u_ibase, __pyx_v_base};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1276, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[4] = {__pyx_t_9, __pyx_n_u_IntegerDigits, __pyx_n_u_ibase, __pyx_v_base};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1276, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1276, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (__pyx_t_9) {
        __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_9); __pyx_t_9 = NULL;
      }
      __Pyx_INCREF(__pyx_n_u_IntegerDigits);
      __Pyx_GIVEREF(__pyx_n_u_IntegerDigits);
      PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_8, __pyx_n_u_IntegerDigits);
      __Pyx_INCREF(__pyx_n_u_ibase);
      __Pyx_GIVEREF(__pyx_n_u_ibase);
      PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_8, __pyx_n_u_ibase);
      __Pyx_INCREF(__pyx_v_base);
      __Pyx_GIVEREF(__pyx_v_base);
      PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_8, __pyx_v_base);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1276, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "mathics/builtin/numeric.py":1275
 *             )
 * 
 *         if not (isinstance(base, Integer) and base.get_int_value() > 1):             # <<<<<<<<<<<<<<
 *             return evaluation.message("IntegerDigits", "ibase", base)
 * 
 */
  }

  /* "mathics/builtin/numeric.py":1278
 *             return evaluation.message("IntegerDigits", "ibase", base)
 * 
 *         if nr_elements == 0:             # <<<<<<<<<<<<<<
 *             # trivial case: we don't want any digits
 *             return Expression(SymbolList)
 */
  __pyx_t_4 = __Pyx_PyInt_EqObjC(__pyx_v_nr_elements, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1278, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1278, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_10) {

    /* "mathics/builtin/numeric.py":1280
 *         if nr_elements == 0:
 *             # trivial case: we don't want any digits
 *             return Expression(SymbolList)             # <<<<<<<<<<<<<<
 * 
 *         digits = convert_int_to_digit_list(n.get_int_value(), base.get_int_value())
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Expression); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1280, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_SymbolList); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1280, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_4 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_9, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1280, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "mathics/builtin/numeric.py":1278
 *             return evaluation.message("IntegerDigits", "ibase", base)
 * 
 *         if nr_elements == 0:             # <<<<<<<<<<<<<<
 *             # trivial case: we don't want any digits
 *             return Expression(SymbolList)
 */
  }

  /* "mathics/builtin/numeric.py":1282
 *             return Expression(SymbolList)
 * 
 *         digits = convert_int_to_digit_list(n.get_int_value(), base.get_int_value())             # <<<<<<<<<<<<<<
 * 
 *         if nr_elements is not None:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_convert_int_to_digit_list); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_n, __pyx_n_s_get_int_value); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_9);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_9, function);
    }
  }
  __pyx_t_5 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_base, __pyx_n_s_get_int_value); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_9 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_5, __pyx_t_9};
    __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1282, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_5, __pyx_t_9};
    __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1282, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1282, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_t_9);
    __pyx_t_5 = 0;
    __pyx_t_9 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1282, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_digits = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "mathics/builtin/numeric.py":1284
 *         digits = convert_int_to_digit_list(n.get_int_value(), base.get_int_value())
 * 
 *         if nr_elements is not None:             # <<<<<<<<<<<<<<
 *             if len(digits) >= nr_elements:
 *                 # Truncate, preserving the digits on the right
 */
  __pyx_t_10 = (__pyx_v_nr_elements != Py_None);
  __pyx_t_3 = (__pyx_t_10 != 0);
  if (__pyx_t_3) {

    /* "mathics/builtin/numeric.py":1285
 * 
 *         if nr_elements is not None:
 *             if len(digits) >= nr_elements:             # <<<<<<<<<<<<<<
 *                 # Truncate, preserving the digits on the right
 *                 digits = digits[-nr_elements:]
 */
    __pyx_t_11 = PyObject_Length(__pyx_v_digits); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1285, __pyx_L1_error)
    __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_v_nr_elements, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1285, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1285, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_3) {

      /* "mathics/builtin/numeric.py":1287
 *             if len(digits) >= nr_elements:
 *                 # Truncate, preserving the digits on the right
 *                 digits = digits[-nr_elements:]             # <<<<<<<<<<<<<<
 *             else:
 *                 # Pad with zeroes
 */
      __pyx_t_1 = PyNumber_Negative(__pyx_v_nr_elements); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1287, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_v_digits, 0, 0, &__pyx_t_1, NULL, NULL, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1287, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF_SET(__pyx_v_digits, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "mathics/builtin/numeric.py":1285
 * 
 *         if nr_elements is not None:
 *             if len(digits) >= nr_elements:             # <<<<<<<<<<<<<<
 *                 # Truncate, preserving the digits on the right
 *                 digits = digits[-nr_elements:]
 */
      goto __pyx_L9;
    }

    /* "mathics/builtin/numeric.py":1290
 *             else:
 *                 # Pad with zeroes
 *                 digits = [0] * (nr_elements - len(digits)) + digits             # <<<<<<<<<<<<<<
 * 
 *         return Expression(SymbolList, *digits)
 */
    /*else*/ {
      __pyx_t_11 = PyObject_Length(__pyx_v_digits); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1290, __pyx_L1_error)
      __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1290, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = PyNumber_Subtract(__pyx_v_nr_elements, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1290, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1290, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_4, 0, __pyx_int_0);
      { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_temp)) __PYX_ERR(0, 1290, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_temp);
        __Pyx_DECREF(__pyx_t_4);
        __pyx_t_4 = __pyx_temp;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyNumber_Add(__pyx_t_4, __pyx_v_digits); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1290, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF_SET(__pyx_v_digits, __pyx_t_1);
      __pyx_t_1 = 0;
    }
    __pyx_L9:;

    /* "mathics/builtin/numeric.py":1284
 *         digits = convert_int_to_digit_list(n.get_int_value(), base.get_int_value())
 * 
 *         if nr_elements is not None:             # <<<<<<<<<<<<<<
 *             if len(digits) >= nr_elements:
 *                 # Truncate, preserving the digits on the right
 */
  }

  /* "mathics/builtin/numeric.py":1292
 *                 digits = [0] * (nr_elements - len(digits)) + digits
 * 
 *         return Expression(SymbolList, *digits)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Expression); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_SymbolList); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_digits); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_9 = PyNumber_Add(__pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "mathics/builtin/numeric.py":1267
 *         return self.apply(n, base, evaluation, nr_elements=length.get_int_value())
 * 
 *     def apply(self, n, base, evaluation, nr_elements=None):             # <<<<<<<<<<<<<<
 *         "IntegerDigits[n_, base_]"
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("mathics.builtin.numeric.IntegerDigits.apply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_digits);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1295
 * 
 * 
 * def check_finite_decimal(denominator):             # <<<<<<<<<<<<<<
 *     # The rational number is finite decimal if the denominator has form 2^a * 5^b
 *     while denominator % 5 == 0:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_11check_finite_decimal(PyObject *__pyx_self, PyObject *__pyx_v_denominator); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_11check_finite_decimal = {"check_finite_decimal", (PyCFunction)__pyx_pw_7mathics_7builtin_7numeric_11check_finite_decimal, METH_O, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_11check_finite_decimal(PyObject *__pyx_self, PyObject *__pyx_v_denominator) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("check_finite_decimal (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_10check_finite_decimal(__pyx_self, ((PyObject *)__pyx_v_denominator));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_10check_finite_decimal(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_denominator) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("check_finite_decimal", 0);
  __Pyx_INCREF(__pyx_v_denominator);

  /* "mathics/builtin/numeric.py":1297
 * def check_finite_decimal(denominator):
 *     # The rational number is finite decimal if the denominator has form 2^a * 5^b
 *     while denominator % 5 == 0:             # <<<<<<<<<<<<<<
 *         denominator = denominator / 5
 * 
 */
  while (1) {
    __pyx_t_1 = __Pyx_PyInt_RemainderObjC(__pyx_v_denominator, __pyx_int_5, 5, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1297, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_t_1, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1297, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1297, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!__pyx_t_3) break;

    /* "mathics/builtin/numeric.py":1298
 *     # The rational number is finite decimal if the denominator has form 2^a * 5^b
 *     while denominator % 5 == 0:
 *         denominator = denominator / 5             # <<<<<<<<<<<<<<
 * 
 *     while denominator % 2 == 0:
 */
    __pyx_t_2 = __Pyx_PyInt_TrueDivideObjC(__pyx_v_denominator, __pyx_int_5, 5, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1298, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_denominator, __pyx_t_2);
    __pyx_t_2 = 0;
  }

  /* "mathics/builtin/numeric.py":1300
 *         denominator = denominator / 5
 * 
 *     while denominator % 2 == 0:             # <<<<<<<<<<<<<<
 *         denominator = denominator / 2
 * 
 */
  while (1) {
    __pyx_t_2 = __Pyx_PyInt_RemainderObjC(__pyx_v_denominator, __pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1300, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_t_2, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1300, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1300, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!__pyx_t_3) break;

    /* "mathics/builtin/numeric.py":1301
 * 
 *     while denominator % 2 == 0:
 *         denominator = denominator / 2             # <<<<<<<<<<<<<<
 * 
 *     return True if denominator == 1 else False
 */
    __pyx_t_1 = __Pyx_PyInt_TrueDivideObjC(__pyx_v_denominator, __pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1301, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_denominator, __pyx_t_1);
    __pyx_t_1 = 0;
  }

  /* "mathics/builtin/numeric.py":1303
 *         denominator = denominator / 2
 * 
 *     return True if denominator == 1 else False             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_v_denominator, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1303, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {
    __Pyx_INCREF(Py_True);
    __pyx_t_1 = Py_True;
  } else {
    __Pyx_INCREF(Py_False);
    __pyx_t_1 = Py_False;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/builtin/numeric.py":1295
 * 
 * 
 * def check_finite_decimal(denominator):             # <<<<<<<<<<<<<<
 *     # The rational number is finite decimal if the denominator has form 2^a * 5^b
 *     while denominator % 5 == 0:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("mathics.builtin.numeric.check_finite_decimal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_denominator);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1306
 * 
 * 
 * def convert_repeating_decimal(numerator, denominator, base):             # <<<<<<<<<<<<<<
 *     head = [x for x in str(numerator // denominator)]
 *     tails = []
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_13convert_repeating_decimal(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_13convert_repeating_decimal = {"convert_repeating_decimal", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_13convert_repeating_decimal, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_13convert_repeating_decimal(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_numerator = 0;
  PyObject *__pyx_v_denominator = 0;
  PyObject *__pyx_v_base = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("convert_repeating_decimal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_numerator,&__pyx_n_s_denominator,&__pyx_n_s_base,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_numerator)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_denominator)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convert_repeating_decimal", 1, 3, 3, 1); __PYX_ERR(0, 1306, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_base)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convert_repeating_decimal", 1, 3, 3, 2); __PYX_ERR(0, 1306, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "convert_repeating_decimal") < 0)) __PYX_ERR(0, 1306, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_numerator = values[0];
    __pyx_v_denominator = values[1];
    __pyx_v_base = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("convert_repeating_decimal", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1306, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.convert_repeating_decimal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_12convert_repeating_decimal(__pyx_self, __pyx_v_numerator, __pyx_v_denominator, __pyx_v_base);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7mathics_7builtin_7numeric_25convert_repeating_decimal_2generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "mathics/builtin/numeric.py":1332
 * 
 *     # truncate all leading 0's
 *     if all(elem == "0" for elem in head):             # <<<<<<<<<<<<<<
 *         for i in range(0, len(tails)):
 *             if tails[0] == "0":
 */

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_25convert_repeating_decimal_genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr *)__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr(__pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1332, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7mathics_7builtin_7numeric_25convert_repeating_decimal_2generator2, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_convert_repeating_decimal_locals, __pyx_n_s_mathics_builtin_numeric); if (unlikely(!gen)) __PYX_ERR(0, 1332, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.convert_repeating_decimal.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_7mathics_7builtin_7numeric_25convert_repeating_decimal_2generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1332, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_head)) { __Pyx_RaiseClosureNameError("head"); __PYX_ERR(0, 1332, __pyx_L1_error) }
  if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_head == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 1332, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_head; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 1332, __pyx_L1_error)
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1332, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_elem);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_elem, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_cur_scope->__pyx_v_elem, __pyx_kp_u_0, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1332, __pyx_L1_error)
    __pyx_t_5 = ((!__pyx_t_4) != 0);
    if (__pyx_t_5) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_False);
      __pyx_r = Py_False;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
  }
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1306
 * 
 * 
 * def convert_repeating_decimal(numerator, denominator, base):             # <<<<<<<<<<<<<<
 *     head = [x for x in str(numerator // denominator)]
 *     tails = []
 */

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_12convert_repeating_decimal(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_numerator, PyObject *__pyx_v_denominator, PyObject *__pyx_v_base) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal *__pyx_cur_scope;
  PyObject *__pyx_v_tails = NULL;
  PyObject *__pyx_v_subresults = NULL;
  PyObject *__pyx_v_result_digit = NULL;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_v_j = NULL;
  PyObject *__pyx_9genexpr11__pyx_v_x = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  void *__pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *(*__pyx_t_12)(PyObject *);
  int __pyx_t_13;
  int __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("convert_repeating_decimal", 0);
  __pyx_cur_scope = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal *)__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal(__pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1306, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __Pyx_INCREF(__pyx_v_numerator);

  /* "mathics/builtin/numeric.py":1307
 * 
 * def convert_repeating_decimal(numerator, denominator, base):
 *     head = [x for x in str(numerator // denominator)]             # <<<<<<<<<<<<<<
 *     tails = []
 *     subresults = [numerator % denominator]
 */
  { /* enter inner scope */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1307, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyNumber_FloorDivide(__pyx_v_numerator, __pyx_v_denominator); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1307, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1307, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = __Pyx_init_unicode_iteration(__pyx_t_3, (&__pyx_t_5), (&__pyx_t_6), (&__pyx_t_7)); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 1307, __pyx_L5_error)
    for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_5; __pyx_t_9++) {
      __pyx_t_4 = __pyx_t_9;
      __pyx_t_2 = PyUnicode_FromOrdinal(__Pyx_PyUnicode_READ(__pyx_t_7, __pyx_t_6, __pyx_t_4)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1307, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_XDECREF_SET(__pyx_9genexpr11__pyx_v_x, __pyx_t_2);
      __pyx_t_2 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_9genexpr11__pyx_v_x))) __PYX_ERR(0, 1307, __pyx_L5_error)
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_x); __pyx_9genexpr11__pyx_v_x = 0;
    goto __pyx_L8_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_x); __pyx_9genexpr11__pyx_v_x = 0;
    goto __pyx_L1_error;
    __pyx_L8_exit_scope:;
  } /* exit inner scope */
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_head = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":1308
 * def convert_repeating_decimal(numerator, denominator, base):
 *     head = [x for x in str(numerator // denominator)]
 *     tails = []             # <<<<<<<<<<<<<<
 *     subresults = [numerator % denominator]
 *     numerator %= denominator
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_tails = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":1309
 *     head = [x for x in str(numerator // denominator)]
 *     tails = []
 *     subresults = [numerator % denominator]             # <<<<<<<<<<<<<<
 *     numerator %= denominator
 * 
 */
  __pyx_t_1 = PyNumber_Remainder(__pyx_v_numerator, __pyx_v_denominator); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_v_subresults = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "mathics/builtin/numeric.py":1310
 *     tails = []
 *     subresults = [numerator % denominator]
 *     numerator %= denominator             # <<<<<<<<<<<<<<
 * 
 *     while numerator != 0:  # only rational input can go to this case
 */
  __pyx_t_3 = PyNumber_InPlaceRemainder(__pyx_v_numerator, __pyx_v_denominator); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF_SET(__pyx_v_numerator, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "mathics/builtin/numeric.py":1312
 *     numerator %= denominator
 * 
 *     while numerator != 0:  # only rational input can go to this case             # <<<<<<<<<<<<<<
 *         numerator *= base
 *         result_digit, numerator = divmod(numerator, denominator)
 */
  while (1) {
    __pyx_t_3 = __Pyx_PyInt_NeObjC(__pyx_v_numerator, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1312, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1312, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!__pyx_t_10) break;

    /* "mathics/builtin/numeric.py":1313
 * 
 *     while numerator != 0:  # only rational input can go to this case
 *         numerator *= base             # <<<<<<<<<<<<<<
 *         result_digit, numerator = divmod(numerator, denominator)
 *         tails.append(str(result_digit))
 */
    __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_v_numerator, __pyx_v_base); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1313, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_numerator, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "mathics/builtin/numeric.py":1314
 *     while numerator != 0:  # only rational input can go to this case
 *         numerator *= base
 *         result_digit, numerator = divmod(numerator, denominator)             # <<<<<<<<<<<<<<
 *         tails.append(str(result_digit))
 *         if numerator not in subresults:
 */
    __pyx_t_3 = PyNumber_Divmod(__pyx_v_numerator, __pyx_v_denominator); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1314, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
      PyObject* sequence = __pyx_t_3;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1314, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      #else
      __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1314, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1314, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_11 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1314, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext;
      index = 0; __pyx_t_1 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_1)) goto __pyx_L11_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      index = 1; __pyx_t_2 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_2)) goto __pyx_L11_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_2);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < 0) __PYX_ERR(0, 1314, __pyx_L1_error)
      __pyx_t_12 = NULL;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      goto __pyx_L12_unpacking_done;
      __pyx_L11_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_12 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1314, __pyx_L1_error)
      __pyx_L12_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_result_digit, __pyx_t_1);
    __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_numerator, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "mathics/builtin/numeric.py":1315
 *         numerator *= base
 *         result_digit, numerator = divmod(numerator, denominator)
 *         tails.append(str(result_digit))             # <<<<<<<<<<<<<<
 *         if numerator not in subresults:
 *             subresults.append(numerator)
 */
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_result_digit); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1315, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_tails, __pyx_t_3); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 1315, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "mathics/builtin/numeric.py":1316
 *         result_digit, numerator = divmod(numerator, denominator)
 *         tails.append(str(result_digit))
 *         if numerator not in subresults:             # <<<<<<<<<<<<<<
 *             subresults.append(numerator)
 *         else:
 */
    __pyx_t_10 = (__Pyx_PySequence_ContainsTF(__pyx_v_numerator, __pyx_v_subresults, Py_NE)); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1316, __pyx_L1_error)
    __pyx_t_14 = (__pyx_t_10 != 0);
    if (__pyx_t_14) {

      /* "mathics/builtin/numeric.py":1317
 *         tails.append(str(result_digit))
 *         if numerator not in subresults:
 *             subresults.append(numerator)             # <<<<<<<<<<<<<<
 *         else:
 *             break
 */
      __pyx_t_13 = __Pyx_PyList_Append(__pyx_v_subresults, __pyx_v_numerator); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 1317, __pyx_L1_error)

      /* "mathics/builtin/numeric.py":1316
 *         result_digit, numerator = divmod(numerator, denominator)
 *         tails.append(str(result_digit))
 *         if numerator not in subresults:             # <<<<<<<<<<<<<<
 *             subresults.append(numerator)
 *         else:
 */
      goto __pyx_L13;
    }

    /* "mathics/builtin/numeric.py":1319
 *             subresults.append(numerator)
 *         else:
 *             break             # <<<<<<<<<<<<<<
 * 
 *     for i in range(len(head) - 1, -1, -1):
 */
    /*else*/ {
      goto __pyx_L10_break;
    }
    __pyx_L13:;
  }
  __pyx_L10_break:;

  /* "mathics/builtin/numeric.py":1321
 *             break
 * 
 *     for i in range(len(head) - 1, -1, -1):             # <<<<<<<<<<<<<<
 *         j = len(tails) - 1
 *         if head[i] != tails[j]:
 */
  __pyx_t_3 = __pyx_cur_scope->__pyx_v_head;
  __Pyx_INCREF(__pyx_t_3);
  if (unlikely(__pyx_t_3 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 1321, __pyx_L1_error)
  }
  __pyx_t_5 = PyList_GET_SIZE(__pyx_t_3); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1321, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (__pyx_t_4 = (__pyx_t_5 - 1); __pyx_t_4 > -1L; __pyx_t_4-=1) {
    __pyx_v_i = __pyx_t_4;

    /* "mathics/builtin/numeric.py":1322
 * 
 *     for i in range(len(head) - 1, -1, -1):
 *         j = len(tails) - 1             # <<<<<<<<<<<<<<
 *         if head[i] != tails[j]:
 *             break
 */
    __pyx_t_9 = PyList_GET_SIZE(__pyx_v_tails); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1322, __pyx_L1_error)
    __pyx_t_3 = PyInt_FromSsize_t((__pyx_t_9 - 1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1322, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "mathics/builtin/numeric.py":1323
 *     for i in range(len(head) - 1, -1, -1):
 *         j = len(tails) - 1
 *         if head[i] != tails[j]:             # <<<<<<<<<<<<<<
 *             break
 *         else:
 */
    __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_cur_scope->__pyx_v_head, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1323, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_tails, __pyx_v_j); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1323, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1323, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 1323, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_14) {

      /* "mathics/builtin/numeric.py":1324
 *         j = len(tails) - 1
 *         if head[i] != tails[j]:
 *             break             # <<<<<<<<<<<<<<
 *         else:
 *             del tails[j]
 */
      goto __pyx_L15_break;

      /* "mathics/builtin/numeric.py":1323
 *     for i in range(len(head) - 1, -1, -1):
 *         j = len(tails) - 1
 *         if head[i] != tails[j]:             # <<<<<<<<<<<<<<
 *             break
 *         else:
 */
    }

    /* "mathics/builtin/numeric.py":1326
 *             break
 *         else:
 *             del tails[j]             # <<<<<<<<<<<<<<
 *             tails.insert(0, head[i])
 *             del head[i]
 */
    /*else*/ {
      if (unlikely(PyObject_DelItem(__pyx_v_tails, __pyx_v_j) < 0)) __PYX_ERR(0, 1326, __pyx_L1_error)

      /* "mathics/builtin/numeric.py":1327
 *         else:
 *             del tails[j]
 *             tails.insert(0, head[i])             # <<<<<<<<<<<<<<
 *             del head[i]
 *             j = j - 1
 */
      __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_cur_scope->__pyx_v_head, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1327, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_13 = PyList_Insert(__pyx_v_tails, 0, __pyx_t_1); if (unlikely(__pyx_t_13 == ((int)-1))) __PYX_ERR(0, 1327, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "mathics/builtin/numeric.py":1328
 *             del tails[j]
 *             tails.insert(0, head[i])
 *             del head[i]             # <<<<<<<<<<<<<<
 *             j = j - 1
 * 
 */
      if (unlikely(__Pyx_DelItemInt(__pyx_cur_scope->__pyx_v_head, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 1, 1, 1) < 0)) __PYX_ERR(0, 1328, __pyx_L1_error)

      /* "mathics/builtin/numeric.py":1329
 *             tails.insert(0, head[i])
 *             del head[i]
 *             j = j - 1             # <<<<<<<<<<<<<<
 * 
 *     # truncate all leading 0's
 */
      __pyx_t_1 = __Pyx_PyInt_SubtractObjC(__pyx_v_j, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1329, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF_SET(__pyx_v_j, __pyx_t_1);
      __pyx_t_1 = 0;
    }
  }
  __pyx_L15_break:;

  /* "mathics/builtin/numeric.py":1332
 * 
 *     # truncate all leading 0's
 *     if all(elem == "0" for elem in head):             # <<<<<<<<<<<<<<
 *         for i in range(0, len(tails)):
 *             if tails[0] == "0":
 */
  __pyx_t_1 = __pyx_pf_7mathics_7builtin_7numeric_25convert_repeating_decimal_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1332, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_Generator_Next(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1332, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 1332, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_14) {

    /* "mathics/builtin/numeric.py":1333
 *     # truncate all leading 0's
 *     if all(elem == "0" for elem in head):
 *         for i in range(0, len(tails)):             # <<<<<<<<<<<<<<
 *             if tails[0] == "0":
 *                 tails = tails[1:] + [str(0)]
 */
    __pyx_t_5 = PyList_GET_SIZE(__pyx_v_tails); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1333, __pyx_L1_error)
    __pyx_t_4 = __pyx_t_5;
    for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_4; __pyx_t_9+=1) {
      __pyx_v_i = __pyx_t_9;

      /* "mathics/builtin/numeric.py":1334
 *     if all(elem == "0" for elem in head):
 *         for i in range(0, len(tails)):
 *             if tails[0] == "0":             # <<<<<<<<<<<<<<
 *                 tails = tails[1:] + [str(0)]
 *             else:
 */
      __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_tails, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1334, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_14 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_kp_u_0, Py_EQ)); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 1334, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_14) {

        /* "mathics/builtin/numeric.py":1335
 *         for i in range(0, len(tails)):
 *             if tails[0] == "0":
 *                 tails = tails[1:] + [str(0)]             # <<<<<<<<<<<<<<
 *             else:
 *                 break
 */
        __pyx_t_2 = __Pyx_PyList_GetSlice(__pyx_v_tails, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1335, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&PyUnicode_Type)), __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1335, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1335, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_1);
        PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
        __pyx_t_1 = 0;
        __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1335, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF_SET(__pyx_v_tails, ((PyObject*)__pyx_t_1));
        __pyx_t_1 = 0;

        /* "mathics/builtin/numeric.py":1334
 *     if all(elem == "0" for elem in head):
 *         for i in range(0, len(tails)):
 *             if tails[0] == "0":             # <<<<<<<<<<<<<<
 *                 tails = tails[1:] + [str(0)]
 *             else:
 */
        goto __pyx_L20;
      }

      /* "mathics/builtin/numeric.py":1337
 *                 tails = tails[1:] + [str(0)]
 *             else:
 *                 break             # <<<<<<<<<<<<<<
 *     return (head, tails)
 * 
 */
      /*else*/ {
        goto __pyx_L19_break;
      }
      __pyx_L20:;
    }
    __pyx_L19_break:;

    /* "mathics/builtin/numeric.py":1332
 * 
 *     # truncate all leading 0's
 *     if all(elem == "0" for elem in head):             # <<<<<<<<<<<<<<
 *         for i in range(0, len(tails)):
 *             if tails[0] == "0":
 */
  }

  /* "mathics/builtin/numeric.py":1338
 *             else:
 *                 break
 *     return (head, tails)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1338, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_head);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_head);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_v_head);
  __Pyx_INCREF(__pyx_v_tails);
  __Pyx_GIVEREF(__pyx_v_tails);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_tails);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/builtin/numeric.py":1306
 * 
 * 
 * def convert_repeating_decimal(numerator, denominator, base):             # <<<<<<<<<<<<<<
 *     head = [x for x in str(numerator // denominator)]
 *     tails = []
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("mathics.builtin.numeric.convert_repeating_decimal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tails);
  __Pyx_XDECREF(__pyx_v_subresults);
  __Pyx_XDECREF(__pyx_v_result_digit);
  __Pyx_XDECREF(__pyx_v_j);
  __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_numerator);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1341
 * 
 * 
 * def convert_float_base(x, base, precision=10):             # <<<<<<<<<<<<<<
 * 
 *     length_of_int = 0 if x == 0 else int(mpmath.log(x, base))
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_15convert_float_base(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_15convert_float_base = {"convert_float_base", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_15convert_float_base, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_15convert_float_base(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_base = 0;
  PyObject *__pyx_v_precision = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("convert_float_base (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_base,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)((PyObject *)__pyx_int_10));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_base)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convert_float_base", 0, 2, 3, 1); __PYX_ERR(0, 1341, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "convert_float_base") < 0)) __PYX_ERR(0, 1341, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_base = values[1];
    __pyx_v_precision = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("convert_float_base", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1341, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.convert_float_base", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_14convert_float_base(__pyx_self, __pyx_v_x, __pyx_v_base, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1346
 *     # iexps = list(range(length_of_int, -1, -1))
 * 
 *     def convert_int(x, base, exponents):             # <<<<<<<<<<<<<<
 *         out = []
 *         for e in range(0, exponents + 1):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_18convert_float_base_1convert_int(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_18convert_float_base_1convert_int = {"convert_int", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_18convert_float_base_1convert_int, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_18convert_float_base_1convert_int(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_base = 0;
  PyObject *__pyx_v_exponents = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("convert_int (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_base,&__pyx_n_s_exponents,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_base)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convert_int", 1, 3, 3, 1); __PYX_ERR(0, 1346, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exponents)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convert_int", 1, 3, 3, 2); __PYX_ERR(0, 1346, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "convert_int") < 0)) __PYX_ERR(0, 1346, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_x = values[0];
    __pyx_v_base = values[1];
    __pyx_v_exponents = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("convert_int", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1346, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.convert_float_base.convert_int", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_18convert_float_base_convert_int(__pyx_self, __pyx_v_x, __pyx_v_base, __pyx_v_exponents);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_18convert_float_base_convert_int(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_base, PyObject *__pyx_v_exponents) {
  PyObject *__pyx_v_out = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_e = NULL;
  PyObject *__pyx_v_d = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("convert_int", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "mathics/builtin/numeric.py":1347
 * 
 *     def convert_int(x, base, exponents):
 *         out = []             # <<<<<<<<<<<<<<
 *         for e in range(0, exponents + 1):
 *             d = x % base
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1347, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_out = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":1348
 *     def convert_int(x, base, exponents):
 *         out = []
 *         for e in range(0, exponents + 1):             # <<<<<<<<<<<<<<
 *             d = x % base
 *             out.append(d)
 */
  __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_v_exponents, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1348, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1348, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1348, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1348, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1348, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1348, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1348, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_e, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "mathics/builtin/numeric.py":1349
 *         out = []
 *         for e in range(0, exponents + 1):
 *             d = x % base             # <<<<<<<<<<<<<<
 *             out.append(d)
 *             x = x / base
 */
    __pyx_t_1 = PyNumber_Remainder(__pyx_v_x, __pyx_v_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1349, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_d, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "mathics/builtin/numeric.py":1350
 *         for e in range(0, exponents + 1):
 *             d = x % base
 *             out.append(d)             # <<<<<<<<<<<<<<
 *             x = x / base
 *             if x == 0:
 */
    __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_out, __pyx_v_d); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 1350, __pyx_L1_error)

    /* "mathics/builtin/numeric.py":1351
 *             d = x % base
 *             out.append(d)
 *             x = x / base             # <<<<<<<<<<<<<<
 *             if x == 0:
 *                 break
 */
    __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_x, __pyx_v_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1351, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "mathics/builtin/numeric.py":1352
 *             out.append(d)
 *             x = x / base
 *             if x == 0:             # <<<<<<<<<<<<<<
 *                 break
 *         out.reverse()
 */
    __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_x, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1352, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1352, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_6) {

      /* "mathics/builtin/numeric.py":1353
 *             x = x / base
 *             if x == 0:
 *                 break             # <<<<<<<<<<<<<<
 *         out.reverse()
 *         return out
 */
      goto __pyx_L4_break;

      /* "mathics/builtin/numeric.py":1352
 *             out.append(d)
 *             x = x / base
 *             if x == 0:             # <<<<<<<<<<<<<<
 *                 break
 *         out.reverse()
 */
    }

    /* "mathics/builtin/numeric.py":1348
 *     def convert_int(x, base, exponents):
 *         out = []
 *         for e in range(0, exponents + 1):             # <<<<<<<<<<<<<<
 *             d = x % base
 *             out.append(d)
 */
  }
  __pyx_L4_break:;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":1354
 *             if x == 0:
 *                 break
 *         out.reverse()             # <<<<<<<<<<<<<<
 *         return out
 * 
 */
  __pyx_t_5 = PyList_Reverse(__pyx_v_out); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 1354, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1355
 *                 break
 *         out.reverse()
 *         return out             # <<<<<<<<<<<<<<
 * 
 *     def convert_float(x, base, exponents):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_out);
  __pyx_r = __pyx_v_out;
  goto __pyx_L0;

  /* "mathics/builtin/numeric.py":1346
 *     # iexps = list(range(length_of_int, -1, -1))
 * 
 *     def convert_int(x, base, exponents):             # <<<<<<<<<<<<<<
 *         out = []
 *         for e in range(0, exponents + 1):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("mathics.builtin.numeric.convert_float_base.convert_int", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_out);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1357
 *         return out
 * 
 *     def convert_float(x, base, exponents):             # <<<<<<<<<<<<<<
 *         out = []
 *         for e in range(0, exponents):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_18convert_float_base_3convert_float(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_18convert_float_base_3convert_float = {"convert_float", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_18convert_float_base_3convert_float, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_18convert_float_base_3convert_float(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_base = 0;
  PyObject *__pyx_v_exponents = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("convert_float (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_base,&__pyx_n_s_exponents,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_base)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convert_float", 1, 3, 3, 1); __PYX_ERR(0, 1357, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exponents)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("convert_float", 1, 3, 3, 2); __PYX_ERR(0, 1357, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "convert_float") < 0)) __PYX_ERR(0, 1357, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_x = values[0];
    __pyx_v_base = values[1];
    __pyx_v_exponents = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("convert_float", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1357, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.convert_float_base.convert_float", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_18convert_float_base_2convert_float(__pyx_self, __pyx_v_x, __pyx_v_base, __pyx_v_exponents);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_18convert_float_base_2convert_float(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_base, PyObject *__pyx_v_exponents) {
  PyObject *__pyx_v_out = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_e = NULL;
  PyObject *__pyx_v_d = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("convert_float", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "mathics/builtin/numeric.py":1358
 * 
 *     def convert_float(x, base, exponents):
 *         out = []             # <<<<<<<<<<<<<<
 *         for e in range(0, exponents):
 *             d = int(x * base)
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1358, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_out = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":1359
 *     def convert_float(x, base, exponents):
 *         out = []
 *         for e in range(0, exponents):             # <<<<<<<<<<<<<<
 *             d = int(x * base)
 *             out.append(d)
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1359, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_0);
  __Pyx_INCREF(__pyx_v_exponents);
  __Pyx_GIVEREF(__pyx_v_exponents);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_exponents);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1359, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1359, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1359, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1359, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1359, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1359, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1359, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_4(__pyx_t_1);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1359, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_XDECREF_SET(__pyx_v_e, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "mathics/builtin/numeric.py":1360
 *         out = []
 *         for e in range(0, exponents):
 *             d = int(x * base)             # <<<<<<<<<<<<<<
 *             out.append(d)
 *             x = (x * base) - d
 */
    __pyx_t_2 = PyNumber_Multiply(__pyx_v_x, __pyx_v_base); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1360, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyNumber_Int(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1360, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_d, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "mathics/builtin/numeric.py":1361
 *         for e in range(0, exponents):
 *             d = int(x * base)
 *             out.append(d)             # <<<<<<<<<<<<<<
 *             x = (x * base) - d
 *             if x == 0:
 */
    __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_out, __pyx_v_d); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 1361, __pyx_L1_error)

    /* "mathics/builtin/numeric.py":1362
 *             d = int(x * base)
 *             out.append(d)
 *             x = (x * base) - d             # <<<<<<<<<<<<<<
 *             if x == 0:
 *                 break
 */
    __pyx_t_5 = PyNumber_Multiply(__pyx_v_x, __pyx_v_base); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1362, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = PyNumber_Subtract(__pyx_t_5, __pyx_v_d); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1362, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "mathics/builtin/numeric.py":1363
 *             out.append(d)
 *             x = (x * base) - d
 *             if x == 0:             # <<<<<<<<<<<<<<
 *                 break
 *         return out
 */
    __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_v_x, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1363, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1363, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_7) {

      /* "mathics/builtin/numeric.py":1364
 *             x = (x * base) - d
 *             if x == 0:
 *                 break             # <<<<<<<<<<<<<<
 *         return out
 * 
 */
      goto __pyx_L4_break;

      /* "mathics/builtin/numeric.py":1363
 *             out.append(d)
 *             x = (x * base) - d
 *             if x == 0:             # <<<<<<<<<<<<<<
 *                 break
 *         return out
 */
    }

    /* "mathics/builtin/numeric.py":1359
 *     def convert_float(x, base, exponents):
 *         out = []
 *         for e in range(0, exponents):             # <<<<<<<<<<<<<<
 *             d = int(x * base)
 *             out.append(d)
 */
  }
  __pyx_L4_break:;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":1365
 *             if x == 0:
 *                 break
 *         return out             # <<<<<<<<<<<<<<
 * 
 *     int_part = convert_int(int(x), base, length_of_int)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_out);
  __pyx_r = __pyx_v_out;
  goto __pyx_L0;

  /* "mathics/builtin/numeric.py":1357
 *         return out
 * 
 *     def convert_float(x, base, exponents):             # <<<<<<<<<<<<<<
 *         out = []
 *         for e in range(0, exponents):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("mathics.builtin.numeric.convert_float_base.convert_float", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_out);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1341
 * 
 * 
 * def convert_float_base(x, base, precision=10):             # <<<<<<<<<<<<<<
 * 
 *     length_of_int = 0 if x == 0 else int(mpmath.log(x, base))
 */

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_14convert_float_base(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_base, PyObject *__pyx_v_precision) {
  PyObject *__pyx_v_length_of_int = NULL;
  PyObject *__pyx_v_convert_int = 0;
  PyObject *__pyx_v_convert_float = 0;
  PyObject *__pyx_v_int_part = NULL;
  PyObject *__pyx_v_real_part = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("convert_float_base", 0);

  /* "mathics/builtin/numeric.py":1343
 * def convert_float_base(x, base, precision=10):
 * 
 *     length_of_int = 0 if x == 0 else int(mpmath.log(x, base))             # <<<<<<<<<<<<<<
 *     # iexps = list(range(length_of_int, -1, -1))
 * 
 */
  __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_v_x, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1343, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {
    __Pyx_INCREF(__pyx_int_0);
    __pyx_t_1 = __pyx_int_0;
  } else {
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_mpmath); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_log); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_x, __pyx_v_base};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1343, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_x, __pyx_v_base};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1343, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1343, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_INCREF(__pyx_v_x);
      __Pyx_GIVEREF(__pyx_v_x);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_x);
      __Pyx_INCREF(__pyx_v_base);
      __Pyx_GIVEREF(__pyx_v_base);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_base);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1343, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyNumber_Int(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_1 = __pyx_t_5;
    __pyx_t_5 = 0;
  }
  __pyx_v_length_of_int = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":1346
 *     # iexps = list(range(length_of_int, -1, -1))
 * 
 *     def convert_int(x, base, exponents):             # <<<<<<<<<<<<<<
 *         out = []
 *         for e in range(0, exponents + 1):
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_18convert_float_base_1convert_int, 0, __pyx_n_s_convert_float_base_locals_conver, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__33)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1346, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_convert_int = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":1357
 *         return out
 * 
 *     def convert_float(x, base, exponents):             # <<<<<<<<<<<<<<
 *         out = []
 *         for e in range(0, exponents):
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_18convert_float_base_3convert_float, 0, __pyx_n_s_convert_float_base_locals_conver_2, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__35)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1357, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_convert_float = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":1367
 *         return out
 * 
 *     int_part = convert_int(int(x), base, length_of_int)             # <<<<<<<<<<<<<<
 *     if isinstance(x, (float, sympy.Float)):
 *         # fexps = list(range(-1, -int(precision + 1), -1))
 */
  __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_v_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1367, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __pyx_pf_7mathics_7builtin_7numeric_18convert_float_base_convert_int(__pyx_v_convert_int, __pyx_t_1, __pyx_v_base, __pyx_v_length_of_int); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1367, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_int_part = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "mathics/builtin/numeric.py":1368
 * 
 *     int_part = convert_int(int(x), base, length_of_int)
 *     if isinstance(x, (float, sympy.Float)):             # <<<<<<<<<<<<<<
 *         # fexps = list(range(-1, -int(precision + 1), -1))
 *         real_part = convert_float(x - int(x), base, precision + 1)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_sympy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1368, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_Float); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1368, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_8 = PyFloat_Check(__pyx_v_x); 
  __pyx_t_9 = (__pyx_t_8 != 0);
  if (!__pyx_t_9) {
  } else {
    __pyx_t_3 = __pyx_t_9;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_9 = PyObject_IsInstance(__pyx_v_x, __pyx_t_1); 
  __pyx_t_8 = (__pyx_t_9 != 0);
  __pyx_t_3 = __pyx_t_8;
  __pyx_L4_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_8 = (__pyx_t_3 != 0);
  if (__pyx_t_8) {

    /* "mathics/builtin/numeric.py":1370
 *     if isinstance(x, (float, sympy.Float)):
 *         # fexps = list(range(-1, -int(precision + 1), -1))
 *         real_part = convert_float(x - int(x), base, precision + 1)             # <<<<<<<<<<<<<<
 *         return int_part + real_part
 *     elif isinstance(x, int):
 */
    __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_v_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1370, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PyNumber_Subtract(__pyx_v_x, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1370, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_v_precision, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1370, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __pyx_pf_7mathics_7builtin_7numeric_18convert_float_base_2convert_float(__pyx_v_convert_float, __pyx_t_5, __pyx_v_base, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1370, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_real_part = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "mathics/builtin/numeric.py":1371
 *         # fexps = list(range(-1, -int(precision + 1), -1))
 *         real_part = convert_float(x - int(x), base, precision + 1)
 *         return int_part + real_part             # <<<<<<<<<<<<<<
 *     elif isinstance(x, int):
 *         return int_part
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyNumber_Add(__pyx_v_int_part, __pyx_v_real_part); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1371, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "mathics/builtin/numeric.py":1368
 * 
 *     int_part = convert_int(int(x), base, length_of_int)
 *     if isinstance(x, (float, sympy.Float)):             # <<<<<<<<<<<<<<
 *         # fexps = list(range(-1, -int(precision + 1), -1))
 *         real_part = convert_float(x - int(x), base, precision + 1)
 */
  }

  /* "mathics/builtin/numeric.py":1372
 *         real_part = convert_float(x - int(x), base, precision + 1)
 *         return int_part + real_part
 *     elif isinstance(x, int):             # <<<<<<<<<<<<<<
 *         return int_part
 *     else:
 */
  __pyx_t_8 = PyInt_Check(__pyx_v_x); 
  __pyx_t_3 = (__pyx_t_8 != 0);
  if (likely(__pyx_t_3)) {

    /* "mathics/builtin/numeric.py":1373
 *         return int_part + real_part
 *     elif isinstance(x, int):
 *         return int_part             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError(x)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_int_part);
    __pyx_r = __pyx_v_int_part;
    goto __pyx_L0;

    /* "mathics/builtin/numeric.py":1372
 *         real_part = convert_float(x - int(x), base, precision + 1)
 *         return int_part + real_part
 *     elif isinstance(x, int):             # <<<<<<<<<<<<<<
 *         return int_part
 *     else:
 */
  }

  /* "mathics/builtin/numeric.py":1375
 *         return int_part
 *     else:
 *         raise TypeError(x)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_v_x); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1375, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 1375, __pyx_L1_error)
  }

  /* "mathics/builtin/numeric.py":1341
 * 
 * 
 * def convert_float_base(x, base, precision=10):             # <<<<<<<<<<<<<<
 * 
 *     length_of_int = 0 if x == 0 else int(mpmath.log(x, base))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("mathics.builtin.numeric.convert_float_base", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_length_of_int);
  __Pyx_XDECREF(__pyx_v_convert_int);
  __Pyx_XDECREF(__pyx_v_convert_float);
  __Pyx_XDECREF(__pyx_v_int_part);
  __Pyx_XDECREF(__pyx_v_real_part);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1459
 *     }
 * 
 *     def apply_complex(self, n, var, evaluation):             # <<<<<<<<<<<<<<
 *         "%(name)s[n_Complex, var___]"
 *         return evaluation.message("RealDigits", "realx", n)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_10RealDigits_1apply_complex(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_7builtin_7numeric_10RealDigits_apply_complex[] = "%(name)s[n_Complex, var___]";
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_10RealDigits_1apply_complex = {"apply_complex", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_10RealDigits_1apply_complex, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_7builtin_7numeric_10RealDigits_apply_complex};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_10RealDigits_1apply_complex(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_n = 0;
  CYTHON_UNUSED PyObject *__pyx_v_var = 0;
  PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("apply_complex (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_n,&__pyx_n_s_var,&__pyx_n_s_evaluation,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_complex", 1, 4, 4, 1); __PYX_ERR(0, 1459, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_var)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_complex", 1, 4, 4, 2); __PYX_ERR(0, 1459, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_complex", 1, 4, 4, 3); __PYX_ERR(0, 1459, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply_complex") < 0)) __PYX_ERR(0, 1459, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_self = values[0];
    __pyx_v_n = values[1];
    __pyx_v_var = values[2];
    __pyx_v_evaluation = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("apply_complex", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1459, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.RealDigits.apply_complex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_10RealDigits_apply_complex(__pyx_self, __pyx_v_self, __pyx_v_n, __pyx_v_var, __pyx_v_evaluation);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_10RealDigits_apply_complex(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_n, CYTHON_UNUSED PyObject *__pyx_v_var, PyObject *__pyx_v_evaluation) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("apply_complex", 0);

  /* "mathics/builtin/numeric.py":1461
 *     def apply_complex(self, n, var, evaluation):
 *         "%(name)s[n_Complex, var___]"
 *         return evaluation.message("RealDigits", "realx", n)             # <<<<<<<<<<<<<<
 * 
 *     def apply_rational_with_base(self, n, b, evaluation):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_message); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1461, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_n_u_RealDigits, __pyx_n_u_realx, __pyx_v_n};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1461, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_n_u_RealDigits, __pyx_n_u_realx, __pyx_v_n};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1461, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1461, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_n_u_RealDigits);
    __Pyx_GIVEREF(__pyx_n_u_RealDigits);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_n_u_RealDigits);
    __Pyx_INCREF(__pyx_n_u_realx);
    __Pyx_GIVEREF(__pyx_n_u_realx);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_n_u_realx);
    __Pyx_INCREF(__pyx_v_n);
    __Pyx_GIVEREF(__pyx_v_n);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_n);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1461, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/builtin/numeric.py":1459
 *     }
 * 
 *     def apply_complex(self, n, var, evaluation):             # <<<<<<<<<<<<<<
 *         "%(name)s[n_Complex, var___]"
 *         return evaluation.message("RealDigits", "realx", n)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("mathics.builtin.numeric.RealDigits.apply_complex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1463
 *         return evaluation.message("RealDigits", "realx", n)
 * 
 *     def apply_rational_with_base(self, n, b, evaluation):             # <<<<<<<<<<<<<<
 *         "%(name)s[n_Rational, b_Integer]"
 *         # expr = Expression("RealDigits", n)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_10RealDigits_3apply_rational_with_base(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_7builtin_7numeric_10RealDigits_2apply_rational_with_base[] = "%(name)s[n_Rational, b_Integer]";
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_10RealDigits_3apply_rational_with_base = {"apply_rational_with_base", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_10RealDigits_3apply_rational_with_base, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_7builtin_7numeric_10RealDigits_2apply_rational_with_base};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_10RealDigits_3apply_rational_with_base(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_n = 0;
  PyObject *__pyx_v_b = 0;
  PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("apply_rational_with_base (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_n,&__pyx_n_s_b,&__pyx_n_s_evaluation,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_rational_with_base", 1, 4, 4, 1); __PYX_ERR(0, 1463, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_rational_with_base", 1, 4, 4, 2); __PYX_ERR(0, 1463, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_rational_with_base", 1, 4, 4, 3); __PYX_ERR(0, 1463, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply_rational_with_base") < 0)) __PYX_ERR(0, 1463, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_self = values[0];
    __pyx_v_n = values[1];
    __pyx_v_b = values[2];
    __pyx_v_evaluation = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("apply_rational_with_base", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1463, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.RealDigits.apply_rational_with_base", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_10RealDigits_2apply_rational_with_base(__pyx_self, __pyx_v_self, __pyx_v_n, __pyx_v_b, __pyx_v_evaluation);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_10RealDigits_2apply_rational_with_base(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_n, PyObject *__pyx_v_b, PyObject *__pyx_v_evaluation) {
  PyObject *__pyx_v_py_n = NULL;
  PyObject *__pyx_v_py_b = NULL;
  PyObject *__pyx_v_exp = NULL;
  PyObject *__pyx_v_head = NULL;
  PyObject *__pyx_v_tails = NULL;
  PyObject *__pyx_v_leaves = NULL;
  PyObject *__pyx_v_x = NULL;
  PyObject *__pyx_v_list_str = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  PyObject *(*__pyx_t_11)(PyObject *);
  Py_ssize_t __pyx_t_12;
  PyObject *(*__pyx_t_13)(PyObject *);
  int __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("apply_rational_with_base", 0);

  /* "mathics/builtin/numeric.py":1466
 *         "%(name)s[n_Rational, b_Integer]"
 *         # expr = Expression("RealDigits", n)
 *         py_n = abs(n.value)             # <<<<<<<<<<<<<<
 *         py_b = b.get_int_value()
 *         if check_finite_decimal(n.denominator().get_int_value()) and not py_b % 2:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_n, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyNumber_Absolute(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_py_n = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":1467
 *         # expr = Expression("RealDigits", n)
 *         py_n = abs(n.value)
 *         py_b = b.get_int_value()             # <<<<<<<<<<<<<<
 *         if check_finite_decimal(n.denominator().get_int_value()) and not py_b % 2:
 *             return self.apply_with_base(n, b, evaluation)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_b, __pyx_n_s_get_int_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1467, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1467, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_py_b = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":1468
 *         py_n = abs(n.value)
 *         py_b = b.get_int_value()
 *         if check_finite_decimal(n.denominator().get_int_value()) and not py_b % 2:             # <<<<<<<<<<<<<<
 *             return self.apply_with_base(n, b, evaluation)
 *         else:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_check_finite_decimal); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1468, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_n, __pyx_n_s_denominator); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1468, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1468, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_get_int_value); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1468, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1468, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1468, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1468, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_8) {
  } else {
    __pyx_t_4 = __pyx_t_8;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_PyInt_RemainderObjC(__pyx_v_py_b, __pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1468, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1468, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_9 = ((!__pyx_t_8) != 0);
  __pyx_t_4 = __pyx_t_9;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_4) {

    /* "mathics/builtin/numeric.py":1469
 *         py_b = b.get_int_value()
 *         if check_finite_decimal(n.denominator().get_int_value()) and not py_b % 2:
 *             return self.apply_with_base(n, b, evaluation)             # <<<<<<<<<<<<<<
 *         else:
 *             exp = int(mpmath.ceil(mpmath.log(py_n, py_b)))
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apply_with_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1469, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = NULL;
    __pyx_t_10 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_10 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_n, __pyx_v_b, __pyx_v_evaluation};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1469, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_n, __pyx_v_b, __pyx_v_evaluation};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1469, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(3+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1469, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_3) {
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL;
      }
      __Pyx_INCREF(__pyx_v_n);
      __Pyx_GIVEREF(__pyx_v_n);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_10, __pyx_v_n);
      __Pyx_INCREF(__pyx_v_b);
      __Pyx_GIVEREF(__pyx_v_b);
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_10, __pyx_v_b);
      __Pyx_INCREF(__pyx_v_evaluation);
      __Pyx_GIVEREF(__pyx_v_evaluation);
      PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_10, __pyx_v_evaluation);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1469, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "mathics/builtin/numeric.py":1468
 *         py_n = abs(n.value)
 *         py_b = b.get_int_value()
 *         if check_finite_decimal(n.denominator().get_int_value()) and not py_b % 2:             # <<<<<<<<<<<<<<
 *             return self.apply_with_base(n, b, evaluation)
 *         else:
 */
  }

  /* "mathics/builtin/numeric.py":1471
 *             return self.apply_with_base(n, b, evaluation)
 *         else:
 *             exp = int(mpmath.ceil(mpmath.log(py_n, py_b)))             # <<<<<<<<<<<<<<
 *             (head, tails) = convert_repeating_decimal(
 *                 py_n.as_numer_denom()[0], py_n.as_numer_denom()[1], py_b
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_mpmath); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1471, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ceil); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1471, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_mpmath); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1471, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_log); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1471, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    __pyx_t_10 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_10 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_py_n, __pyx_v_py_b};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1471, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_py_n, __pyx_v_py_b};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1471, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1471, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_3) {
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __pyx_t_3 = NULL;
      }
      __Pyx_INCREF(__pyx_v_py_n);
      __Pyx_GIVEREF(__pyx_v_py_n);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_10, __pyx_v_py_n);
      __Pyx_INCREF(__pyx_v_py_b);
      __Pyx_GIVEREF(__pyx_v_py_b);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_10, __pyx_v_py_b);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1471, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_5, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_1);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1471, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyNumber_Int(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1471, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_exp = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "mathics/builtin/numeric.py":1472
 *         else:
 *             exp = int(mpmath.ceil(mpmath.log(py_n, py_b)))
 *             (head, tails) = convert_repeating_decimal(             # <<<<<<<<<<<<<<
 *                 py_n.as_numer_denom()[0], py_n.as_numer_denom()[1], py_b
 *             )
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_convert_repeating_decimal); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1472, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "mathics/builtin/numeric.py":1473
 *             exp = int(mpmath.ceil(mpmath.log(py_n, py_b)))
 *             (head, tails) = convert_repeating_decimal(
 *                 py_n.as_numer_denom()[0], py_n.as_numer_denom()[1], py_b             # <<<<<<<<<<<<<<
 *             )
 * 
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_py_n, __pyx_n_s_as_numer_denom); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1473, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1473, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1473, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_py_n, __pyx_n_s_as_numer_denom); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1473, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1473, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1473, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = NULL;
    __pyx_t_10 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_10 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[4] = {__pyx_t_1, __pyx_t_5, __pyx_t_7, __pyx_v_py_b};
      __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1472, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[4] = {__pyx_t_1, __pyx_t_5, __pyx_t_7, __pyx_v_py_b};
      __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1472, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(3+__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1472, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (__pyx_t_1) {
        __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __pyx_t_1 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_10, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_10, __pyx_t_7);
      __Pyx_INCREF(__pyx_v_py_b);
      __Pyx_GIVEREF(__pyx_v_py_b);
      PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_10, __pyx_v_py_b);
      __pyx_t_5 = 0;
      __pyx_t_7 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1472, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
      PyObject* sequence = __pyx_t_6;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1472, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      #else
      __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1472, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1472, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      #endif
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1472, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_11 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_2 = __pyx_t_11(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_2);
      index = 1; __pyx_t_3 = __pyx_t_11(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_7), 2) < 0) __PYX_ERR(0, 1472, __pyx_L1_error)
      __pyx_t_11 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_11 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1472, __pyx_L1_error)
      __pyx_L7_unpacking_done:;
    }

    /* "mathics/builtin/numeric.py":1472
 *         else:
 *             exp = int(mpmath.ceil(mpmath.log(py_n, py_b)))
 *             (head, tails) = convert_repeating_decimal(             # <<<<<<<<<<<<<<
 *                 py_n.as_numer_denom()[0], py_n.as_numer_denom()[1], py_b
 *             )
 */
    __pyx_v_head = __pyx_t_2;
    __pyx_t_2 = 0;
    __pyx_v_tails = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "mathics/builtin/numeric.py":1476
 *             )
 * 
 *             leaves = []             # <<<<<<<<<<<<<<
 *             for x in head:
 *                 if not x == "0":
 */
    __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1476, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_v_leaves = ((PyObject*)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "mathics/builtin/numeric.py":1477
 * 
 *             leaves = []
 *             for x in head:             # <<<<<<<<<<<<<<
 *                 if not x == "0":
 *                     leaves.append(from_python(int(x)))
 */
    if (likely(PyList_CheckExact(__pyx_v_head)) || PyTuple_CheckExact(__pyx_v_head)) {
      __pyx_t_6 = __pyx_v_head; __Pyx_INCREF(__pyx_t_6); __pyx_t_12 = 0;
      __pyx_t_13 = NULL;
    } else {
      __pyx_t_12 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_head); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1477, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_13 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1477, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_13)) {
        if (likely(PyList_CheckExact(__pyx_t_6))) {
          if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_6)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_12); __Pyx_INCREF(__pyx_t_3); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1477, __pyx_L1_error)
          #else
          __pyx_t_3 = PySequence_ITEM(__pyx_t_6, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1477, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        } else {
          if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_12); __Pyx_INCREF(__pyx_t_3); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1477, __pyx_L1_error)
          #else
          __pyx_t_3 = PySequence_ITEM(__pyx_t_6, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1477, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        }
      } else {
        __pyx_t_3 = __pyx_t_13(__pyx_t_6);
        if (unlikely(!__pyx_t_3)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 1477, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_3);
      }
      __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "mathics/builtin/numeric.py":1478
 *             leaves = []
 *             for x in head:
 *                 if not x == "0":             # <<<<<<<<<<<<<<
 *                     leaves.append(from_python(int(x)))
 *             leaves.append(from_python(tails))
 */
      __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_v_x, __pyx_kp_u_0, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1478, __pyx_L1_error)
      __pyx_t_9 = ((!__pyx_t_4) != 0);
      if (__pyx_t_9) {

        /* "mathics/builtin/numeric.py":1479
 *             for x in head:
 *                 if not x == "0":
 *                     leaves.append(from_python(int(x)))             # <<<<<<<<<<<<<<
 *             leaves.append(from_python(tails))
 *             list_str = Expression(SymbolList, *leaves)
 */
        __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_from_python); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1479, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_7 = __Pyx_PyNumber_Int(__pyx_v_x); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1479, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_2, function);
          }
        }
        __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_7);
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1479, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_leaves, __pyx_t_3); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 1479, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "mathics/builtin/numeric.py":1478
 *             leaves = []
 *             for x in head:
 *                 if not x == "0":             # <<<<<<<<<<<<<<
 *                     leaves.append(from_python(int(x)))
 *             leaves.append(from_python(tails))
 */
      }

      /* "mathics/builtin/numeric.py":1477
 * 
 *             leaves = []
 *             for x in head:             # <<<<<<<<<<<<<<
 *                 if not x == "0":
 *                     leaves.append(from_python(int(x)))
 */
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "mathics/builtin/numeric.py":1480
 *                 if not x == "0":
 *                     leaves.append(from_python(int(x)))
 *             leaves.append(from_python(tails))             # <<<<<<<<<<<<<<
 *             list_str = Expression(SymbolList, *leaves)
 *         return Expression(SymbolList, list_str, exp)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_from_python); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1480, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_6 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_tails) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_tails);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1480, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_leaves, __pyx_t_6); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 1480, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "mathics/builtin/numeric.py":1481
 *                     leaves.append(from_python(int(x)))
 *             leaves.append(from_python(tails))
 *             list_str = Expression(SymbolList, *leaves)             # <<<<<<<<<<<<<<
 *         return Expression(SymbolList, list_str, exp)
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_Expression); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1481, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_SymbolList); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1481, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1481, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = PySequence_Tuple(__pyx_v_leaves); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1481, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = PyNumber_Add(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1481, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1481, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_list_str = __pyx_t_3;
    __pyx_t_3 = 0;
  }

  /* "mathics/builtin/numeric.py":1482
 *             leaves.append(from_python(tails))
 *             list_str = Expression(SymbolList, *leaves)
 *         return Expression(SymbolList, list_str, exp)             # <<<<<<<<<<<<<<
 * 
 *     def apply_rational_without_base(self, n, evaluation):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_Expression); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1482, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_SymbolList); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1482, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = NULL;
  __pyx_t_10 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
      __pyx_t_10 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_7)) {
    PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_t_6, __pyx_v_list_str, __pyx_v_exp};
    __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1482, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
    PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_t_6, __pyx_v_list_str, __pyx_v_exp};
    __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1482, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(3+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1482, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_10, __pyx_t_6);
    __Pyx_INCREF(__pyx_v_list_str);
    __Pyx_GIVEREF(__pyx_v_list_str);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_10, __pyx_v_list_str);
    __Pyx_INCREF(__pyx_v_exp);
    __Pyx_GIVEREF(__pyx_v_exp);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_10, __pyx_v_exp);
    __pyx_t_6 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1482, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "mathics/builtin/numeric.py":1463
 *         return evaluation.message("RealDigits", "realx", n)
 * 
 *     def apply_rational_with_base(self, n, b, evaluation):             # <<<<<<<<<<<<<<
 *         "%(name)s[n_Rational, b_Integer]"
 *         # expr = Expression("RealDigits", n)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("mathics.builtin.numeric.RealDigits.apply_rational_with_base", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_py_n);
  __Pyx_XDECREF(__pyx_v_py_b);
  __Pyx_XDECREF(__pyx_v_exp);
  __Pyx_XDECREF(__pyx_v_head);
  __Pyx_XDECREF(__pyx_v_tails);
  __Pyx_XDECREF(__pyx_v_leaves);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_list_str);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1484
 *         return Expression(SymbolList, list_str, exp)
 * 
 *     def apply_rational_without_base(self, n, evaluation):             # <<<<<<<<<<<<<<
 *         "%(name)s[n_Rational]"
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_10RealDigits_5apply_rational_without_base(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_7builtin_7numeric_10RealDigits_4apply_rational_without_base[] = "%(name)s[n_Rational]";
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_10RealDigits_5apply_rational_without_base = {"apply_rational_without_base", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_10RealDigits_5apply_rational_without_base, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_7builtin_7numeric_10RealDigits_4apply_rational_without_base};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_10RealDigits_5apply_rational_without_base(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_n = 0;
  PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("apply_rational_without_base (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_n,&__pyx_n_s_evaluation,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_rational_without_base", 1, 3, 3, 1); __PYX_ERR(0, 1484, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_rational_without_base", 1, 3, 3, 2); __PYX_ERR(0, 1484, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply_rational_without_base") < 0)) __PYX_ERR(0, 1484, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_n = values[1];
    __pyx_v_evaluation = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("apply_rational_without_base", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1484, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.RealDigits.apply_rational_without_base", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_10RealDigits_4apply_rational_without_base(__pyx_self, __pyx_v_self, __pyx_v_n, __pyx_v_evaluation);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_10RealDigits_4apply_rational_without_base(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_n, PyObject *__pyx_v_evaluation) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("apply_rational_without_base", 0);

  /* "mathics/builtin/numeric.py":1487
 *         "%(name)s[n_Rational]"
 * 
 *         return self.apply_rational_with_base(n, from_python(10), evaluation)             # <<<<<<<<<<<<<<
 * 
 *     def apply(self, n, evaluation):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apply_rational_with_base); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_from_python); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_int_10) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_int_10);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_n, __pyx_t_3, __pyx_v_evaluation};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1487, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_n, __pyx_t_3, __pyx_v_evaluation};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1487, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1487, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_v_n);
    __Pyx_GIVEREF(__pyx_v_n);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_v_n);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_t_3);
    __Pyx_INCREF(__pyx_v_evaluation);
    __Pyx_GIVEREF(__pyx_v_evaluation);
    PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_6, __pyx_v_evaluation);
    __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1487, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/builtin/numeric.py":1484
 *         return Expression(SymbolList, list_str, exp)
 * 
 *     def apply_rational_without_base(self, n, evaluation):             # <<<<<<<<<<<<<<
 *         "%(name)s[n_Rational]"
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("mathics.builtin.numeric.RealDigits.apply_rational_without_base", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1489
 *         return self.apply_rational_with_base(n, from_python(10), evaluation)
 * 
 *     def apply(self, n, evaluation):             # <<<<<<<<<<<<<<
 *         "%(name)s[n_]"
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_10RealDigits_7apply(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_7builtin_7numeric_10RealDigits_6apply[] = "%(name)s[n_]";
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_10RealDigits_7apply = {"apply", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_10RealDigits_7apply, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_7builtin_7numeric_10RealDigits_6apply};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_10RealDigits_7apply(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_n = 0;
  PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("apply (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_n,&__pyx_n_s_evaluation,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply", 1, 3, 3, 1); __PYX_ERR(0, 1489, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply", 1, 3, 3, 2); __PYX_ERR(0, 1489, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply") < 0)) __PYX_ERR(0, 1489, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_n = values[1];
    __pyx_v_evaluation = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("apply", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1489, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.RealDigits.apply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_10RealDigits_6apply(__pyx_self, __pyx_v_self, __pyx_v_n, __pyx_v_evaluation);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_10RealDigits_6apply(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_n, PyObject *__pyx_v_evaluation) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("apply", 0);

  /* "mathics/builtin/numeric.py":1493
 * 
 *         # Handling the testcases that throw the error message and return the ouput that doesn't include `base` argument
 *         if isinstance(n, Symbol) and n.name.startswith("System`"):             # <<<<<<<<<<<<<<
 *             return evaluation.message("RealDigits", "ndig", n)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1493, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_IsInstance(__pyx_v_n, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 1493, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_1 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_n, __pyx_n_s_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1493, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_startswith); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1493, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_5, __pyx_kp_u_System) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_kp_u_System);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1493, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1493, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "mathics/builtin/numeric.py":1494
 *         # Handling the testcases that throw the error message and return the ouput that doesn't include `base` argument
 *         if isinstance(n, Symbol) and n.name.startswith("System`"):
 *             return evaluation.message("RealDigits", "ndig", n)             # <<<<<<<<<<<<<<
 * 
 *         if n.is_numeric():
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_message); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1494, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_n_u_RealDigits, __pyx_n_u_ndig, __pyx_v_n};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1494, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_n_u_RealDigits, __pyx_n_u_ndig, __pyx_v_n};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1494, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1494, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(__pyx_n_u_RealDigits);
      __Pyx_GIVEREF(__pyx_n_u_RealDigits);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_n_u_RealDigits);
      __Pyx_INCREF(__pyx_n_u_ndig);
      __Pyx_GIVEREF(__pyx_n_u_ndig);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_n_u_ndig);
      __Pyx_INCREF(__pyx_v_n);
      __Pyx_GIVEREF(__pyx_v_n);
      PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_v_n);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1494, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "mathics/builtin/numeric.py":1493
 * 
 *         # Handling the testcases that throw the error message and return the ouput that doesn't include `base` argument
 *         if isinstance(n, Symbol) and n.name.startswith("System`"):             # <<<<<<<<<<<<<<
 *             return evaluation.message("RealDigits", "ndig", n)
 * 
 */
  }

  /* "mathics/builtin/numeric.py":1496
 *             return evaluation.message("RealDigits", "ndig", n)
 * 
 *         if n.is_numeric():             # <<<<<<<<<<<<<<
 *             return self.apply_with_base(n, from_python(10), evaluation)
 * 
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_n, __pyx_n_s_is_numeric); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_2 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1496, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "mathics/builtin/numeric.py":1497
 * 
 *         if n.is_numeric():
 *             return self.apply_with_base(n, from_python(10), evaluation)             # <<<<<<<<<<<<<<
 * 
 *     def apply_with_base(self, n, b, evaluation, nr_elements=None, pos=None):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apply_with_base); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1497, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_from_python); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1497, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_8 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_9, __pyx_int_10) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_int_10);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1497, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_v_n, __pyx_t_8, __pyx_v_evaluation};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1497, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_v_n, __pyx_t_8, __pyx_v_evaluation};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1497, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1497, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(__pyx_v_n);
      __Pyx_GIVEREF(__pyx_v_n);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_7, __pyx_v_n);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_7, __pyx_t_8);
      __Pyx_INCREF(__pyx_v_evaluation);
      __Pyx_GIVEREF(__pyx_v_evaluation);
      PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_7, __pyx_v_evaluation);
      __pyx_t_8 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1497, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "mathics/builtin/numeric.py":1496
 *             return evaluation.message("RealDigits", "ndig", n)
 * 
 *         if n.is_numeric():             # <<<<<<<<<<<<<<
 *             return self.apply_with_base(n, from_python(10), evaluation)
 * 
 */
  }

  /* "mathics/builtin/numeric.py":1489
 *         return self.apply_rational_with_base(n, from_python(10), evaluation)
 * 
 *     def apply(self, n, evaluation):             # <<<<<<<<<<<<<<
 *         "%(name)s[n_]"
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("mathics.builtin.numeric.RealDigits.apply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1499
 *             return self.apply_with_base(n, from_python(10), evaluation)
 * 
 *     def apply_with_base(self, n, b, evaluation, nr_elements=None, pos=None):             # <<<<<<<<<<<<<<
 *         "%(name)s[n_?NumericQ, b_Integer]"
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_10RealDigits_9apply_with_base(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_7builtin_7numeric_10RealDigits_8apply_with_base[] = "%(name)s[n_?NumericQ, b_Integer]";
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_10RealDigits_9apply_with_base = {"apply_with_base", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_10RealDigits_9apply_with_base, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_7builtin_7numeric_10RealDigits_8apply_with_base};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_10RealDigits_9apply_with_base(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_n = 0;
  PyObject *__pyx_v_b = 0;
  PyObject *__pyx_v_evaluation = 0;
  PyObject *__pyx_v_nr_elements = 0;
  PyObject *__pyx_v_pos = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("apply_with_base (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_n,&__pyx_n_s_b,&__pyx_n_s_evaluation,&__pyx_n_s_nr_elements,&__pyx_n_s_pos,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    values[4] = ((PyObject *)((PyObject *)Py_None));
    values[5] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_with_base", 0, 4, 6, 1); __PYX_ERR(0, 1499, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_with_base", 0, 4, 6, 2); __PYX_ERR(0, 1499, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_with_base", 0, 4, 6, 3); __PYX_ERR(0, 1499, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nr_elements);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pos);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply_with_base") < 0)) __PYX_ERR(0, 1499, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_n = values[1];
    __pyx_v_b = values[2];
    __pyx_v_evaluation = values[3];
    __pyx_v_nr_elements = values[4];
    __pyx_v_pos = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("apply_with_base", 0, 4, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1499, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.RealDigits.apply_with_base", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_10RealDigits_8apply_with_base(__pyx_self, __pyx_v_self, __pyx_v_n, __pyx_v_b, __pyx_v_evaluation, __pyx_v_nr_elements, __pyx_v_pos);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_10RealDigits_8apply_with_base(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_n, PyObject *__pyx_v_b, PyObject *__pyx_v_evaluation, PyObject *__pyx_v_nr_elements, PyObject *__pyx_v_pos) {
  PyObject *__pyx_v_expr = NULL;
  int __pyx_v_rational_no;
  PyObject *__pyx_v_py_b = NULL;
  PyObject *__pyx_v_pos_len = NULL;
  PyObject *__pyx_v_py_n = NULL;
  PyObject *__pyx_v_display_len = NULL;
  PyObject *__pyx_v_exp = NULL;
  PyObject *__pyx_v_digits = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_x = NULL;
  PyObject *__pyx_v_temp = NULL;
  PyObject *__pyx_v_move = NULL;
  PyObject *__pyx_v_leaves = NULL;
  PyObject *__pyx_v_list_str = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  void *__pyx_t_20;
  int __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  int __pyx_t_23;
  PyObject *(*__pyx_t_24)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("apply_with_base", 0);
  __Pyx_INCREF(__pyx_v_n);

  /* "mathics/builtin/numeric.py":1502
 *         "%(name)s[n_?NumericQ, b_Integer]"
 * 
 *         expr = Expression("RealDigits", n)             # <<<<<<<<<<<<<<
 *         rational_no = (
 *             True if isinstance(n, Rational) else False
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Expression); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1502, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_n_u_RealDigits, __pyx_v_n};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1502, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_n_u_RealDigits, __pyx_v_n};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1502, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1502, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_n_u_RealDigits);
    __Pyx_GIVEREF(__pyx_n_u_RealDigits);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_n_u_RealDigits);
    __Pyx_INCREF(__pyx_v_n);
    __Pyx_GIVEREF(__pyx_v_n);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_n);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1502, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_expr = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":1504
 *         expr = Expression("RealDigits", n)
 *         rational_no = (
 *             True if isinstance(n, Rational) else False             # <<<<<<<<<<<<<<
 *         )  # it is used for checking whether the input n is a rational or not
 *         py_b = b.get_int_value()
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Rational); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1504, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = PyObject_IsInstance(__pyx_v_n, __pyx_t_1); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 1504, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if ((__pyx_t_7 != 0)) {
    __pyx_t_6 = 1;
  } else {
    __pyx_t_6 = 0;
  }
  __pyx_v_rational_no = __pyx_t_6;

  /* "mathics/builtin/numeric.py":1506
 *             True if isinstance(n, Rational) else False
 *         )  # it is used for checking whether the input n is a rational or not
 *         py_b = b.get_int_value()             # <<<<<<<<<<<<<<
 *         if isinstance(n, (Expression, Symbol, Rational)):
 *             pos_len = abs(pos) + 1 if pos is not None and pos < 0 else 1
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_b, __pyx_n_s_get_int_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1506, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1506, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_py_b = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":1507
 *         )  # it is used for checking whether the input n is a rational or not
 *         py_b = b.get_int_value()
 *         if isinstance(n, (Expression, Symbol, Rational)):             # <<<<<<<<<<<<<<
 *             pos_len = abs(pos) + 1 if pos is not None and pos < 0 else 1
 *             if nr_elements is not None:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Expression); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1507, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1507, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_Rational); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1507, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = PyObject_IsInstance(__pyx_v_n, __pyx_t_1); 
  __pyx_t_8 = (__pyx_t_7 != 0);
  if (!__pyx_t_8) {
  } else {
    __pyx_t_6 = __pyx_t_8;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_8 = PyObject_IsInstance(__pyx_v_n, __pyx_t_2); 
  __pyx_t_7 = (__pyx_t_8 != 0);
  if (!__pyx_t_7) {
  } else {
    __pyx_t_6 = __pyx_t_7;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_7 = PyObject_IsInstance(__pyx_v_n, __pyx_t_5); 
  __pyx_t_8 = (__pyx_t_7 != 0);
  __pyx_t_6 = __pyx_t_8;
  __pyx_L4_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_8 = (__pyx_t_6 != 0);
  if (__pyx_t_8) {

    /* "mathics/builtin/numeric.py":1508
 *         py_b = b.get_int_value()
 *         if isinstance(n, (Expression, Symbol, Rational)):
 *             pos_len = abs(pos) + 1 if pos is not None and pos < 0 else 1             # <<<<<<<<<<<<<<
 *             if nr_elements is not None:
 *                 n = Expression(
 */
    __pyx_t_6 = (__pyx_v_pos != Py_None);
    __pyx_t_7 = (__pyx_t_6 != 0);
    if (__pyx_t_7) {
    } else {
      __pyx_t_8 = __pyx_t_7;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_pos, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1508, __pyx_L1_error)
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1508, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = __pyx_t_7;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_8) {
      __pyx_t_2 = __Pyx_PyNumber_Absolute(__pyx_v_pos); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1508, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1508, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_1 = __pyx_t_5;
      __pyx_t_5 = 0;
    } else {
      __Pyx_INCREF(__pyx_int_1);
      __pyx_t_1 = __pyx_int_1;
    }
    __pyx_v_pos_len = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "mathics/builtin/numeric.py":1509
 *         if isinstance(n, (Expression, Symbol, Rational)):
 *             pos_len = abs(pos) + 1 if pos is not None and pos < 0 else 1
 *             if nr_elements is not None:             # <<<<<<<<<<<<<<
 *                 n = Expression(
 *                     "N", n, int(mpmath.log(py_b ** (nr_elements + pos_len), 10)) + 1
 */
    __pyx_t_8 = (__pyx_v_nr_elements != Py_None);
    __pyx_t_7 = (__pyx_t_8 != 0);
    if (__pyx_t_7) {

      /* "mathics/builtin/numeric.py":1510
 *             pos_len = abs(pos) + 1 if pos is not None and pos < 0 else 1
 *             if nr_elements is not None:
 *                 n = Expression(             # <<<<<<<<<<<<<<
 *                     "N", n, int(mpmath.log(py_b ** (nr_elements + pos_len), 10)) + 1
 *                 ).evaluate(evaluation)
 */
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Expression); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1510, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);

      /* "mathics/builtin/numeric.py":1511
 *             if nr_elements is not None:
 *                 n = Expression(
 *                     "N", n, int(mpmath.log(py_b ** (nr_elements + pos_len), 10)) + 1             # <<<<<<<<<<<<<<
 *                 ).evaluate(evaluation)
 *             else:
 */
      __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_mpmath); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1511, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_log); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1511, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = PyNumber_Add(__pyx_v_nr_elements, __pyx_v_pos_len); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1511, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_11 = PyNumber_Power(__pyx_v_py_b, __pyx_t_9, Py_None); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1511, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = NULL;
      __pyx_t_4 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_10, function);
          __pyx_t_4 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_10)) {
        PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_11, __pyx_int_10};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1511, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
        PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_11, __pyx_int_10};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1511, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      } else
      #endif
      {
        __pyx_t_12 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1511, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        if (__pyx_t_9) {
          __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_9); __pyx_t_9 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_11);
        PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_4, __pyx_t_11);
        __Pyx_INCREF(__pyx_int_10);
        __Pyx_GIVEREF(__pyx_int_10);
        PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_4, __pyx_int_10);
        __pyx_t_11 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_12, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1511, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      }
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = __Pyx_PyNumber_Int(__pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1511, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_10, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1511, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = NULL;
      __pyx_t_4 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_10)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_10);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_4 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[4] = {__pyx_t_10, __pyx_n_u_N, __pyx_v_n, __pyx_t_3};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1510, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[4] = {__pyx_t_10, __pyx_n_u_N, __pyx_v_n, __pyx_t_3};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1510, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      {
        __pyx_t_12 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1510, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        if (__pyx_t_10) {
          __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10); __pyx_t_10 = NULL;
        }
        __Pyx_INCREF(__pyx_n_u_N);
        __Pyx_GIVEREF(__pyx_n_u_N);
        PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_4, __pyx_n_u_N);
        __Pyx_INCREF(__pyx_v_n);
        __Pyx_GIVEREF(__pyx_v_n);
        PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_4, __pyx_v_n);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_4, __pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_12, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1510, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "mathics/builtin/numeric.py":1512
 *                 n = Expression(
 *                     "N", n, int(mpmath.log(py_b ** (nr_elements + pos_len), 10)) + 1
 *                 ).evaluate(evaluation)             # <<<<<<<<<<<<<<
 *             else:
 *                 if rational_no:
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_evaluate); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1512, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_v_evaluation) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_evaluation);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1512, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "mathics/builtin/numeric.py":1509
 *         if isinstance(n, (Expression, Symbol, Rational)):
 *             pos_len = abs(pos) + 1 if pos is not None and pos < 0 else 1
 *             if nr_elements is not None:             # <<<<<<<<<<<<<<
 *                 n = Expression(
 *                     "N", n, int(mpmath.log(py_b ** (nr_elements + pos_len), 10)) + 1
 */
      goto __pyx_L9;
    }

    /* "mathics/builtin/numeric.py":1514
 *                 ).evaluate(evaluation)
 *             else:
 *                 if rational_no:             # <<<<<<<<<<<<<<
 *                     n = Expression(SymbolN, n).evaluate(evaluation)
 *                 else:
 */
    /*else*/ {
      __pyx_t_7 = (__pyx_v_rational_no != 0);
      if (__pyx_t_7) {

        /* "mathics/builtin/numeric.py":1515
 *             else:
 *                 if rational_no:
 *                     n = Expression(SymbolN, n).evaluate(evaluation)             # <<<<<<<<<<<<<<
 *                 else:
 *                     return evaluation.message("RealDigits", "ndig", expr)
 */
        __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_Expression); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1515, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_SymbolN); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1515, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_3 = NULL;
        __pyx_t_4 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_3)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_3);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
            __pyx_t_4 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_5)) {
          PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_12, __pyx_v_n};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1515, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
          PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_12, __pyx_v_n};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1515, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        } else
        #endif
        {
          __pyx_t_10 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1515, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          if (__pyx_t_3) {
            __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_3); __pyx_t_3 = NULL;
          }
          __Pyx_GIVEREF(__pyx_t_12);
          PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_4, __pyx_t_12);
          __Pyx_INCREF(__pyx_v_n);
          __Pyx_GIVEREF(__pyx_v_n);
          PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_4, __pyx_v_n);
          __pyx_t_12 = 0;
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1515, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        }
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_evaluate); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1515, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_2)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_2);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
          }
        }
        __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_2, __pyx_v_evaluation) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_evaluation);
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1515, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_1);
        __pyx_t_1 = 0;

        /* "mathics/builtin/numeric.py":1514
 *                 ).evaluate(evaluation)
 *             else:
 *                 if rational_no:             # <<<<<<<<<<<<<<
 *                     n = Expression(SymbolN, n).evaluate(evaluation)
 *                 else:
 */
        goto __pyx_L10;
      }

      /* "mathics/builtin/numeric.py":1517
 *                     n = Expression(SymbolN, n).evaluate(evaluation)
 *                 else:
 *                     return evaluation.message("RealDigits", "ndig", expr)             # <<<<<<<<<<<<<<
 *         py_n = abs(n.value)
 * 
 */
      /*else*/ {
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_message); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1517, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_2 = NULL;
        __pyx_t_4 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_2)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_2);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
            __pyx_t_4 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_5)) {
          PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_n_u_RealDigits, __pyx_n_u_ndig, __pyx_v_expr};
          __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1517, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_1);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
          PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_n_u_RealDigits, __pyx_n_u_ndig, __pyx_v_expr};
          __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1517, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_1);
        } else
        #endif
        {
          __pyx_t_10 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1517, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          if (__pyx_t_2) {
            __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2); __pyx_t_2 = NULL;
          }
          __Pyx_INCREF(__pyx_n_u_RealDigits);
          __Pyx_GIVEREF(__pyx_n_u_RealDigits);
          PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_4, __pyx_n_u_RealDigits);
          __Pyx_INCREF(__pyx_n_u_ndig);
          __Pyx_GIVEREF(__pyx_n_u_ndig);
          PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_4, __pyx_n_u_ndig);
          __Pyx_INCREF(__pyx_v_expr);
          __Pyx_GIVEREF(__pyx_v_expr);
          PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_4, __pyx_v_expr);
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1517, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        }
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_r = __pyx_t_1;
        __pyx_t_1 = 0;
        goto __pyx_L0;
      }
      __pyx_L10:;
    }
    __pyx_L9:;

    /* "mathics/builtin/numeric.py":1507
 *         )  # it is used for checking whether the input n is a rational or not
 *         py_b = b.get_int_value()
 *         if isinstance(n, (Expression, Symbol, Rational)):             # <<<<<<<<<<<<<<
 *             pos_len = abs(pos) + 1 if pos is not None and pos < 0 else 1
 *             if nr_elements is not None:
 */
  }

  /* "mathics/builtin/numeric.py":1518
 *                 else:
 *                     return evaluation.message("RealDigits", "ndig", expr)
 *         py_n = abs(n.value)             # <<<<<<<<<<<<<<
 * 
 *         if not py_b > 1:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_n, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1518, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyNumber_Absolute(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1518, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_py_n = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "mathics/builtin/numeric.py":1520
 *         py_n = abs(n.value)
 * 
 *         if not py_b > 1:             # <<<<<<<<<<<<<<
 *             return evaluation.message("RealDigits", "rbase", py_b)
 * 
 */
  __pyx_t_5 = PyObject_RichCompare(__pyx_v_py_b, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1520, __pyx_L1_error)
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1520, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_8 = ((!__pyx_t_7) != 0);
  if (__pyx_t_8) {

    /* "mathics/builtin/numeric.py":1521
 * 
 *         if not py_b > 1:
 *             return evaluation.message("RealDigits", "rbase", py_b)             # <<<<<<<<<<<<<<
 * 
 *         if isinstance(py_n, complex):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_message); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1521, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_10 = NULL;
    __pyx_t_4 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_4 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[4] = {__pyx_t_10, __pyx_n_u_RealDigits, __pyx_n_u_rbase, __pyx_v_py_b};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1521, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[4] = {__pyx_t_10, __pyx_n_u_RealDigits, __pyx_n_u_rbase, __pyx_v_py_b};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1521, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1521, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (__pyx_t_10) {
        __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_10); __pyx_t_10 = NULL;
      }
      __Pyx_INCREF(__pyx_n_u_RealDigits);
      __Pyx_GIVEREF(__pyx_n_u_RealDigits);
      PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_4, __pyx_n_u_RealDigits);
      __Pyx_INCREF(__pyx_n_u_rbase);
      __Pyx_GIVEREF(__pyx_n_u_rbase);
      PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_4, __pyx_n_u_rbase);
      __Pyx_INCREF(__pyx_v_py_b);
      __Pyx_GIVEREF(__pyx_v_py_b);
      PyTuple_SET_ITEM(__pyx_t_2, 2+__pyx_t_4, __pyx_v_py_b);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1521, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "mathics/builtin/numeric.py":1520
 *         py_n = abs(n.value)
 * 
 *         if not py_b > 1:             # <<<<<<<<<<<<<<
 *             return evaluation.message("RealDigits", "rbase", py_b)
 * 
 */
  }

  /* "mathics/builtin/numeric.py":1523
 *             return evaluation.message("RealDigits", "rbase", py_b)
 * 
 *         if isinstance(py_n, complex):             # <<<<<<<<<<<<<<
 *             return evaluation.message("RealDigits", "realx", expr)
 * 
 */
  __pyx_t_8 = PyComplex_Check(__pyx_v_py_n); 
  __pyx_t_7 = (__pyx_t_8 != 0);
  if (__pyx_t_7) {

    /* "mathics/builtin/numeric.py":1524
 * 
 *         if isinstance(py_n, complex):
 *             return evaluation.message("RealDigits", "realx", expr)             # <<<<<<<<<<<<<<
 * 
 *         if isinstance(n, Integer):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_message); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1524, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = NULL;
    __pyx_t_4 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_4 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_n_u_RealDigits, __pyx_n_u_realx, __pyx_v_expr};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1524, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_n_u_RealDigits, __pyx_n_u_realx, __pyx_v_expr};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1524, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    {
      __pyx_t_10 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1524, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (__pyx_t_2) {
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2); __pyx_t_2 = NULL;
      }
      __Pyx_INCREF(__pyx_n_u_RealDigits);
      __Pyx_GIVEREF(__pyx_n_u_RealDigits);
      PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_4, __pyx_n_u_RealDigits);
      __Pyx_INCREF(__pyx_n_u_realx);
      __Pyx_GIVEREF(__pyx_n_u_realx);
      PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_4, __pyx_n_u_realx);
      __Pyx_INCREF(__pyx_v_expr);
      __Pyx_GIVEREF(__pyx_v_expr);
      PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_4, __pyx_v_expr);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_10, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1524, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "mathics/builtin/numeric.py":1523
 *             return evaluation.message("RealDigits", "rbase", py_b)
 * 
 *         if isinstance(py_n, complex):             # <<<<<<<<<<<<<<
 *             return evaluation.message("RealDigits", "realx", expr)
 * 
 */
  }

  /* "mathics/builtin/numeric.py":1526
 *             return evaluation.message("RealDigits", "realx", expr)
 * 
 *         if isinstance(n, Integer):             # <<<<<<<<<<<<<<
 *             display_len = (
 *                 int(mpmath.floor(mpmath.log(py_n, py_b)))
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_Integer); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = PyObject_IsInstance(__pyx_v_n, __pyx_t_5); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 1526, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_8 = (__pyx_t_7 != 0);
  if (__pyx_t_8) {

    /* "mathics/builtin/numeric.py":1529
 *             display_len = (
 *                 int(mpmath.floor(mpmath.log(py_n, py_b)))
 *                 if py_n != 0 and py_n != 1             # <<<<<<<<<<<<<<
 *                 else 1
 *             )
 */
    __pyx_t_1 = __Pyx_PyInt_NeObjC(__pyx_v_py_n, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1529, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1529, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_7) {
    } else {
      __pyx_t_8 = __pyx_t_7;
      goto __pyx_L14_bool_binop_done;
    }
    __pyx_t_1 = __Pyx_PyInt_NeObjC(__pyx_v_py_n, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1529, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1529, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_8 = __pyx_t_7;
    __pyx_L14_bool_binop_done:;
    if (__pyx_t_8) {

      /* "mathics/builtin/numeric.py":1528
 *         if isinstance(n, Integer):
 *             display_len = (
 *                 int(mpmath.floor(mpmath.log(py_n, py_b)))             # <<<<<<<<<<<<<<
 *                 if py_n != 0 and py_n != 1
 *                 else 1
 */
      __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_mpmath); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1528, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_floor); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1528, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_mpmath); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1528, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1528, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = NULL;
      __pyx_t_4 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
          __pyx_t_4 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_v_py_n, __pyx_v_py_b};
        __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1528, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_GOTREF(__pyx_t_10);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_v_py_n, __pyx_v_py_b};
        __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1528, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_GOTREF(__pyx_t_10);
      } else
      #endif
      {
        __pyx_t_11 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1528, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        if (__pyx_t_12) {
          __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_12); __pyx_t_12 = NULL;
        }
        __Pyx_INCREF(__pyx_v_py_n);
        __Pyx_GIVEREF(__pyx_v_py_n);
        PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_4, __pyx_v_py_n);
        __Pyx_INCREF(__pyx_v_py_b);
        __Pyx_GIVEREF(__pyx_v_py_b);
        PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_4, __pyx_v_py_b);
        __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_11, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1528, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_10);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1528, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1528, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __pyx_t_2;
      __pyx_t_2 = 0;
    } else {
      __Pyx_INCREF(__pyx_int_1);
      __pyx_t_5 = __pyx_int_1;
    }
    __pyx_v_display_len = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "mathics/builtin/numeric.py":1526
 *             return evaluation.message("RealDigits", "realx", expr)
 * 
 *         if isinstance(n, Integer):             # <<<<<<<<<<<<<<
 *             display_len = (
 *                 int(mpmath.floor(mpmath.log(py_n, py_b)))
 */
    goto __pyx_L13;
  }

  /* "mathics/builtin/numeric.py":1533
 *             )
 *         else:
 *             display_len = int(             # <<<<<<<<<<<<<<
 *                 Expression(
 *                     "N",
 */
  /*else*/ {

    /* "mathics/builtin/numeric.py":1534
 *         else:
 *             display_len = int(
 *                 Expression(             # <<<<<<<<<<<<<<
 *                     "N",
 *                     Expression(
 */
    __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_Expression); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1534, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);

    /* "mathics/builtin/numeric.py":1536
 *                 Expression(
 *                     "N",
 *                     Expression(             # <<<<<<<<<<<<<<
 *                         "Round",
 *                         Expression(
 */
    __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_Expression); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1536, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);

    /* "mathics/builtin/numeric.py":1538
 *                     Expression(
 *                         "Round",
 *                         Expression(             # <<<<<<<<<<<<<<
 *                             "Divide",
 *                             Expression("Precision", py_n),
 */
    __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_Expression); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1538, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);

    /* "mathics/builtin/numeric.py":1540
 *                         Expression(
 *                             "Divide",
 *                             Expression("Precision", py_n),             # <<<<<<<<<<<<<<
 *                             Expression("Log", 10, py_b),
 *                         ),
 */
    __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_Expression); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1540, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_15 = NULL;
    __pyx_t_4 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
      __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14);
      if (likely(__pyx_t_15)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
        __Pyx_INCREF(__pyx_t_15);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_14, function);
        __pyx_t_4 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_14)) {
      PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_n_u_Precision, __pyx_v_py_n};
      __pyx_t_13 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1540, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_GOTREF(__pyx_t_13);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
      PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_n_u_Precision, __pyx_v_py_n};
      __pyx_t_13 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1540, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_GOTREF(__pyx_t_13);
    } else
    #endif
    {
      __pyx_t_16 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1540, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      if (__pyx_t_15) {
        __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_15); __pyx_t_15 = NULL;
      }
      __Pyx_INCREF(__pyx_n_u_Precision);
      __Pyx_GIVEREF(__pyx_n_u_Precision);
      PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_4, __pyx_n_u_Precision);
      __Pyx_INCREF(__pyx_v_py_n);
      __Pyx_GIVEREF(__pyx_v_py_n);
      PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_4, __pyx_v_py_n);
      __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_16, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1540, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    }
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

    /* "mathics/builtin/numeric.py":1541
 *                             "Divide",
 *                             Expression("Precision", py_n),
 *                             Expression("Log", 10, py_b),             # <<<<<<<<<<<<<<
 *                         ),
 *                     ),
 */
    __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_n_s_Expression); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1541, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __pyx_t_15 = NULL;
    __pyx_t_4 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) {
      __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_16);
      if (likely(__pyx_t_15)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
        __Pyx_INCREF(__pyx_t_15);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_16, function);
        __pyx_t_4 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_16)) {
      PyObject *__pyx_temp[4] = {__pyx_t_15, __pyx_n_u_Log, __pyx_int_10, __pyx_v_py_b};
      __pyx_t_14 = __Pyx_PyFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1541, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_GOTREF(__pyx_t_14);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_16)) {
      PyObject *__pyx_temp[4] = {__pyx_t_15, __pyx_n_u_Log, __pyx_int_10, __pyx_v_py_b};
      __pyx_t_14 = __Pyx_PyCFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1541, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_GOTREF(__pyx_t_14);
    } else
    #endif
    {
      __pyx_t_17 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1541, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      if (__pyx_t_15) {
        __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_15); __pyx_t_15 = NULL;
      }
      __Pyx_INCREF(__pyx_n_u_Log);
      __Pyx_GIVEREF(__pyx_n_u_Log);
      PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_4, __pyx_n_u_Log);
      __Pyx_INCREF(__pyx_int_10);
      __Pyx_GIVEREF(__pyx_int_10);
      PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_4, __pyx_int_10);
      __Pyx_INCREF(__pyx_v_py_b);
      __Pyx_GIVEREF(__pyx_v_py_b);
      PyTuple_SET_ITEM(__pyx_t_17, 2+__pyx_t_4, __pyx_v_py_b);
      __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_17, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1541, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    }
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __pyx_t_16 = NULL;
    __pyx_t_4 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_16)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_16);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
        __pyx_t_4 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_9)) {
      PyObject *__pyx_temp[4] = {__pyx_t_16, __pyx_n_u_Divide, __pyx_t_13, __pyx_t_14};
      __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1538, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
      PyObject *__pyx_temp[4] = {__pyx_t_16, __pyx_n_u_Divide, __pyx_t_13, __pyx_t_14};
      __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1538, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    } else
    #endif
    {
      __pyx_t_17 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1538, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      if (__pyx_t_16) {
        __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_16); __pyx_t_16 = NULL;
      }
      __Pyx_INCREF(__pyx_n_u_Divide);
      __Pyx_GIVEREF(__pyx_n_u_Divide);
      PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_4, __pyx_n_u_Divide);
      __Pyx_GIVEREF(__pyx_t_13);
      PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_4, __pyx_t_13);
      __Pyx_GIVEREF(__pyx_t_14);
      PyTuple_SET_ITEM(__pyx_t_17, 2+__pyx_t_4, __pyx_t_14);
      __pyx_t_13 = 0;
      __pyx_t_14 = 0;
      __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_17, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1538, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    }
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    __pyx_t_4 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_11);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_11, function);
        __pyx_t_4 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_11)) {
      PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_n_u_Round, __pyx_t_12};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1536, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
      PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_n_u_Round, __pyx_t_12};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1536, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    } else
    #endif
    {
      __pyx_t_17 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1536, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      if (__pyx_t_9) {
        __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_9); __pyx_t_9 = NULL;
      }
      __Pyx_INCREF(__pyx_n_u_Round);
      __Pyx_GIVEREF(__pyx_n_u_Round);
      PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_4, __pyx_n_u_Round);
      __Pyx_GIVEREF(__pyx_t_12);
      PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_4, __pyx_t_12);
      __pyx_t_12 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_17, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1536, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    }
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = NULL;
    __pyx_t_4 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
      if (likely(__pyx_t_11)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_10, function);
        __pyx_t_4 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_10)) {
      PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_n_u_N, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1534, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
      PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_n_u_N, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1534, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_17 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1534, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      if (__pyx_t_11) {
        __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_11); __pyx_t_11 = NULL;
      }
      __Pyx_INCREF(__pyx_n_u_N);
      __Pyx_GIVEREF(__pyx_n_u_N);
      PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_4, __pyx_n_u_N);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_4, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1534, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    }
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

    /* "mathics/builtin/numeric.py":1545
 *                     ),
 *                 )
 *                 .evaluate(evaluation)             # <<<<<<<<<<<<<<
 *                 .to_python()
 *             )
 */
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_evaluate); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1545, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_10);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_10, function);
      }
    }
    __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_1, __pyx_v_evaluation) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_v_evaluation);
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1545, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

    /* "mathics/builtin/numeric.py":1546
 *                 )
 *                 .evaluate(evaluation)
 *                 .to_python()             # <<<<<<<<<<<<<<
 *             )
 * 
 */
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_to_python); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1546, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_10);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_10, function);
      }
    }
    __pyx_t_5 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_10);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1546, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

    /* "mathics/builtin/numeric.py":1533
 *             )
 *         else:
 *             display_len = int(             # <<<<<<<<<<<<<<
 *                 Expression(
 *                     "N",
 */
    __pyx_t_10 = __Pyx_PyNumber_Int(__pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1533, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_display_len = __pyx_t_10;
    __pyx_t_10 = 0;
  }
  __pyx_L13:;

  /* "mathics/builtin/numeric.py":1549
 *             )
 * 
 *         exp = log_n_b(py_n, py_b)             # <<<<<<<<<<<<<<
 * 
 *         if py_n == 0 and nr_elements is not None:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_log_n_b); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1549, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_py_n, __pyx_v_py_b};
    __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1549, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_10);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_py_n, __pyx_v_py_b};
    __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1549, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_10);
  } else
  #endif
  {
    __pyx_t_1 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1549, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(__pyx_v_py_n);
    __Pyx_GIVEREF(__pyx_v_py_n);
    PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_4, __pyx_v_py_n);
    __Pyx_INCREF(__pyx_v_py_b);
    __Pyx_GIVEREF(__pyx_v_py_b);
    PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_4, __pyx_v_py_b);
    __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1549, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_exp = __pyx_t_10;
  __pyx_t_10 = 0;

  /* "mathics/builtin/numeric.py":1551
 *         exp = log_n_b(py_n, py_b)
 * 
 *         if py_n == 0 and nr_elements is not None:             # <<<<<<<<<<<<<<
 *             exp = 0
 * 
 */
  __pyx_t_10 = __Pyx_PyInt_EqObjC(__pyx_v_py_n, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1551, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 1551, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (__pyx_t_7) {
  } else {
    __pyx_t_8 = __pyx_t_7;
    goto __pyx_L17_bool_binop_done;
  }
  __pyx_t_7 = (__pyx_v_nr_elements != Py_None);
  __pyx_t_6 = (__pyx_t_7 != 0);
  __pyx_t_8 = __pyx_t_6;
  __pyx_L17_bool_binop_done:;
  if (__pyx_t_8) {

    /* "mathics/builtin/numeric.py":1552
 * 
 *         if py_n == 0 and nr_elements is not None:
 *             exp = 0             # <<<<<<<<<<<<<<
 * 
 *         digits = []
 */
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_DECREF_SET(__pyx_v_exp, __pyx_int_0);

    /* "mathics/builtin/numeric.py":1551
 *         exp = log_n_b(py_n, py_b)
 * 
 *         if py_n == 0 and nr_elements is not None:             # <<<<<<<<<<<<<<
 *             exp = 0
 * 
 */
  }

  /* "mathics/builtin/numeric.py":1554
 *             exp = 0
 * 
 *         digits = []             # <<<<<<<<<<<<<<
 *         if not py_b == 10:
 *             digits = convert_float_base(py_n, py_b, display_len - exp)
 */
  __pyx_t_10 = PyList_New(0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1554, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_v_digits = __pyx_t_10;
  __pyx_t_10 = 0;

  /* "mathics/builtin/numeric.py":1555
 * 
 *         digits = []
 *         if not py_b == 10:             # <<<<<<<<<<<<<<
 *             digits = convert_float_base(py_n, py_b, display_len - exp)
 *             # truncate all the leading 0's
 */
  __pyx_t_10 = __Pyx_PyInt_EqObjC(__pyx_v_py_b, __pyx_int_10, 10, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1555, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1555, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_6 = ((!__pyx_t_8) != 0);
  if (__pyx_t_6) {

    /* "mathics/builtin/numeric.py":1556
 *         digits = []
 *         if not py_b == 10:
 *             digits = convert_float_base(py_n, py_b, display_len - exp)             # <<<<<<<<<<<<<<
 *             # truncate all the leading 0's
 *             i = 0
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_convert_float_base); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1556, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyNumber_Subtract(__pyx_v_display_len, __pyx_v_exp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1556, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = NULL;
    __pyx_t_4 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_4 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_v_py_n, __pyx_v_py_b, __pyx_t_1};
      __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1556, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_v_py_n, __pyx_v_py_b, __pyx_t_1};
      __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1556, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    {
      __pyx_t_17 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1556, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      if (__pyx_t_2) {
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_2); __pyx_t_2 = NULL;
      }
      __Pyx_INCREF(__pyx_v_py_n);
      __Pyx_GIVEREF(__pyx_v_py_n);
      PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_4, __pyx_v_py_n);
      __Pyx_INCREF(__pyx_v_py_b);
      __Pyx_GIVEREF(__pyx_v_py_b);
      PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_4, __pyx_v_py_b);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_17, 2+__pyx_t_4, __pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_17, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1556, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_digits, __pyx_t_10);
    __pyx_t_10 = 0;

    /* "mathics/builtin/numeric.py":1558
 *             digits = convert_float_base(py_n, py_b, display_len - exp)
 *             # truncate all the leading 0's
 *             i = 0             # <<<<<<<<<<<<<<
 *             while digits and digits[i] == 0:
 *                 i += 1
 */
    __Pyx_INCREF(__pyx_int_0);
    __pyx_v_i = __pyx_int_0;

    /* "mathics/builtin/numeric.py":1559
 *             # truncate all the leading 0's
 *             i = 0
 *             while digits and digits[i] == 0:             # <<<<<<<<<<<<<<
 *                 i += 1
 *             digits = digits[i:]
 */
    while (1) {
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_digits); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1559, __pyx_L1_error)
      if (__pyx_t_8) {
      } else {
        __pyx_t_6 = __pyx_t_8;
        goto __pyx_L22_bool_binop_done;
      }
      __pyx_t_10 = __Pyx_PyObject_GetItem(__pyx_v_digits, __pyx_v_i); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1559, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_5 = __Pyx_PyInt_EqObjC(__pyx_t_10, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1559, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1559, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __pyx_t_8;
      __pyx_L22_bool_binop_done:;
      if (!__pyx_t_6) break;

      /* "mathics/builtin/numeric.py":1560
 *             i = 0
 *             while digits and digits[i] == 0:
 *                 i += 1             # <<<<<<<<<<<<<<
 *             digits = digits[i:]
 * 
 */
      __pyx_t_5 = __Pyx_PyInt_AddObjC(__pyx_v_i, __pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1560, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF_SET(__pyx_v_i, __pyx_t_5);
      __pyx_t_5 = 0;
    }

    /* "mathics/builtin/numeric.py":1561
 *             while digits and digits[i] == 0:
 *                 i += 1
 *             digits = digits[i:]             # <<<<<<<<<<<<<<
 * 
 *             if not isinstance(n, Integer):
 */
    __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_v_digits, 0, 0, &__pyx_v_i, NULL, NULL, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1561, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF_SET(__pyx_v_digits, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "mathics/builtin/numeric.py":1563
 *             digits = digits[i:]
 * 
 *             if not isinstance(n, Integer):             # <<<<<<<<<<<<<<
 *                 if len(digits) > display_len:
 *                     digits = digits[: display_len - 1]
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_Integer); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1563, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyObject_IsInstance(__pyx_v_n, __pyx_t_5); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 1563, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_8 = ((!(__pyx_t_6 != 0)) != 0);
    if (__pyx_t_8) {

      /* "mathics/builtin/numeric.py":1564
 * 
 *             if not isinstance(n, Integer):
 *                 if len(digits) > display_len:             # <<<<<<<<<<<<<<
 *                     digits = digits[: display_len - 1]
 *         else:
 */
      __pyx_t_18 = PyObject_Length(__pyx_v_digits); if (unlikely(__pyx_t_18 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1564, __pyx_L1_error)
      __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_18); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1564, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_10 = PyObject_RichCompare(__pyx_t_5, __pyx_v_display_len, Py_GT); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1564, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1564, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (__pyx_t_8) {

        /* "mathics/builtin/numeric.py":1565
 *             if not isinstance(n, Integer):
 *                 if len(digits) > display_len:
 *                     digits = digits[: display_len - 1]             # <<<<<<<<<<<<<<
 *         else:
 *             # drop any leading zeroes
 */
        __pyx_t_10 = __Pyx_PyInt_SubtractObjC(__pyx_v_display_len, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1565, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_v_digits, 0, 0, NULL, &__pyx_t_10, NULL, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1565, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF_SET(__pyx_v_digits, __pyx_t_5);
        __pyx_t_5 = 0;

        /* "mathics/builtin/numeric.py":1564
 * 
 *             if not isinstance(n, Integer):
 *                 if len(digits) > display_len:             # <<<<<<<<<<<<<<
 *                     digits = digits[: display_len - 1]
 *         else:
 */
      }

      /* "mathics/builtin/numeric.py":1563
 *             digits = digits[i:]
 * 
 *             if not isinstance(n, Integer):             # <<<<<<<<<<<<<<
 *                 if len(digits) > display_len:
 *                     digits = digits[: display_len - 1]
 */
    }

    /* "mathics/builtin/numeric.py":1555
 * 
 *         digits = []
 *         if not py_b == 10:             # <<<<<<<<<<<<<<
 *             digits = convert_float_base(py_n, py_b, display_len - exp)
 *             # truncate all the leading 0's
 */
    goto __pyx_L19;
  }

  /* "mathics/builtin/numeric.py":1568
 *         else:
 *             # drop any leading zeroes
 *             for x in str(py_n):             # <<<<<<<<<<<<<<
 *                 if x != "." and (digits or x != "0"):
 *                     digits.append(x)
 */
  /*else*/ {
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_py_n); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1568, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_21 = __Pyx_init_unicode_iteration(__pyx_t_5, (&__pyx_t_19), (&__pyx_t_20), (&__pyx_t_4)); if (unlikely(__pyx_t_21 == ((int)-1))) __PYX_ERR(0, 1568, __pyx_L1_error)
    for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_19; __pyx_t_22++) {
      __pyx_t_18 = __pyx_t_22;
      __pyx_t_10 = PyUnicode_FromOrdinal(__Pyx_PyUnicode_READ(__pyx_t_4, __pyx_t_20, __pyx_t_18)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1568, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_10);
      __pyx_t_10 = 0;

      /* "mathics/builtin/numeric.py":1569
 *             # drop any leading zeroes
 *             for x in str(py_n):
 *                 if x != "." and (digits or x != "0"):             # <<<<<<<<<<<<<<
 *                     digits.append(x)
 * 
 */
      __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_v_x, __pyx_kp_u__36, Py_NE)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1569, __pyx_L1_error)
      if (__pyx_t_6) {
      } else {
        __pyx_t_8 = __pyx_t_6;
        goto __pyx_L29_bool_binop_done;
      }
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_digits); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1569, __pyx_L1_error)
      if (!__pyx_t_6) {
      } else {
        __pyx_t_8 = __pyx_t_6;
        goto __pyx_L29_bool_binop_done;
      }
      __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_v_x, __pyx_kp_u_0, Py_NE)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1569, __pyx_L1_error)
      __pyx_t_8 = __pyx_t_6;
      __pyx_L29_bool_binop_done:;
      if (__pyx_t_8) {

        /* "mathics/builtin/numeric.py":1570
 *             for x in str(py_n):
 *                 if x != "." and (digits or x != "0"):
 *                     digits.append(x)             # <<<<<<<<<<<<<<
 * 
 *         if pos is not None:
 */
        __pyx_t_23 = __Pyx_PyObject_Append(__pyx_v_digits, __pyx_v_x); if (unlikely(__pyx_t_23 == ((int)-1))) __PYX_ERR(0, 1570, __pyx_L1_error)

        /* "mathics/builtin/numeric.py":1569
 *             # drop any leading zeroes
 *             for x in str(py_n):
 *                 if x != "." and (digits or x != "0"):             # <<<<<<<<<<<<<<
 *                     digits.append(x)
 * 
 */
      }
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_L19:;

  /* "mathics/builtin/numeric.py":1572
 *                     digits.append(x)
 * 
 *         if pos is not None:             # <<<<<<<<<<<<<<
 *             temp = exp
 *             exp = pos + 1
 */
  __pyx_t_8 = (__pyx_v_pos != Py_None);
  __pyx_t_6 = (__pyx_t_8 != 0);
  if (__pyx_t_6) {

    /* "mathics/builtin/numeric.py":1573
 * 
 *         if pos is not None:
 *             temp = exp             # <<<<<<<<<<<<<<
 *             exp = pos + 1
 *             move = temp - 1 - pos
 */
    __Pyx_INCREF(__pyx_v_exp);
    __pyx_v_temp = __pyx_v_exp;

    /* "mathics/builtin/numeric.py":1574
 *         if pos is not None:
 *             temp = exp
 *             exp = pos + 1             # <<<<<<<<<<<<<<
 *             move = temp - 1 - pos
 *             if move <= 0:
 */
    __pyx_t_5 = __Pyx_PyInt_AddObjC(__pyx_v_pos, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1574, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF_SET(__pyx_v_exp, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "mathics/builtin/numeric.py":1575
 *             temp = exp
 *             exp = pos + 1
 *             move = temp - 1 - pos             # <<<<<<<<<<<<<<
 *             if move <= 0:
 *                 digits = [0] * abs(move) + digits
 */
    __pyx_t_5 = __Pyx_PyInt_SubtractObjC(__pyx_v_temp, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1575, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_10 = PyNumber_Subtract(__pyx_t_5, __pyx_v_pos); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1575, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_move = __pyx_t_10;
    __pyx_t_10 = 0;

    /* "mathics/builtin/numeric.py":1576
 *             exp = pos + 1
 *             move = temp - 1 - pos
 *             if move <= 0:             # <<<<<<<<<<<<<<
 *                 digits = [0] * abs(move) + digits
 *             else:
 */
    __pyx_t_10 = PyObject_RichCompare(__pyx_v_move, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1576, __pyx_L1_error)
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1576, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (__pyx_t_6) {

      /* "mathics/builtin/numeric.py":1577
 *             move = temp - 1 - pos
 *             if move <= 0:
 *                 digits = [0] * abs(move) + digits             # <<<<<<<<<<<<<<
 *             else:
 *                 digits = digits[abs(move) :]
 */
      __pyx_t_10 = __Pyx_PyNumber_Absolute(__pyx_v_move); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1577, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1577, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_5, 0, __pyx_int_0);
      { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_5, __pyx_t_10); if (unlikely(!__pyx_temp)) __PYX_ERR(0, 1577, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_temp);
        __Pyx_DECREF(__pyx_t_5);
        __pyx_t_5 = __pyx_temp;
      }
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = PyNumber_Add(__pyx_t_5, __pyx_v_digits); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1577, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF_SET(__pyx_v_digits, __pyx_t_10);
      __pyx_t_10 = 0;

      /* "mathics/builtin/numeric.py":1576
 *             exp = pos + 1
 *             move = temp - 1 - pos
 *             if move <= 0:             # <<<<<<<<<<<<<<
 *                 digits = [0] * abs(move) + digits
 *             else:
 */
      goto __pyx_L33;
    }

    /* "mathics/builtin/numeric.py":1579
 *                 digits = [0] * abs(move) + digits
 *             else:
 *                 digits = digits[abs(move) :]             # <<<<<<<<<<<<<<
 *                 display_len = display_len - move
 * 
 */
    /*else*/ {
      __pyx_t_10 = __Pyx_PyNumber_Absolute(__pyx_v_move); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1579, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_v_digits, 0, 0, &__pyx_t_10, NULL, NULL, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1579, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF_SET(__pyx_v_digits, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "mathics/builtin/numeric.py":1580
 *             else:
 *                 digits = digits[abs(move) :]
 *                 display_len = display_len - move             # <<<<<<<<<<<<<<
 * 
 *         leaves = []
 */
      __pyx_t_5 = PyNumber_Subtract(__pyx_v_display_len, __pyx_v_move); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1580, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF_SET(__pyx_v_display_len, __pyx_t_5);
      __pyx_t_5 = 0;
    }
    __pyx_L33:;

    /* "mathics/builtin/numeric.py":1572
 *                     digits.append(x)
 * 
 *         if pos is not None:             # <<<<<<<<<<<<<<
 *             temp = exp
 *             exp = pos + 1
 */
  }

  /* "mathics/builtin/numeric.py":1582
 *                 display_len = display_len - move
 * 
 *         leaves = []             # <<<<<<<<<<<<<<
 *         for x in digits:
 *             if x == "e" or x == "E":
 */
  __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1582, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v_leaves = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "mathics/builtin/numeric.py":1583
 * 
 *         leaves = []
 *         for x in digits:             # <<<<<<<<<<<<<<
 *             if x == "e" or x == "E":
 *                 break
 */
  if (likely(PyList_CheckExact(__pyx_v_digits)) || PyTuple_CheckExact(__pyx_v_digits)) {
    __pyx_t_5 = __pyx_v_digits; __Pyx_INCREF(__pyx_t_5); __pyx_t_19 = 0;
    __pyx_t_24 = NULL;
  } else {
    __pyx_t_19 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_digits); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1583, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_24 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 1583, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_24)) {
      if (likely(PyList_CheckExact(__pyx_t_5))) {
        if (__pyx_t_19 >= PyList_GET_SIZE(__pyx_t_5)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_10 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_19); __Pyx_INCREF(__pyx_t_10); __pyx_t_19++; if (unlikely(0 < 0)) __PYX_ERR(0, 1583, __pyx_L1_error)
        #else
        __pyx_t_10 = PySequence_ITEM(__pyx_t_5, __pyx_t_19); __pyx_t_19++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1583, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        #endif
      } else {
        if (__pyx_t_19 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_19); __Pyx_INCREF(__pyx_t_10); __pyx_t_19++; if (unlikely(0 < 0)) __PYX_ERR(0, 1583, __pyx_L1_error)
        #else
        __pyx_t_10 = PySequence_ITEM(__pyx_t_5, __pyx_t_19); __pyx_t_19++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1583, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        #endif
      }
    } else {
      __pyx_t_10 = __pyx_t_24(__pyx_t_5);
      if (unlikely(!__pyx_t_10)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1583, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_10);
    }
    __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_10);
    __pyx_t_10 = 0;

    /* "mathics/builtin/numeric.py":1584
 *         leaves = []
 *         for x in digits:
 *             if x == "e" or x == "E":             # <<<<<<<<<<<<<<
 *                 break
 *             # Convert to Mathics' list format
 */
    __pyx_t_8 = (__Pyx_PyUnicode_Equals(__pyx_v_x, __pyx_n_u_e, Py_EQ)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1584, __pyx_L1_error)
    if (!__pyx_t_8) {
    } else {
      __pyx_t_6 = __pyx_t_8;
      goto __pyx_L37_bool_binop_done;
    }
    __pyx_t_8 = (__Pyx_PyUnicode_Equals(__pyx_v_x, __pyx_n_u_E, Py_EQ)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1584, __pyx_L1_error)
    __pyx_t_6 = __pyx_t_8;
    __pyx_L37_bool_binop_done:;
    if (__pyx_t_6) {

      /* "mathics/builtin/numeric.py":1585
 *         for x in digits:
 *             if x == "e" or x == "E":
 *                 break             # <<<<<<<<<<<<<<
 *             # Convert to Mathics' list format
 *             leaves.append(from_python(int(x)))
 */
      goto __pyx_L35_break;

      /* "mathics/builtin/numeric.py":1584
 *         leaves = []
 *         for x in digits:
 *             if x == "e" or x == "E":             # <<<<<<<<<<<<<<
 *                 break
 *             # Convert to Mathics' list format
 */
    }

    /* "mathics/builtin/numeric.py":1587
 *                 break
 *             # Convert to Mathics' list format
 *             leaves.append(from_python(int(x)))             # <<<<<<<<<<<<<<
 * 
 *         if not rational_no:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_17, __pyx_n_s_from_python); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1587, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_17);
    __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_v_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1587, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_17))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_17);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_17, function);
      }
    }
    __pyx_t_10 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_17, __pyx_t_2, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_17, __pyx_t_1);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1587, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    __pyx_t_23 = __Pyx_PyList_Append(__pyx_v_leaves, __pyx_t_10); if (unlikely(__pyx_t_23 == ((int)-1))) __PYX_ERR(0, 1587, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

    /* "mathics/builtin/numeric.py":1583
 * 
 *         leaves = []
 *         for x in digits:             # <<<<<<<<<<<<<<
 *             if x == "e" or x == "E":
 *                 break
 */
  }
  __pyx_L35_break:;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/builtin/numeric.py":1589
 *             leaves.append(from_python(int(x)))
 * 
 *         if not rational_no:             # <<<<<<<<<<<<<<
 *             while len(leaves) < display_len:
 *                 leaves.append(from_python(0))
 */
  __pyx_t_6 = ((!(__pyx_v_rational_no != 0)) != 0);
  if (__pyx_t_6) {

    /* "mathics/builtin/numeric.py":1590
 * 
 *         if not rational_no:
 *             while len(leaves) < display_len:             # <<<<<<<<<<<<<<
 *                 leaves.append(from_python(0))
 * 
 */
    while (1) {
      __pyx_t_19 = PyList_GET_SIZE(__pyx_v_leaves); if (unlikely(__pyx_t_19 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1590, __pyx_L1_error)
      __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_19); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1590, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_10 = PyObject_RichCompare(__pyx_t_5, __pyx_v_display_len, Py_LT); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1590, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1590, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (!__pyx_t_6) break;

      /* "mathics/builtin/numeric.py":1591
 *         if not rational_no:
 *             while len(leaves) < display_len:
 *                 leaves.append(from_python(0))             # <<<<<<<<<<<<<<
 * 
 *         if nr_elements is not None:
 */
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_from_python); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1591, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_17 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_17)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_17);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      __pyx_t_10 = (__pyx_t_17) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_17, __pyx_int_0) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_int_0);
      __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
      if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1591, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_23 = __Pyx_PyList_Append(__pyx_v_leaves, __pyx_t_10); if (unlikely(__pyx_t_23 == ((int)-1))) __PYX_ERR(0, 1591, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }

    /* "mathics/builtin/numeric.py":1589
 *             leaves.append(from_python(int(x)))
 * 
 *         if not rational_no:             # <<<<<<<<<<<<<<
 *             while len(leaves) < display_len:
 *                 leaves.append(from_python(0))
 */
  }

  /* "mathics/builtin/numeric.py":1593
 *                 leaves.append(from_python(0))
 * 
 *         if nr_elements is not None:             # <<<<<<<<<<<<<<
 *             # display_len == nr_elements
 *             if len(leaves) >= nr_elements:
 */
  __pyx_t_6 = (__pyx_v_nr_elements != Py_None);
  __pyx_t_8 = (__pyx_t_6 != 0);
  if (__pyx_t_8) {

    /* "mathics/builtin/numeric.py":1595
 *         if nr_elements is not None:
 *             # display_len == nr_elements
 *             if len(leaves) >= nr_elements:             # <<<<<<<<<<<<<<
 *                 # Truncate, preserving the digits on the right
 *                 leaves = leaves[:nr_elements]
 */
    __pyx_t_19 = PyList_GET_SIZE(__pyx_v_leaves); if (unlikely(__pyx_t_19 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1595, __pyx_L1_error)
    __pyx_t_10 = PyInt_FromSsize_t(__pyx_t_19); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1595, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_10, __pyx_v_nr_elements, Py_GE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1595, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1595, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_8) {

      /* "mathics/builtin/numeric.py":1597
 *             if len(leaves) >= nr_elements:
 *                 # Truncate, preserving the digits on the right
 *                 leaves = leaves[:nr_elements]             # <<<<<<<<<<<<<<
 *             else:
 *                 if isinstance(n, Integer):
 */
      __Pyx_INCREF(__pyx_v_nr_elements);
      __pyx_t_5 = __pyx_v_nr_elements;
      __pyx_t_8 = (__pyx_t_5 == Py_None);
      if (__pyx_t_8) {
        __pyx_t_19 = PY_SSIZE_T_MAX;
      } else {
        __pyx_t_18 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_18 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1597, __pyx_L1_error)
        __pyx_t_19 = __pyx_t_18;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyList_GetSlice(__pyx_v_leaves, 0, __pyx_t_19); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1597, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF_SET(__pyx_v_leaves, ((PyObject*)__pyx_t_5));
      __pyx_t_5 = 0;

      /* "mathics/builtin/numeric.py":1595
 *         if nr_elements is not None:
 *             # display_len == nr_elements
 *             if len(leaves) >= nr_elements:             # <<<<<<<<<<<<<<
 *                 # Truncate, preserving the digits on the right
 *                 leaves = leaves[:nr_elements]
 */
      goto __pyx_L43;
    }

    /* "mathics/builtin/numeric.py":1599
 *                 leaves = leaves[:nr_elements]
 *             else:
 *                 if isinstance(n, Integer):             # <<<<<<<<<<<<<<
 *                     while len(leaves) < nr_elements:
 *                         leaves.append(from_python(0))
 */
    /*else*/ {
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_Integer); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1599, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_8 = PyObject_IsInstance(__pyx_v_n, __pyx_t_5); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 1599, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = (__pyx_t_8 != 0);
      if (__pyx_t_6) {

        /* "mathics/builtin/numeric.py":1600
 *             else:
 *                 if isinstance(n, Integer):
 *                     while len(leaves) < nr_elements:             # <<<<<<<<<<<<<<
 *                         leaves.append(from_python(0))
 *                 else:
 */
        while (1) {
          __pyx_t_19 = PyList_GET_SIZE(__pyx_v_leaves); if (unlikely(__pyx_t_19 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1600, __pyx_L1_error)
          __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_19); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1600, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_10 = PyObject_RichCompare(__pyx_t_5, __pyx_v_nr_elements, Py_LT); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1600, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1600, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          if (!__pyx_t_6) break;

          /* "mathics/builtin/numeric.py":1601
 *                 if isinstance(n, Integer):
 *                     while len(leaves) < nr_elements:
 *                         leaves.append(from_python(0))             # <<<<<<<<<<<<<<
 *                 else:
 *                     # Adding Indeterminate if the length is greater than the precision
 */
          __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_from_python); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1601, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_17 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
            __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_5);
            if (likely(__pyx_t_17)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
              __Pyx_INCREF(__pyx_t_17);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_5, function);
            }
          }
          __pyx_t_10 = (__pyx_t_17) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_17, __pyx_int_0) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_int_0);
          __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
          if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1601, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_23 = __Pyx_PyList_Append(__pyx_v_leaves, __pyx_t_10); if (unlikely(__pyx_t_23 == ((int)-1))) __PYX_ERR(0, 1601, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        }

        /* "mathics/builtin/numeric.py":1599
 *                 leaves = leaves[:nr_elements]
 *             else:
 *                 if isinstance(n, Integer):             # <<<<<<<<<<<<<<
 *                     while len(leaves) < nr_elements:
 *                         leaves.append(from_python(0))
 */
        goto __pyx_L44;
      }

      /* "mathics/builtin/numeric.py":1604
 *                 else:
 *                     # Adding Indeterminate if the length is greater than the precision
 *                     while len(leaves) < nr_elements:             # <<<<<<<<<<<<<<
 *                         leaves.append(from_python(Symbol("Indeterminate")))
 *         list_str = Expression(SymbolList, *leaves)
 */
      /*else*/ {
        while (1) {
          __pyx_t_19 = PyList_GET_SIZE(__pyx_v_leaves); if (unlikely(__pyx_t_19 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1604, __pyx_L1_error)
          __pyx_t_10 = PyInt_FromSsize_t(__pyx_t_19); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1604, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_5 = PyObject_RichCompare(__pyx_t_10, __pyx_v_nr_elements, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1604, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 1604, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (!__pyx_t_6) break;

          /* "mathics/builtin/numeric.py":1605
 *                     # Adding Indeterminate if the length is greater than the precision
 *                     while len(leaves) < nr_elements:
 *                         leaves.append(from_python(Symbol("Indeterminate")))             # <<<<<<<<<<<<<<
 *         list_str = Expression(SymbolList, *leaves)
 *         return Expression(SymbolList, list_str, exp)
 */
          __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_from_python); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1605, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1605, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_2 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
            __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
            if (likely(__pyx_t_2)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
              __Pyx_INCREF(__pyx_t_2);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_1, function);
            }
          }
          __pyx_t_17 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, __pyx_n_u_Indeterminate) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_n_u_Indeterminate);
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1605, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_17);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
            __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_10);
            if (likely(__pyx_t_1)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
              __Pyx_INCREF(__pyx_t_1);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_10, function);
            }
          }
          __pyx_t_5 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_1, __pyx_t_17) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_17);
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
          if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1605, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __pyx_t_23 = __Pyx_PyList_Append(__pyx_v_leaves, __pyx_t_5); if (unlikely(__pyx_t_23 == ((int)-1))) __PYX_ERR(0, 1605, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
      }
      __pyx_L44:;
    }
    __pyx_L43:;

    /* "mathics/builtin/numeric.py":1593
 *                 leaves.append(from_python(0))
 * 
 *         if nr_elements is not None:             # <<<<<<<<<<<<<<
 *             # display_len == nr_elements
 *             if len(leaves) >= nr_elements:
 */
  }

  /* "mathics/builtin/numeric.py":1606
 *                     while len(leaves) < nr_elements:
 *                         leaves.append(from_python(Symbol("Indeterminate")))
 *         list_str = Expression(SymbolList, *leaves)             # <<<<<<<<<<<<<<
 *         return Expression(SymbolList, list_str, exp)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_Expression); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1606, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_SymbolList); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1606, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_17 = PyTuple_New(1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1606, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  __Pyx_GIVEREF(__pyx_t_10);
  PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_10);
  __pyx_t_10 = 0;
  __pyx_t_10 = PySequence_Tuple(__pyx_v_leaves); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1606, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_1 = PyNumber_Add(__pyx_t_17, __pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1606, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1606, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_list_str = __pyx_t_10;
  __pyx_t_10 = 0;

  /* "mathics/builtin/numeric.py":1607
 *                         leaves.append(from_python(Symbol("Indeterminate")))
 *         list_str = Expression(SymbolList, *leaves)
 *         return Expression(SymbolList, list_str, exp)             # <<<<<<<<<<<<<<
 * 
 *     def apply_with_base_and_length(self, n, b, length, evaluation, pos=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Expression); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1607, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_SymbolList); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1607, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_17 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_17)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_17);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[4] = {__pyx_t_17, __pyx_t_5, __pyx_v_list_str, __pyx_v_exp};
    __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1607, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[4] = {__pyx_t_17, __pyx_t_5, __pyx_v_list_str, __pyx_v_exp};
    __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1607, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_2 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1607, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__pyx_t_17) {
      __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_17); __pyx_t_17 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_4, __pyx_t_5);
    __Pyx_INCREF(__pyx_v_list_str);
    __Pyx_GIVEREF(__pyx_v_list_str);
    PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_4, __pyx_v_list_str);
    __Pyx_INCREF(__pyx_v_exp);
    __Pyx_GIVEREF(__pyx_v_exp);
    PyTuple_SET_ITEM(__pyx_t_2, 2+__pyx_t_4, __pyx_v_exp);
    __pyx_t_5 = 0;
    __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1607, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_10;
  __pyx_t_10 = 0;
  goto __pyx_L0;

  /* "mathics/builtin/numeric.py":1499
 *             return self.apply_with_base(n, from_python(10), evaluation)
 * 
 *     def apply_with_base(self, n, b, evaluation, nr_elements=None, pos=None):             # <<<<<<<<<<<<<<
 *         "%(name)s[n_?NumericQ, b_Integer]"
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_AddTraceback("mathics.builtin.numeric.RealDigits.apply_with_base", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_expr);
  __Pyx_XDECREF(__pyx_v_py_b);
  __Pyx_XDECREF(__pyx_v_pos_len);
  __Pyx_XDECREF(__pyx_v_py_n);
  __Pyx_XDECREF(__pyx_v_display_len);
  __Pyx_XDECREF(__pyx_v_exp);
  __Pyx_XDECREF(__pyx_v_digits);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_temp);
  __Pyx_XDECREF(__pyx_v_move);
  __Pyx_XDECREF(__pyx_v_leaves);
  __Pyx_XDECREF(__pyx_v_list_str);
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1609
 *         return Expression(SymbolList, list_str, exp)
 * 
 *     def apply_with_base_and_length(self, n, b, length, evaluation, pos=None):             # <<<<<<<<<<<<<<
 *         "%(name)s[n_?NumericQ, b_Integer, length_]"
 *         leaves = []
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_10RealDigits_11apply_with_base_and_length(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_7builtin_7numeric_10RealDigits_10apply_with_base_and_length[] = "%(name)s[n_?NumericQ, b_Integer, length_]";
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_10RealDigits_11apply_with_base_and_length = {"apply_with_base_and_length", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_10RealDigits_11apply_with_base_and_length, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_7builtin_7numeric_10RealDigits_10apply_with_base_and_length};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_10RealDigits_11apply_with_base_and_length(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_n = 0;
  PyObject *__pyx_v_b = 0;
  PyObject *__pyx_v_length = 0;
  PyObject *__pyx_v_evaluation = 0;
  PyObject *__pyx_v_pos = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("apply_with_base_and_length (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_n,&__pyx_n_s_b,&__pyx_n_s_length,&__pyx_n_s_evaluation,&__pyx_n_s_pos,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    values[5] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_with_base_and_length", 0, 5, 6, 1); __PYX_ERR(0, 1609, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_with_base_and_length", 0, 5, 6, 2); __PYX_ERR(0, 1609, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_length)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_with_base_and_length", 0, 5, 6, 3); __PYX_ERR(0, 1609, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_with_base_and_length", 0, 5, 6, 4); __PYX_ERR(0, 1609, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pos);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply_with_base_and_length") < 0)) __PYX_ERR(0, 1609, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_n = values[1];
    __pyx_v_b = values[2];
    __pyx_v_length = values[3];
    __pyx_v_evaluation = values[4];
    __pyx_v_pos = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("apply_with_base_and_length", 0, 5, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1609, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.RealDigits.apply_with_base_and_length", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_10RealDigits_10apply_with_base_and_length(__pyx_self, __pyx_v_self, __pyx_v_n, __pyx_v_b, __pyx_v_length, __pyx_v_evaluation, __pyx_v_pos);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_10RealDigits_10apply_with_base_and_length(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_n, PyObject *__pyx_v_b, PyObject *__pyx_v_length, PyObject *__pyx_v_evaluation, PyObject *__pyx_v_pos) {
  PyObject *__pyx_v_leaves = NULL;
  PyObject *__pyx_v_expr = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("apply_with_base_and_length", 0);

  /* "mathics/builtin/numeric.py":1611
 *     def apply_with_base_and_length(self, n, b, length, evaluation, pos=None):
 *         "%(name)s[n_?NumericQ, b_Integer, length_]"
 *         leaves = []             # <<<<<<<<<<<<<<
 *         if pos is not None:
 *             leaves.append(from_python(pos))
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1611, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_leaves = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":1612
 *         "%(name)s[n_?NumericQ, b_Integer, length_]"
 *         leaves = []
 *         if pos is not None:             # <<<<<<<<<<<<<<
 *             leaves.append(from_python(pos))
 *         expr = Expression("RealDigits", n, b, length, *leaves)
 */
  __pyx_t_2 = (__pyx_v_pos != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "mathics/builtin/numeric.py":1613
 *         leaves = []
 *         if pos is not None:
 *             leaves.append(from_python(pos))             # <<<<<<<<<<<<<<
 *         expr = Expression("RealDigits", n, b, length, *leaves)
 *         if not (isinstance(length, Integer) and length.get_int_value() >= 0):
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_from_python); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1613, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_pos) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_pos);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1613, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_leaves, __pyx_t_1); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 1613, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "mathics/builtin/numeric.py":1612
 *         "%(name)s[n_?NumericQ, b_Integer, length_]"
 *         leaves = []
 *         if pos is not None:             # <<<<<<<<<<<<<<
 *             leaves.append(from_python(pos))
 *         expr = Expression("RealDigits", n, b, length, *leaves)
 */
  }

  /* "mathics/builtin/numeric.py":1614
 *         if pos is not None:
 *             leaves.append(from_python(pos))
 *         expr = Expression("RealDigits", n, b, length, *leaves)             # <<<<<<<<<<<<<<
 *         if not (isinstance(length, Integer) and length.get_int_value() >= 0):
 *             return evaluation.message("RealDigits", "intnm", expr)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Expression); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_n_u_RealDigits);
  __Pyx_GIVEREF(__pyx_n_u_RealDigits);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_n_u_RealDigits);
  __Pyx_INCREF(__pyx_v_n);
  __Pyx_GIVEREF(__pyx_v_n);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_n);
  __Pyx_INCREF(__pyx_v_b);
  __Pyx_GIVEREF(__pyx_v_b);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_b);
  __Pyx_INCREF(__pyx_v_length);
  __Pyx_GIVEREF(__pyx_v_length);
  PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_length);
  __pyx_t_5 = PySequence_Tuple(__pyx_v_leaves); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = PyNumber_Add(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_expr = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "mathics/builtin/numeric.py":1615
 *             leaves.append(from_python(pos))
 *         expr = Expression("RealDigits", n, b, length, *leaves)
 *         if not (isinstance(length, Integer) and length.get_int_value() >= 0):             # <<<<<<<<<<<<<<
 *             return evaluation.message("RealDigits", "intnm", expr)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_Integer); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1615, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_length, __pyx_t_5); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 1615, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_8 = (__pyx_t_2 != 0);
  if (__pyx_t_8) {
  } else {
    __pyx_t_3 = __pyx_t_8;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_length, __pyx_n_s_get_int_value); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1615, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  __pyx_t_5 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1615, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyObject_RichCompare(__pyx_t_5, __pyx_int_0, Py_GE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1615, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 1615, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_3 = __pyx_t_8;
  __pyx_L5_bool_binop_done:;
  __pyx_t_8 = ((!__pyx_t_3) != 0);
  if (__pyx_t_8) {

    /* "mathics/builtin/numeric.py":1616
 *         expr = Expression("RealDigits", n, b, length, *leaves)
 *         if not (isinstance(length, Integer) and length.get_int_value() >= 0):
 *             return evaluation.message("RealDigits", "intnm", expr)             # <<<<<<<<<<<<<<
 * 
 *         return self.apply_with_base(
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_message); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1616, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[4] = {__pyx_t_1, __pyx_n_u_RealDigits, __pyx_n_u_intnm, __pyx_v_expr};
      __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1616, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_7);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[4] = {__pyx_t_1, __pyx_n_u_RealDigits, __pyx_n_u_intnm, __pyx_v_expr};
      __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1616, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_7);
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(3+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1616, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__pyx_t_1) {
        __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __pyx_t_1 = NULL;
      }
      __Pyx_INCREF(__pyx_n_u_RealDigits);
      __Pyx_GIVEREF(__pyx_n_u_RealDigits);
      PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_9, __pyx_n_u_RealDigits);
      __Pyx_INCREF(__pyx_n_u_intnm);
      __Pyx_GIVEREF(__pyx_n_u_intnm);
      PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_9, __pyx_n_u_intnm);
      __Pyx_INCREF(__pyx_v_expr);
      __Pyx_GIVEREF(__pyx_v_expr);
      PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_9, __pyx_v_expr);
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1616, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_7;
    __pyx_t_7 = 0;
    goto __pyx_L0;

    /* "mathics/builtin/numeric.py":1615
 *             leaves.append(from_python(pos))
 *         expr = Expression("RealDigits", n, b, length, *leaves)
 *         if not (isinstance(length, Integer) and length.get_int_value() >= 0):             # <<<<<<<<<<<<<<
 *             return evaluation.message("RealDigits", "intnm", expr)
 * 
 */
  }

  /* "mathics/builtin/numeric.py":1618
 *             return evaluation.message("RealDigits", "intnm", expr)
 * 
 *         return self.apply_with_base(             # <<<<<<<<<<<<<<
 *             n, b, evaluation, nr_elements=length.get_int_value(), pos=pos
 *         )
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apply_with_base); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);

  /* "mathics/builtin/numeric.py":1619
 * 
 *         return self.apply_with_base(
 *             n, b, evaluation, nr_elements=length.get_int_value(), pos=pos             # <<<<<<<<<<<<<<
 *         )
 * 
 */
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_n);
  __Pyx_GIVEREF(__pyx_v_n);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_n);
  __Pyx_INCREF(__pyx_v_b);
  __Pyx_GIVEREF(__pyx_v_b);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_b);
  __Pyx_INCREF(__pyx_v_evaluation);
  __Pyx_GIVEREF(__pyx_v_evaluation);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_evaluation);
  __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1619, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_length, __pyx_n_s_get_int_value); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1619, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
    __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
    if (likely(__pyx_t_11)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_10, function);
    }
  }
  __pyx_t_1 = (__pyx_t_11) ? __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_11) : __Pyx_PyObject_CallNoArg(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1619, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_nr_elements, __pyx_t_1) < 0) __PYX_ERR(0, 1619, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_pos, __pyx_v_pos) < 0) __PYX_ERR(0, 1619, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1618
 *             return evaluation.message("RealDigits", "intnm", expr)
 * 
 *         return self.apply_with_base(             # <<<<<<<<<<<<<<
 *             n, b, evaluation, nr_elements=length.get_int_value(), pos=pos
 *         )
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/builtin/numeric.py":1609
 *         return Expression(SymbolList, list_str, exp)
 * 
 *     def apply_with_base_and_length(self, n, b, length, evaluation, pos=None):             # <<<<<<<<<<<<<<
 *         "%(name)s[n_?NumericQ, b_Integer, length_]"
 *         leaves = []
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("mathics.builtin.numeric.RealDigits.apply_with_base_and_length", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_leaves);
  __Pyx_XDECREF(__pyx_v_expr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1622
 *         )
 * 
 *     def apply_with_base_length_and_precision(self, n, b, length, p, evaluation):             # <<<<<<<<<<<<<<
 *         "%(name)s[n_?NumericQ, b_Integer, length_, p_]"
 *         if not isinstance(p, Integer):
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_10RealDigits_13apply_with_base_length_and_precision(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_7builtin_7numeric_10RealDigits_12apply_with_base_length_and_precision[] = "%(name)s[n_?NumericQ, b_Integer, length_, p_]";
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_10RealDigits_13apply_with_base_length_and_precision = {"apply_with_base_length_and_precision", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_10RealDigits_13apply_with_base_length_and_precision, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_7builtin_7numeric_10RealDigits_12apply_with_base_length_and_precision};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_10RealDigits_13apply_with_base_length_and_precision(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_n = 0;
  PyObject *__pyx_v_b = 0;
  PyObject *__pyx_v_length = 0;
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("apply_with_base_length_and_precision (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_n,&__pyx_n_s_b,&__pyx_n_s_length,&__pyx_n_s_p,&__pyx_n_s_evaluation,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_with_base_length_and_precision", 1, 6, 6, 1); __PYX_ERR(0, 1622, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_with_base_length_and_precision", 1, 6, 6, 2); __PYX_ERR(0, 1622, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_length)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_with_base_length_and_precision", 1, 6, 6, 3); __PYX_ERR(0, 1622, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_with_base_length_and_precision", 1, 6, 6, 4); __PYX_ERR(0, 1622, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply_with_base_length_and_precision", 1, 6, 6, 5); __PYX_ERR(0, 1622, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply_with_base_length_and_precision") < 0)) __PYX_ERR(0, 1622, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
    }
    __pyx_v_self = values[0];
    __pyx_v_n = values[1];
    __pyx_v_b = values[2];
    __pyx_v_length = values[3];
    __pyx_v_p = values[4];
    __pyx_v_evaluation = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("apply_with_base_length_and_precision", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1622, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.RealDigits.apply_with_base_length_and_precision", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_10RealDigits_12apply_with_base_length_and_precision(__pyx_self, __pyx_v_self, __pyx_v_n, __pyx_v_b, __pyx_v_length, __pyx_v_p, __pyx_v_evaluation);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_10RealDigits_12apply_with_base_length_and_precision(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_n, PyObject *__pyx_v_b, PyObject *__pyx_v_length, PyObject *__pyx_v_p, PyObject *__pyx_v_evaluation) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("apply_with_base_length_and_precision", 0);

  /* "mathics/builtin/numeric.py":1624
 *     def apply_with_base_length_and_precision(self, n, b, length, p, evaluation):
 *         "%(name)s[n_?NumericQ, b_Integer, length_, p_]"
 *         if not isinstance(p, Integer):             # <<<<<<<<<<<<<<
 *             return evaluation.message(
 *                 "RealDigits", "intm", Expression("RealDigits", n, b, length, p)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Integer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1624, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_p, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 1624, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = ((!(__pyx_t_2 != 0)) != 0);
  if (__pyx_t_3) {

    /* "mathics/builtin/numeric.py":1625
 *         "%(name)s[n_?NumericQ, b_Integer, length_, p_]"
 *         if not isinstance(p, Integer):
 *             return evaluation.message(             # <<<<<<<<<<<<<<
 *                 "RealDigits", "intm", Expression("RealDigits", n, b, length, p)
 *             )
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_evaluation, __pyx_n_s_message); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1625, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "mathics/builtin/numeric.py":1626
 *         if not isinstance(p, Integer):
 *             return evaluation.message(
 *                 "RealDigits", "intm", Expression("RealDigits", n, b, length, p)             # <<<<<<<<<<<<<<
 *             )
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_Expression); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1626, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[6] = {__pyx_t_7, __pyx_n_u_RealDigits, __pyx_v_n, __pyx_v_b, __pyx_v_length, __pyx_v_p};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1626, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[6] = {__pyx_t_7, __pyx_n_u_RealDigits, __pyx_v_n, __pyx_v_b, __pyx_v_length, __pyx_v_p};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1626, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(5+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1626, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_INCREF(__pyx_n_u_RealDigits);
      __Pyx_GIVEREF(__pyx_n_u_RealDigits);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_n_u_RealDigits);
      __Pyx_INCREF(__pyx_v_n);
      __Pyx_GIVEREF(__pyx_v_n);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_n);
      __Pyx_INCREF(__pyx_v_b);
      __Pyx_GIVEREF(__pyx_v_b);
      PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_v_b);
      __Pyx_INCREF(__pyx_v_length);
      __Pyx_GIVEREF(__pyx_v_length);
      PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_8, __pyx_v_length);
      __Pyx_INCREF(__pyx_v_p);
      __Pyx_GIVEREF(__pyx_v_p);
      PyTuple_SET_ITEM(__pyx_t_9, 4+__pyx_t_8, __pyx_v_p);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1626, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_n_u_RealDigits, __pyx_n_u_intm, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1625, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_n_u_RealDigits, __pyx_n_u_intm, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1625, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1625, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_6) {
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); __pyx_t_6 = NULL;
      }
      __Pyx_INCREF(__pyx_n_u_RealDigits);
      __Pyx_GIVEREF(__pyx_n_u_RealDigits);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_n_u_RealDigits);
      __Pyx_INCREF(__pyx_n_u_intm);
      __Pyx_GIVEREF(__pyx_n_u_intm);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_n_u_intm);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1625, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "mathics/builtin/numeric.py":1624
 *     def apply_with_base_length_and_precision(self, n, b, length, p, evaluation):
 *         "%(name)s[n_?NumericQ, b_Integer, length_, p_]"
 *         if not isinstance(p, Integer):             # <<<<<<<<<<<<<<
 *             return evaluation.message(
 *                 "RealDigits", "intm", Expression("RealDigits", n, b, length, p)
 */
  }

  /* "mathics/builtin/numeric.py":1629
 *             )
 * 
 *         return self.apply_with_base_and_length(             # <<<<<<<<<<<<<<
 *             n, b, length, evaluation, pos=p.get_int_value()
 *         )
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_apply_with_base_and_length); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "mathics/builtin/numeric.py":1630
 * 
 *         return self.apply_with_base_and_length(
 *             n, b, length, evaluation, pos=p.get_int_value()             # <<<<<<<<<<<<<<
 *         )
 * 
 */
  __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_n);
  __Pyx_GIVEREF(__pyx_v_n);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_n);
  __Pyx_INCREF(__pyx_v_b);
  __Pyx_GIVEREF(__pyx_v_b);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_b);
  __Pyx_INCREF(__pyx_v_length);
  __Pyx_GIVEREF(__pyx_v_length);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_length);
  __Pyx_INCREF(__pyx_v_evaluation);
  __Pyx_GIVEREF(__pyx_v_evaluation);
  PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_evaluation);
  __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1630, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_p, __pyx_n_s_get_int_value); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1630, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1630, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_pos, __pyx_t_5) < 0) __PYX_ERR(0, 1630, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/builtin/numeric.py":1629
 *             )
 * 
 *         return self.apply_with_base_and_length(             # <<<<<<<<<<<<<<
 *             n, b, length, evaluation, pos=p.get_int_value()
 *         )
 */
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "mathics/builtin/numeric.py":1622
 *         )
 * 
 *     def apply_with_base_length_and_precision(self, n, b, length, p, evaluation):             # <<<<<<<<<<<<<<
 *         "%(name)s[n_?NumericQ, b_Integer, length_, p_]"
 *         if not isinstance(p, Integer):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("mathics.builtin.numeric.RealDigits.apply_with_base_length_and_precision", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1635
 * 
 * class _ZLibHash:  # make zlib hashes behave as if they were from hashlib
 *     def __init__(self, fn):             # <<<<<<<<<<<<<<
 *         self._bytes = b""
 *         self._fn = fn
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_9_ZLibHash_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_9_ZLibHash_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_9_ZLibHash_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_9_ZLibHash_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_fn = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_fn,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fn)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 1635, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 1635, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_fn = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1635, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric._ZLibHash.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_9_ZLibHash___init__(__pyx_self, __pyx_v_self, __pyx_v_fn);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_9_ZLibHash___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_fn) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "mathics/builtin/numeric.py":1636
 * class _ZLibHash:  # make zlib hashes behave as if they were from hashlib
 *     def __init__(self, fn):
 *         self._bytes = b""             # <<<<<<<<<<<<<<
 *         self._fn = fn
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_bytes, __pyx_kp_b__2) < 0) __PYX_ERR(0, 1636, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1637
 *     def __init__(self, fn):
 *         self._bytes = b""
 *         self._fn = fn             # <<<<<<<<<<<<<<
 * 
 *     def update(self, bytes):
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_fn_2, __pyx_v_fn) < 0) __PYX_ERR(0, 1637, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1635
 * 
 * class _ZLibHash:  # make zlib hashes behave as if they were from hashlib
 *     def __init__(self, fn):             # <<<<<<<<<<<<<<
 *         self._bytes = b""
 *         self._fn = fn
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric._ZLibHash.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1639
 *         self._fn = fn
 * 
 *     def update(self, bytes):             # <<<<<<<<<<<<<<
 *         self._bytes += bytes
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_9_ZLibHash_3update(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_9_ZLibHash_3update = {"update", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_9_ZLibHash_3update, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_9_ZLibHash_3update(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_bytes = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_bytes_2,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bytes_2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("update", 1, 2, 2, 1); __PYX_ERR(0, 1639, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "update") < 0)) __PYX_ERR(0, 1639, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_bytes = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("update", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1639, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric._ZLibHash.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_9_ZLibHash_2update(__pyx_self, __pyx_v_self, __pyx_v_bytes);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_9_ZLibHash_2update(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_bytes) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("update", 0);

  /* "mathics/builtin/numeric.py":1640
 * 
 *     def update(self, bytes):
 *         self._bytes += bytes             # <<<<<<<<<<<<<<
 * 
 *     def hexdigest(self):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_bytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1640, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_v_bytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1640, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_bytes, __pyx_t_2) < 0) __PYX_ERR(0, 1640, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":1639
 *         self._fn = fn
 * 
 *     def update(self, bytes):             # <<<<<<<<<<<<<<
 *         self._bytes += bytes
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("mathics.builtin.numeric._ZLibHash.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1642
 *         self._bytes += bytes
 * 
 *     def hexdigest(self):             # <<<<<<<<<<<<<<
 *         return format(self._fn(self._bytes), "x")
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_9_ZLibHash_5hexdigest(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_9_ZLibHash_5hexdigest = {"hexdigest", (PyCFunction)__pyx_pw_7mathics_7builtin_7numeric_9_ZLibHash_5hexdigest, METH_O, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_9_ZLibHash_5hexdigest(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("hexdigest (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_9_ZLibHash_4hexdigest(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_9_ZLibHash_4hexdigest(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("hexdigest", 0);

  /* "mathics/builtin/numeric.py":1643
 * 
 *     def hexdigest(self):
 *         return format(self._fn(self._bytes), "x")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_fn_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1643, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_bytes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1643, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1643, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1643, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_INCREF(__pyx_n_u_x);
  __Pyx_GIVEREF(__pyx_n_u_x);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_n_u_x);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_format, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1643, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/builtin/numeric.py":1642
 *         self._bytes += bytes
 * 
 *     def hexdigest(self):             # <<<<<<<<<<<<<<
 *         return format(self._fn(self._bytes), "x")
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("mathics.builtin.numeric._ZLibHash.hexdigest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1686
 *     # FIXME md2
 *     _supported_hashes = {
 *         "Adler32": lambda: _ZLibHash(zlib.adler32),             # <<<<<<<<<<<<<<
 *         "CRC32": lambda: _ZLibHash(zlib.crc32),
 *         "MD5": hashlib.md5,
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_4Hash_4lambda12(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_4Hash_4lambda12 = {"lambda12", (PyCFunction)__pyx_pw_7mathics_7builtin_7numeric_4Hash_4lambda12, METH_NOARGS, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_4Hash_4lambda12(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lambda12 (wrapper)", 0);
  __pyx_r = __pyx_lambda_funcdef_7mathics_7builtin_7numeric_4Hash_lambda12(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_lambda_funcdef_7mathics_7builtin_7numeric_4Hash_lambda12(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lambda12", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ZLibHash); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1686, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_zlib); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1686, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_adler32); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1686, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1686, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("mathics.builtin.numeric.Hash.lambda12", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1687
 *     _supported_hashes = {
 *         "Adler32": lambda: _ZLibHash(zlib.adler32),
 *         "CRC32": lambda: _ZLibHash(zlib.crc32),             # <<<<<<<<<<<<<<
 *         "MD5": hashlib.md5,
 *         "SHA": hashlib.sha1,
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_4Hash_5lambda13(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_4Hash_5lambda13 = {"lambda13", (PyCFunction)__pyx_pw_7mathics_7builtin_7numeric_4Hash_5lambda13, METH_NOARGS, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_4Hash_5lambda13(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lambda13 (wrapper)", 0);
  __pyx_r = __pyx_lambda_funcdef_7mathics_7builtin_7numeric_4Hash_lambda13(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_lambda_funcdef_7mathics_7builtin_7numeric_4Hash_lambda13(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lambda13", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ZLibHash); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1687, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_zlib); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1687, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_crc32); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1687, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1687, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("mathics.builtin.numeric.Hash.lambda13", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1697
 * 
 *     @staticmethod
 *     def compute(user_hash, py_hashtype, py_format):             # <<<<<<<<<<<<<<
 *         hash_func = Hash._supported_hashes.get(py_hashtype)
 *         if hash_func is None:  # unknown hash function?
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_4Hash_1compute(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_4Hash_1compute = {"compute", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_4Hash_1compute, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_4Hash_1compute(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_user_hash = 0;
  PyObject *__pyx_v_py_hashtype = 0;
  PyObject *__pyx_v_py_format = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("compute (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_user_hash,&__pyx_n_s_py_hashtype,&__pyx_n_s_py_format,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_hash)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_py_hashtype)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("compute", 1, 3, 3, 1); __PYX_ERR(0, 1697, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_py_format)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("compute", 1, 3, 3, 2); __PYX_ERR(0, 1697, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "compute") < 0)) __PYX_ERR(0, 1697, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_user_hash = values[0];
    __pyx_v_py_hashtype = values[1];
    __pyx_v_py_format = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("compute", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1697, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.Hash.compute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_4Hash_compute(__pyx_self, __pyx_v_user_hash, __pyx_v_py_hashtype, __pyx_v_py_format);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_4Hash_compute(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_user_hash, PyObject *__pyx_v_py_hashtype, PyObject *__pyx_v_py_format) {
  PyObject *__pyx_v_hash_func = NULL;
  PyObject *__pyx_v_h = NULL;
  PyObject *__pyx_v_res = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("compute", 0);

  /* "mathics/builtin/numeric.py":1698
 *     @staticmethod
 *     def compute(user_hash, py_hashtype, py_format):
 *         hash_func = Hash._supported_hashes.get(py_hashtype)             # <<<<<<<<<<<<<<
 *         if hash_func is None:  # unknown hash function?
 *             return  # in order to return original Expression
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Hash); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1698, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_supported_hashes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1698, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1698, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_py_hashtype) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_py_hashtype);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1698, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_hash_func = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":1699
 *     def compute(user_hash, py_hashtype, py_format):
 *         hash_func = Hash._supported_hashes.get(py_hashtype)
 *         if hash_func is None:  # unknown hash function?             # <<<<<<<<<<<<<<
 *             return  # in order to return original Expression
 *         h = hash_func()
 */
  __pyx_t_4 = (__pyx_v_hash_func == Py_None);
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "mathics/builtin/numeric.py":1700
 *         hash_func = Hash._supported_hashes.get(py_hashtype)
 *         if hash_func is None:  # unknown hash function?
 *             return  # in order to return original Expression             # <<<<<<<<<<<<<<
 *         h = hash_func()
 *         user_hash(h.update)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "mathics/builtin/numeric.py":1699
 *     def compute(user_hash, py_hashtype, py_format):
 *         hash_func = Hash._supported_hashes.get(py_hashtype)
 *         if hash_func is None:  # unknown hash function?             # <<<<<<<<<<<<<<
 *             return  # in order to return original Expression
 *         h = hash_func()
 */
  }

  /* "mathics/builtin/numeric.py":1701
 *         if hash_func is None:  # unknown hash function?
 *             return  # in order to return original Expression
 *         h = hash_func()             # <<<<<<<<<<<<<<
 *         user_hash(h.update)
 *         res = h.hexdigest()
 */
  __Pyx_INCREF(__pyx_v_hash_func);
  __pyx_t_2 = __pyx_v_hash_func; __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1701, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_h = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":1702
 *             return  # in order to return original Expression
 *         h = hash_func()
 *         user_hash(h.update)             # <<<<<<<<<<<<<<
 *         res = h.hexdigest()
 *         if py_format in ("HexString", "HexStringLittleEndian"):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_h, __pyx_n_s_update); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1702, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_user_hash);
  __pyx_t_3 = __pyx_v_user_hash; __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1702, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":1703
 *         h = hash_func()
 *         user_hash(h.update)
 *         res = h.hexdigest()             # <<<<<<<<<<<<<<
 *         if py_format in ("HexString", "HexStringLittleEndian"):
 *             return from_python(res)
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_h, __pyx_n_s_hexdigest); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1703, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1703, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_res = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":1704
 *         user_hash(h.update)
 *         res = h.hexdigest()
 *         if py_format in ("HexString", "HexStringLittleEndian"):             # <<<<<<<<<<<<<<
 *             return from_python(res)
 *         res = int(res, 16)
 */
  __Pyx_INCREF(__pyx_v_py_format);
  __pyx_t_1 = __pyx_v_py_format;
  __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_n_u_HexString, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1704, __pyx_L1_error)
  if (!__pyx_t_4) {
  } else {
    __pyx_t_5 = __pyx_t_4;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_t_1, __pyx_n_u_HexStringLittleEndian, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1704, __pyx_L1_error)
  __pyx_t_5 = __pyx_t_4;
  __pyx_L5_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = (__pyx_t_5 != 0);
  if (__pyx_t_4) {

    /* "mathics/builtin/numeric.py":1705
 *         res = h.hexdigest()
 *         if py_format in ("HexString", "HexStringLittleEndian"):
 *             return from_python(res)             # <<<<<<<<<<<<<<
 *         res = int(res, 16)
 *         if py_format == "DecimalString":
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_from_python); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1705, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_res) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_res);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1705, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "mathics/builtin/numeric.py":1704
 *         user_hash(h.update)
 *         res = h.hexdigest()
 *         if py_format in ("HexString", "HexStringLittleEndian"):             # <<<<<<<<<<<<<<
 *             return from_python(res)
 *         res = int(res, 16)
 */
  }

  /* "mathics/builtin/numeric.py":1706
 *         if py_format in ("HexString", "HexStringLittleEndian"):
 *             return from_python(res)
 *         res = int(res, 16)             # <<<<<<<<<<<<<<
 *         if py_format == "DecimalString":
 *             return from_python(str(res))
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1706, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_res);
  __Pyx_GIVEREF(__pyx_v_res);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_res);
  __Pyx_INCREF(__pyx_int_16);
  __Pyx_GIVEREF(__pyx_int_16);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_16);
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)(&PyInt_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1706, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF_SET(__pyx_v_res, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "mathics/builtin/numeric.py":1707
 *             return from_python(res)
 *         res = int(res, 16)
 *         if py_format == "DecimalString":             # <<<<<<<<<<<<<<
 *             return from_python(str(res))
 *         elif py_format == "ByteArray":
 */
  __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_v_py_format, __pyx_n_u_DecimalString, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1707, __pyx_L1_error)
  if (__pyx_t_4) {

    /* "mathics/builtin/numeric.py":1708
 *         res = int(res, 16)
 *         if py_format == "DecimalString":
 *             return from_python(str(res))             # <<<<<<<<<<<<<<
 *         elif py_format == "ByteArray":
 *             return from_python(bytearray(res))
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_from_python); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1708, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_res); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1708, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1708, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "mathics/builtin/numeric.py":1707
 *             return from_python(res)
 *         res = int(res, 16)
 *         if py_format == "DecimalString":             # <<<<<<<<<<<<<<
 *             return from_python(str(res))
 *         elif py_format == "ByteArray":
 */
  }

  /* "mathics/builtin/numeric.py":1709
 *         if py_format == "DecimalString":
 *             return from_python(str(res))
 *         elif py_format == "ByteArray":             # <<<<<<<<<<<<<<
 *             return from_python(bytearray(res))
 *         return from_python(res)
 */
  __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_v_py_format, __pyx_n_u_ByteArray, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1709, __pyx_L1_error)
  if (__pyx_t_4) {

    /* "mathics/builtin/numeric.py":1710
 *             return from_python(str(res))
 *         elif py_format == "ByteArray":
 *             return from_python(bytearray(res))             # <<<<<<<<<<<<<<
 *         return from_python(res)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_from_python); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1710, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyByteArray_Type)), __pyx_v_res); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1710, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1710, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "mathics/builtin/numeric.py":1709
 *         if py_format == "DecimalString":
 *             return from_python(str(res))
 *         elif py_format == "ByteArray":             # <<<<<<<<<<<<<<
 *             return from_python(bytearray(res))
 *         return from_python(res)
 */
  }

  /* "mathics/builtin/numeric.py":1711
 *         elif py_format == "ByteArray":
 *             return from_python(bytearray(res))
 *         return from_python(res)             # <<<<<<<<<<<<<<
 * 
 *     def apply(self, expr, hashtype, outformat, evaluation):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_from_python); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1711, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, __pyx_v_res) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_res);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1711, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "mathics/builtin/numeric.py":1697
 * 
 *     @staticmethod
 *     def compute(user_hash, py_hashtype, py_format):             # <<<<<<<<<<<<<<
 *         hash_func = Hash._supported_hashes.get(py_hashtype)
 *         if hash_func is None:  # unknown hash function?
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("mathics.builtin.numeric.Hash.compute", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_hash_func);
  __Pyx_XDECREF(__pyx_v_h);
  __Pyx_XDECREF(__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1713
 *         return from_python(res)
 * 
 *     def apply(self, expr, hashtype, outformat, evaluation):             # <<<<<<<<<<<<<<
 *         "Hash[expr_, hashtype_String, outformat_String]"
 *         return Hash.compute(
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_4Hash_3apply(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7mathics_7builtin_7numeric_4Hash_2apply[] = "Hash[expr_, hashtype_String, outformat_String]";
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_4Hash_3apply = {"apply", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_4Hash_3apply, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7mathics_7builtin_7numeric_4Hash_2apply};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_4Hash_3apply(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_expr = 0;
  PyObject *__pyx_v_hashtype = 0;
  PyObject *__pyx_v_outformat = 0;
  CYTHON_UNUSED PyObject *__pyx_v_evaluation = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("apply (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_expr,&__pyx_n_s_hashtype,&__pyx_n_s_outformat,&__pyx_n_s_evaluation,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_expr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply", 1, 5, 5, 1); __PYX_ERR(0, 1713, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hashtype)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply", 1, 5, 5, 2); __PYX_ERR(0, 1713, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outformat)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply", 1, 5, 5, 3); __PYX_ERR(0, 1713, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_evaluation)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply", 1, 5, 5, 4); __PYX_ERR(0, 1713, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply") < 0)) __PYX_ERR(0, 1713, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
    }
    __pyx_v_self = values[0];
    __pyx_v_expr = values[1];
    __pyx_v_hashtype = values[2];
    __pyx_v_outformat = values[3];
    __pyx_v_evaluation = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("apply", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1713, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.Hash.apply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_4Hash_2apply(__pyx_self, __pyx_v_self, __pyx_v_expr, __pyx_v_hashtype, __pyx_v_outformat, __pyx_v_evaluation);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_4Hash_2apply(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_expr, PyObject *__pyx_v_hashtype, PyObject *__pyx_v_outformat, CYTHON_UNUSED PyObject *__pyx_v_evaluation) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("apply", 0);

  /* "mathics/builtin/numeric.py":1715
 *     def apply(self, expr, hashtype, outformat, evaluation):
 *         "Hash[expr_, hashtype_String, outformat_String]"
 *         return Hash.compute(             # <<<<<<<<<<<<<<
 *             expr.user_hash, hashtype.get_string_value(), outformat.get_string_value()
 *         )
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Hash); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1715, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_compute); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1715, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":1716
 *         "Hash[expr_, hashtype_String, outformat_String]"
 *         return Hash.compute(
 *             expr.user_hash, hashtype.get_string_value(), outformat.get_string_value()             # <<<<<<<<<<<<<<
 *         )
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_expr, __pyx_n_s_user_hash); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1716, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_hashtype, __pyx_n_s_get_string_value); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1716, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1716, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_outformat, __pyx_n_s_get_string_value); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1716, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1716, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_2, __pyx_t_4, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1715, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_2, __pyx_t_4, __pyx_t_5};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1715, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1715, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_8, __pyx_t_5);
    __pyx_t_2 = 0;
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1715, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/builtin/numeric.py":1713
 *         return from_python(res)
 * 
 *     def apply(self, expr, hashtype, outformat, evaluation):             # <<<<<<<<<<<<<<
 *         "Hash[expr_, hashtype_String, outformat_String]"
 *         return Hash.compute(
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("mathics.builtin.numeric.Hash.apply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1721
 * 
 * class TypeEscalation(Exception):
 *     def __init__(self, mode):             # <<<<<<<<<<<<<<
 *         self.mode = mode
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_14TypeEscalation_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_14TypeEscalation_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_14TypeEscalation_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_14TypeEscalation_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_mode = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_mode,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 1721, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 1721, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_mode = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1721, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.TypeEscalation.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_14TypeEscalation___init__(__pyx_self, __pyx_v_self, __pyx_v_mode);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_14TypeEscalation___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_mode) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "mathics/builtin/numeric.py":1722
 * class TypeEscalation(Exception):
 *     def __init__(self, mode):
 *         self.mode = mode             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_mode, __pyx_v_mode) < 0) __PYX_ERR(0, 1722, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1721
 * 
 * class TypeEscalation(Exception):
 *     def __init__(self, mode):             # <<<<<<<<<<<<<<
 *         self.mode = mode
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.TypeEscalation.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1745
 *         ),
 *         SYMBOLIC: ComputationFunctions(
 *             cos=lambda x: Expression("Cos", x),             # <<<<<<<<<<<<<<
 *             sin=lambda x: Expression("Sin", x),
 *         ),
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_4Fold_9lambda14(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_4Fold_9lambda14 = {"lambda14", (PyCFunction)__pyx_pw_7mathics_7builtin_7numeric_4Fold_9lambda14, METH_O, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_4Fold_9lambda14(PyObject *__pyx_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lambda14 (wrapper)", 0);
  __pyx_r = __pyx_lambda_funcdef_7mathics_7builtin_7numeric_4Fold_lambda14(__pyx_self, ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_lambda_funcdef_7mathics_7builtin_7numeric_4Fold_lambda14(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lambda14", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Expression); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1745, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_n_u_Cos, __pyx_v_x};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1745, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_n_u_Cos, __pyx_v_x};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1745, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1745, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_n_u_Cos);
    __Pyx_GIVEREF(__pyx_n_u_Cos);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_n_u_Cos);
    __Pyx_INCREF(__pyx_v_x);
    __Pyx_GIVEREF(__pyx_v_x);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_x);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1745, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("mathics.builtin.numeric.Fold.lambda14", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1746
 *         SYMBOLIC: ComputationFunctions(
 *             cos=lambda x: Expression("Cos", x),
 *             sin=lambda x: Expression("Sin", x),             # <<<<<<<<<<<<<<
 *         ),
 *     }
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_4Fold_10lambda15(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_4Fold_10lambda15 = {"lambda15", (PyCFunction)__pyx_pw_7mathics_7builtin_7numeric_4Fold_10lambda15, METH_O, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_4Fold_10lambda15(PyObject *__pyx_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lambda15 (wrapper)", 0);
  __pyx_r = __pyx_lambda_funcdef_7mathics_7builtin_7numeric_4Fold_lambda15(__pyx_self, ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_lambda_funcdef_7mathics_7builtin_7numeric_4Fold_lambda15(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lambda15", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Expression); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1746, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_n_u_Sin, __pyx_v_x};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1746, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_n_u_Sin, __pyx_v_x};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1746, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1746, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_n_u_Sin);
    __Pyx_GIVEREF(__pyx_n_u_Sin);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_n_u_Sin);
    __Pyx_INCREF(__pyx_v_x);
    __Pyx_GIVEREF(__pyx_v_x);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_x);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1746, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("mathics.builtin.numeric.Fold.lambda15", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1751
 * 
 *     operands = {
 *         FLOAT: lambda x: None if x is None else x.round_to_float(),             # <<<<<<<<<<<<<<
 *         MPMATH: lambda x: None if x is None else x.to_mpmath(),
 *         SYMBOLIC: lambda x: x,
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_4Fold_11lambda16(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_4Fold_11lambda16 = {"lambda16", (PyCFunction)__pyx_pw_7mathics_7builtin_7numeric_4Fold_11lambda16, METH_O, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_4Fold_11lambda16(PyObject *__pyx_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lambda16 (wrapper)", 0);
  __pyx_r = __pyx_lambda_funcdef_7mathics_7builtin_7numeric_4Fold_lambda16(__pyx_self, ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_lambda_funcdef_7mathics_7builtin_7numeric_4Fold_lambda16(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lambda16", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = (__pyx_v_x == Py_None);
  if ((__pyx_t_2 != 0)) {
    __Pyx_INCREF(Py_None);
    __pyx_t_1 = Py_None;
  } else {
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_x, __pyx_n_s_round_to_float); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1751, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1751, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("mathics.builtin.numeric.Fold.lambda16", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1752
 *     operands = {
 *         FLOAT: lambda x: None if x is None else x.round_to_float(),
 *         MPMATH: lambda x: None if x is None else x.to_mpmath(),             # <<<<<<<<<<<<<<
 *         SYMBOLIC: lambda x: x,
 *     }
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_4Fold_12lambda17(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_4Fold_12lambda17 = {"lambda17", (PyCFunction)__pyx_pw_7mathics_7builtin_7numeric_4Fold_12lambda17, METH_O, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_4Fold_12lambda17(PyObject *__pyx_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lambda17 (wrapper)", 0);
  __pyx_r = __pyx_lambda_funcdef_7mathics_7builtin_7numeric_4Fold_lambda17(__pyx_self, ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_lambda_funcdef_7mathics_7builtin_7numeric_4Fold_lambda17(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lambda17", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = (__pyx_v_x == Py_None);
  if ((__pyx_t_2 != 0)) {
    __Pyx_INCREF(Py_None);
    __pyx_t_1 = Py_None;
  } else {
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_x, __pyx_n_s_to_mpmath); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1752, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1752, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("mathics.builtin.numeric.Fold.lambda17", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1753
 *         FLOAT: lambda x: None if x is None else x.round_to_float(),
 *         MPMATH: lambda x: None if x is None else x.to_mpmath(),
 *         SYMBOLIC: lambda x: x,             # <<<<<<<<<<<<<<
 *     }
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_4Fold_13lambda18(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_4Fold_13lambda18 = {"lambda18", (PyCFunction)__pyx_pw_7mathics_7builtin_7numeric_4Fold_13lambda18, METH_O, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_4Fold_13lambda18(PyObject *__pyx_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lambda18 (wrapper)", 0);
  __pyx_r = __pyx_lambda_funcdef_7mathics_7builtin_7numeric_4Fold_lambda18(__pyx_self, ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_lambda_funcdef_7mathics_7builtin_7numeric_4Fold_lambda18(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lambda18", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_x);
  __pyx_r = __pyx_v_x;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1756
 *     }
 * 
 *     def _operands(self, state, steps):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_4Fold_1_operands(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_4Fold_1_operands = {"_operands", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_4Fold_1_operands, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_4Fold_1_operands(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_state = 0;
  CYTHON_UNUSED PyObject *__pyx_v_steps = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_operands (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_state,&__pyx_n_s_steps,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_operands", 1, 3, 3, 1); __PYX_ERR(0, 1756, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_steps)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_operands", 1, 3, 3, 2); __PYX_ERR(0, 1756, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_operands") < 0)) __PYX_ERR(0, 1756, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_state = values[1];
    __pyx_v_steps = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_operands", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1756, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.Fold._operands", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_4Fold__operands(__pyx_self, __pyx_v_self, __pyx_v_state, __pyx_v_steps);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_4Fold__operands(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_state, CYTHON_UNUSED PyObject *__pyx_v_steps) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_operands", 0);

  /* "mathics/builtin/numeric.py":1757
 * 
 *     def _operands(self, state, steps):
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     def _fold(self, state, steps, math):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(0, 1757, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1756
 *     }
 * 
 *     def _operands(self, state, steps):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.Fold._operands", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1759
 *         raise NotImplementedError
 * 
 *     def _fold(self, state, steps, math):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_4Fold_3_fold(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_4Fold_3_fold = {"_fold", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_4Fold_3_fold, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_4Fold_3_fold(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_state = 0;
  CYTHON_UNUSED PyObject *__pyx_v_steps = 0;
  CYTHON_UNUSED PyObject *__pyx_v_math = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_fold (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_state,&__pyx_n_s_steps,&__pyx_n_s_math,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_fold", 1, 4, 4, 1); __PYX_ERR(0, 1759, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_steps)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_fold", 1, 4, 4, 2); __PYX_ERR(0, 1759, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_math)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_fold", 1, 4, 4, 3); __PYX_ERR(0, 1759, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_fold") < 0)) __PYX_ERR(0, 1759, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_self = values[0];
    __pyx_v_state = values[1];
    __pyx_v_steps = values[2];
    __pyx_v_math = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_fold", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1759, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.Fold._fold", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_4Fold_2_fold(__pyx_self, __pyx_v_self, __pyx_v_state, __pyx_v_steps, __pyx_v_math);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_4Fold_2_fold(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_state, CYTHON_UNUSED PyObject *__pyx_v_steps, CYTHON_UNUSED PyObject *__pyx_v_math) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_fold", 0);

  /* "mathics/builtin/numeric.py":1760
 * 
 *     def _fold(self, state, steps, math):
 *         raise NotImplementedError             # <<<<<<<<<<<<<<
 * 
 *     def _spans(self, operands):
 */
  __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
  __PYX_ERR(0, 1760, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1759
 *         raise NotImplementedError
 * 
 *     def _fold(self, state, steps, math):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.Fold._fold", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1762
 *         raise NotImplementedError
 * 
 *     def _spans(self, operands):             # <<<<<<<<<<<<<<
 *         spans = {}
 *         k = 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_4Fold_5_spans(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_4Fold_5_spans = {"_spans", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_4Fold_5_spans, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_4Fold_5_spans(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_operands = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_spans (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_operands,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_operands)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_spans", 1, 2, 2, 1); __PYX_ERR(0, 1762, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_spans") < 0)) __PYX_ERR(0, 1762, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_operands = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_spans", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1762, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.Fold._spans", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_4Fold_4_spans(__pyx_self, __pyx_v_self, __pyx_v_operands);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_4Fold_4_spans(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_operands) {
  PyObject *__pyx_v_spans = NULL;
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_v_j = NULL;
  PyObject *__pyx_v_mode = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_operand = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_spans", 0);

  /* "mathics/builtin/numeric.py":1763
 * 
 *     def _spans(self, operands):
 *         spans = {}             # <<<<<<<<<<<<<<
 *         k = 0
 *         j = 0
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1763, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_spans = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":1764
 *     def _spans(self, operands):
 *         spans = {}
 *         k = 0             # <<<<<<<<<<<<<<
 *         j = 0
 * 
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_k = __pyx_int_0;

  /* "mathics/builtin/numeric.py":1765
 *         spans = {}
 *         k = 0
 *         j = 0             # <<<<<<<<<<<<<<
 * 
 *         for mode in (self.FLOAT, self.MPMATH):
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_j = __pyx_int_0;

  /* "mathics/builtin/numeric.py":1767
 *         j = 0
 * 
 *         for mode in (self.FLOAT, self.MPMATH):             # <<<<<<<<<<<<<<
 *             for i, operand in enumerate(operands[k:]):
 *                 if operand[0] > mode:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_FLOAT); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1767, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_MPMATH); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1767, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1767, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    if (__pyx_t_4 >= 2) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1767, __pyx_L1_error)
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1767, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_mode, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "mathics/builtin/numeric.py":1768
 * 
 *         for mode in (self.FLOAT, self.MPMATH):
 *             for i, operand in enumerate(operands[k:]):             # <<<<<<<<<<<<<<
 *                 if operand[0] > mode:
 *                     break
 */
    __Pyx_INCREF(__pyx_int_0);
    __pyx_t_3 = __pyx_int_0;
    __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_operands, 0, 0, &__pyx_v_k, NULL, NULL, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1768, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
      __pyx_t_5 = __pyx_t_1; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0;
      __pyx_t_7 = NULL;
    } else {
      __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1768, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1768, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    for (;;) {
      if (likely(!__pyx_t_7)) {
        if (likely(PyList_CheckExact(__pyx_t_5))) {
          if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 1768, __pyx_L1_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1768, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        } else {
          if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 1768, __pyx_L1_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1768, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        }
      } else {
        __pyx_t_1 = __pyx_t_7(__pyx_t_5);
        if (unlikely(!__pyx_t_1)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 1768, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_XDECREF_SET(__pyx_v_operand, __pyx_t_1);
      __pyx_t_1 = 0;
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
      __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1768, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3);
      __pyx_t_3 = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "mathics/builtin/numeric.py":1769
 *         for mode in (self.FLOAT, self.MPMATH):
 *             for i, operand in enumerate(operands[k:]):
 *                 if operand[0] > mode:             # <<<<<<<<<<<<<<
 *                     break
 *                 j = i + k + 1
 */
      __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_operand, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1769, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_8 = PyObject_RichCompare(__pyx_t_1, __pyx_v_mode, Py_GT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1769, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 1769, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (__pyx_t_9) {

        /* "mathics/builtin/numeric.py":1770
 *             for i, operand in enumerate(operands[k:]):
 *                 if operand[0] > mode:
 *                     break             # <<<<<<<<<<<<<<
 *                 j = i + k + 1
 * 
 */
        goto __pyx_L6_break;

        /* "mathics/builtin/numeric.py":1769
 *         for mode in (self.FLOAT, self.MPMATH):
 *             for i, operand in enumerate(operands[k:]):
 *                 if operand[0] > mode:             # <<<<<<<<<<<<<<
 *                     break
 *                 j = i + k + 1
 */
      }

      /* "mathics/builtin/numeric.py":1771
 *                 if operand[0] > mode:
 *                     break
 *                 j = i + k + 1             # <<<<<<<<<<<<<<
 * 
 *             if k == 0 and j == 1:  # only init state? then ignore.
 */
      __pyx_t_8 = PyNumber_Add(__pyx_v_i, __pyx_v_k); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1771, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_t_8, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1771, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF_SET(__pyx_v_j, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "mathics/builtin/numeric.py":1768
 * 
 *         for mode in (self.FLOAT, self.MPMATH):
 *             for i, operand in enumerate(operands[k:]):             # <<<<<<<<<<<<<<
 *                 if operand[0] > mode:
 *                     break
 */
    }
    __pyx_L6_break:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "mathics/builtin/numeric.py":1773
 *                 j = i + k + 1
 * 
 *             if k == 0 and j == 1:  # only init state? then ignore.             # <<<<<<<<<<<<<<
 *                 j = 0
 * 
 */
    __pyx_t_3 = __Pyx_PyInt_EqObjC(__pyx_v_k, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1773, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1773, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_10) {
    } else {
      __pyx_t_9 = __pyx_t_10;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_3 = __Pyx_PyInt_EqObjC(__pyx_v_j, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1773, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1773, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_9 = __pyx_t_10;
    __pyx_L9_bool_binop_done:;
    if (__pyx_t_9) {

      /* "mathics/builtin/numeric.py":1774
 * 
 *             if k == 0 and j == 1:  # only init state? then ignore.
 *                 j = 0             # <<<<<<<<<<<<<<
 * 
 *             spans[mode] = slice(k, j)
 */
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_DECREF_SET(__pyx_v_j, __pyx_int_0);

      /* "mathics/builtin/numeric.py":1773
 *                 j = i + k + 1
 * 
 *             if k == 0 and j == 1:  # only init state? then ignore.             # <<<<<<<<<<<<<<
 *                 j = 0
 * 
 */
    }

    /* "mathics/builtin/numeric.py":1776
 *                 j = 0
 * 
 *             spans[mode] = slice(k, j)             # <<<<<<<<<<<<<<
 *             k = j
 * 
 */
    __pyx_t_3 = PySlice_New(__pyx_v_k, __pyx_v_j, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1776, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely(PyDict_SetItem(__pyx_v_spans, __pyx_v_mode, __pyx_t_3) < 0)) __PYX_ERR(0, 1776, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "mathics/builtin/numeric.py":1777
 * 
 *             spans[mode] = slice(k, j)
 *             k = j             # <<<<<<<<<<<<<<
 * 
 *         spans[self.SYMBOLIC] = slice(k, len(operands))
 */
    __Pyx_INCREF(__pyx_v_j);
    __Pyx_DECREF_SET(__pyx_v_k, __pyx_v_j);

    /* "mathics/builtin/numeric.py":1767
 *         j = 0
 * 
 *         for mode in (self.FLOAT, self.MPMATH):             # <<<<<<<<<<<<<<
 *             for i, operand in enumerate(operands[k:]):
 *                 if operand[0] > mode:
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":1779
 *             k = j
 * 
 *         spans[self.SYMBOLIC] = slice(k, len(operands))             # <<<<<<<<<<<<<<
 * 
 *         return spans
 */
  __pyx_t_4 = PyObject_Length(__pyx_v_operands); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1779, __pyx_L1_error)
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PySlice_New(__pyx_v_k, __pyx_t_2, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_SYMBOLIC); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(PyDict_SetItem(__pyx_v_spans, __pyx_t_2, __pyx_t_3) < 0)) __PYX_ERR(0, 1779, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "mathics/builtin/numeric.py":1781
 *         spans[self.SYMBOLIC] = slice(k, len(operands))
 * 
 *         return spans             # <<<<<<<<<<<<<<
 * 
 *     def fold(self, x, ll):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_spans);
  __pyx_r = __pyx_v_spans;
  goto __pyx_L0;

  /* "mathics/builtin/numeric.py":1762
 *         raise NotImplementedError
 * 
 *     def _spans(self, operands):             # <<<<<<<<<<<<<<
 *         spans = {}
 *         k = 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("mathics.builtin.numeric.Fold._spans", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_spans);
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_j);
  __Pyx_XDECREF(__pyx_v_mode);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_operand);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7mathics_7builtin_7numeric_4Fold_8generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "mathics/builtin/numeric.py":1783
 *         return spans
 * 
 *     def fold(self, x, ll):             # <<<<<<<<<<<<<<
 *         # computes fold(x, ll) with the internal _fold function. will start
 *         # its evaluation machine precision, and will escalate to arbitrary
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_4Fold_7fold(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_4Fold_7fold = {"fold", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7mathics_7builtin_7numeric_4Fold_7fold, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_4Fold_7fold(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_ll = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fold (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_x,&__pyx_n_s_ll,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fold", 1, 3, 3, 1); __PYX_ERR(0, 1783, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ll)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fold", 1, 3, 3, 2); __PYX_ERR(0, 1783, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fold") < 0)) __PYX_ERR(0, 1783, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_x = values[1];
    __pyx_v_ll = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fold", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1783, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.Fold.fold", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_4Fold_6fold(__pyx_self, __pyx_v_self, __pyx_v_x, __pyx_v_ll);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7mathics_7builtin_7numeric_4Fold_4fold_14generator6(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "mathics/builtin/numeric.py":1840
 *                 if init is not None:
 *                     c_init = tuple(
 *                         (None if t is None else as_operand(from_python(t)))             # <<<<<<<<<<<<<<
 *                         for t in init
 *                     )
 */

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_4Fold_4fold_12genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr *)__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr(__pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1840, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7mathics_7builtin_7numeric_4Fold_4fold_14generator6, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_Fold_fold_locals_genexpr, __pyx_n_s_mathics_builtin_numeric); if (unlikely(!gen)) __PYX_ERR(0, 1840, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.Fold.fold.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_7mathics_7builtin_7numeric_4Fold_4fold_14generator6(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1840, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1841
 *                     c_init = tuple(
 *                         (None if t is None else as_operand(from_python(t)))
 *                         for t in init             # <<<<<<<<<<<<<<
 *                     )
 *                 else:
 */
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_init)) { __Pyx_RaiseClosureNameError("init"); __PYX_ERR(0, 1841, __pyx_L1_error) }
  if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_init == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 1841, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_init; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 1841, __pyx_L1_error)
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1841, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_t);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_t, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;

    /* "mathics/builtin/numeric.py":1840
 *                 if init is not None:
 *                     c_init = tuple(
 *                         (None if t is None else as_operand(from_python(t)))             # <<<<<<<<<<<<<<
 *                         for t in init
 *                     )
 */
    __pyx_t_4 = (__pyx_cur_scope->__pyx_v_t == Py_None);
    if ((__pyx_t_4 != 0)) {
      __Pyx_INCREF(Py_None);
      __pyx_t_3 = Py_None;
    } else {
      if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_as_operand)) { __Pyx_RaiseClosureNameError("as_operand"); __PYX_ERR(0, 1840, __pyx_L1_error) }
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_from_python); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1840, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_cur_scope->__pyx_v_t) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_cur_scope->__pyx_v_t);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1840, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_INCREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_as_operand);
      __pyx_t_7 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_as_operand; __pyx_t_8 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1840, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_5 = 0;
    }
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    __Pyx_XGIVEREF(__pyx_t_1);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_cur_scope->__pyx_t_0 = 0;
    __Pyx_XGOTREF(__pyx_t_1);
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1840, __pyx_L1_error)

    /* "mathics/builtin/numeric.py":1841
 *                     c_init = tuple(
 *                         (None if t is None else as_operand(from_python(t)))
 *                         for t in init             # <<<<<<<<<<<<<<
 *                     )
 *                 else:
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "mathics/builtin/numeric.py":1840
 *                 if init is not None:
 *                     c_init = tuple(
 *                         (None if t is None else as_operand(from_python(t)))             # <<<<<<<<<<<<<<
 *                         for t in init
 *                     )
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7mathics_7builtin_7numeric_4Fold_4fold_17generator7(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "mathics/builtin/numeric.py":1845
 *                 else:
 *                     c_init = next(c_operands)
 *                     init = tuple((None if t is None else out(t)) for t in c_init)             # <<<<<<<<<<<<<<
 * 
 *                 generator = self._fold(c_init, c_operands, self.math.get(mode))
 */

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_4Fold_4fold_15genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr *)__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr(__pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1845, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7mathics_7builtin_7numeric_4Fold_4fold_17generator7, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_Fold_fold_locals_genexpr, __pyx_n_s_mathics_builtin_numeric); if (unlikely(!gen)) __PYX_ERR(0, 1845, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.Fold.fold.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_7mathics_7builtin_7numeric_4Fold_4fold_17generator7(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1845, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_c_init)) { __Pyx_RaiseClosureNameError("c_init"); __PYX_ERR(0, 1845, __pyx_L1_error) }
  if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_c_init)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_c_init)) {
    __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_c_init; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_c_init); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1845, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1845, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 1845, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1845, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 1845, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1845, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1845, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_t);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_t, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_5 = (__pyx_cur_scope->__pyx_v_t == Py_None);
    if ((__pyx_t_5 != 0)) {
      __Pyx_INCREF(Py_None);
      __pyx_t_4 = Py_None;
    } else {
      if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_out)) { __Pyx_RaiseClosureNameError("out"); __PYX_ERR(0, 1845, __pyx_L1_error) }
      __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_out, __pyx_cur_scope->__pyx_v_t); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1845, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_4 = __pyx_t_6;
      __pyx_t_6 = 0;
    }
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XGIVEREF(__pyx_t_1);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_cur_scope->__pyx_t_0 = 0;
    __Pyx_XGOTREF(__pyx_t_1);
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1845, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7mathics_7builtin_7numeric_4Fold_4fold_20generator8(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "mathics/builtin/numeric.py":1850
 * 
 *                 for y in generator:
 *                     y = tuple(out(t) for t in y)             # <<<<<<<<<<<<<<
 *                     yield y
 *                     init = y
 */

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_4Fold_4fold_18genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr *)__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr(__pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1850, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7mathics_7builtin_7numeric_4Fold_4fold_20generator8, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_Fold_fold_locals_genexpr, __pyx_n_s_mathics_builtin_numeric); if (unlikely(!gen)) __PYX_ERR(0, 1850, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.Fold.fold.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_7mathics_7builtin_7numeric_4Fold_4fold_20generator8(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1850, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_y)) { __Pyx_RaiseClosureNameError("y"); __PYX_ERR(0, 1850, __pyx_L1_error) }
  if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_y)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_y)) {
    __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_y; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_y); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1850, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1850, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 1850, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1850, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 1850, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1850, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1850, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_t);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_t, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_out)) { __Pyx_RaiseClosureNameError("out"); __PYX_ERR(0, 1850, __pyx_L1_error) }
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_out, __pyx_cur_scope->__pyx_v_t); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1850, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XGIVEREF(__pyx_t_1);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_cur_scope->__pyx_t_0 = 0;
    __Pyx_XGOTREF(__pyx_t_1);
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1850, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1783
 *         return spans
 * 
 *     def fold(self, x, ll):             # <<<<<<<<<<<<<<
 *         # computes fold(x, ll) with the internal _fold function. will start
 *         # its evaluation machine precision, and will escalate to arbitrary
 */

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_4Fold_6fold(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_ll) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("fold", 0);
  __pyx_cur_scope = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold *)__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold(__pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1783, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self);
  __pyx_cur_scope->__pyx_v_x = __pyx_v_x;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_x);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_x);
  __pyx_cur_scope->__pyx_v_ll = __pyx_v_ll;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_ll);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_ll);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7mathics_7builtin_7numeric_4Fold_8generator, __pyx_codeobj__37, (PyObject *) __pyx_cur_scope, __pyx_n_s_fold, __pyx_n_s_Fold_fold, __pyx_n_s_mathics_builtin_numeric); if (unlikely(!gen)) __PYX_ERR(0, 1783, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.Fold.fold", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7mathics_7builtin_7numeric_4Fold_4fold_2generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "mathics/builtin/numeric.py":1809
 * 
 *                 @contextmanager
 *                 def working_precision(_):             # <<<<<<<<<<<<<<
 *                     yield
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_4Fold_4fold_1working_precision(PyObject *__pyx_self, PyObject *__pyx_v__); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_4Fold_4fold_1working_precision = {"working_precision", (PyCFunction)__pyx_pw_7mathics_7builtin_7numeric_4Fold_4fold_1working_precision, METH_O, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_4Fold_4fold_1working_precision(PyObject *__pyx_self, PyObject *__pyx_v__) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("working_precision (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_4Fold_4fold_working_precision(__pyx_self, ((PyObject *)__pyx_v__));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_4Fold_4fold_working_precision(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v__) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("working_precision", 0);
  __pyx_cur_scope = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision *)__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision(__pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1809, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v__ = __pyx_v__;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v__);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v__);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7mathics_7builtin_7numeric_4Fold_4fold_2generator3, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_working_precision, __pyx_n_s_Fold_fold_locals_working_precisi, __pyx_n_s_mathics_builtin_numeric); if (unlikely(!gen)) __PYX_ERR(0, 1809, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.Fold.fold.working_precision", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_7mathics_7builtin_7numeric_4Fold_4fold_2generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision *__pyx_cur_scope = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("working_precision", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L4_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1809, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1810
 *                 @contextmanager
 *                 def working_precision(_):
 *                     yield             # <<<<<<<<<<<<<<
 * 
 *                 precision = None
 */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  /* return from generator, yielding value */
  __pyx_generator->resume_label = 1;
  return __pyx_r;
  __pyx_L4_resume_from_yield:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1810, __pyx_L1_error)
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "mathics/builtin/numeric.py":1809
 * 
 *                 @contextmanager
 *                 def working_precision(_):             # <<<<<<<<<<<<<<
 *                     yield
 * 
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("working_precision", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1816
 *             if mode == self.FLOAT:
 * 
 *                 def out(z):             # <<<<<<<<<<<<<<
 *                     return Real(z)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_4Fold_4fold_4out(PyObject *__pyx_self, PyObject *__pyx_v_z); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_4Fold_4fold_4out = {"out", (PyCFunction)__pyx_pw_7mathics_7builtin_7numeric_4Fold_4fold_4out, METH_O, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_4Fold_4fold_4out(PyObject *__pyx_self, PyObject *__pyx_v_z) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("out (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_4Fold_4fold_3out(__pyx_self, ((PyObject *)__pyx_v_z));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_4Fold_4fold_3out(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_z) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("out", 0);

  /* "mathics/builtin/numeric.py":1817
 * 
 *                 def out(z):
 *                     return Real(z)             # <<<<<<<<<<<<<<
 * 
 *             elif mode == self.MPMATH:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Real); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1817, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_z) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_z);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1817, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/builtin/numeric.py":1816
 *             if mode == self.FLOAT:
 * 
 *                 def out(z):             # <<<<<<<<<<<<<<
 *                     return Real(z)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("mathics.builtin.numeric.Fold.fold.out", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1821
 *             elif mode == self.MPMATH:
 * 
 *                 def out(z):             # <<<<<<<<<<<<<<
 *                     return Real(z, precision)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_4Fold_4fold_6out(PyObject *__pyx_self, PyObject *__pyx_v_z); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_4Fold_4fold_6out = {"out", (PyCFunction)__pyx_pw_7mathics_7builtin_7numeric_4Fold_4fold_6out, METH_O, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_4Fold_4fold_6out(PyObject *__pyx_self, PyObject *__pyx_v_z) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("out (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_4Fold_4fold_5out(__pyx_self, ((PyObject *)__pyx_v_z));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_4Fold_4fold_5out(PyObject *__pyx_self, PyObject *__pyx_v_z) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold *__pyx_cur_scope;
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold *__pyx_outer_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("out", 0);
  __pyx_outer_scope = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "mathics/builtin/numeric.py":1822
 * 
 *                 def out(z):
 *                     return Real(z, precision)             # <<<<<<<<<<<<<<
 * 
 *             else:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Real); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1822, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(!__pyx_cur_scope->__pyx_v_precision)) { __Pyx_RaiseClosureNameError("precision"); __PYX_ERR(0, 1822, __pyx_L1_error) }
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_z, __pyx_cur_scope->__pyx_v_precision};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1822, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_z, __pyx_cur_scope->__pyx_v_precision};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1822, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1822, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_v_z);
    __Pyx_GIVEREF(__pyx_v_z);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_z);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_precision);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_precision);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_cur_scope->__pyx_v_precision);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1822, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "mathics/builtin/numeric.py":1821
 *             elif mode == self.MPMATH:
 * 
 *                 def out(z):             # <<<<<<<<<<<<<<
 *                     return Real(z, precision)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("mathics.builtin.numeric.Fold.fold.out", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1826
 *             else:
 * 
 *                 def out(z):             # <<<<<<<<<<<<<<
 *                     return z
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_4Fold_4fold_8out(PyObject *__pyx_self, PyObject *__pyx_v_z); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_4Fold_4fold_8out = {"out", (PyCFunction)__pyx_pw_7mathics_7builtin_7numeric_4Fold_4fold_8out, METH_O, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_4Fold_4fold_8out(PyObject *__pyx_self, PyObject *__pyx_v_z) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("out (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_4Fold_4fold_7out(__pyx_self, ((PyObject *)__pyx_v_z));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_4Fold_4fold_7out(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_z) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("out", 0);

  /* "mathics/builtin/numeric.py":1827
 * 
 *                 def out(z):
 *                     return z             # <<<<<<<<<<<<<<
 * 
 *             as_operand = self.operands.get(mode)
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_z);
  __pyx_r = __pyx_v_z;
  goto __pyx_L0;

  /* "mathics/builtin/numeric.py":1826
 *             else:
 * 
 *                 def out(z):             # <<<<<<<<<<<<<<
 *                     return z
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7mathics_7builtin_7numeric_4Fold_4fold_11generator4(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "mathics/builtin/numeric.py":1831
 *             as_operand = self.operands.get(mode)
 * 
 *             def converted_operands():             # <<<<<<<<<<<<<<
 *                 for y in s_operands:
 *                     yield tuple(as_operand(t) for t in y)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_4Fold_4fold_10converted_operands(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_7mathics_7builtin_7numeric_4Fold_4fold_10converted_operands = {"converted_operands", (PyCFunction)__pyx_pw_7mathics_7builtin_7numeric_4Fold_4fold_10converted_operands, METH_NOARGS, 0};
static PyObject *__pyx_pw_7mathics_7builtin_7numeric_4Fold_4fold_10converted_operands(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("converted_operands (wrapper)", 0);
  __pyx_r = __pyx_pf_7mathics_7builtin_7numeric_4Fold_4fold_9converted_operands(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_7mathics_7builtin_7numeric_4Fold_4fold_18converted_operands_2generator5(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "mathics/builtin/numeric.py":1833
 *             def converted_operands():
 *                 for y in s_operands:
 *                     yield tuple(as_operand(t) for t in y)             # <<<<<<<<<<<<<<
 * 
 *             with working_precision(precision):
 */

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_4Fold_4fold_18converted_operands_genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr *)__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr(__pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1833, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7mathics_7builtin_7numeric_4Fold_4fold_18converted_operands_2generator5, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_Fold_fold_locals_converted_opera, __pyx_n_s_mathics_builtin_numeric); if (unlikely(!gen)) __PYX_ERR(0, 1833, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.Fold.fold.converted_operands.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_7mathics_7builtin_7numeric_4Fold_4fold_18converted_operands_2generator5(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr *__pyx_cur_scope = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1833, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_y)) { __Pyx_RaiseClosureNameError("y"); __PYX_ERR(0, 1833, __pyx_L1_error) }
  if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_y)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_y)) {
    __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_y; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_y); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1833, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1833, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 1833, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1833, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 1833, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1833, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1833, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_t);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_t, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_outer_scope->__pyx_v_as_operand)) { __Pyx_RaiseClosureNameError("as_operand"); __PYX_ERR(0, 1833, __pyx_L1_error) }
    __Pyx_INCREF(__pyx_cur_scope->__pyx_outer_scope->__pyx_outer_scope->__pyx_v_as_operand);
    __pyx_t_5 = __pyx_cur_scope->__pyx_outer_scope->__pyx_outer_scope->__pyx_v_as_operand; __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_cur_scope->__pyx_v_t) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_cur_scope->__pyx_v_t);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1833, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XGIVEREF(__pyx_t_1);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_cur_scope->__pyx_t_0 = 0;
    __Pyx_XGOTREF(__pyx_t_1);
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1833, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1831
 *             as_operand = self.operands.get(mode)
 * 
 *             def converted_operands():             # <<<<<<<<<<<<<<
 *                 for y in s_operands:
 *                     yield tuple(as_operand(t) for t in y)
 */

static PyObject *__pyx_pf_7mathics_7builtin_7numeric_4Fold_4fold_9converted_operands(PyObject *__pyx_self) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("converted_operands", 0);
  __pyx_cur_scope = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands *)__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands(__pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1831, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_7mathics_7builtin_7numeric_4Fold_4fold_11generator4, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_converted_operands, __pyx_n_s_Fold_fold_locals_converted_opera_2, __pyx_n_s_mathics_builtin_numeric); if (unlikely(!gen)) __PYX_ERR(0, 1831, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("mathics.builtin.numeric.Fold.fold.converted_operands", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_7mathics_7builtin_7numeric_4Fold_4fold_11generator4(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands *__pyx_cur_scope = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("converted_operands", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1831, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1832
 * 
 *             def converted_operands():
 *                 for y in s_operands:             # <<<<<<<<<<<<<<
 *                     yield tuple(as_operand(t) for t in y)
 * 
 */
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_s_operands)) { __Pyx_RaiseClosureNameError("s_operands"); __PYX_ERR(0, 1832, __pyx_L1_error) }
  if (unlikely(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_s_operands == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 1832, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_s_operands; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 1832, __pyx_L1_error)
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1832, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_y);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_y, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;

    /* "mathics/builtin/numeric.py":1833
 *             def converted_operands():
 *                 for y in s_operands:
 *                     yield tuple(as_operand(t) for t in y)             # <<<<<<<<<<<<<<
 * 
 *             with working_precision(precision):
 */
    __pyx_t_3 = __pyx_pf_7mathics_7builtin_7numeric_4Fold_4fold_18converted_operands_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1833, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1833, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XGIVEREF(__pyx_t_1);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_cur_scope->__pyx_t_0 = 0;
    __Pyx_XGOTREF(__pyx_t_1);
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1833, __pyx_L1_error)

    /* "mathics/builtin/numeric.py":1832
 * 
 *             def converted_operands():
 *                 for y in s_operands:             # <<<<<<<<<<<<<<
 *                     yield tuple(as_operand(t) for t in y)
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "mathics/builtin/numeric.py":1831
 *             as_operand = self.operands.get(mode)
 * 
 *             def converted_operands():             # <<<<<<<<<<<<<<
 *                 for y in s_operands:
 *                     yield tuple(as_operand(t) for t in y)
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("converted_operands", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "mathics/builtin/numeric.py":1783
 *         return spans
 * 
 *     def fold(self, x, ll):             # <<<<<<<<<<<<<<
 *         # computes fold(x, ll) with the internal _fold function. will start
 *         # its evaluation machine precision, and will escalate to arbitrary
 */

static PyObject *__pyx_gb_7mathics_7builtin_7numeric_4Fold_8generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold *__pyx_cur_scope = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_t_9;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fold", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L4_resume_from_yield;
    case 2: goto __pyx_L32_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1783, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1789
 *         # items already computed are carried over to new evaluation modes.
 * 
 *         yield x  # initial state             # <<<<<<<<<<<<<<
 * 
 *         init = None
 */
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_x);
  __pyx_r = __pyx_cur_scope->__pyx_v_x;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  /* return from generator, yielding value */
  __pyx_generator->resume_label = 1;
  return __pyx_r;
  __pyx_L4_resume_from_yield:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1789, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1791
 *         yield x  # initial state
 * 
 *         init = None             # <<<<<<<<<<<<<<
 *         operands = list(self._operands(x, ll))
 *         spans = self._spans(operands)
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __pyx_cur_scope->__pyx_v_init = ((PyObject*)Py_None);

  /* "mathics/builtin/numeric.py":1792
 * 
 *         init = None
 *         operands = list(self._operands(x, ll))             # <<<<<<<<<<<<<<
 *         spans = self._spans(operands)
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_operands_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1792, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_x, __pyx_cur_scope->__pyx_v_ll};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1792, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_x, __pyx_cur_scope->__pyx_v_ll};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1792, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1792, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_x);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_x);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_cur_scope->__pyx_v_x);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_ll);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_ll);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_cur_scope->__pyx_v_ll);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1792, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PySequence_List(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1792, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_cur_scope->__pyx_v_operands = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":1793
 *         init = None
 *         operands = list(self._operands(x, ll))
 *         spans = self._spans(operands)             # <<<<<<<<<<<<<<
 * 
 *         for mode in (self.FLOAT, self.MPMATH, self.SYMBOLIC):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_spans); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1793, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_cur_scope->__pyx_v_operands) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_cur_scope->__pyx_v_operands);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1793, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_cur_scope->__pyx_v_spans = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":1795
 *         spans = self._spans(operands)
 * 
 *         for mode in (self.FLOAT, self.MPMATH, self.SYMBOLIC):             # <<<<<<<<<<<<<<
 *             s_operands = [y[1:] for y in operands[spans[mode]]]
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_FLOAT); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1795, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_MPMATH); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1795, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_SYMBOLIC); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1795, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1795, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_5);
  __pyx_t_2 = 0;
  __pyx_t_1 = 0;
  __pyx_t_5 = 0;
  __pyx_t_5 = __pyx_t_3; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    if (__pyx_t_6 >= 3) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 1795, __pyx_L1_error)
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1795, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_mode);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_mode, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;

    /* "mathics/builtin/numeric.py":1796
 * 
 *         for mode in (self.FLOAT, self.MPMATH, self.SYMBOLIC):
 *             s_operands = [y[1:] for y in operands[spans[mode]]]             # <<<<<<<<<<<<<<
 * 
 *             if not s_operands:
 */
    { /* enter inner scope */
      __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1796, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_spans, __pyx_cur_scope->__pyx_v_mode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1796, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_operands, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1796, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
        __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_7 = 0;
        __pyx_t_8 = NULL;
      } else {
        __pyx_t_7 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1796, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_8 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1796, __pyx_L1_error)
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      for (;;) {
        if (likely(!__pyx_t_8)) {
          if (likely(PyList_CheckExact(__pyx_t_1))) {
            if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_1)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 1796, __pyx_L1_error)
            #else
            __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1796, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            #endif
          } else {
            if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 1796, __pyx_L1_error)
            #else
            __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1796, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            #endif
          }
        } else {
          __pyx_t_2 = __pyx_t_8(__pyx_t_1);
          if (unlikely(!__pyx_t_2)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 1796, __pyx_L1_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_2);
        }
        __Pyx_XGOTREF(__pyx_cur_scope->__pyx_9genexpr13__pyx_v_y);
        __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_9genexpr13__pyx_v_y, __pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_2);
        __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_cur_scope->__pyx_9genexpr13__pyx_v_y, 1, 0, NULL, NULL, &__pyx_slice__16, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1796, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 1796, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } /* exit inner scope */
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_s_operands);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_s_operands, ((PyObject*)__pyx_t_3));
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;

    /* "mathics/builtin/numeric.py":1798
 *             s_operands = [y[1:] for y in operands[spans[mode]]]
 * 
 *             if not s_operands:             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
    __pyx_t_9 = (PyList_GET_SIZE(__pyx_cur_scope->__pyx_v_s_operands) != 0);
    __pyx_t_10 = ((!__pyx_t_9) != 0);
    if (__pyx_t_10) {

      /* "mathics/builtin/numeric.py":1799
 * 
 *             if not s_operands:
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             if mode == self.MPMATH:
 */
      goto __pyx_L5_continue;

      /* "mathics/builtin/numeric.py":1798
 *             s_operands = [y[1:] for y in operands[spans[mode]]]
 * 
 *             if not s_operands:             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
    }

    /* "mathics/builtin/numeric.py":1801
 *                 continue
 * 
 *             if mode == self.MPMATH:             # <<<<<<<<<<<<<<
 *                 from mathics.core.numbers import min_prec
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_MPMATH); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1801, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_mode, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1801, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1801, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_10) {

      /* "mathics/builtin/numeric.py":1802
 * 
 *             if mode == self.MPMATH:
 *                 from mathics.core.numbers import min_prec             # <<<<<<<<<<<<<<
 * 
 *                 precision = min_prec(*[t for t in chain(*s_operands) if t is not None])
 */
      __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1802, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_n_s_min_prec);
      __Pyx_GIVEREF(__pyx_n_s_min_prec);
      PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_min_prec);
      __pyx_t_3 = __Pyx_Import(__pyx_n_s_mathics_core_numbers, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1802, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_min_prec); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1802, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_min_prec);
      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_min_prec, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "mathics/builtin/numeric.py":1804
 *                 from mathics.core.numbers import min_prec
 * 
 *                 precision = min_prec(*[t for t in chain(*s_operands) if t is not None])             # <<<<<<<<<<<<<<
 *                 working_precision = mpmath.workprec
 *             else:
 */
      { /* enter inner scope */
        __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1804, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_chain); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1804, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = PySequence_Tuple(__pyx_cur_scope->__pyx_v_s_operands); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1804, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1804, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (likely(PyList_CheckExact(__pyx_t_11)) || PyTuple_CheckExact(__pyx_t_11)) {
          __pyx_t_2 = __pyx_t_11; __Pyx_INCREF(__pyx_t_2); __pyx_t_7 = 0;
          __pyx_t_8 = NULL;
        } else {
          __pyx_t_7 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1804, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_8 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1804, __pyx_L1_error)
        }
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        for (;;) {
          if (likely(!__pyx_t_8)) {
            if (likely(PyList_CheckExact(__pyx_t_2))) {
              if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_2)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_11 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_11); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 1804, __pyx_L1_error)
              #else
              __pyx_t_11 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1804, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_11);
              #endif
            } else {
              if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_11 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_11); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 1804, __pyx_L1_error)
              #else
              __pyx_t_11 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1804, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_11);
              #endif
            }
          } else {
            __pyx_t_11 = __pyx_t_8(__pyx_t_2);
            if (unlikely(!__pyx_t_11)) {
              PyObject* exc_type = PyErr_Occurred();
              if (exc_type) {
                if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                else __PYX_ERR(0, 1804, __pyx_L1_error)
              }
              break;
            }
            __Pyx_GOTREF(__pyx_t_11);
          }
          __Pyx_XGOTREF(__pyx_cur_scope->__pyx_9genexpr14__pyx_v_t);
          __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_9genexpr14__pyx_v_t, __pyx_t_11);
          __Pyx_GIVEREF(__pyx_t_11);
          __pyx_t_11 = 0;
          __pyx_t_10 = (__pyx_cur_scope->__pyx_9genexpr14__pyx_v_t != Py_None);
          __pyx_t_9 = (__pyx_t_10 != 0);
          if (__pyx_t_9) {
            if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_cur_scope->__pyx_9genexpr14__pyx_v_t))) __PYX_ERR(0, 1804, __pyx_L1_error)
          }
        }
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } /* exit inner scope */
      __pyx_t_2 = PySequence_Tuple(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1804, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_cur_scope->__pyx_v_min_prec, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1804, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_precision);
      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_precision, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_3 = 0;

      /* "mathics/builtin/numeric.py":1805
 * 
 *                 precision = min_prec(*[t for t in chain(*s_operands) if t is not None])
 *                 working_precision = mpmath.workprec             # <<<<<<<<<<<<<<
 *             else:
 * 
 */
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_mpmath); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1805, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_workprec); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1805, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_working_precision);
      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_working_precision, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;

      /* "mathics/builtin/numeric.py":1801
 *                 continue
 * 
 *             if mode == self.MPMATH:             # <<<<<<<<<<<<<<
 *                 from mathics.core.numbers import min_prec
 * 
 */
      goto __pyx_L10;
    }

    /* "mathics/builtin/numeric.py":1808
 *             else:
 * 
 *                 @contextmanager             # <<<<<<<<<<<<<<
 *                 def working_precision(_):
 *                     yield
 */
    /*else*/ {

      /* "mathics/builtin/numeric.py":1809
 * 
 *                 @contextmanager
 *                 def working_precision(_):             # <<<<<<<<<<<<<<
 *                     yield
 * 
 */
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_contextmanager); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1808, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_11 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_4Fold_4fold_1working_precision, 0, __pyx_n_s_Fold_fold_locals_working_precisi, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__40)); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1809, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_1 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_t_11) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_11);
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1808, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_working_precision);
      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_working_precision, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;

      /* "mathics/builtin/numeric.py":1812
 *                     yield
 * 
 *                 precision = None             # <<<<<<<<<<<<<<
 * 
 *             if mode == self.FLOAT:
 */
      __Pyx_INCREF(Py_None);
      __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_precision);
      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_precision, Py_None);
      __Pyx_GIVEREF(Py_None);
    }
    __pyx_L10:;

    /* "mathics/builtin/numeric.py":1814
 *                 precision = None
 * 
 *             if mode == self.FLOAT:             # <<<<<<<<<<<<<<
 * 
 *                 def out(z):
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_FLOAT); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1814, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_mode, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1814, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 1814, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_9) {

      /* "mathics/builtin/numeric.py":1816
 *             if mode == self.FLOAT:
 * 
 *                 def out(z):             # <<<<<<<<<<<<<<
 *                     return Real(z)
 * 
 */
      __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_4Fold_4fold_4out, 0, __pyx_n_s_Fold_fold_locals_out, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__42)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1816, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_out);
      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_out, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_3 = 0;

      /* "mathics/builtin/numeric.py":1814
 *                 precision = None
 * 
 *             if mode == self.FLOAT:             # <<<<<<<<<<<<<<
 * 
 *                 def out(z):
 */
      goto __pyx_L14;
    }

    /* "mathics/builtin/numeric.py":1819
 *                     return Real(z)
 * 
 *             elif mode == self.MPMATH:             # <<<<<<<<<<<<<<
 * 
 *                 def out(z):
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_MPMATH); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1819, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_mode, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1819, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 1819, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_9) {

      /* "mathics/builtin/numeric.py":1821
 *             elif mode == self.MPMATH:
 * 
 *                 def out(z):             # <<<<<<<<<<<<<<
 *                     return Real(z, precision)
 * 
 */
      __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_4Fold_4fold_6out, 0, __pyx_n_s_Fold_fold_locals_out, ((PyObject*)__pyx_cur_scope), __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__44)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1821, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_out);
      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_out, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;

      /* "mathics/builtin/numeric.py":1819
 *                     return Real(z)
 * 
 *             elif mode == self.MPMATH:             # <<<<<<<<<<<<<<
 * 
 *                 def out(z):
 */
      goto __pyx_L14;
    }

    /* "mathics/builtin/numeric.py":1826
 *             else:
 * 
 *                 def out(z):             # <<<<<<<<<<<<<<
 *                     return z
 * 
 */
    /*else*/ {
      __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_4Fold_4fold_8out, 0, __pyx_n_s_Fold_fold_locals_out, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__46)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1826, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_out);
      __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_out, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
    }
    __pyx_L14:;

    /* "mathics/builtin/numeric.py":1829
 *                     return z
 * 
 *             as_operand = self.operands.get(mode)             # <<<<<<<<<<<<<<
 * 
 *             def converted_operands():
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_operands); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1829, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1829, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_11);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_11, function);
      }
    }
    __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_3, __pyx_cur_scope->__pyx_v_mode) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_cur_scope->__pyx_v_mode);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1829, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_as_operand);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_as_operand, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;

    /* "mathics/builtin/numeric.py":1831
 *             as_operand = self.operands.get(mode)
 * 
 *             def converted_operands():             # <<<<<<<<<<<<<<
 *                 for y in s_operands:
 *                     yield tuple(as_operand(t) for t in y)
 */
    __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_4Fold_4fold_10converted_operands, 0, __pyx_n_s_Fold_fold_locals_converted_opera_2, ((PyObject*)__pyx_cur_scope), __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__48)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1831, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_converted_operands);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_converted_operands, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;

    /* "mathics/builtin/numeric.py":1835
 *                     yield tuple(as_operand(t) for t in y)
 * 
 *             with working_precision(precision):             # <<<<<<<<<<<<<<
 *                 c_operands = converted_operands()
 * 
 */
    /*with:*/ {
      __Pyx_INCREF(__pyx_cur_scope->__pyx_v_working_precision);
      __pyx_t_11 = __pyx_cur_scope->__pyx_v_working_precision; __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_11);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_11, function);
        }
      }
      __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_3, __pyx_cur_scope->__pyx_v_precision) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_cur_scope->__pyx_v_precision);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1835, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_12 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_n_s_exit); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1835, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_2, __pyx_n_s_enter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1835, __pyx_L15_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      __pyx_t_11 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1835, __pyx_L15_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      /*try:*/ {
        {
          __Pyx_ExceptionSave(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
          __Pyx_XGOTREF(__pyx_t_13);
          __Pyx_XGOTREF(__pyx_t_14);
          __Pyx_XGOTREF(__pyx_t_15);
          /*try:*/ {

            /* "mathics/builtin/numeric.py":1836
 * 
 *             with working_precision(precision):
 *                 c_operands = converted_operands()             # <<<<<<<<<<<<<<
 * 
 *                 if init is not None:
 */
            __pyx_t_2 = __pyx_pf_7mathics_7builtin_7numeric_4Fold_4fold_9converted_operands(__pyx_cur_scope->__pyx_v_converted_operands); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1836, __pyx_L21_error)
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_c_operands);
            __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_c_operands, __pyx_t_2);
            __Pyx_GIVEREF(__pyx_t_2);
            __pyx_t_2 = 0;

            /* "mathics/builtin/numeric.py":1838
 *                 c_operands = converted_operands()
 * 
 *                 if init is not None:             # <<<<<<<<<<<<<<
 *                     c_init = tuple(
 *                         (None if t is None else as_operand(from_python(t)))
 */
            __pyx_t_9 = (__pyx_cur_scope->__pyx_v_init != ((PyObject*)Py_None));
            __pyx_t_10 = (__pyx_t_9 != 0);
            if (__pyx_t_10) {

              /* "mathics/builtin/numeric.py":1840
 *                 if init is not None:
 *                     c_init = tuple(
 *                         (None if t is None else as_operand(from_python(t)))             # <<<<<<<<<<<<<<
 *                         for t in init
 *                     )
 */
              __pyx_t_2 = __pyx_pf_7mathics_7builtin_7numeric_4Fold_4fold_12genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1840, __pyx_L21_error)
              __Pyx_GOTREF(__pyx_t_2);

              /* "mathics/builtin/numeric.py":1839
 * 
 *                 if init is not None:
 *                     c_init = tuple(             # <<<<<<<<<<<<<<
 *                         (None if t is None else as_operand(from_python(t)))
 *                         for t in init
 */
              __pyx_t_11 = __Pyx_PySequence_Tuple(__pyx_t_2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1839, __pyx_L21_error)
              __Pyx_GOTREF(__pyx_t_11);
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
              __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_c_init);
              __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_c_init, __pyx_t_11);
              __Pyx_GIVEREF(__pyx_t_11);
              __pyx_t_11 = 0;

              /* "mathics/builtin/numeric.py":1838
 *                 c_operands = converted_operands()
 * 
 *                 if init is not None:             # <<<<<<<<<<<<<<
 *                     c_init = tuple(
 *                         (None if t is None else as_operand(from_python(t)))
 */
              goto __pyx_L29;
            }

            /* "mathics/builtin/numeric.py":1844
 *                     )
 *                 else:
 *                     c_init = next(c_operands)             # <<<<<<<<<<<<<<
 *                     init = tuple((None if t is None else out(t)) for t in c_init)
 * 
 */
            /*else*/ {
              __pyx_t_11 = __Pyx_PyIter_Next(__pyx_cur_scope->__pyx_v_c_operands); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1844, __pyx_L21_error)
              __Pyx_GOTREF(__pyx_t_11);
              __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_c_init);
              __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_c_init, __pyx_t_11);
              __Pyx_GIVEREF(__pyx_t_11);
              __pyx_t_11 = 0;

              /* "mathics/builtin/numeric.py":1845
 *                 else:
 *                     c_init = next(c_operands)
 *                     init = tuple((None if t is None else out(t)) for t in c_init)             # <<<<<<<<<<<<<<
 * 
 *                 generator = self._fold(c_init, c_operands, self.math.get(mode))
 */
              __pyx_t_11 = __pyx_pf_7mathics_7builtin_7numeric_4Fold_4fold_15genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1845, __pyx_L21_error)
              __Pyx_GOTREF(__pyx_t_11);
              __pyx_t_2 = __Pyx_PySequence_Tuple(__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1845, __pyx_L21_error)
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
              __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_init);
              __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_init, ((PyObject*)__pyx_t_2));
              __Pyx_GIVEREF(__pyx_t_2);
              __pyx_t_2 = 0;
            }
            __pyx_L29:;

            /* "mathics/builtin/numeric.py":1847
 *                     init = tuple((None if t is None else out(t)) for t in c_init)
 * 
 *                 generator = self._fold(c_init, c_operands, self.math.get(mode))             # <<<<<<<<<<<<<<
 * 
 *                 for y in generator:
 */
            __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_fold_2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1847, __pyx_L21_error)
            __Pyx_GOTREF(__pyx_t_11);
            __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_math); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1847, __pyx_L21_error)
            __Pyx_GOTREF(__pyx_t_1);
            __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_get); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1847, __pyx_L21_error)
            __Pyx_GOTREF(__pyx_t_16);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __pyx_t_1 = NULL;
            if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_16))) {
              __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_16);
              if (likely(__pyx_t_1)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
                __Pyx_INCREF(__pyx_t_1);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_16, function);
              }
            }
            __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_16, __pyx_t_1, __pyx_cur_scope->__pyx_v_mode) : __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_cur_scope->__pyx_v_mode);
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1847, __pyx_L21_error)
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
            __pyx_t_16 = NULL;
            __pyx_t_4 = 0;
            if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
              __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_11);
              if (likely(__pyx_t_16)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
                __Pyx_INCREF(__pyx_t_16);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_11, function);
                __pyx_t_4 = 1;
              }
            }
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_11)) {
              PyObject *__pyx_temp[4] = {__pyx_t_16, __pyx_cur_scope->__pyx_v_c_init, __pyx_cur_scope->__pyx_v_c_operands, __pyx_t_3};
              __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1847, __pyx_L21_error)
              __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
              PyObject *__pyx_temp[4] = {__pyx_t_16, __pyx_cur_scope->__pyx_v_c_init, __pyx_cur_scope->__pyx_v_c_operands, __pyx_t_3};
              __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1847, __pyx_L21_error)
              __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            } else
            #endif
            {
              __pyx_t_1 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1847, __pyx_L21_error)
              __Pyx_GOTREF(__pyx_t_1);
              if (__pyx_t_16) {
                __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_16); __pyx_t_16 = NULL;
              }
              __Pyx_INCREF(__pyx_cur_scope->__pyx_v_c_init);
              __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_c_init);
              PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_4, __pyx_cur_scope->__pyx_v_c_init);
              __Pyx_INCREF(__pyx_cur_scope->__pyx_v_c_operands);
              __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_c_operands);
              PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_4, __pyx_cur_scope->__pyx_v_c_operands);
              __Pyx_GIVEREF(__pyx_t_3);
              PyTuple_SET_ITEM(__pyx_t_1, 2+__pyx_t_4, __pyx_t_3);
              __pyx_t_3 = 0;
              __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1847, __pyx_L21_error)
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            }
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_generator);
            __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_generator, __pyx_t_2);
            __Pyx_GIVEREF(__pyx_t_2);
            __pyx_t_2 = 0;

            /* "mathics/builtin/numeric.py":1849
 *                 generator = self._fold(c_init, c_operands, self.math.get(mode))
 * 
 *                 for y in generator:             # <<<<<<<<<<<<<<
 *                     y = tuple(out(t) for t in y)
 *                     yield y
 */
            if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_generator)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_generator)) {
              __pyx_t_2 = __pyx_cur_scope->__pyx_v_generator; __Pyx_INCREF(__pyx_t_2); __pyx_t_7 = 0;
              __pyx_t_8 = NULL;
            } else {
              __pyx_t_7 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_generator); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1849, __pyx_L21_error)
              __Pyx_GOTREF(__pyx_t_2);
              __pyx_t_8 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1849, __pyx_L21_error)
            }
            for (;;) {
              if (likely(!__pyx_t_8)) {
                if (likely(PyList_CheckExact(__pyx_t_2))) {
                  if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_2)) break;
                  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                  __pyx_t_11 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_11); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 1849, __pyx_L21_error)
                  #else
                  __pyx_t_11 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1849, __pyx_L21_error)
                  __Pyx_GOTREF(__pyx_t_11);
                  #endif
                } else {
                  if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
                  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                  __pyx_t_11 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_11); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 1849, __pyx_L21_error)
                  #else
                  __pyx_t_11 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1849, __pyx_L21_error)
                  __Pyx_GOTREF(__pyx_t_11);
                  #endif
                }
              } else {
                __pyx_t_11 = __pyx_t_8(__pyx_t_2);
                if (unlikely(!__pyx_t_11)) {
                  PyObject* exc_type = PyErr_Occurred();
                  if (exc_type) {
                    if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                    else __PYX_ERR(0, 1849, __pyx_L21_error)
                  }
                  break;
                }
                __Pyx_GOTREF(__pyx_t_11);
              }
              __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_y);
              __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_y, __pyx_t_11);
              __Pyx_GIVEREF(__pyx_t_11);
              __pyx_t_11 = 0;

              /* "mathics/builtin/numeric.py":1850
 * 
 *                 for y in generator:
 *                     y = tuple(out(t) for t in y)             # <<<<<<<<<<<<<<
 *                     yield y
 *                     init = y
 */
              __pyx_t_11 = __pyx_pf_7mathics_7builtin_7numeric_4Fold_4fold_18genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1850, __pyx_L21_error)
              __Pyx_GOTREF(__pyx_t_11);
              __pyx_t_1 = __Pyx_PySequence_Tuple(__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1850, __pyx_L21_error)
              __Pyx_GOTREF(__pyx_t_1);
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
              __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_y);
              __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_y, __pyx_t_1);
              __Pyx_GIVEREF(__pyx_t_1);
              __pyx_t_1 = 0;

              /* "mathics/builtin/numeric.py":1851
 *                 for y in generator:
 *                     y = tuple(out(t) for t in y)
 *                     yield y             # <<<<<<<<<<<<<<
 *                     init = y
 */
              __Pyx_INCREF(__pyx_cur_scope->__pyx_v_y);
              __pyx_r = __pyx_cur_scope->__pyx_v_y;
              __Pyx_XGIVEREF(__pyx_t_2);
              __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
              __Pyx_XGIVEREF(__pyx_t_5);
              __pyx_cur_scope->__pyx_t_1 = __pyx_t_5;
              __pyx_cur_scope->__pyx_t_2 = __pyx_t_6;
              __pyx_cur_scope->__pyx_t_3 = __pyx_t_7;
              __pyx_cur_scope->__pyx_t_4 = __pyx_t_8;
              __Pyx_XGIVEREF(__pyx_t_12);
              __pyx_cur_scope->__pyx_t_5 = __pyx_t_12;
              __Pyx_XGIVEREF(__pyx_t_13);
              __pyx_cur_scope->__pyx_t_6 = __pyx_t_13;
              __Pyx_XGIVEREF(__pyx_t_14);
              __pyx_cur_scope->__pyx_t_7 = __pyx_t_14;
              __Pyx_XGIVEREF(__pyx_t_15);
              __pyx_cur_scope->__pyx_t_8 = __pyx_t_15;
              __Pyx_XGIVEREF(__pyx_r);
              __Pyx_RefNannyFinishContext();
              __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
              /* return from generator, yielding value */
              __pyx_generator->resume_label = 2;
              return __pyx_r;
              __pyx_L32_resume_from_yield:;
              __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
              __pyx_cur_scope->__pyx_t_0 = 0;
              __Pyx_XGOTREF(__pyx_t_2);
              __pyx_t_5 = __pyx_cur_scope->__pyx_t_1;
              __pyx_cur_scope->__pyx_t_1 = 0;
              __Pyx_XGOTREF(__pyx_t_5);
              __pyx_t_6 = __pyx_cur_scope->__pyx_t_2;
              __pyx_t_7 = __pyx_cur_scope->__pyx_t_3;
              __pyx_t_8 = __pyx_cur_scope->__pyx_t_4;
              __pyx_t_12 = __pyx_cur_scope->__pyx_t_5;
              __pyx_cur_scope->__pyx_t_5 = 0;
              __Pyx_XGOTREF(__pyx_t_12);
              __pyx_t_13 = __pyx_cur_scope->__pyx_t_6;
              __pyx_cur_scope->__pyx_t_6 = 0;
              __Pyx_XGOTREF(__pyx_t_13);
              __pyx_t_14 = __pyx_cur_scope->__pyx_t_7;
              __pyx_cur_scope->__pyx_t_7 = 0;
              __Pyx_XGOTREF(__pyx_t_14);
              __pyx_t_15 = __pyx_cur_scope->__pyx_t_8;
              __pyx_cur_scope->__pyx_t_8 = 0;
              __Pyx_XGOTREF(__pyx_t_15);
              if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1851, __pyx_L21_error)

              /* "mathics/builtin/numeric.py":1852
 *                     y = tuple(out(t) for t in y)
 *                     yield y
 *                     init = y             # <<<<<<<<<<<<<<
 */
              __Pyx_INCREF(__pyx_cur_scope->__pyx_v_y);
              __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_init);
              __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_init, __pyx_cur_scope->__pyx_v_y);
              __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_y);

              /* "mathics/builtin/numeric.py":1849
 *                 generator = self._fold(c_init, c_operands, self.math.get(mode))
 * 
 *                 for y in generator:             # <<<<<<<<<<<<<<
 *                     y = tuple(out(t) for t in y)
 *                     yield y
 */
            }
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

            /* "mathics/builtin/numeric.py":1835
 *                     yield tuple(as_operand(t) for t in y)
 * 
 *             with working_precision(precision):             # <<<<<<<<<<<<<<
 *                 c_operands = converted_operands()
 * 
 */
          }
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
          goto __pyx_L28_try_end;
          __pyx_L21_error:;
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          /*except:*/ {
            __Pyx_AddTraceback("mathics.builtin.numeric.Fold.fold", __pyx_clineno, __pyx_lineno, __pyx_filename);
            if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_11) < 0) __PYX_ERR(0, 1835, __pyx_L23_except_error)
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_GOTREF(__pyx_t_11);
            __pyx_t_3 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_1, __pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1835, __pyx_L23_except_error)
            __Pyx_GOTREF(__pyx_t_3);
            __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_3, NULL);
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1835, __pyx_L23_except_error)
            __Pyx_GOTREF(__pyx_t_17);
            __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_17);
            __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
            if (__pyx_t_10 < 0) __PYX_ERR(0, 1835, __pyx_L23_except_error)
            __pyx_t_9 = ((!(__pyx_t_10 != 0)) != 0);
            if (__pyx_t_9) {
              __Pyx_GIVEREF(__pyx_t_2);
              __Pyx_GIVEREF(__pyx_t_1);
              __Pyx_XGIVEREF(__pyx_t_11);
              __Pyx_ErrRestoreWithState(__pyx_t_2, __pyx_t_1, __pyx_t_11);
              __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_11 = 0; 
              __PYX_ERR(0, 1835, __pyx_L23_except_error)
            }
            __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
            goto __pyx_L22_exception_handled;
          }
          __pyx_L23_except_error:;
          __Pyx_XGIVEREF(__pyx_t_13);
          __Pyx_XGIVEREF(__pyx_t_14);
          __Pyx_XGIVEREF(__pyx_t_15);
          __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
          goto __pyx_L1_error;
          __pyx_L22_exception_handled:;
          __Pyx_XGIVEREF(__pyx_t_13);
          __Pyx_XGIVEREF(__pyx_t_14);
          __Pyx_XGIVEREF(__pyx_t_15);
          __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
          __pyx_L28_try_end:;
        }
      }
      /*finally:*/ {
        /*normal exit:*/{
          if (__pyx_t_12) {
            __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_tuple__49, NULL);
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1835, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_15);
            __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          }
          goto __pyx_L20;
        }
        __pyx_L20:;
      }
      goto __pyx_L36;
      __pyx_L15_error:;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      goto __pyx_L1_error;
      __pyx_L36:;
    }

    /* "mathics/builtin/numeric.py":1795
 *         spans = self._spans(operands)
 * 
 *         for mode in (self.FLOAT, self.MPMATH, self.SYMBOLIC):             # <<<<<<<<<<<<<<
 *             s_operands = [y[1:] for y in operands[spans[mode]]]
 * 
 */
    __pyx_L5_continue:;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* "mathics/builtin/numeric.py":1783
 *         return spans
 * 
 *     def fold(self, x, ll):             # <<<<<<<<<<<<<<
 *         # computes fold(x, ll) with the internal _fold function. will start
 *         # its evaluation machine precision, and will escalate to arbitrary
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("fold", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface *__pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface[8];
static int __pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface = 0;

static PyObject *__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface)))) {
    o = (PyObject*)__pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface[--__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface(PyObject *o) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_adapt_func);
  Py_CLEAR(p->__pyx_v_integrator);
  Py_CLEAR(p->__pyx_v_mandatory);
  Py_CLEAR(p->__pyx_v_options_map);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface)))) {
    __pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface[__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface++] = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface *)o;
  if (p->__pyx_v_adapt_func) {
    e = (*v)(p->__pyx_v_adapt_func, a); if (e) return e;
  }
  if (p->__pyx_v_integrator) {
    e = (*v)(p->__pyx_v_integrator, a); if (e) return e;
  }
  if (p->__pyx_v_mandatory) {
    e = (*v)(p->__pyx_v_mandatory, a); if (e) return e;
  }
  if (p->__pyx_v_options_map) {
    e = (*v)(p->__pyx_v_options_map, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface *)o;
  tmp = ((PyObject*)p->__pyx_v_adapt_func);
  p->__pyx_v_adapt_func = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_integrator);
  p->__pyx_v_integrator = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_mandatory);
  p->__pyx_v_mandatory = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_options_map);
  p->__pyx_v_options_map = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.builtin.numeric.__pyx_scope_struct___scipy_interface", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface, /*tp_traverse*/
  __pyx_tp_clear_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule *__pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule[8];
static int __pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule = 0;

static PyObject *__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule)))) {
    o = (PyObject*)__pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule[--__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule(PyObject *o) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v__quad_asr);
  Py_CLEAR(p->__pyx_v__quad_simpsons_mem);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule)))) {
    __pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule[__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule++] = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule *)o;
  if (p->__pyx_v__quad_asr) {
    e = (*v)(p->__pyx_v__quad_asr, a); if (e) return e;
  }
  if (p->__pyx_v__quad_simpsons_mem) {
    e = (*v)(p->__pyx_v__quad_simpsons_mem, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule *)o;
  tmp = ((PyObject*)p->__pyx_v__quad_asr);
  p->__pyx_v__quad_asr = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v__quad_simpsons_mem);
  p->__pyx_v__quad_simpsons_mem = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.builtin.numeric.__pyx_scope_struct_1__internal_adaptative_simpsons_rule", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule, /*tp_traverse*/
  __pyx_tp_clear_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini *__pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini[8];
static int __pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini = 0;

static PyObject *__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini)))) {
    o = (PyObject*)__pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini[--__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini(PyObject *o) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_func);
  Py_CLEAR(p->__pyx_v_opts);
  Py_CLEAR(p->__pyx_v_ranges);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini)))) {
    __pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini[__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini++] = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini *)o;
  if (p->__pyx_v_func) {
    e = (*v)(p->__pyx_v_func, a); if (e) return e;
  }
  if (p->__pyx_v_opts) {
    e = (*v)(p->__pyx_v_opts, a); if (e) return e;
  }
  if (p->__pyx_v_ranges) {
    e = (*v)(p->__pyx_v_ranges, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini *)o;
  tmp = ((PyObject*)p->__pyx_v_func);
  p->__pyx_v_func = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_opts);
  p->__pyx_v_opts = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_ranges);
  p->__pyx_v_ranges = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.builtin.numeric.__pyx_scope_struct_2__fubini", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini, /*tp_traverse*/
  __pyx_tp_clear_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral *__pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral[8];
static int __pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral = 0;

static PyObject *__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral)))) {
    o = (PyObject*)__pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral[--__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral(PyObject *o) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_u);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral)))) {
    __pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral[__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral++] = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_u) {
    e = (*v)(p->__pyx_v_u, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral *)o;
  tmp = ((PyObject*)p->__pyx_outer_scope);
  p->__pyx_outer_scope = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_u);
  p->__pyx_v_u = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.builtin.numeric.__pyx_scope_struct_3_subintegral", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral, /*tp_traverse*/
  __pyx_tp_clear_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain *__pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain[8];
static int __pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain = 0;

static PyObject *__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain)))) {
    o = (PyObject*)__pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain[--__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain(PyObject *o) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_a);
  Py_CLEAR(p->__pyx_v_b);
  Py_CLEAR(p->__pyx_v_coordtransform);
  Py_CLEAR(p->__pyx_v_i);
  Py_CLEAR(p->__pyx_v_integrand);
  Py_CLEAR(p->__pyx_v_x);
  Py_CLEAR(p->__pyx_v_z);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain)))) {
    __pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain[__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain++] = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain *)o;
  if (p->__pyx_v_a) {
    e = (*v)(p->__pyx_v_a, a); if (e) return e;
  }
  if (p->__pyx_v_b) {
    e = (*v)(p->__pyx_v_b, a); if (e) return e;
  }
  if (p->__pyx_v_coordtransform) {
    e = (*v)(p->__pyx_v_coordtransform, a); if (e) return e;
  }
  if (p->__pyx_v_i) {
    e = (*v)(p->__pyx_v_i, a); if (e) return e;
  }
  if (p->__pyx_v_integrand) {
    e = (*v)(p->__pyx_v_integrand, a); if (e) return e;
  }
  if (p->__pyx_v_x) {
    e = (*v)(p->__pyx_v_x, a); if (e) return e;
  }
  if (p->__pyx_v_z) {
    e = (*v)(p->__pyx_v_z, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain *)o;
  tmp = ((PyObject*)p->__pyx_v_a);
  p->__pyx_v_a = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_b);
  p->__pyx_v_b = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_coordtransform);
  p->__pyx_v_coordtransform = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_i);
  p->__pyx_v_i = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_integrand);
  p->__pyx_v_integrand = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_x);
  p->__pyx_v_x = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_z);
  p->__pyx_v_z = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.builtin.numeric.__pyx_scope_struct_4_apply_with_func_domain", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain, /*tp_traverse*/
  __pyx_tp_clear_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply *__pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply[8];
static int __pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply = 0;

static PyObject *__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply)))) {
    o = (PyObject*)__pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply[--__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply(PyObject *o) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_evaluation);
  Py_CLEAR(p->__pyx_v_test);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply)))) {
    __pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply[__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply++] = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply *)o;
  if (p->__pyx_v_evaluation) {
    e = (*v)(p->__pyx_v_evaluation, a); if (e) return e;
  }
  if (p->__pyx_v_test) {
    e = (*v)(p->__pyx_v_test, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply *)o;
  tmp = ((PyObject*)p->__pyx_v_evaluation);
  p->__pyx_v_evaluation = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_test);
  p->__pyx_v_test = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.builtin.numeric.__pyx_scope_struct_5_apply", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply, /*tp_traverse*/
  __pyx_tp_clear_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_6_test *__pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_6_test[8];
static int __pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_6_test = 0;

static PyObject *__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_6_test(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_6_test > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_6_test)))) {
    o = (PyObject*)__pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_6_test[--__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_6_test];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_6_test));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7mathics_7builtin_7numeric___pyx_scope_struct_6_test(PyObject *o) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_6_test *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_6_test *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_expr);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_6_test < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_6_test)))) {
    __pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_6_test[__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_6_test++] = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_6_test *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_7builtin_7numeric___pyx_scope_struct_6_test(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_6_test *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_6_test *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_expr) {
    e = (*v)(p->__pyx_v_expr, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7mathics_7builtin_7numeric___pyx_scope_struct_6_test(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_6_test *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_6_test *)o;
  tmp = ((PyObject*)p->__pyx_outer_scope);
  p->__pyx_outer_scope = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_expr);
  p->__pyx_v_expr = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_6_test = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.builtin.numeric.__pyx_scope_struct_6_test", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_6_test), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_7builtin_7numeric___pyx_scope_struct_6_test, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7mathics_7builtin_7numeric___pyx_scope_struct_6_test, /*tp_traverse*/
  __pyx_tp_clear_7mathics_7builtin_7numeric___pyx_scope_struct_6_test, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_6_test, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr *__pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr[8];
static int __pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr = 0;

static PyObject *__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr)))) {
    o = (PyObject*)__pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr[--__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr(PyObject *o) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_leaf);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr)))) {
    __pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr[__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr++] = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_leaf) {
    e = (*v)(p->__pyx_v_leaf, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.builtin.numeric.__pyx_scope_struct_7_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal *__pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal[8];
static int __pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal = 0;

static PyObject *__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal)))) {
    o = (PyObject*)__pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal[--__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal(PyObject *o) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_head);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal)))) {
    __pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal[__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal++] = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal *)o;
  if (p->__pyx_v_head) {
    e = (*v)(p->__pyx_v_head, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal *)o;
  tmp = ((PyObject*)p->__pyx_v_head);
  p->__pyx_v_head = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.builtin.numeric.__pyx_scope_struct_8_convert_repeating_decimal", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal, /*tp_traverse*/
  __pyx_tp_clear_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr *__pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr[8];
static int __pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr = 0;

static PyObject *__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr)))) {
    o = (PyObject*)__pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr[--__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr(PyObject *o) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_elem);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr)))) {
    __pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr[__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr++] = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_elem) {
    e = (*v)(p->__pyx_v_elem, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.builtin.numeric.__pyx_scope_struct_9_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold *__pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold[8];
static int __pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold = 0;

static PyObject *__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold)))) {
    o = (PyObject*)__pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold[--__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold(PyObject *o) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_as_operand);
  Py_CLEAR(p->__pyx_v_c_init);
  Py_CLEAR(p->__pyx_v_c_operands);
  Py_CLEAR(p->__pyx_v_converted_operands);
  Py_CLEAR(p->__pyx_v_generator);
  Py_CLEAR(p->__pyx_v_genexpr);
  Py_CLEAR(p->__pyx_v_init);
  Py_CLEAR(p->__pyx_v_ll);
  Py_CLEAR(p->__pyx_v_min_prec);
  Py_CLEAR(p->__pyx_v_mode);
  Py_CLEAR(p->__pyx_v_operands);
  Py_CLEAR(p->__pyx_v_out);
  Py_CLEAR(p->__pyx_v_precision);
  Py_CLEAR(p->__pyx_v_s_operands);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_spans);
  Py_CLEAR(p->__pyx_9genexpr14__pyx_v_t);
  Py_CLEAR(p->__pyx_v_working_precision);
  Py_CLEAR(p->__pyx_v_x);
  Py_CLEAR(p->__pyx_9genexpr13__pyx_v_y);
  Py_CLEAR(p->__pyx_v_y);
  Py_CLEAR(p->__pyx_t_0);
  Py_CLEAR(p->__pyx_t_1);
  Py_CLEAR(p->__pyx_t_5);
  Py_CLEAR(p->__pyx_t_6);
  Py_CLEAR(p->__pyx_t_7);
  Py_CLEAR(p->__pyx_t_8);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold)))) {
    __pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold[__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold++] = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold *)o;
  if (p->__pyx_v_as_operand) {
    e = (*v)(p->__pyx_v_as_operand, a); if (e) return e;
  }
  if (p->__pyx_v_c_init) {
    e = (*v)(p->__pyx_v_c_init, a); if (e) return e;
  }
  if (p->__pyx_v_c_operands) {
    e = (*v)(p->__pyx_v_c_operands, a); if (e) return e;
  }
  if (p->__pyx_v_converted_operands) {
    e = (*v)(p->__pyx_v_converted_operands, a); if (e) return e;
  }
  if (p->__pyx_v_generator) {
    e = (*v)(p->__pyx_v_generator, a); if (e) return e;
  }
  if (p->__pyx_v_genexpr) {
    e = (*v)(p->__pyx_v_genexpr, a); if (e) return e;
  }
  if (p->__pyx_v_init) {
    e = (*v)(p->__pyx_v_init, a); if (e) return e;
  }
  if (p->__pyx_v_ll) {
    e = (*v)(p->__pyx_v_ll, a); if (e) return e;
  }
  if (p->__pyx_v_min_prec) {
    e = (*v)(p->__pyx_v_min_prec, a); if (e) return e;
  }
  if (p->__pyx_v_mode) {
    e = (*v)(p->__pyx_v_mode, a); if (e) return e;
  }
  if (p->__pyx_v_operands) {
    e = (*v)(p->__pyx_v_operands, a); if (e) return e;
  }
  if (p->__pyx_v_out) {
    e = (*v)(p->__pyx_v_out, a); if (e) return e;
  }
  if (p->__pyx_v_precision) {
    e = (*v)(p->__pyx_v_precision, a); if (e) return e;
  }
  if (p->__pyx_v_s_operands) {
    e = (*v)(p->__pyx_v_s_operands, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(p->__pyx_v_self, a); if (e) return e;
  }
  if (p->__pyx_v_spans) {
    e = (*v)(p->__pyx_v_spans, a); if (e) return e;
  }
  if (p->__pyx_9genexpr14__pyx_v_t) {
    e = (*v)(p->__pyx_9genexpr14__pyx_v_t, a); if (e) return e;
  }
  if (p->__pyx_v_working_precision) {
    e = (*v)(p->__pyx_v_working_precision, a); if (e) return e;
  }
  if (p->__pyx_v_x) {
    e = (*v)(p->__pyx_v_x, a); if (e) return e;
  }
  if (p->__pyx_9genexpr13__pyx_v_y) {
    e = (*v)(p->__pyx_9genexpr13__pyx_v_y, a); if (e) return e;
  }
  if (p->__pyx_v_y) {
    e = (*v)(p->__pyx_v_y, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  if (p->__pyx_t_1) {
    e = (*v)(p->__pyx_t_1, a); if (e) return e;
  }
  if (p->__pyx_t_5) {
    e = (*v)(p->__pyx_t_5, a); if (e) return e;
  }
  if (p->__pyx_t_6) {
    e = (*v)(p->__pyx_t_6, a); if (e) return e;
  }
  if (p->__pyx_t_7) {
    e = (*v)(p->__pyx_t_7, a); if (e) return e;
  }
  if (p->__pyx_t_8) {
    e = (*v)(p->__pyx_t_8, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.builtin.numeric.__pyx_scope_struct_10_fold", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision *__pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision[8];
static int __pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision = 0;

static PyObject *__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision)))) {
    o = (PyObject*)__pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision[--__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision(PyObject *o) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v__);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision)))) {
    __pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision[__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision++] = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision *)o;
  if (p->__pyx_v__) {
    e = (*v)(p->__pyx_v__, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.builtin.numeric.__pyx_scope_struct_11_working_precision", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands *__pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands[8];
static int __pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands = 0;

static PyObject *__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands)))) {
    o = (PyObject*)__pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands[--__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands(PyObject *o) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_genexpr);
  Py_CLEAR(p->__pyx_v_y);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands)))) {
    __pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands[__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands++] = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_genexpr) {
    e = (*v)(p->__pyx_v_genexpr, a); if (e) return e;
  }
  if (p->__pyx_v_y) {
    e = (*v)(p->__pyx_v_y, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.builtin.numeric.__pyx_scope_struct_12_converted_operands", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr *__pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr[8];
static int __pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr = 0;

static PyObject *__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr)))) {
    o = (PyObject*)__pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr[--__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr(PyObject *o) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_t);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr)))) {
    __pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr[__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr++] = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_t) {
    e = (*v)(p->__pyx_v_t, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.builtin.numeric.__pyx_scope_struct_13_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr *__pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr[8];
static int __pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr = 0;

static PyObject *__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr)))) {
    o = (PyObject*)__pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr[--__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr(PyObject *o) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_t);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr)))) {
    __pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr[__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr++] = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_t) {
    e = (*v)(p->__pyx_v_t, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.builtin.numeric.__pyx_scope_struct_14_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr *__pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr[8];
static int __pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr = 0;

static PyObject *__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr)))) {
    o = (PyObject*)__pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr[--__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr(PyObject *o) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_t);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr)))) {
    __pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr[__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr++] = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_t) {
    e = (*v)(p->__pyx_v_t, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.builtin.numeric.__pyx_scope_struct_15_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr *__pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr[8];
static int __pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr = 0;

static PyObject *__pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr)))) {
    o = (PyObject*)__pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr[--__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr(PyObject *o) {
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_t);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr)))) {
    __pyx_freelist_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr[__pyx_freecount_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr++] = ((struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr *p = (struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_t) {
    e = (*v)(p->__pyx_v_t, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "mathics.builtin.numeric.__pyx_scope_struct_16_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
#if CYTHON_PEP489_MULTI_PHASE_INIT
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
static int __pyx_pymod_exec_numeric(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  {Py_mod_create, (void*)__pyx_pymod_create},
  {Py_mod_exec, (void*)__pyx_pymod_exec_numeric},
  {0, NULL}
};
#endif

static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    "numeric",
    __pyx_k_Numeric_Evaluation_and_Precisio, /* m_doc */
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    0, /* m_size */
  #else
    -1, /* m_size */
  #endif
    __pyx_methods /* m_methods */,
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    __pyx_moduledef_slots, /* m_slots */
  #else
    NULL, /* m_reload */
  #endif
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif
#ifndef CYTHON_SMALL_CODE
#if defined(__clang__)
    #define CYTHON_SMALL_CODE
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
    #define CYTHON_SMALL_CODE __attribute__((cold))
#else
    #define CYTHON_SMALL_CODE
#endif
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_u_0, __pyx_k_0, sizeof(__pyx_k_0), 0, 1, 0, 0},
  {&__pyx_kp_u_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 1, 0, 0},
  {&__pyx_kp_u_1_10, __pyx_k_1_10, sizeof(__pyx_k_1_10), 0, 1, 0, 0},
  {&__pyx_kp_u_1_2_is_not_a_valid_limit_of_int, __pyx_k_1_2_is_not_a_valid_limit_of_int, sizeof(__pyx_k_1_2_is_not_a_valid_limit_of_int), 0, 1, 0, 0},
  {&__pyx_n_u_Accuracy, __pyx_k_Accuracy, sizeof(__pyx_k_Accuracy), 0, 1, 0, 1},
  {&__pyx_n_u_Adler32, __pyx_k_Adler32, sizeof(__pyx_k_Adler32), 0, 1, 0, 1},
  {&__pyx_n_u_Automatic, __pyx_k_Automatic, sizeof(__pyx_k_Automatic), 0, 1, 0, 1},
  {&__pyx_kp_u_Automatic_2, __pyx_k_Automatic_2, sizeof(__pyx_k_Automatic_2), 0, 1, 0, 0},
  {&__pyx_kp_u_Base_1_is_not_a_real_number_grea, __pyx_k_Base_1_is_not_a_real_number_grea, sizeof(__pyx_k_Base_1_is_not_a_real_number_grea), 0, 1, 0, 0},
  {&__pyx_kp_u_Base_1_is_not_an_integer_greater, __pyx_k_Base_1_is_not_an_integer_greater, sizeof(__pyx_k_Base_1_is_not_an_integer_greater), 0, 1, 0, 0},
  {&__pyx_n_u_Blank, __pyx_k_Blank, sizeof(__pyx_k_Blank), 0, 1, 0, 1},
  {&__pyx_n_s_Builtin, __pyx_k_Builtin, sizeof(__pyx_k_Builtin), 0, 0, 1, 1},
  {&__pyx_n_u_ByteArray, __pyx_k_ByteArray, sizeof(__pyx_k_ByteArray), 0, 1, 0, 1},
  {&__pyx_n_u_CRC32, __pyx_k_CRC32, sizeof(__pyx_k_CRC32), 0, 1, 0, 1},
  {&__pyx_kp_u_Cannot_integrate, __pyx_k_Cannot_integrate, sizeof(__pyx_k_Cannot_integrate), 0, 1, 0, 0},
  {&__pyx_kp_u_Cannot_set_1_such_that_MaxPrecis, __pyx_k_Cannot_set_1_such_that_MaxPrecis, sizeof(__pyx_k_Cannot_set_1_such_that_MaxPrecis), 0, 1, 0, 0},
  {&__pyx_kp_u_Cannot_set_1_to_2_value_must_be, __pyx_k_Cannot_set_1_to_2_value_must_be, sizeof(__pyx_k_Cannot_set_1_to_2_value_must_be), 0, 1, 0, 0},
  {&__pyx_kp_u_Cannot_set_1_to_2_value_must_be_2, __pyx_k_Cannot_set_1_to_2_value_must_be_2, sizeof(__pyx_k_Cannot_set_1_to_2_value_must_be_2), 0, 1, 0, 0},
  {&__pyx_n_s_Chop, __pyx_k_Chop, sizeof(__pyx_k_Chop), 0, 0, 1, 1},
  {&__pyx_n_u_Chop, __pyx_k_Chop, sizeof(__pyx_k_Chop), 0, 1, 0, 1},
  {&__pyx_n_s_Chop_apply, __pyx_k_Chop_apply, sizeof(__pyx_k_Chop_apply), 0, 0, 1, 1},
  {&__pyx_kp_u_Chop_expr, __pyx_k_Chop_expr, sizeof(__pyx_k_Chop_expr), 0, 1, 0, 0},
  {&__pyx_kp_u_Chop_expr_10_10, __pyx_k_Chop_expr_10_10, sizeof(__pyx_k_Chop_expr_10_10), 0, 1, 0, 0},
  {&__pyx_n_u_Compile, __pyx_k_Compile, sizeof(__pyx_k_Compile), 0, 1, 0, 1},
  {&__pyx_n_s_Complex, __pyx_k_Complex, sizeof(__pyx_k_Complex), 0, 0, 1, 1},
  {&__pyx_n_u_Complex, __pyx_k_Complex, sizeof(__pyx_k_Complex), 0, 1, 0, 1},
  {&__pyx_n_s_ComputationFunctions, __pyx_k_ComputationFunctions, sizeof(__pyx_k_ComputationFunctions), 0, 0, 1, 1},
  {&__pyx_n_u_ComputationFunctions, __pyx_k_ComputationFunctions, sizeof(__pyx_k_ComputationFunctions), 0, 1, 0, 1},
  {&__pyx_n_u_Cos, __pyx_k_Cos, sizeof(__pyx_k_Cos), 0, 1, 0, 1},
  {&__pyx_n_u_DecimalString, __pyx_k_DecimalString, sizeof(__pyx_k_DecimalString), 0, 1, 0, 1},
  {&__pyx_n_u_Divide, __pyx_k_Divide, sizeof(__pyx_k_Divide), 0, 1, 0, 1},
  {&__pyx_n_u_E, __pyx_k_E, sizeof(__pyx_k_E), 0, 1, 0, 1},
  {&__pyx_n_s_Expression, __pyx_k_Expression, sizeof(__pyx_k_Expression), 0, 0, 1, 1},
  {&__pyx_n_s_FLOAT, __pyx_k_FLOAT, sizeof(__pyx_k_FLOAT), 0, 0, 1, 1},
  {&__pyx_n_u_False, __pyx_k_False, sizeof(__pyx_k_False), 0, 1, 0, 1},
  {&__pyx_n_s_Float, __pyx_k_Float, sizeof(__pyx_k_Float), 0, 0, 1, 1},
  {&__pyx_n_s_Fold, __pyx_k_Fold, sizeof(__pyx_k_Fold), 0, 0, 1, 1},
  {&__pyx_n_s_Fold__fold, __pyx_k_Fold__fold, sizeof(__pyx_k_Fold__fold), 0, 0, 1, 1},
  {&__pyx_n_s_Fold__operands, __pyx_k_Fold__operands, sizeof(__pyx_k_Fold__operands), 0, 0, 1, 1},
  {&__pyx_n_s_Fold__spans, __pyx_k_Fold__spans, sizeof(__pyx_k_Fold__spans), 0, 0, 1, 1},
  {&__pyx_n_s_Fold_fold, __pyx_k_Fold_fold, sizeof(__pyx_k_Fold_fold), 0, 0, 1, 1},
  {&__pyx_n_s_Fold_fold_locals_converted_opera, __pyx_k_Fold_fold_locals_converted_opera, sizeof(__pyx_k_Fold_fold_locals_converted_opera), 0, 0, 1, 1},
  {&__pyx_n_s_Fold_fold_locals_converted_opera_2, __pyx_k_Fold_fold_locals_converted_opera_2, sizeof(__pyx_k_Fold_fold_locals_converted_opera_2), 0, 0, 1, 1},
  {&__pyx_n_s_Fold_fold_locals_genexpr, __pyx_k_Fold_fold_locals_genexpr, sizeof(__pyx_k_Fold_fold_locals_genexpr), 0, 0, 1, 1},
  {&__pyx_n_s_Fold_fold_locals_out, __pyx_k_Fold_fold_locals_out, sizeof(__pyx_k_Fold_fold_locals_out), 0, 0, 1, 1},
  {&__pyx_n_s_Fold_fold_locals_working_precisi, __pyx_k_Fold_fold_locals_working_precisi, sizeof(__pyx_k_Fold_fold_locals_working_precisi), 0, 0, 1, 1},
  {&__pyx_n_s_Fold_lambda, __pyx_k_Fold_lambda, sizeof(__pyx_k_Fold_lambda), 0, 0, 1, 1},
  {&__pyx_kp_u_Function_undefined_around, __pyx_k_Function_undefined_around, sizeof(__pyx_k_Function_undefined_around), 0, 1, 0, 0},
  {&__pyx_n_s_Hash, __pyx_k_Hash, sizeof(__pyx_k_Hash), 0, 0, 1, 1},
  {&__pyx_n_s_Hash_apply, __pyx_k_Hash_apply, sizeof(__pyx_k_Hash_apply), 0, 0, 1, 1},
  {&__pyx_n_s_Hash_compute, __pyx_k_Hash_compute, sizeof(__pyx_k_Hash_compute), 0, 0, 1, 1},
  {&__pyx_kp_u_Hash_expr, __pyx_k_Hash_expr, sizeof(__pyx_k_Hash_expr), 0, 1, 0, 0},
  {&__pyx_kp_u_Hash_expr_MD5_Integer, __pyx_k_Hash_expr_MD5_Integer, sizeof(__pyx_k_Hash_expr_MD5_Integer), 0, 1, 0, 0},
  {&__pyx_kp_u_Hash_expr__type_String, __pyx_k_Hash_expr__type_String, sizeof(__pyx_k_Hash_expr__type_String), 0, 1, 0, 0},
  {&__pyx_kp_u_Hash_expr_type_Integer, __pyx_k_Hash_expr_type_Integer, sizeof(__pyx_k_Hash_expr_type_Integer), 0, 1, 0, 0},
  {&__pyx_n_s_Hash_lambda, __pyx_k_Hash_lambda, sizeof(__pyx_k_Hash_lambda), 0, 0, 1, 1},
  {&__pyx_kp_u_Head_N_x_Real, __pyx_k_Head_N_x_Real, sizeof(__pyx_k_Head_N_x_Real), 0, 1, 0, 0},
  {&__pyx_n_u_HexString, __pyx_k_HexString, sizeof(__pyx_k_HexString), 0, 1, 0, 1},
  {&__pyx_n_u_HexStringLittleEndian, __pyx_k_HexStringLittleEndian, sizeof(__pyx_k_HexStringLittleEndian), 0, 1, 0, 1},
  {&__pyx_n_u_Indeterminate, __pyx_k_Indeterminate, sizeof(__pyx_k_Indeterminate), 0, 1, 0, 1},
  {&__pyx_n_u_Infinity, __pyx_k_Infinity, sizeof(__pyx_k_Infinity), 0, 1, 0, 1},
  {&__pyx_n_s_Integer, __pyx_k_Integer, sizeof(__pyx_k_Integer), 0, 0, 1, 1},
  {&__pyx_n_s_Integer0, __pyx_k_Integer0, sizeof(__pyx_k_Integer0), 0, 0, 1, 1},
  {&__pyx_n_s_IntegerDigits, __pyx_k_IntegerDigits, sizeof(__pyx_k_IntegerDigits), 0, 0, 1, 1},
  {&__pyx_n_u_IntegerDigits, __pyx_k_IntegerDigits, sizeof(__pyx_k_IntegerDigits), 0, 1, 0, 1},
  {&__pyx_n_s_IntegerDigits_apply, __pyx_k_IntegerDigits_apply, sizeof(__pyx_k_IntegerDigits_apply), 0, 0, 1, 1},
  {&__pyx_n_s_IntegerDigits_apply_len, __pyx_k_IntegerDigits_apply_len, sizeof(__pyx_k_IntegerDigits_apply_len), 0, 0, 1, 1},
  {&__pyx_kp_u_IntegerDigits_n, __pyx_k_IntegerDigits_n, sizeof(__pyx_k_IntegerDigits_n), 0, 1, 0, 0},
  {&__pyx_kp_u_IntegerDigits_n_10, __pyx_k_IntegerDigits_n_10, sizeof(__pyx_k_IntegerDigits_n_10), 0, 1, 0, 0},
  {&__pyx_kp_u_Integer_expected_at_position_1_i, __pyx_k_Integer_expected_at_position_1_i, sizeof(__pyx_k_Integer_expected_at_position_1_i), 0, 1, 0, 0},
  {&__pyx_kp_u_Integration_over_a_complex_domai, __pyx_k_Integration_over_a_complex_domai, sizeof(__pyx_k_Integration_over_a_complex_domai), 0, 1, 0, 0},
  {&__pyx_n_u_Internal, __pyx_k_Internal, sizeof(__pyx_k_Internal), 0, 1, 0, 1},
  {&__pyx_kp_u_Internal_2, __pyx_k_Internal_2, sizeof(__pyx_k_Internal_2), 0, 1, 0, 0},
  {&__pyx_kp_u_Internal_RealValuedNumberQ_x, __pyx_k_Internal_RealValuedNumberQ_x, sizeof(__pyx_k_Internal_RealValuedNumberQ_x), 0, 1, 0, 0},
  {&__pyx_kp_u_Internal_RealValuedNumberQ_x_Int, __pyx_k_Internal_RealValuedNumberQ_x_Int, sizeof(__pyx_k_Internal_RealValuedNumberQ_x_Int), 0, 1, 0, 0},
  {&__pyx_kp_u_Internal_RealValuedNumberQ_x_Rat, __pyx_k_Internal_RealValuedNumberQ_x_Rat, sizeof(__pyx_k_Internal_RealValuedNumberQ_x_Rat), 0, 1, 0, 0},
  {&__pyx_kp_u_Internal_RealValuedNumberQ_x_Rea, __pyx_k_Internal_RealValuedNumberQ_x_Rea, sizeof(__pyx_k_Internal_RealValuedNumberQ_x_Rea), 0, 1, 0, 0},
  {&__pyx_kp_u_Internal_RealValuedNumericQ_x, __pyx_k_Internal_RealValuedNumericQ_x, sizeof(__pyx_k_Internal_RealValuedNumericQ_x), 0, 1, 0, 0},
  {&__pyx_kp_u_Invalid_integration_variable_or, __pyx_k_Invalid_integration_variable_or, sizeof(__pyx_k_Invalid_integration_variable_or), 0, 1, 0, 0},
  {&__pyx_n_u_List, __pyx_k_List, sizeof(__pyx_k_List), 0, 1, 0, 1},
  {&__pyx_n_u_Listable, __pyx_k_Listable, sizeof(__pyx_k_Listable), 0, 1, 0, 1},
  {&__pyx_n_u_Log, __pyx_k_Log, sizeof(__pyx_k_Log), 0, 1, 0, 1},
  {&__pyx_n_u_MD5, __pyx_k_MD5, sizeof(__pyx_k_MD5), 0, 1, 0, 1},
  {&__pyx_n_s_MPMATH, __pyx_k_MPMATH, sizeof(__pyx_k_MPMATH), 0, 0, 1, 1},
  {&__pyx_n_s_MachineEpsilon, __pyx_k_MachineEpsilon, sizeof(__pyx_k_MachineEpsilon), 0, 0, 1, 1},
  {&__pyx_kp_u_MachineEpsilon_2, __pyx_k_MachineEpsilon_2, sizeof(__pyx_k_MachineEpsilon_2), 0, 1, 0, 0},
  {&__pyx_n_s_MachineEpsilon__evaluate, __pyx_k_MachineEpsilon__evaluate, sizeof(__pyx_k_MachineEpsilon__evaluate), 0, 0, 1, 1},
  {&__pyx_n_s_MachinePrecision, __pyx_k_MachinePrecision, sizeof(__pyx_k_MachinePrecision), 0, 0, 1, 1},
  {&__pyx_n_u_MachinePrecision, __pyx_k_MachinePrecision, sizeof(__pyx_k_MachinePrecision), 0, 1, 0, 1},
  {&__pyx_n_s_MachinePrecision_2, __pyx_k_MachinePrecision_2, sizeof(__pyx_k_MachinePrecision_2), 0, 0, 1, 1},
  {&__pyx_kp_u_MachinePrecision_3, __pyx_k_MachinePrecision_3, sizeof(__pyx_k_MachinePrecision_3), 0, 1, 0, 0},
  {&__pyx_n_s_MachineReal, __pyx_k_MachineReal, sizeof(__pyx_k_MachineReal), 0, 0, 1, 1},
  {&__pyx_kp_u_Machine_sized_integer_expected_a, __pyx_k_Machine_sized_integer_expected_a, sizeof(__pyx_k_Machine_sized_integer_expected_a), 0, 1, 0, 0},
  {&__pyx_n_s_MaxPrecision, __pyx_k_MaxPrecision, sizeof(__pyx_k_MaxPrecision), 0, 0, 1, 1},
  {&__pyx_kp_u_MaxPrecision_2, __pyx_k_MaxPrecision_2, sizeof(__pyx_k_MaxPrecision_2), 0, 1, 0, 0},
  {&__pyx_n_u_MaxRecursion, __pyx_k_MaxRecursion, sizeof(__pyx_k_MaxRecursion), 0, 1, 0, 1},
  {&__pyx_n_u_Method, __pyx_k_Method, sizeof(__pyx_k_Method), 0, 1, 0, 1},
  {&__pyx_n_s_MinPrecision, __pyx_k_MinPrecision, sizeof(__pyx_k_MinPrecision), 0, 0, 1, 1},
  {&__pyx_kp_u_MinPrecision_2, __pyx_k_MinPrecision_2, sizeof(__pyx_k_MinPrecision_2), 0, 1, 0, 0},
  {&__pyx_n_s_N, __pyx_k_N, sizeof(__pyx_k_N), 0, 0, 1, 1},
  {&__pyx_n_u_N, __pyx_k_N, sizeof(__pyx_k_N), 0, 1, 0, 1},
  {&__pyx_n_s_NIntegrate, __pyx_k_NIntegrate, sizeof(__pyx_k_NIntegrate), 0, 0, 1, 1},
  {&__pyx_n_u_NIntegrate, __pyx_k_NIntegrate, sizeof(__pyx_k_NIntegrate), 0, 1, 0, 1},
  {&__pyx_n_s_NIntegrate___init, __pyx_k_NIntegrate___init, sizeof(__pyx_k_NIntegrate___init), 0, 0, 1, 1},
  {&__pyx_n_s_NIntegrate___init___locals_lambd, __pyx_k_NIntegrate___init___locals_lambd, sizeof(__pyx_k_NIntegrate___init___locals_lambd), 0, 0, 1, 1},
  {&__pyx_n_s_NIntegrate_apply_with_func_domai, __pyx_k_NIntegrate_apply_with_func_domai, sizeof(__pyx_k_NIntegrate_apply_with_func_domai), 0, 0, 1, 1},
  {&__pyx_n_s_NIntegrate_apply_with_func_domai_2, __pyx_k_NIntegrate_apply_with_func_domai_2, sizeof(__pyx_k_NIntegrate_apply_with_func_domai_2), 0, 0, 1, 1},
  {&__pyx_n_s_NIntegrate_decompose_domain, __pyx_k_NIntegrate_decompose_domain, sizeof(__pyx_k_NIntegrate_decompose_domain), 0, 0, 1, 1},
  {&__pyx_n_u_NQuadrature, __pyx_k_NQuadrature, sizeof(__pyx_k_NQuadrature), 0, 1, 0, 1},
  {&__pyx_kp_u_N_Log_10_2_i_prec, __pyx_k_N_Log_10_2_i_prec, sizeof(__pyx_k_N_Log_10_2_i_prec), 0, 1, 0, 0},
  {&__pyx_kp_u_N_MachinePrecision, __pyx_k_N_MachinePrecision, sizeof(__pyx_k_N_MachinePrecision), 0, 1, 0, 0},
  {&__pyx_kp_u_N_MachinePrecision_prec, __pyx_k_N_MachinePrecision_prec, sizeof(__pyx_k_N_MachinePrecision_prec), 0, 1, 0, 0},
  {&__pyx_n_s_N_apply_with_prec, __pyx_k_N_apply_with_prec, sizeof(__pyx_k_N_apply_with_prec), 0, 0, 1, 1},
  {&__pyx_kp_u_N_expr, __pyx_k_N_expr, sizeof(__pyx_k_N_expr), 0, 1, 0, 0},
  {&__pyx_kp_u_N_expr_MachinePrecision, __pyx_k_N_expr_MachinePrecision, sizeof(__pyx_k_N_expr_MachinePrecision), 0, 1, 0, 0},
  {&__pyx_kp_u_Non_negative_machine_sized_integ, __pyx_k_Non_negative_machine_sized_integ, sizeof(__pyx_k_Non_negative_machine_sized_integ), 0, 1, 0, 0},
  {&__pyx_n_s_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1},
  {&__pyx_n_s_Number, __pyx_k_Number, sizeof(__pyx_k_Number), 0, 0, 1, 1},
  {&__pyx_n_u_NumericFunction, __pyx_k_NumericFunction, sizeof(__pyx_k_NumericFunction), 0, 1, 0, 1},
  {&__pyx_n_s_NumericQ, __pyx_k_NumericQ, sizeof(__pyx_k_NumericQ), 0, 0, 1, 1},
  {&__pyx_n_s_NumericQ_apply, __pyx_k_NumericQ_apply, sizeof(__pyx_k_NumericQ_apply), 0, 0, 1, 1},
  {&__pyx_n_s_NumericQ_apply_locals_test, __pyx_k_NumericQ_apply_locals_test, sizeof(__pyx_k_NumericQ_apply_locals_test), 0, 0, 1, 1},
  {&__pyx_n_s_NumericQ_apply_locals_test_local, __pyx_k_NumericQ_apply_locals_test_local, sizeof(__pyx_k_NumericQ_apply_locals_test_local), 0, 0, 1, 1},
  {&__pyx_n_s_Precision, __pyx_k_Precision, sizeof(__pyx_k_Precision), 0, 0, 1, 1},
  {&__pyx_n_u_Precision, __pyx_k_Precision, sizeof(__pyx_k_Precision), 0, 1, 0, 1},
  {&__pyx_n_s_PrecisionValueError, __pyx_k_PrecisionValueError, sizeof(__pyx_k_PrecisionValueError), 0, 0, 1, 1},
  {&__pyx_n_s_Precision_apply, __pyx_k_Precision_apply, sizeof(__pyx_k_Precision_apply), 0, 0, 1, 1},
  {&__pyx_kp_u_Precision_z__MachineNumberQ, __pyx_k_Precision_z__MachineNumberQ, sizeof(__pyx_k_Precision_z__MachineNumberQ), 0, 1, 0, 0},
  {&__pyx_n_s_Predefined, __pyx_k_Predefined, sizeof(__pyx_k_Predefined), 0, 0, 1, 1},
  {&__pyx_n_u_Protected, __pyx_k_Protected, sizeof(__pyx_k_Protected), 0, 1, 0, 1},
  {&__pyx_n_u_Quadrature, __pyx_k_Quadrature, sizeof(__pyx_k_Quadrature), 0, 1, 0, 1},
  {&__pyx_n_s_Rational, __pyx_k_Rational, sizeof(__pyx_k_Rational), 0, 0, 1, 1},
  {&__pyx_n_s_Rationalize, __pyx_k_Rationalize, sizeof(__pyx_k_Rationalize), 0, 0, 1, 1},
  {&__pyx_n_u_Rationalize, __pyx_k_Rationalize, sizeof(__pyx_k_Rationalize), 0, 1, 0, 1},
  {&__pyx_kp_u_Rationalize_Re_z_I_Rationalize_I, __pyx_k_Rationalize_Re_z_I_Rationalize_I, sizeof(__pyx_k_Rationalize_Re_z_I_Rationalize_I), 0, 1, 0, 0},
  {&__pyx_kp_u_Rationalize_Re_z_dx_I_Rationaliz, __pyx_k_Rationalize_Re_z_dx_I_Rationaliz, sizeof(__pyx_k_Rationalize_Re_z_dx_I_Rationaliz), 0, 1, 0, 0},
  {&__pyx_n_s_Rationalize_apply, __pyx_k_Rationalize_apply, sizeof(__pyx_k_Rationalize_apply), 0, 0, 1, 1},
  {&__pyx_n_s_Rationalize_apply_dx, __pyx_k_Rationalize_apply_dx, sizeof(__pyx_k_Rationalize_apply_dx), 0, 0, 1, 1},
  {&__pyx_n_s_Rationalize_approx_interval_cont, __pyx_k_Rationalize_approx_interval_cont, sizeof(__pyx_k_Rationalize_approx_interval_cont), 0, 0, 1, 1},
  {&__pyx_n_s_Rationalize_find_approximant, __pyx_k_Rationalize_find_approximant, sizeof(__pyx_k_Rationalize_find_approximant), 0, 0, 1, 1},
  {&__pyx_n_s_Rationalize_find_exact, __pyx_k_Rationalize_find_exact, sizeof(__pyx_k_Rationalize_find_exact), 0, 0, 1, 1},
  {&__pyx_kp_u_Rationalize_z_Complex, __pyx_k_Rationalize_z_Complex, sizeof(__pyx_k_Rationalize_z_Complex), 0, 1, 0, 0},
  {&__pyx_kp_u_Rationalize_z_Complex_dx__Intern, __pyx_k_Rationalize_z_Complex_dx__Intern, sizeof(__pyx_k_Rationalize_z_Complex_dx__Intern), 0, 1, 0, 0},
  {&__pyx_n_u_ReadProtected, __pyx_k_ReadProtected, sizeof(__pyx_k_ReadProtected), 0, 1, 0, 1},
  {&__pyx_n_s_Real, __pyx_k_Real, sizeof(__pyx_k_Real), 0, 0, 1, 1},
  {&__pyx_n_s_RealDigits, __pyx_k_RealDigits, sizeof(__pyx_k_RealDigits), 0, 0, 1, 1},
  {&__pyx_n_u_RealDigits, __pyx_k_RealDigits, sizeof(__pyx_k_RealDigits), 0, 1, 0, 1},
  {&__pyx_n_s_RealDigits_apply, __pyx_k_RealDigits_apply, sizeof(__pyx_k_RealDigits_apply), 0, 0, 1, 1},
  {&__pyx_n_s_RealDigits_apply_complex, __pyx_k_RealDigits_apply_complex, sizeof(__pyx_k_RealDigits_apply_complex), 0, 0, 1, 1},
  {&__pyx_n_s_RealDigits_apply_rational_with_b, __pyx_k_RealDigits_apply_rational_with_b, sizeof(__pyx_k_RealDigits_apply_rational_with_b), 0, 0, 1, 1},
  {&__pyx_n_s_RealDigits_apply_rational_withou, __pyx_k_RealDigits_apply_rational_withou, sizeof(__pyx_k_RealDigits_apply_rational_withou), 0, 0, 1, 1},
  {&__pyx_n_s_RealDigits_apply_with_base, __pyx_k_RealDigits_apply_with_base, sizeof(__pyx_k_RealDigits_apply_with_base), 0, 0, 1, 1},
  {&__pyx_n_s_RealDigits_apply_with_base_and_l, __pyx_k_RealDigits_apply_with_base_and_l, sizeof(__pyx_k_RealDigits_apply_with_base_and_l), 0, 0, 1, 1},
  {&__pyx_n_s_RealDigits_apply_with_base_lengt, __pyx_k_RealDigits_apply_with_base_lengt, sizeof(__pyx_k_RealDigits_apply_with_base_lengt), 0, 0, 1, 1},
  {&__pyx_n_s_RealValuedNumberQ, __pyx_k_RealValuedNumberQ, sizeof(__pyx_k_RealValuedNumberQ), 0, 0, 1, 1},
  {&__pyx_n_s_RealValuedNumericQ, __pyx_k_RealValuedNumericQ, sizeof(__pyx_k_RealValuedNumericQ), 0, 0, 1, 1},
  {&__pyx_kp_u_Requested_precision_1_is_larger, __pyx_k_Requested_precision_1_is_larger, sizeof(__pyx_k_Requested_precision_1_is_larger), 0, 1, 0, 0},
  {&__pyx_kp_u_Requested_precision_1_is_not_a_m, __pyx_k_Requested_precision_1_is_not_a_m, sizeof(__pyx_k_Requested_precision_1_is_not_a_m), 0, 1, 0, 0},
  {&__pyx_kp_u_Requested_precision_1_is_smaller, __pyx_k_Requested_precision_1_is_smaller, sizeof(__pyx_k_Requested_precision_1_is_smaller), 0, 1, 0, 0},
  {&__pyx_n_u_Romberg, __pyx_k_Romberg, sizeof(__pyx_k_Romberg), 0, 1, 0, 1},
  {&__pyx_n_u_Root, __pyx_k_Root, sizeof(__pyx_k_Root), 0, 1, 0, 1},
  {&__pyx_n_s_Round, __pyx_k_Round, sizeof(__pyx_k_Round), 0, 0, 1, 1},
  {&__pyx_n_u_Round, __pyx_k_Round, sizeof(__pyx_k_Round), 0, 1, 0, 1},
  {&__pyx_kp_u_Round_Re_expr_1_I_Round_Im_expr, __pyx_k_Round_Re_expr_1_I_Round_Im_expr, sizeof(__pyx_k_Round_Re_expr_1_I_Round_Im_expr), 0, 1, 0, 0},
  {&__pyx_kp_u_Round_Re_expr_k_I_Round_Im_expr, __pyx_k_Round_Re_expr_k_I_Round_Im_expr, sizeof(__pyx_k_Round_Re_expr_k_I_Round_Im_expr), 0, 1, 0, 0},
  {&__pyx_n_s_Round_apply, __pyx_k_Round_apply, sizeof(__pyx_k_Round_apply), 0, 0, 1, 1},
  {&__pyx_kp_u_Round_expr_Complex_k__RealNumber, __pyx_k_Round_expr_Complex_k__RealNumber, sizeof(__pyx_k_Round_expr_Complex_k__RealNumber), 0, 1, 0, 0},
  {&__pyx_kp_u_Round_expr__NumericQ, __pyx_k_Round_expr__NumericQ, sizeof(__pyx_k_Round_expr__NumericQ), 0, 1, 0, 0},
  {&__pyx_n_u_SHA, __pyx_k_SHA, sizeof(__pyx_k_SHA), 0, 1, 0, 1},
  {&__pyx_n_u_SHA224, __pyx_k_SHA224, sizeof(__pyx_k_SHA224), 0, 1, 0, 1},
  {&__pyx_n_u_SHA256, __pyx_k_SHA256, sizeof(__pyx_k_SHA256), 0, 1, 0, 1},
  {&__pyx_n_u_SHA384, __pyx_k_SHA384, sizeof(__pyx_k_SHA384), 0, 1, 0, 1},
  {&__pyx_n_u_SHA512, __pyx_k_SHA512, sizeof(__pyx_k_SHA512), 0, 1, 0, 1},
  {&__pyx_n_s_SYMBOLIC, __pyx_k_SYMBOLIC, sizeof(__pyx_k_SYMBOLIC), 0, 0, 1, 1},
  {&__pyx_n_u_Simpson, __pyx_k_Simpson, sizeof(__pyx_k_Simpson), 0, 1, 0, 1},
  {&__pyx_n_u_Sin, __pyx_k_Sin, sizeof(__pyx_k_Sin), 0, 1, 0, 1},
  {&__pyx_n_s_String, __pyx_k_String, sizeof(__pyx_k_String), 0, 0, 1, 1},
  {&__pyx_n_s_Symbol, __pyx_k_Symbol, sizeof(__pyx_k_Symbol), 0, 0, 1, 1},
  {&__pyx_n_s_SymbolFalse, __pyx_k_SymbolFalse, sizeof(__pyx_k_SymbolFalse), 0, 0, 1, 1},
  {&__pyx_n_s_SymbolList, __pyx_k_SymbolList, sizeof(__pyx_k_SymbolList), 0, 0, 1, 1},
  {&__pyx_n_s_SymbolN, __pyx_k_SymbolN, sizeof(__pyx_k_SymbolN), 0, 0, 1, 1},
  {&__pyx_n_s_SymbolTrue, __pyx_k_SymbolTrue, sizeof(__pyx_k_SymbolTrue), 0, 0, 1, 1},
  {&__pyx_kp_u_System, __pyx_k_System, sizeof(__pyx_k_System), 0, 1, 0, 0},
  {&__pyx_kp_u_System_Accuracy, __pyx_k_System_Accuracy, sizeof(__pyx_k_System_Accuracy), 0, 1, 0, 0},
  {&__pyx_kp_u_System_Complex, __pyx_k_System_Complex, sizeof(__pyx_k_System_Complex), 0, 1, 0, 0},
  {&__pyx_kp_u_System_DirectedInfinity, __pyx_k_System_DirectedInfinity, sizeof(__pyx_k_System_DirectedInfinity), 0, 1, 0, 0},
  {&__pyx_kp_u_System_List, __pyx_k_System_List, sizeof(__pyx_k_System_List), 0, 1, 0, 0},
  {&__pyx_kp_u_System_MaxRecursion, __pyx_k_System_MaxRecursion, sizeof(__pyx_k_System_MaxRecursion), 0, 1, 0, 0},
  {&__pyx_kp_u_System_Method, __pyx_k_System_Method, sizeof(__pyx_k_System_Method), 0, 1, 0, 0},
  {&__pyx_kp_u_System_NHoldAll, __pyx_k_System_NHoldAll, sizeof(__pyx_k_System_NHoldAll), 0, 1, 0, 0},
  {&__pyx_kp_u_System_NHoldFirst, __pyx_k_System_NHoldFirst, sizeof(__pyx_k_System_NHoldFirst), 0, 1, 0, 0},
  {&__pyx_kp_u_System_NHoldRest, __pyx_k_System_NHoldRest, sizeof(__pyx_k_System_NHoldRest), 0, 1, 0, 0},
  {&__pyx_kp_u_System_NValues, __pyx_k_System_NValues, sizeof(__pyx_k_System_NValues), 0, 1, 0, 0},
  {&__pyx_kp_u_System_NumericFunction, __pyx_k_System_NumericFunction, sizeof(__pyx_k_System_NumericFunction), 0, 1, 0, 0},
  {&__pyx_kp_u_System_Rule, __pyx_k_System_Rule, sizeof(__pyx_k_System_Rule), 0, 1, 0, 0},
  {&__pyx_kp_u_System_Sequence, __pyx_k_System_Sequence, sizeof(__pyx_k_System_Sequence), 0, 1, 0, 0},
  {&__pyx_kp_u_System_Tolerance, __pyx_k_System_Tolerance, sizeof(__pyx_k_System_Tolerance), 0, 1, 0, 0},
  {&__pyx_kp_u_The_Method_option_should_be_a_bu, __pyx_k_The_Method_option_should_be_a_bu, sizeof(__pyx_k_The_Method_option_should_be_a_bu), 0, 1, 0, 0},
  {&__pyx_kp_u_The_Method_option_should_be_a_bu_2, __pyx_k_The_Method_option_should_be_a_bu_2, sizeof(__pyx_k_The_Method_option_should_be_a_bu_2), 0, 1, 0, 0},
  {&__pyx_kp_u_The_integrand_1_has_evaluated_to, __pyx_k_The_integrand_1_has_evaluated_to, sizeof(__pyx_k_The_integrand_1_has_evaluated_to), 0, 1, 0, 0},
  {&__pyx_kp_u_The_number_of_digits_to_return_c, __pyx_k_The_number_of_digits_to_return_c, sizeof(__pyx_k_The_number_of_digits_to_return_c), 0, 1, 0, 0},
  {&__pyx_kp_u_The_specified_method_failed_to_r, __pyx_k_The_specified_method_failed_to_r, sizeof(__pyx_k_The_specified_method_failed_to_r), 0, 1, 0, 0},
  {&__pyx_kp_u_The_value_1_is_not_a_real_number, __pyx_k_The_value_1_is_not_a_real_number, sizeof(__pyx_k_The_value_1_is_not_a_real_number), 0, 1, 0, 0},
  {&__pyx_n_u_Times, __pyx_k_Times, sizeof(__pyx_k_Times), 0, 1, 0, 1},
  {&__pyx_n_u_Tolerance, __pyx_k_Tolerance, sizeof(__pyx_k_Tolerance), 0, 1, 0, 1},
  {&__pyx_kp_u_Tolerance_specification_1_must_b, __pyx_k_Tolerance_specification_1_must_b, sizeof(__pyx_k_Tolerance_specification_1_must_b), 0, 1, 0, 0},
  {&__pyx_kp_u_Tolerance_specification_a_must_b, __pyx_k_Tolerance_specification_a_must_b, sizeof(__pyx_k_Tolerance_specification_a_must_b), 0, 1, 0, 0},
  {&__pyx_n_u_True, __pyx_k_True, sizeof(__pyx_k_True), 0, 1, 0, 1},
  {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
  {&__pyx_n_s_TypeEscalation, __pyx_k_TypeEscalation, sizeof(__pyx_k_TypeEscalation), 0, 0, 1, 1},
  {&__pyx_n_s_TypeEscalation___init, __pyx_k_TypeEscalation___init, sizeof(__pyx_k_TypeEscalation___init), 0, 0, 1, 1},
  {&__pyx_kp_u_Using_Automatic, __pyx_k_Using_Automatic, sizeof(__pyx_k_Using_Automatic), 0, 1, 0, 0},
  {&__pyx_n_s_ZLibHash, __pyx_k_ZLibHash, sizeof(__pyx_k_ZLibHash), 0, 0, 1, 1},
  {&__pyx_n_s_ZLibHash___init, __pyx_k_ZLibHash___init, sizeof(__pyx_k_ZLibHash___init), 0, 0, 1, 1},
  {&__pyx_n_s_ZLibHash_hexdigest, __pyx_k_ZLibHash_hexdigest, sizeof(__pyx_k_ZLibHash_hexdigest), 0, 0, 1, 1},
  {&__pyx_n_s_ZLibHash_update, __pyx_k_ZLibHash_update, sizeof(__pyx_k_ZLibHash_update), 0, 0, 1, 1},
  {&__pyx_n_s_ZeroDivisionError, __pyx_k_ZeroDivisionError, sizeof(__pyx_k_ZeroDivisionError), 0, 0, 1, 1},
  {&__pyx_kp_b__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 0, 0, 0},
  {&__pyx_kp_u__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 1, 0, 0},
  {&__pyx_kp_u__22, __pyx_k__22, sizeof(__pyx_k__22), 0, 1, 0, 0},
  {&__pyx_kp_u__36, __pyx_k__36, sizeof(__pyx_k__36), 0, 1, 0, 0},
  {&__pyx_n_s__38, __pyx_k__38, sizeof(__pyx_k__38), 0, 0, 1, 1},
  {&__pyx_n_s_a, __pyx_k_a, sizeof(__pyx_k_a), 0, 0, 1, 1},
  {&__pyx_n_s_a_gen, __pyx_k_a_gen, sizeof(__pyx_k_a_gen), 0, 0, 1, 1},
  {&__pyx_n_s_accuracy, __pyx_k_accuracy, sizeof(__pyx_k_accuracy), 0, 0, 1, 1},
  {&__pyx_n_u_acur, __pyx_k_acur, sizeof(__pyx_k_acur), 0, 1, 0, 1},
  {&__pyx_n_s_adapt_func, __pyx_k_adapt_func, sizeof(__pyx_k_adapt_func), 0, 0, 1, 1},
  {&__pyx_n_s_adler32, __pyx_k_adler32, sizeof(__pyx_k_adler32), 0, 0, 1, 1},
  {&__pyx_n_s_any, __pyx_k_any, sizeof(__pyx_k_any), 0, 0, 1, 1},
  {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1},
  {&__pyx_n_s_apply, __pyx_k_apply, sizeof(__pyx_k_apply), 0, 0, 1, 1},
  {&__pyx_n_s_apply_complex, __pyx_k_apply_complex, sizeof(__pyx_k_apply_complex), 0, 0, 1, 1},
  {&__pyx_n_s_apply_dx, __pyx_k_apply_dx, sizeof(__pyx_k_apply_dx), 0, 0, 1, 1},
  {&__pyx_n_s_apply_len, __pyx_k_apply_len, sizeof(__pyx_k_apply_len), 0, 0, 1, 1},
  {&__pyx_n_s_apply_rational_with_base, __pyx_k_apply_rational_with_base, sizeof(__pyx_k_apply_rational_with_base), 0, 0, 1, 1},
  {&__pyx_n_s_apply_rational_without_base, __pyx_k_apply_rational_without_base, sizeof(__pyx_k_apply_rational_without_base), 0, 0, 1, 1},
  {&__pyx_n_s_apply_with_base, __pyx_k_apply_with_base, sizeof(__pyx_k_apply_with_base), 0, 0, 1, 1},
  {&__pyx_n_s_apply_with_base_and_length, __pyx_k_apply_with_base_and_length, sizeof(__pyx_k_apply_with_base_and_length), 0, 0, 1, 1},
  {&__pyx_n_s_apply_with_base_length_and_preci, __pyx_k_apply_with_base_length_and_preci, sizeof(__pyx_k_apply_with_base_length_and_preci), 0, 0, 1, 1},
  {&__pyx_n_s_apply_with_func_domain, __pyx_k_apply_with_func_domain, sizeof(__pyx_k_apply_with_func_domain), 0, 0, 1, 1},
  {&__pyx_n_s_apply_with_prec, __pyx_k_apply_with_prec, sizeof(__pyx_k_apply_with_prec), 0, 0, 1, 1},
  {&__pyx_n_s_approx_interval_continued_fracti, __pyx_k_approx_interval_continued_fracti, sizeof(__pyx_k_approx_interval_continued_fracti), 0, 0, 1, 1},
  {&__pyx_n_s_arctanh, __pyx_k_arctanh, sizeof(__pyx_k_arctanh), 0, 0, 1, 1},
  {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
  {&__pyx_n_s_as_numer_denom, __pyx_k_as_numer_denom, sizeof(__pyx_k_as_numer_denom), 0, 0, 1, 1},
  {&__pyx_n_s_as_operand, __pyx_k_as_operand, sizeof(__pyx_k_as_operand), 0, 0, 1, 1},
  {&__pyx_n_s_attr, __pyx_k_attr, sizeof(__pyx_k_attr), 0, 0, 1, 1},
  {&__pyx_n_s_attributes, __pyx_k_attributes, sizeof(__pyx_k_attributes), 0, 0, 1, 1},
  {&__pyx_n_s_axis, __pyx_k_axis, sizeof(__pyx_k_axis), 0, 0, 1, 1},
  {&__pyx_n_s_b, __pyx_k_b, sizeof(__pyx_k_b), 0, 0, 1, 1},
  {&__pyx_n_s_b_gen, __pyx_k_b_gen, sizeof(__pyx_k_b_gen), 0, 0, 1, 1},
  {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1},
  {&__pyx_n_u_bdmtd, __pyx_k_bdmtd, sizeof(__pyx_k_bdmtd), 0, 1, 0, 1},
  {&__pyx_n_s_boundaries, __pyx_k_boundaries, sizeof(__pyx_k_boundaries), 0, 0, 1, 1},
  {&__pyx_n_s_bytes, __pyx_k_bytes, sizeof(__pyx_k_bytes), 0, 0, 1, 1},
  {&__pyx_n_s_bytes_2, __pyx_k_bytes_2, sizeof(__pyx_k_bytes_2), 0, 0, 1, 1},
  {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
  {&__pyx_n_s_c_init, __pyx_k_c_init, sizeof(__pyx_k_c_init), 0, 0, 1, 1},
  {&__pyx_n_s_c_operands, __pyx_k_c_operands, sizeof(__pyx_k_c_operands), 0, 0, 1, 1},
  {&__pyx_n_s_ceil, __pyx_k_ceil, sizeof(__pyx_k_ceil), 0, 0, 1, 1},
  {&__pyx_n_s_cfunc, __pyx_k_cfunc, sizeof(__pyx_k_cfunc), 0, 0, 1, 1},
  {&__pyx_n_s_chain, __pyx_k_chain, sizeof(__pyx_k_chain), 0, 0, 1, 1},
  {&__pyx_n_s_check_finite_decimal, __pyx_k_check_finite_decimal, sizeof(__pyx_k_check_finite_decimal), 0, 0, 1, 1},
  {&__pyx_n_s_chop, __pyx_k_chop, sizeof(__pyx_k_chop), 0, 0, 1, 1},
  {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
  {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
  {&__pyx_n_u_cmpint, __pyx_k_cmpint, sizeof(__pyx_k_cmpint), 0, 1, 0, 1},
  {&__pyx_n_s_collections, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1},
  {&__pyx_n_s_compute, __pyx_k_compute, sizeof(__pyx_k_compute), 0, 0, 1, 1},
  {&__pyx_n_s_context, __pyx_k_context, sizeof(__pyx_k_context), 0, 0, 1, 1},
  {&__pyx_n_s_contextlib, __pyx_k_contextlib, sizeof(__pyx_k_contextlib), 0, 0, 1, 1},
  {&__pyx_n_s_contextmanager, __pyx_k_contextmanager, sizeof(__pyx_k_contextmanager), 0, 0, 1, 1},
  {&__pyx_n_s_continued_fraction_convergents, __pyx_k_continued_fraction_convergents, sizeof(__pyx_k_continued_fraction_convergents), 0, 0, 1, 1},
  {&__pyx_n_s_continued_fraction_iterator, __pyx_k_continued_fraction_iterator, sizeof(__pyx_k_continued_fraction_iterator), 0, 0, 1, 1},
  {&__pyx_n_s_continued_fraction_reduce, __pyx_k_continued_fraction_reduce, sizeof(__pyx_k_continued_fraction_reduce), 0, 0, 1, 1},
  {&__pyx_n_s_convert_float, __pyx_k_convert_float, sizeof(__pyx_k_convert_float), 0, 0, 1, 1},
  {&__pyx_n_s_convert_float_base, __pyx_k_convert_float_base, sizeof(__pyx_k_convert_float_base), 0, 0, 1, 1},
  {&__pyx_n_s_convert_float_base_locals_conver, __pyx_k_convert_float_base_locals_conver, sizeof(__pyx_k_convert_float_base_locals_conver), 0, 0, 1, 1},
  {&__pyx_n_s_convert_float_base_locals_conver_2, __pyx_k_convert_float_base_locals_conver_2, sizeof(__pyx_k_convert_float_base_locals_conver_2), 0, 0, 1, 1},
  {&__pyx_n_s_convert_int, __pyx_k_convert_int, sizeof(__pyx_k_convert_int), 0, 0, 1, 1},
  {&__pyx_n_s_convert_int_to_digit_list, __pyx_k_convert_int_to_digit_list, sizeof(__pyx_k_convert_int_to_digit_list), 0, 0, 1, 1},
  {&__pyx_n_s_convert_repeating_decimal, __pyx_k_convert_repeating_decimal, sizeof(__pyx_k_convert_repeating_decimal), 0, 0, 1, 1},
  {&__pyx_n_s_convert_repeating_decimal_locals, __pyx_k_convert_repeating_decimal_locals, sizeof(__pyx_k_convert_repeating_decimal_locals), 0, 0, 1, 1},
  {&__pyx_n_s_converted_operands, __pyx_k_converted_operands, sizeof(__pyx_k_converted_operands), 0, 0, 1, 1},
  {&__pyx_n_s_coords, __pyx_k_coords, sizeof(__pyx_k_coords), 0, 0, 1, 1},
  {&__pyx_n_s_coordtransform, __pyx_k_coordtransform, sizeof(__pyx_k_coordtransform), 0, 0, 1, 1},
  {&__pyx_n_s_cos, __pyx_k_cos, sizeof(__pyx_k_cos), 0, 0, 1, 1},
  {&__pyx_n_u_cos, __pyx_k_cos, sizeof(__pyx_k_cos), 0, 1, 0, 1},
  {&__pyx_n_s_crc32, __pyx_k_crc32, sizeof(__pyx_k_crc32), 0, 0, 1, 1},
  {&__pyx_n_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 1},
  {&__pyx_n_s_decompose_domain, __pyx_k_decompose_domain, sizeof(__pyx_k_decompose_domain), 0, 0, 1, 1},
  {&__pyx_n_s_definitions, __pyx_k_definitions, sizeof(__pyx_k_definitions), 0, 0, 1, 1},
  {&__pyx_n_s_delta, __pyx_k_delta, sizeof(__pyx_k_delta), 0, 0, 1, 1},
  {&__pyx_n_s_denominator, __pyx_k_denominator, sizeof(__pyx_k_denominator), 0, 0, 1, 1},
  {&__pyx_n_s_digits, __pyx_k_digits, sizeof(__pyx_k_digits), 0, 0, 1, 1},
  {&__pyx_n_s_display_len, __pyx_k_display_len, sizeof(__pyx_k_display_len), 0, 0, 1, 1},
  {&__pyx_n_u_divmax, __pyx_k_divmax, sizeof(__pyx_k_divmax), 0, 1, 0, 1},
  {&__pyx_kp_s_dl_dt_Chop_expr_dd_replaces_flo, __pyx_k_dl_dt_Chop_expr_dd_replaces_flo, sizeof(__pyx_k_dl_dt_Chop_expr_dd_replaces_flo), 0, 0, 1, 0},
  {&__pyx_kp_s_dl_dt_Hash_expr_dd_returns_an_i, __pyx_k_dl_dt_Hash_expr_dd_returns_an_i, sizeof(__pyx_k_dl_dt_Hash_expr_dd_returns_an_i), 0, 0, 1, 0},
  {&__pyx_kp_s_dl_dt_IntegerDigits_n_dd_return, __pyx_k_dl_dt_IntegerDigits_n_dd_return, sizeof(__pyx_k_dl_dt_IntegerDigits_n_dd_return), 0, 0, 1, 0},
  {&__pyx_kp_s_dl_dt_MachineEpsilon_dd_is_the, __pyx_k_dl_dt_MachineEpsilon_dd_is_the, sizeof(__pyx_k_dl_dt_MachineEpsilon_dd_is_the), 0, 0, 1, 0},
  {&__pyx_kp_s_dl_dt_MachinePrecision_dd_is_th, __pyx_k_dl_dt_MachinePrecision_dd_is_th, sizeof(__pyx_k_dl_dt_MachinePrecision_dd_is_th), 0, 0, 1, 0},
  {&__pyx_kp_s_dl_dt_MachinePrecision_dd_repre, __pyx_k_dl_dt_MachinePrecision_dd_repre, sizeof(__pyx_k_dl_dt_MachinePrecision_dd_repre), 0, 0, 1, 0},
  {&__pyx_kp_s_dl_dt_MaxPrecision_dd_represent, __pyx_k_dl_dt_MaxPrecision_dd_represent, sizeof(__pyx_k_dl_dt_MaxPrecision_dd_represent), 0, 0, 1, 0},
  {&__pyx_kp_s_dl_dt_MinPrecision_dd_represent, __pyx_k_dl_dt_MinPrecision_dd_represent, sizeof(__pyx_k_dl_dt_MinPrecision_dd_represent), 0, 0, 1, 0},
  {&__pyx_kp_s_dl_dt_NIntegrate_expr_interval, __pyx_k_dl_dt_NIntegrate_expr_interval, sizeof(__pyx_k_dl_dt_NIntegrate_expr_interval), 0, 0, 1, 0},
  {&__pyx_kp_s_dl_dt_N_expr_prec_dd_evaluates, __pyx_k_dl_dt_N_expr_prec_dd_evaluates, sizeof(__pyx_k_dl_dt_N_expr_prec_dd_evaluates), 0, 0, 1, 0},
  {&__pyx_kp_s_dl_dt_NumericQ_expr_dd_tests_wh, __pyx_k_dl_dt_NumericQ_expr_dd_tests_wh, sizeof(__pyx_k_dl_dt_NumericQ_expr_dd_tests_wh), 0, 0, 1, 0},
  {&__pyx_kp_s_dl_dt_Precision_expr_dd_examine, __pyx_k_dl_dt_Precision_expr_dd_examine, sizeof(__pyx_k_dl_dt_Precision_expr_dd_examine), 0, 0, 1, 0},
  {&__pyx_kp_s_dl_dt_Rationalize_x_dd_converts, __pyx_k_dl_dt_Rationalize_x_dd_converts, sizeof(__pyx_k_dl_dt_Rationalize_x_dd_converts), 0, 0, 1, 0},
  {&__pyx_kp_s_dl_dt_RealDigits_n_dd_returns_t, __pyx_k_dl_dt_RealDigits_n_dd_returns_t, sizeof(__pyx_k_dl_dt_RealDigits_n_dd_returns_t), 0, 0, 1, 0},
  {&__pyx_kp_s_dl_dt_Round_expr_dd_rounds_expr, __pyx_k_dl_dt_Round_expr_dd_rounds_expr, sizeof(__pyx_k_dl_dt_Round_expr_dd_rounds_expr), 0, 0, 1, 0},
  {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
  {&__pyx_n_s_domain, __pyx_k_domain, sizeof(__pyx_k_domain), 0, 0, 1, 1},
  {&__pyx_n_s_dps, __pyx_k_dps, sizeof(__pyx_k_dps), 0, 0, 1, 1},
  {&__pyx_n_s_dx, __pyx_k_dx, sizeof(__pyx_k_dx), 0, 0, 1, 1},
  {&__pyx_n_s_e, __pyx_k_e, sizeof(__pyx_k_e), 0, 0, 1, 1},
  {&__pyx_n_u_e, __pyx_k_e, sizeof(__pyx_k_e), 0, 1, 0, 1},
  {&__pyx_n_s_ensure_evaluation, __pyx_k_ensure_evaluation, sizeof(__pyx_k_ensure_evaluation), 0, 0, 1, 1},
  {&__pyx_n_s_enter, __pyx_k_enter, sizeof(__pyx_k_enter), 0, 0, 1, 1},
  {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
  {&__pyx_n_s_eps, __pyx_k_eps, sizeof(__pyx_k_eps), 0, 0, 1, 1},
  {&__pyx_n_u_epsabs, __pyx_k_epsabs, sizeof(__pyx_k_epsabs), 0, 1, 0, 1},
  {&__pyx_n_s_err, __pyx_k_err, sizeof(__pyx_k_err), 0, 0, 1, 1},
  {&__pyx_n_s_eval_range, __pyx_k_eval_range, sizeof(__pyx_k_eval_range), 0, 0, 1, 1},
  {&__pyx_n_s_evaluate, __pyx_k_evaluate, sizeof(__pyx_k_evaluate), 0, 0, 1, 1},
  {&__pyx_n_s_evaluation, __pyx_k_evaluation, sizeof(__pyx_k_evaluation), 0, 0, 1, 1},
  {&__pyx_n_s_exit, __pyx_k_exit, sizeof(__pyx_k_exit), 0, 0, 1, 1},
  {&__pyx_n_s_exp, __pyx_k_exp, sizeof(__pyx_k_exp), 0, 0, 1, 1},
  {&__pyx_n_s_exponents, __pyx_k_exponents, sizeof(__pyx_k_exponents), 0, 0, 1, 1},
  {&__pyx_n_s_expr, __pyx_k_expr, sizeof(__pyx_k_expr), 0, 0, 1, 1},
  {&__pyx_n_s_f, __pyx_k_f, sizeof(__pyx_k_f), 0, 0, 1, 1},
  {&__pyx_n_s_fa, __pyx_k_fa, sizeof(__pyx_k_fa), 0, 0, 1, 1},
  {&__pyx_n_s_fb, __pyx_k_fb, sizeof(__pyx_k_fb), 0, 0, 1, 1},
  {&__pyx_n_s_ff, __pyx_k_ff, sizeof(__pyx_k_ff), 0, 0, 1, 1},
  {&__pyx_n_s_find_approximant, __pyx_k_find_approximant, sizeof(__pyx_k_find_approximant), 0, 0, 1, 1},
  {&__pyx_n_s_find_exact, __pyx_k_find_exact, sizeof(__pyx_k_find_exact), 0, 0, 1, 1},
  {&__pyx_n_s_flm, __pyx_k_flm, sizeof(__pyx_k_flm), 0, 0, 1, 1},
  {&__pyx_n_s_floor, __pyx_k_floor, sizeof(__pyx_k_floor), 0, 0, 1, 1},
  {&__pyx_n_s_fm, __pyx_k_fm, sizeof(__pyx_k_fm), 0, 0, 1, 1},
  {&__pyx_n_s_fn, __pyx_k_fn, sizeof(__pyx_k_fn), 0, 0, 1, 1},
  {&__pyx_n_s_fn_2, __pyx_k_fn_2, sizeof(__pyx_k_fn_2), 0, 0, 1, 1},
  {&__pyx_n_s_fold, __pyx_k_fold, sizeof(__pyx_k_fold), 0, 0, 1, 1},
  {&__pyx_n_s_fold_2, __pyx_k_fold_2, sizeof(__pyx_k_fold_2), 0, 0, 1, 1},
  {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
  {&__pyx_n_s_frm, __pyx_k_frm, sizeof(__pyx_k_frm), 0, 0, 1, 1},
  {&__pyx_n_s_from_python, __pyx_k_from_python, sizeof(__pyx_k_from_python), 0, 0, 1, 1},
  {&__pyx_n_s_from_sympy, __pyx_k_from_sympy, sizeof(__pyx_k_from_sympy), 0, 0, 1, 1},
  {&__pyx_n_s_fubini, __pyx_k_fubini, sizeof(__pyx_k_fubini), 0, 0, 1, 1},
  {&__pyx_n_s_fubini_locals_subintegral, __pyx_k_fubini_locals_subintegral, sizeof(__pyx_k_fubini_locals_subintegral), 0, 0, 1, 1},
  {&__pyx_n_s_fubini_locals_subintegral_local, __pyx_k_fubini_locals_subintegral_local, sizeof(__pyx_k_fubini_locals_subintegral_local), 0, 0, 1, 1},
  {&__pyx_n_u_full_output, __pyx_k_full_output, sizeof(__pyx_k_full_output), 0, 1, 0, 1},
  {&__pyx_n_s_fun, __pyx_k_fun, sizeof(__pyx_k_fun), 0, 0, 1, 1},
  {&__pyx_n_s_func, __pyx_k_func, sizeof(__pyx_k_func), 0, 0, 1, 1},
  {&__pyx_n_s_func2, __pyx_k_func2, sizeof(__pyx_k_func2), 0, 0, 1, 1},
  {&__pyx_n_s_functools, __pyx_k_functools, sizeof(__pyx_k_functools), 0, 0, 1, 1},
  {&__pyx_n_s_generator, __pyx_k_generator, sizeof(__pyx_k_generator), 0, 0, 1, 1},
  {&__pyx_n_s_genexpr, __pyx_k_genexpr, sizeof(__pyx_k_genexpr), 0, 0, 1, 1},
  {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1},
  {&__pyx_n_s_get_attributes, __pyx_k_get_attributes, sizeof(__pyx_k_get_attributes), 0, 0, 1, 1},
  {&__pyx_n_s_get_float_value, __pyx_k_get_float_value, sizeof(__pyx_k_get_float_value), 0, 0, 1, 1},
  {&__pyx_n_s_get_head_name, __pyx_k_get_head_name, sizeof(__pyx_k_get_head_name), 0, 0, 1, 1},
  {&__pyx_n_s_get_int_value, __pyx_k_get_int_value, sizeof(__pyx_k_get_int_value), 0, 0, 1, 1},
  {&__pyx_n_s_get_lookup_name, __pyx_k_get_lookup_name, sizeof(__pyx_k_get_lookup_name), 0, 0, 1, 1},
  {&__pyx_n_s_get_mutable_leaves, __pyx_k_get_mutable_leaves, sizeof(__pyx_k_get_mutable_leaves), 0, 0, 1, 1},
  {&__pyx_n_s_get_name, __pyx_k_get_name, sizeof(__pyx_k_get_name), 0, 0, 1, 1},
  {&__pyx_n_s_get_option_values, __pyx_k_get_option_values, sizeof(__pyx_k_get_option_values), 0, 0, 1, 1},
  {&__pyx_n_s_get_precision, __pyx_k_get_precision, sizeof(__pyx_k_get_precision), 0, 0, 1, 1},
  {&__pyx_n_s_get_string_value, __pyx_k_get_string_value, sizeof(__pyx_k_get_string_value), 0, 0, 1, 1},
  {&__pyx_n_s_get_value, __pyx_k_get_value, sizeof(__pyx_k_get_value), 0, 0, 1, 1},
  {&__pyx_n_s_h, __pyx_k_h, sizeof(__pyx_k_h), 0, 0, 1, 1},
  {&__pyx_n_s_has_form, __pyx_k_has_form, sizeof(__pyx_k_has_form), 0, 0, 1, 1},
  {&__pyx_n_s_hash_func, __pyx_k_hash_func, sizeof(__pyx_k_hash_func), 0, 0, 1, 1},
  {&__pyx_n_s_hashlib, __pyx_k_hashlib, sizeof(__pyx_k_hashlib), 0, 0, 1, 1},
  {&__pyx_n_s_hashtype, __pyx_k_hashtype, sizeof(__pyx_k_hashtype), 0, 0, 1, 1},
  {&__pyx_n_s_head, __pyx_k_head, sizeof(__pyx_k_head), 0, 0, 1, 1},
  {&__pyx_n_s_hexdigest, __pyx_k_hexdigest, sizeof(__pyx_k_hexdigest), 0, 0, 1, 1},
  {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
  {&__pyx_n_u_ibase, __pyx_k_ibase, sizeof(__pyx_k_ibase), 0, 1, 0, 1},
  {&__pyx_n_u_ilim, __pyx_k_ilim, sizeof(__pyx_k_ilim), 0, 1, 0, 1},
  {&__pyx_n_s_imag, __pyx_k_imag, sizeof(__pyx_k_imag), 0, 0, 1, 1},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1},
  {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
  {&__pyx_n_s_init_2, __pyx_k_init_2, sizeof(__pyx_k_init_2), 0, 0, 1, 1},
  {&__pyx_n_s_inner_interval, __pyx_k_inner_interval, sizeof(__pyx_k_inner_interval), 0, 0, 1, 1},
  {&__pyx_n_u_int, __pyx_k_int, sizeof(__pyx_k_int), 0, 1, 0, 1},
  {&__pyx_n_s_int_part, __pyx_k_int_part, sizeof(__pyx_k_int_part), 0, 0, 1, 1},
  {&__pyx_n_s_integrand, __pyx_k_integrand, sizeof(__pyx_k_integrand), 0, 0, 1, 1},
  {&__pyx_n_s_integrator, __pyx_k_integrator, sizeof(__pyx_k_integrator), 0, 0, 1, 1},
  {&__pyx_n_u_integrator, __pyx_k_integrator, sizeof(__pyx_k_integrator), 0, 1, 0, 1},
  {&__pyx_n_s_internal_adaptative_simpsons_ru, __pyx_k_internal_adaptative_simpsons_ru, sizeof(__pyx_k_internal_adaptative_simpsons_ru), 0, 0, 1, 1},
  {&__pyx_n_s_internal_adaptative_simpsons_ru_2, __pyx_k_internal_adaptative_simpsons_ru_2, sizeof(__pyx_k_internal_adaptative_simpsons_ru_2), 0, 0, 1, 1},
  {&__pyx_n_s_internal_adaptative_simpsons_ru_3, __pyx_k_internal_adaptative_simpsons_ru_3, sizeof(__pyx_k_internal_adaptative_simpsons_ru_3), 0, 0, 1, 1},
  {&__pyx_n_s_internal_adaptative_simpsons_ru_4, __pyx_k_internal_adaptative_simpsons_ru_4, sizeof(__pyx_k_internal_adaptative_simpsons_ru_4), 0, 0, 1, 1},
  {&__pyx_n_s_interval, __pyx_k_interval, sizeof(__pyx_k_interval), 0, 0, 1, 1},
  {&__pyx_n_s_intervals, __pyx_k_intervals, sizeof(__pyx_k_intervals), 0, 0, 1, 1},
  {&__pyx_n_u_intm, __pyx_k_intm, sizeof(__pyx_k_intm), 0, 1, 0, 1},
  {&__pyx_n_u_intnm, __pyx_k_intnm, sizeof(__pyx_k_intnm), 0, 1, 0, 1},
  {&__pyx_n_u_intnn, __pyx_k_intnn, sizeof(__pyx_k_intnn), 0, 1, 0, 1},
  {&__pyx_n_s_intvar, __pyx_k_intvar, sizeof(__pyx_k_intvar), 0, 0, 1, 1},
  {&__pyx_n_s_intvars, __pyx_k_intvars, sizeof(__pyx_k_intvars), 0, 0, 1, 1},
  {&__pyx_n_u_inumer, __pyx_k_inumer, sizeof(__pyx_k_inumer), 0, 1, 0, 1},
  {&__pyx_n_u_inumr, __pyx_k_inumr, sizeof(__pyx_k_inumr), 0, 1, 0, 1},
  {&__pyx_n_s_invert_interval, __pyx_k_invert_interval, sizeof(__pyx_k_invert_interval), 0, 0, 1, 1},
  {&__pyx_n_s_is_atom, __pyx_k_is_atom, sizeof(__pyx_k_is_atom), 0, 0, 1, 1},
  {&__pyx_n_s_is_inexact, __pyx_k_is_inexact, sizeof(__pyx_k_is_inexact), 0, 0, 1, 1},
  {&__pyx_n_s_is_multidimensional, __pyx_k_is_multidimensional, sizeof(__pyx_k_is_multidimensional), 0, 0, 1, 1},
  {&__pyx_n_s_is_negative, __pyx_k_is_negative, sizeof(__pyx_k_is_negative), 0, 0, 1, 1},
  {&__pyx_n_s_is_number, __pyx_k_is_number, sizeof(__pyx_k_is_number), 0, 0, 1, 1},
  {&__pyx_n_s_is_numeric, __pyx_k_is_numeric, sizeof(__pyx_k_is_numeric), 0, 0, 1, 1},
  {&__pyx_n_s_is_real, __pyx_k_is_real, sizeof(__pyx_k_is_real), 0, 0, 1, 1},
  {&__pyx_n_s_is_zero, __pyx_k_is_zero, sizeof(__pyx_k_is_zero), 0, 0, 1, 1},
  {&__pyx_n_s_isinf, __pyx_k_isinf, sizeof(__pyx_k_isinf), 0, 0, 1, 1},
  {&__pyx_n_s_it, __pyx_k_it, sizeof(__pyx_k_it), 0, 0, 1, 1},
  {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
  {&__pyx_n_s_itertools, __pyx_k_itertools, sizeof(__pyx_k_itertools), 0, 0, 1, 1},
  {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1},
  {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1},
  {&__pyx_n_s_kwargs, __pyx_k_kwargs, sizeof(__pyx_k_kwargs), 0, 0, 1, 1},
  {&__pyx_n_s_le, __pyx_k_le, sizeof(__pyx_k_le), 0, 0, 1, 1},
  {&__pyx_n_s_leaf, __pyx_k_leaf, sizeof(__pyx_k_leaf), 0, 0, 1, 1},
  {&__pyx_n_s_leaves, __pyx_k_leaves, sizeof(__pyx_k_leaves), 0, 0, 1, 1},
  {&__pyx_n_s_left, __pyx_k_left, sizeof(__pyx_k_left), 0, 0, 1, 1},
  {&__pyx_n_s_length, __pyx_k_length, sizeof(__pyx_k_length), 0, 0, 1, 1},
  {&__pyx_n_s_length_of_int, __pyx_k_length_of_int, sizeof(__pyx_k_length_of_int), 0, 0, 1, 1},
  {&__pyx_n_u_limit, __pyx_k_limit, sizeof(__pyx_k_limit), 0, 1, 0, 1},
  {&__pyx_n_s_list_str, __pyx_k_list_str, sizeof(__pyx_k_list_str), 0, 0, 1, 1},
  {&__pyx_n_s_ll, __pyx_k_ll, sizeof(__pyx_k_ll), 0, 0, 1, 1},
  {&__pyx_n_s_lm, __pyx_k_lm, sizeof(__pyx_k_lm), 0, 0, 1, 1},
  {&__pyx_n_s_log, __pyx_k_log, sizeof(__pyx_k_log), 0, 0, 1, 1},
  {&__pyx_n_s_log_n_b, __pyx_k_log_n_b, sizeof(__pyx_k_log_n_b), 0, 0, 1, 1},
  {&__pyx_n_s_lru_cache, __pyx_k_lru_cache, sizeof(__pyx_k_lru_cache), 0, 0, 1, 1},
  {&__pyx_n_s_m, __pyx_k_m, sizeof(__pyx_k_m), 0, 0, 1, 1},
  {&__pyx_n_s_machine_epsilon, __pyx_k_machine_epsilon, sizeof(__pyx_k_machine_epsilon), 0, 0, 1, 1},
  {&__pyx_n_s_machine_precision, __pyx_k_machine_precision, sizeof(__pyx_k_machine_precision), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_mandatory, __pyx_k_mandatory, sizeof(__pyx_k_mandatory), 0, 0, 1, 1},
  {&__pyx_n_s_math, __pyx_k_math, sizeof(__pyx_k_math), 0, 0, 1, 1},
  {&__pyx_n_s_mathics_builtin_base, __pyx_k_mathics_builtin_base, sizeof(__pyx_k_mathics_builtin_base), 0, 0, 1, 1},
  {&__pyx_n_s_mathics_builtin_numeric, __pyx_k_mathics_builtin_numeric, sizeof(__pyx_k_mathics_builtin_numeric), 0, 0, 1, 1},
  {&__pyx_kp_s_mathics_builtin_numeric_py, __pyx_k_mathics_builtin_numeric_py, sizeof(__pyx_k_mathics_builtin_numeric_py), 0, 0, 1, 0},
  {&__pyx_n_s_mathics_core_convert, __pyx_k_mathics_core_convert, sizeof(__pyx_k_mathics_core_convert), 0, 0, 1, 1},
  {&__pyx_n_s_mathics_core_expression, __pyx_k_mathics_core_expression, sizeof(__pyx_k_mathics_core_expression), 0, 0, 1, 1},
  {&__pyx_n_s_mathics_core_numbers, __pyx_k_mathics_core_numbers, sizeof(__pyx_k_mathics_core_numbers), 0, 0, 1, 1},
  {&__pyx_n_s_mathics_version, __pyx_k_mathics_version, sizeof(__pyx_k_mathics_version), 0, 0, 1, 1},
  {&__pyx_n_s_maxrec, __pyx_k_maxrec, sizeof(__pyx_k_maxrec), 0, 0, 1, 1},
  {&__pyx_n_u_maxrec, __pyx_k_maxrec, sizeof(__pyx_k_maxrec), 0, 1, 0, 1},
  {&__pyx_n_s_maxrecursion, __pyx_k_maxrecursion, sizeof(__pyx_k_maxrecursion), 0, 0, 1, 1},
  {&__pyx_n_s_maxsize, __pyx_k_maxsize, sizeof(__pyx_k_maxsize), 0, 0, 1, 1},
  {&__pyx_n_s_md5, __pyx_k_md5, sizeof(__pyx_k_md5), 0, 0, 1, 1},
  {&__pyx_n_s_message, __pyx_k_message, sizeof(__pyx_k_message), 0, 0, 1, 1},
  {&__pyx_n_s_messages, __pyx_k_messages, sizeof(__pyx_k_messages), 0, 0, 1, 1},
  {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
  {&__pyx_n_s_method, __pyx_k_method, sizeof(__pyx_k_method), 0, 0, 1, 1},
  {&__pyx_n_s_method_options, __pyx_k_method_options, sizeof(__pyx_k_method_options), 0, 0, 1, 1},
  {&__pyx_n_s_methods, __pyx_k_methods, sizeof(__pyx_k_methods), 0, 0, 1, 1},
  {&__pyx_n_s_min_prec, __pyx_k_min_prec, sizeof(__pyx_k_min_prec), 0, 0, 1, 1},
  {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1},
  {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
  {&__pyx_n_s_move, __pyx_k_move, sizeof(__pyx_k_move), 0, 0, 1, 1},
  {&__pyx_n_s_mpmath, __pyx_k_mpmath, sizeof(__pyx_k_mpmath), 0, 0, 1, 1},
  {&__pyx_n_u_mtdfail, __pyx_k_mtdfail, sizeof(__pyx_k_mtdfail), 0, 1, 0, 1},
  {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1},
  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
  {&__pyx_n_s_namedtuple, __pyx_k_namedtuple, sizeof(__pyx_k_namedtuple), 0, 0, 1, 1},
  {&__pyx_n_s_nan, __pyx_k_nan, sizeof(__pyx_k_nan), 0, 0, 1, 1},
  {&__pyx_n_s_native_opt, __pyx_k_native_opt, sizeof(__pyx_k_native_opt), 0, 0, 1, 1},
  {&__pyx_n_s_native_opts, __pyx_k_native_opts, sizeof(__pyx_k_native_opts), 0, 0, 1, 1},
  {&__pyx_n_u_ndig, __pyx_k_ndig, sizeof(__pyx_k_ndig), 0, 1, 0, 1},
  {&__pyx_n_s_nexpr, __pyx_k_nexpr, sizeof(__pyx_k_nexpr), 0, 0, 1, 1},
  {&__pyx_n_s_nintegrate_method, __pyx_k_nintegrate_method, sizeof(__pyx_k_nintegrate_method), 0, 0, 1, 1},
  {&__pyx_n_u_nlim, __pyx_k_nlim, sizeof(__pyx_k_nlim), 0, 1, 0, 1},
  {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
  {&__pyx_n_s_nquad, __pyx_k_nquad, sizeof(__pyx_k_nquad), 0, 0, 1, 1},
  {&__pyx_n_s_nr_elements, __pyx_k_nr_elements, sizeof(__pyx_k_nr_elements), 0, 0, 1, 1},
  {&__pyx_n_s_ntheory, __pyx_k_ntheory, sizeof(__pyx_k_ntheory), 0, 0, 1, 1},
  {&__pyx_n_s_nulldomain, __pyx_k_nulldomain, sizeof(__pyx_k_nulldomain), 0, 0, 1, 1},
  {&__pyx_n_s_numerator, __pyx_k_numerator, sizeof(__pyx_k_numerator), 0, 0, 1, 1},
  {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
  {&__pyx_n_s_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 0, 1, 1},
  {&__pyx_n_s_operand, __pyx_k_operand, sizeof(__pyx_k_operand), 0, 0, 1, 1},
  {&__pyx_n_s_operands, __pyx_k_operands, sizeof(__pyx_k_operands), 0, 0, 1, 1},
  {&__pyx_n_s_operands_2, __pyx_k_operands_2, sizeof(__pyx_k_operands_2), 0, 0, 1, 1},
  {&__pyx_n_s_opt, __pyx_k_opt, sizeof(__pyx_k_opt), 0, 0, 1, 1},
  {&__pyx_n_s_options, __pyx_k_options, sizeof(__pyx_k_options), 0, 0, 1, 1},
  {&__pyx_n_s_options_map, __pyx_k_options_map, sizeof(__pyx_k_options_map), 0, 0, 1, 1},
  {&__pyx_n_s_opts, __pyx_k_opts, sizeof(__pyx_k_opts), 0, 0, 1, 1},
  {&__pyx_n_s_out, __pyx_k_out, sizeof(__pyx_k_out), 0, 0, 1, 1},
  {&__pyx_n_s_outformat, __pyx_k_outformat, sizeof(__pyx_k_outformat), 0, 0, 1, 1},
  {&__pyx_n_s_p, __pyx_k_p, sizeof(__pyx_k_p), 0, 0, 1, 1},
  {&__pyx_n_s_permit_complex, __pyx_k_permit_complex, sizeof(__pyx_k_permit_complex), 0, 0, 1, 1},
  {&__pyx_n_s_pos, __pyx_k_pos, sizeof(__pyx_k_pos), 0, 0, 1, 1},
  {&__pyx_n_s_pos_len, __pyx_k_pos_len, sizeof(__pyx_k_pos_len), 0, 0, 1, 1},
  {&__pyx_n_s_prec, __pyx_k_prec, sizeof(__pyx_k_prec), 0, 0, 1, 1},
  {&__pyx_n_u_precbd, __pyx_k_precbd, sizeof(__pyx_k_precbd), 0, 1, 0, 1},
  {&__pyx_n_u_preccon, __pyx_k_preccon, sizeof(__pyx_k_preccon), 0, 1, 0, 1},
  {&__pyx_n_s_precision, __pyx_k_precision, sizeof(__pyx_k_precision), 0, 0, 1, 1},
  {&__pyx_n_u_preclg, __pyx_k_preclg, sizeof(__pyx_k_preclg), 0, 1, 0, 1},
  {&__pyx_n_u_precset, __pyx_k_precset, sizeof(__pyx_k_precset), 0, 1, 0, 1},
  {&__pyx_n_u_precsm, __pyx_k_precsm, sizeof(__pyx_k_precsm), 0, 1, 0, 1},
  {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
  {&__pyx_n_s_prod, __pyx_k_prod, sizeof(__pyx_k_prod), 0, 0, 1, 1},
  {&__pyx_n_s_product, __pyx_k_product, sizeof(__pyx_k_product), 0, 0, 1, 1},
  {&__pyx_n_s_py_b, __pyx_k_py_b, sizeof(__pyx_k_py_b), 0, 0, 1, 1},
  {&__pyx_n_s_py_dx, __pyx_k_py_dx, sizeof(__pyx_k_py_dx), 0, 0, 1, 1},
  {&__pyx_n_s_py_format, __pyx_k_py_format, sizeof(__pyx_k_py_format), 0, 0, 1, 1},
  {&__pyx_n_s_py_hashtype, __pyx_k_py_hashtype, sizeof(__pyx_k_py_hashtype), 0, 0, 1, 1},
  {&__pyx_n_s_py_n, __pyx_k_py_n, sizeof(__pyx_k_py_n), 0, 0, 1, 1},
  {&__pyx_n_s_py_x, __pyx_k_py_x, sizeof(__pyx_k_py_x), 0, 0, 1, 1},
  {&__pyx_n_s_q, __pyx_k_q, sizeof(__pyx_k_q), 0, 0, 1, 1},
  {&__pyx_n_s_quad, __pyx_k_quad, sizeof(__pyx_k_quad), 0, 0, 1, 1},
  {&__pyx_n_s_quad_asr, __pyx_k_quad_asr, sizeof(__pyx_k_quad_asr), 0, 0, 1, 1},
  {&__pyx_n_s_quad_simpsons_mem, __pyx_k_quad_simpsons_mem, sizeof(__pyx_k_quad_simpsons_mem), 0, 0, 1, 1},
  {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
  {&__pyx_n_s_r, __pyx_k_r, sizeof(__pyx_k_r), 0, 0, 1, 1},
  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_n_s_ranges, __pyx_k_ranges, sizeof(__pyx_k_ranges), 0, 0, 1, 1},
  {&__pyx_n_s_rational_no, __pyx_k_rational_no, sizeof(__pyx_k_rational_no), 0, 0, 1, 1},
  {&__pyx_n_u_rbase, __pyx_k_rbase, sizeof(__pyx_k_rbase), 0, 1, 0, 1},
  {&__pyx_n_s_real, __pyx_k_real, sizeof(__pyx_k_real), 0, 0, 1, 1},
  {&__pyx_n_s_real_part, __pyx_k_real_part, sizeof(__pyx_k_real_part), 0, 0, 1, 1},
  {&__pyx_n_u_realx, __pyx_k_realx, sizeof(__pyx_k_realx), 0, 1, 0, 1},
  {&__pyx_n_s_res, __pyx_k_res, sizeof(__pyx_k_res), 0, 0, 1, 1},
  {&__pyx_n_s_result, __pyx_k_result, sizeof(__pyx_k_result), 0, 0, 1, 1},
  {&__pyx_n_s_result_digit, __pyx_k_result_digit, sizeof(__pyx_k_result_digit), 0, 0, 1, 1},
  {&__pyx_n_s_results, __pyx_k_results, sizeof(__pyx_k_results), 0, 0, 1, 1},
  {&__pyx_n_s_return, __pyx_k_return, sizeof(__pyx_k_return), 0, 0, 1, 1},
  {&__pyx_n_s_right, __pyx_k_right, sizeof(__pyx_k_right), 0, 0, 1, 1},
  {&__pyx_n_s_rm, __pyx_k_rm, sizeof(__pyx_k_rm), 0, 0, 1, 1},
  {&__pyx_n_s_romberg, __pyx_k_romberg, sizeof(__pyx_k_romberg), 0, 0, 1, 1},
  {&__pyx_n_s_round, __pyx_k_round, sizeof(__pyx_k_round), 0, 0, 1, 1},
  {&__pyx_n_s_round_to_float, __pyx_k_round_to_float, sizeof(__pyx_k_round_to_float), 0, 0, 1, 1},
  {&__pyx_n_s_rules, __pyx_k_rules, sizeof(__pyx_k_rules), 0, 0, 1, 1},
  {&__pyx_n_s_s_operands, __pyx_k_s_operands, sizeof(__pyx_k_s_operands), 0, 0, 1, 1},
  {&__pyx_n_s_sameQ, __pyx_k_sameQ, sizeof(__pyx_k_sameQ), 0, 0, 1, 1},
  {&__pyx_n_s_scipy_integrate, __pyx_k_scipy_integrate, sizeof(__pyx_k_scipy_integrate), 0, 0, 1, 1},
  {&__pyx_n_s_scipy_interface, __pyx_k_scipy_interface, sizeof(__pyx_k_scipy_interface), 0, 0, 1, 1},
  {&__pyx_n_s_scipy_interface_locals__scipy_p, __pyx_k_scipy_interface_locals__scipy_p, sizeof(__pyx_k_scipy_interface_locals__scipy_p), 0, 0, 1, 1},
  {&__pyx_n_s_scipy_interface_locals__scipy_p_2, __pyx_k_scipy_interface_locals__scipy_p_2, sizeof(__pyx_k_scipy_interface_locals__scipy_p_2), 0, 0, 1, 1},
  {&__pyx_n_s_scipy_proxy_func, __pyx_k_scipy_proxy_func, sizeof(__pyx_k_scipy_proxy_func), 0, 0, 1, 1},
  {&__pyx_n_s_scipy_proxy_func_filter, __pyx_k_scipy_proxy_func_filter, sizeof(__pyx_k_scipy_proxy_func_filter), 0, 0, 1, 1},
  {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
  {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1},
  {&__pyx_n_s_sha1, __pyx_k_sha1, sizeof(__pyx_k_sha1), 0, 0, 1, 1},
  {&__pyx_n_s_sha224, __pyx_k_sha224, sizeof(__pyx_k_sha224), 0, 0, 1, 1},
  {&__pyx_n_s_sha256, __pyx_k_sha256, sizeof(__pyx_k_sha256), 0, 0, 1, 1},
  {&__pyx_n_s_sha384, __pyx_k_sha384, sizeof(__pyx_k_sha384), 0, 0, 1, 1},
  {&__pyx_n_s_sha512, __pyx_k_sha512, sizeof(__pyx_k_sha512), 0, 0, 1, 1},
  {&__pyx_n_s_sin, __pyx_k_sin, sizeof(__pyx_k_sin), 0, 0, 1, 1},
  {&__pyx_n_u_sin, __pyx_k_sin, sizeof(__pyx_k_sin), 0, 1, 0, 1},
  {&__pyx_n_s_spans, __pyx_k_spans, sizeof(__pyx_k_spans), 0, 0, 1, 1},
  {&__pyx_n_s_spans_2, __pyx_k_spans_2, sizeof(__pyx_k_spans_2), 0, 0, 1, 1},
  {&__pyx_n_s_startswith, __pyx_k_startswith, sizeof(__pyx_k_startswith), 0, 0, 1, 1},
  {&__pyx_n_s_state, __pyx_k_state, sizeof(__pyx_k_state), 0, 0, 1, 1},
  {&__pyx_n_s_staticmethod, __pyx_k_staticmethod, sizeof(__pyx_k_staticmethod), 0, 0, 1, 1},
  {&__pyx_n_s_steps, __pyx_k_steps, sizeof(__pyx_k_steps), 0, 0, 1, 1},
  {&__pyx_n_s_subdomain, __pyx_k_subdomain, sizeof(__pyx_k_subdomain), 0, 0, 1, 1},
  {&__pyx_n_s_subdomain2, __pyx_k_subdomain2, sizeof(__pyx_k_subdomain2), 0, 0, 1, 1},
  {&__pyx_n_s_subintegral, __pyx_k_subintegral, sizeof(__pyx_k_subintegral), 0, 0, 1, 1},
  {&__pyx_n_s_subresults, __pyx_k_subresults, sizeof(__pyx_k_subresults), 0, 0, 1, 1},
  {&__pyx_n_s_sum, __pyx_k_sum, sizeof(__pyx_k_sum), 0, 0, 1, 1},
  {&__pyx_n_s_super, __pyx_k_super, sizeof(__pyx_k_super), 0, 0, 1, 1},
  {&__pyx_n_s_supported_hashes, __pyx_k_supported_hashes, sizeof(__pyx_k_supported_hashes), 0, 0, 1, 1},
  {&__pyx_n_s_sym_x, __pyx_k_sym_x, sizeof(__pyx_k_sym_x), 0, 0, 1, 1},
  {&__pyx_n_s_sympy, __pyx_k_sympy, sizeof(__pyx_k_sympy), 0, 0, 1, 1},
  {&__pyx_n_s_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 0, 1, 1},
  {&__pyx_n_s_tails, __pyx_k_tails, sizeof(__pyx_k_tails), 0, 0, 1, 1},
  {&__pyx_n_s_temp, __pyx_k_temp, sizeof(__pyx_k_temp), 0, 0, 1, 1},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_s_test_2, __pyx_k_test_2, sizeof(__pyx_k_test_2), 0, 0, 1, 1},
  {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1},
  {&__pyx_n_s_to_mpmath, __pyx_k_to_mpmath, sizeof(__pyx_k_to_mpmath), 0, 0, 1, 1},
  {&__pyx_n_s_to_python, __pyx_k_to_python, sizeof(__pyx_k_to_python), 0, 0, 1, 1},
  {&__pyx_n_s_to_sympy, __pyx_k_to_sympy, sizeof(__pyx_k_to_sympy), 0, 0, 1, 1},
  {&__pyx_n_s_tol, __pyx_k_tol, sizeof(__pyx_k_tol), 0, 0, 1, 1},
  {&__pyx_n_u_tol, __pyx_k_tol, sizeof(__pyx_k_tol), 0, 1, 0, 1},
  {&__pyx_n_s_tolerance, __pyx_k_tolerance, sizeof(__pyx_k_tolerance), 0, 0, 1, 1},
  {&__pyx_n_u_tolnn, __pyx_k_tolnn, sizeof(__pyx_k_tolnn), 0, 1, 0, 1},
  {&__pyx_n_s_u, __pyx_k_u, sizeof(__pyx_k_u), 0, 0, 1, 1},
  {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
  {&__pyx_n_s_user_hash, __pyx_k_user_hash, sizeof(__pyx_k_user_hash), 0, 0, 1, 1},
  {&__pyx_n_s_val, __pyx_k_val, sizeof(__pyx_k_val), 0, 0, 1, 1},
  {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
  {&__pyx_n_s_var, __pyx_k_var, sizeof(__pyx_k_var), 0, 0, 1, 1},
  {&__pyx_n_s_version, __pyx_k_version, sizeof(__pyx_k_version), 0, 0, 1, 1},
  {&__pyx_n_s_whole, __pyx_k_whole, sizeof(__pyx_k_whole), 0, 0, 1, 1},
  {&__pyx_n_s_working_precision, __pyx_k_working_precision, sizeof(__pyx_k_working_precision), 0, 0, 1, 1},
  {&__pyx_n_s_workprec, __pyx_k_workprec, sizeof(__pyx_k_workprec), 0, 0, 1, 1},
  {&__pyx_n_s_wsr, __pyx_k_wsr, sizeof(__pyx_k_wsr), 0, 0, 1, 1},
  {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
  {&__pyx_n_u_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 1, 0, 1},
  {&__pyx_n_s_xmax, __pyx_k_xmax, sizeof(__pyx_k_xmax), 0, 0, 1, 1},
  {&__pyx_n_s_xmin, __pyx_k_xmin, sizeof(__pyx_k_xmin), 0, 0, 1, 1},
  {&__pyx_n_s_y, __pyx_k_y, sizeof(__pyx_k_y), 0, 0, 1, 1},
  {&__pyx_n_s_z, __pyx_k_z, sizeof(__pyx_k_z), 0, 0, 1, 1},
  {&__pyx_n_s_zlib, __pyx_k_zlib, sizeof(__pyx_k_zlib), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_staticmethod = __Pyx_GetBuiltinName(__pyx_n_s_staticmethod); if (!__pyx_builtin_staticmethod) __PYX_ERR(0, 491, __pyx_L1_error)
  __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) __PYX_ERR(0, 1725, __pyx_L1_error)
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 219, __pyx_L1_error)
  __pyx_builtin_ZeroDivisionError = __Pyx_GetBuiltinName(__pyx_n_s_ZeroDivisionError); if (!__pyx_builtin_ZeroDivisionError) __PYX_ERR(0, 292, __pyx_L1_error)
  __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) __PYX_ERR(0, 447, __pyx_L1_error)
  __pyx_builtin_any = __Pyx_GetBuiltinName(__pyx_n_s_any); if (!__pyx_builtin_any) __PYX_ERR(0, 511, __pyx_L1_error)
  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 581, __pyx_L1_error)
  __pyx_builtin_sum = __Pyx_GetBuiltinName(__pyx_n_s_sum); if (!__pyx_builtin_sum) __PYX_ERR(0, 682, __pyx_L1_error)
  __pyx_builtin_round = __Pyx_GetBuiltinName(__pyx_n_s_round); if (!__pyx_builtin_round) __PYX_ERR(0, 972, __pyx_L1_error)
  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 1375, __pyx_L1_error)
  __pyx_builtin_format = __Pyx_GetBuiltinName(__pyx_n_s_format); if (!__pyx_builtin_format) __PYX_ERR(0, 1643, __pyx_L1_error)
  __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(0, 1757, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "mathics/builtin/numeric.py":195
 * 
 *         # Special case for the Root builtin
 *         if expr.has_form("Root", 2):             # <<<<<<<<<<<<<<
 *             return from_sympy(sympy.N(expr.to_sympy(), d))
 * 
 */
  __pyx_tuple_ = PyTuple_Pack(2, __pyx_n_u_Root, __pyx_int_2); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple_);
  __Pyx_GIVEREF(__pyx_tuple_);

  /* "mathics/builtin/numeric.py":222
 *             elif "System`NHoldRest" in attributes:
 *                 if len(expr.leaves) > 0:
 *                     eval_range = (0,)             # <<<<<<<<<<<<<<
 *                 else:
 *                     eval_range = ()
 */
  __pyx_tuple__3 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__3);
  __Pyx_GIVEREF(__pyx_tuple__3);

  /* "mathics/builtin/numeric.py":242
 *     """
 * 
 *     def _scipy_proxy_func_filter(fun, a, b, **opts):             # <<<<<<<<<<<<<<
 *         native_opts = {}
 *         if mandatory:
 */
  __pyx_tuple__4 = PyTuple_Pack(8, __pyx_n_s_fun, __pyx_n_s_a, __pyx_n_s_b, __pyx_n_s_opts, __pyx_n_s_native_opts, __pyx_n_s_opt, __pyx_n_s_val, __pyx_n_s_native_opt); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__4);
  __Pyx_GIVEREF(__pyx_tuple__4);
  __pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(3, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__4, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_scipy_proxy_func_filter, 242, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) __PYX_ERR(0, 242, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":254
 *         return adapt_func(integrator(fun, a, b, **native_opts))
 * 
 *     def _scipy_proxy_func(fun, a, b, **opts):             # <<<<<<<<<<<<<<
 *         native_opts = {}
 *         if mandatory:
 */
  __pyx_tuple__6 = PyTuple_Pack(8, __pyx_n_s_fun, __pyx_n_s_a, __pyx_n_s_b, __pyx_n_s_opts, __pyx_n_s_native_opts, __pyx_n_s_opt, __pyx_n_s_val, __pyx_n_s_native_opt); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__6);
  __Pyx_GIVEREF(__pyx_tuple__6);
  __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(3, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_scipy_proxy_func, 254, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 254, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":287
 *         maxrec = 150
 * 
 *     def _quad_simpsons_mem(f, a, fa, b, fb):             # <<<<<<<<<<<<<<
 *         """Evaluates the Simpson's Rule, also returning m and f(m) to reuse"""
 *         m = 0.5 * (a + b)
 */
  __pyx_tuple__8 = PyTuple_Pack(7, __pyx_n_s_f, __pyx_n_s_a, __pyx_n_s_fa, __pyx_n_s_b, __pyx_n_s_fb, __pyx_n_s_m, __pyx_n_s_fm); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__8);
  __Pyx_GIVEREF(__pyx_tuple__8);
  __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(5, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_quad_simpsons_mem, 287, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 287, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":300
 *         return (m, fm, wsr * abs(b - a) * (fa + 4.0 * fm + fb))
 * 
 *     def _quad_asr(f, a, fa, b, fb, eps, whole, m, fm, maxrec):             # <<<<<<<<<<<<<<
 *         """
 *         Efficient recursive implementation of adaptive Simpson's rule.
 */
  __pyx_tuple__10 = PyTuple_Pack(18, __pyx_n_s_f, __pyx_n_s_a, __pyx_n_s_fa, __pyx_n_s_b, __pyx_n_s_fb, __pyx_n_s_eps, __pyx_n_s_whole, __pyx_n_s_m, __pyx_n_s_fm, __pyx_n_s_maxrec, __pyx_n_s_left, __pyx_n_s_lm, __pyx_n_s_flm, __pyx_n_s_right, __pyx_n_s_rm, __pyx_n_s_frm, __pyx_n_s_delta, __pyx_n_s_err); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__10);
  __Pyx_GIVEREF(__pyx_tuple__10);
  __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(10, 0, 18, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_quad_asr, 300, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 300, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":323
 *             raise
 * 
 *     def ensure_evaluation(f, x):             # <<<<<<<<<<<<<<
 *         try:
 *             val = f(x)
 */
  __pyx_tuple__12 = PyTuple_Pack(3, __pyx_n_s_f, __pyx_n_s_x, __pyx_n_s_val); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 323, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);
  __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_ensure_evaluation, 323, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 323, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":368
 * 
 *         def subintegral(*u):
 *             def ff(*z):             # <<<<<<<<<<<<<<
 *                 return func(*(u + z))
 * 
 */
  __pyx_tuple__14 = PyTuple_Pack(1, __pyx_n_s_z); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 368, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__14);
  __Pyx_GIVEREF(__pyx_tuple__14);
  __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_ff, 368, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 368, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":371
 *                 return func(*(u + z))
 * 
 *             val = _fubini(ff, ranges[1:], **opts)[0]             # <<<<<<<<<<<<<<
 *             return val
 * 
 */
  __pyx_slice__16 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_slice__16)) __PYX_ERR(0, 371, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__16);
  __Pyx_GIVEREF(__pyx_slice__16);

  /* "mathics/builtin/numeric.py":367
 *     if len(ranges) > 1:
 * 
 *         def subintegral(*u):             # <<<<<<<<<<<<<<
 *             def ff(*z):
 *                 return func(*(u + z))
 */
  __pyx_tuple__17 = PyTuple_Pack(4, __pyx_n_s_u, __pyx_n_s_ff, __pyx_n_s_ff, __pyx_n_s_val); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 367, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__17);
  __Pyx_GIVEREF(__pyx_tuple__17);
  __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_subintegral, 367, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 367, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":462
 *                     quad,
 *                     {
 *                         "tol": ("epsabs", None),             # <<<<<<<<<<<<<<
 *                         "maxrec": ("limit", lambda maxrec: int(2 ** maxrec)),
 *                     },
 */
  __pyx_tuple__19 = PyTuple_Pack(2, __pyx_n_u_epsabs, Py_None); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 462, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__19);
  __Pyx_GIVEREF(__pyx_tuple__19);

  /* "mathics/builtin/numeric.py":473
 *                 _scipy_interface(
 *                     romberg,
 *                     {"tol": ("tol", None), "maxrec": ("divmax", None)},             # <<<<<<<<<<<<<<
 *                     None,
 *                     lambda x: (x, np.nan),
 */
  __pyx_tuple__20 = PyTuple_Pack(2, __pyx_n_u_tol, Py_None); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 473, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__20);
  __Pyx_GIVEREF(__pyx_tuple__20);
  __pyx_tuple__21 = PyTuple_Pack(2, __pyx_n_u_divmax, Py_None); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 473, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__21);
  __Pyx_GIVEREF(__pyx_tuple__21);

  /* "mathics/builtin/numeric.py":493
 *     @staticmethod
 *     def decompose_domain(interval, evaluation):
 *         if interval.has_form("System`Sequence", 1, None):             # <<<<<<<<<<<<<<
 *             intervals = []
 *             for leaf in interval.leaves:
 */
  __pyx_tuple__23 = PyTuple_Pack(3, __pyx_kp_u_System_Sequence, __pyx_int_1, Py_None); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 493, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__23);
  __Pyx_GIVEREF(__pyx_tuple__23);

  /* "mathics/builtin/numeric.py":504
 *             return intervals
 * 
 *         if interval.has_form("System`List", 3, None):             # <<<<<<<<<<<<<<
 *             intervals = []
 *             intvar = interval.leaves[0]
 */
  __pyx_tuple__24 = PyTuple_Pack(3, __pyx_kp_u_System_List, __pyx_int_3, Py_None); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 504, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__24);
  __Pyx_GIVEREF(__pyx_tuple__24);

  /* "mathics/builtin/numeric.py":527
 *         method = options["System`Method"].evaluate(evaluation)
 *         method_options = {}
 *         if method.has_form("System`List", 2):             # <<<<<<<<<<<<<<
 *             method = method.leaves[0]
 *             method_options.update(method.leaves[1].get_option_values())
 */
  __pyx_tuple__25 = PyTuple_Pack(2, __pyx_kp_u_System_List, __pyx_int_2); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 527, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__25);
  __Pyx_GIVEREF(__pyx_tuple__25);

  /* "mathics/builtin/numeric.py":562
 *         # stop the evaluation...
 *         if any([c.get_head_name() == "System`List" for c in coords]):
 *             evaluation.message("NIntegrate", "cmpint")             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_tuple__26 = PyTuple_Pack(2, __pyx_n_u_NIntegrate, __pyx_n_u_cmpint); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 562, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__26);
  __Pyx_GIVEREF(__pyx_tuple__26);

  /* "mathics/builtin/numeric.py":668
 * 
 *             if val is None:
 *                 evaluation.message("NIntegrate", "mtdfail")             # <<<<<<<<<<<<<<
 *                 if len(subdomain2) > 1:
 *                     val = _fubini(
 */
  __pyx_tuple__27 = PyTuple_Pack(2, __pyx_n_u_NIntegrate, __pyx_n_u_mtdfail); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 668, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__27);
  __Pyx_GIVEREF(__pyx_tuple__27);

  /* "mathics/builtin/numeric.py":1155
 *         delta = delta.round_to_float(evaluation)
 *         if delta is None or delta < 0:
 *             return evaluation.message("Chop", "tolnn")             # <<<<<<<<<<<<<<
 * 
 *         return chop(expr, delta=delta)
 */
  __pyx_tuple__28 = PyTuple_Pack(2, __pyx_n_u_Chop, __pyx_n_u_tolnn); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 1155, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__28);
  __Pyx_GIVEREF(__pyx_tuple__28);

  /* "mathics/builtin/numeric.py":1178
 *         "NumericQ[expr_]"
 * 
 *         def test(expr):             # <<<<<<<<<<<<<<
 *             if isinstance(expr, Expression):
 *                 attr = evaluation.definitions.get_attributes(expr.head.get_name())
 */
  __pyx_tuple__29 = PyTuple_Pack(4, __pyx_n_s_expr, __pyx_n_s_attr, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 1178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__29);
  __Pyx_GIVEREF(__pyx_tuple__29);
  __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_test, 1178, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 1178, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1263
 * 
 *         if not (isinstance(length, Integer) and length.get_int_value() >= 0):
 *             return evaluation.message("IntegerDigits", "intnn")             # <<<<<<<<<<<<<<
 * 
 *         return self.apply(n, base, evaluation, nr_elements=length.get_int_value())
 */
  __pyx_tuple__31 = PyTuple_Pack(2, __pyx_n_u_IntegerDigits, __pyx_n_u_intnn); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 1263, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__31);
  __Pyx_GIVEREF(__pyx_tuple__31);

  /* "mathics/builtin/numeric.py":1346
 *     # iexps = list(range(length_of_int, -1, -1))
 * 
 *     def convert_int(x, base, exponents):             # <<<<<<<<<<<<<<
 *         out = []
 *         for e in range(0, exponents + 1):
 */
  __pyx_tuple__32 = PyTuple_Pack(6, __pyx_n_s_x, __pyx_n_s_base, __pyx_n_s_exponents, __pyx_n_s_out, __pyx_n_s_e, __pyx_n_s_d); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 1346, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__32);
  __Pyx_GIVEREF(__pyx_tuple__32);
  __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_convert_int, 1346, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 1346, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1357
 *         return out
 * 
 *     def convert_float(x, base, exponents):             # <<<<<<<<<<<<<<
 *         out = []
 *         for e in range(0, exponents):
 */
  __pyx_tuple__34 = PyTuple_Pack(6, __pyx_n_s_x, __pyx_n_s_base, __pyx_n_s_exponents, __pyx_n_s_out, __pyx_n_s_e, __pyx_n_s_d); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 1357, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__34);
  __Pyx_GIVEREF(__pyx_tuple__34);
  __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_convert_float, 1357, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 1357, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1809
 * 
 *                 @contextmanager
 *                 def working_precision(_):             # <<<<<<<<<<<<<<
 *                     yield
 * 
 */
  __pyx_tuple__39 = PyTuple_Pack(1, __pyx_n_s__38); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 1809, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__39);
  __Pyx_GIVEREF(__pyx_tuple__39);
  __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_working_precision, 1809, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 1809, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1816
 *             if mode == self.FLOAT:
 * 
 *                 def out(z):             # <<<<<<<<<<<<<<
 *                     return Real(z)
 * 
 */
  __pyx_tuple__41 = PyTuple_Pack(1, __pyx_n_s_z); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 1816, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__41);
  __Pyx_GIVEREF(__pyx_tuple__41);
  __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_out, 1816, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 1816, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1821
 *             elif mode == self.MPMATH:
 * 
 *                 def out(z):             # <<<<<<<<<<<<<<
 *                     return Real(z, precision)
 * 
 */
  __pyx_tuple__43 = PyTuple_Pack(1, __pyx_n_s_z); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 1821, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__43);
  __Pyx_GIVEREF(__pyx_tuple__43);
  __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_out, 1821, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(0, 1821, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1826
 *             else:
 * 
 *                 def out(z):             # <<<<<<<<<<<<<<
 *                     return z
 * 
 */
  __pyx_tuple__45 = PyTuple_Pack(1, __pyx_n_s_z); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 1826, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__45);
  __Pyx_GIVEREF(__pyx_tuple__45);
  __pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_out, 1826, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) __PYX_ERR(0, 1826, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1831
 *             as_operand = self.operands.get(mode)
 * 
 *             def converted_operands():             # <<<<<<<<<<<<<<
 *                 for y in s_operands:
 *                     yield tuple(as_operand(t) for t in y)
 */
  __pyx_tuple__47 = PyTuple_Pack(3, __pyx_n_s_y, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 1831, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__47);
  __Pyx_GIVEREF(__pyx_tuple__47);
  __pyx_codeobj__48 = (PyObject*)__Pyx_PyCode_New(0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_converted_operands, 1831, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__48)) __PYX_ERR(0, 1831, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1835
 *                     yield tuple(as_operand(t) for t in y)
 * 
 *             with working_precision(precision):             # <<<<<<<<<<<<<<
 *                 c_operands = converted_operands()
 * 
 */
  __pyx_tuple__49 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 1835, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__49);
  __Pyx_GIVEREF(__pyx_tuple__49);

  /* "mathics/builtin/numeric.py":58
 * 
 * @lru_cache(maxsize=1024)
 * def log_n_b(py_n, py_b) -> int:             # <<<<<<<<<<<<<<
 *     return int(mpmath.ceil(mpmath.log(py_n, py_b))) if py_n != 0 and py_n != 1 else 1
 * 
 */
  __pyx_tuple__50 = PyTuple_Pack(2, __pyx_n_s_py_n, __pyx_n_s_py_b); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 58, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__50);
  __Pyx_GIVEREF(__pyx_tuple__50);
  __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_log_n_b, 58, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 58, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":180
 *     }
 * 
 *     def apply_with_prec(self, expr, prec, evaluation):             # <<<<<<<<<<<<<<
 *         "N[expr_, prec_]"
 * 
 */
  __pyx_tuple__52 = PyTuple_Pack(14, __pyx_n_s_self, __pyx_n_s_expr, __pyx_n_s_prec, __pyx_n_s_evaluation, __pyx_n_s_d, __pyx_n_s_name, __pyx_n_s_nexpr, __pyx_n_s_result, __pyx_n_s_attributes, __pyx_n_s_eval_range, __pyx_n_s_head, __pyx_n_s_leaves, __pyx_n_s_index, __pyx_n_s_leaf); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__52);
  __Pyx_GIVEREF(__pyx_tuple__52);
  __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(4, 0, 14, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_apply_with_prec, 180, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 180, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":236
 * 
 * 
 * def _scipy_interface(integrator, options_map, mandatory=None, adapt_func=None):             # <<<<<<<<<<<<<<
 *     """
 *     This function provides a proxy for scipy.integrate
 */
  __pyx_tuple__54 = PyTuple_Pack(8, __pyx_n_s_integrator, __pyx_n_s_options_map, __pyx_n_s_mandatory, __pyx_n_s_adapt_func, __pyx_n_s_scipy_proxy_func_filter, __pyx_n_s_scipy_proxy_func_filter, __pyx_n_s_scipy_proxy_func, __pyx_n_s_scipy_proxy_func); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(0, 236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__54);
  __Pyx_GIVEREF(__pyx_tuple__54);
  __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(4, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__54, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_scipy_interface, 236, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 236, __pyx_L1_error)
  __pyx_tuple__56 = PyTuple_Pack(2, ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(0, 236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__56);
  __Pyx_GIVEREF(__pyx_tuple__56);

  /* "mathics/builtin/numeric.py":269
 * 
 * 
 * def _internal_adaptative_simpsons_rule(f, a, b, **opts):             # <<<<<<<<<<<<<<
 *     """
 *     1D adaptative Simpson's rule integrator
 */
  __pyx_tuple__57 = PyTuple_Pack(20, __pyx_n_s_f, __pyx_n_s_a, __pyx_n_s_b, __pyx_n_s_opts, __pyx_n_s_wsr, __pyx_n_s_tol, __pyx_n_s_maxrec, __pyx_n_s_quad_simpsons_mem, __pyx_n_s_quad_simpsons_mem, __pyx_n_s_quad_asr, __pyx_n_s_quad_asr, __pyx_n_s_ensure_evaluation, __pyx_n_s_ensure_evaluation, __pyx_n_s_invert_interval, __pyx_n_s_fa, __pyx_n_s_fb, __pyx_n_s_x, __pyx_n_s_m, __pyx_n_s_fm, __pyx_n_s_whole); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(0, 269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__57);
  __Pyx_GIVEREF(__pyx_tuple__57);
  __pyx_codeobj__58 = (PyObject*)__Pyx_PyCode_New(3, 0, 20, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__57, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_internal_adaptative_simpsons_ru_4, 269, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__58)) __PYX_ERR(0, 269, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":355
 * 
 * 
 * def _fubini(func, ranges, **opts):             # <<<<<<<<<<<<<<
 *     if not ranges:
 *         return 0.0
 */
  __pyx_tuple__59 = PyTuple_Pack(10, __pyx_n_s_func, __pyx_n_s_ranges, __pyx_n_s_opts, __pyx_n_s_a, __pyx_n_s_b, __pyx_n_s_integrator, __pyx_n_s_tol, __pyx_n_s_subintegral, __pyx_n_s_subintegral, __pyx_n_s_val); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(0, 355, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__59);
  __Pyx_GIVEREF(__pyx_tuple__59);
  __pyx_codeobj__60 = (PyObject*)__Pyx_PyCode_New(2, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__59, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_fubini, 355, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__60)) __PYX_ERR(0, 355, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":443
 * 
 *     methods = {
 *         "Automatic": (None, False),             # <<<<<<<<<<<<<<
 *     }
 * 
 */
  __pyx_tuple__61 = PyTuple_Pack(2, Py_None, Py_False); if (unlikely(!__pyx_tuple__61)) __PYX_ERR(0, 443, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__61);
  __Pyx_GIVEREF(__pyx_tuple__61);

  /* "mathics/builtin/numeric.py":446
 *     }
 * 
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         super().__init__(*args, **kwargs)
 *         self.methods["Internal"] = (_internal_adaptative_simpsons_rule, False)
 */
  __pyx_tuple__62 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_args, __pyx_n_s_kwargs, __pyx_n_s_romberg, __pyx_n_s_quad, __pyx_n_s_nquad); if (unlikely(!__pyx_tuple__62)) __PYX_ERR(0, 446, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__62);
  __Pyx_GIVEREF(__pyx_tuple__62);
  __pyx_codeobj__63 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__62, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_init, 446, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__63)) __PYX_ERR(0, 446, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":492
 * 
 *     @staticmethod
 *     def decompose_domain(interval, evaluation):             # <<<<<<<<<<<<<<
 *         if interval.has_form("System`Sequence", 1, None):
 *             intervals = []
 */
  __pyx_tuple__64 = PyTuple_Pack(10, __pyx_n_s_interval, __pyx_n_s_evaluation, __pyx_n_s_intervals, __pyx_n_s_leaf, __pyx_n_s_inner_interval, __pyx_n_s_intvar, __pyx_n_s_boundaries, __pyx_n_s_i, __pyx_n_s_a, __pyx_n_s_b); if (unlikely(!__pyx_tuple__64)) __PYX_ERR(0, 492, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__64);
  __Pyx_GIVEREF(__pyx_tuple__64);
  __pyx_codeobj__65 = (PyObject*)__Pyx_PyCode_New(2, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__64, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_decompose_domain, 492, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__65)) __PYX_ERR(0, 492, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":523
 *         return None
 * 
 *     def apply_with_func_domain(self, func, domain, evaluation, options):             # <<<<<<<<<<<<<<
 *         "%(name)s[func_, domain__, OptionsPattern[%(name)s]]"
 *         method = options["System`Method"].evaluate(evaluation)
 */
  __pyx_tuple__66 = PyTuple_Pack(35, __pyx_n_s_self, __pyx_n_s_func, __pyx_n_s_domain, __pyx_n_s_evaluation, __pyx_n_s_options, __pyx_n_s_method, __pyx_n_s_method_options, __pyx_n_s_tolerance, __pyx_n_s_accuracy, __pyx_n_s_maxrecursion, __pyx_n_s_nintegrate_method, __pyx_n_s_is_multidimensional, __pyx_n_s_coords, __pyx_n_s_intvars, __pyx_n_s_integrand, __pyx_n_s_results, __pyx_n_s_subdomain, __pyx_n_s_func2, __pyx_n_s_subdomain2, __pyx_n_s_coordtransform, __pyx_n_s_nulldomain, __pyx_n_s_i, __pyx_n_s_r, __pyx_n_s_a, __pyx_n_s_b, __pyx_n_s_le, __pyx_n_s_z, __pyx_n_s_x, __pyx_n_s_opts, __pyx_n_s_val, __pyx_n_s_result, __pyx_n_s_axis, __pyx_n_s_c, __pyx_n_s_axis, __pyx_n_s_r); if (unlikely(!__pyx_tuple__66)) __PYX_ERR(0, 523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__66);
  __Pyx_GIVEREF(__pyx_tuple__66);
  __pyx_codeobj__67 = (PyObject*)__Pyx_PyCode_New(5, 0, 35, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__66, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_apply_with_func_domain, 523, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__67)) __PYX_ERR(0, 523, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":730
 *     name = "$MachineEpsilon"
 * 
 *     def evaluate(self, evaluation):             # <<<<<<<<<<<<<<
 *         return MachineReal(machine_epsilon)
 * 
 */
  __pyx_tuple__68 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_evaluation); if (unlikely(!__pyx_tuple__68)) __PYX_ERR(0, 730, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__68);
  __Pyx_GIVEREF(__pyx_tuple__68);
  __pyx_codeobj__69 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__68, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_evaluate, 730, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__69)) __PYX_ERR(0, 730, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":795
 *     }
 * 
 *     def apply(self, z, evaluation):             # <<<<<<<<<<<<<<
 *         "Precision[z_]"
 * 
 */
  __pyx_tuple__70 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_z, __pyx_n_s_evaluation); if (unlikely(!__pyx_tuple__70)) __PYX_ERR(0, 795, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__70);
  __Pyx_GIVEREF(__pyx_tuple__70);
  __pyx_codeobj__71 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__70, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_apply, 795, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__71)) __PYX_ERR(0, 795, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":954
 *     """
 * 
 *     attributes = ("Listable", "NumericFunction")             # <<<<<<<<<<<<<<
 * 
 *     rules = {
 */
  __pyx_tuple__72 = PyTuple_Pack(2, __pyx_n_u_Listable, __pyx_n_u_NumericFunction); if (unlikely(!__pyx_tuple__72)) __PYX_ERR(0, 954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__72);
  __Pyx_GIVEREF(__pyx_tuple__72);

  /* "mathics/builtin/numeric.py":963
 *     }
 * 
 *     def apply(self, expr, k, evaluation):             # <<<<<<<<<<<<<<
 *         "Round[expr_?NumericQ, k_?NumericQ]"
 * 
 */
  __pyx_tuple__73 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_expr, __pyx_n_s_k, __pyx_n_s_evaluation, __pyx_n_s_n); if (unlikely(!__pyx_tuple__73)) __PYX_ERR(0, 963, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__73);
  __Pyx_GIVEREF(__pyx_tuple__73);
  __pyx_codeobj__74 = (PyObject*)__Pyx_PyCode_New(4, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__73, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_apply, 963, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__74)) __PYX_ERR(0, 963, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1039
 *     }
 * 
 *     def apply(self, x, evaluation):             # <<<<<<<<<<<<<<
 *         "Rationalize[x_]"
 * 
 */
  __pyx_tuple__75 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_x, __pyx_n_s_evaluation, __pyx_n_s_py_x); if (unlikely(!__pyx_tuple__75)) __PYX_ERR(0, 1039, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__75);
  __Pyx_GIVEREF(__pyx_tuple__75);
  __pyx_codeobj__76 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__75, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_apply, 1039, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__76)) __PYX_ERR(0, 1039, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1048
 * 
 *     @staticmethod
 *     def find_approximant(x):             # <<<<<<<<<<<<<<
 *         c = 1e-4
 *         it = sympy.ntheory.continued_fraction_convergents(
 */
  __pyx_tuple__77 = PyTuple_Pack(7, __pyx_n_s_x, __pyx_n_s_c, __pyx_n_s_it, __pyx_n_s_i, __pyx_n_s_p, __pyx_n_s_q, __pyx_n_s_tol); if (unlikely(!__pyx_tuple__77)) __PYX_ERR(0, 1048, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__77);
  __Pyx_GIVEREF(__pyx_tuple__77);
  __pyx_codeobj__78 = (PyObject*)__Pyx_PyCode_New(1, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__77, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_find_approximant, 1048, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__78)) __PYX_ERR(0, 1048, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1063
 * 
 *     @staticmethod
 *     def find_exact(x):             # <<<<<<<<<<<<<<
 *         p, q = x.as_numer_denom()
 *         it = sympy.ntheory.continued_fraction_convergents(
 */
  __pyx_tuple__79 = PyTuple_Pack(5, __pyx_n_s_x, __pyx_n_s_p, __pyx_n_s_q, __pyx_n_s_it, __pyx_n_s_i); if (unlikely(!__pyx_tuple__79)) __PYX_ERR(0, 1063, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__79);
  __Pyx_GIVEREF(__pyx_tuple__79);
  __pyx_codeobj__80 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__79, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_find_exact, 1063, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__80)) __PYX_ERR(0, 1063, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1073
 *                 return i
 * 
 *     def apply_dx(self, x, dx, evaluation):             # <<<<<<<<<<<<<<
 *         "Rationalize[x_, dx_]"
 *         py_x = x.to_sympy()
 */
  __pyx_tuple__81 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_x, __pyx_n_s_dx, __pyx_n_s_evaluation, __pyx_n_s_py_x, __pyx_n_s_py_dx, __pyx_n_s_a, __pyx_n_s_sym_x); if (unlikely(!__pyx_tuple__81)) __PYX_ERR(0, 1073, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__81);
  __Pyx_GIVEREF(__pyx_tuple__81);
  __pyx_codeobj__82 = (PyObject*)__Pyx_PyCode_New(4, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__81, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_apply_dx, 1073, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__82)) __PYX_ERR(0, 1073, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1093
 * 
 *     @staticmethod
 *     def approx_interval_continued_fraction(xmin, xmax):             # <<<<<<<<<<<<<<
 *         result = []
 *         a_gen = sympy.ntheory.continued_fraction_iterator(xmin)
 */
  __pyx_tuple__83 = PyTuple_Pack(7, __pyx_n_s_xmin, __pyx_n_s_xmax, __pyx_n_s_result, __pyx_n_s_a_gen, __pyx_n_s_b_gen, __pyx_n_s_a, __pyx_n_s_b); if (unlikely(!__pyx_tuple__83)) __PYX_ERR(0, 1093, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__83);
  __Pyx_GIVEREF(__pyx_tuple__83);
  __pyx_codeobj__84 = (PyObject*)__Pyx_PyCode_New(2, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__83, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_approx_interval_continued_fracti, 1093, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__84)) __PYX_ERR(0, 1093, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1107
 * 
 * 
 * def chop(expr, delta=10.0 ** (-10.0)):             # <<<<<<<<<<<<<<
 *     if isinstance(expr, Real):
 *         if -delta < expr.get_float_value() < delta:
 */
  __pyx_tuple__85 = PyTuple_Pack(5, __pyx_n_s_expr, __pyx_n_s_delta, __pyx_n_s_real, __pyx_n_s_imag, __pyx_n_s_leaf); if (unlikely(!__pyx_tuple__85)) __PYX_ERR(0, 1107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__85);
  __Pyx_GIVEREF(__pyx_tuple__85);
  __pyx_codeobj__86 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__85, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_chop, 1107, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__86)) __PYX_ERR(0, 1107, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1150
 *     }
 * 
 *     def apply(self, expr, delta, evaluation):             # <<<<<<<<<<<<<<
 *         "Chop[expr_, delta_:(10^-10)]"
 * 
 */
  __pyx_tuple__87 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_expr, __pyx_n_s_delta, __pyx_n_s_evaluation); if (unlikely(!__pyx_tuple__87)) __PYX_ERR(0, 1150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__87);
  __Pyx_GIVEREF(__pyx_tuple__87);
  __pyx_codeobj__88 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__87, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_apply, 1150, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__88)) __PYX_ERR(0, 1150, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1175
 *     """
 * 
 *     def apply(self, expr, evaluation):             # <<<<<<<<<<<<<<
 *         "NumericQ[expr_]"
 * 
 */
  __pyx_tuple__89 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_expr, __pyx_n_s_evaluation, __pyx_n_s_test, __pyx_n_s_test); if (unlikely(!__pyx_tuple__89)) __PYX_ERR(0, 1175, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__89);
  __Pyx_GIVEREF(__pyx_tuple__89);
  __pyx_codeobj__90 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__89, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_apply, 1175, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__90)) __PYX_ERR(0, 1175, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1248
 *     """
 * 
 *     attributes = ("Listable",)             # <<<<<<<<<<<<<<
 * 
 *     messages = {
 */
  __pyx_tuple__91 = PyTuple_Pack(1, __pyx_n_u_Listable); if (unlikely(!__pyx_tuple__91)) __PYX_ERR(0, 1248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__91);
  __Pyx_GIVEREF(__pyx_tuple__91);

  /* "mathics/builtin/numeric.py":1259
 *     }
 * 
 *     def apply_len(self, n, base, length, evaluation):             # <<<<<<<<<<<<<<
 *         "IntegerDigits[n_, base_, length_]"
 * 
 */
  __pyx_tuple__92 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_n, __pyx_n_s_base, __pyx_n_s_length, __pyx_n_s_evaluation); if (unlikely(!__pyx_tuple__92)) __PYX_ERR(0, 1259, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__92);
  __Pyx_GIVEREF(__pyx_tuple__92);
  __pyx_codeobj__93 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__92, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_apply_len, 1259, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__93)) __PYX_ERR(0, 1259, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1267
 *         return self.apply(n, base, evaluation, nr_elements=length.get_int_value())
 * 
 *     def apply(self, n, base, evaluation, nr_elements=None):             # <<<<<<<<<<<<<<
 *         "IntegerDigits[n_, base_]"
 * 
 */
  __pyx_tuple__94 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_n, __pyx_n_s_base, __pyx_n_s_evaluation, __pyx_n_s_nr_elements, __pyx_n_s_digits); if (unlikely(!__pyx_tuple__94)) __PYX_ERR(0, 1267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__94);
  __Pyx_GIVEREF(__pyx_tuple__94);
  __pyx_codeobj__95 = (PyObject*)__Pyx_PyCode_New(5, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__94, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_apply, 1267, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__95)) __PYX_ERR(0, 1267, __pyx_L1_error)
  __pyx_tuple__96 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__96)) __PYX_ERR(0, 1267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__96);
  __Pyx_GIVEREF(__pyx_tuple__96);

  /* "mathics/builtin/numeric.py":1295
 * 
 * 
 * def check_finite_decimal(denominator):             # <<<<<<<<<<<<<<
 *     # The rational number is finite decimal if the denominator has form 2^a * 5^b
 *     while denominator % 5 == 0:
 */
  __pyx_tuple__97 = PyTuple_Pack(1, __pyx_n_s_denominator); if (unlikely(!__pyx_tuple__97)) __PYX_ERR(0, 1295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__97);
  __Pyx_GIVEREF(__pyx_tuple__97);
  __pyx_codeobj__98 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__97, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_check_finite_decimal, 1295, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__98)) __PYX_ERR(0, 1295, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1306
 * 
 * 
 * def convert_repeating_decimal(numerator, denominator, base):             # <<<<<<<<<<<<<<
 *     head = [x for x in str(numerator // denominator)]
 *     tails = []
 */
  __pyx_tuple__99 = PyTuple_Pack(12, __pyx_n_s_numerator, __pyx_n_s_denominator, __pyx_n_s_base, __pyx_n_s_head, __pyx_n_s_tails, __pyx_n_s_subresults, __pyx_n_s_result_digit, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_x, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__99)) __PYX_ERR(0, 1306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__99);
  __Pyx_GIVEREF(__pyx_tuple__99);
  __pyx_codeobj__100 = (PyObject*)__Pyx_PyCode_New(3, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__99, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_convert_repeating_decimal, 1306, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__100)) __PYX_ERR(0, 1306, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1341
 * 
 * 
 * def convert_float_base(x, base, precision=10):             # <<<<<<<<<<<<<<
 * 
 *     length_of_int = 0 if x == 0 else int(mpmath.log(x, base))
 */
  __pyx_tuple__101 = PyTuple_Pack(10, __pyx_n_s_x, __pyx_n_s_base, __pyx_n_s_precision, __pyx_n_s_length_of_int, __pyx_n_s_convert_int, __pyx_n_s_convert_int, __pyx_n_s_convert_float, __pyx_n_s_convert_float, __pyx_n_s_int_part, __pyx_n_s_real_part); if (unlikely(!__pyx_tuple__101)) __PYX_ERR(0, 1341, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__101);
  __Pyx_GIVEREF(__pyx_tuple__101);
  __pyx_codeobj__102 = (PyObject*)__Pyx_PyCode_New(3, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__101, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_convert_float_base, 1341, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__102)) __PYX_ERR(0, 1341, __pyx_L1_error)
  __pyx_tuple__103 = PyTuple_Pack(1, ((PyObject *)__pyx_int_10)); if (unlikely(!__pyx_tuple__103)) __PYX_ERR(0, 1341, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__103);
  __Pyx_GIVEREF(__pyx_tuple__103);

  /* "mathics/builtin/numeric.py":1459
 *     }
 * 
 *     def apply_complex(self, n, var, evaluation):             # <<<<<<<<<<<<<<
 *         "%(name)s[n_Complex, var___]"
 *         return evaluation.message("RealDigits", "realx", n)
 */
  __pyx_tuple__104 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_n, __pyx_n_s_var, __pyx_n_s_evaluation); if (unlikely(!__pyx_tuple__104)) __PYX_ERR(0, 1459, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__104);
  __Pyx_GIVEREF(__pyx_tuple__104);
  __pyx_codeobj__105 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__104, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_apply_complex, 1459, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__105)) __PYX_ERR(0, 1459, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1463
 *         return evaluation.message("RealDigits", "realx", n)
 * 
 *     def apply_rational_with_base(self, n, b, evaluation):             # <<<<<<<<<<<<<<
 *         "%(name)s[n_Rational, b_Integer]"
 *         # expr = Expression("RealDigits", n)
 */
  __pyx_tuple__106 = PyTuple_Pack(12, __pyx_n_s_self, __pyx_n_s_n, __pyx_n_s_b, __pyx_n_s_evaluation, __pyx_n_s_py_n, __pyx_n_s_py_b, __pyx_n_s_exp, __pyx_n_s_head, __pyx_n_s_tails, __pyx_n_s_leaves, __pyx_n_s_x, __pyx_n_s_list_str); if (unlikely(!__pyx_tuple__106)) __PYX_ERR(0, 1463, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__106);
  __Pyx_GIVEREF(__pyx_tuple__106);
  __pyx_codeobj__107 = (PyObject*)__Pyx_PyCode_New(4, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__106, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_apply_rational_with_base, 1463, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__107)) __PYX_ERR(0, 1463, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1484
 *         return Expression(SymbolList, list_str, exp)
 * 
 *     def apply_rational_without_base(self, n, evaluation):             # <<<<<<<<<<<<<<
 *         "%(name)s[n_Rational]"
 * 
 */
  __pyx_tuple__108 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_n, __pyx_n_s_evaluation); if (unlikely(!__pyx_tuple__108)) __PYX_ERR(0, 1484, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__108);
  __Pyx_GIVEREF(__pyx_tuple__108);
  __pyx_codeobj__109 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__108, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_apply_rational_without_base, 1484, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__109)) __PYX_ERR(0, 1484, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1489
 *         return self.apply_rational_with_base(n, from_python(10), evaluation)
 * 
 *     def apply(self, n, evaluation):             # <<<<<<<<<<<<<<
 *         "%(name)s[n_]"
 * 
 */
  __pyx_tuple__110 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_n, __pyx_n_s_evaluation); if (unlikely(!__pyx_tuple__110)) __PYX_ERR(0, 1489, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__110);
  __Pyx_GIVEREF(__pyx_tuple__110);
  __pyx_codeobj__111 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__110, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_apply, 1489, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__111)) __PYX_ERR(0, 1489, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1499
 *             return self.apply_with_base(n, from_python(10), evaluation)
 * 
 *     def apply_with_base(self, n, b, evaluation, nr_elements=None, pos=None):             # <<<<<<<<<<<<<<
 *         "%(name)s[n_?NumericQ, b_Integer]"
 * 
 */
  __pyx_tuple__112 = PyTuple_Pack(20, __pyx_n_s_self, __pyx_n_s_n, __pyx_n_s_b, __pyx_n_s_evaluation, __pyx_n_s_nr_elements, __pyx_n_s_pos, __pyx_n_s_expr, __pyx_n_s_rational_no, __pyx_n_s_py_b, __pyx_n_s_pos_len, __pyx_n_s_py_n, __pyx_n_s_display_len, __pyx_n_s_exp, __pyx_n_s_digits, __pyx_n_s_i, __pyx_n_s_x, __pyx_n_s_temp, __pyx_n_s_move, __pyx_n_s_leaves, __pyx_n_s_list_str); if (unlikely(!__pyx_tuple__112)) __PYX_ERR(0, 1499, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__112);
  __Pyx_GIVEREF(__pyx_tuple__112);
  __pyx_codeobj__113 = (PyObject*)__Pyx_PyCode_New(6, 0, 20, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__112, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_apply_with_base, 1499, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__113)) __PYX_ERR(0, 1499, __pyx_L1_error)
  __pyx_tuple__114 = PyTuple_Pack(2, ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__114)) __PYX_ERR(0, 1499, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__114);
  __Pyx_GIVEREF(__pyx_tuple__114);

  /* "mathics/builtin/numeric.py":1609
 *         return Expression(SymbolList, list_str, exp)
 * 
 *     def apply_with_base_and_length(self, n, b, length, evaluation, pos=None):             # <<<<<<<<<<<<<<
 *         "%(name)s[n_?NumericQ, b_Integer, length_]"
 *         leaves = []
 */
  __pyx_tuple__115 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_n, __pyx_n_s_b, __pyx_n_s_length, __pyx_n_s_evaluation, __pyx_n_s_pos, __pyx_n_s_leaves, __pyx_n_s_expr); if (unlikely(!__pyx_tuple__115)) __PYX_ERR(0, 1609, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__115);
  __Pyx_GIVEREF(__pyx_tuple__115);
  __pyx_codeobj__116 = (PyObject*)__Pyx_PyCode_New(6, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__115, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_apply_with_base_and_length, 1609, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__116)) __PYX_ERR(0, 1609, __pyx_L1_error)
  __pyx_tuple__117 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__117)) __PYX_ERR(0, 1609, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__117);
  __Pyx_GIVEREF(__pyx_tuple__117);

  /* "mathics/builtin/numeric.py":1622
 *         )
 * 
 *     def apply_with_base_length_and_precision(self, n, b, length, p, evaluation):             # <<<<<<<<<<<<<<
 *         "%(name)s[n_?NumericQ, b_Integer, length_, p_]"
 *         if not isinstance(p, Integer):
 */
  __pyx_tuple__118 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_n, __pyx_n_s_b, __pyx_n_s_length, __pyx_n_s_p, __pyx_n_s_evaluation); if (unlikely(!__pyx_tuple__118)) __PYX_ERR(0, 1622, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__118);
  __Pyx_GIVEREF(__pyx_tuple__118);
  __pyx_codeobj__119 = (PyObject*)__Pyx_PyCode_New(6, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__118, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_apply_with_base_length_and_preci, 1622, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__119)) __PYX_ERR(0, 1622, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1635
 * 
 * class _ZLibHash:  # make zlib hashes behave as if they were from hashlib
 *     def __init__(self, fn):             # <<<<<<<<<<<<<<
 *         self._bytes = b""
 *         self._fn = fn
 */
  __pyx_tuple__120 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_fn); if (unlikely(!__pyx_tuple__120)) __PYX_ERR(0, 1635, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__120);
  __Pyx_GIVEREF(__pyx_tuple__120);
  __pyx_codeobj__121 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__120, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_init, 1635, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__121)) __PYX_ERR(0, 1635, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1639
 *         self._fn = fn
 * 
 *     def update(self, bytes):             # <<<<<<<<<<<<<<
 *         self._bytes += bytes
 * 
 */
  __pyx_tuple__122 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_bytes_2); if (unlikely(!__pyx_tuple__122)) __PYX_ERR(0, 1639, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__122);
  __Pyx_GIVEREF(__pyx_tuple__122);
  __pyx_codeobj__123 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__122, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_update, 1639, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__123)) __PYX_ERR(0, 1639, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1642
 *         self._bytes += bytes
 * 
 *     def hexdigest(self):             # <<<<<<<<<<<<<<
 *         return format(self._fn(self._bytes), "x")
 * 
 */
  __pyx_tuple__124 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__124)) __PYX_ERR(0, 1642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__124);
  __Pyx_GIVEREF(__pyx_tuple__124);
  __pyx_codeobj__125 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__124, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_hexdigest, 1642, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__125)) __PYX_ERR(0, 1642, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1682
 *     }
 * 
 *     attributes = ("Protected", "ReadProtected")             # <<<<<<<<<<<<<<
 * 
 *     # FIXME md2
 */
  __pyx_tuple__126 = PyTuple_Pack(2, __pyx_n_u_Protected, __pyx_n_u_ReadProtected); if (unlikely(!__pyx_tuple__126)) __PYX_ERR(0, 1682, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__126);
  __Pyx_GIVEREF(__pyx_tuple__126);

  /* "mathics/builtin/numeric.py":1697
 * 
 *     @staticmethod
 *     def compute(user_hash, py_hashtype, py_format):             # <<<<<<<<<<<<<<
 *         hash_func = Hash._supported_hashes.get(py_hashtype)
 *         if hash_func is None:  # unknown hash function?
 */
  __pyx_tuple__127 = PyTuple_Pack(6, __pyx_n_s_user_hash, __pyx_n_s_py_hashtype, __pyx_n_s_py_format, __pyx_n_s_hash_func, __pyx_n_s_h, __pyx_n_s_res); if (unlikely(!__pyx_tuple__127)) __PYX_ERR(0, 1697, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__127);
  __Pyx_GIVEREF(__pyx_tuple__127);
  __pyx_codeobj__128 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__127, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_compute, 1697, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__128)) __PYX_ERR(0, 1697, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1713
 *         return from_python(res)
 * 
 *     def apply(self, expr, hashtype, outformat, evaluation):             # <<<<<<<<<<<<<<
 *         "Hash[expr_, hashtype_String, outformat_String]"
 *         return Hash.compute(
 */
  __pyx_tuple__129 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_expr, __pyx_n_s_hashtype, __pyx_n_s_outformat, __pyx_n_s_evaluation); if (unlikely(!__pyx_tuple__129)) __PYX_ERR(0, 1713, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__129);
  __Pyx_GIVEREF(__pyx_tuple__129);
  __pyx_codeobj__130 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__129, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_apply, 1713, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__130)) __PYX_ERR(0, 1713, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1721
 * 
 * class TypeEscalation(Exception):
 *     def __init__(self, mode):             # <<<<<<<<<<<<<<
 *         self.mode = mode
 * 
 */
  __pyx_tuple__131 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_mode); if (unlikely(!__pyx_tuple__131)) __PYX_ERR(0, 1721, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__131);
  __Pyx_GIVEREF(__pyx_tuple__131);
  __pyx_codeobj__132 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__131, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_init, 1721, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__132)) __PYX_ERR(0, 1721, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1725
 * 
 * 
 * class Fold(object):             # <<<<<<<<<<<<<<
 *     # allows inherited classes to specify a single algorithm implementation that
 *     # can be called with machine precision, arbitrary precision or symbolically.
 */
  __pyx_tuple__133 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__133)) __PYX_ERR(0, 1725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__133);
  __Pyx_GIVEREF(__pyx_tuple__133);

  /* "mathics/builtin/numeric.py":1729
 *     # can be called with machine precision, arbitrary precision or symbolically.
 * 
 *     ComputationFunctions = namedtuple("ComputationFunctions", ("sin", "cos"))             # <<<<<<<<<<<<<<
 * 
 *     FLOAT = 0
 */
  __pyx_tuple__134 = PyTuple_Pack(2, __pyx_n_u_sin, __pyx_n_u_cos); if (unlikely(!__pyx_tuple__134)) __PYX_ERR(0, 1729, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__134);
  __Pyx_GIVEREF(__pyx_tuple__134);
  __pyx_tuple__135 = PyTuple_Pack(2, __pyx_n_u_ComputationFunctions, __pyx_tuple__134); if (unlikely(!__pyx_tuple__135)) __PYX_ERR(0, 1729, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__135);
  __Pyx_GIVEREF(__pyx_tuple__135);

  /* "mathics/builtin/numeric.py":1756
 *     }
 * 
 *     def _operands(self, state, steps):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */
  __pyx_tuple__136 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_state, __pyx_n_s_steps); if (unlikely(!__pyx_tuple__136)) __PYX_ERR(0, 1756, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__136);
  __Pyx_GIVEREF(__pyx_tuple__136);
  __pyx_codeobj__137 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__136, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_operands_2, 1756, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__137)) __PYX_ERR(0, 1756, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1759
 *         raise NotImplementedError
 * 
 *     def _fold(self, state, steps, math):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */
  __pyx_tuple__138 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_state, __pyx_n_s_steps, __pyx_n_s_math); if (unlikely(!__pyx_tuple__138)) __PYX_ERR(0, 1759, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__138);
  __Pyx_GIVEREF(__pyx_tuple__138);
  __pyx_codeobj__139 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__138, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_fold_2, 1759, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__139)) __PYX_ERR(0, 1759, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1762
 *         raise NotImplementedError
 * 
 *     def _spans(self, operands):             # <<<<<<<<<<<<<<
 *         spans = {}
 *         k = 0
 */
  __pyx_tuple__140 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_operands, __pyx_n_s_spans_2, __pyx_n_s_k, __pyx_n_s_j, __pyx_n_s_mode, __pyx_n_s_i, __pyx_n_s_operand); if (unlikely(!__pyx_tuple__140)) __PYX_ERR(0, 1762, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__140);
  __Pyx_GIVEREF(__pyx_tuple__140);
  __pyx_codeobj__141 = (PyObject*)__Pyx_PyCode_New(2, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__140, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_spans, 1762, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__141)) __PYX_ERR(0, 1762, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1783
 *         return spans
 * 
 *     def fold(self, x, ll):             # <<<<<<<<<<<<<<
 *         # computes fold(x, ll) with the internal _fold function. will start
 *         # its evaluation machine precision, and will escalate to arbitrary
 */
  __pyx_tuple__142 = PyTuple_Pack(29, __pyx_n_s_self, __pyx_n_s_x, __pyx_n_s_ll, __pyx_n_s_init_2, __pyx_n_s_operands, __pyx_n_s_spans_2, __pyx_n_s_mode, __pyx_n_s_s_operands, __pyx_n_s_min_prec, __pyx_n_s_precision, __pyx_n_s_working_precision, __pyx_n_s_working_precision, __pyx_n_s_out, __pyx_n_s_out, __pyx_n_s_out, __pyx_n_s_out, __pyx_n_s_as_operand, __pyx_n_s_converted_operands, __pyx_n_s_converted_operands, __pyx_n_s_c_operands, __pyx_n_s_c_init, __pyx_n_s_generator, __pyx_n_s_y, __pyx_n_s_y, __pyx_n_s_t, __pyx_n_s_genexpr, __pyx_n_s_genexpr, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__142)) __PYX_ERR(0, 1783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__142);
  __Pyx_GIVEREF(__pyx_tuple__142);
  __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(3, 0, 29, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__142, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mathics_builtin_numeric_py, __pyx_n_s_fold, 1783, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 1783, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
  __pyx_umethod_PyDict_Type_get.type = (PyObject*)&PyDict_Type;
  __pyx_umethod_PyDict_Type_update.type = (PyObject*)&PyDict_Type;
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  __pyx_float_0_0 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_float_0_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_0_5 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_float_0_5)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_1_0 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_float_1_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_4_0 = PyFloat_FromDouble(4.0); if (unlikely(!__pyx_float_4_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_10_0 = PyFloat_FromDouble(10.0); if (unlikely(!__pyx_float_10_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_1eneg_10 = PyFloat_FromDouble(1e-10); if (unlikely(!__pyx_float_1eneg_10)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_1_0eneg_10 = PyFloat_FromDouble(1.0e-10); if (unlikely(!__pyx_float_1_0eneg_10)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_neg_2_0 = PyFloat_FromDouble(-2.0); if (unlikely(!__pyx_float_neg_2_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_float_neg_10_0 = PyFloat_FromDouble(-10.0); if (unlikely(!__pyx_float_neg_10_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_16 = PyInt_FromLong(16); if (unlikely(!__pyx_int_16)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_150 = PyInt_FromLong(150); if (unlikely(!__pyx_int_150)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_1024 = PyInt_FromLong(1024); if (unlikely(!__pyx_int_1024)) __PYX_ERR(0, 1, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/

static int __Pyx_modinit_global_init_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  /*--- Global init code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  /*--- Variable export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  /*--- Function export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_type_init_code(void) {
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  /*--- Type init code ---*/
  if (PyType_Ready(&__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface) < 0) __PYX_ERR(0, 236, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface.tp_dictoffset && __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface = &__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct___scipy_interface;
  if (PyType_Ready(&__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule) < 0) __PYX_ERR(0, 269, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule.tp_dictoffset && __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule = &__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_1__internal_adaptative_simpsons_rule;
  if (PyType_Ready(&__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini) < 0) __PYX_ERR(0, 355, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini.tp_dictoffset && __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini = &__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_2__fubini;
  if (PyType_Ready(&__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral) < 0) __PYX_ERR(0, 367, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral.tp_dictoffset && __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral = &__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_3_subintegral;
  if (PyType_Ready(&__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain) < 0) __PYX_ERR(0, 523, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain.tp_dictoffset && __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain = &__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_4_apply_with_func_domain;
  if (PyType_Ready(&__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply) < 0) __PYX_ERR(0, 1175, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply.tp_dictoffset && __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply = &__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_5_apply;
  if (PyType_Ready(&__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_6_test) < 0) __PYX_ERR(0, 1178, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_6_test.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_6_test.tp_dictoffset && __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_6_test.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_6_test.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_6_test = &__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_6_test;
  if (PyType_Ready(&__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr) < 0) __PYX_ERR(0, 1182, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr.tp_dictoffset && __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr = &__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_7_genexpr;
  if (PyType_Ready(&__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal) < 0) __PYX_ERR(0, 1306, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal.tp_dictoffset && __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal = &__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_8_convert_repeating_decimal;
  if (PyType_Ready(&__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr) < 0) __PYX_ERR(0, 1332, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr.tp_dictoffset && __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr = &__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_9_genexpr;
  if (PyType_Ready(&__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold) < 0) __PYX_ERR(0, 1783, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold.tp_dictoffset && __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold = &__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_10_fold;
  if (PyType_Ready(&__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision) < 0) __PYX_ERR(0, 1809, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision.tp_dictoffset && __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision = &__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_11_working_precision;
  if (PyType_Ready(&__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands) < 0) __PYX_ERR(0, 1831, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands.tp_dictoffset && __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands = &__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_12_converted_operands;
  if (PyType_Ready(&__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr) < 0) __PYX_ERR(0, 1833, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr.tp_dictoffset && __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr = &__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_13_genexpr;
  if (PyType_Ready(&__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr) < 0) __PYX_ERR(0, 1840, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr.tp_dictoffset && __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr = &__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_14_genexpr;
  if (PyType_Ready(&__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr) < 0) __PYX_ERR(0, 1845, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr.tp_dictoffset && __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr = &__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_15_genexpr;
  if (PyType_Ready(&__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr) < 0) __PYX_ERR(0, 1850, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr.tp_dictoffset && __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr = &__pyx_type_7mathics_7builtin_7numeric___pyx_scope_struct_16_genexpr;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  /*--- Type import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  /*--- Variable import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  /*--- Function import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}


#ifndef CYTHON_NO_PYINIT_EXPORT
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#elif PY_MAJOR_VERSION < 3
#ifdef __cplusplus
#define __Pyx_PyMODINIT_FUNC extern "C" void
#else
#define __Pyx_PyMODINIT_FUNC void
#endif
#else
#ifdef __cplusplus
#define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
#else
#define __Pyx_PyMODINIT_FUNC PyObject *
#endif
#endif


#if PY_MAJOR_VERSION < 3
__Pyx_PyMODINIT_FUNC initnumeric(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC initnumeric(void)
#else
__Pyx_PyMODINIT_FUNC PyInit_numeric(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC PyInit_numeric(void)
#if CYTHON_PEP489_MULTI_PHASE_INIT
{
  return PyModuleDef_Init(&__pyx_moduledef);
}
static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
    #if PY_VERSION_HEX >= 0x030700A1
    static PY_INT64_T main_interpreter_id = -1;
    PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
    if (main_interpreter_id == -1) {
        main_interpreter_id = current_id;
        return (unlikely(current_id == -1)) ? -1 : 0;
    } else if (unlikely(main_interpreter_id != current_id))
    #else
    static PyInterpreterState *main_interpreter = NULL;
    PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
    if (!main_interpreter) {
        main_interpreter = current_interpreter;
    } else if (unlikely(main_interpreter != current_interpreter))
    #endif
    {
        PyErr_SetString(
            PyExc_ImportError,
            "Interpreter change detected - this module can only be loaded into one interpreter per process.");
        return -1;
    }
    return 0;
}
static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
    PyObject *value = PyObject_GetAttrString(spec, from_name);
    int result = 0;
    if (likely(value)) {
        if (allow_none || value != Py_None) {
            result = PyDict_SetItemString(moddict, to_name, value);
        }
        Py_DECREF(value);
    } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Clear();
    } else {
        result = -1;
    }
    return result;
}
static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
    PyObject *module = NULL, *moddict, *modname;
    if (__Pyx_check_single_interpreter())
        return NULL;
    if (__pyx_m)
        return __Pyx_NewRef(__pyx_m);
    modname = PyObject_GetAttrString(spec, "name");
    if (unlikely(!modname)) goto bad;
    module = PyModule_NewObject(modname);
    Py_DECREF(modname);
    if (unlikely(!module)) goto bad;
    moddict = PyModule_GetDict(module);
    if (unlikely(!moddict)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
    return module;
bad:
    Py_XDECREF(module);
    return NULL;
}


static CYTHON_SMALL_CODE int __pyx_pymod_exec_numeric(PyObject *__pyx_pyinit_module)
#endif
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  if (__pyx_m) {
    if (__pyx_m == __pyx_pyinit_module) return 0;
    PyErr_SetString(PyExc_RuntimeError, "Module 'numeric' has already been imported. Re-initialisation is not supported.");
    return -1;
  }
  #elif PY_MAJOR_VERSION >= 3
  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  #endif
  #if CYTHON_REFNANNY
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
if (!__Pyx_RefNanny) {
  PyErr_Clear();
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
  if (!__Pyx_RefNanny)
      Py_FatalError("failed to import 'refnanny' module");
}
#endif
  __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_numeric(void)", 0);
  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pxy_PyFrame_Initialize_Offsets
  __Pxy_PyFrame_Initialize_Offsets();
  #endif
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pyx_CyFunction_USED
  if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Coroutine_USED
  if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_AsyncGen_USED
  if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_StopAsyncIteration_USED
  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  __pyx_m = __pyx_pyinit_module;
  Py_INCREF(__pyx_m);
  #else
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4("numeric", __pyx_methods, __pyx_k_Numeric_Evaluation_and_Precisio, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_d);
  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_b);
  __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_cython_runtime);
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  if (__pyx_module_is_main_mathics__builtin__numeric) {
    if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "mathics.builtin.numeric")) {
      if (unlikely(PyDict_SetItemString(modules, "mathics.builtin.numeric", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Global type/function init code ---*/
  (void)__Pyx_modinit_global_init_code();
  (void)__Pyx_modinit_variable_export_code();
  (void)__Pyx_modinit_function_export_code();
  if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
  (void)__Pyx_modinit_type_import_code();
  (void)__Pyx_modinit_variable_import_code();
  (void)__Pyx_modinit_function_import_code();
  /*--- Execution code ---*/
  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif

  /* "mathics/builtin/numeric.py":15
 * However, things like 'N[Pi, 100]' should work as expected.
 * """
 * from mathics.version import __version__  # noqa used in loading to check consistency.             # <<<<<<<<<<<<<<
 * import sympy
 * import mpmath
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_version);
  __Pyx_GIVEREF(__pyx_n_s_version);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_version);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_mathics_version, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_version); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_version, __pyx_t_1) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":16
 * """
 * from mathics.version import __version__  # noqa used in loading to check consistency.
 * import sympy             # <<<<<<<<<<<<<<
 * import mpmath
 * import numpy as np
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_sympy, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_sympy, __pyx_t_2) < 0) __PYX_ERR(0, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":17
 * from mathics.version import __version__  # noqa used in loading to check consistency.
 * import sympy
 * import mpmath             # <<<<<<<<<<<<<<
 * import numpy as np
 * import math
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_mpmath, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_mpmath, __pyx_t_2) < 0) __PYX_ERR(0, 17, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":18
 * import sympy
 * import mpmath
 * import numpy as np             # <<<<<<<<<<<<<<
 * import math
 * import hashlib
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_numpy, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_2) < 0) __PYX_ERR(0, 18, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":19
 * import mpmath
 * import numpy as np
 * import math             # <<<<<<<<<<<<<<
 * import hashlib
 * import zlib
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_math, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_math, __pyx_t_2) < 0) __PYX_ERR(0, 19, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":20
 * import numpy as np
 * import math
 * import hashlib             # <<<<<<<<<<<<<<
 * import zlib
 * from collections import namedtuple
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_hashlib, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_hashlib, __pyx_t_2) < 0) __PYX_ERR(0, 20, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":21
 * import math
 * import hashlib
 * import zlib             # <<<<<<<<<<<<<<
 * from collections import namedtuple
 * from contextlib import contextmanager
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_zlib, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 21, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_zlib, __pyx_t_2) < 0) __PYX_ERR(0, 21, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":22
 * import hashlib
 * import zlib
 * from collections import namedtuple             # <<<<<<<<<<<<<<
 * from contextlib import contextmanager
 * from itertools import chain, product
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_namedtuple);
  __Pyx_GIVEREF(__pyx_n_s_namedtuple);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_namedtuple);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_collections, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_namedtuple); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_namedtuple, __pyx_t_2) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":23
 * import zlib
 * from collections import namedtuple
 * from contextlib import contextmanager             # <<<<<<<<<<<<<<
 * from itertools import chain, product
 * from functools import lru_cache
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_contextmanager);
  __Pyx_GIVEREF(__pyx_n_s_contextmanager);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_contextmanager);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_contextlib, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_contextmanager); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_contextmanager, __pyx_t_1) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":24
 * from collections import namedtuple
 * from contextlib import contextmanager
 * from itertools import chain, product             # <<<<<<<<<<<<<<
 * from functools import lru_cache
 * 
 */
  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_chain);
  __Pyx_GIVEREF(__pyx_n_s_chain);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_chain);
  __Pyx_INCREF(__pyx_n_s_product);
  __Pyx_GIVEREF(__pyx_n_s_product);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_product);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_itertools, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_chain); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_chain, __pyx_t_2) < 0) __PYX_ERR(0, 24, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_product); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_product, __pyx_t_2) < 0) __PYX_ERR(0, 24, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":25
 * from contextlib import contextmanager
 * from itertools import chain, product
 * from functools import lru_cache             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_lru_cache);
  __Pyx_GIVEREF(__pyx_n_s_lru_cache);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_lru_cache);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_functools, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_lru_cache); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_lru_cache, __pyx_t_1) < 0) __PYX_ERR(0, 25, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":28
 * 
 * 
 * from mathics.builtin.base import Builtin, Predefined             # <<<<<<<<<<<<<<
 * from mathics.core.numbers import (
 *     dps,
 */
  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_Builtin);
  __Pyx_GIVEREF(__pyx_n_s_Builtin);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_Builtin);
  __Pyx_INCREF(__pyx_n_s_Predefined);
  __Pyx_GIVEREF(__pyx_n_s_Predefined);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_Predefined);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_mathics_builtin_base, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Builtin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Builtin, __pyx_t_2) < 0) __PYX_ERR(0, 28, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Predefined); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Predefined, __pyx_t_2) < 0) __PYX_ERR(0, 28, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":30
 * from mathics.builtin.base import Builtin, Predefined
 * from mathics.core.numbers import (
 *     dps,             # <<<<<<<<<<<<<<
 *     convert_int_to_digit_list,
 *     machine_precision,
 */
  __pyx_t_1 = PyList_New(6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_dps);
  __Pyx_GIVEREF(__pyx_n_s_dps);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_dps);
  __Pyx_INCREF(__pyx_n_s_convert_int_to_digit_list);
  __Pyx_GIVEREF(__pyx_n_s_convert_int_to_digit_list);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_convert_int_to_digit_list);
  __Pyx_INCREF(__pyx_n_s_machine_precision);
  __Pyx_GIVEREF(__pyx_n_s_machine_precision);
  PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_s_machine_precision);
  __Pyx_INCREF(__pyx_n_s_machine_epsilon);
  __Pyx_GIVEREF(__pyx_n_s_machine_epsilon);
  PyList_SET_ITEM(__pyx_t_1, 3, __pyx_n_s_machine_epsilon);
  __Pyx_INCREF(__pyx_n_s_get_precision);
  __Pyx_GIVEREF(__pyx_n_s_get_precision);
  PyList_SET_ITEM(__pyx_t_1, 4, __pyx_n_s_get_precision);
  __Pyx_INCREF(__pyx_n_s_PrecisionValueError);
  __Pyx_GIVEREF(__pyx_n_s_PrecisionValueError);
  PyList_SET_ITEM(__pyx_t_1, 5, __pyx_n_s_PrecisionValueError);

  /* "mathics/builtin/numeric.py":29
 * 
 * from mathics.builtin.base import Builtin, Predefined
 * from mathics.core.numbers import (             # <<<<<<<<<<<<<<
 *     dps,
 *     convert_int_to_digit_list,
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_mathics_core_numbers, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_dps); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_dps, __pyx_t_1) < 0) __PYX_ERR(0, 30, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_convert_int_to_digit_list); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_convert_int_to_digit_list, __pyx_t_1) < 0) __PYX_ERR(0, 31, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_machine_precision); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_machine_precision, __pyx_t_1) < 0) __PYX_ERR(0, 32, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_machine_epsilon); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_machine_epsilon, __pyx_t_1) < 0) __PYX_ERR(0, 33, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_get_precision); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_precision, __pyx_t_1) < 0) __PYX_ERR(0, 34, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_PrecisionValueError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_PrecisionValueError, __pyx_t_1) < 0) __PYX_ERR(0, 35, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":38
 * )
 * from mathics.core.expression import (
 *     Complex,             # <<<<<<<<<<<<<<
 *     Expression,
 *     Integer,
 */
  __pyx_t_2 = PyList_New(15); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_Complex);
  __Pyx_GIVEREF(__pyx_n_s_Complex);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_Complex);
  __Pyx_INCREF(__pyx_n_s_Expression);
  __Pyx_GIVEREF(__pyx_n_s_Expression);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_Expression);
  __Pyx_INCREF(__pyx_n_s_Integer);
  __Pyx_GIVEREF(__pyx_n_s_Integer);
  PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_Integer);
  __Pyx_INCREF(__pyx_n_s_Integer0);
  __Pyx_GIVEREF(__pyx_n_s_Integer0);
  PyList_SET_ITEM(__pyx_t_2, 3, __pyx_n_s_Integer0);
  __Pyx_INCREF(__pyx_n_s_MachineReal);
  __Pyx_GIVEREF(__pyx_n_s_MachineReal);
  PyList_SET_ITEM(__pyx_t_2, 4, __pyx_n_s_MachineReal);
  __Pyx_INCREF(__pyx_n_s_Number);
  __Pyx_GIVEREF(__pyx_n_s_Number);
  PyList_SET_ITEM(__pyx_t_2, 5, __pyx_n_s_Number);
  __Pyx_INCREF(__pyx_n_s_Rational);
  __Pyx_GIVEREF(__pyx_n_s_Rational);
  PyList_SET_ITEM(__pyx_t_2, 6, __pyx_n_s_Rational);
  __Pyx_INCREF(__pyx_n_s_Real);
  __Pyx_GIVEREF(__pyx_n_s_Real);
  PyList_SET_ITEM(__pyx_t_2, 7, __pyx_n_s_Real);
  __Pyx_INCREF(__pyx_n_s_String);
  __Pyx_GIVEREF(__pyx_n_s_String);
  PyList_SET_ITEM(__pyx_t_2, 8, __pyx_n_s_String);
  __Pyx_INCREF(__pyx_n_s_Symbol);
  __Pyx_GIVEREF(__pyx_n_s_Symbol);
  PyList_SET_ITEM(__pyx_t_2, 9, __pyx_n_s_Symbol);
  __Pyx_INCREF(__pyx_n_s_SymbolFalse);
  __Pyx_GIVEREF(__pyx_n_s_SymbolFalse);
  PyList_SET_ITEM(__pyx_t_2, 10, __pyx_n_s_SymbolFalse);
  __Pyx_INCREF(__pyx_n_s_SymbolTrue);
  __Pyx_GIVEREF(__pyx_n_s_SymbolTrue);
  PyList_SET_ITEM(__pyx_t_2, 11, __pyx_n_s_SymbolTrue);
  __Pyx_INCREF(__pyx_n_s_SymbolList);
  __Pyx_GIVEREF(__pyx_n_s_SymbolList);
  PyList_SET_ITEM(__pyx_t_2, 12, __pyx_n_s_SymbolList);
  __Pyx_INCREF(__pyx_n_s_SymbolN);
  __Pyx_GIVEREF(__pyx_n_s_SymbolN);
  PyList_SET_ITEM(__pyx_t_2, 13, __pyx_n_s_SymbolN);
  __Pyx_INCREF(__pyx_n_s_from_python);
  __Pyx_GIVEREF(__pyx_n_s_from_python);
  PyList_SET_ITEM(__pyx_t_2, 14, __pyx_n_s_from_python);

  /* "mathics/builtin/numeric.py":37
 *     PrecisionValueError,
 * )
 * from mathics.core.expression import (             # <<<<<<<<<<<<<<
 *     Complex,
 *     Expression,
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_mathics_core_expression, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Complex); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Complex, __pyx_t_2) < 0) __PYX_ERR(0, 38, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Expression); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Expression, __pyx_t_2) < 0) __PYX_ERR(0, 39, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Integer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Integer, __pyx_t_2) < 0) __PYX_ERR(0, 40, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Integer0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Integer0, __pyx_t_2) < 0) __PYX_ERR(0, 41, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_MachineReal); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_MachineReal, __pyx_t_2) < 0) __PYX_ERR(0, 42, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Number); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Number, __pyx_t_2) < 0) __PYX_ERR(0, 43, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Rational); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Rational, __pyx_t_2) < 0) __PYX_ERR(0, 44, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Real); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Real, __pyx_t_2) < 0) __PYX_ERR(0, 45, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_String); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_String, __pyx_t_2) < 0) __PYX_ERR(0, 46, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Symbol); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Symbol, __pyx_t_2) < 0) __PYX_ERR(0, 47, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_SymbolFalse); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SymbolFalse, __pyx_t_2) < 0) __PYX_ERR(0, 48, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_SymbolTrue); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SymbolTrue, __pyx_t_2) < 0) __PYX_ERR(0, 49, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_SymbolList); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SymbolList, __pyx_t_2) < 0) __PYX_ERR(0, 50, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_SymbolN); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SymbolN, __pyx_t_2) < 0) __PYX_ERR(0, 51, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_from_python); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_from_python, __pyx_t_2) < 0) __PYX_ERR(0, 52, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":54
 *     from_python,
 * )
 * from mathics.core.convert import from_sympy             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 54, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_from_sympy);
  __Pyx_GIVEREF(__pyx_n_s_from_sympy);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_from_sympy);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_mathics_core_convert, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 54, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_from_sympy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 54, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_from_sympy, __pyx_t_1) < 0) __PYX_ERR(0, 54, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":57
 * 
 * 
 * @lru_cache(maxsize=1024)             # <<<<<<<<<<<<<<
 * def log_n_b(py_n, py_b) -> int:
 *     return int(mpmath.ceil(mpmath.log(py_n, py_b))) if py_n != 0 and py_n != 1 else 1
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_lru_cache); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_maxsize, __pyx_int_1024) < 0) __PYX_ERR(0, 57, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":58
 * 
 * @lru_cache(maxsize=1024)
 * def log_n_b(py_n, py_b) -> int:             # <<<<<<<<<<<<<<
 *     return int(mpmath.ceil(mpmath.log(py_n, py_b))) if py_n != 0 and py_n != 1 else 1
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 58, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, __pyx_n_u_int) < 0) __PYX_ERR(0, 58, __pyx_L1_error)
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_1log_n_b, 0, __pyx_n_s_log_n_b, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__51)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 58, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":57
 * 
 * 
 * @lru_cache(maxsize=1024)             # <<<<<<<<<<<<<<
 * def log_n_b(py_n, py_b) -> int:
 *     return int(mpmath.ceil(mpmath.log(py_n, py_b))) if py_n != 0 and py_n != 1 else 1
 */
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 57, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_log_n_b, __pyx_t_1) < 0) __PYX_ERR(0, 58, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":62
 * 
 * 
 * class N(Builtin):             # <<<<<<<<<<<<<<
 *     """
 *     <dl>
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Builtin); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_N, __pyx_n_s_N, (PyObject *) NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_kp_s_dl_dt_N_expr_prec_dd_evaluates); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 62, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "mathics/builtin/numeric.py":162
 * 
 *     messages = {
 *         "precbd": ("Requested precision `1` is not a " + "machine-sized real number."),             # <<<<<<<<<<<<<<
 *         "preclg": (
 *             "Requested precision `1` is larger than $MaxPrecision. "
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 162, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_precbd, __pyx_kp_u_Requested_precision_1_is_not_a_m) < 0) __PYX_ERR(0, 162, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_preclg, __pyx_kp_u_Requested_precision_1_is_larger) < 0) __PYX_ERR(0, 162, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_precsm, __pyx_kp_u_Requested_precision_1_is_smaller) < 0) __PYX_ERR(0, 162, __pyx_L1_error)
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_messages, __pyx_t_4) < 0) __PYX_ERR(0, 161, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/builtin/numeric.py":177
 * 
 *     rules = {
 *         "N[expr_]": "N[expr, MachinePrecision]",             # <<<<<<<<<<<<<<
 *     }
 * 
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 177, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_N_expr, __pyx_kp_u_N_expr_MachinePrecision) < 0) __PYX_ERR(0, 177, __pyx_L1_error)
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_rules, __pyx_t_4) < 0) __PYX_ERR(0, 176, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/builtin/numeric.py":180
 *     }
 * 
 *     def apply_with_prec(self, expr, prec, evaluation):             # <<<<<<<<<<<<<<
 *         "N[expr_, prec_]"
 * 
 */
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_1N_1apply_with_prec, 0, __pyx_n_s_N_apply_with_prec, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__53)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_apply_with_prec, __pyx_t_4) < 0) __PYX_ERR(0, 180, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/builtin/numeric.py":62
 * 
 * 
 * class N(Builtin):             # <<<<<<<<<<<<<<
 *     """
 *     <dl>
 */
  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_N, __pyx_t_2, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 62, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_N, __pyx_t_4) < 0) __PYX_ERR(0, 62, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":236
 * 
 * 
 * def _scipy_interface(integrator, options_map, mandatory=None, adapt_func=None):             # <<<<<<<<<<<<<<
 *     """
 *     This function provides a proxy for scipy.integrate
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_3_scipy_interface, 0, __pyx_n_s_scipy_interface, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__55)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__56);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_scipy_interface, __pyx_t_2) < 0) __PYX_ERR(0, 236, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":269
 * 
 * 
 * def _internal_adaptative_simpsons_rule(f, a, b, **opts):             # <<<<<<<<<<<<<<
 *     """
 *     1D adaptative Simpson's rule integrator
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_5_internal_adaptative_simpsons_rule, 0, __pyx_n_s_internal_adaptative_simpsons_ru_4, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__58)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_internal_adaptative_simpsons_ru_4, __pyx_t_2) < 0) __PYX_ERR(0, 269, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":355
 * 
 * 
 * def _fubini(func, ranges, **opts):             # <<<<<<<<<<<<<<
 *     if not ranges:
 *         return 0.0
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_7_fubini, 0, __pyx_n_s_fubini, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__60)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 355, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_fubini, __pyx_t_2) < 0) __PYX_ERR(0, 355, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":382
 * 
 * 
 * class NIntegrate(Builtin):             # <<<<<<<<<<<<<<
 *     """
 *     <dl>
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Builtin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_NIntegrate, __pyx_n_s_NIntegrate, (PyObject *) NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_kp_s_dl_dt_NIntegrate_expr_interval); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "mathics/builtin/numeric.py":419
 * 
 *     messages = {
 *         "bdmtd": "The Method option should be a built-in method name.",             # <<<<<<<<<<<<<<
 *         "inumr": (
 *             "The integrand `1` has evaluated to non-numerical "
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_bdmtd, __pyx_kp_u_The_Method_option_should_be_a_bu_2) < 0) __PYX_ERR(0, 419, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_inumr, __pyx_kp_u_The_integrand_1_has_evaluated_to) < 0) __PYX_ERR(0, 419, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_nlim, __pyx_kp_u_1_2_is_not_a_valid_limit_of_int) < 0) __PYX_ERR(0, 419, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_ilim, __pyx_kp_u_Invalid_integration_variable_or) < 0) __PYX_ERR(0, 419, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_mtdfail, __pyx_kp_u_The_specified_method_failed_to_r) < 0) __PYX_ERR(0, 419, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_cmpint, __pyx_kp_u_Integration_over_a_complex_domai) < 0) __PYX_ERR(0, 419, __pyx_L1_error)
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_messages, __pyx_t_5) < 0) __PYX_ERR(0, 418, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/builtin/numeric.py":436
 * 
 *     options = {
 *         "Method": '"Automatic"',             # <<<<<<<<<<<<<<
 *         "Tolerance": "1*^-10",
 *         "Accuracy": "1*^-10",
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 436, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_Method, __pyx_kp_u_Automatic_2) < 0) __PYX_ERR(0, 436, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_Tolerance, __pyx_kp_u_1_10) < 0) __PYX_ERR(0, 436, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_Accuracy, __pyx_kp_u_1_10) < 0) __PYX_ERR(0, 436, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_MaxRecursion, __pyx_kp_u_10) < 0) __PYX_ERR(0, 436, __pyx_L1_error)
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_options, __pyx_t_5) < 0) __PYX_ERR(0, 435, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/builtin/numeric.py":443
 * 
 *     methods = {
 *         "Automatic": (None, False),             # <<<<<<<<<<<<<<
 *     }
 * 
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 443, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_Automatic, __pyx_tuple__61) < 0) __PYX_ERR(0, 443, __pyx_L1_error)
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_methods, __pyx_t_5) < 0) __PYX_ERR(0, 442, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/builtin/numeric.py":446
 *     }
 * 
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         super().__init__(*args, **kwargs)
 *         self.methods["Internal"] = (_internal_adaptative_simpsons_rule, False)
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_10NIntegrate_1__init__, 0, __pyx_n_s_NIntegrate___init, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__63)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 446, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_t_5);
  PyList_Append(__pyx_t_4, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_init, __pyx_t_5) < 0) __PYX_ERR(0, 446, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/builtin/numeric.py":492
 * 
 *     @staticmethod
 *     def decompose_domain(interval, evaluation):             # <<<<<<<<<<<<<<
 *         if interval.has_form("System`Sequence", 1, None):
 *             intervals = []
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_10NIntegrate_3decompose_domain, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_NIntegrate_decompose_domain, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__65)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 492, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "mathics/builtin/numeric.py":491
 *         )
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def decompose_domain(interval, evaluation):
 *         if interval.has_form("System`Sequence", 1, None):
 */
  __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_decompose_domain, __pyx_t_6) < 0) __PYX_ERR(0, 492, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/builtin/numeric.py":523
 *         return None
 * 
 *     def apply_with_func_domain(self, func, domain, evaluation, options):             # <<<<<<<<<<<<<<
 *         "%(name)s[func_, domain__, OptionsPattern[%(name)s]]"
 *         method = options["System`Method"].evaluate(evaluation)
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_10NIntegrate_5apply_with_func_domain, 0, __pyx_n_s_NIntegrate_apply_with_func_domai_2, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__67)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_apply_with_func_domain, __pyx_t_6) < 0) __PYX_ERR(0, 523, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/builtin/numeric.py":382
 * 
 * 
 * class NIntegrate(Builtin):             # <<<<<<<<<<<<<<
 *     """
 *     <dl>
 */
  __pyx_t_6 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_NIntegrate, __pyx_t_1, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (__Pyx_CyFunction_InitClassCell(__pyx_t_4, __pyx_t_6) < 0) __PYX_ERR(0, 382, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_NIntegrate, __pyx_t_6) < 0) __PYX_ERR(0, 382, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":688
 * 
 * 
 * class MachinePrecision(Predefined):             # <<<<<<<<<<<<<<
 *     """
 *     <dl>
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Predefined); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 688, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 688, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 688, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_MachinePrecision, __pyx_n_s_MachinePrecision, (PyObject *) NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_kp_s_dl_dt_MachinePrecision_dd_repre); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 688, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "mathics/builtin/numeric.py":708
 * 
 *     rules = {
 *         "N[MachinePrecision, prec_]": ("N[Log[10, 2] * %i, prec]" % machine_precision),             # <<<<<<<<<<<<<<
 *     }
 * 
 */
  __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 708, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_machine_precision); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 708, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_N_Log_10_2_i_prec, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 708, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_6, __pyx_kp_u_N_MachinePrecision_prec, __pyx_t_5) < 0) __PYX_ERR(0, 708, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_rules, __pyx_t_6) < 0) __PYX_ERR(0, 707, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/builtin/numeric.py":688
 * 
 * 
 * class MachinePrecision(Predefined):             # <<<<<<<<<<<<<<
 *     """
 *     <dl>
 */
  __pyx_t_6 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_MachinePrecision, __pyx_t_2, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 688, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_MachinePrecision, __pyx_t_6) < 0) __PYX_ERR(0, 688, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":712
 * 
 * 
 * class MachineEpsilon_(Predefined):             # <<<<<<<<<<<<<<
 *     """
 *     <dl>
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Predefined); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 712, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 712, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 712, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_MachineEpsilon, __pyx_n_s_MachineEpsilon, (PyObject *) NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_kp_s_dl_dt_MachineEpsilon_dd_is_the); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 712, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "mathics/builtin/numeric.py":728
 *     """
 * 
 *     name = "$MachineEpsilon"             # <<<<<<<<<<<<<<
 * 
 *     def evaluate(self, evaluation):
 */
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_name, __pyx_kp_u_MachineEpsilon_2) < 0) __PYX_ERR(0, 728, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":730
 *     name = "$MachineEpsilon"
 * 
 *     def evaluate(self, evaluation):             # <<<<<<<<<<<<<<
 *         return MachineReal(machine_epsilon)
 * 
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_15MachineEpsilon__1evaluate, 0, __pyx_n_s_MachineEpsilon__evaluate, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__69)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 730, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_evaluate, __pyx_t_6) < 0) __PYX_ERR(0, 730, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/builtin/numeric.py":712
 * 
 * 
 * class MachineEpsilon_(Predefined):             # <<<<<<<<<<<<<<
 *     """
 *     <dl>
 */
  __pyx_t_6 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_MachineEpsilon, __pyx_t_1, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 712, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_MachineEpsilon, __pyx_t_6) < 0) __PYX_ERR(0, 712, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":734
 * 
 * 
 * class MachinePrecision_(Predefined):             # <<<<<<<<<<<<<<
 *     """
 *     <dl>
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Predefined); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 734, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 734, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 734, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_MachinePrecision_2, __pyx_n_s_MachinePrecision_2, (PyObject *) NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_kp_s_dl_dt_MachinePrecision_dd_is_th); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 734, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "mathics/builtin/numeric.py":746
 *     """
 * 
 *     name = "$MachinePrecision"             # <<<<<<<<<<<<<<
 * 
 *     rules = {
 */
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_name, __pyx_kp_u_MachinePrecision_3) < 0) __PYX_ERR(0, 746, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":749
 * 
 *     rules = {
 *         "$MachinePrecision": "N[MachinePrecision]",             # <<<<<<<<<<<<<<
 *     }
 * 
 */
  __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 749, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_6, __pyx_kp_u_MachinePrecision_3, __pyx_kp_u_N_MachinePrecision) < 0) __PYX_ERR(0, 749, __pyx_L1_error)
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_rules, __pyx_t_6) < 0) __PYX_ERR(0, 748, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/builtin/numeric.py":734
 * 
 * 
 * class MachinePrecision_(Predefined):             # <<<<<<<<<<<<<<
 *     """
 *     <dl>
 */
  __pyx_t_6 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_MachinePrecision_2, __pyx_t_2, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 734, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_MachinePrecision_2, __pyx_t_6) < 0) __PYX_ERR(0, 734, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":753
 * 
 * 
 * class Precision(Builtin):             # <<<<<<<<<<<<<<
 *     """
 *     <dl>
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Builtin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_Precision, __pyx_n_s_Precision, (PyObject *) NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_kp_s_dl_dt_Precision_expr_dd_examine); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "mathics/builtin/numeric.py":792
 * 
 *     rules = {
 *         "Precision[z_?MachineNumberQ]": "MachinePrecision",             # <<<<<<<<<<<<<<
 *     }
 * 
 */
  __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 792, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_6, __pyx_kp_u_Precision_z__MachineNumberQ, __pyx_n_u_MachinePrecision) < 0) __PYX_ERR(0, 792, __pyx_L1_error)
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_rules, __pyx_t_6) < 0) __PYX_ERR(0, 791, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/builtin/numeric.py":795
 *     }
 * 
 *     def apply(self, z, evaluation):             # <<<<<<<<<<<<<<
 *         "Precision[z_]"
 * 
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_9Precision_1apply, 0, __pyx_n_s_Precision_apply, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__71)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 795, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_apply, __pyx_t_6) < 0) __PYX_ERR(0, 795, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/builtin/numeric.py":753
 * 
 * 
 * class Precision(Builtin):             # <<<<<<<<<<<<<<
 *     """
 *     <dl>
 */
  __pyx_t_6 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_Precision, __pyx_t_1, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Precision, __pyx_t_6) < 0) __PYX_ERR(0, 753, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":806
 * 
 * 
 * class MinPrecision(Builtin):             # <<<<<<<<<<<<<<
 *     """
 *     <dl>
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Builtin); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 806, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 806, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 806, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_MinPrecision, __pyx_n_s_MinPrecision, (PyObject *) NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_kp_s_dl_dt_MinPrecision_dd_represent); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 806, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "mathics/builtin/numeric.py":846
 *     """
 * 
 *     name = "$MinPrecision"             # <<<<<<<<<<<<<<
 *     rules = {
 *         "$MinPrecision": "0",
 */
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_name, __pyx_kp_u_MinPrecision_2) < 0) __PYX_ERR(0, 846, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":848
 *     name = "$MinPrecision"
 *     rules = {
 *         "$MinPrecision": "0",             # <<<<<<<<<<<<<<
 *     }
 * 
 */
  __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 848, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_6, __pyx_kp_u_MinPrecision_2, __pyx_kp_u_0) < 0) __PYX_ERR(0, 848, __pyx_L1_error)
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_rules, __pyx_t_6) < 0) __PYX_ERR(0, 847, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/builtin/numeric.py":852
 * 
 *     messages = {
 *         "precset": "Cannot set `1` to `2`; value must be a non-negative number.",             # <<<<<<<<<<<<<<
 *         "preccon": "Cannot set `1` such that $MaxPrecision < $MinPrecision.",
 *     }
 */
  __pyx_t_6 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 852, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_u_precset, __pyx_kp_u_Cannot_set_1_to_2_value_must_be) < 0) __PYX_ERR(0, 852, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_u_preccon, __pyx_kp_u_Cannot_set_1_such_that_MaxPrecis) < 0) __PYX_ERR(0, 852, __pyx_L1_error)
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_messages, __pyx_t_6) < 0) __PYX_ERR(0, 851, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/builtin/numeric.py":806
 * 
 * 
 * class MinPrecision(Builtin):             # <<<<<<<<<<<<<<
 *     """
 *     <dl>
 */
  __pyx_t_6 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_MinPrecision, __pyx_t_2, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 806, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_MinPrecision, __pyx_t_6) < 0) __PYX_ERR(0, 806, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":857
 * 
 * 
 * class MaxPrecision(Predefined):             # <<<<<<<<<<<<<<
 *     """
 *     <dl>
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Predefined); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 857, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 857, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 857, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_MaxPrecision, __pyx_n_s_MaxPrecision, (PyObject *) NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_kp_s_dl_dt_MaxPrecision_dd_represent); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 857, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "mathics/builtin/numeric.py":897
 *     """
 * 
 *     name = "$MaxPrecision"             # <<<<<<<<<<<<<<
 * 
 *     rules = {
 */
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_name, __pyx_kp_u_MaxPrecision_2) < 0) __PYX_ERR(0, 897, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":900
 * 
 *     rules = {
 *         "$MaxPrecision": "Infinity",             # <<<<<<<<<<<<<<
 *     }
 * 
 */
  __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 900, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_6, __pyx_kp_u_MaxPrecision_2, __pyx_n_u_Infinity) < 0) __PYX_ERR(0, 900, __pyx_L1_error)
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_rules, __pyx_t_6) < 0) __PYX_ERR(0, 899, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/builtin/numeric.py":904
 * 
 *     messages = {
 *         "precset": "Cannot set `1` to `2`; value must be a positive number or Infinity.",             # <<<<<<<<<<<<<<
 *         "preccon": "Cannot set `1` such that $MaxPrecision < $MinPrecision.",
 *     }
 */
  __pyx_t_6 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 904, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_u_precset, __pyx_kp_u_Cannot_set_1_to_2_value_must_be_2) < 0) __PYX_ERR(0, 904, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_u_preccon, __pyx_kp_u_Cannot_set_1_such_that_MaxPrecis) < 0) __PYX_ERR(0, 904, __pyx_L1_error)
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_messages, __pyx_t_6) < 0) __PYX_ERR(0, 903, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/builtin/numeric.py":857
 * 
 * 
 * class MaxPrecision(Predefined):             # <<<<<<<<<<<<<<
 *     """
 *     <dl>
 */
  __pyx_t_6 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_MaxPrecision, __pyx_t_1, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 857, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_MaxPrecision, __pyx_t_6) < 0) __PYX_ERR(0, 857, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":909
 * 
 * 
 * class Round(Builtin):             # <<<<<<<<<<<<<<
 *     """
 *     <dl>
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Builtin); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_Round, __pyx_n_s_Round, (PyObject *) NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_kp_s_dl_dt_Round_expr_dd_rounds_expr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "mathics/builtin/numeric.py":954
 *     """
 * 
 *     attributes = ("Listable", "NumericFunction")             # <<<<<<<<<<<<<<
 * 
 *     rules = {
 */
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_attributes, __pyx_tuple__72) < 0) __PYX_ERR(0, 954, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":957
 * 
 *     rules = {
 *         "Round[expr_?NumericQ]": "Round[Re[expr], 1] + I * Round[Im[expr], 1]",             # <<<<<<<<<<<<<<
 *         "Round[expr_Complex, k_?RealNumberQ]": (
 *             "Round[Re[expr], k] + I * Round[Im[expr], k]"
 */
  __pyx_t_6 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 957, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_6, __pyx_kp_u_Round_expr__NumericQ, __pyx_kp_u_Round_Re_expr_1_I_Round_Im_expr) < 0) __PYX_ERR(0, 957, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_6, __pyx_kp_u_Round_expr_Complex_k__RealNumber, __pyx_kp_u_Round_Re_expr_k_I_Round_Im_expr) < 0) __PYX_ERR(0, 957, __pyx_L1_error)
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_rules, __pyx_t_6) < 0) __PYX_ERR(0, 956, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/builtin/numeric.py":963
 *     }
 * 
 *     def apply(self, expr, k, evaluation):             # <<<<<<<<<<<<<<
 *         "Round[expr_?NumericQ, k_?NumericQ]"
 * 
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_5Round_1apply, 0, __pyx_n_s_Round_apply, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__74)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 963, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_apply, __pyx_t_6) < 0) __PYX_ERR(0, 963, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/builtin/numeric.py":909
 * 
 * 
 * class Round(Builtin):             # <<<<<<<<<<<<<<
 *     """
 *     <dl>
 */
  __pyx_t_6 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_Round, __pyx_t_2, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Round, __pyx_t_6) < 0) __PYX_ERR(0, 909, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":979
 * 
 * 
 * class Rationalize(Builtin):             # <<<<<<<<<<<<<<
 *     """
 *     <dl>
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Builtin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 979, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 979, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 979, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_Rationalize, __pyx_n_s_Rationalize, (PyObject *) NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_kp_s_dl_dt_Rationalize_x_dd_converts); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 979, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "mathics/builtin/numeric.py":1031
 * 
 *     messages = {
 *         "tolnn": "Tolerance specification `1` must be a non-negative number.",             # <<<<<<<<<<<<<<
 *     }
 * 
 */
  __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1031, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_u_tolnn, __pyx_kp_u_Tolerance_specification_1_must_b) < 0) __PYX_ERR(0, 1031, __pyx_L1_error)
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_messages, __pyx_t_6) < 0) __PYX_ERR(0, 1030, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/builtin/numeric.py":1035
 * 
 *     rules = {
 *         "Rationalize[z_Complex]": "Rationalize[Re[z]] + I Rationalize[Im[z]]",             # <<<<<<<<<<<<<<
 *         "Rationalize[z_Complex, dx_?Internal`RealValuedNumberQ]/;dx >= 0": "Rationalize[Re[z], dx] + I Rationalize[Im[z], dx]",
 *     }
 */
  __pyx_t_6 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1035, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_6, __pyx_kp_u_Rationalize_z_Complex, __pyx_kp_u_Rationalize_Re_z_I_Rationalize_I) < 0) __PYX_ERR(0, 1035, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_6, __pyx_kp_u_Rationalize_z_Complex_dx__Intern, __pyx_kp_u_Rationalize_Re_z_dx_I_Rationaliz) < 0) __PYX_ERR(0, 1035, __pyx_L1_error)
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_rules, __pyx_t_6) < 0) __PYX_ERR(0, 1034, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/builtin/numeric.py":1039
 *     }
 * 
 *     def apply(self, x, evaluation):             # <<<<<<<<<<<<<<
 *         "Rationalize[x_]"
 * 
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_11Rationalize_1apply, 0, __pyx_n_s_Rationalize_apply, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__76)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1039, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_apply, __pyx_t_6) < 0) __PYX_ERR(0, 1039, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/builtin/numeric.py":1048
 * 
 *     @staticmethod
 *     def find_approximant(x):             # <<<<<<<<<<<<<<
 *         c = 1e-4
 *         it = sympy.ntheory.continued_fraction_convergents(
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_11Rationalize_3find_approximant, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_Rationalize_find_approximant, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__78)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1048, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);

  /* "mathics/builtin/numeric.py":1047
 *         return from_sympy(self.find_approximant(py_x))
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def find_approximant(x):
 *         c = 1e-4
 */
  __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_find_approximant, __pyx_t_5) < 0) __PYX_ERR(0, 1048, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/builtin/numeric.py":1063
 * 
 *     @staticmethod
 *     def find_exact(x):             # <<<<<<<<<<<<<<
 *         p, q = x.as_numer_denom()
 *         it = sympy.ntheory.continued_fraction_convergents(
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_11Rationalize_5find_exact, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_Rationalize_find_exact, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__80)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1063, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "mathics/builtin/numeric.py":1062
 *         return x
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def find_exact(x):
 *         p, q = x.as_numer_denom()
 */
  __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1062, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_find_exact, __pyx_t_6) < 0) __PYX_ERR(0, 1063, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/builtin/numeric.py":1073
 *                 return i
 * 
 *     def apply_dx(self, x, dx, evaluation):             # <<<<<<<<<<<<<<
 *         "Rationalize[x_, dx_]"
 *         py_x = x.to_sympy()
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_11Rationalize_7apply_dx, 0, __pyx_n_s_Rationalize_apply_dx, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__82)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1073, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_apply_dx, __pyx_t_6) < 0) __PYX_ERR(0, 1073, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/builtin/numeric.py":1093
 * 
 *     @staticmethod
 *     def approx_interval_continued_fraction(xmin, xmax):             # <<<<<<<<<<<<<<
 *         result = []
 *         a_gen = sympy.ntheory.continued_fraction_iterator(xmin)
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_11Rationalize_9approx_interval_continued_fraction, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_Rationalize_approx_interval_cont, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__84)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1093, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);

  /* "mathics/builtin/numeric.py":1092
 *         return Rational(sym_x)
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def approx_interval_continued_fraction(xmin, xmax):
 *         result = []
 */
  __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1092, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_approx_interval_continued_fracti, __pyx_t_5) < 0) __PYX_ERR(0, 1093, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/builtin/numeric.py":979
 * 
 * 
 * class Rationalize(Builtin):             # <<<<<<<<<<<<<<
 *     """
 *     <dl>
 */
  __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_Rationalize, __pyx_t_1, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 979, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Rationalize, __pyx_t_5) < 0) __PYX_ERR(0, 979, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":1107
 * 
 * 
 * def chop(expr, delta=10.0 ** (-10.0)):             # <<<<<<<<<<<<<<
 *     if isinstance(expr, Real):
 *         if -delta < expr.get_float_value() < delta:
 */
  __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_9chop, 0, __pyx_n_s_chop, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__86)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!__Pyx_CyFunction_InitDefaults(__pyx_t_1, sizeof(__pyx_defaults), 1)) __PYX_ERR(0, 1107, __pyx_L1_error)
  __pyx_t_2 = PyFloat_FromDouble(pow(10.0, -10.0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_Defaults(__pyx_defaults, __pyx_t_1)->__pyx_arg_delta = __pyx_t_2;
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_1, __pyx_pf_7mathics_7builtin_7numeric_16__defaults__);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_chop, __pyx_t_1) < 0) __PYX_ERR(0, 1107, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":1123
 * 
 * 
 * class Chop(Builtin):             # <<<<<<<<<<<<<<
 *     """
 *     <dl>
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Builtin); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_Chop, __pyx_n_s_Chop, (PyObject *) NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_kp_s_dl_dt_Chop_expr_dd_replaces_flo); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "mathics/builtin/numeric.py":1143
 * 
 *     messages = {
 *         "tolnn": "Tolerance specification a must be a non-negative number.",             # <<<<<<<<<<<<<<
 *     }
 * 
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_tolnn, __pyx_kp_u_Tolerance_specification_a_must_b) < 0) __PYX_ERR(0, 1143, __pyx_L1_error)
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_messages, __pyx_t_5) < 0) __PYX_ERR(0, 1142, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/builtin/numeric.py":1147
 * 
 *     rules = {
 *         "Chop[expr_]": "Chop[expr, 10^-10]",             # <<<<<<<<<<<<<<
 *     }
 * 
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1147, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_kp_u_Chop_expr, __pyx_kp_u_Chop_expr_10_10) < 0) __PYX_ERR(0, 1147, __pyx_L1_error)
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_rules, __pyx_t_5) < 0) __PYX_ERR(0, 1146, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/builtin/numeric.py":1150
 *     }
 * 
 *     def apply(self, expr, delta, evaluation):             # <<<<<<<<<<<<<<
 *         "Chop[expr_, delta_:(10^-10)]"
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_4Chop_1apply, 0, __pyx_n_s_Chop_apply, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__88)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_apply, __pyx_t_5) < 0) __PYX_ERR(0, 1150, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/builtin/numeric.py":1123
 * 
 * 
 * class Chop(Builtin):             # <<<<<<<<<<<<<<
 *     """
 *     <dl>
 */
  __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_Chop, __pyx_t_2, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Chop, __pyx_t_5) < 0) __PYX_ERR(0, 1123, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":1160
 * 
 * 
 * class NumericQ(Builtin):             # <<<<<<<<<<<<<<
 *     """
 *     <dl>
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Builtin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_NumericQ, __pyx_n_s_NumericQ, (PyObject *) NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_kp_s_dl_dt_NumericQ_expr_dd_tests_wh); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "mathics/builtin/numeric.py":1175
 *     """
 * 
 *     def apply(self, expr, evaluation):             # <<<<<<<<<<<<<<
 *         "NumericQ[expr_]"
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_8NumericQ_1apply, 0, __pyx_n_s_NumericQ_apply, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__90)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1175, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_apply, __pyx_t_5) < 0) __PYX_ERR(0, 1175, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/builtin/numeric.py":1160
 * 
 * 
 * class NumericQ(Builtin):             # <<<<<<<<<<<<<<
 *     """
 *     <dl>
 */
  __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_NumericQ, __pyx_t_1, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_NumericQ, __pyx_t_5) < 0) __PYX_ERR(0, 1160, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":1190
 * 
 * 
 * class RealValuedNumericQ(Builtin):             # <<<<<<<<<<<<<<
 *     # No docstring since this is internal and it will mess up documentation.
 *     # FIXME: Perhaps in future we will have a more explicite way to indicate not
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Builtin); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_RealValuedNumericQ, __pyx_n_s_RealValuedNumericQ, (PyObject *) NULL, __pyx_n_s_mathics_builtin_numeric, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "mathics/builtin/numeric.py":1194
 *     # FIXME: Perhaps in future we will have a more explicite way to indicate not
 *     # to add something to the docs.
 *     context = "Internal`"             # <<<<<<<<<<<<<<
 * 
 *     rules = {
 */
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_context, __pyx_kp_u_Internal_2) < 0) __PYX_ERR(0, 1194, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1197
 * 
 *     rules = {
 *         "Internal`RealValuedNumericQ[x_]": "Head[N[x]] === Real",             # <<<<<<<<<<<<<<
 *     }
 * 
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1197, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_kp_u_Internal_RealValuedNumericQ_x, __pyx_kp_u_Head_N_x_Real) < 0) __PYX_ERR(0, 1197, __pyx_L1_error)
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_rules, __pyx_t_5) < 0) __PYX_ERR(0, 1196, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/builtin/numeric.py":1190
 * 
 * 
 * class RealValuedNumericQ(Builtin):             # <<<<<<<<<<<<<<
 *     # No docstring since this is internal and it will mess up documentation.
 *     # FIXME: Perhaps in future we will have a more explicite way to indicate not
 */
  __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_RealValuedNumericQ, __pyx_t_2, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RealValuedNumericQ, __pyx_t_5) < 0) __PYX_ERR(0, 1190, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":1201
 * 
 * 
 * class RealValuedNumberQ(Builtin):             # <<<<<<<<<<<<<<
 *     # No docstring since this is internal and it will mess up documentation.
 *     # FIXME: Perhaps in future we will have a more explicite way to indicate not
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Builtin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_RealValuedNumberQ, __pyx_n_s_RealValuedNumberQ, (PyObject *) NULL, __pyx_n_s_mathics_builtin_numeric, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "mathics/builtin/numeric.py":1205
 *     # FIXME: Perhaps in future we will have a more explicite way to indicate not
 *     # to add something to the docs.
 *     context = "Internal`"             # <<<<<<<<<<<<<<
 * 
 *     rules = {
 */
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_context, __pyx_kp_u_Internal_2) < 0) __PYX_ERR(0, 1205, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1208
 * 
 *     rules = {
 *         "Internal`RealValuedNumberQ[x_Real]": "True",             # <<<<<<<<<<<<<<
 *         "Internal`RealValuedNumberQ[x_Integer]": "True",
 *         "Internal`RealValuedNumberQ[x_Rational]": "True",
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_kp_u_Internal_RealValuedNumberQ_x_Rea, __pyx_n_u_True) < 0) __PYX_ERR(0, 1208, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_kp_u_Internal_RealValuedNumberQ_x_Int, __pyx_n_u_True) < 0) __PYX_ERR(0, 1208, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_kp_u_Internal_RealValuedNumberQ_x_Rat, __pyx_n_u_True) < 0) __PYX_ERR(0, 1208, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_kp_u_Internal_RealValuedNumberQ_x, __pyx_n_u_False) < 0) __PYX_ERR(0, 1208, __pyx_L1_error)
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_rules, __pyx_t_5) < 0) __PYX_ERR(0, 1207, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/builtin/numeric.py":1201
 * 
 * 
 * class RealValuedNumberQ(Builtin):             # <<<<<<<<<<<<<<
 *     # No docstring since this is internal and it will mess up documentation.
 *     # FIXME: Perhaps in future we will have a more explicite way to indicate not
 */
  __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_RealValuedNumberQ, __pyx_t_1, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RealValuedNumberQ, __pyx_t_5) < 0) __PYX_ERR(0, 1201, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":1215
 * 
 * 
 * class IntegerDigits(Builtin):             # <<<<<<<<<<<<<<
 *     """
 *     <dl>
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Builtin); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_IntegerDigits, __pyx_n_s_IntegerDigits, (PyObject *) NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_kp_s_dl_dt_IntegerDigits_n_dd_return); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "mathics/builtin/numeric.py":1248
 *     """
 * 
 *     attributes = ("Listable",)             # <<<<<<<<<<<<<<
 * 
 *     messages = {
 */
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_attributes, __pyx_tuple__91) < 0) __PYX_ERR(0, 1248, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1251
 * 
 *     messages = {
 *         "int": "Integer expected at position 1 in `1`",             # <<<<<<<<<<<<<<
 *         "ibase": "Base `1` is not an integer greater than 1.",
 *     }
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_int, __pyx_kp_u_Integer_expected_at_position_1_i) < 0) __PYX_ERR(0, 1251, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_ibase, __pyx_kp_u_Base_1_is_not_an_integer_greater) < 0) __PYX_ERR(0, 1251, __pyx_L1_error)
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_messages, __pyx_t_5) < 0) __PYX_ERR(0, 1250, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/builtin/numeric.py":1256
 * 
 *     rules = {
 *         "IntegerDigits[n_]": "IntegerDigits[n, 10]",             # <<<<<<<<<<<<<<
 *     }
 * 
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1256, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_kp_u_IntegerDigits_n, __pyx_kp_u_IntegerDigits_n_10) < 0) __PYX_ERR(0, 1256, __pyx_L1_error)
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_rules, __pyx_t_5) < 0) __PYX_ERR(0, 1255, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/builtin/numeric.py":1259
 *     }
 * 
 *     def apply_len(self, n, base, length, evaluation):             # <<<<<<<<<<<<<<
 *         "IntegerDigits[n_, base_, length_]"
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_13IntegerDigits_1apply_len, 0, __pyx_n_s_IntegerDigits_apply_len, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__93)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1259, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_apply_len, __pyx_t_5) < 0) __PYX_ERR(0, 1259, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/builtin/numeric.py":1267
 *         return self.apply(n, base, evaluation, nr_elements=length.get_int_value())
 * 
 *     def apply(self, n, base, evaluation, nr_elements=None):             # <<<<<<<<<<<<<<
 *         "IntegerDigits[n_, base_]"
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_13IntegerDigits_3apply, 0, __pyx_n_s_IntegerDigits_apply, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__95)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__96);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_apply, __pyx_t_5) < 0) __PYX_ERR(0, 1267, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/builtin/numeric.py":1215
 * 
 * 
 * class IntegerDigits(Builtin):             # <<<<<<<<<<<<<<
 *     """
 *     <dl>
 */
  __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_IntegerDigits, __pyx_t_2, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_IntegerDigits, __pyx_t_5) < 0) __PYX_ERR(0, 1215, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":1295
 * 
 * 
 * def check_finite_decimal(denominator):             # <<<<<<<<<<<<<<
 *     # The rational number is finite decimal if the denominator has form 2^a * 5^b
 *     while denominator % 5 == 0:
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_11check_finite_decimal, 0, __pyx_n_s_check_finite_decimal, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__98)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_check_finite_decimal, __pyx_t_2) < 0) __PYX_ERR(0, 1295, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":1306
 * 
 * 
 * def convert_repeating_decimal(numerator, denominator, base):             # <<<<<<<<<<<<<<
 *     head = [x for x in str(numerator // denominator)]
 *     tails = []
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_13convert_repeating_decimal, 0, __pyx_n_s_convert_repeating_decimal, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__100)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_convert_repeating_decimal, __pyx_t_2) < 0) __PYX_ERR(0, 1306, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":1341
 * 
 * 
 * def convert_float_base(x, base, precision=10):             # <<<<<<<<<<<<<<
 * 
 *     length_of_int = 0 if x == 0 else int(mpmath.log(x, base))
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_15convert_float_base, 0, __pyx_n_s_convert_float_base, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__102)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1341, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__103);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_convert_float_base, __pyx_t_2) < 0) __PYX_ERR(0, 1341, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":1378
 * 
 * 
 * class RealDigits(Builtin):             # <<<<<<<<<<<<<<
 *     """
 *     <dl>
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Builtin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1378, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1378, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1378, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_RealDigits, __pyx_n_s_RealDigits, (PyObject *) NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_kp_s_dl_dt_RealDigits_n_dd_returns_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1378, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "mathics/builtin/numeric.py":1449
 *     """
 * 
 *     attributes = ("Listable",)             # <<<<<<<<<<<<<<
 * 
 *     messages = {
 */
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_attributes, __pyx_tuple__91) < 0) __PYX_ERR(0, 1449, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1452
 * 
 *     messages = {
 *         "realx": "The value `1` is not a real number.",             # <<<<<<<<<<<<<<
 *         "ndig": "The number of digits to return cannot be determined.",
 *         "rbase": "Base `1` is not a real number greater than 1.",
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1452, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_realx, __pyx_kp_u_The_value_1_is_not_a_real_number) < 0) __PYX_ERR(0, 1452, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_ndig, __pyx_kp_u_The_number_of_digits_to_return_c) < 0) __PYX_ERR(0, 1452, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_rbase, __pyx_kp_u_Base_1_is_not_a_real_number_grea) < 0) __PYX_ERR(0, 1452, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_intnm, __pyx_kp_u_Non_negative_machine_sized_integ) < 0) __PYX_ERR(0, 1452, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_intm, __pyx_kp_u_Machine_sized_integer_expected_a) < 0) __PYX_ERR(0, 1452, __pyx_L1_error)
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_messages, __pyx_t_5) < 0) __PYX_ERR(0, 1451, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/builtin/numeric.py":1459
 *     }
 * 
 *     def apply_complex(self, n, var, evaluation):             # <<<<<<<<<<<<<<
 *         "%(name)s[n_Complex, var___]"
 *         return evaluation.message("RealDigits", "realx", n)
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_10RealDigits_1apply_complex, 0, __pyx_n_s_RealDigits_apply_complex, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__105)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1459, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_apply_complex, __pyx_t_5) < 0) __PYX_ERR(0, 1459, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/builtin/numeric.py":1463
 *         return evaluation.message("RealDigits", "realx", n)
 * 
 *     def apply_rational_with_base(self, n, b, evaluation):             # <<<<<<<<<<<<<<
 *         "%(name)s[n_Rational, b_Integer]"
 *         # expr = Expression("RealDigits", n)
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_10RealDigits_3apply_rational_with_base, 0, __pyx_n_s_RealDigits_apply_rational_with_b, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__107)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1463, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_apply_rational_with_base, __pyx_t_5) < 0) __PYX_ERR(0, 1463, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/builtin/numeric.py":1484
 *         return Expression(SymbolList, list_str, exp)
 * 
 *     def apply_rational_without_base(self, n, evaluation):             # <<<<<<<<<<<<<<
 *         "%(name)s[n_Rational]"
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_10RealDigits_5apply_rational_without_base, 0, __pyx_n_s_RealDigits_apply_rational_withou, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__109)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1484, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_apply_rational_without_base, __pyx_t_5) < 0) __PYX_ERR(0, 1484, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/builtin/numeric.py":1489
 *         return self.apply_rational_with_base(n, from_python(10), evaluation)
 * 
 *     def apply(self, n, evaluation):             # <<<<<<<<<<<<<<
 *         "%(name)s[n_]"
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_10RealDigits_7apply, 0, __pyx_n_s_RealDigits_apply, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__111)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1489, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_apply, __pyx_t_5) < 0) __PYX_ERR(0, 1489, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/builtin/numeric.py":1499
 *             return self.apply_with_base(n, from_python(10), evaluation)
 * 
 *     def apply_with_base(self, n, b, evaluation, nr_elements=None, pos=None):             # <<<<<<<<<<<<<<
 *         "%(name)s[n_?NumericQ, b_Integer]"
 * 
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_10RealDigits_9apply_with_base, 0, __pyx_n_s_RealDigits_apply_with_base, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__113)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1499, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__114);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_apply_with_base, __pyx_t_5) < 0) __PYX_ERR(0, 1499, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/builtin/numeric.py":1609
 *         return Expression(SymbolList, list_str, exp)
 * 
 *     def apply_with_base_and_length(self, n, b, length, evaluation, pos=None):             # <<<<<<<<<<<<<<
 *         "%(name)s[n_?NumericQ, b_Integer, length_]"
 *         leaves = []
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_10RealDigits_11apply_with_base_and_length, 0, __pyx_n_s_RealDigits_apply_with_base_and_l, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__116)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1609, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_tuple__117);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_apply_with_base_and_length, __pyx_t_5) < 0) __PYX_ERR(0, 1609, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/builtin/numeric.py":1622
 *         )
 * 
 *     def apply_with_base_length_and_precision(self, n, b, length, p, evaluation):             # <<<<<<<<<<<<<<
 *         "%(name)s[n_?NumericQ, b_Integer, length_, p_]"
 *         if not isinstance(p, Integer):
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_10RealDigits_13apply_with_base_length_and_precision, 0, __pyx_n_s_RealDigits_apply_with_base_lengt, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__119)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1622, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_apply_with_base_length_and_preci, __pyx_t_5) < 0) __PYX_ERR(0, 1622, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/builtin/numeric.py":1378
 * 
 * 
 * class RealDigits(Builtin):             # <<<<<<<<<<<<<<
 *     """
 *     <dl>
 */
  __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_RealDigits, __pyx_t_1, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1378, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RealDigits, __pyx_t_5) < 0) __PYX_ERR(0, 1378, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":1634
 * 
 * 
 * class _ZLibHash:  # make zlib hashes behave as if they were from hashlib             # <<<<<<<<<<<<<<
 *     def __init__(self, fn):
 *         self._bytes = b""
 */
  __pyx_t_1 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_ZLibHash, __pyx_n_s_ZLibHash, (PyObject *) NULL, __pyx_n_s_mathics_builtin_numeric, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1634, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "mathics/builtin/numeric.py":1635
 * 
 * class _ZLibHash:  # make zlib hashes behave as if they were from hashlib
 *     def __init__(self, fn):             # <<<<<<<<<<<<<<
 *         self._bytes = b""
 *         self._fn = fn
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_9_ZLibHash_1__init__, 0, __pyx_n_s_ZLibHash___init, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__121)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1635, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_2) < 0) __PYX_ERR(0, 1635, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":1639
 *         self._fn = fn
 * 
 *     def update(self, bytes):             # <<<<<<<<<<<<<<
 *         self._bytes += bytes
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_9_ZLibHash_3update, 0, __pyx_n_s_ZLibHash_update, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__123)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1639, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_update, __pyx_t_2) < 0) __PYX_ERR(0, 1639, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":1642
 *         self._bytes += bytes
 * 
 *     def hexdigest(self):             # <<<<<<<<<<<<<<
 *         return format(self._fn(self._bytes), "x")
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_9_ZLibHash_5hexdigest, 0, __pyx_n_s_ZLibHash_hexdigest, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__125)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_hexdigest, __pyx_t_2) < 0) __PYX_ERR(0, 1642, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":1634
 * 
 * 
 * class _ZLibHash:  # make zlib hashes behave as if they were from hashlib             # <<<<<<<<<<<<<<
 *     def __init__(self, fn):
 *         self._bytes = b""
 */
  __pyx_t_2 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_ZLibHash, __pyx_empty_tuple, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1634, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ZLibHash, __pyx_t_2) < 0) __PYX_ERR(0, 1634, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "mathics/builtin/numeric.py":1646
 * 
 * 
 * class Hash(Builtin):             # <<<<<<<<<<<<<<
 *     """
 *     <dl>
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Builtin); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1646, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1646, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1646, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_Hash, __pyx_n_s_Hash, (PyObject *) NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_kp_s_dl_dt_Hash_expr_dd_returns_an_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1646, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "mathics/builtin/numeric.py":1678
 * 
 *     rules = {
 *         "Hash[expr_]": 'Hash[expr, "MD5", "Integer"]',             # <<<<<<<<<<<<<<
 *         "Hash[expr_, type_String]": 'Hash[expr, type, "Integer"]',
 *     }
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1678, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_kp_u_Hash_expr, __pyx_kp_u_Hash_expr_MD5_Integer) < 0) __PYX_ERR(0, 1678, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_kp_u_Hash_expr__type_String, __pyx_kp_u_Hash_expr_type_Integer) < 0) __PYX_ERR(0, 1678, __pyx_L1_error)
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_rules, __pyx_t_5) < 0) __PYX_ERR(0, 1677, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/builtin/numeric.py":1682
 *     }
 * 
 *     attributes = ("Protected", "ReadProtected")             # <<<<<<<<<<<<<<
 * 
 *     # FIXME md2
 */
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_attributes, __pyx_tuple__126) < 0) __PYX_ERR(0, 1682, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1686
 *     # FIXME md2
 *     _supported_hashes = {
 *         "Adler32": lambda: _ZLibHash(zlib.adler32),             # <<<<<<<<<<<<<<
 *         "CRC32": lambda: _ZLibHash(zlib.crc32),
 *         "MD5": hashlib.md5,
 */
  __pyx_t_5 = __Pyx_PyDict_NewPresized(8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1686, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_4Hash_4lambda12, 0, __pyx_n_s_Hash_lambda, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1686, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_Adler32, __pyx_t_6) < 0) __PYX_ERR(0, 1686, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/builtin/numeric.py":1687
 *     _supported_hashes = {
 *         "Adler32": lambda: _ZLibHash(zlib.adler32),
 *         "CRC32": lambda: _ZLibHash(zlib.crc32),             # <<<<<<<<<<<<<<
 *         "MD5": hashlib.md5,
 *         "SHA": hashlib.sha1,
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_4Hash_5lambda13, 0, __pyx_n_s_Hash_lambda, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1687, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_CRC32, __pyx_t_6) < 0) __PYX_ERR(0, 1686, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/builtin/numeric.py":1688
 *         "Adler32": lambda: _ZLibHash(zlib.adler32),
 *         "CRC32": lambda: _ZLibHash(zlib.crc32),
 *         "MD5": hashlib.md5,             # <<<<<<<<<<<<<<
 *         "SHA": hashlib.sha1,
 *         "SHA224": hashlib.sha224,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_hashlib); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1688, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_md5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1688, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_MD5, __pyx_t_4) < 0) __PYX_ERR(0, 1686, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/builtin/numeric.py":1689
 *         "CRC32": lambda: _ZLibHash(zlib.crc32),
 *         "MD5": hashlib.md5,
 *         "SHA": hashlib.sha1,             # <<<<<<<<<<<<<<
 *         "SHA224": hashlib.sha224,
 *         "SHA256": hashlib.sha256,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_hashlib); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1689, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_sha1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1689, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_SHA, __pyx_t_6) < 0) __PYX_ERR(0, 1686, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/builtin/numeric.py":1690
 *         "MD5": hashlib.md5,
 *         "SHA": hashlib.sha1,
 *         "SHA224": hashlib.sha224,             # <<<<<<<<<<<<<<
 *         "SHA256": hashlib.sha256,
 *         "SHA384": hashlib.sha384,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_hashlib); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1690, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_sha224); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1690, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_SHA224, __pyx_t_4) < 0) __PYX_ERR(0, 1686, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/builtin/numeric.py":1691
 *         "SHA": hashlib.sha1,
 *         "SHA224": hashlib.sha224,
 *         "SHA256": hashlib.sha256,             # <<<<<<<<<<<<<<
 *         "SHA384": hashlib.sha384,
 *         "SHA512": hashlib.sha512,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_hashlib); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1691, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_sha256); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1691, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_SHA256, __pyx_t_6) < 0) __PYX_ERR(0, 1686, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/builtin/numeric.py":1692
 *         "SHA224": hashlib.sha224,
 *         "SHA256": hashlib.sha256,
 *         "SHA384": hashlib.sha384,             # <<<<<<<<<<<<<<
 *         "SHA512": hashlib.sha512,
 *     }
 */
  __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_hashlib); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1692, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_sha384); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1692, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_SHA384, __pyx_t_4) < 0) __PYX_ERR(0, 1686, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "mathics/builtin/numeric.py":1693
 *         "SHA256": hashlib.sha256,
 *         "SHA384": hashlib.sha384,
 *         "SHA512": hashlib.sha512,             # <<<<<<<<<<<<<<
 *     }
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_hashlib); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1693, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_sha512); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1693, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_SHA512, __pyx_t_6) < 0) __PYX_ERR(0, 1686, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_supported_hashes, __pyx_t_5) < 0) __PYX_ERR(0, 1685, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/builtin/numeric.py":1697
 * 
 *     @staticmethod
 *     def compute(user_hash, py_hashtype, py_format):             # <<<<<<<<<<<<<<
 *         hash_func = Hash._supported_hashes.get(py_hashtype)
 *         if hash_func is None:  # unknown hash function?
 */
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_4Hash_1compute, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_Hash_compute, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__128)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1697, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "mathics/builtin/numeric.py":1696
 *     }
 * 
 *     @staticmethod             # <<<<<<<<<<<<<<
 *     def compute(user_hash, py_hashtype, py_format):
 *         hash_func = Hash._supported_hashes.get(py_hashtype)
 */
  __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1696, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_compute, __pyx_t_6) < 0) __PYX_ERR(0, 1697, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/builtin/numeric.py":1713
 *         return from_python(res)
 * 
 *     def apply(self, expr, hashtype, outformat, evaluation):             # <<<<<<<<<<<<<<
 *         "Hash[expr_, hashtype_String, outformat_String]"
 *         return Hash.compute(
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_4Hash_3apply, 0, __pyx_n_s_Hash_apply, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__130)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1713, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_apply, __pyx_t_6) < 0) __PYX_ERR(0, 1713, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/builtin/numeric.py":1646
 * 
 * 
 * class Hash(Builtin):             # <<<<<<<<<<<<<<
 *     """
 *     <dl>
 */
  __pyx_t_6 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_Hash, __pyx_t_2, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1646, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Hash, __pyx_t_6) < 0) __PYX_ERR(0, 1646, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":1720
 * 
 * 
 * class TypeEscalation(Exception):             # <<<<<<<<<<<<<<
 *     def __init__(self, mode):
 *         self.mode = mode
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1720, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
  __Pyx_GIVEREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1720, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_TypeEscalation, __pyx_n_s_TypeEscalation, (PyObject *) NULL, __pyx_n_s_mathics_builtin_numeric, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1720, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "mathics/builtin/numeric.py":1721
 * 
 * class TypeEscalation(Exception):
 *     def __init__(self, mode):             # <<<<<<<<<<<<<<
 *         self.mode = mode
 * 
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_14TypeEscalation_1__init__, 0, __pyx_n_s_TypeEscalation___init, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__132)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1721, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_init, __pyx_t_6) < 0) __PYX_ERR(0, 1721, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/builtin/numeric.py":1720
 * 
 * 
 * class TypeEscalation(Exception):             # <<<<<<<<<<<<<<
 *     def __init__(self, mode):
 *         self.mode = mode
 */
  __pyx_t_6 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_TypeEscalation, __pyx_t_2, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1720, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_TypeEscalation, __pyx_t_6) < 0) __PYX_ERR(0, 1720, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":1725
 * 
 * 
 * class Fold(object):             # <<<<<<<<<<<<<<
 *     # allows inherited classes to specify a single algorithm implementation that
 *     # can be called with machine precision, arbitrary precision or symbolically.
 */
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__133); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_tuple__133, __pyx_n_s_Fold, __pyx_n_s_Fold, (PyObject *) NULL, __pyx_n_s_mathics_builtin_numeric, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "mathics/builtin/numeric.py":1729
 *     # can be called with machine precision, arbitrary precision or symbolically.
 * 
 *     ComputationFunctions = namedtuple("ComputationFunctions", ("sin", "cos"))             # <<<<<<<<<<<<<<
 * 
 *     FLOAT = 0
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_namedtuple); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1729, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__135, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1729, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_ComputationFunctions, __pyx_t_6) < 0) __PYX_ERR(0, 1729, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/builtin/numeric.py":1731
 *     ComputationFunctions = namedtuple("ComputationFunctions", ("sin", "cos"))
 * 
 *     FLOAT = 0             # <<<<<<<<<<<<<<
 *     MPMATH = 1
 *     SYMBOLIC = 2
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_FLOAT, __pyx_int_0) < 0) __PYX_ERR(0, 1731, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1732
 * 
 *     FLOAT = 0
 *     MPMATH = 1             # <<<<<<<<<<<<<<
 *     SYMBOLIC = 2
 * 
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_MPMATH, __pyx_int_1) < 0) __PYX_ERR(0, 1732, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1733
 *     FLOAT = 0
 *     MPMATH = 1
 *     SYMBOLIC = 2             # <<<<<<<<<<<<<<
 * 
 *     math = {
 */
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_SYMBOLIC, __pyx_int_2) < 0) __PYX_ERR(0, 1733, __pyx_L1_error)

  /* "mathics/builtin/numeric.py":1736
 * 
 *     math = {
 *         FLOAT: ComputationFunctions(             # <<<<<<<<<<<<<<
 *             cos=math.cos,
 *             sin=math.sin,
 */
  __pyx_t_6 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1736, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = PyObject_GetItem(__pyx_t_1, __pyx_n_s_FLOAT);
  if (unlikely(!__pyx_t_3)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FLOAT);
  }
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1736, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyObject_GetItem(__pyx_t_1, __pyx_n_s_ComputationFunctions);
  if (unlikely(!__pyx_t_5)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_ComputationFunctions);
  }
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1736, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);

  /* "mathics/builtin/numeric.py":1737
 *     math = {
 *         FLOAT: ComputationFunctions(
 *             cos=math.cos,             # <<<<<<<<<<<<<<
 *             sin=math.sin,
 *         ),
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1737, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_math);
  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1737, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_cos); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1737, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_cos, __pyx_t_8) < 0) __PYX_ERR(0, 1737, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/builtin/numeric.py":1738
 *         FLOAT: ComputationFunctions(
 *             cos=math.cos,
 *             sin=math.sin,             # <<<<<<<<<<<<<<
 *         ),
 *         MPMATH: ComputationFunctions(
 */
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_math);
  if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1738, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_sin); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1738, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_sin, __pyx_t_7) < 0) __PYX_ERR(0, 1737, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "mathics/builtin/numeric.py":1736
 * 
 *     math = {
 *         FLOAT: ComputationFunctions(             # <<<<<<<<<<<<<<
 *             cos=math.cos,
 *             sin=math.sin,
 */
  __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1736, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_6, __pyx_t_3, __pyx_t_7) < 0) __PYX_ERR(0, 1736, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "mathics/builtin/numeric.py":1740
 *             sin=math.sin,
 *         ),
 *         MPMATH: ComputationFunctions(             # <<<<<<<<<<<<<<
 *             cos=mpmath.cos,
 *             sin=mpmath.sin,
 */
  __pyx_t_7 = PyObject_GetItem(__pyx_t_1, __pyx_n_s_MPMATH);
  if (unlikely(!__pyx_t_7)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_MPMATH);
  }
  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1740, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_3 = PyObject_GetItem(__pyx_t_1, __pyx_n_s_ComputationFunctions);
  if (unlikely(!__pyx_t_3)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ComputationFunctions);
  }
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1740, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "mathics/builtin/numeric.py":1741
 *         ),
 *         MPMATH: ComputationFunctions(
 *             cos=mpmath.cos,             # <<<<<<<<<<<<<<
 *             sin=mpmath.sin,
 *         ),
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1741, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_mpmath); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1741, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_cos); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1741, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_cos, __pyx_t_8) < 0) __PYX_ERR(0, 1741, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "mathics/builtin/numeric.py":1742
 *         MPMATH: ComputationFunctions(
 *             cos=mpmath.cos,
 *             sin=mpmath.sin,             # <<<<<<<<<<<<<<
 *         ),
 *         SYMBOLIC: ComputationFunctions(
 */
  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_mpmath); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1742, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_sin); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1742, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_sin, __pyx_t_5) < 0) __PYX_ERR(0, 1741, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/builtin/numeric.py":1740
 *             sin=math.sin,
 *         ),
 *         MPMATH: ComputationFunctions(             # <<<<<<<<<<<<<<
 *             cos=mpmath.cos,
 *             sin=mpmath.sin,
 */
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1740, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_6, __pyx_t_7, __pyx_t_5) < 0) __PYX_ERR(0, 1736, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/builtin/numeric.py":1744
 *             sin=mpmath.sin,
 *         ),
 *         SYMBOLIC: ComputationFunctions(             # <<<<<<<<<<<<<<
 *             cos=lambda x: Expression("Cos", x),
 *             sin=lambda x: Expression("Sin", x),
 */
  __pyx_t_5 = PyObject_GetItem(__pyx_t_1, __pyx_n_s_SYMBOLIC);
  if (unlikely(!__pyx_t_5)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_SYMBOLIC);
  }
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1744, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = PyObject_GetItem(__pyx_t_1, __pyx_n_s_ComputationFunctions);
  if (unlikely(!__pyx_t_7)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_ComputationFunctions);
  }
  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1744, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);

  /* "mathics/builtin/numeric.py":1745
 *         ),
 *         SYMBOLIC: ComputationFunctions(
 *             cos=lambda x: Expression("Cos", x),             # <<<<<<<<<<<<<<
 *             sin=lambda x: Expression("Sin", x),
 *         ),
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1745, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_4Fold_9lambda14, 0, __pyx_n_s_Fold_lambda, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1745, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_cos, __pyx_t_3) < 0) __PYX_ERR(0, 1745, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "mathics/builtin/numeric.py":1746
 *         SYMBOLIC: ComputationFunctions(
 *             cos=lambda x: Expression("Cos", x),
 *             sin=lambda x: Expression("Sin", x),             # <<<<<<<<<<<<<<
 *         ),
 *     }
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_4Fold_10lambda15, 0, __pyx_n_s_Fold_lambda, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1746, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_sin, __pyx_t_3) < 0) __PYX_ERR(0, 1745, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "mathics/builtin/numeric.py":1744
 *             sin=mpmath.sin,
 *         ),
 *         SYMBOLIC: ComputationFunctions(             # <<<<<<<<<<<<<<
 *             cos=lambda x: Expression("Cos", x),
 *             sin=lambda x: Expression("Sin", x),
 */
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1744, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_6, __pyx_t_5, __pyx_t_3) < 0) __PYX_ERR(0, 1736, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_math, __pyx_t_6) < 0) __PYX_ERR(0, 1735, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/builtin/numeric.py":1751
 * 
 *     operands = {
 *         FLOAT: lambda x: None if x is None else x.round_to_float(),             # <<<<<<<<<<<<<<
 *         MPMATH: lambda x: None if x is None else x.to_mpmath(),
 *         SYMBOLIC: lambda x: x,
 */
  __pyx_t_6 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1751, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = PyObject_GetItem(__pyx_t_1, __pyx_n_s_FLOAT);
  if (unlikely(!__pyx_t_3)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_FLOAT);
  }
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1751, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_4Fold_11lambda16, 0, __pyx_n_s_Fold_lambda, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1751, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_6, __pyx_t_3, __pyx_t_5) < 0) __PYX_ERR(0, 1751, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "mathics/builtin/numeric.py":1752
 *     operands = {
 *         FLOAT: lambda x: None if x is None else x.round_to_float(),
 *         MPMATH: lambda x: None if x is None else x.to_mpmath(),             # <<<<<<<<<<<<<<
 *         SYMBOLIC: lambda x: x,
 *     }
 */
  __pyx_t_5 = PyObject_GetItem(__pyx_t_1, __pyx_n_s_MPMATH);
  if (unlikely(!__pyx_t_5)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_MPMATH);
  }
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1752, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_4Fold_12lambda17, 0, __pyx_n_s_Fold_lambda, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1752, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_6, __pyx_t_5, __pyx_t_3) < 0) __PYX_ERR(0, 1751, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "mathics/builtin/numeric.py":1753
 *         FLOAT: lambda x: None if x is None else x.round_to_float(),
 *         MPMATH: lambda x: None if x is None else x.to_mpmath(),
 *         SYMBOLIC: lambda x: x,             # <<<<<<<<<<<<<<
 *     }
 * 
 */
  __pyx_t_3 = PyObject_GetItem(__pyx_t_1, __pyx_n_s_SYMBOLIC);
  if (unlikely(!__pyx_t_3)) {
    PyErr_Clear();
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_SYMBOLIC);
  }
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_4Fold_13lambda18, 0, __pyx_n_s_Fold_lambda, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_6, __pyx_t_3, __pyx_t_5) < 0) __PYX_ERR(0, 1751, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_operands, __pyx_t_6) < 0) __PYX_ERR(0, 1750, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/builtin/numeric.py":1756
 *     }
 * 
 *     def _operands(self, state, steps):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_4Fold_1_operands, 0, __pyx_n_s_Fold__operands, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__137)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1756, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_operands_2, __pyx_t_6) < 0) __PYX_ERR(0, 1756, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/builtin/numeric.py":1759
 *         raise NotImplementedError
 * 
 *     def _fold(self, state, steps, math):             # <<<<<<<<<<<<<<
 *         raise NotImplementedError
 * 
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_4Fold_3_fold, 0, __pyx_n_s_Fold__fold, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__139)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1759, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_fold_2, __pyx_t_6) < 0) __PYX_ERR(0, 1759, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/builtin/numeric.py":1762
 *         raise NotImplementedError
 * 
 *     def _spans(self, operands):             # <<<<<<<<<<<<<<
 *         spans = {}
 *         k = 0
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_4Fold_5_spans, 0, __pyx_n_s_Fold__spans, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__141)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1762, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_spans, __pyx_t_6) < 0) __PYX_ERR(0, 1762, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/builtin/numeric.py":1783
 *         return spans
 * 
 *     def fold(self, x, ll):             # <<<<<<<<<<<<<<
 *         # computes fold(x, ll) with the internal _fold function. will start
 *         # its evaluation machine precision, and will escalate to arbitrary
 */
  __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7mathics_7builtin_7numeric_4Fold_7fold, 0, __pyx_n_s_Fold_fold, NULL, __pyx_n_s_mathics_builtin_numeric, __pyx_d, ((PyObject *)__pyx_codeobj__37)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_fold, __pyx_t_6) < 0) __PYX_ERR(0, 1783, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "mathics/builtin/numeric.py":1725
 * 
 * 
 * class Fold(object):             # <<<<<<<<<<<<<<
 *     # allows inherited classes to specify a single algorithm implementation that
 *     # can be called with machine precision, arbitrary precision or symbolically.
 */
  __pyx_t_6 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_Fold, __pyx_tuple__133, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Fold, __pyx_t_6) < 0) __PYX_ERR(0, 1725, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "mathics/builtin/numeric.py":1
 * # cython: language_level=3             # <<<<<<<<<<<<<<
 * # -*- coding: utf-8 -*-
 * 
 */
  __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test_2, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init mathics.builtin.numeric", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    Py_CLEAR(__pyx_m);
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init mathics.builtin.numeric");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  return (__pyx_m != NULL) ? 0 : -1;
  #elif PY_MAJOR_VERSION >= 3
  return __pyx_m;
  #else
  return;
  #endif
}

/* --- Runtime support code --- */
/* Refnanny */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule(modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, "RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif

/* PyObjectGetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro))
        return tp->tp_getattro(obj, attr_name);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_getattr))
        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
#endif
    return PyObject_GetAttr(obj, attr_name);
}
#endif

/* GetBuiltinName */
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
    if (unlikely(!result)) {
        PyErr_Format(PyExc_NameError,
#if PY_MAJOR_VERSION >= 3
            "name '%U' is not defined", name);
#else
            "name '%.200s' is not defined", PyString_AS_STRING(name));
#endif
    }
    return result;
}

/* RaiseArgTupleInvalid */
static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *more_or_less;
    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    PyErr_Format(PyExc_TypeError,
                 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

/* RaiseDoubleKeywords */
static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AsString(kw_name));
        #endif
}

/* ParseKeywords */
static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;
    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
            continue;
        }
        name = first_kw_arg;
        #if PY_MAJOR_VERSION < 3
        if (likely(PyString_Check(key))) {
            while (*name) {
                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
                        && _PyString_Eq(**name, key)) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    if ((**argname == key) || (
                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
                             && _PyString_Eq(**argname, key))) {
                        goto arg_passed_twice;
                    }
                    argname++;
                }
            }
        } else
        #endif
        if (likely(PyUnicode_Check(key))) {
            while (*name) {
                int cmp = (**name == key) ? 0 :
                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                    (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
                #endif
                    PyUnicode_Compare(**name, key);
                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                if (cmp == 0) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    int cmp = (**argname == key) ? 0 :
                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                        (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
                    #endif
                        PyUnicode_Compare(**argname, key);
                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                    if (cmp == 0) goto arg_passed_twice;
                    argname++;
                }
            }
        } else
            goto invalid_keyword_type;
        if (kwds2) {
            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
        } else {
            goto invalid_keyword;
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

/* PyIntCompare */
static CYTHON_INLINE PyObject* __Pyx_PyInt_NeObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) {
    if (op1 == op2) {
        Py_RETURN_FALSE;
    }
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long a = PyInt_AS_LONG(op1);
        if (a != b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        int unequal;
        unsigned long uintval;
        Py_ssize_t size = Py_SIZE(op1);
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        if (intval == 0) {
            if (size != 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
        } else if (intval < 0) {
            if (size >= 0)
                Py_RETURN_TRUE;
            intval = -intval;
            size = -size;
        } else {
            if (size <= 0)
                Py_RETURN_TRUE;
        }
        uintval = (unsigned long) intval;
#if PyLong_SHIFT * 4 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 4)) {
            unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 3 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 3)) {
            unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 2 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 2)) {
            unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 1 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 1)) {
            unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
            unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
        if (unequal != 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
        if ((double)a != (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    return (
        PyObject_RichCompare(op1, op2, Py_NE));
}

/* PyDictVersioning */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
    PyObject **dictptr = NULL;
    Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
    if (offset) {
#if CYTHON_COMPILING_IN_CPYTHON
        dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
#else
        dictptr = _PyObject_GetDictPtr(obj);
#endif
    }
    return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
}
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
        return 0;
    return obj_dict_version == __Pyx_get_object_dict_version(obj);
}
#endif

/* GetModuleGlobalName */
#if CYTHON_USE_DICT_VERSIONS
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
#else
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
#endif
{
    PyObject *result;
#if !CYTHON_AVOID_BORROWED_REFS
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
    result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    } else if (unlikely(PyErr_Occurred())) {
        return NULL;
    }
#else
    result = PyDict_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
#endif
#else
    result = PyObject_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
    PyErr_Clear();
#endif
    return __Pyx_GetBuiltinName(name);
}

/* PyFunctionFastCall */
#if CYTHON_FAST_PYCALL
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
                                               PyObject *globals) {
    PyFrameObject *f;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject **fastlocals;
    Py_ssize_t i;
    PyObject *result;
    assert(globals != NULL);
    /* XXX Perhaps we should create a specialized
       PyFrame_New() that doesn't take locals, but does
       take builtins without sanity checking them.
       */
    assert(tstate != NULL);
    f = PyFrame_New(tstate, co, globals, NULL);
    if (f == NULL) {
        return NULL;
    }
    fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
    for (i = 0; i < na; i++) {
        Py_INCREF(*args);
        fastlocals[i] = *args++;
    }
    result = PyEval_EvalFrameEx(f,0);
    ++tstate->recursion_depth;
    Py_DECREF(f);
    --tstate->recursion_depth;
    return result;
}
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
    PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
    PyObject *globals = PyFunction_GET_GLOBALS(func);
    PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
    PyObject *closure;
#if PY_MAJOR_VERSION >= 3
    PyObject *kwdefs;
#endif
    PyObject *kwtuple, **k;
    PyObject **d;
    Py_ssize_t nd;
    Py_ssize_t nk;
    PyObject *result;
    assert(kwargs == NULL || PyDict_Check(kwargs));
    nk = kwargs ? PyDict_Size(kwargs) : 0;
    if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
        return NULL;
    }
    if (
#if PY_MAJOR_VERSION >= 3
            co->co_kwonlyargcount == 0 &&
#endif
            likely(kwargs == NULL || nk == 0) &&
            co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
        if (argdefs == NULL && co->co_argcount == nargs) {
            result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
            goto done;
        }
        else if (nargs == 0 && argdefs != NULL
                 && co->co_argcount == Py_SIZE(argdefs)) {
            /* function called with no arguments, but all parameters have
               a default value: use default values as arguments .*/
            args = &PyTuple_GET_ITEM(argdefs, 0);
            result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
            goto done;
        }
    }
    if (kwargs != NULL) {
        Py_ssize_t pos, i;
        kwtuple = PyTuple_New(2 * nk);
        if (kwtuple == NULL) {
            result = NULL;
            goto done;
        }
        k = &PyTuple_GET_ITEM(kwtuple, 0);
        pos = i = 0;
        while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
            Py_INCREF(k[i]);
            Py_INCREF(k[i+1]);
            i += 2;
        }
        nk = i / 2;
    }
    else {
        kwtuple = NULL;
        k = NULL;
    }
    closure = PyFunction_GET_CLOSURE(func);
#if PY_MAJOR_VERSION >= 3
    kwdefs = PyFunction_GET_KW_DEFAULTS(func);
#endif
    if (argdefs != NULL) {
        d = &PyTuple_GET_ITEM(argdefs, 0);
        nd = Py_SIZE(argdefs);
    }
    else {
        d = NULL;
        nd = 0;
    }
#if PY_MAJOR_VERSION >= 3
    result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
                               args, (int)nargs,
                               k, (int)nk,
                               d, (int)nd, kwdefs, closure);
#else
    result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
                               args, (int)nargs,
                               k, (int)nk,
                               d, (int)nd, closure);
#endif
    Py_XDECREF(kwtuple);
done:
    Py_LeaveRecursiveCall();
    return result;
}
#endif
#endif

/* PyCFunctionFastCall */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
    PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
    PyCFunction meth = PyCFunction_GET_FUNCTION(func);
    PyObject *self = PyCFunction_GET_SELF(func);
    int flags = PyCFunction_GET_FLAGS(func);
    assert(PyCFunction_Check(func));
    assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
    assert(nargs >= 0);
    assert(nargs == 0 || args != NULL);
    /* _PyCFunction_FastCallDict() must not be called with an exception set,
       because it may clear it (directly or indirectly) and so the
       caller loses its exception */
    assert(!PyErr_Occurred());
    if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
        return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
    } else {
        return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
    }
}
#endif

/* PyObjectCall */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = func->ob_type->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = (*call)(func, arg, kw);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectCall2Args */
static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
    PyObject *args, *result = NULL;
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(function)) {
        PyObject *args[2] = {arg1, arg2};
        return __Pyx_PyFunction_FastCall(function, args, 2);
    }
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(function)) {
        PyObject *args[2] = {arg1, arg2};
        return __Pyx_PyCFunction_FastCall(function, args, 2);
    }
    #endif
    args = PyTuple_New(2);
    if (unlikely(!args)) goto done;
    Py_INCREF(arg1);
    PyTuple_SET_ITEM(args, 0, arg1);
    Py_INCREF(arg2);
    PyTuple_SET_ITEM(args, 1, arg2);
    Py_INCREF(function);
    result = __Pyx_PyObject_Call(function, args, NULL);
    Py_DECREF(args);
    Py_DECREF(function);
done:
    return result;
}

/* PyObjectCallMethO */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
    PyObject *self, *result;
    PyCFunction cfunc;
    cfunc = PyCFunction_GET_FUNCTION(func);
    self = PyCFunction_GET_SELF(func);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = cfunc(self, arg);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectCallOneArg */
#if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_New(1);
    if (unlikely(!args)) return NULL;
    Py_INCREF(arg);
    PyTuple_SET_ITEM(args, 0, arg);
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, &arg, 1);
    }
#endif
    if (likely(PyCFunction_Check(func))) {
        if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
            return __Pyx_PyObject_CallMethO(func, arg);
#if CYTHON_FAST_PYCCALL
        } else if (__Pyx_PyFastCFunction_Check(func)) {
            return __Pyx_PyCFunction_FastCall(func, &arg, 1);
#endif
        }
    }
    return __Pyx__PyObject_CallOneArg(func, arg);
}
#else
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_Pack(1, arg);
    if (unlikely(!args)) return NULL;
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
#endif

/* GetTopmostException */
#if CYTHON_USE_EXC_INFO_STACK
static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
{
    _PyErr_StackItem *exc_info = tstate->exc_info;
    while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
           exc_info->previous_item != NULL)
    {
        exc_info = exc_info->previous_item;
    }
    return exc_info;
}
#endif

/* SaveResetException */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
    *type = exc_info->exc_type;
    *value = exc_info->exc_value;
    *tb = exc_info->exc_traceback;
    #else
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    #endif
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
}
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = type;
    exc_info->exc_value = value;
    exc_info->exc_traceback = tb;
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
#endif

/* PyErrFetchRestore */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
}
#endif

/* FastTypeChecks */
#if CYTHON_COMPILING_IN_CPYTHON
static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
    while (a) {
        a = a->tp_base;
        if (a == b)
            return 1;
    }
    return b == &PyBaseObject_Type;
}
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
    PyObject *mro;
    if (a == b) return 1;
    mro = a->tp_mro;
    if (likely(mro)) {
        Py_ssize_t i, n;
        n = PyTuple_GET_SIZE(mro);
        for (i = 0; i < n; i++) {
            if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
                return 1;
        }
        return 0;
    }
    return __Pyx_InBases(a, b);
}
#if PY_MAJOR_VERSION == 2
static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
    PyObject *exception, *value, *tb;
    int res;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&exception, &value, &tb);
    res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
    if (unlikely(res == -1)) {
        PyErr_WriteUnraisable(err);
        res = 0;
    }
    if (!res) {
        res = PyObject_IsSubclass(err, exc_type2);
        if (unlikely(res == -1)) {
            PyErr_WriteUnraisable(err);
            res = 0;
        }
    }
    __Pyx_ErrRestore(exception, value, tb);
    return res;
}
#else
static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
    int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
    if (!res) {
        res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
    }
    return res;
}
#endif
static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    assert(PyExceptionClass_Check(exc_type));
    n = PyTuple_GET_SIZE(tuple);
#if PY_MAJOR_VERSION >= 3
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
#endif
    for (i=0; i<n; i++) {
        PyObject *t = PyTuple_GET_ITEM(tuple, i);
        #if PY_MAJOR_VERSION < 3
        if (likely(exc_type == t)) return 1;
        #endif
        if (likely(PyExceptionClass_Check(t))) {
            if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
        } else {
        }
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
    if (likely(err == exc_type)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        if (likely(PyExceptionClass_Check(exc_type))) {
            return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
        } else if (likely(PyTuple_Check(exc_type))) {
            return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
        } else {
        }
    }
    return PyErr_GivenExceptionMatches(err, exc_type);
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
    assert(PyExceptionClass_Check(exc_type1));
    assert(PyExceptionClass_Check(exc_type2));
    if (likely(err == exc_type1 || err == exc_type2)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
    }
    return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
}
#endif

/* GetException */
#if CYTHON_FAST_THREAD_STATE
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
#endif
{
    PyObject *local_type, *local_value, *local_tb;
#if CYTHON_FAST_THREAD_STATE
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    local_type = tstate->curexc_type;
    local_value = tstate->curexc_value;
    local_tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
#if CYTHON_FAST_THREAD_STATE
    if (unlikely(tstate->curexc_type))
#else
    if (unlikely(PyErr_Occurred()))
#endif
        goto bad;
    #if PY_MAJOR_VERSION >= 3
    if (local_tb) {
        if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
            goto bad;
    }
    #endif
    Py_XINCREF(local_tb);
    Py_XINCREF(local_type);
    Py_XINCREF(local_value);
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
#if CYTHON_FAST_THREAD_STATE
    #if CYTHON_USE_EXC_INFO_STACK
    {
        _PyErr_StackItem *exc_info = tstate->exc_info;
        tmp_type = exc_info->exc_type;
        tmp_value = exc_info->exc_value;
        tmp_tb = exc_info->exc_traceback;
        exc_info->exc_type = local_type;
        exc_info->exc_value = local_value;
        exc_info->exc_traceback = local_tb;
    }
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = local_type;
    tstate->exc_value = local_value;
    tstate->exc_traceback = local_tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_SetExcInfo(local_type, local_value, local_tb);
#endif
    return 0;
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
}

/* PyObjectCallNoArg */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, NULL, 0);
    }
#endif
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
#else
    if (likely(PyCFunction_Check(func)))
#endif
    {
        if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
            return __Pyx_PyObject_CallMethO(func, NULL);
        }
    }
    return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
}
#endif

/* BytesEquals */
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    if (s1 == s2) {
        return (equals == Py_EQ);
    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
        const char *ps1, *ps2;
        Py_ssize_t length = PyBytes_GET_SIZE(s1);
        if (length != PyBytes_GET_SIZE(s2))
            return (equals == Py_NE);
        ps1 = PyBytes_AS_STRING(s1);
        ps2 = PyBytes_AS_STRING(s2);
        if (ps1[0] != ps2[0]) {
            return (equals == Py_NE);
        } else if (length == 1) {
            return (equals == Py_EQ);
        } else {
            int result;
#if CYTHON_USE_UNICODE_INTERNALS
            Py_hash_t hash1, hash2;
            hash1 = ((PyBytesObject*)s1)->ob_shash;
            hash2 = ((PyBytesObject*)s2)->ob_shash;
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                return (equals == Py_NE);
            }
#endif
            result = memcmp(ps1, ps2, (size_t)length);
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
        return (equals == Py_NE);
    } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
        return (equals == Py_NE);
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
#endif
}

/* UnicodeEquals */
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
#if PY_MAJOR_VERSION < 3
    PyObject* owned_ref = NULL;
#endif
    int s1_is_unicode, s2_is_unicode;
    if (s1 == s2) {
        goto return_eq;
    }
    s1_is_unicode = PyUnicode_CheckExact(s1);
    s2_is_unicode = PyUnicode_CheckExact(s2);
#if PY_MAJOR_VERSION < 3
    if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
        owned_ref = PyUnicode_FromObject(s2);
        if (unlikely(!owned_ref))
            return -1;
        s2 = owned_ref;
        s2_is_unicode = 1;
    } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
        owned_ref = PyUnicode_FromObject(s1);
        if (unlikely(!owned_ref))
            return -1;
        s1 = owned_ref;
        s1_is_unicode = 1;
    } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
        return __Pyx_PyBytes_Equals(s1, s2, equals);
    }
#endif
    if (s1_is_unicode & s2_is_unicode) {
        Py_ssize_t length;
        int kind;
        void *data1, *data2;
        if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
            return -1;
        length = __Pyx_PyUnicode_GET_LENGTH(s1);
        if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
            goto return_ne;
        }
#if CYTHON_USE_UNICODE_INTERNALS
        {
            Py_hash_t hash1, hash2;
        #if CYTHON_PEP393_ENABLED
            hash1 = ((PyASCIIObject*)s1)->hash;
            hash2 = ((PyASCIIObject*)s2)->hash;
        #else
            hash1 = ((PyUnicodeObject*)s1)->hash;
            hash2 = ((PyUnicodeObject*)s2)->hash;
        #endif
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                goto return_ne;
            }
        }
#endif
        kind = __Pyx_PyUnicode_KIND(s1);
        if (kind != __Pyx_PyUnicode_KIND(s2)) {
            goto return_ne;
        }
        data1 = __Pyx_PyUnicode_DATA(s1);
        data2 = __Pyx_PyUnicode_DATA(s2);
        if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
            goto return_ne;
        } else if (length == 1) {
            goto return_eq;
        } else {
            int result = memcmp(data1, data2, (size_t)(length * kind));
            #if PY_MAJOR_VERSION < 3
            Py_XDECREF(owned_ref);
            #endif
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & s2_is_unicode) {
        goto return_ne;
    } else if ((s2 == Py_None) & s1_is_unicode) {
        goto return_ne;
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        #if PY_MAJOR_VERSION < 3
        Py_XDECREF(owned_ref);
        #endif
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
return_eq:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_EQ);
return_ne:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_NE);
#endif
}

/* GetItemInt */
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyList_GET_SIZE(o);
    }
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, wrapped_i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyTuple_GET_SIZE(o);
    }
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
                                                     CYTHON_NCP_UNUSED int wraparound,
                                                     CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
            PyObject *r = PyList_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    }
    else if (PyTuple_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return NULL;
                    PyErr_Clear();
                }
            }
            return m->sq_item(o, i);
        }
    }
#else
    if (is_list || PySequence_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}

/* ObjectGetItem */
#if CYTHON_USE_TYPE_SLOTS
static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
    PyObject *runerr;
    Py_ssize_t key_value;
    PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
    if (unlikely(!(m && m->sq_item))) {
        PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
        return NULL;
    }
    key_value = __Pyx_PyIndex_AsSsize_t(index);
    if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
        return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
    }
    if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
        PyErr_Clear();
        PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
    }
    return NULL;
}
static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
    PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
    if (likely(m && m->mp_subscript)) {
        return m->mp_subscript(obj, key);
    }
    return __Pyx_PyObject_GetIndex(obj, key);
}
#endif

/* None */
static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) {
    PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
}

/* UnpackUnboundCMethod */
static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
    PyObject *method;
    method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
    if (unlikely(!method))
        return -1;
    target->method = method;
#if CYTHON_COMPILING_IN_CPYTHON
    #if PY_MAJOR_VERSION >= 3
    if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
    #endif
    {
        PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
        target->func = descr->d_method->ml_meth;
        target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
    }
#endif
    return 0;
}

/* CallUnboundCMethod1 */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) {
    if (likely(cfunc->func)) {
        int flag = cfunc->flag;
        if (flag == METH_O) {
            return (*(cfunc->func))(self, arg);
        } else if (PY_VERSION_HEX >= 0x030600B1 && flag == METH_FASTCALL) {
            if (PY_VERSION_HEX >= 0x030700A0) {
                return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, &arg, 1);
            } else {
                return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL);
            }
        } else if (PY_VERSION_HEX >= 0x030700A0 && flag == (METH_FASTCALL | METH_KEYWORDS)) {
            return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL);
        }
    }
    return __Pyx__CallUnboundCMethod1(cfunc, self, arg);
}
#endif
static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){
    PyObject *args, *result = NULL;
    if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_COMPILING_IN_CPYTHON
    if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
        args = PyTuple_New(1);
        if (unlikely(!args)) goto bad;
        Py_INCREF(arg);
        PyTuple_SET_ITEM(args, 0, arg);
        if (cfunc->flag & METH_KEYWORDS)
            result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL);
        else
            result = (*cfunc->func)(self, args);
    } else {
        args = PyTuple_New(2);
        if (unlikely(!args)) goto bad;
        Py_INCREF(self);
        PyTuple_SET_ITEM(args, 0, self);
        Py_INCREF(arg);
        PyTuple_SET_ITEM(args, 1, arg);
        result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
    }
#else
    args = PyTuple_Pack(2, self, arg);
    if (unlikely(!args)) goto bad;
    result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
#endif
bad:
    Py_XDECREF(args);
    return result;
}

/* IterFinish */
static CYTHON_INLINE int __Pyx_IterFinish(void) {
#if CYTHON_FAST_THREAD_STATE
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject* exc_type = tstate->curexc_type;
    if (unlikely(exc_type)) {
        if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
            PyObject *exc_value, *exc_tb;
            exc_value = tstate->curexc_value;
            exc_tb = tstate->curexc_traceback;
            tstate->curexc_type = 0;
            tstate->curexc_value = 0;
            tstate->curexc_traceback = 0;
            Py_DECREF(exc_type);
            Py_XDECREF(exc_value);
            Py_XDECREF(exc_tb);
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#else
    if (unlikely(PyErr_Occurred())) {
        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
            PyErr_Clear();
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#endif
}

/* PyObjectGetMethod */
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
    PyObject *attr;
#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
    PyTypeObject *tp = Py_TYPE(obj);
    PyObject *descr;
    descrgetfunc f = NULL;
    PyObject **dictptr, *dict;
    int meth_found = 0;
    assert (*method == NULL);
    if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
        attr = __Pyx_PyObject_GetAttrStr(obj, name);
        goto try_unpack;
    }
    if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
        return 0;
    }
    descr = _PyType_Lookup(tp, name);
    if (likely(descr != NULL)) {
        Py_INCREF(descr);
#if PY_MAJOR_VERSION >= 3
        #ifdef __Pyx_CyFunction_USED
        if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
        #else
        if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
        #endif
#else
        #ifdef __Pyx_CyFunction_USED
        if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
        #else
        if (likely(PyFunction_Check(descr)))
        #endif
#endif
        {
            meth_found = 1;
        } else {
            f = Py_TYPE(descr)->tp_descr_get;
            if (f != NULL && PyDescr_IsData(descr)) {
                attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
                Py_DECREF(descr);
                goto try_unpack;
            }
        }
    }
    dictptr = _PyObject_GetDictPtr(obj);
    if (dictptr != NULL && (dict = *dictptr) != NULL) {
        Py_INCREF(dict);
        attr = __Pyx_PyDict_GetItemStr(dict, name);
        if (attr != NULL) {
            Py_INCREF(attr);
            Py_DECREF(dict);
            Py_XDECREF(descr);
            goto try_unpack;
        }
        Py_DECREF(dict);
    }
    if (meth_found) {
        *method = descr;
        return 1;
    }
    if (f != NULL) {
        attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
        Py_DECREF(descr);
        goto try_unpack;
    }
    if (descr != NULL) {
        *method = descr;
        return 0;
    }
    PyErr_Format(PyExc_AttributeError,
#if PY_MAJOR_VERSION >= 3
                 "'%.50s' object has no attribute '%U'",
                 tp->tp_name, name);
#else
                 "'%.50s' object has no attribute '%.400s'",
                 tp->tp_name, PyString_AS_STRING(name));
#endif
    return 0;
#else
    attr = __Pyx_PyObject_GetAttrStr(obj, name);
    goto try_unpack;
#endif
try_unpack:
#if CYTHON_UNPACK_METHODS
    if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
        PyObject *function = PyMethod_GET_FUNCTION(attr);
        Py_INCREF(function);
        Py_DECREF(attr);
        *method = function;
        return 1;
    }
#endif
    *method = attr;
    return 0;
}

/* PyObjectCallMethod0 */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
    PyObject *method = NULL, *result = NULL;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_CallOneArg(method, obj);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) goto bad;
    result = __Pyx_PyObject_CallNoArg(method);
    Py_DECREF(method);
bad:
    return result;
}

/* RaiseNeedMoreValuesToUnpack */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
                 index, (index == 1) ? "" : "s");
}

/* RaiseTooManyValuesToUnpack */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}

/* UnpackItemEndCheck */
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    } else {
        return __Pyx_IterFinish();
    }
    return 0;
}

/* RaiseNoneIterError */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

/* UnpackTupleError */
static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
    if (t == Py_None) {
      __Pyx_RaiseNoneNotIterableError();
    } else if (PyTuple_GET_SIZE(t) < index) {
      __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
    } else {
      __Pyx_RaiseTooManyValuesError(index);
    }
}

/* UnpackTuple2 */
static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
        PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, int decref_tuple) {
    PyObject *value1 = NULL, *value2 = NULL;
#if CYTHON_COMPILING_IN_PYPY
    value1 = PySequence_ITEM(tuple, 0);  if (unlikely(!value1)) goto bad;
    value2 = PySequence_ITEM(tuple, 1);  if (unlikely(!value2)) goto bad;
#else
    value1 = PyTuple_GET_ITEM(tuple, 0);  Py_INCREF(value1);
    value2 = PyTuple_GET_ITEM(tuple, 1);  Py_INCREF(value2);
#endif
    if (decref_tuple) {
        Py_DECREF(tuple);
    }
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
#if CYTHON_COMPILING_IN_PYPY
bad:
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
#endif
}
static int __Pyx_unpack_tuple2_generic(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
                                       int has_known_size, int decref_tuple) {
    Py_ssize_t index;
    PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
    iternextfunc iternext;
    iter = PyObject_GetIter(tuple);
    if (unlikely(!iter)) goto bad;
    if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; }
    iternext = Py_TYPE(iter)->tp_iternext;
    value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; }
    value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; }
    if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad;
    Py_DECREF(iter);
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
unpacking_failed:
    if (!has_known_size && __Pyx_IterFinish() == 0)
        __Pyx_RaiseNeedMoreValuesError(index);
bad:
    Py_XDECREF(iter);
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
}

/* dict_iter */
static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_source_is_dict) {
    is_dict = is_dict || likely(PyDict_CheckExact(iterable));
    *p_source_is_dict = is_dict;
    if (is_dict) {
#if !CYTHON_COMPILING_IN_PYPY
        *p_orig_length = PyDict_Size(iterable);
        Py_INCREF(iterable);
        return iterable;
#elif PY_MAJOR_VERSION >= 3
        static PyObject *py_items = NULL, *py_keys = NULL, *py_values = NULL;
        PyObject **pp = NULL;
        if (method_name) {
            const char *name = PyUnicode_AsUTF8(method_name);
            if (strcmp(name, "iteritems") == 0) pp = &py_items;
            else if (strcmp(name, "iterkeys") == 0) pp = &py_keys;
            else if (strcmp(name, "itervalues") == 0) pp = &py_values;
            if (pp) {
                if (!*pp) {
                    *pp = PyUnicode_FromString(name + 4);
                    if (!*pp)
                        return NULL;
                }
                method_name = *pp;
            }
        }
#endif
    }
    *p_orig_length = 0;
    if (method_name) {
        PyObject* iter;
        iterable = __Pyx_PyObject_CallMethod0(iterable, method_name);
        if (!iterable)
            return NULL;
#if !CYTHON_COMPILING_IN_PYPY
        if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable))
            return iterable;
#endif
        iter = PyObject_GetIter(iterable);
        Py_DECREF(iterable);
        return iter;
    }
    return PyObject_GetIter(iterable);
}
static CYTHON_INLINE int __Pyx_dict_iter_next(
        PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos,
        PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) {
    PyObject* next_item;
#if !CYTHON_COMPILING_IN_PYPY
    if (source_is_dict) {
        PyObject *key, *value;
        if (unlikely(orig_length != PyDict_Size(iter_obj))) {
            PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration");
            return -1;
        }
        if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) {
            return 0;
        }
        if (pitem) {
            PyObject* tuple = PyTuple_New(2);
            if (unlikely(!tuple)) {
                return -1;
            }
            Py_INCREF(key);
            Py_INCREF(value);
            PyTuple_SET_ITEM(tuple, 0, key);
            PyTuple_SET_ITEM(tuple, 1, value);
            *pitem = tuple;
        } else {
            if (pkey) {
                Py_INCREF(key);
                *pkey = key;
            }
            if (pvalue) {
                Py_INCREF(value);
                *pvalue = value;
            }
        }
        return 1;
    } else if (PyTuple_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        if (unlikely(pos >= PyTuple_GET_SIZE(iter_obj))) return 0;
        *ppos = pos + 1;
        next_item = PyTuple_GET_ITEM(iter_obj, pos);
        Py_INCREF(next_item);
    } else if (PyList_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        if (unlikely(pos >= PyList_GET_SIZE(iter_obj))) return 0;
        *ppos = pos + 1;
        next_item = PyList_GET_ITEM(iter_obj, pos);
        Py_INCREF(next_item);
    } else
#endif
    {
        next_item = PyIter_Next(iter_obj);
        if (unlikely(!next_item)) {
            return __Pyx_IterFinish();
        }
    }
    if (pitem) {
        *pitem = next_item;
    } else if (pkey && pvalue) {
        if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1))
            return -1;
    } else if (pkey) {
        *pkey = next_item;
    } else {
        *pvalue = next_item;
    }
    return 1;
}

/* FetchCommonType */
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
    PyObject* fake_module;
    PyTypeObject* cached_type = NULL;
    fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
    if (!fake_module) return NULL;
    Py_INCREF(fake_module);
    cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
    if (cached_type) {
        if (!PyType_Check((PyObject*)cached_type)) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s is not a type object",
                type->tp_name);
            goto bad;
        }
        if (cached_type->tp_basicsize != type->tp_basicsize) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s has the wrong size, try recompiling",
                type->tp_name);
            goto bad;
        }
    } else {
        if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
        PyErr_Clear();
        if (PyType_Ready(type) < 0) goto bad;
        if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
            goto bad;
        Py_INCREF(type);
        cached_type = type;
    }
done:
    Py_DECREF(fake_module);
    return cached_type;
bad:
    Py_XDECREF(cached_type);
    cached_type = NULL;
    goto done;
}

/* CythonFunctionShared */
#include <structmember.h>
static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
{
    if (unlikely(op->func_doc == NULL)) {
        if (op->func.m_ml->ml_doc) {
#if PY_MAJOR_VERSION >= 3
            op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
#else
            op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
#endif
            if (unlikely(op->func_doc == NULL))
                return NULL;
        } else {
            Py_INCREF(Py_None);
            return Py_None;
        }
    }
    Py_INCREF(op->func_doc);
    return op->func_doc;
}
static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp = op->func_doc;
    if (value == NULL) {
        value = Py_None;
    }
    Py_INCREF(value);
    op->func_doc = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    if (unlikely(op->func_name == NULL)) {
#if PY_MAJOR_VERSION >= 3
        op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
#else
        op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
#endif
        if (unlikely(op->func_name == NULL))
            return NULL;
    }
    Py_INCREF(op->func_name);
    return op->func_name;
}
static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value)))
#else
    if (unlikely(value == NULL || !PyString_Check(value)))
#endif
    {
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    tmp = op->func_name;
    Py_INCREF(value);
    op->func_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    Py_INCREF(op->func_qualname);
    return op->func_qualname;
}
static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value)))
#else
    if (unlikely(value == NULL || !PyString_Check(value)))
#endif
    {
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    tmp = op->func_qualname;
    Py_INCREF(value);
    op->func_qualname = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
{
    PyObject *self;
    self = m->func_closure;
    if (self == NULL)
        self = Py_None;
    Py_INCREF(self);
    return self;
}
static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    if (unlikely(op->func_dict == NULL)) {
        op->func_dict = PyDict_New();
        if (unlikely(op->func_dict == NULL))
            return NULL;
    }
    Py_INCREF(op->func_dict);
    return op->func_dict;
}
static int
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
    if (unlikely(value == NULL)) {
        PyErr_SetString(PyExc_TypeError,
               "function's dictionary may not be deleted");
        return -1;
    }
    if (unlikely(!PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
               "setting function's dictionary to a non-dict");
        return -1;
    }
    tmp = op->func_dict;
    Py_INCREF(value);
    op->func_dict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    Py_INCREF(op->func_globals);
    return op->func_globals;
}
static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    Py_INCREF(Py_None);
    return Py_None;
}
static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    PyObject* result = (op->func_code) ? op->func_code : Py_None;
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
    int result = 0;
    PyObject *res = op->defaults_getter((PyObject *) op);
    if (unlikely(!res))
        return -1;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
    Py_INCREF(op->defaults_tuple);
    op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
    Py_INCREF(op->defaults_kwdict);
    #else
    op->defaults_tuple = PySequence_ITEM(res, 0);
    if (unlikely(!op->defaults_tuple)) result = -1;
    else {
        op->defaults_kwdict = PySequence_ITEM(res, 1);
        if (unlikely(!op->defaults_kwdict)) result = -1;
    }
    #endif
    Py_DECREF(res);
    return result;
}
static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyTuple_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__defaults__ must be set to a tuple object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_tuple;
    op->defaults_tuple = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
    PyObject* result = op->defaults_tuple;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_tuple;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__kwdefaults__ must be set to a dict object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_kwdict;
    op->defaults_kwdict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
    PyObject* result = op->defaults_kwdict;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_kwdict;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
    PyObject* tmp;
    if (!value || value == Py_None) {
        value = NULL;
    } else if (!PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__annotations__ must be set to a dict object");
        return -1;
    }
    Py_XINCREF(value);
    tmp = op->func_annotations;
    op->func_annotations = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
    PyObject* result = op->func_annotations;
    if (unlikely(!result)) {
        result = PyDict_New();
        if (unlikely(!result)) return NULL;
        op->func_annotations = result;
    }
    Py_INCREF(result);
    return result;
}
static PyGetSetDef __pyx_CyFunction_getsets[] = {
    {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
    {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
    {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
    {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
    {0, 0, 0, 0, 0}
};
static PyMemberDef __pyx_CyFunction_members[] = {
    {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
    {0, 0, 0,  0, 0}
};
static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromString(m->func.m_ml->ml_name);
#else
    return PyString_FromString(m->func.m_ml->ml_name);
#endif
}
static PyMethodDef __pyx_CyFunction_methods[] = {
    {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
    {0, 0, 0, 0}
};
#if PY_VERSION_HEX < 0x030500A0
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
#else
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
#endif
static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
                                       PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
    if (unlikely(op == NULL))
        return NULL;
    op->flags = flags;
    __Pyx_CyFunction_weakreflist(op) = NULL;
    op->func.m_ml = ml;
    op->func.m_self = (PyObject *) op;
    Py_XINCREF(closure);
    op->func_closure = closure;
    Py_XINCREF(module);
    op->func.m_module = module;
    op->func_dict = NULL;
    op->func_name = NULL;
    Py_INCREF(qualname);
    op->func_qualname = qualname;
    op->func_doc = NULL;
    op->func_classobj = NULL;
    op->func_globals = globals;
    Py_INCREF(op->func_globals);
    Py_XINCREF(code);
    op->func_code = code;
    op->defaults_pyobjects = 0;
    op->defaults_size = 0;
    op->defaults = NULL;
    op->defaults_tuple = NULL;
    op->defaults_kwdict = NULL;
    op->defaults_getter = NULL;
    op->func_annotations = NULL;
    return (PyObject *) op;
}
static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
{
    Py_CLEAR(m->func_closure);
    Py_CLEAR(m->func.m_module);
    Py_CLEAR(m->func_dict);
    Py_CLEAR(m->func_name);
    Py_CLEAR(m->func_qualname);
    Py_CLEAR(m->func_doc);
    Py_CLEAR(m->func_globals);
    Py_CLEAR(m->func_code);
    Py_CLEAR(m->func_classobj);
    Py_CLEAR(m->defaults_tuple);
    Py_CLEAR(m->defaults_kwdict);
    Py_CLEAR(m->func_annotations);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_XDECREF(pydefaults[i]);
        PyObject_Free(m->defaults);
        m->defaults = NULL;
    }
    return 0;
}
static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    if (__Pyx_CyFunction_weakreflist(m) != NULL)
        PyObject_ClearWeakRefs((PyObject *) m);
    __Pyx_CyFunction_clear(m);
    PyObject_GC_Del(m);
}
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    PyObject_GC_UnTrack(m);
    __Pyx__CyFunction_dealloc(m);
}
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
{
    Py_VISIT(m->func_closure);
    Py_VISIT(m->func.m_module);
    Py_VISIT(m->func_dict);
    Py_VISIT(m->func_name);
    Py_VISIT(m->func_qualname);
    Py_VISIT(m->func_doc);
    Py_VISIT(m->func_globals);
    Py_VISIT(m->func_code);
    Py_VISIT(m->func_classobj);
    Py_VISIT(m->defaults_tuple);
    Py_VISIT(m->defaults_kwdict);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_VISIT(pydefaults[i]);
    }
    return 0;
}
static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
{
#if PY_MAJOR_VERSION < 3
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
        Py_INCREF(func);
        return func;
    }
    if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
        if (type == NULL)
            type = (PyObject *)(Py_TYPE(obj));
        return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
    }
    if (obj == Py_None)
        obj = NULL;
#endif
    return __Pyx_PyMethod_New(func, obj, type);
}
static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromFormat("<cyfunction %U at %p>",
                                op->func_qualname, (void *)op);
#else
    return PyString_FromFormat("<cyfunction %s at %p>",
                               PyString_AsString(op->func_qualname), (void *)op);
#endif
}
static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
    PyCFunctionObject* f = (PyCFunctionObject*)func;
    PyCFunction meth = f->m_ml->ml_meth;
    Py_ssize_t size;
    switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
    case METH_VARARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0))
            return (*meth)(self, arg);
        break;
    case METH_VARARGS | METH_KEYWORDS:
        return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw);
    case METH_NOARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
            size = PyTuple_GET_SIZE(arg);
            if (likely(size == 0))
                return (*meth)(self, NULL);
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    case METH_O:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
            size = PyTuple_GET_SIZE(arg);
            if (likely(size == 1)) {
                PyObject *result, *arg0;
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                arg0 = PyTuple_GET_ITEM(arg, 0);
                #else
                arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
                #endif
                result = (*meth)(self, arg0);
                #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
                Py_DECREF(arg0);
                #endif
                return result;
            }
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags in "
                        "__Pyx_CyFunction_Call. METH_OLDARGS is no "
                        "longer supported!");
        return NULL;
    }
    PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
                 f->m_ml->ml_name);
    return NULL;
}
static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
}
static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
    PyObject *result;
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
    if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
        Py_ssize_t argc;
        PyObject *new_args;
        PyObject *self;
        argc = PyTuple_GET_SIZE(args);
        new_args = PyTuple_GetSlice(args, 1, argc);
        if (unlikely(!new_args))
            return NULL;
        self = PyTuple_GetItem(args, 0);
        if (unlikely(!self)) {
            Py_DECREF(new_args);
            return NULL;
        }
        result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
        Py_DECREF(new_args);
    } else {
        result = __Pyx_CyFunction_Call(func, args, kw);
    }
    return result;
}
static PyTypeObject __pyx_CyFunctionType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "cython_function_or_method",
    sizeof(__pyx_CyFunctionObject),
    0,
    (destructor) __Pyx_CyFunction_dealloc,
    0,
    0,
    0,
#if PY_MAJOR_VERSION < 3
    0,
#else
    0,
#endif
    (reprfunc) __Pyx_CyFunction_repr,
    0,
    0,
    0,
    0,
    __Pyx_CyFunction_CallAsMethod,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
    0,
    (traverseproc) __Pyx_CyFunction_traverse,
    (inquiry) __Pyx_CyFunction_clear,
    0,
#if PY_VERSION_HEX < 0x030500A0
    offsetof(__pyx_CyFunctionObject, func_weakreflist),
#else
    offsetof(PyCFunctionObject, m_weakreflist),
#endif
    0,
    0,
    __pyx_CyFunction_methods,
    __pyx_CyFunction_members,
    __pyx_CyFunction_getsets,
    0,
    0,
    __Pyx_CyFunction_descr_get,
    0,
    offsetof(__pyx_CyFunctionObject, func_dict),
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if PY_VERSION_HEX >= 0x030400a1
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b1
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
    0,
#endif
};
static int __pyx_CyFunction_init(void) {
    __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
    if (unlikely(__pyx_CyFunctionType == NULL)) {
        return -1;
    }
    return 0;
}
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults = PyObject_Malloc(size);
    if (unlikely(!m->defaults))
        return PyErr_NoMemory();
    memset(m->defaults, 0, size);
    m->defaults_pyobjects = pyobjects;
    m->defaults_size = size;
    return m->defaults;
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_tuple = tuple;
    Py_INCREF(tuple);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_kwdict = dict;
    Py_INCREF(dict);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->func_annotations = dict;
    Py_INCREF(dict);
}

/* CythonFunction */
static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
                                      PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
    PyObject *op = __Pyx_CyFunction_Init(
        PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
        ml, flags, qualname, closure, module, globals, code
    );
    if (likely(op)) {
        PyObject_GC_Track(op);
    }
    return op;
}

/* PyErrExceptionMatches */
#if CYTHON_FAST_THREAD_STATE
static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    n = PyTuple_GET_SIZE(tuple);
#if PY_MAJOR_VERSION >= 3
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
#endif
    for (i=0; i<n; i++) {
        if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
    PyObject *exc_type = tstate->curexc_type;
    if (exc_type == err) return 1;
    if (unlikely(!exc_type)) return 0;
    if (unlikely(PyTuple_Check(err)))
        return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
    return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
}
#endif

/* PyFloatBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_AddObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) {
    const double b = floatval;
    double a, result;
    (void)inplace;
    (void)zerodivision_check;
    if (likely(PyFloat_CheckExact(op1))) {
        a = PyFloat_AS_DOUBLE(op1);
        
    } else
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        a = (double) PyInt_AS_LONG(op1);
        
    } else
    #endif
    if (likely(PyLong_CheckExact(op1))) {
        #if CYTHON_USE_PYLONG_INTERNALS
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        switch (size) {
            case  0: a = 0.0; break;
            case -1: a = -(double) digits[0]; break;
            case  1: a = (double) digits[0]; break;
            case -2:
            case 2:
                if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
                    a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -2)
                            a = -a;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -3:
            case 3:
                if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
                    a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -3)
                            a = -a;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -4:
            case 4:
                if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
                    a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -4)
                            a = -a;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            default:
        #else
        {
        #endif
            a = PyLong_AsDouble(op1);
            if (unlikely(a == -1.0 && PyErr_Occurred())) return NULL;
            
        }
    } else {
        return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
    }
        
        PyFPE_START_PROTECT("add", return NULL)
        result = a + b;
        PyFPE_END_PROTECT(result)
        return PyFloat_FromDouble(result);
}
#endif

/* py_abs */
  #if CYTHON_USE_PYLONG_INTERNALS
static PyObject *__Pyx_PyLong_AbsNeg(PyObject *n) {
    if (likely(Py_SIZE(n) == -1)) {
        return PyLong_FromLong(((PyLongObject*)n)->ob_digit[0]);
    }
#if CYTHON_COMPILING_IN_CPYTHON
    {
        PyObject *copy = _PyLong_Copy((PyLongObject*)n);
        if (likely(copy)) {
            __Pyx_SET_SIZE(copy, -Py_SIZE(copy));
        }
        return copy;
    }
#else
    return PyNumber_Negative(n);
#endif
}
#endif

/* PyIntBinop */
  #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            x = (long)((unsigned long)a - b);
            if (likely((x^a) >= 0 || (x^~b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
            }
        }
                x = a - b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla - llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            PyFPE_START_PROTECT("subtract", return NULL)
            result = ((double)a) - (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
}
#endif

/* PyIntCompare */
  static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) {
    if (op1 == op2) {
        Py_RETURN_TRUE;
    }
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long a = PyInt_AS_LONG(op1);
        if (a == b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        int unequal;
        unsigned long uintval;
        Py_ssize_t size = Py_SIZE(op1);
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        if (intval == 0) {
            if (size == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
        } else if (intval < 0) {
            if (size >= 0)
                Py_RETURN_FALSE;
            intval = -intval;
            size = -size;
        } else {
            if (size <= 0)
                Py_RETURN_FALSE;
        }
        uintval = (unsigned long) intval;
#if PyLong_SHIFT * 4 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 4)) {
            unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 3 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 3)) {
            unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 2 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 2)) {
            unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 1 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 1)) {
            unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
            unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
        if (unequal == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
        if ((double)a == (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
    }
    return (
        PyObject_RichCompare(op1, op2, Py_EQ));
}

/* PyIntBinop */
  #if !CYTHON_COMPILING_IN_PYPY
#if PY_MAJOR_VERSION < 3 || CYTHON_USE_PYLONG_INTERNALS
#define __Pyx_PyInt_TrueDivideObjC_ZeroDivisionError(operand)\
    if (unlikely(zerodivision_check && ((operand) == 0))) {\
        PyErr_SetString(PyExc_ZeroDivisionError, "integer division by zero");\
        return NULL;\
    }
#endif
static PyObject* __Pyx_PyInt_TrueDivideObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long a = PyInt_AS_LONG(op1);
            __Pyx_PyInt_TrueDivideObjC_ZeroDivisionError(b)
            if (8 * sizeof(long) <= 53 || likely(labs(a) <= ((PY_LONG_LONG)1 << 53))) {
                return PyFloat_FromDouble((double)a / (double)b);
            }
            return PyInt_Type.tp_as_number->nb_true_divide(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT && 1 * PyLong_SHIFT < 53) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT && 1 * PyLong_SHIFT < 53) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT && 2 * PyLong_SHIFT < 53) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT && 2 * PyLong_SHIFT < 53) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT && 3 * PyLong_SHIFT < 53) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT && 3 * PyLong_SHIFT < 53) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_true_divide(op1, op2);
            }
        }
                __Pyx_PyInt_TrueDivideObjC_ZeroDivisionError(b)
                if ((8 * sizeof(long) <= 53 || likely(labs(a) <= ((PY_LONG_LONG)1 << 53)))
                        || __Pyx_sst_abs(size) <= 52 / PyLong_SHIFT) {
                    return PyFloat_FromDouble((double)a / (double)b);
                }
                return PyLong_Type.tp_as_number->nb_true_divide(op1, op2);
            return PyLong_FromLong(x);
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            if (unlikely(zerodivision_check && b == 0)) {
                PyErr_SetString(PyExc_ZeroDivisionError, "float division by zero");
                return NULL;
            }
            PyFPE_START_PROTECT("divide", return NULL)
            result = ((double)a) / (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceTrueDivide : PyNumber_TrueDivide)(op1, op2);
}
#endif

/* CallUnboundCMethod2 */
  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1
static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) {
    if (likely(cfunc->func)) {
        PyObject *args[2] = {arg1, arg2};
        if (cfunc->flag == METH_FASTCALL) {
            #if PY_VERSION_HEX >= 0x030700A0
            return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, args, 2);
            #else
            return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL);
            #endif
        }
        #if PY_VERSION_HEX >= 0x030700A0
        if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS))
            return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL);
        #endif
    }
    return __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2);
}
#endif
static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){
    PyObject *args, *result = NULL;
    if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_COMPILING_IN_CPYTHON
    if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
        args = PyTuple_New(2);
        if (unlikely(!args)) goto bad;
        Py_INCREF(arg1);
        PyTuple_SET_ITEM(args, 0, arg1);
        Py_INCREF(arg2);
        PyTuple_SET_ITEM(args, 1, arg2);
        if (cfunc->flag & METH_KEYWORDS)
            result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL);
        else
            result = (*cfunc->func)(self, args);
    } else {
        args = PyTuple_New(3);
        if (unlikely(!args)) goto bad;
        Py_INCREF(self);
        PyTuple_SET_ITEM(args, 0, self);
        Py_INCREF(arg1);
        PyTuple_SET_ITEM(args, 1, arg1);
        Py_INCREF(arg2);
        PyTuple_SET_ITEM(args, 2, arg2);
        result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
    }
#else
    args = PyTuple_Pack(3, self, arg1, arg2);
    if (unlikely(!args)) goto bad;
    result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
#endif
bad:
    Py_XDECREF(args);
    return result;
}

/* dict_getitem_default */
  static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) {
    PyObject* value;
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (unlikely(PyErr_Occurred()))
            return NULL;
        value = default_value;
    }
    Py_INCREF(value);
    if ((1));
#else
    if (PyString_CheckExact(key) || PyUnicode_CheckExact(key) || PyInt_CheckExact(key)) {
        value = PyDict_GetItem(d, key);
        if (unlikely(!value)) {
            value = default_value;
        }
        Py_INCREF(value);
    }
#endif
    else {
        if (default_value == Py_None)
            value = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_get, d, key);
        else
            value = __Pyx_CallUnboundCMethod2(&__pyx_umethod_PyDict_Type_get, d, key, default_value);
    }
    return value;
}

/* PyFloatBinop */
  #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_AddCObj(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) {
    const double a = floatval;
    double b, result;
    (void)inplace;
    (void)zerodivision_check;
    if (likely(PyFloat_CheckExact(op2))) {
        b = PyFloat_AS_DOUBLE(op2);
        
    } else
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op2))) {
        b = (double) PyInt_AS_LONG(op2);
        
    } else
    #endif
    if (likely(PyLong_CheckExact(op2))) {
        #if CYTHON_USE_PYLONG_INTERNALS
        const digit* digits = ((PyLongObject*)op2)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op2);
        switch (size) {
            case  0: b = 0.0; break;
            case -1: b = -(double) digits[0]; break;
            case  1: b = (double) digits[0]; break;
            case -2:
            case 2:
                if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
                    b = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -2)
                            b = -b;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -3:
            case 3:
                if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
                    b = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -3)
                            b = -b;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -4:
            case 4:
                if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
                    b = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -4)
                            b = -b;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            default:
        #else
        {
        #endif
            b = PyLong_AsDouble(op2);
            if (unlikely(b == -1.0 && PyErr_Occurred())) return NULL;
            
        }
    } else {
        return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
    }
        
        PyFPE_START_PROTECT("add", return NULL)
        result = a + b;
        PyFPE_END_PROTECT(result)
        return PyFloat_FromDouble(result);
}
#endif

/* JoinPyUnicode */
    static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength,
                                      CYTHON_UNUSED Py_UCS4 max_char) {
#if CYTHON_USE_UNICODE_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    PyObject *result_uval;
    int result_ukind;
    Py_ssize_t i, char_pos;
    void *result_udata;
#if CYTHON_PEP393_ENABLED
    result_uval = PyUnicode_New(result_ulength, max_char);
    if (unlikely(!result_uval)) return NULL;
    result_ukind = (max_char <= 255) ? PyUnicode_1BYTE_KIND : (max_char <= 65535) ? PyUnicode_2BYTE_KIND : PyUnicode_4BYTE_KIND;
    result_udata = PyUnicode_DATA(result_uval);
#else
    result_uval = PyUnicode_FromUnicode(NULL, result_ulength);
    if (unlikely(!result_uval)) return NULL;
    result_ukind = sizeof(Py_UNICODE);
    result_udata = PyUnicode_AS_UNICODE(result_uval);
#endif
    char_pos = 0;
    for (i=0; i < value_count; i++) {
        int ukind;
        Py_ssize_t ulength;
        void *udata;
        PyObject *uval = PyTuple_GET_ITEM(value_tuple, i);
        if (unlikely(__Pyx_PyUnicode_READY(uval)))
            goto bad;
        ulength = __Pyx_PyUnicode_GET_LENGTH(uval);
        if (unlikely(!ulength))
            continue;
        if (unlikely(char_pos + ulength < 0))
            goto overflow;
        ukind = __Pyx_PyUnicode_KIND(uval);
        udata = __Pyx_PyUnicode_DATA(uval);
        if (!CYTHON_PEP393_ENABLED || ukind == result_ukind) {
            memcpy((char *)result_udata + char_pos * result_ukind, udata, (size_t) (ulength * result_ukind));
        } else {
            #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030300F0 || defined(_PyUnicode_FastCopyCharacters)
            _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength);
            #else
            Py_ssize_t j;
            for (j=0; j < ulength; j++) {
                Py_UCS4 uchar = __Pyx_PyUnicode_READ(ukind, udata, j);
                __Pyx_PyUnicode_WRITE(result_ukind, result_udata, char_pos+j, uchar);
            }
            #endif
        }
        char_pos += ulength;
    }
    return result_uval;
overflow:
    PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string");
bad:
    Py_DECREF(result_uval);
    return NULL;
#else
    result_ulength++;
    value_count++;
    return PyUnicode_Join(__pyx_empty_unicode, value_tuple);
#endif
}

/* RaiseException */
    #if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                        CYTHON_UNUSED PyObject *cause) {
    __Pyx_PyThreadState_declare
    Py_XINCREF(type);
    if (!value || value == Py_None)
        value = NULL;
    else
        Py_INCREF(value);
    if (!tb || tb == Py_None)
        tb = NULL;
    else {
        Py_INCREF(tb);
        if (!PyTraceBack_Check(tb)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: arg 3 must be a traceback or None");
            goto raise_error;
        }
    }
    if (PyType_Check(type)) {
#if CYTHON_COMPILING_IN_PYPY
        if (!value) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#endif
        PyErr_NormalizeException(&type, &value, &tb);
    } else {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        value = type;
        type = (PyObject*) Py_TYPE(type);
        Py_INCREF(type);
        if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: exception class must be a subclass of BaseException");
            goto raise_error;
        }
    }
    __Pyx_PyThreadState_assign
    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}
#else
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    PyObject* owned_instance = NULL;
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (PyExceptionClass_Check(type)) {
        PyObject *instance_class = NULL;
        if (value && PyExceptionInstance_Check(value)) {
            instance_class = (PyObject*) Py_TYPE(value);
            if (instance_class != type) {
                int is_subclass = PyObject_IsSubclass(instance_class, type);
                if (!is_subclass) {
                    instance_class = NULL;
                } else if (unlikely(is_subclass == -1)) {
                    goto bad;
                } else {
                    type = instance_class;
                }
            }
        }
        if (!instance_class) {
            PyObject *args;
            if (!value)
                args = PyTuple_New(0);
            else if (PyTuple_Check(value)) {
                Py_INCREF(value);
                args = value;
            } else
                args = PyTuple_Pack(1, value);
            if (!args)
                goto bad;
            owned_instance = PyObject_Call(type, args, NULL);
            Py_DECREF(args);
            if (!owned_instance)
                goto bad;
            value = owned_instance;
            if (!PyExceptionInstance_Check(value)) {
                PyErr_Format(PyExc_TypeError,
                             "calling %R should have returned an instance of "
                             "BaseException, not %R",
                             type, Py_TYPE(value));
                goto bad;
            }
        }
    } else {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
    if (cause) {
        PyObject *fixed_cause;
        if (cause == Py_None) {
            fixed_cause = NULL;
        } else if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        } else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        } else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
#if CYTHON_COMPILING_IN_PYPY
        PyObject *tmp_type, *tmp_value, *tmp_tb;
        PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
        Py_INCREF(tb);
        PyErr_Restore(tmp_type, tmp_value, tb);
        Py_XDECREF(tmp_tb);
#else
        PyThreadState *tstate = __Pyx_PyThreadState_Current;
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
#endif
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}
#endif

/* PyFloatBinop */
    #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_SubtractCObj(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) {
    const double a = floatval;
    double b, result;
    (void)inplace;
    (void)zerodivision_check;
    if (likely(PyFloat_CheckExact(op2))) {
        b = PyFloat_AS_DOUBLE(op2);
        
    } else
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op2))) {
        b = (double) PyInt_AS_LONG(op2);
        
    } else
    #endif
    if (likely(PyLong_CheckExact(op2))) {
        #if CYTHON_USE_PYLONG_INTERNALS
        const digit* digits = ((PyLongObject*)op2)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op2);
        switch (size) {
            case  0: b = 0.0; break;
            case -1: b = -(double) digits[0]; break;
            case  1: b = (double) digits[0]; break;
            case -2:
            case 2:
                if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
                    b = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -2)
                            b = -b;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -3:
            case 3:
                if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
                    b = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -3)
                            b = -b;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -4:
            case 4:
                if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
                    b = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -4)
                            b = -b;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            default:
        #else
        {
        #endif
            b = PyLong_AsDouble(op2);
            if (unlikely(b == -1.0 && PyErr_Occurred())) return NULL;
            
        }
    } else {
        return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
    }
        
        PyFPE_START_PROTECT("subtract", return NULL)
        result = a - b;
        PyFPE_END_PROTECT(result)
        return PyFloat_FromDouble(result);
}
#endif

/* KeywordStringCheck */
      static int __Pyx_CheckKeywordStrings(
    PyObject *kwdict,
    const char* function_name,
    int kw_allowed)
{
    PyObject* key = 0;
    Py_ssize_t pos = 0;
#if CYTHON_COMPILING_IN_PYPY
    if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0))
        goto invalid_keyword;
    return 1;
#else
    while (PyDict_Next(kwdict, &pos, &key, 0)) {
        #if PY_MAJOR_VERSION < 3
        if (unlikely(!PyString_Check(key)))
        #endif
            if (unlikely(!PyUnicode_Check(key)))
                goto invalid_keyword_type;
    }
    if ((!kw_allowed) && unlikely(key))
        goto invalid_keyword;
    return 1;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    return 0;
#endif
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
    return 0;
}

/* SliceObject */
      static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
        Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
        int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
#if CYTHON_USE_TYPE_SLOTS
    PyMappingMethods* mp;
#if PY_MAJOR_VERSION < 3
    PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
    if (likely(ms && ms->sq_slice)) {
        if (!has_cstart) {
            if (_py_start && (*_py_start != Py_None)) {
                cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
                if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstart = 0;
        }
        if (!has_cstop) {
            if (_py_stop && (*_py_stop != Py_None)) {
                cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
                if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstop = PY_SSIZE_T_MAX;
        }
        if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
            Py_ssize_t l = ms->sq_length(obj);
            if (likely(l >= 0)) {
                if (cstop < 0) {
                    cstop += l;
                    if (cstop < 0) cstop = 0;
                }
                if (cstart < 0) {
                    cstart += l;
                    if (cstart < 0) cstart = 0;
                }
            } else {
                if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                    goto bad;
                PyErr_Clear();
            }
        }
        return ms->sq_slice(obj, cstart, cstop);
    }
#endif
    mp = Py_TYPE(obj)->tp_as_mapping;
    if (likely(mp && mp->mp_subscript))
#endif
    {
        PyObject* result;
        PyObject *py_slice, *py_start, *py_stop;
        if (_py_slice) {
            py_slice = *_py_slice;
        } else {
            PyObject* owned_start = NULL;
            PyObject* owned_stop = NULL;
            if (_py_start) {
                py_start = *_py_start;
            } else {
                if (has_cstart) {
                    owned_start = py_start = PyInt_FromSsize_t(cstart);
                    if (unlikely(!py_start)) goto bad;
                } else
                    py_start = Py_None;
            }
            if (_py_stop) {
                py_stop = *_py_stop;
            } else {
                if (has_cstop) {
                    owned_stop = py_stop = PyInt_FromSsize_t(cstop);
                    if (unlikely(!py_stop)) {
                        Py_XDECREF(owned_start);
                        goto bad;
                    }
                } else
                    py_stop = Py_None;
            }
            py_slice = PySlice_New(py_start, py_stop, Py_None);
            Py_XDECREF(owned_start);
            Py_XDECREF(owned_stop);
            if (unlikely(!py_slice)) goto bad;
        }
#if CYTHON_USE_TYPE_SLOTS
        result = mp->mp_subscript(obj, py_slice);
#else
        result = PyObject_GetItem(obj, py_slice);
#endif
        if (!_py_slice) {
            Py_DECREF(py_slice);
        }
        return result;
    }
    PyErr_Format(PyExc_TypeError,
        "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
bad:
    return NULL;
}

/* DictGetItem */
      #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (!PyErr_Occurred()) {
            if (unlikely(PyTuple_Check(key))) {
                PyObject* args = PyTuple_Pack(1, key);
                if (likely(args)) {
                    PyErr_SetObject(PyExc_KeyError, args);
                    Py_DECREF(args);
                }
            } else {
                PyErr_SetObject(PyExc_KeyError, key);
            }
        }
        return NULL;
    }
    Py_INCREF(value);
    return value;
}
#endif

/* PyNumberPow2 */
      static PyObject* __Pyx__PyNumber_PowerOf2(PyObject *two, PyObject *exp, PyObject *none, int inplace) {
#if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t shiftby;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(exp))) {
        shiftby = PyInt_AS_LONG(exp);
    } else
#endif
    if (likely(PyLong_CheckExact(exp))) {
        #if CYTHON_USE_PYLONG_INTERNALS
        const Py_ssize_t size = Py_SIZE(exp);
        if (likely(size == 1)) {
            shiftby = ((PyLongObject*)exp)->ob_digit[0];
        } else if (size == 0) {
            return PyInt_FromLong(1L);
        } else if (unlikely(size < 0)) {
            goto fallback;
        } else {
            shiftby = PyLong_AsSsize_t(exp);
        }
        #else
        shiftby = PyLong_AsSsize_t(exp);
        #endif
    } else {
        goto fallback;
    }
    if (likely(shiftby >= 0)) {
        if ((size_t)shiftby <= sizeof(long) * 8 - 2) {
            long value = 1L << shiftby;
            return PyInt_FromLong(value);
#ifdef HAVE_LONG_LONG
        } else if ((size_t)shiftby <= sizeof(unsigned PY_LONG_LONG) * 8 - 1) {
            unsigned PY_LONG_LONG value = ((unsigned PY_LONG_LONG)1) << shiftby;
            return PyLong_FromUnsignedLongLong(value);
#endif
        } else {
            PyObject *result, *one = PyInt_FromLong(1L);
            if (unlikely(!one)) return NULL;
            result = PyNumber_Lshift(one, exp);
            Py_DECREF(one);
            return result;
        }
    } else if (shiftby == -1 && PyErr_Occurred()) {
        PyErr_Clear();
    }
fallback:
#endif
    return (inplace ? PyNumber_InPlacePower : PyNumber_Power)(two, exp, none);
}

/* Import */
      static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    #if PY_MAJOR_VERSION < 3
    PyObject *py_import;
    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
    if (!py_import)
        goto bad;
    #endif
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    {
        #if PY_MAJOR_VERSION >= 3
        if (level == -1) {
            if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
                module = PyImport_ImportModuleLevelObject(
                    name, global_dict, empty_dict, list, 1);
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0;
        }
        #endif
        if (!module) {
            #if PY_MAJOR_VERSION < 3
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
            Py_DECREF(py_level);
            #else
            module = PyImport_ImportModuleLevelObject(
                name, global_dict, empty_dict, list, level);
            #endif
        }
    }
bad:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(py_import);
    #endif
    Py_XDECREF(empty_list);
    Py_XDECREF(empty_dict);
    return module;
}

/* ImportFrom */
      static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
    PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
    if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Format(PyExc_ImportError,
        #if PY_MAJOR_VERSION < 3
            "cannot import name %.230s", PyString_AS_STRING(name));
        #else
            "cannot import name %S", name);
        #endif
    }
    return value;
}

/* PyIntBinop */
      #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            x = (long)((unsigned long)a + b);
            if (likely((x^a) >= 0 || (x^b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_add(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
            }
        }
                x = a + b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla + llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            PyFPE_START_PROTECT("add", return NULL)
            result = ((double)a) + (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
}
#endif

/* PyFloatBinop */
      #if !CYTHON_COMPILING_IN_PYPY
#define __Pyx_PyFloat_TrueDivideCObj_ZeroDivisionError(operand) if (unlikely(zerodivision_check && ((operand) == 0))) {\
    PyErr_SetString(PyExc_ZeroDivisionError, "float division by zero");\
    return NULL;\
}
static PyObject* __Pyx_PyFloat_TrueDivideCObj(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) {
    const double a = floatval;
    double b, result;
    (void)inplace;
    (void)zerodivision_check;
    if (likely(PyFloat_CheckExact(op2))) {
        b = PyFloat_AS_DOUBLE(op2);
        __Pyx_PyFloat_TrueDivideCObj_ZeroDivisionError(b)
    } else
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op2))) {
        b = (double) PyInt_AS_LONG(op2);
        __Pyx_PyFloat_TrueDivideCObj_ZeroDivisionError(b)
    } else
    #endif
    if (likely(PyLong_CheckExact(op2))) {
        #if CYTHON_USE_PYLONG_INTERNALS
        const digit* digits = ((PyLongObject*)op2)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op2);
        switch (size) {
            case  0: __Pyx_PyFloat_TrueDivideCObj_ZeroDivisionError(0) break;
            case -1: b = -(double) digits[0]; break;
            case  1: b = (double) digits[0]; break;
            case -2:
            case 2:
                if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
                    b = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -2)
                            b = -b;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -3:
            case 3:
                if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
                    b = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -3)
                            b = -b;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            case -4:
            case 4:
                if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
                    b = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -4)
                            b = -b;
                        break;
                    }
                }
                CYTHON_FALLTHROUGH;
            default:
        #else
        {
        #endif
            b = PyLong_AsDouble(op2);
            if (unlikely(b == -1.0 && PyErr_Occurred())) return NULL;
            __Pyx_PyFloat_TrueDivideCObj_ZeroDivisionError(b)
        }
    } else {
        return (inplace ? PyNumber_InPlaceTrueDivide : PyNumber_TrueDivide)(op1, op2);
    }
        __Pyx_PyFloat_TrueDivideCObj_ZeroDivisionError(b)
        PyFPE_START_PROTECT("divide", return NULL)
        result = a / b;
        PyFPE_END_PROTECT(result)
        return PyFloat_FromDouble(result);
}
#endif

/* PyIntBinop */
        #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_SubtractCObj(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op2))) {
        const long a = intval;
        long x;
        long b = PyInt_AS_LONG(op2);
            x = (long)((unsigned long)a - b);
            if (likely((x^a) >= 0 || (x^~b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op2))) {
        const long a = intval;
        long b, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG lla = intval;
        PY_LONG_LONG llb, llx;
#endif
        const digit* digits = ((PyLongObject*)op2)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op2);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            b = likely(size) ? digits[0] : 0;
            if (size == -1) b = -b;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        b = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        llb = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        b = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        llb = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        b = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        llb = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        b = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        llb = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        b = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        llb = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        b = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        llb = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
            }
        }
                x = a - b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla - llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op2)) {
        const long a = intval;
        double b = PyFloat_AS_DOUBLE(op2);
            double result;
            PyFPE_START_PROTECT("subtract", return NULL)
            result = ((double)a) - (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
}
#endif

/* MergeKeywords */
        static int __Pyx_MergeKeywords(PyObject *kwdict, PyObject *source_mapping) {
    PyObject *iter, *key = NULL, *value = NULL;
    int source_is_dict, result;
    Py_ssize_t orig_length, ppos = 0;
    iter = __Pyx_dict_iterator(source_mapping, 0, __pyx_n_s_items, &orig_length, &source_is_dict);
    if (unlikely(!iter)) {
        PyObject *args;
        if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
        PyErr_Clear();
        args = PyTuple_Pack(1, source_mapping);
        if (likely(args)) {
            PyObject *fallback = PyObject_Call((PyObject*)&PyDict_Type, args, NULL);
            Py_DECREF(args);
            if (likely(fallback)) {
                iter = __Pyx_dict_iterator(fallback, 1, __pyx_n_s_items, &orig_length, &source_is_dict);
                Py_DECREF(fallback);
            }
        }
        if (unlikely(!iter)) goto bad;
    }
    while (1) {
        result = __Pyx_dict_iter_next(iter, orig_length, &ppos, &key, &value, NULL, source_is_dict);
        if (unlikely(result < 0)) goto bad;
        if (!result) break;
        if (unlikely(PyDict_Contains(kwdict, key))) {
            __Pyx_RaiseDoubleKeywordsError("function", key);
            result = -1;
        } else {
            result = PyDict_SetItem(kwdict, key, value);
        }
        Py_DECREF(key);
        Py_DECREF(value);
        if (unlikely(result < 0)) goto bad;
    }
    Py_XDECREF(iter);
    return 0;
bad:
    Py_XDECREF(iter);
    return -1;
}

/* None */
        static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
}

/* IterNext */
        static PyObject *__Pyx_PyIter_Next2Default(PyObject* defval) {
    PyObject* exc_type;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    exc_type = __Pyx_PyErr_Occurred();
    if (unlikely(exc_type)) {
        if (!defval || unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))
            return NULL;
        __Pyx_PyErr_Clear();
        Py_INCREF(defval);
        return defval;
    }
    if (defval) {
        Py_INCREF(defval);
        return defval;
    }
    __Pyx_PyErr_SetNone(PyExc_StopIteration);
    return NULL;
}
static void __Pyx_PyIter_Next_ErrorNoIterator(PyObject *iterator) {
    PyErr_Format(PyExc_TypeError,
        "%.200s object is not an iterator", Py_TYPE(iterator)->tp_name);
}
static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject* defval) {
    PyObject* next;
    iternextfunc iternext = Py_TYPE(iterator)->tp_iternext;
    if (likely(iternext)) {
#if CYTHON_USE_TYPE_SLOTS
        next = iternext(iterator);
        if (likely(next))
            return next;
        #if PY_VERSION_HEX >= 0x02070000
        if (unlikely(iternext == &_PyObject_NextNotImplemented))
            return NULL;
        #endif
#else
        next = PyIter_Next(iterator);
        if (likely(next))
            return next;
#endif
    } else if (CYTHON_USE_TYPE_SLOTS || unlikely(!PyIter_Check(iterator))) {
        __Pyx_PyIter_Next_ErrorNoIterator(iterator);
        return NULL;
    }
#if !CYTHON_USE_TYPE_SLOTS
    else {
        next = PyIter_Next(iterator);
        if (likely(next))
            return next;
    }
#endif
    return __Pyx_PyIter_Next2Default(defval);
}

/* PyIntBinop */
        #if !CYTHON_COMPILING_IN_PYPY
#if PY_MAJOR_VERSION < 3 || CYTHON_USE_PYLONG_INTERNALS
#define __Pyx_PyInt_RemainderObjC_ZeroDivisionError(operand)\
    if (unlikely(zerodivision_check && ((operand) == 0))) {\
        PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");\
        return NULL;\
    }
#endif
static PyObject* __Pyx_PyInt_RemainderObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            __Pyx_PyInt_RemainderObjC_ZeroDivisionError(b)
            x = a % b;
            x += ((x != 0) & ((x ^ b) < 0)) * b;
            return PyInt_FromLong(x);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_remainder(op1, op2);
            }
        }
                __Pyx_PyInt_RemainderObjC_ZeroDivisionError(b)
                x = a % b;
                x += ((x != 0) & ((x ^ b) < 0)) * b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla % llb;
                llx += ((llx != 0) & ((llx ^ llb) < 0)) * llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    return (inplace ? PyNumber_InPlaceRemainder : PyNumber_Remainder)(op1, op2);
}
#endif

/* unicode_iter */
        static CYTHON_INLINE int __Pyx_init_unicode_iteration(
    PyObject* ustring, Py_ssize_t *length, void** data, int *kind) {
#if CYTHON_PEP393_ENABLED
    if (unlikely(__Pyx_PyUnicode_READY(ustring) < 0)) return -1;
    *kind   = PyUnicode_KIND(ustring);
    *length = PyUnicode_GET_LENGTH(ustring);
    *data   = PyUnicode_DATA(ustring);
#else
    *kind   = 0;
    *length = PyUnicode_GET_SIZE(ustring);
    *data   = (void*)PyUnicode_AS_UNICODE(ustring);
#endif
    return 0;
}

/* DelItemInt */
        static int __Pyx_DelItem_Generic(PyObject *o, PyObject *j) {
    int r;
    if (!j) return -1;
    r = PyObject_DelItem(o, j);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE int __Pyx_DelItemInt_Fast(PyObject *o, Py_ssize_t i,
                                               CYTHON_UNUSED int is_list, CYTHON_NCP_UNUSED int wraparound) {
#if !CYTHON_USE_TYPE_SLOTS
    if (is_list || PySequence_Check(o)) {
        return PySequence_DelItem(o, i);
    }
#else
    PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
    if (likely(m && m->sq_ass_item)) {
        if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
            Py_ssize_t l = m->sq_length(o);
            if (likely(l >= 0)) {
                i += l;
            } else {
                if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                    return -1;
                PyErr_Clear();
            }
        }
        return m->sq_ass_item(o, i, (PyObject *)NULL);
    }
#endif
    return __Pyx_DelItem_Generic(o, PyInt_FromSsize_t(i));
}

/* SliceTupleAndList */
        #if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE void __Pyx_crop_slice(Py_ssize_t* _start, Py_ssize_t* _stop, Py_ssize_t* _length) {
    Py_ssize_t start = *_start, stop = *_stop, length = *_length;
    if (start < 0) {
        start += length;
        if (start < 0)
            start = 0;
    }
    if (stop < 0)
        stop += length;
    else if (stop > length)
        stop = length;
    *_length = stop - start;
    *_start = start;
    *_stop = stop;
}
static CYTHON_INLINE void __Pyx_copy_object_array(PyObject** CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) {
    PyObject *v;
    Py_ssize_t i;
    for (i = 0; i < length; i++) {
        v = dest[i] = src[i];
        Py_INCREF(v);
    }
}
static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(
            PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
    PyObject* dest;
    Py_ssize_t length = PyList_GET_SIZE(src);
    __Pyx_crop_slice(&start, &stop, &length);
    if (unlikely(length <= 0))
        return PyList_New(0);
    dest = PyList_New(length);
    if (unlikely(!dest))
        return NULL;
    __Pyx_copy_object_array(
        ((PyListObject*)src)->ob_item + start,
        ((PyListObject*)dest)->ob_item,
        length);
    return dest;
}
static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(
            PyObject* src, Py_ssize_t start, Py_ssize_t stop) {
    PyObject* dest;
    Py_ssize_t length = PyTuple_GET_SIZE(src);
    __Pyx_crop_slice(&start, &stop, &length);
    if (unlikely(length <= 0))
        return PyTuple_New(0);
    dest = PyTuple_New(length);
    if (unlikely(!dest))
        return NULL;
    __Pyx_copy_object_array(
        ((PyTupleObject*)src)->ob_item + start,
        ((PyTupleObject*)dest)->ob_item,
        length);
    return dest;
}
#endif

/* PyObjectCallMethod1 */
        static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
    PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
    Py_DECREF(method);
    return result;
}
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
    PyObject *method = NULL, *result;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_Call2Args(method, obj, arg);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) return NULL;
    return __Pyx__PyObject_CallMethod1(method, arg);
}

/* append */
        static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
    if (likely(PyList_CheckExact(L))) {
        if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1;
    } else {
        PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x);
        if (unlikely(!retval))
            return -1;
        Py_DECREF(retval);
    }
    return 0;
}

/* PyObjectSetAttrStr */
        #if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_setattro))
        return tp->tp_setattro(obj, attr_name, value);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_setattr))
        return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
#endif
    return PyObject_SetAttr(obj, attr_name, value);
}
#endif

/* PyObject_GenericGetAttrNoDict */
        #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
    PyErr_Format(PyExc_AttributeError,
#if PY_MAJOR_VERSION >= 3
                 "'%.50s' object has no attribute '%U'",
                 tp->tp_name, attr_name);
#else
                 "'%.50s' object has no attribute '%.400s'",
                 tp->tp_name, PyString_AS_STRING(attr_name));
#endif
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
    PyObject *descr;
    PyTypeObject *tp = Py_TYPE(obj);
    if (unlikely(!PyString_Check(attr_name))) {
        return PyObject_GenericGetAttr(obj, attr_name);
    }
    assert(!tp->tp_dictoffset);
    descr = _PyType_Lookup(tp, attr_name);
    if (unlikely(!descr)) {
        return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
    }
    Py_INCREF(descr);
    #if PY_MAJOR_VERSION < 3
    if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
    #endif
    {
        descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
        if (unlikely(f)) {
            PyObject *res = f(descr, obj, (PyObject *)tp);
            Py_DECREF(descr);
            return res;
        }
    }
    return descr;
}
#endif

/* CalculateMetaclass */
        static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
    Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
    for (i=0; i < nbases; i++) {
        PyTypeObject *tmptype;
        PyObject *tmp = PyTuple_GET_ITEM(bases, i);
        tmptype = Py_TYPE(tmp);
#if PY_MAJOR_VERSION < 3
        if (tmptype == &PyClass_Type)
            continue;
#endif
        if (!metaclass) {
            metaclass = tmptype;
            continue;
        }
        if (PyType_IsSubtype(metaclass, tmptype))
            continue;
        if (PyType_IsSubtype(tmptype, metaclass)) {
            metaclass = tmptype;
            continue;
        }
        PyErr_SetString(PyExc_TypeError,
                        "metaclass conflict: "
                        "the metaclass of a derived class "
                        "must be a (non-strict) subclass "
                        "of the metaclasses of all its bases");
        return NULL;
    }
    if (!metaclass) {
#if PY_MAJOR_VERSION < 3
        metaclass = &PyClass_Type;
#else
        metaclass = &PyType_Type;
#endif
    }
    Py_INCREF((PyObject*) metaclass);
    return (PyObject*) metaclass;
}

/* Py3ClassCreate */
        static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
                                           PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
    PyObject *ns;
    if (metaclass) {
        PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
        if (prep) {
            PyObject *pargs = PyTuple_Pack(2, name, bases);
            if (unlikely(!pargs)) {
                Py_DECREF(prep);
                return NULL;
            }
            ns = PyObject_Call(prep, pargs, mkw);
            Py_DECREF(prep);
            Py_DECREF(pargs);
        } else {
            if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
                return NULL;
            PyErr_Clear();
            ns = PyDict_New();
        }
    } else {
        ns = PyDict_New();
    }
    if (unlikely(!ns))
        return NULL;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
    if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
    return ns;
bad:
    Py_DECREF(ns);
    return NULL;
}
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
                                      PyObject *dict, PyObject *mkw,
                                      int calculate_metaclass, int allow_py2_metaclass) {
    PyObject *result, *margs;
    PyObject *owned_metaclass = NULL;
    if (allow_py2_metaclass) {
        owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
        if (owned_metaclass) {
            metaclass = owned_metaclass;
        } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
            PyErr_Clear();
        } else {
            return NULL;
        }
    }
    if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
        metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
        Py_XDECREF(owned_metaclass);
        if (unlikely(!metaclass))
            return NULL;
        owned_metaclass = metaclass;
    }
    margs = PyTuple_Pack(3, name, bases, dict);
    if (unlikely(!margs)) {
        result = NULL;
    } else {
        result = PyObject_Call(metaclass, margs, mkw);
        Py_DECREF(margs);
    }
    Py_XDECREF(owned_metaclass);
    return result;
}

/* CyFunctionClassCell */
        static int __Pyx_CyFunction_InitClassCell(PyObject *cyfunctions, PyObject *classobj) {
    Py_ssize_t i, count = PyList_GET_SIZE(cyfunctions);
    for (i = 0; i < count; i++) {
        __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *)
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            PyList_GET_ITEM(cyfunctions, i);
#else
            PySequence_ITEM(cyfunctions, i);
        if (unlikely(!m))
            return -1;
#endif
        Py_INCREF(classobj);
        m->func_classobj = classobj;
#if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
        Py_DECREF((PyObject*)m);
#endif
    }
    return 0;
}

/* CLineInTraceback */
        #ifndef CYTHON_CLINE_IN_TRACEBACK
static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
    PyObject *use_cline;
    PyObject *ptype, *pvalue, *ptraceback;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject **cython_runtime_dict;
#endif
    if (unlikely(!__pyx_cython_runtime)) {
        return c_line;
    }
    __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
#if CYTHON_COMPILING_IN_CPYTHON
    cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
    if (likely(cython_runtime_dict)) {
        __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
            use_cline, *cython_runtime_dict,
            __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
    } else
#endif
    {
      PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
      if (use_cline_obj) {
        use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
        Py_DECREF(use_cline_obj);
      } else {
        PyErr_Clear();
        use_cline = NULL;
      }
    }
    if (!use_cline) {
        c_line = 0;
        PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
    }
    else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
        c_line = 0;
    }
    __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
    return c_line;
}
#endif

/* CodeObjectCache */
        static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = start + (end - start) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
    PyCodeObject* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = __pyx_code_cache.entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            __pyx_code_cache.entries = entries;
            __pyx_code_cache.max_count = 64;
            __pyx_code_cache.count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
        PyCodeObject* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_DECREF(tmp);
        return;
    }
    if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
        int new_max = __pyx_code_cache.max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        __pyx_code_cache.entries = entries;
        __pyx_code_cache.max_count = new_max;
    }
    for (i=__pyx_code_cache.count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    __pyx_code_cache.count++;
    Py_INCREF(code_object);
}

/* AddTraceback */
        #include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(filename);
    #else
    py_srcfile = PyUnicode_FromString(filename);
    #endif
    if (!py_srcfile) goto bad;
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_code = __Pyx_PyCode_New(
        0,
        0,
        0,
        0,
        0,
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple, /*PyObject *consts,*/
        __pyx_empty_tuple, /*PyObject *names,*/
        __pyx_empty_tuple, /*PyObject *varnames,*/
        __pyx_empty_tuple, /*PyObject *freevars,*/
        __pyx_empty_tuple, /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        py_line,
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    Py_DECREF(py_srcfile);
    Py_DECREF(py_funcname);
    return py_code;
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    if (c_line) {
        c_line = __Pyx_CLineForTraceback(tstate, c_line);
    }
    py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
    if (!py_code) {
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) goto bad;
        __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
    }
    py_frame = PyFrame_New(
        tstate,            /*PyThreadState *tstate,*/
        py_code,           /*PyCodeObject *code,*/
        __pyx_d,    /*PyObject *globals,*/
        0                  /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

/* CIntToPy */
        static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const long neg_one = (long) -1, const_zero = (long) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(long) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
    }
}

/* CIntFromPyVerify */
        #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
    {\
        func_type value = func_value;\
        if (sizeof(target_type) < sizeof(func_type)) {\
            if (unlikely(value != (func_type) (target_type) value)) {\
                func_type zero = 0;\
                if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
                    return (target_type) -1;\
                if (is_unsigned && unlikely(value < zero))\
                    goto raise_neg_overflow;\
                else\
                    goto raise_overflow;\
            }\
        }\
        return (target_type) value;\
    }

/* CIntFromPy */
        static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const long neg_one = (long) -1, const_zero = (long) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(long) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (long) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
                            return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
                            return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
                            return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (long) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(long) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(long) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            long val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (long) -1;
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (long) -1;
        val = __Pyx_PyInt_As_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to long");
    return (long) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to long");
    return (long) -1;
}

/* CIntFromPy */
        static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int neg_one = (int) -1, const_zero = (int) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(int) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
                            return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
                            return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
                            return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (int) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(int) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(int) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            int val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (int) -1;
        }
    } else {
        int val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (int) -1;
        val = __Pyx_PyInt_As_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int");
    return (int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int");
    return (int) -1;
}

/* SwapException */
        #if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = *type;
    exc_info->exc_value = *value;
    exc_info->exc_traceback = *tb;
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = *type;
    tstate->exc_value = *value;
    tstate->exc_traceback = *tb;
    #endif
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
    PyErr_SetExcInfo(*type, *value, *tb);
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#endif

/* CoroutineBase */
        #include <structmember.h>
#include <frameobject.h>
#define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom)
static int __Pyx_PyGen__FetchStopIterationValue(CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject **pvalue) {
    PyObject *et, *ev, *tb;
    PyObject *value = NULL;
    __Pyx_ErrFetch(&et, &ev, &tb);
    if (!et) {
        Py_XDECREF(tb);
        Py_XDECREF(ev);
        Py_INCREF(Py_None);
        *pvalue = Py_None;
        return 0;
    }
    if (likely(et == PyExc_StopIteration)) {
        if (!ev) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#if PY_VERSION_HEX >= 0x030300A0
        else if (Py_TYPE(ev) == (PyTypeObject*)PyExc_StopIteration) {
            value = ((PyStopIterationObject *)ev)->value;
            Py_INCREF(value);
            Py_DECREF(ev);
        }
#endif
        else if (unlikely(PyTuple_Check(ev))) {
            if (PyTuple_GET_SIZE(ev) >= 1) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                value = PyTuple_GET_ITEM(ev, 0);
                Py_INCREF(value);
#else
                value = PySequence_ITEM(ev, 0);
#endif
            } else {
                Py_INCREF(Py_None);
                value = Py_None;
            }
            Py_DECREF(ev);
        }
        else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) {
            value = ev;
        }
        if (likely(value)) {
            Py_XDECREF(tb);
            Py_DECREF(et);
            *pvalue = value;
            return 0;
        }
    } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    PyErr_NormalizeException(&et, &ev, &tb);
    if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    Py_XDECREF(tb);
    Py_DECREF(et);
#if PY_VERSION_HEX >= 0x030300A0
    value = ((PyStopIterationObject *)ev)->value;
    Py_INCREF(value);
    Py_DECREF(ev);
#else
    {
        PyObject* args = __Pyx_PyObject_GetAttrStr(ev, __pyx_n_s_args);
        Py_DECREF(ev);
        if (likely(args)) {
            value = PySequence_GetItem(args, 0);
            Py_DECREF(args);
        }
        if (unlikely(!value)) {
            __Pyx_ErrRestore(NULL, NULL, NULL);
            Py_INCREF(Py_None);
            value = Py_None;
        }
    }
#endif
    *pvalue = value;
    return 0;
}
static CYTHON_INLINE
void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) {
    PyObject *t, *v, *tb;
    t = exc_state->exc_type;
    v = exc_state->exc_value;
    tb = exc_state->exc_traceback;
    exc_state->exc_type = NULL;
    exc_state->exc_value = NULL;
    exc_state->exc_traceback = NULL;
    Py_XDECREF(t);
    Py_XDECREF(v);
    Py_XDECREF(tb);
}
#define __Pyx_Coroutine_AlreadyRunningError(gen)  (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL)
static void __Pyx__Coroutine_AlreadyRunningError(CYTHON_UNUSED __pyx_CoroutineObject *gen) {
    const char *msg;
    if ((0)) {
    #ifdef __Pyx_Coroutine_USED
    } else if (__Pyx_Coroutine_Check((PyObject*)gen)) {
        msg = "coroutine already executing";
    #endif
    #ifdef __Pyx_AsyncGen_USED
    } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) {
        msg = "async generator already executing";
    #endif
    } else {
        msg = "generator already executing";
    }
    PyErr_SetString(PyExc_ValueError, msg);
}
#define __Pyx_Coroutine_NotStartedError(gen)  (__Pyx__Coroutine_NotStartedError(gen), (PyObject*)NULL)
static void __Pyx__Coroutine_NotStartedError(CYTHON_UNUSED PyObject *gen) {
    const char *msg;
    if ((0)) {
    #ifdef __Pyx_Coroutine_USED
    } else if (__Pyx_Coroutine_Check(gen)) {
        msg = "can't send non-None value to a just-started coroutine";
    #endif
    #ifdef __Pyx_AsyncGen_USED
    } else if (__Pyx_AsyncGen_CheckExact(gen)) {
        msg = "can't send non-None value to a just-started async generator";
    #endif
    } else {
        msg = "can't send non-None value to a just-started generator";
    }
    PyErr_SetString(PyExc_TypeError, msg);
}
#define __Pyx_Coroutine_AlreadyTerminatedError(gen, value, closing)  (__Pyx__Coroutine_AlreadyTerminatedError(gen, value, closing), (PyObject*)NULL)
static void __Pyx__Coroutine_AlreadyTerminatedError(CYTHON_UNUSED PyObject *gen, PyObject *value, CYTHON_UNUSED int closing) {
    #ifdef __Pyx_Coroutine_USED
    if (!closing && __Pyx_Coroutine_Check(gen)) {
        PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine");
    } else
    #endif
    if (value) {
        #ifdef __Pyx_AsyncGen_USED
        if (__Pyx_AsyncGen_CheckExact(gen))
            PyErr_SetNone(__Pyx_PyExc_StopAsyncIteration);
        else
        #endif
        PyErr_SetNone(PyExc_StopIteration);
    }
}
static
PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, int closing) {
    __Pyx_PyThreadState_declare
    PyThreadState *tstate;
    __Pyx_ExcInfoStruct *exc_state;
    PyObject *retval;
    assert(!self->is_running);
    if (unlikely(self->resume_label == 0)) {
        if (unlikely(value && value != Py_None)) {
            return __Pyx_Coroutine_NotStartedError((PyObject*)self);
        }
    }
    if (unlikely(self->resume_label == -1)) {
        return __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing);
    }
#if CYTHON_FAST_THREAD_STATE
    __Pyx_PyThreadState_assign
    tstate = __pyx_tstate;
#else
    tstate = __Pyx_PyThreadState_Current;
#endif
    exc_state = &self->gi_exc_state;
    if (exc_state->exc_type) {
        #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
        #else
        if (exc_state->exc_traceback) {
            PyTracebackObject *tb = (PyTracebackObject *) exc_state->exc_traceback;
            PyFrameObject *f = tb->tb_frame;
            Py_XINCREF(tstate->frame);
            assert(f->f_back == NULL);
            f->f_back = tstate->frame;
        }
        #endif
    }
#if CYTHON_USE_EXC_INFO_STACK
    exc_state->previous_item = tstate->exc_info;
    tstate->exc_info = exc_state;
#else
    if (exc_state->exc_type) {
        __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
    } else {
        __Pyx_Coroutine_ExceptionClear(exc_state);
        __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
    }
#endif
    self->is_running = 1;
    retval = self->body((PyObject *) self, tstate, value);
    self->is_running = 0;
#if CYTHON_USE_EXC_INFO_STACK
    exc_state = &self->gi_exc_state;
    tstate->exc_info = exc_state->previous_item;
    exc_state->previous_item = NULL;
    __Pyx_Coroutine_ResetFrameBackpointer(exc_state);
#endif
    return retval;
}
static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) {
    PyObject *exc_tb = exc_state->exc_traceback;
    if (likely(exc_tb)) {
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
#else
        PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
        PyFrameObject *f = tb->tb_frame;
        Py_CLEAR(f->f_back);
#endif
    }
}
static CYTHON_INLINE
PyObject *__Pyx_Coroutine_MethodReturn(CYTHON_UNUSED PyObject* gen, PyObject *retval) {
    if (unlikely(!retval)) {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        if (!__Pyx_PyErr_Occurred()) {
            PyObject *exc = PyExc_StopIteration;
            #ifdef __Pyx_AsyncGen_USED
            if (__Pyx_AsyncGen_CheckExact(gen))
                exc = __Pyx_PyExc_StopAsyncIteration;
            #endif
            __Pyx_PyErr_SetNone(exc);
        }
    }
    return retval;
}
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
static CYTHON_INLINE
PyObject *__Pyx_PyGen_Send(PyGenObject *gen, PyObject *arg) {
#if PY_VERSION_HEX <= 0x030A00A1
    return _PyGen_Send(gen, arg);
#else
    PyObject *result;
    if (PyIter_Send((PyObject*)gen, arg ? arg : Py_None, &result) == PYGEN_RETURN) {
        if (PyAsyncGen_CheckExact(gen)) {
            assert(result == Py_None);
            PyErr_SetNone(PyExc_StopAsyncIteration);
        }
        else if (result == Py_None) {
            PyErr_SetNone(PyExc_StopIteration);
        }
        else {
            _PyGen_SetStopIterationValue(result);
        }
        Py_CLEAR(result);
    }
    return result;
#endif
}
#endif
static CYTHON_INLINE
PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) {
    PyObject *ret;
    PyObject *val = NULL;
    __Pyx_Coroutine_Undelegate(gen);
    __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val);
    ret = __Pyx_Coroutine_SendEx(gen, val, 0);
    Py_XDECREF(val);
    return ret;
}
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
    PyObject *retval;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        PyObject *ret;
        gen->is_running = 1;
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Coroutine_Send(yf, value);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_Check(yf)) {
            ret = __Pyx_Coroutine_Send(yf, value);
        } else
        #endif
        #ifdef __Pyx_AsyncGen_USED
        if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
            ret = __Pyx_async_gen_asend_send(yf, value);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
        if (PyGen_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03050000 && defined(PyCoro_CheckExact) && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
        if (PyCoro_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
        } else
        #endif
        {
            if (value == Py_None)
                ret = Py_TYPE(yf)->tp_iternext(yf);
            else
                ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value);
        }
        gen->is_running = 0;
        if (likely(ret)) {
            return ret;
        }
        retval = __Pyx_Coroutine_FinishDelegation(gen);
    } else {
        retval = __Pyx_Coroutine_SendEx(gen, value, 0);
    }
    return __Pyx_Coroutine_MethodReturn(self, retval);
}
static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
    PyObject *retval = NULL;
    int err = 0;
    #ifdef __Pyx_Generator_USED
    if (__Pyx_Generator_CheckExact(yf)) {
        retval = __Pyx_Coroutine_Close(yf);
        if (!retval)
            return -1;
    } else
    #endif
    #ifdef __Pyx_Coroutine_USED
    if (__Pyx_Coroutine_Check(yf)) {
        retval = __Pyx_Coroutine_Close(yf);
        if (!retval)
            return -1;
    } else
    if (__Pyx_CoroutineAwait_CheckExact(yf)) {
        retval = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf, NULL);
        if (!retval)
            return -1;
    } else
    #endif
    #ifdef __Pyx_AsyncGen_USED
    if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
        retval = __Pyx_async_gen_asend_close(yf, NULL);
    } else
    if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) {
        retval = __Pyx_async_gen_athrow_close(yf, NULL);
    } else
    #endif
    {
        PyObject *meth;
        gen->is_running = 1;
        meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_close);
        if (unlikely(!meth)) {
            if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
                PyErr_WriteUnraisable(yf);
            }
            PyErr_Clear();
        } else {
            retval = PyObject_CallFunction(meth, NULL);
            Py_DECREF(meth);
            if (!retval)
                err = -1;
        }
        gen->is_running = 0;
    }
    Py_XDECREF(retval);
    return err;
}
static PyObject *__Pyx_Generator_Next(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        PyObject *ret;
        gen->is_running = 1;
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Generator_Next(yf);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
        if (PyGen_CheckExact(yf)) {
            ret = __Pyx_PyGen_Send((PyGenObject*)yf, NULL);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_Check(yf)) {
            ret = __Pyx_Coroutine_Send(yf, Py_None);
        } else
        #endif
            ret = Py_TYPE(yf)->tp_iternext(yf);
        gen->is_running = 0;
        if (likely(ret)) {
            return ret;
        }
        return __Pyx_Coroutine_FinishDelegation(gen);
    }
    return __Pyx_Coroutine_SendEx(gen, Py_None, 0);
}
static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, CYTHON_UNUSED PyObject *arg) {
    return __Pyx_Coroutine_Close(self);
}
static PyObject *__Pyx_Coroutine_Close(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject *retval, *raised_exception;
    PyObject *yf = gen->yieldfrom;
    int err = 0;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        Py_INCREF(yf);
        err = __Pyx_Coroutine_CloseIter(gen, yf);
        __Pyx_Coroutine_Undelegate(gen);
        Py_DECREF(yf);
    }
    if (err == 0)
        PyErr_SetNone(PyExc_GeneratorExit);
    retval = __Pyx_Coroutine_SendEx(gen, NULL, 1);
    if (unlikely(retval)) {
        const char *msg;
        Py_DECREF(retval);
        if ((0)) {
        #ifdef __Pyx_Coroutine_USED
        } else if (__Pyx_Coroutine_Check(self)) {
            msg = "coroutine ignored GeneratorExit";
        #endif
        #ifdef __Pyx_AsyncGen_USED
        } else if (__Pyx_AsyncGen_CheckExact(self)) {
#if PY_VERSION_HEX < 0x03060000
            msg = "async generator ignored GeneratorExit - might require Python 3.6+ finalisation (PEP 525)";
#else
            msg = "async generator ignored GeneratorExit";
#endif
        #endif
        } else {
            msg = "generator ignored GeneratorExit";
        }
        PyErr_SetString(PyExc_RuntimeError, msg);
        return NULL;
    }
    raised_exception = PyErr_Occurred();
    if (likely(!raised_exception || __Pyx_PyErr_GivenExceptionMatches2(raised_exception, PyExc_GeneratorExit, PyExc_StopIteration))) {
        if (raised_exception) PyErr_Clear();
        Py_INCREF(Py_None);
        return Py_None;
    }
    return NULL;
}
static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb,
                                        PyObject *args, int close_on_genexit) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        PyObject *ret;
        Py_INCREF(yf);
        if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) {
            int err = __Pyx_Coroutine_CloseIter(gen, yf);
            Py_DECREF(yf);
            __Pyx_Coroutine_Undelegate(gen);
            if (err < 0)
                return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
            goto throw_here;
        }
        gen->is_running = 1;
        if (0
        #ifdef __Pyx_Generator_USED
            || __Pyx_Generator_CheckExact(yf)
        #endif
        #ifdef __Pyx_Coroutine_USED
            || __Pyx_Coroutine_Check(yf)
        #endif
            ) {
            ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit);
        #ifdef __Pyx_Coroutine_USED
        } else if (__Pyx_CoroutineAwait_CheckExact(yf)) {
            ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit);
        #endif
        } else {
            PyObject *meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_throw);
            if (unlikely(!meth)) {
                Py_DECREF(yf);
                if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
                    gen->is_running = 0;
                    return NULL;
                }
                PyErr_Clear();
                __Pyx_Coroutine_Undelegate(gen);
                gen->is_running = 0;
                goto throw_here;
            }
            if (likely(args)) {
                ret = PyObject_CallObject(meth, args);
            } else {
                ret = PyObject_CallFunctionObjArgs(meth, typ, val, tb, NULL);
            }
            Py_DECREF(meth);
        }
        gen->is_running = 0;
        Py_DECREF(yf);
        if (!ret) {
            ret = __Pyx_Coroutine_FinishDelegation(gen);
        }
        return __Pyx_Coroutine_MethodReturn(self, ret);
    }
throw_here:
    __Pyx_Raise(typ, val, tb, NULL);
    return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
}
static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) {
    PyObject *typ;
    PyObject *val = NULL;
    PyObject *tb = NULL;
    if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb))
        return NULL;
    return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1);
}
static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) {
    Py_VISIT(exc_state->exc_type);
    Py_VISIT(exc_state->exc_value);
    Py_VISIT(exc_state->exc_traceback);
    return 0;
}
static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) {
    Py_VISIT(gen->closure);
    Py_VISIT(gen->classobj);
    Py_VISIT(gen->yieldfrom);
    return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg);
}
static int __Pyx_Coroutine_clear(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    Py_CLEAR(gen->closure);
    Py_CLEAR(gen->classobj);
    Py_CLEAR(gen->yieldfrom);
    __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state);
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer);
    }
#endif
    Py_CLEAR(gen->gi_code);
    Py_CLEAR(gen->gi_name);
    Py_CLEAR(gen->gi_qualname);
    Py_CLEAR(gen->gi_modulename);
    return 0;
}
static void __Pyx_Coroutine_dealloc(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject_GC_UnTrack(gen);
    if (gen->gi_weakreflist != NULL)
        PyObject_ClearWeakRefs(self);
    if (gen->resume_label >= 0) {
        PyObject_GC_Track(self);
#if PY_VERSION_HEX >= 0x030400a1 && CYTHON_USE_TP_FINALIZE
        if (PyObject_CallFinalizerFromDealloc(self))
#else
        Py_TYPE(gen)->tp_del(self);
        if (self->ob_refcnt > 0)
#endif
        {
            return;
        }
        PyObject_GC_UnTrack(self);
    }
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        /* We have to handle this case for asynchronous generators
           right here, because this code has to be between UNTRACK
           and GC_Del. */
        Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer);
    }
#endif
    __Pyx_Coroutine_clear(self);
    PyObject_GC_Del(gen);
}
static void __Pyx_Coroutine_del(PyObject *self) {
    PyObject *error_type, *error_value, *error_traceback;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    __Pyx_PyThreadState_declare
    if (gen->resume_label < 0) {
        return;
    }
#if !CYTHON_USE_TP_FINALIZE
    assert(self->ob_refcnt == 0);
    __Pyx_SET_REFCNT(self, 1);
#endif
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self;
        PyObject *finalizer = agen->ag_finalizer;
        if (finalizer && !agen->ag_closed) {
            PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self);
            if (unlikely(!res)) {
                PyErr_WriteUnraisable(self);
            } else {
                Py_DECREF(res);
            }
            __Pyx_ErrRestore(error_type, error_value, error_traceback);
            return;
        }
    }
#endif
    if (unlikely(gen->resume_label == 0 && !error_value)) {
#ifdef __Pyx_Coroutine_USED
#ifdef __Pyx_Generator_USED
    if (!__Pyx_Generator_CheckExact(self))
#endif
        {
        PyObject_GC_UnTrack(self);
#if PY_MAJOR_VERSION >= 3  || defined(PyErr_WarnFormat)
        if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0))
            PyErr_WriteUnraisable(self);
#else
        {PyObject *msg;
        char *cmsg;
        #if CYTHON_COMPILING_IN_PYPY
        msg = NULL;
        cmsg = (char*) "coroutine was never awaited";
        #else
        char *cname;
        PyObject *qualname;
        qualname = gen->gi_qualname;
        cname = PyString_AS_STRING(qualname);
        msg = PyString_FromFormat("coroutine '%.50s' was never awaited", cname);
        if (unlikely(!msg)) {
            PyErr_Clear();
            cmsg = (char*) "coroutine was never awaited";
        } else {
            cmsg = PyString_AS_STRING(msg);
        }
        #endif
        if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, cmsg, 1) < 0))
            PyErr_WriteUnraisable(self);
        Py_XDECREF(msg);}
#endif
        PyObject_GC_Track(self);
        }
#endif
    } else {
        PyObject *res = __Pyx_Coroutine_Close(self);
        if (unlikely(!res)) {
            if (PyErr_Occurred())
                PyErr_WriteUnraisable(self);
        } else {
            Py_DECREF(res);
        }
    }
    __Pyx_ErrRestore(error_type, error_value, error_traceback);
#if !CYTHON_USE_TP_FINALIZE
    assert(self->ob_refcnt > 0);
    if (--self->ob_refcnt == 0) {
        return;
    }
    {
        Py_ssize_t refcnt = self->ob_refcnt;
        _Py_NewReference(self);
        __Pyx_SET_REFCNT(self, refcnt);
    }
#if CYTHON_COMPILING_IN_CPYTHON
    assert(PyType_IS_GC(self->ob_type) &&
           _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED);
    _Py_DEC_REFTOTAL;
#endif
#ifdef COUNT_ALLOCS
    --Py_TYPE(self)->tp_frees;
    --Py_TYPE(self)->tp_allocs;
#endif
#endif
}
static PyObject *
__Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
{
    PyObject *name = self->gi_name;
    if (unlikely(!name)) name = Py_None;
    Py_INCREF(name);
    return name;
}
static int
__Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value)))
#else
    if (unlikely(value == NULL || !PyString_Check(value)))
#endif
    {
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    tmp = self->gi_name;
    Py_INCREF(value);
    self->gi_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
{
    PyObject *name = self->gi_qualname;
    if (unlikely(!name)) name = Py_None;
    Py_INCREF(name);
    return name;
}
static int
__Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value)))
#else
    if (unlikely(value == NULL || !PyString_Check(value)))
#endif
    {
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    tmp = self->gi_qualname;
    Py_INCREF(value);
    self->gi_qualname = value;
    Py_XDECREF(tmp);
    return 0;
}
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
            PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name) {
    __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type);
    if (unlikely(!gen))
        return NULL;
    return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name);
}
static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
            __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name) {
    gen->body = body;
    gen->closure = closure;
    Py_XINCREF(closure);
    gen->is_running = 0;
    gen->resume_label = 0;
    gen->classobj = NULL;
    gen->yieldfrom = NULL;
    gen->gi_exc_state.exc_type = NULL;
    gen->gi_exc_state.exc_value = NULL;
    gen->gi_exc_state.exc_traceback = NULL;
#if CYTHON_USE_EXC_INFO_STACK
    gen->gi_exc_state.previous_item = NULL;
#endif
    gen->gi_weakreflist = NULL;
    Py_XINCREF(qualname);
    gen->gi_qualname = qualname;
    Py_XINCREF(name);
    gen->gi_name = name;
    Py_XINCREF(module_name);
    gen->gi_modulename = module_name;
    Py_XINCREF(code);
    gen->gi_code = code;
    PyObject_GC_Track(gen);
    return gen;
}

/* PatchModuleWithCoroutine */
        static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) {
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
    int result;
    PyObject *globals, *result_obj;
    globals = PyDict_New();  if (unlikely(!globals)) goto ignore;
    result = PyDict_SetItemString(globals, "_cython_coroutine_type",
    #ifdef __Pyx_Coroutine_USED
        (PyObject*)__pyx_CoroutineType);
    #else
        Py_None);
    #endif
    if (unlikely(result < 0)) goto ignore;
    result = PyDict_SetItemString(globals, "_cython_generator_type",
    #ifdef __Pyx_Generator_USED
        (PyObject*)__pyx_GeneratorType);
    #else
        Py_None);
    #endif
    if (unlikely(result < 0)) goto ignore;
    if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore;
    if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore;
    result_obj = PyRun_String(py_code, Py_file_input, globals, globals);
    if (unlikely(!result_obj)) goto ignore;
    Py_DECREF(result_obj);
    Py_DECREF(globals);
    return module;
ignore:
    Py_XDECREF(globals);
    PyErr_WriteUnraisable(module);
    if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) {
        Py_DECREF(module);
        module = NULL;
    }
#else
    py_code++;
#endif
    return module;
}

/* PatchGeneratorABC */
        #ifndef CYTHON_REGISTER_ABCS
#define CYTHON_REGISTER_ABCS 1
#endif
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
static PyObject* __Pyx_patch_abc_module(PyObject *module);
static PyObject* __Pyx_patch_abc_module(PyObject *module) {
    module = __Pyx_Coroutine_patch_module(
        module, ""
"if _cython_generator_type is not None:\n"
"    try: Generator = _module.Generator\n"
"    except AttributeError: pass\n"
"    else: Generator.register(_cython_generator_type)\n"
"if _cython_coroutine_type is not None:\n"
"    try: Coroutine = _module.Coroutine\n"
"    except AttributeError: pass\n"
"    else: Coroutine.register(_cython_coroutine_type)\n"
    );
    return module;
}
#endif
static int __Pyx_patch_abc(void) {
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
    static int abc_patched = 0;
    if (CYTHON_REGISTER_ABCS && !abc_patched) {
        PyObject *module;
        module = PyImport_ImportModule((PY_MAJOR_VERSION >= 3) ? "collections.abc" : "collections");
        if (!module) {
            PyErr_WriteUnraisable(NULL);
            if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning,
                    ((PY_MAJOR_VERSION >= 3) ?
                        "Cython module failed to register with collections.abc module" :
                        "Cython module failed to register with collections module"), 1) < 0)) {
                return -1;
            }
        } else {
            module = __Pyx_patch_abc_module(module);
            abc_patched = 1;
            if (unlikely(!module))
                return -1;
            Py_DECREF(module);
        }
        module = PyImport_ImportModule("backports_abc");
        if (module) {
            module = __Pyx_patch_abc_module(module);
            Py_XDECREF(module);
        }
        if (!module) {
            PyErr_Clear();
        }
    }
#else
    if ((0)) __Pyx_Coroutine_patch_module(NULL, NULL);
#endif
    return 0;
}

/* Generator */
        static PyMethodDef __pyx_Generator_methods[] = {
    {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
     (char*) PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")},
    {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
     (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")},
    {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS,
     (char*) PyDoc_STR("close() -> raise GeneratorExit inside generator.")},
    {0, 0, 0, 0}
};
static PyMemberDef __pyx_Generator_memberlist[] = {
    {(char *) "gi_running", T_BOOL, offsetof(__pyx_CoroutineObject, is_running), READONLY, NULL},
    {(char*) "gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
     (char*) PyDoc_STR("object being iterated by 'yield from', or None")},
    {(char*) "gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL},
    {0, 0, 0, 0, 0}
};
static PyGetSetDef __pyx_Generator_getsets[] = {
    {(char *) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
     (char*) PyDoc_STR("name of the generator"), 0},
    {(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
     (char*) PyDoc_STR("qualified name of the generator"), 0},
    {0, 0, 0, 0, 0}
};
static PyTypeObject __pyx_GeneratorType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "generator",
    sizeof(__pyx_CoroutineObject),
    0,
    (destructor) __Pyx_Coroutine_dealloc,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
    0,
    (traverseproc) __Pyx_Coroutine_traverse,
    0,
    0,
    offsetof(__pyx_CoroutineObject, gi_weakreflist),
    0,
    (iternextfunc) __Pyx_Generator_Next,
    __pyx_Generator_methods,
    __pyx_Generator_memberlist,
    __pyx_Generator_getsets,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if CYTHON_USE_TP_FINALIZE
    0,
#else
    __Pyx_Coroutine_del,
#endif
    0,
#if CYTHON_USE_TP_FINALIZE
    __Pyx_Coroutine_del,
#elif PY_VERSION_HEX >= 0x030400a1
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b1
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
    0,
#endif
};
static int __pyx_Generator_init(void) {
    __pyx_GeneratorType_type.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
    __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter;
    __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type);
    if (unlikely(!__pyx_GeneratorType)) {
        return -1;
    }
    return 0;
}

/* CheckBinaryVersion */
        static int __Pyx_check_binary_version(void) {
    char ctversion[4], rtversion[4];
    PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
    PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
    if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
        char message[200];
        PyOS_snprintf(message, sizeof(message),
                      "compiletime version %s of module '%.100s' "
                      "does not match runtime version %s",
                      ctversion, __Pyx_MODULE_NAME, rtversion);
        return PyErr_WarnEx(NULL, message, 1);
    }
    return 0;
}

/* InitStrings */
        static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        if (PyObject_Hash(*t->p) == -1)
            return -1;
        ++t;
    }
    return 0;
}

static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
    return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
}
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
#if !CYTHON_PEP393_ENABLED
static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    char* defenc_c;
    PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
    if (!defenc) return NULL;
    defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    {
        char* end = defenc_c + PyBytes_GET_SIZE(defenc);
        char* c;
        for (c = defenc_c; c < end; c++) {
            if ((unsigned char) (*c) >= 128) {
                PyUnicode_AsASCIIString(o);
                return NULL;
            }
        }
    }
#endif
    *length = PyBytes_GET_SIZE(defenc);
    return defenc_c;
}
#else
static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    if (likely(PyUnicode_IS_ASCII(o))) {
        *length = PyUnicode_GET_LENGTH(o);
        return PyUnicode_AsUTF8(o);
    } else {
        PyUnicode_AsASCIIString(o);
        return NULL;
    }
#else
    return PyUnicode_AsUTF8AndSize(o, length);
#endif
}
#endif
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
    if (
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
            __Pyx_sys_getdefaultencoding_not_ascii &&
#endif
            PyUnicode_Check(o)) {
        return __Pyx_PyUnicode_AsStringAndSize(o, length);
    } else
#endif
#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
    if (PyByteArray_Check(o)) {
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
    } else
#endif
    {
        char* result;
        int r = PyBytes_AsStringAndSize(o, &result, length);
        if (unlikely(r < 0)) {
            return NULL;
        } else {
            return result;
        }
    }
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
    int retval;
    if (unlikely(!x)) return -1;
    retval = __Pyx_PyObject_IsTrue(x);
    Py_DECREF(x);
    return retval;
}
static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
#if PY_MAJOR_VERSION >= 3
    if (PyLong_Check(result)) {
        if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
                "__int__ returned non-int (type %.200s).  "
                "The ability to return an instance of a strict subclass of int "
                "is deprecated, and may be removed in a future version of Python.",
                Py_TYPE(result)->tp_name)) {
            Py_DECREF(result);
            return NULL;
        }
        return result;
    }
#endif
    PyErr_Format(PyExc_TypeError,
                 "__%.4s__ returned non-%.4s (type %.200s)",
                 type_name, type_name, Py_TYPE(result)->tp_name);
    Py_DECREF(result);
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
#if CYTHON_USE_TYPE_SLOTS
  PyNumberMethods *m;
#endif
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_Check(x) || PyLong_Check(x)))
#else
  if (likely(PyLong_Check(x)))
#endif
    return __Pyx_NewRef(x);
#if CYTHON_USE_TYPE_SLOTS
  m = Py_TYPE(x)->tp_as_number;
  #if PY_MAJOR_VERSION < 3
  if (m && m->nb_int) {
    name = "int";
    res = m->nb_int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = m->nb_long(x);
  }
  #else
  if (likely(m && m->nb_int)) {
    name = "int";
    res = m->nb_int(x);
  }
  #endif
#else
  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
    res = PyNumber_Int(x);
  }
#endif
  if (likely(res)) {
#if PY_MAJOR_VERSION < 3
    if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
#else
    if (unlikely(!PyLong_CheckExact(res))) {
#endif
        return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject *x;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_CheckExact(b))) {
    if (sizeof(Py_ssize_t) >= sizeof(long))
        return PyInt_AS_LONG(b);
    else
        return PyInt_AsSsize_t(b);
  }
#endif
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_USE_PYLONG_INTERNALS
    const digit* digits = ((PyLongObject*)b)->ob_digit;
    const Py_ssize_t size = Py_SIZE(b);
    if (likely(__Pyx_sst_abs(size) <= 1)) {
        ival = likely(size) ? digits[0] : 0;
        if (size == -1) ival = -ival;
        return ival;
    } else {
      switch (size) {
         case 2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
      }
    }
    #endif
    return PyLong_AsSsize_t(b);
  }
  x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
}


#endif /* Py_PYTHON_H */
