# Does Mp3tag only do integer math?

**URL:** https://community.mp3tag.de/t/does-mp3tag-only-do-integer-math/15050
**Category:** Support
**Created:** [September 22, 2013, 2:14am UTC](https://community.mp3tag.de/t/does-mp3tag-only-do-integer-math/15050 "2013-09-22T02:14:26Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![JJ\_Johnson](https://community.mp3tag.de/user_avatar/community.mp3tag.de/jj_johnson/32/67_2.png) [@JJ\_Johnson](https://community.mp3tag.de/u/JJ_Johnson)
#### Post date: [September 22, 2013, 2:14am UTC](https://community.mp3tag.de/t/does-mp3tag-only-do-integer-math/15050/1 "2013-09-22T02:14:26Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [September 22, 2013, 7:29am UTC](https://community.mp3tag.de/t/does-mp3tag-only-do-integer-math/15050/2 "2013-09-22T07:29:55Z")

</div>

Perhaps does Mp3 **T** ag 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.

---

<div class="post-metadata">

### Author: ![stevehero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stevehero/32/337_2.png) [@stevehero](https://community.mp3tag.de/u/stevehero)
#### Post date: [September 22, 2013, 2:05pm UTC](https://community.mp3tag.de/t/does-mp3tag-only-do-integer-math/15050/3 "2013-09-22T14:05:44Z")

</div>

> [@JJ Johnson](#):
>
> Integer only?

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**

---

<div class="post-metadata">

### Author: ![JJ\_Johnson](https://community.mp3tag.de/user_avatar/community.mp3tag.de/jj_johnson/32/67_2.png) [@JJ\_Johnson](https://community.mp3tag.de/u/JJ_Johnson)
#### Post date: [September 22, 2013, 9:16pm UTC](https://community.mp3tag.de/t/does-mp3tag-only-do-integer-math/15050/4 "2013-09-22T21:16:39Z")

</div>

> [@ohrenkino](#):
>
> AFAIK it is just BPMAnalyzer that adds these strange values.

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.

---

<div class="post-metadata">

### Author: ![JJ\_Johnson](https://community.mp3tag.de/user_avatar/community.mp3tag.de/jj_johnson/32/67_2.png) [@JJ\_Johnson](https://community.mp3tag.de/u/JJ_Johnson)
#### Post date: [September 22, 2013, 9:18pm UTC](https://community.mp3tag.de/t/does-mp3tag-only-do-integer-math/15050/5 "2013-09-22T21:18:18Z")

</div>

> [@stevehero](#):
>
> **$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)**

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

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [September 23, 2013, 10:04am UTC](https://community.mp3tag.de/t/does-mp3tag-only-do-integer-math/15050/6 "2013-09-23T10:04:00Z")

</div>

You can also use less code:  
[/t/7295/1](https://community.mp3tag.de/t/7295/1)

---

<div class="post-metadata">

### Author: ![stevehero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stevehero/32/337_2.png) [@stevehero](https://community.mp3tag.de/u/stevehero)
#### Post date: [September 23, 2013, 10:09am UTC](https://community.mp3tag.de/t/does-mp3tag-only-do-integer-math/15050/7 "2013-09-23T10:09:30Z")

</div>

> [@JJ Johnson](#):
>
> Good Lord. You've got to be kidding me.

![:wacko:](https://community.mp3tag.de/uploads/default/original/1X/455ecca54df2b24f3c99cde256604242b1031da2.gif ":wacko:") unfortunately not.

---

<div class="post-metadata">

### Author: ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)
#### Post date: [February 9, 2026, 12:24pm UTC](https://community.mp3tag.de/t/does-mp3tag-only-do-integer-math/15050/8 "2026-02-09T12:24:40Z")

</div>


