Displaying only a couple decimal places.

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
stuartls
Posts: 49
Joined: Mon Jan 22, 2007 10:59 pm
Contact:

Displaying only a couple decimal places.

Post by stuartls » Thu Dec 20, 2007 10:18 pm

If I have a field that accepts a value. Such as 7.45789 for example. How do I force that field to just display the 7.45?

Thanks!
Stu

stuartls
Posts: 49
Joined: Mon Jan 22, 2007 10:59 pm
Contact:

Post by stuartls » Thu Dec 20, 2007 10:52 pm

Opppppppsssssss... found it myself..

put format("%2.2f", tNumberOfWrong) into field "Percentage"

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Post by BvG » Fri Dec 21, 2007 7:49 pm

You can use the trunc() function, or the round() function, which are easier to use (but less flexible) then your approach.
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

Post Reply