[Archive!] Pure mathematics, physics, chemistry, etc.: brain-training problems not related to trade in any way - page 510

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I don't like to use continue and break operators, but maybe they can help you, especially since a 36-fold if on mql might not work
And accelerate My code can be broken down if, consisting of a complex 36-entry check condition, into 36 ifs with a simple condition! :)))
I think the code would speed up noticeably, although to know for sure you need to understand the machine instructions, which are the result of compilation.
I ran your code in MT5. It already has short evaluations of logical operators already implemented (built in), so there's no need to break the code into lots of ifs.
In MT4 it is different, this optimization makes sense there. But I did time evaluation in MT5, by short scheme.
Accelerated by a factor of 4. Rewrote Validate().
Now it's like this:
WorkTime == 200 msHorrible, but it makes sense to optimise the code in the following way. Many times faster! And here MT5 won't help any more.
It's not an idea of course. But I wonder how fast it will work! :))
Also in the code I reduced the range of the divisor values. 654321/2 = 327160,5...
Accelerated by a factor of 4. Rewrote Validate().
Now it looks like this:
WorkTime == 200 msIt's beautiful! Not like mine.
I have an idea to write a column division algorithm. Divide by digits, write down the remainder of division and when the result is greater than 6, do the continue operation. That's exactly what I did this afternoon, when I was going through the five, I divided everything in columns. But it's a long time coming! :))
It's in the hexadecimal number representation that you need to do the optimization, as you have done.
I have an idea to write a column division algorithm. Divide by digits, write down the remainder of the division and if it matches or the result is greater than 6, do the continue operation. That's exactly what I did this afternoon, when I was going through the five, I divided everything in columns. But it's a long time coming! :))
It's in the representation of six-digit numbers that we need to optimize, as you have done.
О! That's not a bad idea. Rewrote it again. WorkTime=125 ms.
О! That's not a bad idea. Rewritten it again. WorkTime=125 ms
Now the hockey players will definitely stay happy! :)))) I didn't mean it like that though! ;D
How much does the time counter show by My code?
I understand the changes. I just haven't mastered it yet:
"Is "|=" a logical OR? The rest is a dead end...
Now the hockey players will be happy for sure! :))))
Yeah.
Your new code is even faster, but there are some bugs there.
The number of curly braces didn't add up. But I think that's nothing, it can be fixed by deleting the last one.
Explain the meaning of the highlighted lines. I don't get it.
Yeah.
Your new code is even faster, but there are some bugs there.
The number of curly braces didn't add up. But I think it's nothing, it can be fixed by deleting the last one.
Explain the meaning of separated lines. I do not understand.
Exactly... Bullshit! :))) And brackets seem to be ok, I copied from ready-made code.
This is how it should be:
Also in MQL5 it will speed up comparison a bit:
But 125 ms is clearly not catching up.
Or maybe it's all in C++?
.
Validate- one parameter function.
How about the old-fashioned way... allocate memory and cache a bool
for all valid values of the argument?