Time Nick Message 20:59 Krock nerzhul: what kind of "updates on the server" do you mean? 21:36 Krock nerzhul: new toy #7569 21:36 ShadowBot https://github.com/minetest/minetest/issues/7569 -- Send custom floats (log2) by SmallJoker 21:54 p_gimeno sorry for the dumb question, but what's wrong with just using F32? 21:54 p_gimeno I mean, actual single-precision floats 21:54 Krock as in memcpy? 21:56 p_gimeno yes, or union integer and hton/ntoh 21:56 Krock the memory representation is not defined, so it would be required to disassemble each feature of the float 21:56 Krock and the bitop everything together again so that it's ensured to be the correct format 21:56 Krock see also: https://github.com/minetest/minetest/pull/6312 21:59 Krock I cannot test whether all by Minetest supported architectures also will work with this idea - missing computers, time and motivation to get the stuff together 22:00 p_gimeno you don't need floats to work the same in all architectures in order to transmit them through a network, and while the C++ standard does not specify floats to be IEEE-754 compliant, you can add a configure check and either refuse to compile, or have fallback code for IEEE conversion 22:01 p_gimeno I'm pretty sure there must be simple functions with a usable license that convert float to IEEE and vice versa 22:04 p_gimeno it seems you did a good job getting close to that, already 22:06 Krock thanks. However, it's not perfect. Special numbers (nan/inf/-inf) and those close to the maximal float value aren't handled correctly 22:09 p_gimeno special cases are trivial to handle: if (isnan(f)) return 0x7FC00000; if (isinf(f)) return 0x7F800000 | (f < 0) << 31; 22:11 p_gimeno well, the other way around has the danger that the implementation aborts on division by zero instead of returning NaN/Inf, but I doubt that's a problem 22:12 p_gimeno that's assuming you want to transmit these values through the network in the first place 22:13 Krock yes. at least have the regular values correctly and as precise as possible transmit 22:14 Krock will check logs 22:17 p_gimeno a configure check (or even runtime) seems pretty trivial: https://stackoverflow.com/questions/5777484/how-to-check-if-c-compiler-uses-ieee-754-floating-point-standard 22:34 p_gimeno here's one such IEEE conversion project: https://github.com/MalcolmMcLean/ieee754 22:35 p_gimeno unfortunately that one doesn't specify a license, guess you could bug the author in an issue to see if he would add one 22:45 nerzhul Krock interesting PR