Skip to content

emsr/cxx_math_const

Repository files navigation

C++ Math Constants

[![Build Status](https://travis-ci.orgBuild Status Codacy Badge

This project collects various ideas about mathematical constants for C++.

Most of these constants are now in the standard for C++20. These versions under namespace emsr will work under C++17.

New ideas:

There are several directions this could go once the basics are in place.

  • template<typename Constant, typename NumTp> class floating_point_constant { NumTp fact; };

  • Constant is able to belch out mantissa bits - as many as needed for the type of float NumTp. Actually NumTp could be floating-point, rational or fixed-point.

  • Math operations involving floating_point_constant would modify the factor and accumulate operations using template programming. Ratios need to cancel the constant.

  • Only evaluate at the end and with the best precision.

  • This could work a lot like units.