Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

binomial does not accept float #9633

Closed
sagetrac-Henryk-Trappmann mannequin opened this issue Jul 29, 2010 · 9 comments
Closed

binomial does not accept float #9633

sagetrac-Henryk-Trappmann mannequin opened this issue Jul 29, 2010 · 9 comments

Comments

@sagetrac-Henryk-Trappmann
Copy link
Mannequin

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' 

CC: @kcrisman

Component: basic arithmetic

Author: Johan Bosman

Reviewer: Douglas McNeil, Karl-Dieter Crisman

Merged: sage-4.7.1.alpha0

Issue created by migration from https://trac.sagemath.org/ticket/9633

@sagetrac-johanbosman
Copy link
Mannequin

sagetrac-johanbosman mannequin commented Apr 11, 2011

Author: Johan Bosman

@sagetrac-dsm
Copy link
Mannequin

sagetrac-dsm mannequin commented Apr 12, 2011

comment:4

Two points: (1) I think "P = parent(x)" is simpler, if I'm reading sage.structure.parent correctly. (2) Doctest? :^)

@sagetrac-johanbosman
Copy link
Mannequin

sagetrac-johanbosman mannequin commented Apr 12, 2011

Attachment: trac_9633_binomial_float.patch.gz

@sagetrac-johanbosman
Copy link
Mannequin

sagetrac-johanbosman mannequin commented Apr 12, 2011

comment:5

Good points. :).

@kcrisman
Copy link
Member

comment:6

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 ...

@kcrisman
Copy link
Member

Reviewer: Douglas S. McNeil, Karl-Dieter Crisman

@kcrisman
Copy link
Member

comment:7

Pass :) Good catch.

@jdemeyer
Copy link

jdemeyer commented May 3, 2011

Merged: sage-4.7.1.alpha0

@jdemeyer
Copy link

Changed reviewer from Douglas S. McNeil, Karl-Dieter Crisman to Douglas McNeil, Karl-Dieter Crisman

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants