#10771: gcd and lcm for fraction fields
--------------------------------+-------------------------------------------
Reporter: SimonKing | Owner: AlexGhitza
Type: defect | Status: needs_work
Priority: major | Milestone: sage-4.7
Component: basic arithmetic | Keywords: gcd lcm fraction fields
Author: Simon King | Upstream: N/A
Reviewer: Marco Streng | Merged:
Work_issues: |
--------------------------------+-------------------------------------------
Comment(by SimonKing):
Yep, I understand where the first error comes from.
The original gcd codes says:
{{{
if b is not None:
if hasattr(a, "gcd"):
return a.gcd(b, **kwargs)
else:
try:
return ZZ(a).gcd(ZZ(b))
except TypeError:
raise TypeError, "unable to find gcd of %s and %s"%(a,b)
}}}
Moreover, elements of `RR` did not have a gcd method. Hence, it was tried
to coerce them into ZZ, and so we had
{{{
sage: gcd(3.0,6.0)
3
}}}
But with my patch, ''all'' field elements (including elements of `RR`)
have a gcd method, so, a conversion to `ZZ` is not attempted.
I am not sure yet how I would solve it: Change the code of
`sage.symbolic.expression"? Change the gcd implemented for fields that are
no fraction fields, such that a special case is made for inexact fields?
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10771#comment:15>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.