Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrapf documentation inconsistent with its behavior #61801

Closed
akien-mga opened this issue Jun 8, 2022 · 1 comment · Fixed by #61812
Closed

wrapf documentation inconsistent with its behavior #61801

akien-mga opened this issue Jun 8, 2022 · 1 comment · Fixed by #61812
Milestone

Comments

@akien-mga
Copy link
Member

Godot version

3.x (d51fc36)

System information

Any

Issue description

This was reported on Weblate against the 3.x docs, but it's likely the same in master (didn't test but the code and docs are the same).

The wrapf documentation gives this example:

# Infinite loop between 5.0 and 9.9
value = wrapf(value + 0.1, 5.0, 10.0)

But if you run this code with e.g.:

var value = 0

func _process(_delta):
    value = wrapf(value + 0.1, 5.0, 10.0)
    print(value)

It prints:

5.1
5.2
5.3
5.4
5.5
5.6
5.7
5.8
5.9
6
6.1
6.2
6.3
6.4
6.5
6.6
6.7
6.8
6.9
7
7.1
7.2
7.3
7.4
7.5
7.6
7.7
7.8
7.9
8
8.1
8.2
8.3
8.4
8.5
8.6
8.7
8.8
8.9
9
9.1
9.2
9.3
9.4
9.5
9.6
9.7
9.8
9.9
10
5.1
5.2
5.3

So it seems to wrap between 5.1 and 10.0.

Either the docs or the implementation are wrong.

Steps to reproduce

See above.

Minimal reproduction project

See above.

@Chaosus
Copy link
Member

Chaosus commented Jun 8, 2022

(Confirmed in 4.0) I think it's a bug in the implementation ^^.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants