I have three counters counterBoat
, counterThink
and counterWork
.
I want to print the integer "round"(100*counterBoat/(counterBoat+ counterThink+ counterWork))
in my document.
I use the package totcount
.
\numexpr(100*\value{counterBoat}) /
( \value{counterBoat} + \value{counterThink} + \value{counterWork})\relax
\the
Commented
Oct 2, 2019 at 12:57
\the
in front of that line in a document and the number will be printed. There is no testable code in this answer as you did not supply a test document in the question.
Commented
Oct 2, 2019 at 15:03
\numexpr
and counters so this is integer arithmetic. That appears to be a completely different question, perhaps you want to use the xfp package and floating point arithmetic, i really can't guess.
Commented
Oct 2, 2019 at 16:03
xfp
package and use\inteval
, and use\value
to access the values of the counters. The result is rounded by default.\inteval{100*\value{counterBoat}/(\value{counterBoat}+\value{counterThink}+\value{counterWork})}