# AreNotApproximatelyEqual

> Asserts that the values are approximately not equal.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine.Assertions](/engine/6000.0/script-reference/unityengine/assertions.md)
* **Assembly:** UnityEngine.CoreModule

## AreNotApproximatelyEqual(float, float)

Asserts that the values are approximately not equal.

```csharp
[Conditional("UNITY_ASSERTIONS")]
public static void AreNotApproximatelyEqual(float expected, float actual)
```

### Parameters

**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The assumed [Assert](/engine/6000.0/script-reference/unityengine/assertions/assert.md) value.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The exact [Assert](/engine/6000.0/script-reference/unityengine/assertions/assert.md) value.

### Remarks

An absolute error check is used for approximate equality check (|a-b| \< tolerance). Default tolerance is 0.00001f.

### Examples

```csharp
using UnityEngine;
using UnityEngine.Assertions;

public class AssertionExampleClass : MonoBehaviour
{
    Rigidbody rb;

    void Update()
    {
        // Make sure the rigidbody never stops.
        // AreNotApproximatelyEqual should be used for comparing floating point variables.
        // Unless specified, default error tolerance will be used.
        Assert.AreNotApproximatelyEqual(0.0f, rb.velocity.magnitude);
    }
}
```

## AreNotApproximatelyEqual(float, float, string)

Asserts that the values are approximately not equal.

```csharp
[Conditional("UNITY_ASSERTIONS")]
public static void AreNotApproximatelyEqual(float expected, float actual, string message)
```

### Parameters

**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The assumed [Assert](/engine/6000.0/script-reference/unityengine/assertions/assert.md) value.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The exact [Assert](/engine/6000.0/script-reference/unityengine/assertions/assert.md) value.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The string used to describe the [Assert](/engine/6000.0/script-reference/unityengine/assertions/assert.md).

### Remarks

An absolute error check is used for approximate equality check (|a-b| \< tolerance). Default tolerance is 0.00001f.

### Examples

```csharp
using UnityEngine;
using UnityEngine.Assertions;

public class AssertionExampleClass : MonoBehaviour
{
    Rigidbody rb;

    void Update()
    {
        // Make sure the rigidbody never stops.
        // AreNotApproximatelyEqual should be used for comparing floating point variables.
        // Unless specified, default error tolerance will be used.
        Assert.AreNotApproximatelyEqual(0.0f, rb.velocity.magnitude);
    }
}
```

## AreNotApproximatelyEqual(float, float, float)

Asserts that the values are approximately not equal.

```csharp
[Conditional("UNITY_ASSERTIONS")]
public static void AreNotApproximatelyEqual(float expected, float actual, float tolerance)
```

### Parameters

**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The assumed [Assert](/engine/6000.0/script-reference/unityengine/assertions/assert.md) value.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The exact [Assert](/engine/6000.0/script-reference/unityengine/assertions/assert.md) value.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): Tolerance of approximation.

### Remarks

An absolute error check is used for approximate equality check (|a-b| \< tolerance). Default tolerance is 0.00001f.

### Examples

```csharp
using UnityEngine;
using UnityEngine.Assertions;

public class AssertionExampleClass : MonoBehaviour
{
    Rigidbody rb;

    void Update()
    {
        // Make sure the rigidbody never stops.
        // AreNotApproximatelyEqual should be used for comparing floating point variables.
        // Unless specified, default error tolerance will be used.
        Assert.AreNotApproximatelyEqual(0.0f, rb.velocity.magnitude);
    }
}
```

## AreNotApproximatelyEqual(float, float, float, string)

Asserts that the values are approximately not equal.

```csharp
[Conditional("UNITY_ASSERTIONS")]
public static void AreNotApproximatelyEqual(float expected, float actual, float tolerance, string message)
```

### Parameters

**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The assumed [Assert](/engine/6000.0/script-reference/unityengine/assertions/assert.md) value.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The exact [Assert](/engine/6000.0/script-reference/unityengine/assertions/assert.md) value.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): Tolerance of approximation.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The string used to describe the [Assert](/engine/6000.0/script-reference/unityengine/assertions/assert.md).

### Remarks

An absolute error check is used for approximate equality check (|a-b| \< tolerance). Default tolerance is 0.00001f.

### Examples

```csharp
using UnityEngine;
using UnityEngine.Assertions;

public class AssertionExampleClass : MonoBehaviour
{
    Rigidbody rb;

    void Update()
    {
        // Make sure the rigidbody never stops.
        // AreNotApproximatelyEqual should be used for comparing floating point variables.
        // Unless specified, default error tolerance will be used.
        Assert.AreNotApproximatelyEqual(0.0f, rb.velocity.magnitude);
    }
}
```
