Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Feb 2007
    Posts
    218
    Thanks
    25
    Thanked 1 Time in 1 Post

    overflow problem in 1 line :S

    Hi there, I've got an overflow in this line:

    <%=Round((Clng(nrOfGeenInteresse) / (Clng(nrOfGeenInteresse) + Clng(nrOfDeelnames))) * 100,2)%>%";

    I've tried it with cint, int and clng..though the overflow error remains.. :S
    How come ?

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Zwolle, The Netherlands
    Posts
    1,120
    Thanks
    2
    Thanked 31 Times in 31 Posts
    perhaps you can split this oneliner into a few lins, to see where it goes wrong exactly:
    Code:
    <%
    lngNrOfGeenInteresse = Clng(nrOfGeenInteresse)
    lngNrOfDeelnames = Clng(nrOfDeelnames)
    quotient = lngNrOfGeenInteresse / (lngNrOfGeenInteresse + lngNrOfDeelnames)
    percentage = quotient * 100
    Round(percentage, 2)
    %>
    also you might want to spit out the values of some of these variables with response.write
    I am the luckiest man in the world

  • #3
    Registered User
    Join Date
    Jan 2006
    Posts
    130
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Check the character length of what is being passed in. I copied your code and supplied my own numbers and it was fine until I entered a number of 10 digits, at which time I also received an overflow error.

  • #4
    Regular Coder
    Join Date
    Mar 2007
    Posts
    505
    Thanks
    1
    Thanked 19 Times in 19 Posts
    Also, check to make sure that none of your numbers is 0.

    Since you are doing mathematical calculations including division. If you have a 0 as the divisor you will get an Overflow, as the dividend, a DIV BY 0 error.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •