MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / __format_float

Method __format_float

system/lib/libcxx/src/locale.cpp:4081–4119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4079}
4080
4081bool __num_put_base::__format_float(char* __fmtp, const char* __len, ios_base::fmtflags __flags) {
4082 bool specify_precision = true;
4083 if (__flags & ios_base::showpos)
4084 *__fmtp++ = '+';
4085 if (__flags & ios_base::showpoint)
4086 *__fmtp++ = '#';
4087 ios_base::fmtflags floatfield = __flags & ios_base::floatfield;
4088 bool uppercase = (__flags & ios_base::uppercase) != 0;
4089 if (floatfield == (ios_base::fixed | ios_base::scientific))
4090 specify_precision = false;
4091 else {
4092 *__fmtp++ = '.';
4093 *__fmtp++ = '*';
4094 }
4095 while (*__len)
4096 *__fmtp++ = *__len++;
4097 if (floatfield == ios_base::fixed) {
4098 if (uppercase)
4099 *__fmtp = 'F';
4100 else
4101 *__fmtp = 'f';
4102 } else if (floatfield == ios_base::scientific) {
4103 if (uppercase)
4104 *__fmtp = 'E';
4105 else
4106 *__fmtp = 'e';
4107 } else if (floatfield == (ios_base::fixed | ios_base::scientific)) {
4108 if (uppercase)
4109 *__fmtp = 'A';
4110 else
4111 *__fmtp = 'a';
4112 } else {
4113 if (uppercase)
4114 *__fmtp = 'G';
4115 else
4116 *__fmtp = 'g';
4117 }
4118 return specify_precision;
4119}
4120
4121char* __num_put_base::__identify_padding(char* __nb, char* __ne, const ios_base& __iob) {
4122 switch (__iob.flags() & ios_base::adjustfield) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected