Guest Cheung Posted September 27, 2002 Posted September 27, 2002 Dim result As Double Dim first As Double Dim second As Double Dim third As Double Dim fourth As Double first = 31 second = 13 third = 31 fourth = 434 result = Math.Ceiling((first - second) / third * 434) MsgBox("result" & result) Obviously, the correct answer is 252. But it gives 253!! pls suggest how I can solve it. it is a matter of the datatype? Thank you very much. Quote
*Experts* Bucky Posted September 27, 2002 *Experts* Posted September 27, 2002 Actually, it computes to 252.00000000000003, which when using Ceiling rounds up to 253. If you're looking to round a number, use Math.Round. Also, get into the .NET habit of using MessageBox.Show instead of MsgBox. Quote "Being grown up isn't half as fun as growing up These are the best days of our lives" -The Ataris, In This Diary
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.