# $div decimal places?

**URL:** https://community.mp3tag.de/t/div-decimal-places/5737
**Category:** Support
**Created:** [November 15, 2007, 12:56am UTC](https://community.mp3tag.de/t/div-decimal-places/5737 "2007-11-15T00:56:11Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Oblio](https://community.mp3tag.de/user_avatar/community.mp3tag.de/oblio/32/4828_2.png) [@Oblio](https://community.mp3tag.de/u/Oblio)
#### Post date: [November 15, 2007, 12:56am UTC](https://community.mp3tag.de/t/div-decimal-places/5737/1 "2007-11-15T00:56:11Z")

</div>

Can the $div scripting function be made to return a given number of decimal places? Or can I do something similar with $mod?

thanks

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [November 15, 2007, 7:29am UTC](https://community.mp3tag.de/t/div-decimal-places/5737/2 "2007-11-15T07:29:54Z")

</div>

Mp3tag scripting language supports integer mathematics only.  
So let us see your real world example and maybe we can solve the problem.

DD.20071115.0930.CET

---

<div class="post-metadata">

### Author: ![Oblio](https://community.mp3tag.de/user_avatar/community.mp3tag.de/oblio/32/4828_2.png) [@Oblio](https://community.mp3tag.de/u/Oblio)
#### Post date: [November 26, 2007, 12:10pm UTC](https://community.mp3tag.de/t/div-decimal-places/5737/3 "2007-11-26T12:10:07Z")

</div>

OK thanks DetlevD

I want to show the tag size in kB so I need something like $div(%\_tag\_size\_prepended%, 1024). For 1 decimal place I guess I need something like:

$div(%\_tag\_size\_prepended%,1024).$div($mul($mod(%\_tag\_size\_prepended%, 1024), 10), 1024)k

but its not rounding up. Any suggestions?

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [November 26, 2007, 6:51pm UTC](https://community.mp3tag.de/t/div-decimal-places/5737/4 "2007-11-26T18:51:34Z")

</div>

This might round in the right way:

**$ifgreater($mod($div($mul(%\_tag\_size\_prepended%,100),1024),10),4,$div($add(1,$div($div($mul(%\_tag\_size\_prepended%,100),1024),10)),10)'.'$mod($add(1,$div($div($mul(%\_tag\_size\_prepended%,100),1024),10)),10),$div($div($div($mul(%\_tag\_size\_prepended%,100),1024),10),10)'.'$mod($div($div($mul(%\_tag\_size\_prepended%,100),1024),10),10))' KB'**

e. g. 672615 to 656.9 KB  
e. g. 13648 to 13.3 KB

DD.20071126.2050

---

<div class="post-metadata">

### Author: ![Oblio](https://community.mp3tag.de/user_avatar/community.mp3tag.de/oblio/32/4828_2.png) [@Oblio](https://community.mp3tag.de/u/Oblio)
#### Post date: [November 28, 2007, 4:55am UTC](https://community.mp3tag.de/t/div-decimal-places/5737/5 "2007-11-28T04:55:51Z")

</div>

Wow that seems to work! thanks DetlevD. 😃

---

<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:20pm UTC](https://community.mp3tag.de/t/div-decimal-places/5737/6 "2026-02-09T12:20:35Z")

</div>


