MCPcopy Create free account
hub / github.com/coreutils/coreutils / expld

Function expld

src/numfmt.c:358–374  ·  view source on GitHub ↗

Scale down 'val', returns 'updated val' and 'x', such that val*base^X = original val Similar to "frexpl(3)" but without requiring 'libm', allowing only integer scale, limited functionality and error checking. */

Source from the content-addressed store, hash-verified

356 Similar to "frexpl(3)" but without requiring 'libm',
357 allowing only integer scale, limited functionality and error checking. */
358static long double
359expld (long double val, int base, int /*output */ *x)
360{
361 int power = 0;
362
363 if (val >= -LDBL_MAX && val <= LDBL_MAX)
364 {
365 while (absld (val) >= base)
366 {
367 ++power;
368 val /= base;
369 }
370 }
371 if (x)
372 *x = power;
373 return val;
374}
375
376/* EXTREMELY limited 'ceil' - without 'libm'.
377 Assumes values that fit in intmax_t. */

Callers 2

double_to_humanFunction · 0.85
prepare_padded_numberFunction · 0.85

Calls 1

absldFunction · 0.85

Tested by

no test coverage detected