Printing long long

Let us know what you think about the chipKIT, and what can be done to make it better!
Post Reply
pito
Posts: 193
Joined: Sun May 22, 2011 9:37 pm

Printing long long

Post by pito » Sat Jan 11, 2014 2:16 pm

Maybe that would be of great help when having it in Serial.print().
Adding printing to the print class:

Code: Select all

signed long long int
unsigned long long int
What we have now:

Code: Select all

D:\ProgramFiles\arduino\uecide\hardware\cores\chipKIT\api/Print.h:64:7: note: candidates are: void Print::println(const String&)
D:\ProgramFiles\arduino\uecide\hardware\cores\chipKIT\api/Print.h:65:7: note:                 void Print::println(const char*) <near match>
D:\ProgramFiles\arduino\uecide\hardware\cores\chipKIT\api/Print.h:66:7: note:                 void Print::println(char, int)
D:\ProgramFiles\arduino\uecide\hardware\cores\chipKIT\api/Print.h:67:7: note:                 void Print::println(unsigned char, int)
D:\ProgramFiles\arduino\uecide\hardware\cores\chipKIT\api/Print.h:68:7: note:                 void Print::println(int, int)
D:\ProgramFiles\arduino\uecide\hardware\cores\chipKIT\api/Print.h:69:7: note:                 void Print::println(unsigned int, int)
D:\ProgramFiles\arduino\uecide\hardware\cores\chipKIT\api/Print.h:70:7: note:                 void Print::println(long int, int)
D:\ProgramFiles\arduino\uecide\hardware\cores\chipKIT\api/Print.h:71:7: note:                 void Print::println(long unsigned int, int)
D:\ProgramFiles\arduino\uecide\hardware\cores\chipKIT\api/Print.h:72:7: note:                 void Print::println(double, int)
So we miss long long stuff (64bit) and double (64bit - this is its precision today).

This is a workaround for example:

Code: Select all

char buf[22];
long long int nnn = 123456789012345678LL;
sprintf(buf, "%lld", nnn);
Serial.print(buf);
Last edited by pito on Sat Jan 11, 2014 2:37 pm, edited 4 times in total.

User avatar
majenko
Site Admin
Posts: 2165
Joined: Wed Nov 09, 2011 7:51 pm
Location: UK
Contact:

Re: Printing long long and double

Post by majenko » Sat Jan 11, 2014 2:22 pm

The problem is, the Arduino API only uses long in the Print class, so we can't really warrant using long long as it would break the Arduino API compatibility.
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".

User avatar
Jacob Christ
Posts: 723
Joined: Sat May 28, 2011 6:34 am
Location: Southern California
Contact:

Re: Printing long long

Post by Jacob Christ » Wed Feb 12, 2014 4:15 pm

How would it break compatibility? Couldn't we as chipKIT take the view that Arduino is a subset of chipKIT, kind of like how C is a subset of C++? It also seems like this is something that we might be ahead of the curve on for Due that might be needed there in the future..

Jacob
PONTECH Quick240 an industrial form factor platform for chipKIT and Arduino users.

Post Reply