mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 13:53:34 +08:00
Matrix: correct print buffer size prediction
Apparently printf of %8.8g can result in 8 significant digits + dot + scientific notation e.g. "e+12" = 14 bytes
This commit is contained in:
committed by
Julian Kent
parent
2cca35c8fe
commit
c6db357c92
+2
-2
@@ -352,8 +352,8 @@ public:
|
||||
|
||||
void print(FILE *stream = stdout) const
|
||||
{
|
||||
// element: tab, point, 8 digits; row: newline; string: \0 end
|
||||
static const size_t n = 10*N*M + M + 1;
|
||||
// element: tab, point, 8 digits, 4 scientific notation chars; row: newline; string: \0 end
|
||||
static const size_t n = 15*N*M + M + 1;
|
||||
char * buf = new char[n];
|
||||
write_string(buf, n);
|
||||
fprintf(stream, "%s\n", buf);
|
||||
|
||||
Reference in New Issue
Block a user