Skip to content

[for (t=[0:step:1-step]) ...] yields one less than expected #13

@charlieb

Description

@charlieb

I'm guessing here but it seems like the intent of the 1-step end condition in the following is that we exclude 1.0 from the array. Thus:

step = 0.01
echo([for (t=[0:step:1-step]) t])

would print [0 ... 0.99] i.e. 100 values but it doesn't. It prints only 99 values: [0 ... 0.98].
This is a little confusing when trying to adapt the code because I end up with a bunch of -2s where I would expect to find only -1s.
This is not exactly a big deal but if someone would confirm the intent is as I expect I will create a pull request with the fixes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions