Tobias Burnus schrieb: > > I have a nice document where I need to perform small > calculation (actually > only calculating the average value): > if((#1+#2+#3) != 0) > (#1*1 + #2*2 + #3*3)/(#1+#2+#3) > else > "--" > > Now I was thinking where I could do so in TeX. (I think > there are some > macros in ConTeXt, but I cannot find them.) >
There is the fp package for latex. It provides rather complete fixed-point arithmetic. I have never used it, but probably it is generic enough to work with context. If not, there is the fltpoint package which will definitely work, but it is limited to addition, subtraction, multiplication and division (if-then-else could be done too). Eckhart
