Not/fi: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: Not/fi
| Old | New | Line | |
|---|---|---|---|
| 1 | + | \ | |
| 2 | + | \ | |
| 3 | + | ||
| 4 | + | ## Not boolean lausekkeessa | |
| 5 | + | ||
| 6 | + | **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 | + | ||
| 8 | + | ### Totuustaulukko | |
| 9 | + | ||
| 10 | + | | A | Not A | | |
| 11 | + | |-----------|-----------| | |
| 12 | + | | false | true | | |
| 13 | + | | true | false | | |
| 14 | + | ||
| 15 | + | ## Not bittikohtaisissa toiminnoissa | |
| 16 | + | ||
| 17 | + | 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 | + | ||
| 19 | + | ### Yhden Komplementti | |
| 20 | + | ||
| 21 | + | ``` pascal | |
| 22 | + | function OnesComplement ( const aValue : byte ): byte; | |
| 23 | + | begin | |
| 24 | + | result := Not AValue; | |
| 25 | + | end; | |
| 26 | + | ``` | |
| 27 | + | ||
| 28 | + | 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 | + | ||
| 30 | + | ``` pascal | |
| 31 | + | function OnesComplement2 ( const aValue : shortint ): shortint; | |
| 32 | + | begin | |
| 33 | + | result := Not AValue; | |
| 34 | + | end; | |
| 35 | + | ``` | |
| 36 | + | ||
| 37 | + | 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 | + | ||
| 39 | + | ## Katso myös | |
| 40 | + | ||
| 41 | + | - [[And/fi|And]] (ja) | |
| 42 | + | - [[Or/fi|Or]] (tai) | |
| 43 | + | - [[Shl]] | |
| 44 | + | - [[Const/fi|Const]] | |
| 45 | + | - [[Function]] | |
| 46 | + | - [[Byte/fi|Byte]] | |
| 47 | + | - [[Shortint]] | |
| 48 | + | - [[Shl|Nollaa bitti]] | |
| 49 | + | - [[Bit manipulation]] | |
| 50 | + | - [[Binary numeral system/fi|Binäärinumerot]] | |
| 51 | + | ||
| 52 | + | --- | |
| 53 | + | *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).* |
