> then neither MyFloat.__mul__ or MyFloat.__rmul__ is called, sage must > down cast MyFloat to a sage RealNumer and perform the operation? > > I imagine that this could be fixed by not deriving MyFloat from float, > but is there a better way to do this?
Sage has some rules that tell it to convert floats to RealNumbers when doing arithmetic. So, choosing to encapsulate the float rather than inherit from it will fix the problem. Another option would be to make a Parent object so that the Sage coercion system should know that when you multiply a RealNumber by a MyFloat, you should get a MyFloat back. --Mike --~--~---------~--~----~------------~-------~--~----~ 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-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---
