/test/lib/numeric/real/test_is_infinity.e

http://github.com/tybor/Liberty · Specman e · 77 lines · 46 code · 7 blank · 24 comment · 0 complexity · b0ace7e2d1a118d1f65c03b13c75a0da MD5 · raw file

  1. -- This file is part of SmartEiffel The GNU Eiffel Compiler Tools and Libraries.
  2. -- See the Copyright notice at the end of this file.
  3. --
  4. class TEST_IS_INFINITY
  5. --
  6. -- Of REAL_GENERAL.
  7. --
  8. insert
  9. EIFFELTEST_TOOLS
  10. create {}
  11. make
  12. feature {ANY}
  13. make
  14. local
  15. real_32: REAL_32; real_64: REAL_64; real_extended: REAL_EXTENDED
  16. do
  17. assert(not real_64.is_infinity)
  18. real_64 := unchecked_c_divide_64(1.0, 0.0)
  19. assert(real_64.is_infinity)
  20. assert(real_64 > 0)
  21. real_64 := unchecked_c_divide_64(-1.0, 0.0)
  22. assert(real_64.is_infinity)
  23. assert(real_64 < 0)
  24. assert(not real_32.is_infinity)
  25. real_32 := unchecked_c_divide_32({REAL_32 1.0}, {REAL_32 0.0})
  26. assert(real_32.is_infinity)
  27. assert(real_32 > 0)
  28. real_32 := unchecked_c_divide_32(-{REAL_32 1.0}, {REAL_32 0.0})
  29. assert(real_32.is_infinity)
  30. assert(real_32 < 0)
  31. assert(not real_extended.is_infinity)
  32. real_extended := unchecked_c_divide_ext({REAL_EXTENDED 1.0}, {REAL_EXTENDED 0.0})
  33. assert(real_extended.is_infinity)
  34. assert(real_extended > 0)
  35. real_extended := unchecked_c_divide_ext(-{REAL_EXTENDED 1.0}, {REAL_EXTENDED 0.0})
  36. assert(real_extended.is_infinity)
  37. assert(real_extended < 0)
  38. end
  39. feature {}
  40. unchecked_c_divide_64(x, y: REAL_64): REAL_64
  41. external "C inline"
  42. alias "(($x) / ($y))"
  43. end
  44. unchecked_c_divide_32(x, y: REAL_32): REAL_32
  45. external "C inline"
  46. alias "(($x) / ($y))"
  47. end
  48. unchecked_c_divide_ext(x, y: REAL_EXTENDED): REAL_EXTENDED
  49. external "C inline"
  50. alias "(($x) / ($y))"
  51. end
  52. end -- class TEST_IS_INFINITY
  53. --
  54. -- ------------------------------------------------------------------------------------------------------------------------------
  55. -- Copyright notice below. Please read.
  56. --
  57. -- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
  58. -- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
  59. -- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
  60. -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
  61. -- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
  62. -- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
  63. --
  64. -- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE
  65. -- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
  66. --
  67. -- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
  68. --
  69. -- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
  70. -- ------------------------------------------------------------------------------------------------------------------------------