Stupid math question

1. Junior Member
Join Date
Dec 1969
Posts
10

## Stupid math question

I have been working 20 hours a day for 3 days... now my brain is some kind of mushy matter..<BR><BR>That is why I cant remember the stupid mathematic way to round 23.75 to 23 .. (not 24 as most language do when u convert the float to integer)<BR><BR>Can someone help me out and remind me how to do this simple task?<BR><BR>Thanks<BR>

2. Senior Member
Join Date
Dec 1969
Posts
213

## RE: Stupid math question

Try doing<BR><BR>Int(23.75)<BR><BR>That should give you 23.

3. Senior Member
Join Date
Dec 1969
Posts
11,334

## RE: Stupid math question

That&#039;s not rounding... you want truncating.<BR><BR>CInt(yourvar)<BR><BR>or<BR><BR> Int(yourvar)<BR><BR>Your choice.

4. Junior Member
Join Date
Dec 1969
Posts
23

## RE: Stupid math question

In VBSCript ...<BR><BR>Both Int and Fix remove the fractional part of number and return the resulting integer value.<BR><BR>The difference between Int and Fix is that if number is negative, Int returns the first negative integer less than or equal to number, whereas Fix returns the first negative integer greater than or equal to number. For example, Int converts -8.4 to -9, and Fix converts -8.4 to -8.<BR>

5. Senior Member
Join Date
Dec 1969
Posts
10,852

## Not quite....

CInt rounds. <BR><BR>You feeling better?

6. Senior Member
Join Date
Dec 1969
Posts
11,334

## Does it really?

Geez.<BR><BR>I&#039;m gettin&#039; really bad with VBS anymore -- haven&#039;t coded with it in so long I&#039;m gettin&#039; rusty. <BR><BR>Yeah, much better. Sorry about your CD again. I have a homebrew I&#039;m probably going to bottle tonight, maybe I&#039;ll send that your way instead.

7. Junior Member
Join Date
Dec 1969
Posts
10

## Supplementary info

Ok maybe I was not clear in my question... but I do not want to use a vb or jscript function... why? I am not using either of these languages but a custom script engine..that engine Rounds 23.75 to 24 when I convert a float to an integer... you guys have to note that not all language will do type casting the same way. <BR><BR>Anyway, what I am looking for is the mathematical way to do that! I remember having to do this in one of my course but can&#039;t remember how...

8. Senior Member
Join Date
Dec 1969
Posts
10,852

## He he....

I know how it is. So what language/technology are you focusign on right now? C++?<BR><BR>&#062;Yeah, much better. Sorry about your CD again. I have a homebrew I&#039;m probably going to bottle tonight, <BR>&#062;maybe I&#039;ll send that your way instead.<BR><BR>Don&#039;t worry about it...And I&#039;d love some. I can&#039;t exactly reciprocate, since I&#039;d be scared to taste anything that I might try and brew, but I&#039;d be happy to send you a selection of Texas&#039; own.

9. Junior Member
Join Date
Dec 1969
Posts
23

## RE: Supplementary info

What do you want, a MacLauren series ? A proof with truth tables ?<BR><BR>How can we advise you on a language/script without knowing anything about said language/script ?

10. Junior Member
Join Date
Dec 1969
Posts
10

## RE: Supplementary info

Man... just for your knowledge... math is a universal language.. when u do int(23.75) in VB it does round it up with a mathematical formula.. it is NOT MAGIC IT IS MATH ! <BR><BR><BR>:)<BR>

#### Posting Permissions

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