cint seems to round up, is there another way

# Thread: cint seems to round up, is there another way

1. Senior Member
Join Date
Dec 1969
Posts
433

## cint seems to round up, is there another way

&#060;%if objrs("PPP") &#060;&#062; "" then<BR> PPP = cnum(348.99)<BR> end if<BR> if objrs("YDS") &#060;&#062; "" then<BR> YDS = cnum(582.80)<BR> end if<BR> if objrs("LDS") &#060;&#062; "" then<BR> LDS = cnum(582.80)<BR> end if<BR> totalprice = PPP + YDS + LDS<BR>response.write("£" & formatnumber(totalprice, 2))%&#062;<BR><BR>So added together should make £1,514.59, however it seems to make £1,515.00? I thought cint just made sure asp read it as a number rather than string? If not is there another way?<BR><BR>Thanks for any help you can give, Will

2. Senior Member
Join Date
Dec 1969
Posts
231

## RE: cint seems to round up, is there another way

Instead of CInt use CDbl, this will maintain the decimal places.<BR><BR>Cheers,<BR>Mike<BR><BR>p.s. I presume the cnum is a typo on your post?

3. Matthew Augier Guest

## RE: cint seems to round up, is there another way

And Integer is just that - an integer/whole number. Try using cCur which is for currency and should round it correctly...

4. Matthew Augier Guest

## RE: cint seems to round up, is there another way

An Integer is just that - an integer/whole number. Try using cCur which is for currency and should round it correctly...

5. Senior Member
Join Date
Dec 1969
Posts
433

## RE: cint seems to round up, is there another way

Thanks a lot they are both great

6. Senior Member
Join Date
Dec 1969
Posts
614

## CINT ... vs. INT

Cint() returns the neareast integer<BR>Int() truncates<BR><BR>I hope this helps<BR><BR>http://msdn.microsoft.com/scripting/default.htm?/scripting/vbscript/doc/vsfctCInt.htm

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•