2^32 is about 4.2 billion. :) BUT, ColdFusion does not use unsigned
integers, it uses signed integers. Hence, you cut the magnitude in half
(2 billion).

-------------------------------
James Ang
Sr. Developer/Product Engineer
MedSeek, Inc.
[EMAIL PROTECTED]



-----Original Message-----
From: Barney Boisvert [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 25, 2003 12:58 PM
To: CF-Talk
Subject: RE: CF error...Cannot convert 10000000000 to integer


It'll probably puke with 9 places, if the leftmost is larger than 4 as
well.
The 4.2 billion limit to the size a 4 byte integer can hold.  When
passed,
don't declare it as a numeric type, then use a string function to strip
off
characters from the left of the decimal point and save them.  then
process
the fractional part into a fraction, and then do some string
manipulation to
add back in the part you stripped of to begin with.  An example might be
better (pay attention to quotes to determine what is string and what is
numeric):

recieve the string "1000000000.33" as arg
save "1000000000" as _whole
arg now equals ".33"
add zero to get 0.33
compute that 0.33 = "33/100" as save as fract
return _whole & " " & fract

I think that's the only way you're going to get around the 4.2 bil
problem.
Might be easier to just say your function doesn't handle values that
big,
because if you're dealing with stuff that size, fractions usually don't
matter a whole lot (what's another .01 when you've already got
4,000,000,000?).

HTH,
barneyb

---
Barney Boisvert, Senior Development Engineer
AudienceCentral (formerly PIER System, Inc.)
[EMAIL PROTECTED]
voice : 360.671.8708 x12
fax   : 360.647.5351

www.audiencecentral.com

> -----Original Message-----
> From: charlie griefer [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 25, 2003 12:26 PM
> To: CF-Talk
> Subject: CF error...Cannot convert 10000000000 to integer
>
>
> Hey folks:
>
> working on a function to convert a decimal number to a fraction.
>
> everything's working fine, unless the number passed to the
> function has MORE
> than 9 decimal places.  If 10 decimal places, i get:
>
> Error Occurred While Processing Request
> Cannot convert 10000000000 to integer
>
> The function can be seen here:
> http://charlie.griefer.com/decimal_to_fraction.cfm
>
>
> Is this something wrong in the code?  Or a ceiling on CF and integers?
>
> Also...just curious...if you were using this function, and passed
> .33 to it,
> would you rather get back 33/100 (accurate), or 1/3 (more generally
> accepted)?
>
> tia,
> charlie
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
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

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to