lakshayg

Sollya - library for safe floating-point code development

I discovered Sollya today when trying to find a good polynomial approximation to ArcTan in [0, 1]. This tool provides an implementation of the Remez Algorithm which I used to compute the polynomial approximation.

Installation

Installation of this tool is straightforward on Ubuntu. It depends on the following libraries:

All of these can be installed on Ubuntu by running apt-get install {lib}.

Building the tool: ./configure && make

Usage

The documentation of Sollya has a good page with various examples

The tool provides a number of functions. To compute the approximation, we can use the remez function. Here is an example of approximating sin(x) in the range [-pi/2, pi/2].

remez(sin(x),[|1,3,5,7|],[-pi/2,pi/2],1,1e-10);

This yields a polynomial with the following coefficients

N coefficient
1 0.9999966159080027758584108080842308779136959066439
3 -0.16664828381895057659620411447060988814996627242661
5 8.3063252271598984923167323097762502541923865405786e-3
7 -1.8363653976946848392387223432528423431195832560898e-4

Here’s a plot of the approximation error