Ticket #9633 (closed defect: fixed)
binomial does not accept float
| Reported by: | Henryk.Trappmann | Owned by: | AlexGhitza |
|---|---|---|---|
| Priority: | major | Milestone: | sage-4.7.1 |
| Component: | basic arithmetic | Keywords: | |
| Cc: | kcrisman | Work issues: | |
| Report Upstream: | N/A | Reviewers: | Douglas McNeil, Karl-Dieter Crisman |
| Authors: | Johan Bosman | Merged in: | sage-4.7.1.alpha0 |
| Dependencies: | Stopgaps: |
Description
sage: binomial(0.5r,5) --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) /home/bo198214/projects/<ipython console> in <module>() /opt/sage-4.5-linux-32bit-ubuntu_10.04_lts-i686-Linux/local/lib/ python2.6/site-packages/sage/rings/arith.pyc in binomial(x, m) 2887 if isinstance(x, (float, sage.rings.real_mpfr.RealNumber, 2888 sage.rings.real_mpfr.RealLiteral)): -> 2889 P = x.parent() 2890 if m < 0: 2891 return P(0) AttributeError: 'float' object has no attribute 'parent'
Attachments
Change History
comment:4 Changed 2 years ago by dsm
Two points: (1) I think "P = parent(x)" is simpler, if I'm reading sage.structure.parent correctly. (2) Doctest? :^)
comment:6 Changed 2 years ago by kcrisman
- Reviewers set to Douglas S. McNeil, Karl-Dieter Crisman
Certainly looks good! Interesting that we didn't catch that when we put it in, even though it explicitly has 'float' in the previous version :(
Currently running tests in case there was something subtle about x.parent() that was different from parent(x), though I can't see what that would be ...
comment:7 Changed 2 years ago by kcrisman
- Status changed from needs_review to positive_review
- Milestone set to sage-4.7.1
Pass :) Good catch.
Note: See
TracTickets for help on using
tickets.

