File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,10 @@ template <typename Out> struct Renderer
5454 // `fmt::memory_buffer` stores first 500 bytes in the object itself(i.e. on stack in this
5555 // case) and then grows using heap if needed
5656 fmt::memory_buffer buffer;
57- fmt::format_to (std::back_inserter (buffer), FMT_COMPILE (" {:.10g}" ), number.value );
57+ if (static_cast <std::uint64_t >(number.value ) == number.value )
58+ fmt::format_to (std::back_inserter (buffer), FMT_COMPILE (" {}" ), static_cast <std::uint64_t >(number.value ));
59+ else
60+ fmt::format_to (std::back_inserter (buffer), FMT_COMPILE (" {:.10g}" ), number.value );
5861
5962 write (buffer.data (), buffer.size ());
6063 }
Original file line number Diff line number Diff line change @@ -87,8 +87,13 @@ BOOST_AUTO_TEST_CASE(test_json_issue_6531)
8787 BOOST_CHECK_EQUAL (output, " 0.1234567892" );
8888
8989 output.clear ();
90- renderer (123456789123456789 .);
91- BOOST_CHECK_EQUAL (output, " 1.234567891e+17" );
90+ renderer (12345678912345678 .);
91+ BOOST_CHECK_EQUAL (output, " 12345678912345678" );
92+
93+ // handle large osm ids
94+ output.clear ();
95+ renderer (1000396615812 );
96+ BOOST_CHECK_EQUAL (output, " 1000396615812" );
9297}
9398
9499BOOST_AUTO_TEST_SUITE_END ()
You can’t perform that action at this time.
0 commit comments