[Issue 356] New: std, math.tan doesn't preserve NaN payloads [fix	included]
    Don Clugston 
    dac at nospam.com.au
       
    Mon Sep 25 11:41:01 PDT 2006
    
    
  
d-bugmail at puremagic.com wrote:
> http://d.puremagic.com/issues/show_bug.cgi?id=356
> 
>            Summary: std,math.tan doesn't preserve NaN payloads [fix
>                     included]
>            Product: D
>            Version: 0.167
>           Platform: PC
>         OS/Version: Windows
>             Status: NEW
>           Severity: minor
>           Priority: P1
>          Component: Phobos
>         AssignedTo: bugzilla at digitalmars.com
>         ReportedBy: clugdbug at yahoo.com.au
> 
> 
> Currently in tan(x), it effectively does 
>   if (isnan(x)) return real.nan; 
> when it should be
>   if (isnan(x)) return x;
> 
> The good news is that all math functions preserve NaN payloads, with this one
> exception. And it's a one-line fix.
I spoke too soon. The version(linux) form of pow() should have two lines 
changed:
     if (isnan(y))
         return y;   //  <<< instead of "return real.nan" <<<<<<<<
     if (y == 0)
         return 1;       // even if x is $(NAN)
     if (isnan(x) && y != 0)
         return x; // instead of "return real.nan;"  <<<<<<
    
    
More information about the Digitalmars-d-bugs
mailing list