Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By martinayotte
#52111 As mentioned in the other thread :

Of course Print class doesn't support uint64_t type.
Trying to split the print into two 32bits parts, it seems that even gcc has trouble handling 64bits.
After digging the issue, trying also the famous BigNumber library, I've only figured out the following way to handle it :
Code: Select all//    BigNumber l = (BigNumber)14000000000ULL;
    BigNumber l = (BigNumber)1400000 * (BigNumber)10000;
    l.printTo(p);
    p.println();

As we can see, the commented line isn't working too, gcc seems to handle this constructor as 32bits too, so I had to use the second declaration to create the BigNumber and make it working.

EDIT :
I didn't dig enough ...
The Nick Gammon BigNumber didn't have a 64bits constructor, but it have a string constructor has a work around.
Code: Select allBigNumber l = (BigNumber)"14000000000";

Also, I did something wrong while testing plain uint64_t arithmetics, the following code is working :
Code: Select all    uint64_t l = 12345678901ULL;
    Serial.print(uint32_t(l / 100000));
    Serial.println(uint32_t(l % 100000));

So, gcc isn't guilty at all ... :ugeek:
User avatar
By tma
#52421 According to this Sparkfun site Arduino does not support 64 bit math:

https://learn.sparkfun.com/tutorials/da ... in-arduino

However I do not know if this applies to the esp8266 port which compiles without error with uint64_t variables. To confirm what is happening I need to be able to print 64 bit integers. Others have also had the need to print 64 bit integers and have written library code for the AVR:

http://forum.arduino.cc/index.php?topic=143584.0

I have ported the code over to esp8266 and have it to the point where it will compile but have not yet confirmed that it works.
User avatar
By tma
#52648 Greetings,

I have ported a patch that I found for the AVR library over to the print library for the esp8266. It seems to work well for my needs. Also the Arduino esp8266 language seems to handle 64 bit math OK for my application. The modified library files are attached - use at your own risk.
You do not have the required permissions to view the files attached to this post.