10.07.2015 Views

Algol 68 - ACM Digital Library

Algol 68 - ACM Digital Library

Algol 68 - ACM Digital Library

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

134van Wijngaarden, et al.ALGOL <strong>68</strong> Revised" Report135c)op abs = (L compl a) L real : L sqrt (re a T 2 + im a ! 2) ;10.2.3.8. Bits and associated operationsd)op arg = (L compl a) L real :it L real re = re a, im =im a;reeL Ov im~ L 0then if abs re > abs imthen L arctan (ira / re) + L pi / L 2 x(im < L O I sign re - 11 1 - sign re)else -L arctan (re / ira) + L pi / L 2 × sign imfifi;a) op ~ =, eq ~ = (L bits a, b) bool :begin bool c;for i to L bits widthwhile c :: (L F of a) [i]_ffi(L P@f b) [ !]__ Ido skip od;b)Cend;op ~ ~ , /=, ne ~ = (L bits a, b) bool : ~ (a = b) ;e)f)g)h)i)op conj = (L compl a) L compl : re a .L -im a ;op ~ =, eq ~ = (L compl a, b) bool : re a = re b ^im a =im b ;op ~ ~, /=, ne ~ = (L compl a, b) bool : ~ (a = b) ;op - = (L compl a, b) L compl : (re a - re b) .L (ira a -im b) ;op -= (L compl a) L compl : - re a .L -ira a ;c)op ~ v, or~ = (L bits a, b) L bits :begin L bits c;for i to L bits widthdo(L Fofc) [i]1:= (L Fofa) [i]l v (L Fofb)[i]lod;Cend;J)k)l)m)op + = (L compl a, b) L compl : (re a + re b) L (ira a +im b) ;op + = (L compl a) L compl : a ;op ~ x, • ~ = (L compl a, b) L compl :(rea×reb-imaximb) J_ (reaximb+ima×reb);op / = (L compl a, b) L compl :(L real d = re (b × conj b); L compl n = a × conj b;(re n / d) L (im n / d)) ;d) op ~ ^, &, and ~ = (L bits a, b) L bits :begin L bits c;for i to L bits widthdo (L Fofc) [i]1: = (C Fofa) [i]1^ (C Fofb) [/]lod;Cend;e) op~=, ge ~ = (L bits a, b) bool" b _OIp I L 1/p));op E = (L compl a, Lint b) bool : a E L compl (b) ;op E = (L compl a, L real b) bool : a E L compl (b) ;op E = (L int a, L compl b) bool : b E a ;g) op ~ l, up, shl~ = (L bits a, int b) L bits :if.abs b 0 thenfor i from 3 to L bits widthdolL Fore) [i-i]l:: (L 'ofc)t od:(L F of c) [L bit# u~b~--h~ : = falseelsefori from L bits width by-1 to2do (L F of c) [~J]: = (L F of c) [i-: i]lod:(L F of c) [j]~ = falsefi od;fl;C\\x)op E = (L real a, L compl b) bool : b E a ;h) op ~ 1, down, shr~ = (L bits x, int n) L bits" x T - n ;

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!