nan 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. .TH NAN 2
  2. .SH NAME
  3. NaN, Inf, isNaN, isInf \- not-a-number and infinity functions
  4. .SH SYNOPSIS
  5. .B #include <u.h>
  6. .br
  7. .B #include <libc.h>
  8. .PP
  9. .ta \w'\fLdouble 'u
  10. .B
  11. double NaN(void)
  12. .PP
  13. .B
  14. double Inf(int)
  15. .PP
  16. .B
  17. int isNaN(double)
  18. .PP
  19. .B
  20. int isInf(double, int)
  21. .SH DESCRIPTION
  22. The IEEE floating point standard defines values called
  23. `not-a-number' and positive and negative `infinity'.
  24. These values can be produced by such things as overflow
  25. and division by zero.
  26. Also, the library functions sometimes return them when
  27. the arguments are not in the domain, or the result is
  28. out of range.
  29. By default, manipulating these values may cause a floating point exception
  30. on some processors but
  31. .I setfcr
  32. (see
  33. .IR getfcr (2))
  34. can change that behavior.
  35. .PP
  36. .I NaN
  37. returns a double that is not-a-number.
  38. .I IsNaN
  39. returns true if its argument is not-a-number.
  40. .PP
  41. .IR Inf ( i )
  42. returns positive infinity if
  43. .I i
  44. is greater than or equal to zero,
  45. else negative infinity.
  46. .I IsInf
  47. returns true if its first argument is infinity
  48. with the same sign as the second argument.
  49. .SH SOURCE
  50. .B /sys/src/libc/port/nan.c
  51. .SH "SEE ALSO"
  52. .IR getfcr (2)