If MinDouble > 0 Then // -> всегда True If MinDouble < 0 Then // -> всегда False 

... And how to compare with him?

I will try to explain in more detail the essence of the question: the minimum and maximum possible value is needed in order to determine the boundaries of the range. In order to create these constants. And the fact that the minimum value is greater than zero is strange, because negative values ​​for this type are not forbidden by anyone to assign. In practice, it turns out all negative numbers are less than the minimum value, although it is the minimum so that there is nothing less than it.

  • 3
    Why don't you read the Delphi documentation, how is MinDouble defined? - Vlad from Moscow

2 answers 2

The fallacy is that:

  • as opposed to integers, where the minimum is the most negative value
  • The minimum number of type Double (and similar types with a "floating point") is the minimum non-zero value.

The fact is that the sign of a number with a point is encoded with one bit, and does not affect the minimum / maximum values ​​represented by this type.

In this way:

  • MinDouble = 5.0e-324; Minimum representable non-zero number
  • MaxDouble = 1.7e+308; Maximum non-zero representable number

Positive or negative number - for these constants it does not matter, you add the sign as you need. For example, using 4 numbers and a sign, we get the following ranges:

 [-MaxDouble .. -MinDouble] 0 [+MinDouble .. +MaxDouble] 

PS And Delphi has nothing to do with it, in other programs it’s still the same.

  • Thank you for the detailed explanation! - Isaev
  • (and similar floating point types) What about Comp and Currency? They also belong to the group of these types, but the minimum values ​​correspond to negative boundaries. - Isaev
  • one
    @Isaev Currency is a fixed-point type, not a floating one. This is not a similar type ;-) ( docwiki.embarcadero.com/RADStudio/Seattle/en/Delphi_Data_Types ) - Kromster
  • Can I ask you to transfer a comment from the question to the question itself? Yes, of course, suffered. - Isaev

Because MinDouble defines the minimum absolute value of type double

 MinDouble = 5.0e-324;