Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to convert a number to a string

Status
Not open for further replies.
Actually what I really want is For example
x=(23464.4356). I use
<cfset x = numberformat(x, "99999.99")>
I only want the 23464.43, but I keep getting 23464.44
Is there anyway of getting just the first 2 digit after the decimal point.

I couldnot figure out how to do it, so I thought of using converting x to a string first.

Anyone can tell me how to just get the first 2 digit after the decimal point is greatly appreciate it.
 
Yes, annoyingly NumberFormat() also rounds the input value. It would be nice if there was a flag to control the behavior .. but there is not. So rolling your own function is the way to go ;-)

----------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top