Wishes for MT5 - page 46

 
-Alexey-:
I disagree, there is a problem, here is an example (grid 10000x10000):

double x1=0.0011;

double y1=x1/10000;

double x2=0.0012;
double y2=x2/10000;

double c=y1-y2;
double d=MathPow(c,2);


printf(string(d));

результат: 9.999999999999968e-017

So what do I do with this result? How do I compare it to other results? DBL_EPSILON=2.2204460492503131e-016. Besides the last two digits - see? And that's only two operations. And I have more of these operations. And this information must be used to restore data later with some more operations. More losses. I'm just learning to program in a C-like language and such a class is difficult for me to build (or rather, I have no idea how). This is a serious work. By the way, by any chance, do you have such a class? And the developers can improve things for everyone at once. It would be possible to make 100,000x100,000 grids. Already more or less representative samples would be available, although even this is not enough by and large. And if they made a class for arbitrary precision, it would be even better :) It's just a data type. If it exists, it's there for a reason, because it fulfills a need. The point is that I don't know whether it's difficult or not for developers. If it's difficult and expensive - I agree with you - why pass my problem onto them. But if it's not difficult - why not do it. Again - a powerful development environment for trading calculations with high accuracy - some competitive advantage here :). That's why I'm asking what they think about it.

Please reread the standard form of the number, and many questions will disappear.

In the standard form 1.111e5 is bigger than 9.999e4 so the comparison is quite correct.

Here is the same result: 9.9999999999999999968e-017 is related to the binary representation of the number, not every number in binary form is represented by a finite fraction, some are represented by an infinite fraction, hence rounding off the mantissa to the nearest number with a finite fraction.

By the way double d=MathPow(c,2); it is not correct to take degree, if you work with double then double d=MathPow(c,2.0); so, I don't know bug or not but when setting a number to a degree you should watch for type of indicator too.

 
-Alexey-:
Fantasy has nothing to do with it at all. My question arose about the possibility of implementing the most common method of analysis. And that is to work with the series remaining after removal of the trend and the cycle. It is written about this method in all, without exception, textbooks on finance statistics and method books in universities. This is not a fantasy, but one of the canonical approaches to analysis. And a specialized environment should have means to implement this approach, don't you think?
)))))))
 
Urain:

Please reread the standard form of the number, and many questions will disappear.

In the standard form 1.111e5 is larger than 9.999e4 so the comparison is quite correct.

Here is the same result: 9.9999999999999999968e-017 is related to the binary representation of the number, not every number in binary form is represented by a finite fraction, some are represented by an infinite fraction, hence rounding mantissa to the nearest number with a finite fraction.

About the 1.111e5 and the 9.999e4 I see. But I need to compare these: 9.99999999999999999999968e-017 (about the loss of precision in digits I additionally wrote). Help tells me that numbers with a difference less than DBL_EPSILON should be considered indistinguishable. Sorry, if I'm not making it clear - I'm just learning it now :) Thank you separately for the information about the indicator.

 
Urain:

By the way double d=MathPow(c,2); it is not correct to take degree, if you work with double then double d=MathPow(c,2.0); so, I do not know bug or not but when setting a number to a degree it is necessary to follow the type of indicator.

The exponent must in any case be of type double.
Документация по MQL5: Основы языка / Типы данных / Вещественные типы (double, float)
Документация по MQL5: Основы языка / Типы данных / Вещественные типы (double, float)
  • www.mql5.com
Основы языка / Типы данных / Вещественные типы (double, float) - Документация по MQL5
 

Dear developers, allow void type to return values, or define a new class that returns values of any type.

Something like this:

voids get(int i)
  {
   if(i==0)return((int)2);
   else
     {
      if(i==1)return((double)2);
      else
        {
         if(i==2)return((string)2);
        }
     }
  }

I want to have this kind of declaration in user-defined functions:

int  Custom_ArraySize( void  array[] );   
bool Custom_ArraySort( number&  array[] );

and for that I need to add something to the language. You've over-secured the users, you need to loosen up a little somewhere.

Imagine a developer is writing code, he has created 1500 lines and the whole code operates with a double, to pass an int into it he will have to do an overload for 1500 more lines. And you have 14 types.

 
Urain:

Imagine, a person writes code, makes 1500 lines, and the whole code works with the double, to pass into it you will need to do overloading for 1500 lines more. And you have 14 types.

Use OOP.

 
lea:

Use OOP.

Do you think I write in autocode?

to Developers:

as an option to ease the plight of the writing fraternity, make an array type conversion, so you can at least make such a call:

void OnStart()
  {
   int array[10];
   func((double)array)
  }
//+------------------------------------------------------------------+
void func(double &array[]){};
 
Urain:

Do you think I write in autocode?

Judging from the fact that you needed such an extension of the language, I guess so.

p.s. If you had only the C++ compiler at the time you solved your problem, would we hear a suggestion to revise the language standard?

 
lea:

Based on the fact that you needed such an extension of the language - apparently, yes.

p.s. If you had only C++ compiler at the time of your problem - would we have heard the suggestion to revise the language standard?

Don't confuse translator and compiler. mql isn't really a compiler, it's a translator describing safe C++ function calls.

And mql5 is in active development phase. So my request for changes is quite adequate.

Документация по MQL5: Основы языка / Функции / Вызов функции
Документация по MQL5: Основы языка / Функции / Вызов функции
  • www.mql5.com
Основы языка / Функции / Вызов функции - Документация по MQL5
 
Urain:

Don't confuse translator and compiler, mql is not really a compiler, it is a translator describing safe C++ function calls

Besides, mql5 is at the active stage of development. So my request to make changes is quite adequate.

Ok, if it is so important, let's take Java and not C++. Also translation into bytecode :) Please reconsider the language standard?

A request to add a universal type is not quite adequate. You should ask for templates. And for universal types OOP is enough.