Skip to content

Dev Notes: 2017_01_19

Dave Hudson edited this page Jan 19, 2017 · 5 revisions

Minor Updates

In my last update I had introduced the function c8::toull() to convert a natural number to an unsigned long long, and c8::toll() to convert an integer to a long long. Today I've added c8:todouble() to convert a rational to a double. This means that all 3 types now have a means of converting in and out of C++ native types.

In my previous update I had added c8::isull() and c8::isll() too, but I've now removed them. Implementing the matching c8::isdouble() would have been almost impossible as it would have had to do all of the same work as c8::todouble(), but the more I've thought about it, the more I've realized that they merely encouraged an imperative approach, and one of my aims was to design the c8 library to support functional-style programming as much as possible. I also realized that it was pretty trivial to implement their functionality in user code anway, e.g.:

Clone this wiki locally