In the manual on page 902, it says that
Normally, when a list item ... is encountered, there should already have been two list items before it, which where numbers.
Examples of numbers are 1, -10, or -0.24. Let us call these numbers x and y and let
d:=y−x
be their difference. Next, there should also be one number following the three dots, let us call this numberz
.In this situation, the part of the list reading
x,y,...,z
is replaced byx
,x+d
,x+2d
,x+3d
,...,x+md
where the last dots are semantic dots, not syntactic dots. The value m is the largest number such thatx+md≤z
ifd is positive
or such thatx+md ≥ z
ifd is negative
.Perhaps it is best to explain this by some examples: The following < list> have the same effects:
\foreach \x in {0,0.1,...,0.5} {\x, }
yields0
,0.1
,0.20001
,0.30002
,0.40002
,
As here x=0
, we deduce that 2d=0.20001
and therefore only d=0.100005
.
Edit: 3d=0.30002
and therefore d=0.10000666666...
Edit: Then, in this case, 0
is subtracted from a 0.1
entry and this 0.1
entry is modified. How is this possible since nothing is subtracted from 0.1
at all?
Does this mean that subtracting 0
subtracts something from the number 0.1
?
- Is it due to binary subtraction in base 2 with
TeX
? withpgffor
? - is it because of the binary coding of the number 0 in
TeX?
withpgffor
? - How does
pgffor
calculate the increment in a foreach loop?
Translated with www.DeepL.com/Translator
\dimen0= 0.100005pt \showthe\dimen0
, you get0.1pt
. If you add\advance\dimen0 by 0.1pt \showthe\dimen0
you get0.20001pt
. PGF uses dimen registers, which are bound to the conversions to and from binary arithmetic.2d=0.20001
and3d=0.30002
. It remains to be seen why not subtract nothing (subtract0
) subtracts something!