This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F280025C: Can't use sprintf for the error '64bit floating point operations are not allowed'

Part Number: TMS320F280025C

Hi experts,

I want to use 'sprintf' function in F280025C but the complier report that  '64bit floating point operations are not allowed'.

The configuration is as below.

BR

Jim

  • Hello Jim,

    I'm guessing BUCK_vInSensed_Volts is a float64_t datatype? If not, are there any other 64-bit floating point numbers in your program? Have you tried doing the type-casting outside of the sprintf function call to determine whether the problem is the conversion or something with calling sprintf?

    Best regards,

    Omer Amir

  • Hi Omer,

    Thanks for reply!

    BUCK_vInSensed_Volts is float32_t. I try to delete float64_t datatype defination to find if there is someplace use it, but there is no error due to that.

    Have you tried doing the type-casting outside of the sprintf function call to determine whether the problem is the conversion or something with calling sprintf?

    Yes, BUCK_vInSensed_Volts  itself is float32_t, so i think when calling sprintf and using float32_t, there is some operations transform float32_t to float64_t in sprintf.

    Pls help to check how to use sprintf in F280025C, Thanks!

    BR

    Jim

  • Hello Jim,

    Are you using any libraries for this project? If so, can you verify that they are built with the FPU32 configuration in the Project Properties > Build > C2000 Compiler > Processor Options?

    Also, can you show what that sprintf function is calling? When I enter it in my code and include the stdio.h header file and the below sample code I have no errors building.

    char *temp = "Test";
    float32_t val = 5.06f;
    sprintf(temp, "%3.0f", (float32_t)val);

    Best regards,

    Omer Amir

  • Hi Omer,

    Thanks a lot!

    I find there is a setting in Project Properties result in that error.

    I used '32' in that setting, and when i change to 'all', there is no errors.

    Can I use 'all' in that setting?

    BR

    Jim

  • Hello Jim,

    If you look at the compiler optimization guide, section 2.3.3 on Miscellaneous Useful Options talks about the --float_operations_allowed compiler setting. To summarize, 'all' is the default setting and allows all floating-point type operations (32-bit or 64-bit); the reason you would use this flag to be 32 or 64 would be if you want to prevent accidentally using a floating-point type operation that is inconsistent with your program.

    Best regards,

    Omer Amir