NormalizeDouble paradox - page 7

 
transcendreamer:

For some reason, houses on streets are numbered from 1

floors in buildings (usually) from 1

rooms with 1

Why are warrants numbered from 0?

And hours, minutes and seconds are numbered from 0.

 
Contender:

And hours, minutes and seconds are numbered from 0.

and so does speed and other things

because 0 on the speedometer has a physical meaning - zero speed.

And zero is nonsense.

In human language, it's common to say "first", "second"...

has anyone ever heard of saying "in-zero"?

...........

Still have to subtract one from TotalOrders()

I don't understand this stubbornness who say zero is more convenient

just like with ArraySize, you have to subtract one.

what's the point of convenience?

 

the whole topic is looking more and more like a collection of jokes about programmers

no offense intended

here's an example

-- a programmer asks a colleague -- "Can I borrow a thousand till payday?

-- take 1024 to make it even.

 
transcendreamer:

unconvincingly

what are the advantages of counting from 0?

For a man, not a machine

Somehow, I didn't set out to convince anyone, the main thing is that I am convinced myself. For that you have to conquer all sorts of complex algorithms with arrays.
 
Integer:
I don't want to convince anyone, the main thing is that I'm convinced of it myself. For that, I'll have to conquer all sorts of complicated algorithms with arrays.

I'm not imposing my opinion either.

when I had to work with matrices, I saw that it was often convenient to shift an element by its index in a loop

but there have been many counter-examples where it's intuitively easier to have the last index equal to the dimension

or this example: for(int i=0; i<variables+constants; i++)

here is the enumeration of variables and constants; it would be intuitively more convenient if i=variables+1 meant transition to the area of constants

i.e. by the number of variables + 1 - it means that variables have ended, constants have started - everything is simple

but no - we have to remember to decrease by one (or do a separate conversion of the variable number to the array index)

so it's not all so straightforward.

 
transcendreamer:

I'm not imposing my opinion either.

when I had to work with matrices, I saw that it was often convenient to shift an element by its index in a loop

but there have been many counter-examples where it's intuitively easier to have the last index equal to the dimension

or this example: for(int i=0; i<variables+constants; i++)

here is the enumeration of variables and constants; it would be intuitively more convenient if i=variables+1 meant transition to the area of constants

i.e. by the number of variables + 1 - it means that variables have ended, constants have started - everything is simple

but no - we have to remember to decrease by one (or do a separate conversion of the variable number to the array index)

so it's not all that straightforward.

Because there's no way you can get away from school maths with counting from one.

When counting from 0, you don't have to remember any units, everything adds up miraculously by itself.

Everything is simple and clear:

for(int i=0; i<variables; i++){}

for(int i=variables; i<variables+constants; i++){}

or

for(int i=0; i<variables+constants; i++){if(i<variables){}else{}}

If it suddenly takes a countdown from 1, then there's something wrong with the algorithm.

 
transcendreamer:

and so is speed and other variables

because 0 on the speedometer has a physical meaning - zero speed

and zero is nonsense.

The human language is to say "first", "second"...

has anyone ever heard of saying "in-zero"?

...........

Still have to subtract one from TotalOrders()

I don't understand this stubbornness who say zero is more convenient

just like with ArraySize, you have to subtract one.

What's the point of convenience?

Who's forcing you to talk about "zeros"? Say it however you like, the first ones for example. But don't forget about indexing.

OrdersTotal() will give you 10, if the number of open positions == 10. If you subtract then one, then you introduce an error in calculations.

ArraySize() will give you 10 if the array has 10 cells. If you subtract 1 after that (not for reference to a cell by its index, but for manipulations with the array size), you make a mistake in calculations.

The number of orders is given to you in the format you are used to. If there are 10 of them, you will get 10. And when you refer to an array element by index, you must not forget to start from zero.

 

  for(int i=0; i<variables+constants; i++){if(i<variables){}else{}}

this is where the physical meaning of variable i is lost

I don't understand how you can seriously say that.

it's unnatural to count from zero.

in ancient Babylon they used to count by 12 but the clever Jews invented the decimal system because there are 10 fingers and still everybody uses it.

the Romans came up with terrible numbers, but the clever Arabs stole normal numbers from the Indians and it caught on.

people everywhere count from 1 and only a small percentage live differently.

for example int n=OrdersTotal();

it would be quite easy and intuitive for(i=1; i<=n; i++) {OrderSelect(i,.......);} // if numbering were normal human

and the physical meaning of the i variable is as simple and clear as sunlight: select the first order, select the second, the third... until you get to the last one

at any moment, we can check the i variable and by its value tell us which order we are working with, without any shifts

The void DisplayChart(int draw_bars) function, for example, draws draw_bars of the latest bars

to access the first bar in the indicator buffer, you need to subtract 1: draw_bars-1

it's just an extra action every time and it's a pain to remember it

 
Why? Also the subject of a Hollywood action movie. A long time ago, 300 years ago, all earthlings were divided into two classes: some believed that you have to count from one, while others believed that you have to start from zero. And for 300 years there has been a fierce and unrelenting struggle between them... and then he shows up (like some immortal highlander) and... explains to everyone that the countdown must be reversed (and a little askew). Then there's all sorts of stuff and a happy ending.
 
transcendreamer:

For some reason, houses on streets are numbered from 1

floors in buildings (usually) from 1

rooms with 1

Why do they number warrants at 0?

Floors in buildings? It's a matter of how. What the Russians call "ground floor", the Germans call "erdgeschoss", the Germans call the first floor "erste stok". At school it caused me culture shock, which then passed - there's a lot of Horatio's friend...

The English don't have 13 numbers in some places, either in houses or flats.

Orders don't have a zero ticker. And the fact that the account starts from zero, so it is specifically mentioned in the documentation.

If you want to program, program according to programmers' rules.

Reason: