in reply to Re^9: Weird behavior of int()
in thread Weird behavior of int()
However, whether or not all trunc implementations do it that way, it doesn't change my main points: preserving INF and NAN through an operation like perl's int is reasonable.
I was using the example of POSIX-compliant trunc , not because I was saying "since trunc requires this behavior (which you have pointed out is not true), then perl's int must behave this way", but because I was saying "since something like POSIX's implementation of trunc implements it this way, I believe it is reasonable to implement such functions this way, whether it's an implementation of trunc or of perl's func or any other similar "return the integer portion of a number that might have a non-integer component" function.
|
---|