Ticket #777 (new enhancement)

Opened 21 months ago

Last modified 21 months ago

sign function

Reported by: kedlaya Owned by: somebody
Priority: minor Milestone: sage-4.1
Component: basic arithmetic Keywords: sign
Cc: Reviewer(s):
Author(s): Merged in:

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

Changed 21 months ago by mabshoff

  • milestone set to sage-2.9
Note: See TracTickets for help on using tickets.