[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 177
  • Last Modified:

Dropping the decimals??

I'm doing a simple math calcuation and for some reason CF is dropping the decimals:

When I output it on the screen, this is what it says:
22222\1000=22
22*10.0000=220

Here is the math:

<cfset price=#form.qty#\1000>#form.qty#\1000=#price#<br>
#price#*#priceperm#=<cfset price=#price#*#priceperm#>#price#<br>

Help! Am I having a brain freeze or something?
0
mailershaven
Asked:
mailershaven
  • 2
1 Solution
 
sigmaconCommented:
Hi mailershaven,

try

<cfset price=#form.qty# / 1000.00>#form.qty# / 1000.00 =#price#<br>
#price#*#priceperm#=<cfset price=#price#*#priceperm#>#price#<br>


Good luck!
0
 
sigmaconCommented:
actually, drop the unneccessary #s

<cfset price= form.qty / 1000.00>#form.qty# / 1000.00 = #price#<br>
#price# * #priceperm# = #price * priceperm#<br> <!--- this works only in MX, not in CF 5 --->

0
 
mailershavenAuthor Commented:
definite brain freeze. / :)
0

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now