Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: exp() bignum issue

by salva (Canon)
on Aug 31, 2020 at 13:11 UTC ( #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
Node Status?
node history
Node Type: note [id://11121225]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2021-04-15 07:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?