Return-Path: Delivered-To: apmail-velocity-dev-archive@www.apache.org Received: (qmail 65692 invoked from network); 6 Feb 2009 17:05:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Feb 2009 17:05:38 -0000 Received: (qmail 83077 invoked by uid 500); 6 Feb 2009 17:05:37 -0000 Delivered-To: apmail-velocity-dev-archive@velocity.apache.org Received: (qmail 83046 invoked by uid 500); 6 Feb 2009 17:05:37 -0000 Mailing-List: contact dev-help@velocity.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Velocity Developers List" Delivered-To: mailing list dev@velocity.apache.org Received: (qmail 83035 invoked by uid 99); 6 Feb 2009 17:05:37 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Feb 2009 09:05:37 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of nbubna@gmail.com designates 209.85.198.237 as permitted sender) Received: from [209.85.198.237] (HELO rv-out-0506.google.com) (209.85.198.237) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Feb 2009 17:05:30 +0000 Received: by rv-out-0506.google.com with SMTP id b25so832940rvf.49 for ; Fri, 06 Feb 2009 09:05:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=NS355KT4CkaF/heiI+2mGmsG9e1ddJ9e4VI41vtQjys=; b=nMzDJD8EQgJ9m4I5WslraL5XA4To7GW5EoyOSwcJKlt4jcOz91S9Qz6YMJFtzCoqiU 7FfY/RXaymA3SMtocgVK5A+NTxuhIjLNBnW376ARL7UuntbEXeV6SR9w/vhnMiAJ8d2F hQMI4mse9biitIagDvcGU8eE0Kybz9xL6KP9s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=MovkpaWRi/vbqpJyrySZ+R9BcO40No0T/CYXAoAS767EK5YcU504caZT5HRdcmn7vy c2dVSM4yOtB3CCUrAvFnOCgI8kcE62PX/CtR3fVKDYKz+uyXgPeVNvxNFbOHW9vsxBTn W2aMdwg6Qsphrq9U6tSRjw0dW/FdGzR6FAFME= MIME-Version: 1.0 Received: by 10.141.172.7 with SMTP id z7mr1419478rvo.128.1233939910025; Fri, 06 Feb 2009 09:05:10 -0800 (PST) In-Reply-To: References: Date: Fri, 6 Feb 2009 09:05:09 -0800 Message-ID: <4d651da50902060905o4aa2e1a1r8655339c60620df3@mail.gmail.com> Subject: Re: Float precison From: Nathan Bubna To: Velocity Developers List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org You could use the MathTool to round your result: http://velocity.apache.org/tools/devel/javadoc/org/apache/velocity/tools/generic/MathTool.html You might also try consider using Float or BigDecimal types instead of Double. On Fri, Feb 6, 2009 at 8:28 AM, BOUTERFASS Mostapha wrote: > Hi all > i put in my context 3 float : v1 = 2 v2 = 11 v3 = 0.1 > > in my template i have > > #set( $mnt = (100 * v1 * v2 / (1 + v3))) > v1 = $v1 > v2 = $v2 > v3 = $v3 > mnt = $mnt > > > after execution i have this result > v1 = 2.0 > v2 = 11.0 > v3 = 0.1 > mnt = 1999.9999999999998 > > > but the right result mast be mnt = 2000 !!! > > > how can i resolve this problem > > > thanx in advence > and sorry for mu english > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org For additional commands, e-mail: dev-help@velocity.apache.org