AnsweredAssumed Answered

Negative float value print

Question asked by Martin Dusek on Aug 31, 2016
Latest reply on Feb 16, 2017 by Chris Paynter

Hi in KDS 3.2 and latest SDK for K64F, this code:

 

double var1 = -5.8;

PRINTF("%f\r\n", var1);

double var2 = -10.4;

PRINTF("%f\r\n, var2);

double var3 = 1.5;

PRINTF("%f\r\n", var3);

 

produces:

 

-6.8

-11.4

1.5

 

i.e. negative double numbers are printed with -1 added to them. Why and how to fix it?

Outcomes