Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

overflow error for small numbers

cloudncalicloudncali Posts: 35Member
[b][red]This message was edited by cloudncali at 2006-6-16 20:29:50[/red][/b][hr]
ok i have some vary small numbers like not even in the hundreds

is there any other way this error is caused?
any way help plz :(


Comments

  • cloudncalicloudncali Posts: 35Member
    : [b][red]This message was edited by cloudncali at 2006-6-16 20:29:50[/red][/b][hr]
    : ok i have some vary small numbers like not even in the hundreds
    :
    : is there any other way this error is caused?
    : any way help plz :(
    :
    :
    :
    Hello any one want to help me
  • BitByBit_ThorBitByBit_Thor Posts: 2,444Member
    [b][red]This message was edited by BitByBit_Thor at 2006-6-19 5:29:34[/red][/b][hr]
    : : [b][red]This message was edited by cloudncali at 2006-6-16 20:29:50[/red][/b][hr]
    : : ok i have some vary small numbers like not even in the hundreds
    : :
    : : is there any other way this error is caused?
    : : any way help plz :(
    : :
    : :
    : :
    : Hello any one want to help me
    :

    Post the piece of code.

    Best Regards,
    Richard



  • cloudncalicloudncali Posts: 35Member
    Public HP As Single
    Public HPM As Single
    Public MP As Single
    Public MPM As Single
    Public SP As Single
    Public SPM As Single
    HPBar.Width = 2520 - (HP / HPM)
    MPBar.Width = 2520 - (MP / MPM)
    SPBar.Width = 2520 - (SP / SPM)

    im gussing that it might be the /ing Part
  • dokken2dokken2 Posts: 532Member
    : Public HP As Single
    : Public HPM As Single
    : Public MP As Single
    : Public MPM As Single
    : Public SP As Single
    : Public SPM As Single
    : HPBar.Width = 2520 - (HP / HPM)
    : MPBar.Width = 2520 - (MP / MPM)
    : SPBar.Width = 2520 - (SP / SPM)
    :
    : im gussing that it might be the /ing Part
    :

    you can try declaring the variables as Double instead of Single, that would provide some additional math precision. still may not solve the overflow because of how the floating point numbers are represented in binary.
  • cloudncalicloudncali Posts: 35Member
    : : Public HP As Single
    : : Public HPM As Single
    : : Public MP As Single
    : : Public MPM As Single
    : : Public SP As Single
    : : Public SPM As Single
    : : HPBar.Width = 2520 - (HP / HPM)
    : : MPBar.Width = 2520 - (MP / MPM)
    : : SPBar.Width = 2520 - (SP / SPM)
    : :
    : : im gussing that it might be the /ing Part
    : :
    :
    : you can try declaring the variables as Double instead of Single, that would provide some additional math precision. still may not solve the overflow because of how the floating point numbers are represented in binary.
    :
    i did that and it i still got the error i rilly need to solve this this is holding back my game
  • BitByBit_ThorBitByBit_Thor Posts: 2,444Member
    : : : Public HP As Single
    : : : Public HPM As Single
    : : : Public MP As Single
    : : : Public MPM As Single
    : : : Public SP As Single
    : : : Public SPM As Single
    : : : HPBar.Width = 2520 - (HP / HPM)
    : : : MPBar.Width = 2520 - (MP / MPM)
    : : : SPBar.Width = 2520 - (SP / SPM)
    : : :
    : : : im gussing that it might be the /ing Part
    : : :
    : :
    : : you can try declaring the variables as Double instead of Single, that would provide some additional math precision. still may not solve the overflow because of how the floating point numbers are represented in binary.
    : :
    : i did that and it i still got the error i rilly need to solve this this is holding back my game
    :

    Did you make sure that HPM, MPM and SPM have a value? Division by zero will cause it's own kind of overflow error (or was it just a 'division by zero' error?)

    Furtherly, run through the code with Debug, step by step. Make sure the value of Width etc doesn't get negative! Running through it in debug will let you see what values come out of the equation.


    Best Regards,
    Richard

  • DrMartenDrMarten Posts: 748Member
    [b][red]This message was edited by DrMarten at 2006-6-20 0:58:59[/red][/b][hr]
    Hi,

    What are HPBar MPBar and SPBar are they scrollBars?

    The VB name for the control is a Trackbar.
    It is in VB.Net at least.


    Regards,

    Dr M.

  • dokken2dokken2 Posts: 532Member
    : : : : Public HP As Single
    : : : : Public HPM As Single
    : : : : Public MP As Single
    : : : : Public MPM As Single
    : : : : Public SP As Single
    : : : : Public SPM As Single
    : : : : HPBar.Width = 2520 - (HP / HPM)
    : : : : MPBar.Width = 2520 - (MP / MPM)
    : : : : SPBar.Width = 2520 - (SP / SPM)
    : : : :
    : : : : im gussing that it might be the /ing Part
    : : : :
    : : :
    : : : you can try declaring the variables as Double instead of Single, that would provide some additional math precision. still may not solve the overflow because of how the floating point numbers are represented in binary.
    : : :
    : : i did that and it i still got the error i rilly need to solve this this is holding back my game
    : :
    :
    : Did you make sure that HPM, MPM and SPM have a value? Division by zero will cause it's own kind of overflow error (or was it just a 'division by zero' error?)
    :
    : Furtherly, run through the code with Debug, step by step. Make sure the value of Width etc doesn't get negative! Running through it in debug will let you see what values come out of the equation.
    :
    :
    : Best Regards,
    : Richard
    :
    :

    Overflow can be caused by how the numbers are represented in binary. Some floating point numbers can *never* be accurately represented, ie: 1/3 is not equal to 0.33333333 and there is a sign bit for floating point. arithmetic operations can introduce their own error.

    i have a good article by a professor from drexel but its no longer on the web, there are others - http://docs.python.org/tut/node16.html

    errors occur from-
    - inexact representation of a constant
    - integer overflow resulting from a calculation with a result too large for the wordsize
    - integer overflow resulting from a calculation with a result too large for the number of bits used to represent the mantissa of a floating point number
    - accumulated error resulting from repeated use of numbers stored inexactly


Sign In or Register to comment.