May 01, 2024, 07:04:15 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Confusion

Started by src243, September 16, 2009, 05:03:25 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

src243

I have a program with integer and double precision variables. When executing the values are altered but not by any code. In some instances, the value changes when the variable is used in a calculation.


LarryMc

LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

src243

There is no reason for the value to change. The code does not assign a new value.

LarryMc

OK?

You do understand that if you want some help you need to post the code that is giving you the problem along with the specific results you expect vs what you're getting?

Otherwise, all we can offer is "Sorry to hear you're having problems".

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

src243

How do I add the code and the data associated data file?

LarryMc

put your .eba file and the data file into a zip file

post a reply
at the bottom left corner of the area you type your post there is a link 'Additional Options'
click that
browse to where the zip file is.
click on the zip file and then click open
now your zipfile appears in the edit control next to the word Attach.
now click post.

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

src243

I have attached the files.
The problem occurs at line 686 where the value of FAVG changes for the i=3 as indicated in the print out of the value at 733. At this point, the value of FAVG changes for <1 to 21.

LarryMc

Scott

Looking at the values while the program is running.

every execution of line 660 where i=3 the value of FAVG is 21....
and at the end of all the looping the value of FAVG[3] at line 733 is the same exact 21....

so the value of FAVG[3] is not changing between those 2 lines as you suggest.

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

billhsln

September 16, 2009, 08:29:26 PM #8 Last Edit: September 16, 2009, 08:46:02 PM by billhsln
Quick thing that needs to be fixed:  Line 289, 682, and 699.  You have END IF, should be ENDIF (no space).  Surprised the compiler does not complain about them.

Also, you need to note that every thing in EBasic is Base of 0 (zero), so:

DEF freq[7,60] as FLOAT

FOR I=1 to 7
  FOR J=1 to 59
    freq[I,J]=0.0
  NEXT J
NEXT I

Should be:

FOR I=0 to 6
  FOR J=0 to 59
    freq[I,J]=0.0
  NEXT J
NEXT I

For FREQ I of 7 is out of range.

The END could give unpredictable results.

Bill
When all else fails, get a bigger hammer.

Ionic Wind Support Team

Bill,
The compiler allows both forms.  Same with END SUB

Paul.
Ionic Wind Support Team

Ionic Wind Support Team

Scott,
You need to review the manual on arrays.  Arrays in Emergence are 0 based, not 1 based.  This section of code for example:

FOR I=1 to 7
FOR J=1 to 59
freq[I,J]=0.0
NEXT J
NEXT I


is exceeding the dimension of the array.  You have freq defined as:

DEF freq[7,60] as FLOAT

Which has valid indices of [0-6, 0-59]

By using FOR I = 1 TO 7 you are overwriting 59 * 8 bytes of memory beyond the array.  You have made this error throughout your code, so I will leave it to you to find the rest.

Paul.
Ionic Wind Support Team

src243

It was the array size. THanks,

src243