Jump to content

VBScript Int function returns wrong result!


Recommended Posts

Can anyone please explain why the Int function returns random incorrect values in the following code?

Running Win Server2003 and IIS 6.

The full code and result can be viewed here www.patronomy.com/test/test-int.asp


I couldn't believe it at first because Stripe (a payment processor) requires whole numbers eg, 803 for $8.03 and as you can see the iteration has many errors.


<table><%TR "Value", "Int(Value*100)"For i = 1 to 10 For j = 1 to 10 k = i+(j/100) TR k, int(k*100) NextNext %></table><%Function TR(str1, str2) Response.Write("<tr><td>"&str1&"</td><td>"&str2&"</td></tr>")End Function%>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...