convert 32 bit float in 64 bit float

More
25 Dec 2024 19:39 #317369 by papagno-source
convert 32 bit float in 64 bit float was created by papagno-source
Good morning.
If a variable declared as float exceeds the maximum positive limit, adding the value 1 changes its sign to negative. Is there a component that can manage the saturation of a float variable even after its saturation in both positive and negative directions?

Please Log in or Create an account to join the conversation.

More
08 Jan 2025 17:21 #318434 by andypugh
Replied by andypugh on topic convert 32 bit float in 64 bit float
All HAL float pins are 64-bit doubles.

Are you needing to deal with Single precision floats from something like Modbus or EtherCAT.

In the general case there is no way to do this, as there is no way to know what was intended. But if there is an assumption that the value is approximately continuous then you can make an inference.

That said, it's hard to think of any engineering quantity inside a CNC controller that could overflow. (encoder and stepgen integer counts potentially can)

Also, I don't think that your initial assertion is correct:

stackoverflow.com/questions/61918158/how...t-max-1-defined-in-c

Please Log in or Create an account to join the conversation.

Time to create page: 0.091 seconds
Powered by Kunena Forum