MCPcopy Create free account
hub / github.com/CruiserOne/Astrolog / FormatR

Function FormatR

general.cpp:348–365  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

346// fractional digits, and dropping trailing '0' characters.
347
348void FormatR(char *sz, real r, int n)
349{
350 char szT[cchSzDef], *pch;
351 int x = n/100, y = NAbs(n%100);
352
353 // If n > 100, use 100's place as minimum field length for entire number.
354 if (x != 0)
355 sprintf(szT, "%%%d.%df", NAbs(x) + y + 1, y);
356 else
357 sprintf(szT, "%%.%df", NAbs(n));
358 sprintf(sz, szT, r);
359 for (pch = sz; *pch; pch++)
360 ;
361 while (pch > sz && *(--pch) == '0') // Drop off any trailing 0 digits.
362 ;
363 // Positive n means ensure at least one fractional digit.
364 pch[n > 0 ? 1 + (*pch == '.') : (*pch != '.')] = chNull;
365}
366
367
368// Blend two RGB colors along the specified proportion between them. Returned

Callers 13

ShowParseExpressionFunction · 0.85
PchFormatExpressionFunction · 0.85
PrintAspectsFunction · 0.85
FOutputSettingsFunction · 0.85
DrawInfoFunction · 0.85
XChartMidpointFunction · 0.85
FErrorValRFunction · 0.85
SzElevationFunction · 0.85
SzTemperatureFunction · 0.85
SzLengthFunction · 0.85
SetEditRFunction · 0.85
DlgCalcFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected