Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.
the float data type is a 32bit value, if you convert it to a variable that uses only one byte like an unsigned char then you will loose all the decimals and you can only represent integers from 0 to 255 (0b00000000 to 0b11111111).
Assuming that the value can fit in 8bits and you don't mind truncating the decimals you can use (unsigned char)my_float_variable
Are the float values higher than zero or they can be negative too?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.