Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    float returns altered... though in range

    Scheduled Pinned Locked Moved SDK Help
    2 Posts 0 Posters 162 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 12/06/2009 at 12:46, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   11.027 
      Platform:    Mac  ;  
      Language(s) :   C.O.F.F.E.E  ;

      ---------
          Hi,
         I'm translating a timer that returns the date in seconds from a consistent start time 70 years ago. It creates a 10 digit number. I tack on a few more digits for my product key manipulation.
         Problem is, the values I get back are inconsistent. I understand that an integer has a range limit below my number, but even when I convert everything to floats, I run into problems after 12 digits. I've duplicated the problem in this simple COFFEE expression.
      Any ideas?
      Thanks,
      Graham

      > main(doc,op) \> { \> var vNum = 01034121024.0; // This float prints OK on next lines \> println("vNum = ", vNum); \> println("int(vNum = ", int(vNum) ); \> println("float(vNum) = ", float(vNum) ); \> println(" "); \> \> var vNum = 010341210240.0; // This float prints incorrectly on next lines \> println("vNum = ", vNum); \> println("int(vNum = ", int(vNum) ); \> println("float(vNum) = ", float(vNum) ); \> println(" "); \> \> var vNum = 01034121024; // This integer prints incorrectly (may \>                          //be over 2,147,483,648 integer limit even \>                          //though it starts with a zero... still 11 digits) \> println("vNum = ", vNum); \> println("int(vNum = ", int(vNum/100) ); \> println("float(vNum) = ", float(vNum/100) ); \> println(3.4E38); // Float limit seems OK \> println(2147483649); // This laps to (-) by two since int limit is ...648 \> println(2147483647); // This int, at limit, prints this number as expected \> \> println("-------------------------------------------------------"); \> }

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 13/06/2009 at 13:39, xxxxxxxx wrote:

        Do it as a string. Numbers in computer format can't start with a '0' (except for number smaller than 1 (0.xxxx) in floating point).

        1 Reply Last reply Reply Quote 0
        • First post
          Last post