nice peter... thanks, I will work with this and see what I can do with it.

It's odd, when the value retrieved from the database has more than two zeros
to the right of the decimal point CF fills the text box with scientific
notation.  Subsequent cfinput validation for numeric then fails when CF
decides that 2E-004 in not numeric and pops an alert box ;-(    I can't seem
to shut that off so my next step is to stop the cfinput validation and check
for numeric data post form submission.

If I use cf functions like Trim(NumberFormat(num,'PPPPPPPP.PPPPPPPP')) to
populate the text box it frequently puts up odd results into the text field
such as 0.00019999999494757503  for .0002 which comes from the database
field being used to populate the text box.... and values like .000002 show
up like

How is that controlled?  can't seem to find a good way to override it.  yes
the field is float or real depending upon which database is in use.


On Thu, Apr 30, 2009 at 11:42 AM, Pete Freitag <p...@foundeo.com> wrote:

>
> Gonzo,
>
> You can do this with BigDecimal and NumberFormat java classes:
>
> <cfset n = "4.7e-013">
> <cfset bigD = CreateObject("java", "java.math.BigDecimal")>
> <cfset numFormat = CreateObject("java", "java.text.NumberFormat")>
> <cfset numFormat = numFormat.getInstance()>
> <cfset bigD.init(n)>
> <cfset numFormat.setMaximumFractionDigits(100)>
> <cfset numFormat.setMaximumIntegerDigits(100)>
> <cfoutput>#numFormat.format(bigD.doubleValue())#</cfoutput>
>
> --
> Pete Freitag
> http://foundeo.com/ - ColdFusion Consulting & Products
> http://petefreitag.com/ - My Blog
> Web Application Firewall For ColdFusion: http://foundeo.com/security/
>
>
> On Tue, Apr 28, 2009 at 7:02 PM, Gonzo Rock <gonzor...@gmail.com> wrote:
> >
> > Having trouble converting numbers like
> >
> > 4.7e-013
> > and
> > 1.234e+012
> >
> > into decimal notation
> >
> > 0.00000000000047
> > and
> > 1234000000000.0
> >
> > scoured this list for "scientific notation" and found some discussion but
> > ... alas no cigar, as they say.
> >
> > any help would be appreciated ;-)
> >
> > thanks,
> > Gonzo
> >
> >
> >
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:322088
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to