phoenix-rtos / phoenix-rtos-project

Sample project using Phoenix-RTOS
https://phoenix-rtos.com
BSD 3-Clause "New" or "Revised" License
45 stars 32 forks source link

libphoenix: `printf()` cannot print floats bigger than 2^20 #400

Closed niewim19 closed 1 year ago

niewim19 commented 2 years ago

Test scenario:

Printing floating point values larger than 2^20 results in wrong number printed (checked on ia32-generic)

Test case:

Test code:

    printf("%f\n", 1048575.F);   /* 2^20 - 1 */
    printf("%f\n", 1048576.F);   /* 2^20 */
    printf("%f\n\n", 1048577.F); /* 2^20 + 1 */

    printf("%f\n", 1048575.); /* 2^20 - 1 */
    printf("%f\n", 1048576.); /* 2^20 */
    printf("%f\n", 1048577.); /* 2^20 + 1 */

results in:

1048575.000000
1048576.000000
1099511627777.000000

1048575.000000
1048576.000000
1099511627777.000000
niewim19 commented 2 years ago

Issue forces changes in tests proposed in

gerard5 commented 1 year ago

Mention of pull-request which extends support for %f (float, doubles) -> https://github.com/phoenix-rtos/libphoenix/pull/228

astalke commented 1 year ago

Fixed in: