Skip to content

[Bug]: RangeParameterConfig error when using some float stepsize #4781

@AlbanMor

Description

@AlbanMor

What happened?

Hi,
First of all, Thank you for this amazing package!

Here is the issue. When trying to use a step size of 0.1 in the range of [8 to 9.8] in a RangeParameterConfig, when trying to configure the experiment, it throws the error "The range of the parameter must be evenly divisible by the step size." when trying to configure the experiment.

The issue is that in that case for some reason (upper - lower) % step_size != 0. It is equal to 6.106226635438361e-16...

Please provide a minimal, reproducible example of the unexpected behavior.

from ax.api.configs import RangeParameterConfig

test = RangeParameterConfig(name="test", parameter_type="float", bounds=(8, 9.8), step_size=0.1)

print((9.8 - 8) % 0.1)

client = Client()
client.configure_experiment(parameters=[test])

Please paste any relevant traceback/logs produced by the example provided.

Ax Version

1.2.1

Python Version

3.13.3

Operating System

MS

(Optional) Describe any potential fixes you've considered to the issue outlined above.

Might be worth changing the code for if (upper - lower) % step_size > 1e-14. But I don<t know what would be the implications further down the road in your package.

In the mean time I'll just be changing my units ;-).

Pull Request

None

Code of Conduct

  • I agree to follow Ax's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions