Re: Number formatting issue

2005-07-18 Thread Bud
Thanks Matthew. I actually didn't want it to round at all.

Rey...

It has to round either up or down, or it's going to remain 22.995. :)

There are 2 functions, INT which rounds DOWN to the nearest integer 
and CEILING which rounds UP. Neither works on decimals. What Rey is 
saying is to first multiply by 100 to get rid of the excess decimals.

num*100

This will give you 2299.5. Putting that within INT knocks off the .5.

int(num * 100) = 2299

Now, divide that by 100 to get back where you started.

int(num*100) / 100 = 22.99

Matthew Walker wrote:
  If you use numberFormat() without a mask, it rounds to the nearest integer
  (which I think is silly). If you use decimalFormat() or dollarFormat(), it
  rounds to two decimal places. The standard way of rounding a 5 is to round
  it up. If you want it to round down, you could do this:

  int(num*100)/100


  -Original Message-
  From: Rey Bango [mailto:[EMAIL PROTECTED]
  Sent: Monday, 18 July 2005 9:17 a.m.
  To: CF-Talk
  Subject: Number formatting issue

  Guys,

  I have a number that looks like this. 22.995

  But everytime I use DollarFormat() or NumberFormat, it rounds it up to
  23.00. I need the value to display as 22.99 not 23.00. How do I get
  around this? I could just treat the value as a string and cut off the
  trailing 5 but why are the number formatting functions rounding my
  value up?

  This is on CF 5.

  Rey...


--
http://www.ReyBango.com




~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:212111
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


Re: Number formatting issue

2005-07-18 Thread Rey Bango
Gotcha! I'll give that a try.

Thanks for the help, Bud.

Rey...

Bud wrote:
Thanks Matthew. I actually didn't want it to round at all.

Rey...
 
 
 It has to round either up or down, or it's going to remain 22.995. :)
 
 There are 2 functions, INT which rounds DOWN to the nearest integer 
 and CEILING which rounds UP. Neither works on decimals. What Rey is 
 saying is to first multiply by 100 to get rid of the excess decimals.
 
 num*100
 
 This will give you 2299.5. Putting that within INT knocks off the .5.
 
 int(num * 100) = 2299
 
 Now, divide that by 100 to get back where you started.
 
 int(num*100) / 100 = 22.99
 
 
Matthew Walker wrote:

 If you use numberFormat() without a mask, it rounds to the nearest integer
 (which I think is silly). If you use decimalFormat() or dollarFormat(), it
 rounds to two decimal places. The standard way of rounding a 5 is to round
 it up. If you want it to round down, you could do this:

 int(num*100)/100


 -Original Message-
 From: Rey Bango [mailto:[EMAIL PROTECTED]
 Sent: Monday, 18 July 2005 9:17 a.m.
 To: CF-Talk
 Subject: Number formatting issue

 Guys,

 I have a number that looks like this. 22.995

 But everytime I use DollarFormat() or NumberFormat, it rounds it up to
 23.00. I need the value to display as 22.99 not 23.00. How do I get
 around this? I could just treat the value as a string and cut off the
 trailing 5 but why are the number formatting functions rounding my
 value up?

 This is on CF 5.

 Rey...


--
http://www.ReyBango.com



 
 
 

~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:212149
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


RE: Number formatting issue

2005-07-17 Thread Matthew Walker
If you use numberFormat() without a mask, it rounds to the nearest integer
(which I think is silly). If you use decimalFormat() or dollarFormat(), it
rounds to two decimal places. The standard way of rounding a 5 is to round
it up. If you want it to round down, you could do this:

int(num*100)/100


-Original Message-
From: Rey Bango [mailto:[EMAIL PROTECTED] 
Sent: Monday, 18 July 2005 9:17 a.m.
To: CF-Talk
Subject: Number formatting issue

Guys,

I have a number that looks like this. 22.995

But everytime I use DollarFormat() or NumberFormat, it rounds it up to 
23.00. I need the value to display as 22.99 not 23.00. How do I get 
around this? I could just treat the value as a string and cut off the 
trailing 5 but why are the number formatting functions rounding my 
value up?

This is on CF 5.

Rey...

-- 
http://www.ReyBango.com




~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:212084
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


Re: Number formatting issue

2005-07-17 Thread Rey Bango
Thanks Matthew. I actually didn't want it to round at all.

Rey...

Matthew Walker wrote:
 If you use numberFormat() without a mask, it rounds to the nearest integer
 (which I think is silly). If you use decimalFormat() or dollarFormat(), it
 rounds to two decimal places. The standard way of rounding a 5 is to round
 it up. If you want it to round down, you could do this:
 
 int(num*100)/100
 
 
 -Original Message-
 From: Rey Bango [mailto:[EMAIL PROTECTED] 
 Sent: Monday, 18 July 2005 9:17 a.m.
 To: CF-Talk
 Subject: Number formatting issue
 
 Guys,
 
 I have a number that looks like this. 22.995
 
 But everytime I use DollarFormat() or NumberFormat, it rounds it up to 
 23.00. I need the value to display as 22.99 not 23.00. How do I get 
 around this? I could just treat the value as a string and cut off the 
 trailing 5 but why are the number formatting functions rounding my 
 value up?
 
 This is on CF 5.
 
 Rey...
 

-- 
http://www.ReyBango.com


~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:212085
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


RE: Number formatting issue

2002-06-07 Thread Thane Sherrington

At 02:22 PM 06/06/02 +0100, Philip Arnold - ASP wrote:

Write a UDF to do it...

Thanks.  This works wonderfully.

T

__
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Number formatting issue

2002-06-06 Thread Philip Arnold - ASP

 I have a series of numbers that can have up two decimal
 places.  I'd like to trim the trailing zeroes so that I
 have 9.56, 8.5 and 6 rather than 9.56, 8.50, and 6.00.
 What's the easiest way to do that?

Write a UDF to do it...

Function StripDigits(FormattedNumber)
{
If (right(FormattedNumber,3) is .00)
{

FormattedNumber=Left(FormattedNumber,Len(FormattedNumber)-3);
}
Else if (right(FormattedNumber,1) is 0)
{

FormattedNumber=Left(FormattedNumber,Len(FormattedNumber)-1);
}
return FormattedNumber;
}

Philip Arnold
Technical Director
Certified ColdFusion Developer
ASP Multimedia Limited
Switchboard: +44 (0)20 8680 8099
Fax: +44 (0)20 8686 7911

www.aspmedia.co.uk
www.aspevents.net

An ISO9001 registered company.

**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
**


__
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists