Opened 14 years ago

Closed 14 years ago

#837 closed enhancement (fixed)

[with patch] RealNumber should have abs method

Reported by: dmharvey Owned by: cwitty
Priority: major Milestone: sage-2.8.9
Component: basic arithmetic Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

This violates the principle of least surprise, at least for me:

sage: x = -2.0
sage: x.abs()
---------------------------------------------------------------------------
<type 'exceptions.AttributeError'>        Traceback (most recent call last)

/Users/david/sage-2.8.5/<ipython console> in <module>()

<type 'exceptions.AttributeError'>: 'sage.rings.real_mpfr.RealNumber' object has no attribute 'abs'

Attachments (1)

7003.patch (1.1 KB) - added by cwitty 14 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 14 years ago by mabshoff

  • Milestone set to sage-2.9

comment:2 Changed 14 years ago by mabshoff

  • Owner changed from somebody to cwitty

Changed 14 years ago by cwitty

comment:3 Changed 14 years ago by cwitty

  • Milestone changed from sage-2.9 to sage-2.8.8
  • Summary changed from RealNumber should have abs method to [with patch] RealNumber should have abs method

The attached patch actually adds an abs() method to every RingElement? (that just forwards to the __abs__ method).

comment:4 Changed 14 years ago by was

  • Milestone changed from sage-2.8.8 to sage-2.8.9

comment:5 Changed 14 years ago by malb

  • Resolution set to fixed
  • Status changed from new to closed

applied to 2.8.9.alpha0

Note: See TracTickets for help on using tickets.