No announcement yet.

Cast String to float or double

  • Filter
  • Time
  • Show
Clear All
new posts

  • Cast String to float or double


    how i can cast a string to float?

    In ANSI C @ string.h have a function atof(char*) but in i have not found this function in the evolution headers...

    What i can now doing? How i can make a easy soloution?

    thanks Issahie

  • #2
    Sorry - no floating point help on the processor. Do you just need to convert the string into a IEEE float or are you planning to do some math?


    • #3
      I planing to do something in math...i have a easy solution for floating point operation found but now i have another problem.

      I want division a 64 Bit / 32 Bit attribute. Where i can get standard 64 Bit division solutions?

      The Processor MatchportAR support only uint32_t divisions...

      Can help me?


      • #4
        I have done a bit of experimentation and it appears that GCC (CodeSourcery) for the ColdFire processor provides an emulation library for 64 bit floating point and integer math. This is accomplished using 32 bit operations with calls to intrinsic utility functions automatically generated by the compiler.

        We provide a uint64_t and int64_t data type in Evolution_types.h which is associated with the native type "unsigned long long" and "signed long long". We do not, however, provide a data type for 64 bit floating point values. I would suggest you define your own, using something like the following:

        typedef double float32_t;
        typedef long double float64_t;

        Evolution output functions such as printf and sprintf do not support 64 bit or floating point data types.