Jump to content
  • Advertisement

MrC_XBMC

Member
  • Content Count

    3
  • Joined

  • Last visited

Community Reputation

122 Neutral

About MrC_XBMC

  • Rank
    Newbie
  1. MrC_XBMC

    Problems when using floats in for loops

    Yeah, certainly! And its worth getting yourself an Xbox just for Vortex ;-) Cheers! MrC
  2. MrC_XBMC

    Problems when using floats in for loops

    Yeah, I agree with the float thing. However this was a user script that I was debugging to find out why it was crashing, so not guilty! Anyway, thanks for the fix and such a great library. You may be interested to know that I am currently using AngelScript in a music visualization plugin for the Xbox Media Center called Vortex. A couple of screenshots of it in action. Cheers! MrC
  3. Hi In certain circumstances when using floats in for loops the termination value is not calculated correctly. Example float[] myArray(70); float aSize = 8; float MyFunction(float a) { return a; } void Test() { for (float k = 0; k< aSize; k++) { myArray[MyFunction(k*aSize)] = k; } for (int i = 0; i< aSize*aSize; i++) { Print("i = " + i + "\n"); myArray = i; } } In the above example the 2nd for loop should terminate at 64 but it keeps going until it eventually crashes with an out of bounds exception when it hits 70. Remove the 1st for loop and the 2nd for loop stops at 64 as expected. Remove the call to MyFunction and the 2nd loop works. Remove the *aSize in the 1st for loop and the 2nd loop works. Compiled Bytecode 31 8 * SUSPEND 32 8 * CpyVtoV4 v4, v1 34 8 * iTOf v4 35 8 * CpyGtoV4 v5, 1 37 8 * CpyGtoV4 v4, 1 39 8 * MULf v5, v5, v4 41 8 * CMPf v4, v5 43 8 * JNS +55 (d:100) I don't fully understand the above but it looks like v4 is getting overwritten before it is used. I am using the svn version of AngelScript from today but this problem is also in version 2.5.0b. Thanks.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!