Skip to content

floor() and ceiling() could use 10ths, 100ths, etc like round() has. #2556

@Dunbaratu

Description

@Dunbaratu

With round() you can pick the number of digits after the decimal to round to, i.e. round(x, 2) to round to the nearest hundredth.

But floor() and ceiling() only work for going to an integer, not tenths or hundredths, etc.

They could use a similar optional second parameter like Round() has, that does the same thing.

i.e. while round(1.666, 2) would give 1.67, floor(1.666, 2) would give 1.66.

Without that, people have to resort to the workaround of multiplying by a power of ten to shift the decimal point, then calling floor() then shifting it back, like so:
to get the effect of floor(x, 2) the script has to do: floor(x*100) / 100.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementSomething new (not a bug fix) is being requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions