- Posts: 170
- Thank you received: 0
convert 32 bit float in 64 bit float
- papagno-source
- Topic Author
- Offline
- Elite Member
-
Less
More
1 year 10 months ago #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?
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 to join the conversation.
1 year 9 months ago #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
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 to join the conversation.
Time to create page: 0.115 seconds
