Reputation: 10576
I'm creating script for automated testing of financial application.
Using VbScript as language.
Need to manipulate with large floating point numbers (more than 10 billions) - make add, multiply operations and so on. But vbscript doesn't have data type for large numbers.
Please, advise me any solution or workaround for this problem.
Maybe someone had faced with this problem before?
Thanks!
Upvotes: 0
Views: 5703
Reputation:
@Rob's link is good but his selection of data type is dangerous. Use the Currency type as it is represented internally by a fixed point number.
If you need more than 4 decimal points then you are facing either:
Binary floating point numbers cannot represent decimal numbers accurately and you can end up with rounding errors that make your data invalid. See Why not use Double or Float to represent currency? if you want details.
Upvotes: 1
Reputation: 9
Use that:
function mmod(a,moduloValue)
dim k,t
k=CDbl(a)
t=Fix(k/moduloValue)
mmod = k-(t*moduloValue)
end function
msgbox mmod(4010051786300000078934,1024)
output: 86
msgbox mmod(4010051786300000078934,2)
output: 0
Upvotes: 0
Reputation: 1846
VBScript has some data types for large numbers. In your case, you probably want to use Double. Here's an overview: http://www.csidata.com/custserv/onlinehelp/vbsdocs/vbs0.htm
Upvotes: 0
Reputation: 61755
Try using the decimal data type: http://msdn.microsoft.com/en-us/library/47zceaw7%28VS.80%29.aspx
Upvotes: 0