diff --git a/src/libgap-api.c b/src/libgap-api.c index 1b814e333f..e186f6a2f3 100644 --- a/src/libgap-api.c +++ b/src/libgap-api.c @@ -10,6 +10,7 @@ #include "gvars.h" #include "integer.h" #include "lists.h" +#include "macfloat.h" #include "opers.h" #include "plist.h" #include "streams.h" @@ -194,6 +195,29 @@ Obj GAP_CallFuncArray(Obj func, UInt narg, Obj args[]) } +//// +//// floats +//// + +Int GAP_IsMacFloat(Obj obj) +{ + return IS_MACFLOAT(obj); +} + +double GAP_ValueMacFloat(Obj obj) +{ + if (!IS_MACFLOAT(obj)) { + ErrorMayQuit(" is not a MacFloat", 0, 0); + } + return (double)VAL_MACFLOAT(obj); +} + +Obj GAP_NewMacFloat(double x) +{ + return NEW_MACFLOAT(x); +} + + //// //// integers //// diff --git a/src/libgap-api.h b/src/libgap-api.h index 8a6266b7f2..2c698889a0 100644 --- a/src/libgap-api.h +++ b/src/libgap-api.h @@ -78,10 +78,25 @@ extern Obj GAP_Fail; extern Obj GAP_CallFuncList(Obj func, Obj args); // Call the GAP object as a function with arguments given -// as an array with entries +// as an array with entries. extern Obj GAP_CallFuncArray(Obj func, UInt narg, Obj args[]); +//// +//// floats +//// + +// Returns 1 if is a GAP machine float, 0 if not. +extern Int GAP_IsMacFloat(Obj obj); + +// Returns the value of the GAP machine float object . +// If is not a machine float object, an error is raised. +extern double GAP_ValueMacFloat(Obj obj); + +// Returns a new GAP machine float with value . +extern Obj GAP_NewMacFloat(double x); + + //// //// integers ////