Machine constants | Extreme Optimization Numerical Libraries for .NET Professional |

The MachineConstants class contains constants related to
the specific implementation of floating-point arithmetic in the .NET framework and the Common Language Runtime. The
System

Any number representation is necessarily limited. This class provides constants that specify these limits for the CLS' floating-point types.

Many of these constants are also available in the
System^{-16}.
The Double^{-308}) instead.
This makes Double

All machine constants are implemented as static fields of the MachineConstants class.

The following example prints the values of some of the machine constants to the console:

Console.WriteLine("Machine precision: {0:R}", MachineConstants.Epsilon); Console.WriteLine("Largest value: {0:R}", MachineConstants.MaxDouble); Console.WriteLine("Smallest normalized value: {0:R}", MachineConstants.MinNormalizedDouble); Console.WriteLine("Logarithm of largest value: {0:R}", MachineConstants.LogMaxDouble);

The following table summarizes the machine constants for the Double type:

Machine precision | |
---|---|

Represents the machine precision for Double-precision floating point numbers. | |

Represents the square root of the machine precision Epsilon for Double-precision floating point numbers. | |

Represents the cube root of the machine precision Epsilon for Double-precision floating point numbers. | |

Represents the largest possible value of a Double-precision floating point number. | |

Represents the square root of MaxDouble. | |

Represents the natural logarithm of MaxDouble. | |

Represents the smallest Double-precision floating point number that is greater than zero. | |

Represents the square root of MinDouble. | |

Represents the natural logarithm of MinDouble. |

A similar set of constants is available for the Single type.

Machine precision | |
---|---|

Represents the machine precision for Single-precision floating point numbers. | |

Represents the square root of the machine precision SingleEpsilon for Single-precision floating point numbers. | |

Represents the cube root of the machine precision SingleEpsilon for Single-precision floating point numbers. | |

Represents the largest possible value of a Single-precision floating point number. | |

Represents the square root of MaxSingle. | |

Represents the natural logarithm of MaxSingle. | |

Represents the smallest Single-precision floating point number that is greater than zero. | |

Represents the square root of MinSingle. | |

Represents the natural logarithm of MinSingle. |

Copyright Â© 2004-2018,
Extreme Optimization. All rights reserved.

*Extreme Optimization,* *Complexity made simple*, *M#*, and *M
Sharp* are trademarks of ExoAnalytics Inc.

*Microsoft*, *Visual C#, Visual Basic, Visual Studio*, *Visual
Studio.NET*, and the *Optimized for Visual Studio* logo

are
registered trademarks of Microsoft Corporation.