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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...