float_formatter

compas.numerical.float_formatter(x)[source]

Formats float to truncated string.

Parameters

x (float) – Input float.

Returns

str – Truncated string with default precision .2f.

Notes

stackoverflow.com/questions/21008858/formatting-floats-in-a-numpy-array float_formatter = lambda x: ‘%.2f’ % x

Examples

>>> float_formatter(3.14159265359)
'+3.14'