IPB

Welcome Guest ( Log In | Register )

> Notice!

Please take a minute to check our Frequently Asked Questions. Use Search to reveal possible related topics.

Also make sure you've read the Forum Guidelines before posting in this forum.

 
Reply to this topicStart new topic
> Accurate math?
Mizery_Made
post Oct 12 2012, 11:17
Post #1


Member


Group: Full Members
Posts: 72
Joined: 24-January 07
From: Missouri, United States
Member No.: 4314
Mp3tag Version: 2.52



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:

CODE
$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?
Go to the top of the page
 
+Quote Post
dano
post Oct 12 2012, 11:41
Post #2


Moderator


Group: Moderators
Posts: 5506
Joined: 4-September 03
From: Germany
Member No.: 201
Mp3tag Version: 2.55a



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.


--------------------
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 24th May 2013 - 12:29