How to initialize a double to the max value ? double VarMax = ???; - page 2

 
//+------------------------------------------------------------------+
//|                                           TestDoubleValueMax.mq4 |
//|                                       Copyright © 2012, Pierre8r |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2012, Pierre8r"
#property link      ""

#define INF 0x6FFFFFFF 

//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start()
  {
//----
   double DOUBLE_MAX_VALUE = 1.7 * (MathPow(10,308));
   Alert("DOUBLE_MAX_VALUE  : ", DOUBLE_MAX_VALUE); 
   Alert("INF  : ", INF); 
  
//----
   return(0);
  }
//+------------------------------------------------------------------+

1.7 * (MathPow(10,308)); seen nearest of the max value.

 
//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start()
  {
//----
   double VarMax1 = 1.7976931348623158*MathPow(10,308); //last digit 8
   Alert("VarMax1 = ",VarMax1);
   double VarMax2 = 1.7976931348623159*MathPow(10,308); //last digit 9
   Alert("VarMax2 = ",VarMax2);
//----
   return(0);
  }

 
WHRoeder:
I use this: It's not infinite but larger than you'll find in FX and it can be used in signed computations.

Help! I have the pack of ‘Dragtrade Library’ the new way of trading by drag+drop but there are lots of errors when compile and the pack has so complicated files to place… you can visit the page for details by this link: https://www.mql5.com/en/articles/mt4/ 1034 and download the ‘Pack’ @ the bottom of the page (I can’t put it here!)

I use 5 dijits Acc. I think it’s no problem!! Anyone can tell me how to place all files correctly,clearly and all steps perfectly? All big thanks to all help!+all new modify will be very useful to many people too! Keep watch I’ m gonna’ offer lots of excellent EA’s (but need bit change!)to get modified!!

(anyone want any free EA!..anyone want free daily signal to catch 300 pips/day I am here to give away!!,mail me: kenmakaz@gmail.com)

 
you can just

#define MAX_DOUBLE 1.7976931348623158e308
 
bradleycuster:
Useless. You can just use DBL_MAX, which was not available at the time this topic was created.
 
  1. Don't dredge up old posts, a lot has changed since Build 600 and Higher (17.02.2014)
  2. Write self-documenting code.
    //{ Typedefs
    #define  PRICE    double         // A PRICE
    #define     PRICE_MAX   (PRICE)EMPTY_VALUE
    #define     PRICE_MIN   (PRICE)0
    #define     CHANGE      PRICE    // Difference of two prices.
    #define  INDEX    uint           // Zero based.
       #define  INV_INDEX      UINT_MAX
    #define  COUNT    uint           //  One based.
       #define  INV_COUNT      UINT_MAX
    #define  TICKET   int
       #define  INV_TICKET  EMPTY
    #define  MONEY    double
    #define  SYMBOL   string
    #define  MAX_DATETIME    D'3000.12.31 23:59:59'
    //} Typedefs
    

 
Alain Verleyen:
Useless. You can just use DBL_MAX, which was not available at the time this topic was created.
quite true