google / starlark-go

Starlark in Go: the Starlark configuration language, implemented in Go
BSD 3-Clause "New" or "Revised" License
2.32k stars 212 forks source link

lib/math: rename abs to fabs #362

Closed adonovan closed 3 years ago

adonovan commented 3 years ago

The new math.abs function should be renamed fabs, to follow Python, and because it always returns a float even when given an int. (Starlark should provide Python's abs function to return the absolute value of the same type.)

Let's do this soon before people start using math.abs. Thanks to @fenollp for pointing out the issue.

See context at https://github.com/google/starlark-go/pull/357#issuecomment-796944557. See spec issue for predeclared abs at https://github.com/bazelbuild/starlark/issues/183

@b5