TerraForge3D  2.3.1
3D Terrain And Landscape Generator

◆ append_exponent()

JSON_HEDLEY_RETURNS_NON_NULL char * nlohmann::detail::dtoa_impl::append_exponent ( char *  buf,
int  e 
)
inline

appends a decimal representation of e to buf

Returns
a pointer to the element following the exponent.
Precondition
-1000 < e < 1000

Definition at line 16411 of file json.hpp.

16412{
16413 JSON_ASSERT(e > -1000);
16414 JSON_ASSERT(e < 1000);
16415
16416 if (e < 0)
16417 {
16418 e = -e;
16419 *buf++ = '-';
16420 }
16421
16422 else
16423 {
16424 *buf++ = '+';
16425 }
16426
16427 auto k = static_cast<std::uint32_t>(e);
16428
16429 if (k < 10)
16430 {
16431 // Always print at least two digits in the exponent.
16432 // This is for compatibility with printf("%g").
16433 *buf++ = '0';
16434 *buf++ = static_cast<char>('0' + k);
16435 }
16436
16437 else if (k < 100)
16438 {
16439 *buf++ = static_cast<char>('0' + k / 10);
16440 k %= 10;
16441 *buf++ = static_cast<char>('0' + k);
16442 }
16443
16444 else
16445 {
16446 *buf++ = static_cast<char>('0' + k / 100);
16447 k %= 100;
16448 *buf++ = static_cast<char>('0' + k / 10);
16449 k %= 10;
16450 *buf++ = static_cast<char>('0' + k);
16451 }
16452
16453 return buf;
16454}