src/pylib/builtins/round_float

Search:
Group by:
Source   Edit  

Procs

proc round(x: F; ndigit: int): F {....raises: [], tags: [], forbids: [].}
translated from CPython/Objects/floatobject.c:double_round rounds a finite double to the closest multiple of 10**-ndigits; here ndigits is within reasonable bounds (typically, -308 <= ndigits <= 323). Returns a Python float, or sets a Python error and returns NULL on failure (OverflowError and memory errors are possible
Hint:

variant whose F is float32 is not implemented, and won't be unless https://netlib.org/fp/ftoa.c is implemented ( none as of 2025-02-17)

Source   Edit