C++ API: Add double operator, type checks (thanks to @CzarekTomczak)