Not/fi: what changed
Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.
| Old | New | Line | |
|---|---|---|---|
| 1 | - | ||
| 2 | - | ||
| 3 | - | ||
| 4 | 1 | ## Not boolean lausekkeessa | |
| 5 | 2 | ||
| 6 | 3 | **Not** tuottaa arvon [[True|true]] jos alkuperäinen arvo on [[False|false]]. Usein **not** suomennetaan **ei**:ksi (Tai **eri**ksi. Tuloshan on eri kuin alkuperäinen). | |
| 7 | 4 | ||
| 8 | 5 | ### Totuustaulukko | |
| 9 | 6 | ||
| 10 | 7 | | A | Not A | | |
| 11 | 8 | |-----------|-----------| | |
| 12 | 9 | | false | true | | |
| 13 | 10 | | true | false | | |
| 14 | 11 | ||
| 15 | 12 | ## Not bittikohtaisissa toiminnoissa | |
| 16 | 13 | ||
| 17 | 14 | Bitettäin tehtävä **not** eli ei (eri) asettaa kyseisen bitin ykköseksi (1) jos vastaava bitti oli nolla (0). Jos se oli ykkönen (1) niin **not** asettaa sen nollaksi (0). | |
| 18 | 15 | ||
| 19 | 16 | ### Yhden Komplementti | |
| 20 | 17 | ||
| 21 | 18 | ``` pascal | |
| 22 | 19 | function OnesComplement ( const aValue : byte ): byte; | |
| 23 | 20 | begin | |
| 24 | 21 | result := Not AValue; | |
| 25 | 22 | end; | |
| 26 | 23 | ``` | |
| 27 | 24 | ||
| 28 | 25 | Jos kutsut funktiota OnesComplement([[Percent sign|%]]10000000) niin saat %01111111 ([[Binary numeral system/fi|Binäärinen]] %10000000 on desimaalijärjestelmässä 128 ja vastaavasti kaksijärjestelmän %01111111 on desimaalijärjestelmän 127). Jos kutsut funktiota OnesComplement(%00000111) niin saat 248 (248 = %11111000). | |
| 29 | 26 | ||
| 30 | 27 | ``` pascal | |
| 31 | 28 | function OnesComplement2 ( const aValue : shortint ): shortint; | |
| 32 | 29 | begin | |
| 33 | 30 | result := Not AValue; | |
| 34 | 31 | end; | |
| 35 | 32 | ``` | |
| 36 | 33 | ||
| 37 | 34 | Jos kutsut OnesComplement2(%00000010) niin saat %11111101 (huomio että %00000010 = 2 ja %11111101 = -3 kun [[Type|tyyppi]] on [[Shortint]]). Jos kutsut OnesComplement2(7) niin saat -8 (-8 = %11111000 kun tyyppi on shortint ja 7 = %00000111 ). | |
| 38 | 35 | ||
| 39 | 36 | ## Katso myös | |
| 40 | 37 | ||
| 41 | 38 | - [[And/fi|And]] (ja) | |
| 42 | 39 | - [[Or/fi|Or]] (tai) | |
| 43 | 40 | - [[Shl]] | |
| 44 | 41 | - [[Const/fi|Const]] | |
| 45 | 42 | - [[Function]] | |
| 46 | 43 | - [[Byte/fi|Byte]] | |
| 47 | 44 | - [[Shortint]] | |
| 48 | 45 | - [[Shl|Nollaa bitti]] | |
| 49 | 46 | - [[Bit manipulation]] | |
| 50 | 47 | - [[Binary numeral system/fi|Binäärinumerot]] | |
| 51 | 48 | ||
| 52 | 49 | --- | |
| 53 | 50 | *From the Free Pascal wiki, page "Not/fi", as it stood on 2020-02-21 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* |
