"io_x" <a@b.c.invalid> ha scritto nel messaggio news:4f193789$0$1389$4fafb...@reader1.news.tin.it... > > "Terje Mathisen" <"terje.mathisen at tmsw.no"@giganews.com> ha scritto nel > messaggio news:iqe6u8-os52....@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;
better than above if(MemIsOut(r, sizeof( d64))) goto .e; is difficult to know if a range is in the process? > 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? > > > _______________________________________________ help-gplusplus mailing list help-gplusplus@gnu.org https://lists.gnu.org/mailman/listinfo/help-gplusplus