Zavolaj!

I’d been thinking for a while that I should look at adding the extended standard math library functions to Perl 6. And I’d been thinking I should try to do something with Zavolaj, the Perl 6 native call interface. And gee, those two things work perfectly together!

use NativeCall;

sub log1p(Num $x) returns Num is native("libm") { ... }
sub expm1(Num $x) returns Num is native("libm") { ... }
sub erf(Num $x) returns Num is native("libm") { ... }
sub erfc(Num $x) returns Num is native("libm") { ... }
sub tgamma(Num $x) returns Num is native("libm") { ... }
sub lgamma(Num $x) returns Num is native("libm") { ... }

Okay, that was really, really easy to do. I am officially impressed by Zavolaj.

I was thinking the next step is to make a module of this, which I think should be pretty easy. But I'm blocked on a name for it. Any suggestions?

About these ads

2 Responses to “Zavolaj!”

  1. tadzik Says:

    Maybe Math::Native?

  2. Anonymous Says:

    Math::Libm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.

%d bloggers like this: