Here is the source for the GSL extension module supporting the Elementary Functions.
/*
GNU Scientific Library
Based on GSL 1.15
Interface By: John Spikowski
Refinements By: Armando I. Rivera (AIR)
Version 0.01
*/
#include <stdio.h>
#include "../../basext.h"
#include <gsl/gsl_math.h>
besVERSION_NEGOTIATE
return (int)INTERFACE_VERSION;
besEND
besSUB_START
besEND
besSUB_FINISH
besEND
/* Elementary Functions */
besFUNCTION(_log1p)
double x;
besARGUMENTS("r")
&x
besARGEND
besRETURN_DOUBLE(gsl_log1p(x));
besEND
besFUNCTION(_expm1)
double x;
besARGUMENTS("r")
&x
besARGEND
besRETURN_DOUBLE(gsl_expm1(x));
besEND
besFUNCTION(_hypot)
double x,y;
besARGUMENTS("rr")
&x,&y
besARGEND
besRETURN_DOUBLE(gsl_hypot(x, y));
besEND
besFUNCTION(_hypot3)
double x,y,z;
besARGUMENTS("rrr")
&x,&y,&z
besARGEND
besRETURN_DOUBLE(gsl_hypot3(x, y, z));
besEND
besFUNCTION(_acosh)
double x;
besARGUMENTS("r")
&x
besARGEND
besRETURN_DOUBLE(gsl_acosh(x));
besEND
besFUNCTION(_asinh)
double x;
besARGUMENTS("r")
&x
besARGEND
besRETURN_DOUBLE(gsl_asinh(x));
besEND
besFUNCTION(_atanh)
double x;
besARGUMENTS("r")
&x
besARGEND
besRETURN_DOUBLE(gsl_atanh(x));
besEND
besFUNCTION(_ldexp)
double x;
int y;
besARGUMENTS("ri")
&x,&y
besARGEND
besRETURN_DOUBLE(gsl_ldexp(x, y));
besEND
besFUNCTION(_frexp)
double f;
LEFTVALUE e;
besARGUMENTS("r")
&f
besARGEND
besLEFTVALUE(besARGUMENT(2),e);
besRETURN_DOUBLE(gsl_frexp(f, *e));
besEND
Calling GSL SB extension module functions:
log1p()
DECLARE SUB log1p ALIAS "_log1p" LIB "gsl"
PRINT FORMAT("%.32g", log1p(34.0)),"\n"
3.5553480614894135136694330867613
frexp()
DECLARE SUB frexp ALIAS "_frexp" LIB "gsl"
x = 16.4
e = 0
fraction = frexp(x, e)
PRINT FORMAT("%g",fraction),"\n"
PRINT e,"\n"
0.5125
5