PDA

Click to See Complete Forum and Search --> : variable types


atom
Jun 1st, 2001, 08:16 AM
I am trying to write a vb component, which receives values from an asp page and then makes some calculations before returning the value. However, as I am fairly new to this game, it is coming up with an error saying 'overflow'!

The values I pass into the component are integers. These are then multiplied with some constant values, which can be anything up to 50000. I therefore stored these in a variable of type long. This value is then multiplied by 0.10, to give a percentage. The function then returns the value back to the asp page as a variable type double.

I hope this makes sense, and would appreciate it very much if anyone could suggest where I am going wrong.

Rob Brown
Jun 2nd, 2001, 04:37 AM
The number after multiplication is too large to be stored in a long variable, I would suggest perhaps dividing by .10 before multiplying, the calculation will produce the same result but the number should not 'overflow' the variable if you do it this way.

Hope this is of help.

Best regards,

Rob Brown.