Skip to content

Follow contract of floor/ceil #234

@Seelengrab

Description

@Seelengrab

floor and ceil are supposed to return the same type as the input type:

floor(x) returns the nearest integral value of the same type as x that is less than or equal to x.

However, floor(N0f8(0.33), digits=1) returns 0.3f0 and ceil(N0f8(0.33), digits=1) returns 0.4f0 i.e. they return Float32.

I haven't tested other types, but since all calls to floor/ceil fallback to the Base definition of floor(x; kwargs...) = round(x, RoundDown; kwargs...) (RoundUp for ceil) and their callchains call float(x), I suspect this is the case for all Normed types.

Found here.

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