Floating point wrapper

The functions in the arb_fpwrap module of Arb are handled different from other functions. The methods for them are generated using

Arblib.ArbCall.@arbfpwrapcall_strMacro
@arbfpwrapcall_str str

Parse a string as an Arblib.ArbCall.ArbFPWrapFunction, generate the code for a corresponding method with Arblib.ArbCall.jlcode and evaluate the code.

For example

arbfpwrapcall"int arb_fpwrap_double_exp(double * res, double x, int flags)"

defines the method

fpwrap_exp(
    x::Union{Float16, Float32, Float64};
    error_on_failure::Bool = Arblib.ArbCall.fpwrap_error_on_failure_default(),
    correct_rounding::Bool = false, work_limit::Integer = 8,
)
Arblib.ArbCall.ArbFPWrapFunctionType
ArbFPWrapFunction{T}(fname, args)
ArbFPWrapFunction(str)

Struct representing an Arb function from the arb_fpwrap.h module.

Arblib.ArbCall.jlcodeMethod
jlcode(af::ArbFPWrapFunction, jl_fname = jlfname(af))

Generate the Julia code for calling a function from the fpwrap module of Arb from Julia.

The name for the generated method is given by removing the arb prefix and the double or cdouble in the middle of the name.

The flag argument that the C functions take are split into several keyword arguments in Julia. For the double type this is correct_rounding::Bool = false and work_limit::Integer = 8. For the cdouble type it also includes accurate_parts::Bool = false. The default values correspond to setting the flag to 0 in C.

The C functions return an int flag indicating the status. If the return flag is FPWRAP_SUCCESS the computed value is returned. If the return flag is FPWRAP_UNABLE it throws an error if the keyword argument error_on_failure is true and returns NaN otherwise. The default value for error_on_failure is handled by the following two methods