Rel 0013 and Serial.print(double)

I was happy to see support for printing doubles in Rel. 0013. (Nicer than rolling my own "printDouble" when I need it.)

However, I prefer a default of 4 decimal places for doubles instead of the current 2 places provided.

So I modified the Print.cpp file in hardware\cores\arduino - changing . . .

void Print::print(double n)
{
  printFloat(n, 2);
}

to this . . .

void Print::print(double n)
{
  printFloat(n, 4);
}

It seems to work fine.

My question is, is there any known problems I might experiance down the road for having done this?
(I guess I mean, was there a reason to limit it to 2 places other than it was seen as the most common usage?)

If I were tying in the float support, I would think this is probably the technique I'd use. Not sure what mellis' reasoning was, he may have had some preference or issue with this approach.

class Print {
...
    void print(double n[glow], int places = 2[/glow]);
...
};
void Print::print(double n[glow], int places /* = 2 */[/glow])
{
  printFloat(n, [glow]places[/glow]);
}

Yes, I thought having a parameter for places would be the way to go, but I wasn't sure if it would interfere with "DEC", "BIN", "BYTE", etc. so I was afraid to mess with it.

BroHogan, there should be no problem with the change you made.

The implimentation of double in print.cpp can be easily enhanced take an optional argument (thanks to the good work of Mikal) but the arduino team wanted to get release 0013 out the door before this could be tested. I believe it will be going into the next release.

Yep, it should be fine to change the precision. We'll make this user-specifiable in the next release.