Math.ecl 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*##############################################################################
  2. ## HPCC SYSTEMS software Copyright (C) 2017 HPCC Systems®. All rights reserved.
  3. ############################################################################## */
  4. rtl :=
  5. SERVICE : fold
  6. REAL8 Infinity() : eclrtl,pure,include,library='eclrtl',entrypoint='rtlCreateRealInf';
  7. REAL8 Nan() : eclrtl,pure,include,library='eclrtl',entrypoint='rtlCreateRealNull';
  8. BOOLEAN IsInfinite(REAL8 value) : eclrtl,pure,include,library='eclrtl',entrypoint='rtlIsInfinite';
  9. BOOLEAN IsNaN(REAL8 value) : eclrtl,pure,include,library='eclrtl',entrypoint='rtlIsNaN';
  10. BOOLEAN IsFinite(REAL8 value) : eclrtl,pure,include,library='eclrtl',entrypoint='rtlIsFinite';
  11. END;
  12. EXPORT Math := MODULE
  13. /**
  14. * Return a real "infinity" value.
  15. *
  16. */
  17. EXPORT REAL8 Infinity := rtl.Infinity();
  18. /**
  19. * Return a non-signalling NaN (Not a Number)value.
  20. *
  21. */
  22. EXPORT REAL8 NaN := rtl.NaN();
  23. /**
  24. * Return whether a real value is infinite (positive or negative).
  25. *
  26. * @param val The value to test.
  27. */
  28. EXPORT BOOLEAN isInfinite(REAL8 val) := rtl.isInfinite(val);
  29. /**
  30. * Return whether a real value is a NaN (not a number) value.
  31. *
  32. * @param val The value to test.
  33. */
  34. EXPORT BOOLEAN isNaN(REAL8 val) := rtl.isNaN(val);
  35. /**
  36. * Return whether a real value is a valid value (neither infinite not NaN).
  37. *
  38. * @param val The value to test.
  39. */
  40. EXPORT BOOLEAN isFinite(REAL8 val) := rtl.isFinite(val);
  41. END;