Skip to content

Wrong behavior of "convert_str_time" for non integer dt in utils.py #137

@DamienTOQUER

Description

@DamienTOQUER

The function "convert_str_time" to convert string (ex "12ps") into frame number providing a dt (in ps) can give a wrong result for non integer dt. For example:

  • convert_str_time("10ps", 1) gives 10, as expected
  • convert_str_time("1ps", 0.1) gives 9

The reason behind is a floating point error: 1//0.1 = 9.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions