Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: exp() bignum issue

by salva (Canon)
on Aug 31, 2020 at 13:11 UTC ( [id://11121225]=note: print w/replies, xml ) Need Help??


in reply to exp() bignum issue

What is your problem exactly, because Perl can usually handle this cases correctly.

At least, the following code works for me:

sub expit { my $x = shift; 1.0/(1.0 + exp(-$x)); }

Or do you really want to manage probabilities that are under the 1e-308 threshold, and that's why you need Math::BigFloat?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2024-04-25 08:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found