Skip to content

Ensure proper handling of "partially missing" complex inputs where appropriate #5797

Description

@MichaelChirico

Follow-up to #5748.

We need to ensure our complex handling behaves "as expected" in the improved world of missingness for complex values in R.

coalesce() in particular seems worthy of further scrutiny (skipped for now in the interest of just getting tests green as quickly as possible):

showz = \(z) cbind(Re = Re(z), Im = Im(z))

showz(fcoalesce(complex(real = NA, imaginary = NA), 0+1i)) # i.e. NA_complex_
#      Re Im
# [1,]  0  1
showz(fcoalesce(complex(real = 0 , imaginary = NA), 0+1i)) # i.e. unchanged
#      Re Im
# [1,]  0 NA
showz(fcoalesce(complex(real = NA, imaginary = 0 ), 0+1i)) # i.e. unchanged
#      Re Im
# [1,] NA  0

If this is deemed problematic we should check handling elsewhere in the codebase too.

Activity

  1. jangorecki commented on Dec 6, 2023

    @jangorecki
    Member

    I think it is good. If complex number is only partially missing then fcoalesce can ignore it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions