fpm icon indicating copy to clipboard operation
fpm copied to clipboard

Provide a way to serialize fpm::fixed

Open Eren121 opened this issue 3 years ago • 2 comments

Is the value returned by raw_value() the same across all platforms for a given fixed point value? That's for serialization and sending into network and ensure portability. I assume yes but just to be sure.

Eren121 avatar Apr 22 '22 16:04 Eren121

Hi @Eren121, it is the same in practice, but to be fair, FPM makes no guarantee for this. You could use raw_value() for now, but "officially" supporting platform-stable (and backwards-compatible) serialization would be a good feature request.

MikeLankamp avatar Apr 22 '22 16:04 MikeLankamp

Thanks for your answer. So I turn this into a feature request : making fpm::fixed serialization-friendly ^^

If it is with raw_value() or another method to ensure raw_value() backward-compatibility, that's not important. Currently it could be implemented surely by serializing a char array (e.g. "1.4672") but, that seems a waste of memory space, therefore of performance.

Eren121 avatar Apr 22 '22 17:04 Eren121