Skip to content

Provide more "inline" operators such as copysign, isfinite, etc... #92

@eschnett

Description

@eschnett

Certain math functions such as copysign can be implemented efficiently with bitwise operations. It would be convenient to have these available:

  • copysign
  • isfinite
  • isinf
  • isnan
  • isnormal
  • signbit

I find the non-standard flipsign function https://docs.julialang.org/en/v1/base/math/#Base.flipsign convenient, e.g. to implement upwind finite differencing stencils. It can be defined as

flipsign(x, y) = copysign(1, y) * x

but can be implemented more efficiently as

flipsign(x, y) = x ^ (y & SIGNMASK)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions