Package js.lang

Examples of js.lang.NativeIntArray


            // Initinity
            component = null;
            exponential = 0;
        } else if (i == b || e < MIN_EXP) {
            // zero or underflow
            component = new NativeIntArray(new int[] {0});
            exponential = 0;
        } else {
            // Determine trailing zeros.
            while (0 <= --b && value.charAt(b) == '0') {
            }
            exponential = e;
            component = new NativeIntArray(b - i + 1);

            // Convert string to array of digits (without leading and trailing zeros).
            int p = 0;

            while (i <= b) {
View Full Code Here


        if (augend.isZero()) {
            return this;
        }

        // copy each components
        NativeIntArray large = component.copy();
        NativeIntArray small = augend.component.copy();

        // equalize each exponent
        // candidate value for max exponent
        int exponent = exponential;

        // "large" compoent must be larger than "small" component
        if (large.length() < small.length()) {
            NativeIntArray swap = large;

            large = small;
            small = swap;
        }
View Full Code Here

            return this;
        }

        // copy each components
        int sign = this.sign;
        NativeIntArray large = component.copy();
        NativeIntArray small = subtrahend.component.copy();

        // equalize each exponent
        int largeExponent = exponential;
        int smallExponent = subtrahend.exponential;
        int maxExponent = largeExponent;
        int diff = largeExponent - smallExponent;

        boolean shouldSwap = false;

        if (diff != 0) {
            NativeIntArray min = null;

            if (0 < diff) {
                // "large" is larger than "small", so we should expand "small".
                min = small;
            } else {
                // "large" is smaller than "small", so we should expand "large".
                small = large;
                maxExponent = smallExponent;
                shouldSwap = true;

                // absolutize exponent diff size
                diff = -diff;
            }

            // prepend zero to equalize exponent
            for (int i = diff; 0 < i; --i) {
                min.unshift(0);
            }
        } else {
            // each exponents are equal, so we check its digit values
            int size = Math.min(large.length(), small.length());

            for (int i = 0; i < size; i++) {
                int largeValue = large.get(i);
                int smallValue = small.get(i);

                if (largeValue != smallValue) {
                    shouldSwap = largeValue < smallValue;
                    break;
                }
            }
        }

        // "large" compoent must be larger than "small" component
        if (shouldSwap) {
            NativeIntArray swap = large;

            large = small;
            small = swap;
            sign = -sign;
        }
View Full Code Here

TOP

Related Classes of js.lang.NativeIntArray

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.