arground

arground, function

def pure arground(a: number): number

Returns the number of decimal places to retain when displaying the input number a.

Examples

show summary "Roundings" with
  arground(5.3001) as "of 5.3001"
  arground(5.30001) as "of 5.30001"
  arground(5.29998) as "of 5.29998"

Output:

of 5.3001 of 5.30001 of 5.29998
1 1 1

Remarks

This function favors shorter display forms when the decimal expansion is close to a round value. In the example above, all inputs return 1, meaning one decimal place is recommended.

User Contributed Notes
0 notes + add a note