MCPcopy Create free account
hub / github.com/crownengine/crown / toString

Function toString

3rdparty/bx/src/dtoa.cpp:429–461  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

427 }
428
429 int32_t toString(char* _dst, int32_t _max, double _value)
430 {
431 int32_t sign = 0 != (doubleToBits(_value) & kDoubleSignMask) ? 1 : 0;
432 if (1 == sign)
433 {
434 *_dst++ = '-';
435 --_max;
436 _value = -_value;
437 }
438
439 if (isNan(_value) )
440 {
441 return (int32_t)strCopy(_dst, _max, "nan") + sign;
442 }
443 else if (isInfinite(_value) )
444 {
445 return (int32_t)strCopy(_dst, _max, "inf") + sign;
446 }
447
448 int32_t len;
449 if (0.0 == _value)
450 {
451 len = (int32_t)strCopy(_dst, _max, "0.0");
452 }
453 else
454 {
455 int32_t kk;
456 Grisu2(_value, _dst, &len, &kk);
457 len = Prettify(_dst, len, kk);
458 }
459
460 return len + sign;
461 }
462
463 static void reverse(char* _dst, int32_t _len)
464 {

Callers 2

toStringSignedFunction · 0.70
writeFunction · 0.70

Calls 6

strCopyFunction · 0.85
Grisu2Function · 0.85
PrettifyFunction · 0.85
toStringSignedFunction · 0.85
toStringUnsignedFunction · 0.85
isInfiniteFunction · 0.50

Tested by

no test coverage detected