4 ms·
If you feel that using type casting to implement round-to-nearest-integer is cheating, an earlier post is on the subject of implementing a substitute for type c
by pascal_cuoq 13y ago
If you feel that using type casting to implement round-to-nearest-integer is cheating, an earlier post is on the subject of implementing a substitute for type casting without type casting.
It uses only floating-point arithmetic, but it should still satisfy your curiosity for bit-fiddling.
http://blog.frama-c.com/index.php?post/2013/05/01/A-conversionless-conversion-function2 http://blog.frama-c.com/index.php?post/2013/05/01/A-conversi...