AnsweredAssumed Answered

Fast floating point math

Question asked by Kilohercas on Apr 3, 2013
Latest reply on Apr 4, 2013 by fm
Hello, i run in to a problem, where i need to do math with single precision floating point.
it looks like if(...) condition, and printing floating point to uint16_t is very slow.
so i have two questions:
first, what is the fastest way to print float to integer ? ( float will be between -10 and +10, and that should correspond to 0x0000 and 0xFFFF in integer.)
and second, how can i read binary data from float variable to u32 variables, so i can make if(...) condition faster (i need to set floating point to zero, if it is more than 10.0 or less that -10.0
 ( i know that floating point variable is in memory with adress of 0x2000000C so all i need to do is to copy raw binary data to u32 variable, and check mantissa and exponent to see if it goes off the limit, but i don't know how to copy 32b data to 32b unsigned integer, if i try to do that with pointers i get error, or compiler do conversion for me, and slow my program)