# Does Mp3tag only do integer math?

I was looking for a way to take floating point values with two decimal places such as the following and round them to the closest integer:

97.54 -> 98
122.00 -> 122
90.98 -> 91
144.19 -> 144

Ideally, something like
\$round(%bpm%)
or
\$trunc(\$add(%bpm%,0.5))

But I found that just doing the following truncates the value to an integer, without adding the floating point value.

\$add(%bpm%,0.5)

and

\$mul(%bpm%,100)

drops the decimal value before multiplying, so that something like 90.98 x 100 = 9000.

Integer only?

Perhaps does Mp3Tag behave differently (see topic of thread)... -> after dano has edited the topic this reference does not make sense any more, please ignore.

Apparently, all numbers are treated as integers.

AFAIK it is just BPMAnalyzer that adds these strange values. So it must be some kind of average. Rounding a BPM value would then mean that the real music is either not quite 1 beat short every minute (of 4 beats for a 4-minute-piece) or it has not more than half a beat too many per minute - can you detect that? Esp. if it is a track with varying bpms? iTunes, I think, does not display decimal BPMs.
What other numeric values would be there that need to be treated as real numbers? TRACK is integer, so is DISCNUMBER, COMPILATION. YEAR and other dates have other formats. Bitrate is not edited by MP3tag.

I got this on here and kept it as part of my clean up tools. Don't ask me where but I think DetlevD wrote it.

Name of action group: Clean-Up 2# Round BPM To Integer

Action #1:
Action type: Format value
Field: BPM_ROUNDBY
Formatstring: 1

Action #2:
Action type: Format value
Field: BPM
Formatstring: \$div(\$mul(\$mul(%BPM_ROUNDBY%,100),\$ifgreater(\$sub(\$div(\$mul(\$left(\$replace(%BPM%,.,)00,\$add(\$len(\$div(%BPM%,1)),2)),10),\$mul(%BPM_ROUNDBY%,100)),\$mul(\$div(\$left(\$replace(%BPM%,.,)00,\$add(\$len(\$div(%BPM%,1)),2)),\$mul(%BPM_ROUNDBY%,100)),10)),4,\$add(\$div(\$left(\$replace(%BPM%,.,)00,\$add(\$len(\$div(%BPM%,1)),2)),\$mul(%BPM_ROUNDBY%,100)),1),\$div(\$left(\$replace(%BPM%,.,)00,\$add(\$len(\$div(%BPM%,1)),2)),\$mul(%BPM_ROUNDBY%,100)))),100)

Action #3:
Action type: Remove fields
Fields to remove (semicolon-separated): BPM_ROUNDBY

It was MixMeister BPM Analyzer, but I believe the BPM analyzer plugin to foobar200 does the same. So that's at least three, and I"m sure there are more.

Good Lord. You've got to be kidding me.

You can also use less code:
/t/7295/1

unfortunately not.