FPEnvironment_DEC.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. //
  2. // FPEnvironment_DEC.h
  3. //
  4. // Library: Foundation
  5. // Package: Core
  6. // Module: FPEnvironment
  7. //
  8. // Definitions of class FPEnvironmentImpl for Tru64 and OpenVMS Alpha.
  9. //
  10. // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
  11. // and Contributors.
  12. //
  13. // SPDX-License-Identifier: BSL-1.0
  14. //
  15. #ifndef Foundation_FPEnvironment_DEC_INCLUDED
  16. #define Foundation_FPEnvironment_DEC_INCLUDED
  17. #include "Poco/Foundation.h"
  18. #if defined(__VMS)
  19. #include <ieeedef.h>
  20. #else
  21. #include <machine/fpu.h>
  22. #endif
  23. namespace Poco {
  24. class FPEnvironmentImpl
  25. {
  26. protected:
  27. enum RoundingModeImpl
  28. {
  29. FP_ROUND_DOWNWARD_IMPL = 0,
  30. FP_ROUND_UPWARD_IMPL = 0,
  31. FP_ROUND_TONEAREST_IMPL = 0,
  32. FP_ROUND_TOWARDZERO_IMPL = 0
  33. };
  34. enum FlagImpl
  35. {
  36. #if defined(__VMS)
  37. FP_DIVIDE_BY_ZERO_IMPL = IEEE$M_STATUS_DZE,
  38. FP_INEXACT_IMPL = IEEE$M_STATUS_INE,
  39. FP_OVERFLOW_IMPL = IEEE$M_STATUS_OVF,
  40. FP_UNDERFLOW_IMPL = IEEE$M_STATUS_UNF,
  41. FP_INVALID_IMPL = IEEE$M_STATUS_INV
  42. #else
  43. FP_DIVIDE_BY_ZERO_IMPL = IEEE_STATUS_DZE,
  44. FP_INEXACT_IMPL = IEEE_STATUS_INE,
  45. FP_OVERFLOW_IMPL = IEEE_STATUS_OVF,
  46. FP_UNDERFLOW_IMPL = IEEE_STATUS_UNF,
  47. FP_INVALID_IMPL = IEEE_STATUS_INV
  48. #endif
  49. };
  50. FPEnvironmentImpl();
  51. FPEnvironmentImpl(const FPEnvironmentImpl& env);
  52. ~FPEnvironmentImpl();
  53. FPEnvironmentImpl& operator = (const FPEnvironmentImpl& env);
  54. void keepCurrentImpl();
  55. static void clearFlagsImpl();
  56. static bool isFlagImpl(FlagImpl flag);
  57. static void setRoundingModeImpl(RoundingModeImpl mode);
  58. static RoundingModeImpl getRoundingModeImpl();
  59. static bool isInfiniteImpl(float value);
  60. static bool isInfiniteImpl(double value);
  61. static bool isInfiniteImpl(long double value);
  62. static bool isNaNImpl(float value);
  63. static bool isNaNImpl(double value);
  64. static bool isNaNImpl(long double value);
  65. static float copySignImpl(float target, float source);
  66. static double copySignImpl(double target, double source);
  67. static long double copySignImpl(long double target, long double source);
  68. private:
  69. #if defined(__VMS)
  70. struct _ieee _env;
  71. #else
  72. unsigned long _env;
  73. #endif
  74. };
  75. } // namespace Poco
  76. #endif // Foundation_FPEnvironment_DEC_INCLUDED