Skip to content

Commit

Permalink
test: improve test precision function (#285)
Browse files Browse the repository at this point in the history
  • Loading branch information
rickstaa authored Aug 8, 2023
1 parent 07f498c commit 0fb571b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions stable_gym/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,17 +325,19 @@ def convert_gym_box_to_gymnasium_box(gym_box_space):
)


def change_precision(input_value, precision=8):
def change_precision(input_value, precision=16):
"""Changes the precision of a value.
Args:
input_value (object): The input value.
precision (int, optional): The precision (i.e. number of decimals) to use.
Defaults to ``8``.
Defaults to ``16``. If ``None``, the input value is returned as is.
Returns:
object: The input value with the new precision.
"""
if precision is None:
return input_value
if isinstance(input_value, dict):
for key, value in input_value.items():
input_value[key] = change_precision(value, precision)
Expand Down

0 comments on commit 0fb571b

Please sign in to comment.