www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22983] New: Complex!float.abs / hypot invalid result when

https://issues.dlang.org/show_bug.cgi?id=22983

          Issue ID: 22983
           Summary: Complex!float.abs / hypot invalid result when argument
                    is small
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: jp-dev gmx.com

This is a bad computation reproduced in the example below.
Expected -5.016558e-20, got 6.2102e+07.
DMD 2.099.0, Linux x86_64

import std.complex;
import std.stdio;
void main()
{
        Complex!float x = -5.016558e-20;
        writeln(x.abs);
}

--
Apr 04 2022