Sign in Join
Wiki copytemporary

Round/eo: what changed

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

OldNewLine
11La [[RTL]] [[System unit|Systema unuo]] enhavas [[Function|funkcion]] **Round**, kiu rondigas [[Real]]-tipan valoron al [[Integer|Entjera]]-tipa valoro. Ĝia eniga parametro estas [[expression|esprimo]] kaj Round revenigos [[Int64]] valoron kiu estas la valoro de la enigo rondigita al la plej proksima entjero. Se la enigo estas ekzakte meze de la du entjeroj - N.5 - tiam "rondigo de bakisto" estas uzata, kies rezulto estas la plej proksima para nombro.
22
33## Deklaro
44
55``` pascal
66function Round(X: Real): int64;
77```
88
99## Ekzemplo de Uzado
1010
1111``` pascal
1212begin
1313 WriteLn( Round(8.7) );
1414 WriteLn( Round(8.3) );
1515 // examples of "bankers rounding" - .5 is adjusted to the nearest even number
1616 WriteLn( Round(2.5) );
1717 WriteLn( Round(3.5) );
1818end.
1919```
2020
2121### Output
2222
23-` 9`\
24-` 8`\
25-` 2`\
26-` 4`
23+```text
24+ 9
25+ 8
26+ 2
27+ 4
28+```
2729
2830## See also
2931
3032- [`system.round`](https://www.freepascal.org/docs-html/rtl/system/round.html)
3133- [`math.ceil`](https://www.freepascal.org/docs-html/rtl/math/ceil.html) - superrondigu
3234- [`math.floor`](https://www.freepascal.org/docs-html/rtl/math/floor.html) - subrondigu
3335- [[Frac|frac]] - revenigos la frakcian parton de glitpunkta valoro
3436- [[Trunc|trunc]] - rondigas al nulo
3537- [[Int|int]] - revenigos la entjera parto de glitpunkta valoro
3638- [[Div|div]] - entjera divido
3739- [[Comparison of approaches for rounding to an integer|Komparo de alproksimiĝoj por rondigi al entjero]]
3840
3941---
4042*From the Free Pascal wiki, page "Round/eo", 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