Altera_Forum
Honored Contributor
16 years agofancy conversion from real to unsigned
Hi Experts,
could someone give me a hint to make conversion: having a float number: CALIBRATION_CURRENT_LOGAIN : real:= 0.89552238805970152; i wanted to convert it to unsigned(15 downto 0) (declared as UWord) as: constant CALIBRATION_CONSTANT_LOGAIN : UWord := TO_UNSIGNED(integer(CALIBRATION_CURRENT_LOGAIN*real(2**15)),UWord'length); for some funny reasons I get unsigned value as "70F0" instead of "72A0" as it is supposed to be. any ideas where the error comes from? thanks d.