IEC 559 support in LibTomMath on FreeBSD

Raku is the new name of Perl 6, a language inspired by Perl and compiled for a virtual machine. When preparing FreeBSD ports for the Raku ecosystem, I’ve noticed those depend on LibTomMath, with IEEE754 floating point format support.

Let’s try to call zef, a tool to manage modules (dependencies) in Raku:

$ raku … zef … //usr/local/lib/ Undefined symbol "mp_set_double"

(MoarVM is the virtual machine running the Raku bytecode)

When building the port:
bn_mp_set_double.c:44:6: warning: "mp_set_double implementation is
only available on platforms with IEEE754 floating point format"

The source code protects mp_set_double function with a check for
STDC_IEC_559 defined.

This is well supported by the OS, as documented in man 3 ieee, but the compilers clang and gcc don’t seem to define it. On the Linux platform, glibc defines it.

The library refactored the way to detect STDC_IEC_559, but this isn’t released yet.

Pietro Cerutti, who maintains the FreeBSD port for LibTomMath, merged this better detection patch, so w can benefit of those features right now.

So you can know use mp_set_double on FreeBSD machines too, and the zef package manager.

Related links

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.