Build 2504 & 2506 Bug - page 2

 
JC:

It's a little ironic that this ties in with our discussion of coming from other languages: there are many in which 1 / 2 = 0.5, not 0. While I'm obviously very used to it, I've always regarded it as a counter-intuitive and pointless trap that 1 is treated as (int)1 regardless of cast/context. It's basically a legacy of times when computing power was too limited to put much intelligence into compilers, rather than a useful feature of a language.

The steps by which you then mis-identify something as an external change rather than a persistent bug in your code are, well... if you've never done it, you're the only programmer on earth who hasn't. 

Maybe I was, who knows.

Anyway what is ridiculous is for experimented people to not even check the forum before claiming such things, everyone has to lean and make error, that's the path to knowledge. But claiming "a bug" or "try it" while this topic has been raised at least 10 times (as answered by WHR by the way), is the real issue.

And sorry but it's perfectly coherent and a good illustration my point on the other topic : a language, any language, should be learn on it's own, as much as possible. Never assume anything from your past experience, check it, try it, it's the basic of a scientific approach of life in general and of coding specifically, anything else is dogmatism.

 
Alain Verleyen:


And sorry but it's perfectly coherent and a good illustration my point on the other topic : a language, any language, should be learn on it's own, as much as possible. Never assume anything from your past experience, check it, try it, it's the basic of a scientific approach of life in general and of coding specifically, anything else is dogmatism.


good point.

 

But seriously, I think the platform should at least show a warning on the incorrectness of the division. An implicit typecast can really help.

How can a result of division be zero when  the numerator is not a zero? I don't understand how that math works.

Besides, I'm storing the answer in a double. How can it not be clear what I'm trying to do?

 
Nelson Wanyama:

But seriously, I think the platform should at least show a warning on the incorrectness of the division. An implicit typecast can really help.

How can a result of division be zero when  the numerator is not a zero? I don't understand how that math works.

Besides, I'm storing the answer in a double. How can it not be clear what I'm trying to do?

Integer division. It's perfectly clear concept taught in grade school.

The integer division of 1 by 2, gives 0 remaining 1.

Integer division always zero
Integer division always zero
  • 2012.02.26
  • Safari Safari 9,031 17 17 gold badges 70 70 silver badges 150 150 bronze badges
  • stackoverflow.com
probably my question is very simple and stupid. I would like to store the value of a division, in particular where is a integer value. I try to do it but I always get I try to enter a value fixed in x, for example but always get the same value .. what's Wrong?
 
Alain Verleyen:

Integer division. It's perfectly clear concept taught in grade school.

The integer division of 1 by 2, gives 0 remaining 1.

I remember skipping that class. 😎

Thanks anyway.

 
Yet Python and Julia handle that division as I expected (maybe other languages too). Maybe MetaQuotes should adopt a style that is based on frequent usage rather than a mathematical logic😎
 
Nelson Wanyama: Maybe MetaQuotes should adopt a style that is based on frequent usage r
They did.
  1. It's called Fortran, B,  C, C++, C#, Python 2, SQL, Visual Basic, R, Java.
  2. Integer Division -- from Wolfram MathWorld
  3. Integer Division and Modulus – Programming Fundamentals
 
Thanks William
Reason: