help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with Hand-Optimized Assembly


From: io_x
Subject: Re: Help with Hand-Optimized Assembly
Date: Wed, 28 Mar 2012 18:30:00 -0000

"Terje Mathisen" <"terje.mathisen at tmsw.no"@giganews.com> ha scritto nel
messaggio iqe6u8-os52.ln1@ntp6.tmsw.no">news:iqe6u8-os52.ln1@ntp6.tmsw.no...
>> inline double delta(double th1, th2)

why not 2 loops [one for normalize delta >pi and one for < -pi]?

difPimPi(double x, y)
    x-=y     |>?#.2
.1: x>=-pi#.3|x+=2*pi|#.1
.2: x< +pi#.3|x-=2*pi|#.2
.3:
ret

or someting in one 'pseudocode' good enought for
represent the problem...

i32 difPimPi(d64 *r, x, y)
{   if(MemIsOut(r)) goto .e;
    if(IsNanOrErr(x)||IsNanOrErr(y))
.e:             return -1;
     x-=y
    if(CF()) goto .e;
    if(x>0)  goto .2; // or better if(SignFlag()>0)  goto .2
.1: if(x>=-pi) goto .3; x+=2*pi; goto .1;
.2: if(x<  pi) goto .3; x-=2*pi; goto .2;
.3: *r=x; return 0;
}

where i32 is int signed 32 bit
and d64 is double 64 bits

i check every possible error with this last?
how many error do someone of you find in that?
how many UB do you find if the last is one C program?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]