Solved

Dropping the decimals??

Posted on 2004-10-28
163 Views
Last Modified: 2013-12-24
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
Question by:mailershaven
    3 Comments
     
    LVL 8

    Expert Comment

    by:sigmacon
    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
     
    LVL 8

    Accepted Solution

    by:
    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
     

    Author Comment

    by:mailershaven
    definite brain freeze. / :)
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Suggested Solutions

    A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
    Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
    This video Micro Tutorial is the first in a two-part series that shows how to create and use custom scanning profiles in Nuance's PaperPort 14.5 (http://www.experts-exchange.com/articles/17490/). But the ability to create custom scanning profiles al…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    933 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now