Assuming you get the data from C++ in the first place, why not just use the same data type?

Looks a lot like trying to make your life as hard as possible by artifically doing things in JavaScript instead of doing it in C++.

Cheers,
_