[Python-ideas] Why no sign function?
Ram Rachum
cool-rr at cool-rr.com
Mon Apr 26 23:43:46 CEST 2010
Robert Kern <robert.kern at ...> writes:
| That is what small utility functions are for.
|
| Basically, there are number of different conventions a sign() function could
| choose. In floating point, there are signed zeros and NaNs. Similarly, there
| no sign() function in the standard C math library, which the math module tries
| to wrap thinly. Since there is an important ambiguity, the standard libraries
| leave it to you to write your own small utility function which implements the
| convention you desire.
That makes sense, now that you phrase it like that. Thanks Robert.
Ram.
More information about the Python-ideas
mailing list