{!See https://docs.google.com/document/d/1takg_GmIBBKKTj-GHZCwzxohpQz7Bhekivkk72kYMtE/edit for reference implementation of OneTrust, dataLayer and GTM} {!OneTrust Cookies Consent} {!OneTrust Cookies Consent end} {!dataLayer initialization push} {!dataLayer initialization push end} {!Google Tag Manager} {!Google Tag Manager end} Method AreFloatsEqual | Test Framework | 2.0.1-exp.2
docs.unity3d.com
"{0}"의 검색 결과

    목차 표시/숨기기

    Method AreFloatsEqual

    AreFloatsEqual(float, float, float)

    Relative epsilon comparison of two float values for equality. The relative error is the absolute error divided by the magnitude of the exact value.

    선언
    public static bool AreFloatsEqual(float expected, float actual, float epsilon)
    파라미터
    타입 이름 설명
    float expected

    The expected float value used to compare.

    float actual

    The actual float value to test.

    float epsilon

    Epsilon is the relative error to be used in relative epsilon comparison.

    반환
    타입 설명
    bool

    Returns true if the actual value is equivalent to the expected value.

    예
    [TestFixture]
    class UtilsTests
    {
        [Test]
        public void CheckThat_FloatsAreEqual()
        {
            float expected = 10e-8f;
            float actual = 0f;
            float allowedRelativeError = 10e-6f;
    
            Assert.That(Utils.AreFloatsEqual(expected, actual, allowedRelativeError), Is.True);
        }
    }
    문서 개요
    맨 위로
    Copyright © 2023 Unity Technologies — 상표 및 이용약관
    • 법률정보
    • 개인정보처리방침
    • 쿠키
    • 내 개인정보 판매 금지
    • Your Privacy Choices (Cookie Settings)