You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Big numbers are often stored in some data structure such as values of a BTreeMap. When I want to do some local change on the data structure, I usually get a &mut of the number. In this case, if I'm taking a neg(), a clone() of the number is needed, which is inefficient since it's essentially only a flip of sign. Similar for recip().
A new function like
fnset_neg(&mutself){self.sign = -self.sign;}
may be helpful. In fact, I even think it should be a method of the Neg trait.
The text was updated successfully, but these errors were encountered:
Big numbers are often stored in some data structure such as values of a BTreeMap. When I want to do some local change on the data structure, I usually get a
&mut
of the number. In this case, if I'm taking aneg()
, aclone()
of the number is needed, which is inefficient since it's essentially only a flip of sign. Similar forrecip()
.A new function like
may be helpful. In fact, I even think it should be a method of the
Neg
trait.The text was updated successfully, but these errors were encountered: