The Daily Click ::. Forums ::. Klik Coding Help ::. Round off to 1 or 2 decimal places
 

Post Reply  Post Oekaki 
 

Posted By Message

joelr_2000



Registered
  22/02/2004
Points
  687
9th January, 2013 at 09/01/2013 11:09:31 -

Is this possible in mmf2? Using counter or values or and extention- dont care, what ever it takes..

 
n/a

Alonso Martin



Registered
  29/12/2010
Points
  294
9th January, 2013 at 09/01/2013 15:46:07 -

I'm not sure I understand what you want to do. If you just want to remove decimals (turn 0.1231 into 0.12), just do this:

Val(Left$(Str$(VALUE), 3+Find(Str$(VALUE), ".", 0)))



 
www.hfalicia.com
www.alonsomartin.mx

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49566

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
9th January, 2013 at 09/01/2013 15:52:36 -

You could use floor(value) to remove decimals as well.

So floor(2.3123) = 2.

Edited by UrbanMonk

 
n/a

s-m-r

Slow-Motion Riot

Registered
  04/06/2006
Points
  1078

Candle
9th January, 2013 at 09/01/2013 19:32:16 -

If you're using a Counter Object, you can set the maximum number of decimal places; look in the Object Properties pane or whatever. Set it to 2, and the rounding happens for you automatically.

 
n/a

nim



Registered
  17/05/2002
Points
  7233
9th January, 2013 at 09/01/2013 21:19:25 -


Originally Posted by s-m-r
If you're using a Counter Object, you can set the maximum number of decimal places; look in the Object Properties pane or whatever. Set it to 2, and the rounding happens for you automatically.



I don't know why but that has never worked for me.

 
//

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49566

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
9th January, 2013 at 09/01/2013 23:50:41 -

It works sometimes. At extremes it breaks. There are a few operations you can't use on counters with that property.

Also I find this sometimes works to fix a unruly counter:
set counter to val(str$(counter value))

Hacky, but it works in some cases, but sometimes it doesn't. Try different things till you get it.

Also multiply by decimal values because that can mess them up too.
Divide instead:

Instead of: Value * 0.3
Do this: Value / 3

Not as exact, but usually the counter is being used to display a value from elsewhere anyway.

 
n/a

joelr_2000



Registered
  22/02/2004
Points
  687
12th January, 2013 at 12/01/2013 11:16:22 -


Originally Posted by Alonso Martin
I'm not sure I understand what you want to do. If you just want to remove decimals (turn 0.1231 into 0.12), just do this:

Val(Left$(Str$(VALUE), 3+Find(Str$(VALUE), ".", 0)))




Dude your awesome.. this has been the biggest headache for me. I dnt understand that equation , I just copied and pasted it and it worked

 
n/a
   

Post Reply



 



Advertisement

Worth A Click