Sign in Join
Wiki copytemporary

Trunc/fi: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
1-<img src="trunc.png" title="trunc.png" width="100" />
1+![](/wiki-images/e/ea/Trunc.png)
22
33Free Pascalin [[RTL/fi|RTL]] [[Unit/fi|käännösyksikkö]] [[System unit/fi|System]] sisältää [[Function/fi|funktion]] **trunc**, mikä katkaisee [[Real/fi|reaaliluku]] tyyppisen arvon [[Integer/fi|Integer]]-tyyppiseksi arvoksi. Sille annetaan parametriksi realilukutyyppinen [[expression/fi|lauseke]] ja trunc palauttaa [[Int64/fi|Int64]] arvon jonka desimaaliosa on poistettu (eli pyöristää kohti nollaa).
44
55## Määrittely
66
77``` pascal
88function Trunc(X: Real): Longint;
99```
1010
1111## Käyttöesimerkki
1212
1313``` pascal
1414begin
1515 WriteLn( Trunc(8.7) );
1616 WriteLn( Trunc(8.3) );
1717 WriteLn( Trunc(-8.7) );
1818 WriteLn( Trunc(-8.3) );
1919
2020end;
2121```
2222
2323### Tulostaa
2424
2525`8`\
2626`8`\
2727`-8`\
2828`-8`
2929
3030## Katso myös
3131
3232- [[Round/fi|round]]
3333- [`math.ceil`](https://www.freepascal.org/docs-html/rtl/math/ceil.html) - pyöristää ylöspäin
3434- [`math.floor`](https://www.freepascal.org/docs-html/rtl/math/floor.html) - pyoristää alaspäin
3535- [[Trunc/fi|trunc]] - pyöristää kohti nollaa
3636- [[Int/fi|int]] - palauttaa kokonaisosan reaalilukuarvosta.
3737- [[Div/fi|div]] - kokonaisluku jakolasku
3838
3939- [[Comparison of approaches for rounding to an integer]]
4040
4141---
4242*From the Free Pascal wiki, page "Trunc/fi", as it stood on 2022-08-06 after a change by Kai Burghardt, 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).*

Back to history