docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method AreApproximatelyEqual

    AreApproximatelyEqual(float, float)

    Assert that two float expressions are approximately equal to each other, within a default tolerance. Throws an exception if the assertion fails.

    Declaration
    [Conditional("UNITY_ASSERTIONS")]
    public static void AreApproximatelyEqual(float expected, float actual)
    Parameters
    Type Name Description
    float expected

    The expected value of the float expression.

    float actual

    The actual value of the float expression.

    AreApproximatelyEqual(float, float, string)

    Assert that two float expressions are approximately equal to each other, within a default tolerance. Throws an exception if the assertion fails.

    Declaration
    [Conditional("UNITY_ASSERTIONS")]
    public static void AreApproximatelyEqual(float expected, float actual, string message)
    Parameters
    Type Name Description
    float expected

    The expected value of the float expression.

    float actual

    The actual value of the float expression.

    string message

    If the assertion fails, this message will be logged.

    AreApproximatelyEqual(float, float, float)

    Assert that two float expressions are approximately equal to each other, within a caller-provided tolerance. Throws an exception if the assertion fails.

    Declaration
    [Conditional("UNITY_ASSERTIONS")]
    public static void AreApproximatelyEqual(float expected, float actual, float tolerance)
    Parameters
    Type Name Description
    float expected

    The expected value of the float expression.

    float actual

    The actual value of the float expression.

    float tolerance

    The maximum absolute difference between expected and actual for the two values to be considered equal.

    In This Article
    • AreApproximatelyEqual(float, float)
    • AreApproximatelyEqual(float, float, string)
    • AreApproximatelyEqual(float, float, float)
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)