Skip to content

[Flang] Complex division operator overflows needlessly. #76324

Open
@chandankds

Description

@chandankds

Complex division produces Infinity in results that can be computed without overflow.

The Intel compiler does not overflow this case, GNU does.

Program test_complex_division_overflow
  Real(Kind(1.d0)) :: x, y
  x = Huge(0.d0)
  y = 2.d0
  Call ops(x,y)
  Contains
    Subroutine ops(n,d)
      Real(Kind(1.d0)) :: n,d
      Complex(Kind(1.d0)) :: a,b
      a = Cmplx(n,-n,Kind(1.d0))
      b = Cmplx(d,d,Kind(1.d0))
      Print *,a/b ! avoids infinity?
    End Subroutine ops
End Program test_complex_division_overflow

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