Skip to content

Extend floor (round, etc) to Complex numbers #42060

@danilo-bc

Description

@danilo-bc

I was recently porting a Matlab example to julia and I realized there's no direct equivalence.

I extended the floor function in my code snippet by doing:

import Base.floor
floor(x::Complex) = floor(real(x)::Real) + 1im*floor(imag(x)::Real)

I'm not sure if this would be a welcome addition, but it would surely make Julia code more similar to other well-used scientific software.

Metadata

Metadata

Assignees

No one assigned

    Labels

    complexComplex numbersmathsMathematical functions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions