Skip to content

Commit 13e1714

Browse files
committed
added stack overflow example
1 parent e98048b commit 13e1714

12 files changed

+226
-69
lines changed

text/main/basics/simpleDataTypesAndOperations/documentation/documentation.tex

Lines changed: 212 additions & 56 deletions
Large diffs are not rendered by default.
Loading
Loading
Loading
Loading
Loading

text/main/basics/simpleDataTypesAndOperations/float/float.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@
223223
The result of \pythonil{int(x)} and \pythonil{trunc(x)} is the same for all finite \pythonils{float}~\pythonil{x}.
224224
The semantic difference between the two functions is that \pythonil{int(x)} means~\emph{\inQuotes{Convert \pythonil{x} to an~\pythonil{int}.}} whereas \pythonil{trunc(x)} means~\emph{\inQuotes{Discards the fractional digits and return integer part of the number as an~\pythonil{int}.}}
225225
\pythonil{int(x)}~thus is inherently a datatype conversion function whereas \pythonil{trunc(x)}~is a mathematical operation.
226-
Besides these semantic differences, there is not much of a practical relevant difference between the two functions.
226+
Besides these semantic differences, there is not much of a practical relevant difference between the two functions~\cite{PEP3141}.
227227

228228
If you want to round the way I learned in school, namely that~$x.5$ becomes $x + 1$, then this goes via \pythonilIdx{int} or \pythonilIdx{trunc}:~We can simply compute~\pythonil{int(x + 0.5)} (or \pythonil{trunc(x + 0.5)}).
229229
\Cref{exec:float_rounding} shows this, too.

0 commit comments

Comments
 (0)