Skip to content
forked from johnmcfarlane/cnl

A Compositional Numeric Library for C++

License

Notifications You must be signed in to change notification settings

somefunAgba/cnl

 
 

Repository files navigation

Compositional Numeric Library

Build Status Build status CircleCI Join the chat at https://gitter.im/cppcnl/community

The Compositional Numeric Library (CNL) is a C++ library of fixed-precision numeric classes which enhance integers to deliver safer, simpler, cheaper arithmetic types. Documentation can be found here.

Requirements

Linux

Compiled on x86-64 and armv7. Tested on x86-86 using Travis and CircleCI.

Requires:

  • GCC 5.1 / Clang 4.0

Optional:

  • CMake (3.5.1)
  • Boost - facilitates multiprecision support
  • Conan - package manager makes it easier to install test dependencies
  • Doxygen - generates documentation in the doc/gh-pages directory

Windows

Tested on AppVeyor and on Windows 10 Professional with CMake 3.8.0. Requires:

  • MSBuild 15.0 (VS 2017)
  • CMake 3.8.0

Instructions

Download

The library is hosted on GitHub:

cd /some/directory
git clone https://github.com/johnmcfarlane/cnl.git

Build

CNL is a header-only library so there is no need to build it. However, it comes with a number of tests and benchmarks.

Running Tests

  1. Prepare Conan package manager:

    conan remote add johnmcfarlane/cnl https://api.bintray.com/conan/johnmcfarlane/cnl
  2. Generate the build system:

    mkdir build
    cd build
    cmake -DCMAKE_BUILD_TYPE=Debug -DCNL_DEV=ON ..
  3. Build tests:

    • For Linux:

      cmake --build . --target Tests -- -j $(nproc)
    • For Windows:

      cmake --build .
  4. Run tests:

    ctest

Running Benchmarks

  1. Generate the build system (optimized):

    cmake -DCMAKE_BUILD_TYPE=Release -DCNL_DEV=ON ..

  2. Build benchmarks:

    cmake --build . --target Benchmark

  3. Run benchmarks:

    src/benchmark/Benchmark

Additional build system generation options:

  1. To describe CNL build options:

    cmake -LH ..

  2. Then to apply an option, e.g. to disabled exceptions:

    cmake -DCNL_EXCEPTIONS=OFF ..

Integration

The API is exposed through headers in the include directory. Add this to your system header list and include, e.g.:

// to use a specific type:
#include <cnl/scaled_integer.h>

// or to include all CNL types:
#include <cnl/all.h>

Example Projects

Examples of projects using CNL:

  • CDSP - Compositional DSP Library for C++;
  • BrewBlox firmware - firmware for a brewery controller
  • cnl_example - minimal CMake-based project which uses CNL as a dependency.

Further Reading

Contact Information

All feedback greatly appreciated.

Developed with CLion: A Cross-Platform IDE for C and C++ by JetBrains.

About

A Compositional Numeric Library for C++

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 96.6%
  • CMake 1.6%
  • Other 1.8%