Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^8: How does Math::GMP overload the assignment operator ? (more guessing)

by syphilis (Archbishop)
on Nov 11, 2020 at 01:30 UTC ( [id://11123565]=note: print w/replies, xml ) Need Help??


in reply to Re^7: How does Math::GMP overload the assignment operator ? (more guessing)
in thread How does Math::GMP overload the assignment operator ?

one possibility is to first convert the object to a string and then use the builtin string->number conversion

Yes, that seems consistent with the behaviour I've noticed.
In the absence of a specified '0+' overload subroutine, $array[Math::GMPz->new(-2)] would be stringified to $array["-2"] and then numified to $array[-2]

Cheers,
Rob

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11123565]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-25 16:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found