Ticket #3576 (closed defect: fixed)
[with patch; positive review] stupid bug in RDF
| Reported by: | was | Owned by: | somebody |
|---|---|---|---|
| Priority: | blocker | Milestone: | sage-3.0.4 |
| Component: | basic arithmetic | Keywords: | |
| Cc: | Work issues: | ||
| Report Upstream: | Reviewers: | ||
| Authors: | Merged in: | ||
| Dependencies: | Stopgaps: |
Description
This is sad:
sage: RDF(-1).nth_root(2)
Look at the dumb code in real_double.pyx:
def nth_root(self, int n):
"""
Returns the $n^{th}$ root of self.
EXAMPLES:
sage: r = RDF(-125.0); r.nth_root(3)
-5.0
sage: r.nth_root(5)
-2.6265278044
"""
if n == 0:
return RealDoubleElement(float('nan'))
if self._value < 0 and GSL_IS_EVEN(n):
pass #return self._complex_double_().pow(1.0/n)
else:
return RealDoubleElement(self.__nth_root(n))
Amazingly this was introduced in the very first patch by Tom Boothby in 2006 and nobody ever noticed!!
Attachments
Change History
comment:2 Changed 5 years ago by was
- Summary changed from stupid bug in RDF to [with patch; needs review] stupid bug in RDF
comment:3 Changed 5 years ago by mhansen
- Summary changed from [with patch; needs review] stupid bug in RDF to [with patch; positive review] stupid bug in RDF
The code is definitely much better style and correctness-wise after the patch.
+1
Note: See
TracTickets for help on using
tickets.


This is also bad, bad, bad: