> For the complete documentation index, see [llms.txt](https://jmdash.gitbook.io/jmdash-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jmdash.gitbook.io/jmdash-docs/design-documents/initial-design-of-error-handling-document/the-error-tree/matherrors.md).

# MathErrors

This page contains all of the errors listed in the **MathError** category, these are related to the [`.jmath` library](/jmdash-docs/jmbasics/syntax101/calling-functions/other-libraries/file-read-and-write.md)

```
MathError;
    -> DivisionByZero;
        // Error when attempting to divide a number by zero
        // e.g. `mth.pwr{<< myInteger << 0};` (in cases where division is involved)

    -> NegativeSquareRoot;
        // Error when attempting to calculate the square root of a negative number
        // e.g. `mth.sqrt{<< -myInteger};`

    -> LogarithmOfNegative;
        // Error when attempting to compute the logarithm of a negative number
        // e.g. `mth.log{<< -myInteger};`

    -> LogarithmOfZero;
        // Error when attempting to compute the logarithm of zero
        // e.g. `mth.log{<< 0};`

    -> OverflowError;
        // Error when a mathematical operation results in a value too large to be represented
        // e.g. `mth.pwr{<< largeNumber << largeExponent};`

    -> UnderflowError;
        // Error when a mathematical operation results in a value too small to be represented
        // e.g. `mth.pwr{<< smallNumber << largeNegativeExponent};`

    -> NaNError;
        // Error when an operation results in a NaN (Not a Number) value where it is not expected
        // e.g. `mth.sqrt{<< myNaN};`

    -> InfinityError;
        // Error when an operation results in an infinite value where it is not expected
        // e.g. `mth.pwr{<< largeNumber << largeExponent};`

    -> InvalidOperation;
        // Error when attempting an undefined or invalid mathematical operation
        // e.g. `mth.log{<< "NotANumber"};` or `mth.pwr{<< "Text" << "Text"};`

    -> OutOfDomain;
        // Error when a function is called with a value outside its domain of definition
        // e.g. `mth.sqrt{<< -myInteger};` (negative value for square root)

    -> PrecisionLoss;
        // Warning or error when a mathematical operation results in significant loss of precision
        // e.g. `mth.pwr{<< veryLargeNumber << smallExponent};`

    -> ComplexResultError;
        // Error when an operation results in a complex number where only real numbers are expected
        // e.g. `mth.sqrt{<< -myInteger};` (should produce a complex result, but real numbers are expected)
```
