3 ms·
How would the compiler be able to use any fast, floating point specific instructions if you parsed it as a hexadecimal string?
by orf 6y ago
How would the compiler be able to use any fast, floating point specific instructions if you parsed it as a hexadecimal string?
- MauranKilom 6y agoNot sure I understand the question. The suggestion is to use hexfloats, as they are unambiguous and straightforward to convert from and to (as opposed to anything with decimal significands): https://www.cplusplus.com/reference/ios/hexfloat/ https://www.cplusplus.com/reference/ios/hexfloat/
- firebacon 6y agoYou don't need any specific instructions. The hex encoded double contains the final binary representation of the floating point number. So no conversion is required to load it, except maybe for swapping around bytes on some architectures. Conceptually: double v; memcpy(&v, "\x00\x00\x00\x00\x00\xe4\x94\x40", sizeof(v)); // LE