AnsweredAssumed Answered

P1020 float to unsigned int

Question asked by quanli wang on Jul 29, 2015
Latest reply on Aug 11, 2015 by Serguei Podiatchev

I met a problem when I use P1020 board. I write the following program:

unsigned int ui1 = 0;

float f1 = -1.0;

ui1 = f1;


When I ran it on bareboard(without no OS),ui1 = 0.But when I ran it on Linux with the same controller, ui1 = 0xffffffff. Then I checked  the assembly and foung both used the instruction "EFSCTUIZ". So I want to know if any other conditions will affect the result of this instrucion.

Btw, I tried the negtive double to unsigned int convertion, the result is 0 no matter what the value of double data,the instruction used is "EFDCTUIZ".