<!----- significant figures numaric -------->
<cfscript>
 function SFFormat(fltNumber,intSF) {
  intExponent=int(log10(abs(fltNumber)))-intSF+1;
  return round(fltNumber/10^intExponent) * 10^intExponent;
}
</cfscript>

<!------- scientific notation ------------>
<cfset a = #SFFormat(200100,3)#>

<cfset num=a*10^-intExponent & "x10#Trim(NumberFormat(intExponent, 
"_+_______"))#">

<cfset num2 = '#REReplace(num, "[+]", "^", "ALL")#' />

<cfset num3 = '#REReplace(num2, "[x]", " x ", "ALL")#' />

<cfoutput>#num3#</cfoutput>

With this code the answer comes out 200 x 10^4 I need 2.00 x 10^4

I cant get the decimal to appear correctly. Any thoughts?

Thanks
Keith

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:356174
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to