# Math to display total bytes as MB

**URL:** <https://forum.kirupa.com/t/math-to-display-total-bytes-as-mb/41566>\
**Category:** Uncategorized\
**Created:** [January 30, 2004, 4:54pm UTC](https://forum.kirupa.com/t/math-to-display-total-bytes-as-mb/41566 "2004-01-30T16:54:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![amidude](https://avatars.discourse-cdn.com/v4/letter/a/bc79bd/32.png) [@amidude](https://forum.kirupa.com/u/amidude)\
**Post date:** [January 30, 2004, 4:54pm UTC](https://forum.kirupa.com/t/math-to-display-total-bytes-as-mb/41566/1 "2004-01-30T16:54:57Z")

</div>

Okay, my preloader has some code in it to display the percentage of a 6 MB movie and I want to display the proper file size such as 6.53MB instead of 6987362892 Bytes. Here is what i have so far and it’s not working.  
[AS]percent.text = Math.round((getBytesLoaded() / getBytesTotal()) \* 100) + ‘% of ’ + [COLOR=darkred]Math.round(getBytesTotal()) / 1024[/COLOR] + ’ kb’;[/AS]

The red code is where I’m having my problems. Any help would greatly be appreciated.:nerd:
