significant digits

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
dhobbs
Posts: 24
Joined: Tue Dec 15, 2009 6:25 pm

significant digits

Post by dhobbs » Sun Jun 19, 2011 7:47 pm

I'm not sure how to insure a certain number of significant digits in a number I'm diplaying.

As an example, I perform a calculation and get a number: 35.003742.
If I use statRound(35.003742,2) I get 35 (written without any decimal point). Not 35.00. How to I get "35.00"? Is there another function that specifies how many decimal places you want to diplay in a number? Most of the calculations do not

I'm sure I could catch this with a separate function and add the zero's, but that seems roundabout.

Thanks,

--Doug

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4163
Joined: Sun Jan 07, 2007 9:12 pm

Re: significant digits

Post by bn » Sun Jun 19, 2011 7:56 pm

Hi Doug,

look at "numberformat" in the dictionary.

Just be aware that you have to set the numberformat before you make any calculation. If you just have a number and want it displayed in the form of the numberformat you specified just add a zero to that number and the numberformat will be in effect.

Kind regards

Bernd

Post Reply