# How do I format numbers?

**URL:** <https://forum.kirupa.com/t/how-do-i-format-numbers/64049>\
**Category:** flash\
**Created:** [September 12, 2004, 9:33pm UTC](https://forum.kirupa.com/t/how-do-i-format-numbers/64049 "2004-09-12T21:33:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![OM2](https://avatars.discourse-cdn.com/v4/letter/o/3ab097/32.png) [@OM2](https://forum.kirupa.com/u/OM2)\
**Post date:** [September 12, 2004, 9:33pm UTC](https://forum.kirupa.com/t/how-do-i-format-numbers/64049/1 "2004-09-12T21:33:42Z")

</div>

[font=verdana, arial, helvetica][size=2]Can someone tell me how I can format numbers in Flash so that it will show two decimal places regardless of the number itself?

Thanks.

OM[/size][/font]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 12, 2004, 10:06pm UTC](https://forum.kirupa.com/t/how-do-i-format-numbers/64049/2 "2004-09-12T22:06:28Z")

</div>

do a forum search for format numbers and you’ll find what you need.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 13, 2004, 12:04am UTC](https://forum.kirupa.com/t/how-do-i-format-numbers/64049/3 "2004-09-13T00:04:35Z")

</div>

hi there… i’ve tried something really simple… but came across of a bug (??). Does anybody know why this happens?

```auto

y = 145.24;
decimals = Math.floor((y-Math.floor(y))*100);
trace (y-Math.floor(y));// this traces 0.240000000000009
trace (Math.floor(y)+","+decimals);//this works... sometimes :)

```

Anybody?  
I know the code is not really working as OM2 wanted, but I am very curious about this thing with the Math.floor stuff.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 13, 2004, 12:13am UTC](https://forum.kirupa.com/t/how-do-i-format-numbers/64049/4 "2004-09-13T00:13:37Z")

</div>

see:  
[http://www.macromedia.com/support/flash/ts/documents/roundoff\_error.htm](http://www.macromedia.com/support/flash/ts/documents/roundoff_error.htm)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 13, 2004, 12:21am UTC](https://forum.kirupa.com/t/how-do-i-format-numbers/64049/5 "2004-09-13T00:21:01Z")

</div>

10x a lot senocular.  
As they say "This is a fact of life " - I too should probably live with it 🙂
