exa.core.util.formatting.scientific_rounding#
- scientific_rounding(value, uncertainty)#
Round a value according to uncertainty using scientific rounding rules.
- Parameters:
value (Annotated[bool | str | int | float | complex | ndarray, PlainValidator(func=~exa.common.data.value.validate_value, json_schema_input_type=~typing.Any), PlainSerializer(func=~exa.common.data.value.serialize_value, return_type=PydanticUndefined, when_used=always), WithJsonSchema(json_schema={}, mode=None)]) – The value to be rounded.
uncertainty (Annotated[int | float | complex | ndarray, PlainValidator(func=~exa.common.data.value.validate_value, json_schema_input_type=~typing.Any), PlainSerializer(func=~exa.common.data.value.serialize_value, return_type=PydanticUndefined, when_used=always), WithJsonSchema(json_schema={}, mode=None)] | None) – The uncertainty of the value.
- Returns:
A string formatted like “<rounded value>±<rounded uncertainty>”
- Return type: