 # Accurate math?

The export feature has some math functions. However, this is presenting me with some frustration. I'm attempting to do a simple list of albums, with their average rating. Doesn't seem to complicated, just add up the ratings ("Rating MM" mind you) and then devide by the number of tracks. I found an "average bitrate" formula through searching which seemed simple enough to convert to ratings. Thus, I ended up with:

``````\$loop(%_filename_ext%)\$puts(avgrating,\$add(\$get(avgrating),%rating mm%))\$puts(cnt1,\$add(\$get(cnt1),1))\$loopend()\$get(avgrating) / \$get(cnt1) = \$div(\$get(avgrating),\$get(cnt1))
``````

However, I find that the programs math isn't accurate. For my test case, I end up with "58 / 12 = 4" when the true answer would be "58 / 12 = 4.8333..." So, is the program simply suppressing the decimals? Or is it rounding (in which case, the example would probably be 5)? Anyway of getting a more accurate average?

The functions themselves don't have better accuracy.

You can get around it by multiplying the dividend by 10 or 100 and inserting a dot in the result on your own.