Simple math question

1. Senior Member
Join Date
Dec 1969
Posts
1,912

## Simple math question

Ok, I have one form field, I enter a #. Let&#039;s say 7.99<BR><BR>I press submit. The response page is told to multiply it by 3.<BR><BR>Ok, so I start off with:<BR><BR>dim a<BR>a=cint(request.form("textbox"))<BR><BR><BR>Re sponse.Write("" & a & "")<BR><BR>Dim test<BR>test = a*4<BR>Response.Write("<BR>" & test & "")<BR><BR><BR>Ok, so what&#039;s the problem? THE GD result is rounded off. If I type 4.44 I want THAT to multiply by 4 NOT 4 X 4 ,as 4.44 seems to round off to 4.<BR><BR>How do I KEEP the pure # and multiply THAT, NOT it&#039;s rounded off #, by 4, as in the response page?<BR><BR>So if I type 4.4 and press enter, it FINALLY multiplies 4.4 x 4, not 4 x 4.<BR><BR>I tried the vbscript reference, I couldn&#039;t find where a String from a FORM would PREVENT rounding off. Where can I learn to do that?<BR><BR>Thanks<BR>

2. Senior Member
Join Date
Dec 1969
Posts
972

## RE: Simple math question

You round it off yourself with the cint function, which converts your string to an integer:<BR><BR>a=cint(request.form("textbox"))<BR ><BR><BR>So replace the cint with cdbl, which converts your string to a double...<BR><BR>

3. Senior Member
Join Date
Dec 1969
Posts
614

## RE: Simple maths question

Sorry you did it CINT() returns an integer.

#### Posting Permissions

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