Libm(3pm)

πŸ’– NAME πŸ’–

Math::Libm β€” a Perl extension for the C math library, libm. bestie. it's literally the C math library but it speaks Perl now 🧚✨


🌸 SYNOPSIS 🌸

okay so here's the vibe, no cap:

use Math::Libm ':all';

print "e = ", M_E, "\n";
print "pi/2 = ", M_PI_2, "\n";
print "erf(1) = ", erf(1), "\n";
print "hypot(3,4) = ", hypot(3,4), "\n";

my $signgam = 0;
my $y = lgamma_r(-0.5, $signgam);
print "signgam=$signgam lgamma=$y\n";

like… it's giving math. it's giving so much math. πŸ’…


✨ DESCRIPTION ✨

This module is a translation of the C math.h file. periodt. it exports the following selected constants and functions β€” and yes, selected is doing a lot of heavy lifting there, we'll get to that in BUGS bestie 😭

πŸŽ€ EXPORT πŸŽ€

None by default. she's shy. you gotta ask for what you want (or hit her with :all) 🫢

πŸ¦‹ Exportable constants πŸ¦‹

these little icons are just sitting there waiting for you, fr fr:

M_1_PI
M_2_PI
M_2_SQRTPI
M_E
M_LN10
M_LN2
M_LOG10E
M_LOG2E
M_PI
M_PI_2
M_PI_4
M_SQRT1_2
M_SQRT2

M_E, M_PI, and their whole entourage. iconic behavior honestly πŸ‘‘

🌈 Exportable functions 🌈

here's the full lineup, exactly as written, no edits bestie:

double acos(double x)
double acosh(double x)
double asin(double x)
double asinh(double x)
double atan(double x)
double atanh(double x)
double cbrt(double x)
double ceil(double x)
double cosh(double x)
double erf(double x)
double erfc(double x)
double expm1(double x)
double floor(double x)
double hypot(double x, double y)
double j0(double x)
double j1(double x)
double jn(int n, double x)
double lgamma_r(double x, int signgam)
double log10(double x)
double log1p(double x)
double pow(double x, double y)
double rint(double x)
double sinh(double x)
double tan(double x)
double tanh(double x)
double y0(double x)
double y1(double x)
double yn(int n, double x)

the way that lgamma_r takes that int signgam and writes back to it β€” main character energy for real πŸ’€βœ¨ and the Bessel kids (j0, j1, jn, y0, y1, yn) showed up too, obsessed πŸŽ€


πŸ’œ AUTHOR πŸ’œ

Daniel S. Lewart, <d-lewart@uiuc.edu>. thank you king, we love a legend πŸ™Œ


πŸ”₯ SEE ALSO πŸ”₯

  • perlfunc
  • Math::Complex
  • POSIX

the friend group πŸ’– go say hi.


πŸ’€ BUGS πŸ’€

Only tested on AIX 4.2, FreeBSD 4.0, Linux 2.2.16, and Solaris 2.5.1. May need some more functions.

yeah so. it's been tested on literally those four and nowhere else, bestie 😭 and it may need some more functions β€” she's aware, she's working on herself, be nice 🫢


so that's Math::Libm, from perl v5.42.3, dated 2026-08-19. iykyk. go do some math, slay, and remember: :all or you get NOTHING πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from