Ethan Merritt - 2022-09-30

Good question.
That is one of a longer list of similar questions I have filed under "decisions to be made before the development version becomes a release candidate"

  • should sgn(NaN) return 0 or NaN?
  • should imag(NaN) return 0 or NaN?
  • should sgn(foo) return an int if foo is an int, cmplx otherwise?
  • should any of the built-in math functions return +Inf or -Inf as opposed to NaN or VERYLARGE? For example, what should gamma(-1) return?

I had figured to eventually post the list to gnuplot-beta for discussion, but any thoughts you have now are welcome.

I tried to see what C, Fortran, or other languages do with regard to sgn(foo) but did not find any useful guidance. Maybe it's covered in some IEEE standard?