argRound(a: number) 🡒 number, pure function

Returns the answer to the question at what point the trailing 1 becomes too small to be worth printing?, or worse, becomes smaller than the precision of floating-point numbers.

The rule is as follows: if we find 000 or 999 in the decimal expansion of a number, then it should be rounded for display. argRound(5.3001) and argRound(5.2998) return 4, suggesting to keep all 4 digits after the decimal point, but argRound(5.30001) and argRound(5.29998) return 1, suggesting that to present these numbers as 5.3. Thus, 5.3001 stays 5.3001; 5.30001 would become 5.3; 5.2998 stays 5.2998; 5.29998 becomes 5.3.


show summary with
  argRound(5.3001) as "of 5.3001"
  argRound(5.30001) as "of 5.30001"
  argRound(5.29998) as "of 5.29998"

See also