Example #1
0
    public static void Test()
    {
        Debug.Log("IsLittleEndian " + BitConverter.IsLittleEndian);
        Debug.Log(FixPointMathTest.ConvertFloatToBinStr(1f));
        Debug.Log(FixPointMathTest.ConvertFloatToBinStr(17.625f));

        Debug.Log(FixPointMath.SqrtOld(new FloatL(0.955d)));
        Debug.Log(Mathf.Sqrt(0.955f));
        Debug.Log(FixPointMath.Sqrt(new FloatL(0.955d)));
        Vector3L dir    = new Vector3L(-0.093d, -0.093d, 0.988d);
        FloatL   angle1 = Vector3L_Angle(Vector3L.forward, dir);
        float    angle2 = Vector3_Angle(Vector3.forward, dir.Convert());

        Debug.Log("angle1 " + angle1 + " angle2 " + angle2);

        Debug.Log("sin 10 " + Mathf.Sin(10 * Mathf.Deg2Rad));
        Debug.Log("sinL 10 " + FixPointMath.Sin(10 * Mathf.Deg2Rad));

        Debug.Log("cos 10 " + Mathf.Cos(10 * Mathf.Deg2Rad));
        Debug.Log("cosL 10 " + FixPointMath.Cos(10 * Mathf.Deg2Rad));

        Debug.Log("acos 0.1 " + Mathf.Acos(0.1f));
        Debug.Log("acosL 0.1 " + FixPointMath.Acos(0.1f));

        Debug.Log("atan2 3/2 " + Mathf.Atan2(3, 2));
        Debug.Log("atan2L 3/2 " + FixPointMath.Atan2(3, 2));

        Debug.Log("asin 0.6 " + Mathf.Asin(0.6f));
        Debug.Log("asinL 0.6 " + FixPointMath.Asin(0.6f));
    }