limits.pxd 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. cdef extern from "<limits>" namespace "std" nogil:
  2. enum float_round_style:
  3. round_indeterminate = -1
  4. round_toward_zero = 0
  5. round_to_nearest = 1
  6. round_toward_infinity = 2
  7. round_toward_neg_infinity = 3
  8. enum float_denorm_style:
  9. denorm_indeterminate = -1
  10. denorm_absent = 0
  11. denorm_present = 1
  12. #The static methods can be called as, e.g. numeric_limits[int].round_error(), etc.
  13. #The const data members should be declared as static. Cython currently doesn't allow that
  14. #and/or I can't figure it out, so you must instantiate an object to access, e.g.
  15. #cdef numeric_limits[double] lm
  16. #print lm.round_style
  17. cdef cppclass numeric_limits[T]:
  18. const bint is_specialized
  19. @staticmethod
  20. T min()
  21. @staticmethod
  22. T max()
  23. const int digits
  24. const int digits10
  25. const bint is_signed
  26. const bint is_integer
  27. const bint is_exact
  28. const int radix
  29. @staticmethod
  30. T epsilon()
  31. @staticmethod
  32. T round_error()
  33. const int min_exponent
  34. const int min_exponent10
  35. const int max_exponent
  36. const int max_exponent10
  37. const bint has_infinity
  38. const bint has_quiet_NaN
  39. const bint has_signaling_NaN
  40. const float_denorm_style has_denorm
  41. const bint has_denorm_loss
  42. @staticmethod
  43. T infinity()
  44. @staticmethod
  45. T quiet_NaN()
  46. @staticmethod
  47. T signaling_NaN()
  48. @staticmethod
  49. T denorm_min()
  50. const bint is_iec559
  51. const bint is_bounded
  52. const bint is_modulo
  53. const bint traps
  54. const bint tinyness_before
  55. const float_round_style round_style