AnsweredAssumed Answered

double precision size

Question asked by Adrian Rockall on Sep 28, 2015
Latest reply on Sep 29, 2015 by Adrian Rockall



Is there support (or going to be support) for printing double precision numbers in KSDK 1.2 / MQX?


I am building with IAR and I generated the code with KDS 3.0.


In the fp_prv.h file it mentions about IEEE 754 single-precision format with an 8 bit exponent, etc but I can't see any mention of double-precision. My application requires the use of double in a couple of places but when I try to use sprintf the stack gets corrupted and the process crashes. This is because double has 11 bit exponent and 53 digits so the buffer is not big enough during the while(intpart != 0) loop in _cvt in fp_prv.c and no check is made in the loop for the pointer going out of bounds. If I change the definition of NDIG to 1080 ( max(E) = 1023 and max(F) = 53 ) then everything seems to be OK.


Best regards,