Ticket #777 (closed enhancement: invalid)
sign function
| Reported by: | kedlaya | Owned by: | somebody |
|---|---|---|---|
| Priority: | minor | Milestone: | sage-duplicate/invalid/wontfix |
| Component: | basic arithmetic | Keywords: | sign |
| Cc: | mhansen | Author(s): | |
| Report Upstream: | Reviewer(s): | ||
| Merged in: | Work issues: |
Description
Should the following function exist globally?
def sign(x):
if x > 0:
return 1
if x < 0:
return -1
return 0
I'm not sure if this is identical to
def sign(x):
return x.__cmp__(0)
I'm also ambivalent as to whether this function is called "sign", "signum", or "sgn".
Change History
Note: See
TracTickets for help on using
tickets.
