Page 1 of 1

harbour Math Difference ?

Posted: Tue Oct 12, 2021 4:57 am
by AUGE_OHR
hi,

this was my working Code

Code: Select all

   Row1 := Height/6*5
   Col1 := Width /6*5
   Row2 := Height/6*1
   Col2 := Width /6*1
than i try this

Code: Select all

   nRing := 3 
   Row1 := Height/nRing*2*5
   Col1 := Width /nRing*2*5
   Row2 := Height/nRing*2*1
   Col2 := Width /nRing*2*1
but it does not work :o

so i try

Code: Select all

   Row1 := Height/(6*5)
   Col1 := Width /(6*5)
   Row2 := Height/(6*1)
   Col2 := Width /(6*1)
and now "this" also does not work :shock:

i did more test and found this Solution

Code: Select all

   nRing := 3 
   Row1 := Height/(nRing*2)*5
   Col1 := Width /(nRing*2)*5
   Row2 := Height/(nRing*2)*1
   Col2 := Width /(nRing*2)*1
but i still confused about Different Result
for my xBase Knowhow all seems to have sane Result, or :?:

Re: harbour Math Difference ?

Posted: Tue Oct 12, 2021 7:24 am
by edk
Hi Jimmy.
You are asking about elementary rules of mathematical operations. In primary school, they teach that there are four basic math operations: division, multiplication, addition and subtraction. According to mathematical rules, individual calculations must be performed in the right order: first we perform calculations in parentheses, then outside the parentheses in the following order: division, then multiplication, and finally addition and subtraction. We perform the calculations from left to right.
Let's see it in the example we're discussing.
For the sake of calculations, assume that the variable "Height" is equal to 30 and nRing = 3.
1. Row1: = Height / 6 * 5 => 30/6 * 5 => 5 * 5 = 25
2. Row1: = Height / nRing * 2 * 5 => 30/3 * 2 * 5 => 10 * 2 * 5 => 20 * 5 = 100
3. Row1: = Height / (6 * 5) => 30 / (6 * 5) => 30/30 = 1
4. Row1: = Height / (nRing * 2) * 5 => 30 / (3 * 2) * 5 => 30/6 * 5 => 5 * 5 = 25

Re: harbour Math Difference ?

Posted: Tue Oct 12, 2021 11:39 pm
by AUGE_OHR
hi,

you are right, sometimes i forgot rules of mathematical operations ... :roll: