schrodinger.math.mathutils module

Contains math-related utility functions

Copyright Schrodinger, LLC. All rights reserved.

schrodinger.math.mathutils.round_value(val, precision=3)

Return val as a string with the required precision, or None if val is a string. Uses scientific notation for very large or small values, if the precision allows.

Parameters:
  • val (float) – The value to round
  • precision (int) – The precision needed after rounding. A precision of 2 means two decimal places should be kept after rounding. A negative precision indicates how many digits can be replaced with zeros before the decimal point. -5 means that 123456 can be shown as 1e5, -3 means it can be shown as 1.23e5.
Return type:

str or None

Returns:

A string with the required precision, or None if the input is a string