FLASH ROUND ERROR

The Function Math.Round Has errors try Round Number 1.265
round in 1.26, when the correct answer its 1.27

Come again... Math.round returns an integer.
Math.round(1.265) will return
1.
Dave -
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/

Similar Messages

  • Flash is introducing insane rounding errors because of some arbitrary decision to round x and y coordinates to 0.05 increments

    The data type for x and y properties is a double precision floating-point Number, so why is it rounding off values?  Rounding is an unnecessary operation, and furthermore it's not saving any memory, because it just requires me to store a more precise value elsewhere, in addition to the lower-bit rounded value.
    This rounding causing unnecessary additional work when coding against these values, because I have to round other values as well to make sure there aren't discrepancies when transforming coordinates.
    So I was really surprised to discover that if I assign a value to a DisplayObject's x or y coordinates such as 10.3333333, and trace the value, it becomes 10.3.
    If I assign 10.666666, it becomes 10.65.  Apparently it's rounding everything to the nearest 20th of a unit.  So now, I have to override the x and y properties to store the Number-type value, once again as a Number-type, which is not rounded.
    Flash's arbitrary rounding of coordinates is causing erratic rounding errors when performing coordinate system transformations using localToGlobal and globalToLocal to find the composite scale of an object on the stage.
    For example, suppose an object was laid out to occupy one third of the display, and it's width ends up being 200.3333333.  One calculation of my docking framework involves obtaining the orthagonal bounding box of the child by transforming its corner points into stage coordinates using localToGlobal, which accounts for things like scaling and rotation.  So despite everything having a scale of 1, and having zero rotation, you'd still end up with a rectangle with a width of 200.3 instead of the expected 200.3333333 in stage coordinates.  So it would appear as though the composite scale is slightly smaller than 1, since 200.3 / 200.333333 is 0.99983361081528.  But the composite scale is in fact 1, we just don't know that because Flash unexpectedly rounded some coordinates to an arbitrary 1/20 unit.
    No game engine in existence does that with its transformation matrices, because it's retarded to round so early, and then allow those rounding errors to accumulate through a display hierarchy via functions like localToGlobal.
    This rounding is causing jittering by a pixel or so when animating a drop down panel in my my docking framework, because it's constantly correcting for unexpected anomalies in the scaling factor on each frame.  Despite the parent container having a constant fixed width, the child object, once its corner coordinates are passed through localToGlobal, end up reporting rounded widths, which ultimately leads to a series such as the following:
    dockedChild.width: 538.3842482614723, parent.width: 558.3412118444024
    dockedChild.width: 538.3754595467979, parent.width: 558.3412118444024
    dockedChild.width: 538.3666709755926, parent.width: 558.3412118444024
    dockedChild.width: 538.3578825478539, parent.width: 558.3412118444024
    dockedChild.width: 538.3490942635798, parent.width: 558.3412118444024
    dockedChild.width: 538.3903098666023, parent.width: 558.3412118444024
    dockedChild.width: 538.3815210529766, parent.width: 558.3412118444024
    dockedChild.width: 538.3727323828218, parent.width: 558.3412118444024
    dockedChild.width: 538.3639438561353, parent.width: 558.3412118444024
    dockedChild.width: 538.3551554729148, parent.width: 558.3412118444024
    dockedChild.width: 538.346367233158, parent.width: 558.3412118444024
    dockedChild.width: 538.3875826274011, parent.width: 558.3412118444024
    dockedChild.width: 538.3787938582956, parent.width: 558.3412118444024
    dockedChild.width: 538.37000523266, parent.width: 558.3412118444024
    dockedChild.width: 538.3612167504922, parent.width: 558.3412118444024
    dockedChild.width: 538.3524284117897, parent.width: 558.3412118444024
    dockedChild.width: 538.3436402165502, parent.width: 558.3412118444024
    dockedChild.width: 538.384855402015, parent.width: 558.3412118444024
    dockedChild.width: 538.3760666774294, parent.width: 558.3412118444024
    dockedChild.width: 538.3672780963132, parent.width: 558.3412118444024
    dockedChild.width: 538.3584896586638, parent.width: 558.3412118444024
    dockedChild.width: 538.349701364479, parent.width: 558.3412118444024
    dockedChild.width: 538.3909170139807, parent.width: 558.3412118444024
    Is there any way to turn off this rounding to 0.05 units?
    To override the x and y values to have greater precision, I must do the following:
    public class Control extends MovieClip
        public function Control()
            super(); //Flash performs timeline/graphics initialization here, which means after this call, the object may have non-zero x and y values
            _x = super.x; //acquire them immediately, so if we try to set x or y to zero, the 'if (_x != value)' check does not think it's already positioned at zero and ignore the call
            _y = super.y;
        private var _x:Number;
        private var _y:Number;
        override public function get x():Number { return _x; } //return precise value, rather than rounded super.x value
        override public function set x( value:Number ):void
            if (_x != value) //ensure value is actually changing before performing work
                _x = value; //store precise value in private variable
                super.x = value; //DisplayObject will round value to nearest 0.05
                if (stage != null)
                    stage.invalidate(); //ensure RENDER event is dispatched to re-render anything that may need to account for a repositioned object
        override public function get y():Number { return _y; } //return precise value, rather than rounded super.y value
        override public function set y( value:Number ):void
                if (_y != value) //ensure value is actually changing before performing work
                _y = value; //store precise value in private variable
                super.y = value; //DisplayObject will round value to nearest 0.05
                if (stage != null)
                        stage.invalidate(); //ensure RENDER event is dispatched to re-render anything that may need to account for a repositioned object    }
    Most importantly, you must initialize the _x and _y values to super.x and super.y in the constructor immediately after a call to super(), in order to acquire any non-zero values that the object instance may have been initialized with on the timeline.
    I just cannot fathom why they didn't leave the x and y coordinates as-is, instead of rounding them, when it causes so many problems and complications, and requires overriding not only x and y, but functions like localToGlobal/globalToLocal/getRect.
    This has been an issue for a while:
    flash - AS3 x and y property precision - Stack Overflow specifically: flash - AS3 x and y property precision - Stack Overflow
    http://www.actionscript.org/forums/showthread.php3?t=96510
    Problems with Sub-pixel Coordinate Movement
    In fact, that last link says: "
    Running the code:
    The motion is still jerky; and
    The distance between the two squares diverges
    However, the one benefit is that the distance does not diverge by more than 1 pixel."
    That's precisely what I saw happening in my own code, as you can see from the series of widths I posted above, which seem to fluctuate randomly between 358.34 and 358.39.

    Actually, there is a way.
    If you simply activate the 3D transformation by setting z to zero, the matrix3D replaces the matrix and concatatedMatrix properties of the DisplayObject's transform object, and suddenly x and y values maintain a precision higher than a twip.  It's not quite the double-precision value of the Number type, however, and looks more like a single-precision 32-bit floating point value.
    For example, if you run the following code:
    var mc:Sprite = new Sprite();
    mc.x = 200.0 + (1/3); //assign high precision value to x
    trace(mc.x); //traces 200.3 (rounded)
    mc.z = 0; //activate 3D matrix
    mc.x = 200.0 + (1/3);
    trace(mc.x); //traces 200.33333740234374 (still rounded, but accurate to 5 decimal places)
    Based on the traced output, it's clear that it is possible to force the DisplayObject to get and set higher precision values for x and y properties, without any modifications to the underlying classes.  However, I'm not happy with that solution for 2 reasons.  First, it activates stage 3D and introduces graphical glitches and unnecessary bitmap caching.  Second, it's still not "Number" precision; it's something less than that.
    Instead, I was able to successfully work around the issue by altering the overrides for properties x, y, scaleX, scaleY, and methods localToGlobal, globalToLocal, and getRect to use privately maintained values.  I was already using privately maintained width and height values in order to decouple the size from the scaling factors.  No need to override getBounds, since it accounts for stroke widths and will be non-exact anyway.
    The consistent, high precision values are vital, and they increased the performance of my layout framework, because it's actually able to prevent unnecessary assignments to x, y, width, and height when the values aren't actually changing.  #beginrant: Such detection is impossible when Flash internally rounds everything, because if you try to keep something at, for example, 1/3 of the screen, it will always think you're trying to assign a high precision value of 200.33333 over a less precise value of 200.3 as I had previously described.  Alternatively, you'd have to pre-round any value you try to assign, which is more work than it's worth.  It's sort of terrible that Flash rounds property values as it does, because the value you assign can never be read back the same.  That's generally not how numerical properties should work when assigning values of the same data type and precision.  #endrant
    In particular, two optimizations were made in the getRect override.  If the target coordinate system is null or "this", then it simply returns new Rectangle( 0, 0, _width, _height ), and more importantly, if the target coordinate system is "parent" (which is the case 99% of the time) and rotation is zero and scale is 1 (also the case 99% of the time for GUI elements), then it simply returns new Rectangle( _x, _y, _width, _height ), which is the internal, high-precision values for x, y, width, and height (resemblance to AS2 properties is purely coincidental; this is AS3 code).  That allows me to skip the following code path 99% of the time, which would otherwise return the orthagonal bounding box of the element at any rotation in any coordinate system:
    //These instance variables are used to accelerate calculations, see comments.
    //Upper left is always an empty point, and these variables store upper right, lower right, and lower left corner points.
    protected var p_UR:Point; //DO NOT ALTER p_UR.y; LEAVE AT ZERO ALWAYS
    protected var p_LR:Point; //Lower right corner: x = width, y = height
    protected var p_LL:Point; //DO NOT ALTER p_LL.x; LEAVE AT ZERO ALWAYS
    //Returns the orthogonal bounding rectangle of the object in the specified target coordinate system
    //based on its own internal height and width (actual contentRect may be larger).
    //getContentRect function was added to replace the original functionality of this method
    override public function getRect( targetCoordinateSpace:DisplayObject ):Rectangle
        switch (_scaleMode) //GUIControl allows decoupling of size and scale
            case SCALE_NOSYNC_SIZE:
                if (targetCoordinateSpace == null || targetCoordinateSpace == this)
                    return new Rectangle( 0, 0, _width, _height );
                //UPDATE: Created this optimization to ensure rounding errors introduced by
                //Flash's tendency to round x and y coordinates to twips are not introduced
                //by localToGlobal/globalToLocal calls, so they are avoided if possible.
                if (targetCoordinateSpace == parent && rotation == 0 && scaleX == 1 && scaleY == 1)
                    return new Rectangle( _x, _y, _width, _height );
                p_UR.x = _width; //note the p_UR.y is always zero
                p_LR.x = _width;
                p_LR.y = _height;
                p_LL.y = _height; //note the p_LL.x is always zero
                break;
            case SCALE_SYNC_SIZE:
                var contentRect:Rectangle = getContentRect( true ); //must use unscaled points when performing local/global transforms, since this object is scaled
                p_UR.x = contentRect.right; //note the p_UR.y is always zero
                p_LR.x = contentRect.right;
                p_LR.y = contentRect.bottom;
                p_LL.y = contentRect.bottom; //note the p_LL.x is always zero
                break;
        return calcOrthogonalBoundingBox(
            targetCoordinateSpace.globalToLocal( localToGlobal( EMPTY_POINT ) ),
            targetCoordinateSpace.globalToLocal( localToGlobal( p_UR ) ),
            targetCoordinateSpace.globalToLocal( localToGlobal( p_LR ) ),
            targetCoordinateSpace.globalToLocal( localToGlobal( p_LL ) )
    protected function calcOrthogonalBoundingBox( p0:Point, p1:Point, p2:Point, p3:Point ):Rectangle
        //Assuming no rotation, points 0 and 3 are most likely to be min_x.  This optimization minimizes the likely number of assignments.
        //Similar optimizations are in place for max_x, min_y, and max_y, all patterns are ordered 0,1,2,3... starting with the two most likely candidates in the sequence.
        var min_x:Number = p3.x;
        if (p0.x < min_x) min_x = p0.x;
        if (p1.x < min_x) min_x = p1.x;
        if (p2.x < min_x) min_x = p2.x;
        var max_x:Number = p1.x;
        if (p2.x > max_x) max_x = p2.x;
        if (p3.x > max_x) max_x = p3.x;
        if (p0.x > max_x) max_x = p0.x;
        var min_y:Number = p0.y;
        if (p1.y < min_y) min_y = p1.y;
        if (p2.y < min_y) min_y = p2.y;
        if (p3.y < min_y) min_y = p3.y;
        var max_y:Number = p2.y;
        if (p3.y > max_y) max_y = p3.y;
        if (p0.y > max_y) max_y = p0.y;
        if (p1.y > max_y) max_y = p1.y;
        return new Rectangle( min_x, min_y, max_x - min_x, max_y - min_y );
    In this framework, particularly in SCALE_NOSYNC_SIZE mode (the default), the width and height are assigned and internally maintained, independently of the scaleX and scaleY values.  The internally maintained values are used for performing layout and drawing operations such as backgrounds and borders.  In the extremely rare occasion where the actual content needs to be measured, I just use getBounds, such as in the constructor when initializing the "original" size of the clip's content, if it has timeline content, or possibly bitmap methods for masked objects.
    These changes have all increased the performance of my framework by an order of magnitude and have virtually eliminated 3rd layout passes, so I'm happy with it.  I still wish the Flash runtime would be updated to simply stop rounding these values.

  • When i download any file it start in a second but when i pause the downloading file & after some time when i open it amessage flash 'download error' source file could not be read please try again later or contact the server administrator.

    when i download any file it works frequently and downloading start in a second but when i pause the downloading file & after some time when i open it,The downloading not start proper and after some time a message flash 'download error' source file could not be read please try again later or contact the server administrator.

    I downloaded the Microsoft Autoruns package and ran it.  There are no programs in the LSA Providers tab, and Apple's Bonjour is the only program in the Winsock Providers tab.  I also did the "netsh winsock reset" and rebooted.  It didn't fix the problem.  Any more ideas?

  • Chart Flash Chart error: ORA-20001: Print Chart Data: Flash Chart error: OR

    Hi,
    if the query where my resource gantt chart is based on returns more the 107 rows, i will get the following error:
    chart Flash Chart error: ORA-20001: Print Chart Data: Flash Chart error: ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    If i reduce the number of results, the chart is working fine.
    Max rows attribute of the series is adjusted to 4000
    Any idea?
    Thank you

    Thank you,
    I have tried it, but it I am not able to make it work, here you find a snip of my pagesource:
    <anygantt> <resource_chart>
    <resources>
    <resource id="341" name="Drexler, Franz" />
    <resource id="5" name="Gross, Johannes-Ludwig" />
    <resource id="8" name="Pecherski, Andrzej" />
    <resource id="131" name="Steinmetz, Raphael" />
    <resource id="191" name="Jenks, Raymond" />
    <resource id="33" name="Alhambra, Roda Marie" />
    <resource id="31" name="Daminescu, Adrian" />
    </resources>
    <periods>
    <period resource_id= "31" start="24-DEC-12 12.00.00.000000000 AM" end="31-DEC-12 12.00.00.000000000 AM" style="green" />
    <period resource_id= "8" start="27-DEC-12 12.00.00.000000000 AM" end="28-DEC-12 12.00.00.000000000 AM" style="green" />
    <period resource_id= "8" start="02-JAN-13 12.00.00.000000000 AM" end="04-JAN-13 12.00.00.000000000 AM" style="green" />
    <period resource_id= "131" start="26-JAN-13 12.00.00.000000000 AM" end="04-FEB-13 12.00.00.000000000 AM" style="green" />
    <period resource_id= "131" start="01-JAN-13 12.00.00.000000000 AM" end="06-JAN-13 12.00.00.000000000 AM" style="green" />
    <period resource_id= "131" start="22-DEC-12 12.00.00.000000000 AM" end="31-DEC-12 12.00.00.000000000 AM" style="green" />
    <period resource_id= "5" start="21-DEC-12 12.00.00.000000000 AM" end="31-DEC-12 12.00.00.000000000 AM" style="green" />
    <period resource_id= "31" start="07-JAN-13 12.00.00.000000000 AM" end="11-JAN-13 12.00.00.000000000 AM" style="green" />
    <period resource_id= "8" start="21-DEC-12 12.00.00.000000000 AM" end="21-DEC-12 12.00.00.000000000 AM" style="blue" />
    <period resource_id= "33" start="26-DEC-12 12.00.00.000000000 AM" end="28-DEC-12 12.00.00.000000000 AM" style="green" />
    <period resource_id= "33" start="25-FEB-13 12.00.00.000000000 AM" end="25-FEB-13 12.00.00.000000000 AM" style="red" />
    <period resource_id= "33" start="28-MAR-13 12.00.00.000000000 AM" end="29-MAR-13 12.00.00.000000000 AM" style="red" />
    <period resource_id= "33" start="09-APR-13 12.00.00.000000000 AM" end="09-APR-13 12.00.00.000000000 AM" style="red" />
    <period resource_id= "33" start="01-MAY-13 12.00.00.000000000 AM" end="01-MAY-13 12.00.00.000000000 AM" style="red" />
    <period resource_id= "33" start="12-JUN-13 12.00.00.000000000 AM" end="12-JUN-13 12.00.00.000000000 AM" style="red" />
    <period resource_id= "33" start="26-AUG-13 12.00.00.000000000 AM" end="26-AUG-13 12.00.00.000000000 AM" style="red" />
    <period resource_id= "33" start="01-NOV-13 12.00.00.000000000 AM" end="01-NOV-13 12.00.00.000000000 AM" style="red" />
    <period resource_id= "33" start="30-DEC-13 12.00.00.000000000 AM" end="30-DEC-13 12.00.00.000000000 AM" style="red" />
    <period resource_id= "33" start="31-DEC-13 12.00.00.000000000 AM" end="31-DEC-13 12.00.00.000000000 AM" style="red" />
    <period resource_id= "33" start="21-AUG-13 12.00.00.000000000 AM" end="21-AUG-13 12.00.00.000000000 AM" style="red" />
    <period resource_id= "33" start="15-OCT-13 12.00.00.000000000 AM" end="15-OCT-13 12.00.00.000000000 AM" style="red" />
    <period resource_id= "8" start="23-DEC-13 12.00.00.000000000 AM" end="23-DEC-13 12.00.00.000000000 AM" style="green" />
    <period resource_id= "8" start="27-DEC-13 12.00.00.000000000 AM" end="27-DEC-13 12.00.00.000000000 AM" style="green" />
    <period resource_id= "8" start="30-DEC-13 12.00.00.000000000 AM" end="30-DEC-13 12.00.00.000000000 AM" style="green" />
    <period resource_id= "8" start="02-JAN-14 12.00.00.000000000 AM" end="03-JAN-14 12.00.00.000000000 AM" style="green" />
    <period resource_id= "5" start="31-MAY-13 12.00.00.000000000 AM" end="31-MAY-13 12.00.00.000000000 AM" style="green" />
    <period resource_id= "8" start="21-MAY-13 12.00.00.000000000 AM" end="24-MAY-13 12.00.00.000000000 AM" style="green" />
    <period resource_id= "8" start="27-MAY-13 12.00.00.000000000 AM" end="29-MAY-13 12.00.00.000000000 AM" style="green" />
    <period resource_id= "8" start="31-MAY-13 12.00.00.000000000 AM" end="31-MAY-13 12.00.00.000000000 AM" style="green" />
    <period resource_id= "8" start="02-APR-13 12.00.00.000000000 AM" end="05-APR-13 12.00.00.000000000 AM" style="green" />
    <period resource_id= "5" start="11-FEB-13 12.00.00.000000000 AM" end="11-FEB-13 12.00.00.000000000 AM" style="green" />
    <period resource_id= "131" start="29-JUN-13 12.00.00.000000000 AM" end="14-JUL-13 12.00.00.000000000 AM" style="green" />
    <period resource_id= "131" start="16-AUG-13 12.00.00.000000000 AM" end="16-AUG-13 12.00.00.000000000 AM" style="blue" />
    <period resource_id= "8" start="26-AUG-13 12.00.00.000000000 AM" end="30-AUG-13 12.00.00.000000000 AM" style="green" />
    <period resource_id= "8" start="02-SEP-13 12.00.00.000000000 AM" end="06-SEP-13 12.00.00.000000000 AM" style="green" />
    <period resource_id= "8" start="15-FEB-13 12.00.00.000000000 AM" end="15-FEB-13 12.00.00.000000000 AM" style="blue" />
    <period resource_id= "5" start="13-MAR-13 12.00.00.000000000 AM" end="13-MAR-13 12.00.00.000000000 AM" style="green" />
    <period resource_id= "8" start="22-MAR-13 12.00.00.000000000 AM" end="22-MAR-13 12.00.00.000000000 AM" style="blue" />
    <period resource_id= "33" start="20-MAR-13 12.00.00.000000000 AM" end="20-MAR-13 12.00.00.000000000 AM" style="green" />
    <period resource_id= "5" start="08-APR-13 12.00.00.000000000 AM" end="08-APR-13 12.00.00.000000000 AM" style="blue" />
    <period resource_id= "31" start="05-APR-13 12.00.00.000000000 AM" end="05-APR-13 12.00.00.000000000 AM" style="green" />
    <period resource_id= "31" start="02-MAY-13 12.00.00.000000000 AM" end="03-MAY-13 12.00.00.000000000 AM" style="green" />
    <period resource_id= "341" start="01-JUL-13 12.00.00.000000000 AM" end="22-JUL-13 12.00.00.000000000 AM" style="green" />
    <period resource_id= "341" start="09-MAY-13 12.00.00.000000000 AM" end="12-MAY-13 12.00.00.000000000 AM" style="green" />
    <period resource_id= "191" start="04-JUL-13 12.00.00.000000000 AM" end="06-JUL-13 12.00.00.000000000 AM" style="red" />
    <period resource_id= "31" start="15-JUN-13 12.00.00.000000000 AM" end="30-JUN-13 12.00.00.000000000 AM" style="green" />
    </periods>
    </resource_chart></anygantt>
    </textarea>
    <div id="chartDiv"></div>
    <script type="text/javascript" language="javascript">
    /* Set default swf path */
    AnyChart.swfFile = 'i/flashchart/anychart_6/swf/OracleAnyChart.swf';
    /* Create new gantt chart */
    var chart = new AnyChart();
    chart.width="2500";
    chart.height="2500";
    /* Get string data from text area */
    var data = document.getElementById('rowData').value.toString();
    /* Set data */
    chart.setData(data);
    /* Write chart to "chart" div */
    chart.write("chartDiv");
    </script>
    do you have a idea whats wrong? thank you

  • Flash chart - Error - No chart data available

    Hi
    I have a Flash chart that shows the message "Error - No chart data available" (not the no data found message).
    If I run its query in sql*plus (using the same parameters) I get 4 rows (with url, label and value columns). I am clueless about how to start investigating this as the chart does not show any other information... Any advice?
    What does that message mean? Obviously is something different from no data found?
    Thanks
    Luis

    Hi Marco
    Thanks for the reply. I did what you said and found out the problem:
    chart Flash Chart error: ORA-20001: get_data error: ORA-20001: Fetch error: ORA-01843: not a valid monthThis was caused because I used the following construction:
    where date_from = :p5_date_fromIf this was a report, this would run fine as I set the date format mask using a application level process. However, as Flash charts use separate database connections, they ignore that setting (btw I posted a message about this problem).
    I fixed it hardcoding a format mask in my SQL. Not nice but it works!
    Thanks
    Luis

  • I am facing issue when opening flash files in Flash CC. (error:- This file was created with a later release of Flash Professional and might contain new features that would be lost when saved in the current format.)

    I am facing issue when opening flash files in Flash CC. (error:- This file was created with a later release of Flash Professional and might contain new features that would be lost when saved in the current format.)

    Wow. Okay...
    I'll let the real veterans in this forum tackle your issues one after the other. But, I can tell you, all will be well.
    My only comment would be re: your computer specs:
    BJReis wrote:
    .  This may be due to somewhat older equipment:
    GHz Intel Core Duo MacBook Pro with a 4GB memory computer with Ddr3 running OSX 10.8.4
    To be completely honest, FCPX is a RAM hog. It just is. But, RAM is relatively cheap, and the pay-off is good.
    4GB is right on the edge, IMHO. 16G is ideal.
    I wish you luck, hang in there, and standby for more help.

  • Due to flash drive error on MBA my drive was wiped yesterday and OS re installed.  How to I get my bookmarks still on my iPhone back onto the mba

    Due to flash drive error on MBA my drive was wiped yesterday and OS re installed.  How to I get my bookmarks still on my iPhone back onto the mba

    Hi Nathanbeyondme!
    I have an article that can help you with that question:
    OS X Mountain Lion: Store your content in iCloud
    http://support.apple.com/kb/PH11421
    Safari bookmarks and tabs
    iCloud keeps your bookmarks and Reading List the same in Safari on your Mac, iPhone, iPad, and iPod touch. On your Mac, Safari also uses iCloud to let you open tabs that are open on your other devices. You set up the Safari service in iCloud preferences.
    If you are having issues with syncing these bookmarks, you will want to reference the following article:
    iCloud: Troubleshooting iCloud Bookmarks and Reading List
    http://support.apple.com/kb/ts4001
    Thanks for being a part of the Apple Support Communities!
    Regards,
    Braden

  • Handle rounding error

    hello,
    I understand that rounding errors exist and I need help determining the best way to handle them.  The particular situation I am dealing with relates to finding the equation of a line and comparing the calculated values to a data set.  
    The big picture:  I have a data set that looks generally exponential with sharp peaks along the curve.  The exponential part is background noise that I want to eliminate. After trying various methods, I've determined that getting a convex hull is the best method of eliminating the background noise.  The convex hull is found by finding a line through point A and point B of the data and determining if all of the data is above (greater than) the line (similar to a tangent line).  Once a point B is found which satisfies the condition, point B becomes the new point A and a new point B is looked for.  
    I compare the data set to the points that create the line.  The X values of the data set and the line are the same integer values.  The Y values of the data set are DBL.  I have attached a VI demonstrating the simple calculations I am doing to find the Y values along the line.  It is simply the (y1-y0)/(x1-x0) to get the slope and using the slope to find the y-intercept (b = y0-m*x0).  I then use the slope and y-intercept to calculate the Y values along the line.  I subtract the line Y values from the data set Y values and check if they are all positive.  If they are, then I can conclude that all the points are above the line and the point B (x1,y1) is kept as part of the convex hull.  
    The problem is that rounding error is causing "false negatives."  In other words, the rounding error is causing the actual and calculated (through equation of line) y1 to be different.  Since (x1, y1) is a data set point that defined the line it should be equal to the calculated (x1, y1), but the rounding error is not allowing that.  
    Currently, I am adding a very small (1.5E-12) constant to the data set point to account for the error and prevent false negatives (which would be the existence of a negative difference, when it should be 0).  However, this small number is not always sufficient.
    How can I find the maximum error, so that I can add the error to the data set point and therefore always prevent false negatives?  
    Thanks!
    Kristen
    Attachments:
    Rounding Error Example.vi ‏13 KB

    Hi Lynn,
    Thanks for your help.
    I have attached a text file with example data set.  The range is 0-6000  (look around x=187 and x=300 for max).   There is a middle region (220- 260ish) that is irrelevant, otherwise, there are eight peaks in total, four peaks on each side, which are symmetric from the center.  I am doing the convex hull on each half of the data.   The data set actually begins as an x-ray diffraction image (irrelevant region is the backstop preventing the x-ray from saturating the detector so only the diffraction is captured) of which I take an ROI and sum down the columns.  The result is this data which is pixel location and summed pixel values.  (Yes, I know the x values in the text file are not integers- this is because some of the end points and the irrelevant area is extracted out and the ramp function is used to create new x values even spaced between the new beginning and end of the data set.  This part of the code is inherited and I need to check with the programmer why this method was used) 
    Previously, I tried doing a curve fit of the whole data set (background not subtracted) with the background described as h0+h1*exp(-h2*(x-r))+h3*exp(-h4*(x-r)) and the peaks described as a convolution of a gaussian and lorentzian peak: abs(a0)*((1/(1+f^2))*exp(-((x-(r+d0))/w)^2)+(1-(1/(1+f^2)))/(1+((x-(r+d0))/w)^2))
    where
    r is the theoretical median of the data (point about which the image is horizontally symmetric)
    a0 is the amplitude of the peak
    d0 is the distance from symmetric center to the center of the peak
    w is the full width half max of the peak
    f is a factor to determine if the peak is more Gaussian or Lorentzian 
    I added the background model with the peak models (subtract d0 from r for the symmetrically equivalent peak) and used the Non-linear Curve Fit VI to fit the equation.  The results were decent, but the convex hull -> subtract background -> peak fit method seemed to be fitting the peaks better (correlation .999 vs .99), which is the important part.
    Thoughts?
    Kristen 
    Attachments:
    ConvexHullTest Example Data.txt ‏7 KB

  • Rounding error in BAPI_PO_CREATE1 Function module

    Hi experts ,
    In my project there are two steps behind PO creation 1-> Authorization of po creation And 2-> PO creation.
    In authorization a logic in smart form calculates the amount for which the po is to be created and then goes go 2 nd step.
    before creating po gross discount percentage is calculated the same way calculated in step1.
    But at the end total amount in smartform and total amount of po created is differing by max of .01 to 0.1.
    Unfortunetely the Z logic in the smartforms is caculation the creec value but standard BAPI BAPI_PO_CREATE1 is creating some rounding errors .
    Please suggest some thing for this problem.
    Thanks in advance
    Shoaibmemon

    Hi Md shoaib Memon,
    there is another thread with the same issue.
    http://scn.sap.com/thread/922418
    Solution:
    Set the following flag
    poitem-no_rounding = 'X'.
    poitemx-no_rounding = 'X'.
    Best regards,
    Ademir

  • Floating point rounding error

    I've been working on an egyptian fraction program and for some reason I cant seem to figure out a way to fix this rounding error. An egyptian fraction is a fraction that can be expressed as a sum of fractions eg. 3/4 = 1/2 + 1/4. For some reason on certain fractions it rounds up and skips the correct fraction to subtract. When I run 2/7 its supposed to equal 1/4 + 1/28, but gives me 1/4 + 1/29 and decides to round. This is my code for the problem.
    public class EgyptianFraction{
        private static double epsilon = 1.0e-7;
        public static void main(String args[]){
            greedySearch(2.0/7.0);
        public static void greedySearch(double fraction){
            for(int i = 2; fraction > epsilon; i++){
                if(fraction - (1.0/i) >= 0){
                    fraction -= (1.0/i);
    //*****Output******
    //0.0357142857142857 - 0.03571428571428571 = -1.3877787807814457E-17
    }When I print out all of the math involved it says that it gives the output above. They are fairly close but for some reason it makes the 1/28 bigger then the current fraction. The program should subtract 1/28 and then the fraction should be close enough to 0 and end. Is there any way you guys can think of to fix this problem?

    You have given the error as epsilon, so you can't expect `fraction - 1.0/i >= 0` to give an exact answer.
    Given your error is +/- epsilon, this expression should be
    fraction - 1.0/i >= epsilon || fraction - 1.0/i >= -epsilon
    or just
    fraction - 1.0/i >= -epsilon
    If you change this you get 1/4 + 1/28 as the answer,

  • Flash Builder Error Compiling Ipad Actionscript Mobile Project.

    I just bought a brand new ipad for testing. I am using flash buider 4.7 to make an actionscript mobile project. I created an app ID, provisioning profile, and certificate. I have done this before in flash professional so it wasn't too bad. However, when I run or debug  even a blank application I get this error in flash builder:
    Error occurred while packaging the application:
    'Launching AppName' has encountered a problem.
    Error occurred while packaging the application.
    Exception in thread "main" java.lang.Error: Unable to find llvm JNI lib in:
    /Applications/Adobe Flash Builder 4.7/eclipse/plugins/com.adobe.flash.compiler_4.7.0.349722/AIRSDK/lib/adt.jar/Darwin
    /Applications/Adobe Flash Builder 4.7/eclipse/plugins/com.adobe.flash.compiler_4.7.0.349722/AIRSDK/lib/aot/lib/x64
    /Applications/Adobe Flash Builder 4.7/eclipse/plugins/com.adobe.flash.compiler_4.7.0.349722/AIRSDK/lib/adt.jar
    /Applications/Adobe Flash Builder 4.7/eclipse/plugins/com.adobe.flash.compiler_4.7.0.349722/AIRSDK/lib
                    at adobe.abc.LLVMEmitter.loadJNI(LLVMEmitter.java:582)
                    at adobe.abc.LLVMEmitter.<clinit>(LLVMEmitter.java:596)
                    at com.adobe.air.ipa.AOTCompiler.generateExtensionsGlue(AOTCompiler.java:419)
                    at com.adobe.air.ipa.AOTCompiler.generateMachineBinaries(AOTCompiler.java:1790)
                    at com.adobe.air.ipa.IPAOutputStream.createIosBinary(IPAOutputStream.java:378)
                    at com.adobe.air.ipa.IPAOutputStream.finalizeSig(IPAOutputStream.java:762)
                    at com.adobe.air.ApplicationPackager.createPackage(ApplicationPackager.java:91)
                    at com.adobe.air.ipa.IPAPackager.createPackage(IPAPackager.java:245)
                    at com.adobe.air.ADT.parseArgsAndGo(ADT.java:571)
                    at com.adobe.air.ADT.run(ADT.java:419)
                    at com.adobe.air.ADT.main(ADT.java:469)
    I have no idea where to even start in trying to figure out what could be the problem. I am pretty sure the itunes developer information is correct. Are there any kinds of drivers or developer modes that I need to set for a new iPad?
    Thanks!

    Thanks Shongrunden for your reply.
    Yes, you are right. If I make a new Flex mobile project, I did not see the issue.
    But that did not fully answer my question, my concern is: can an actionscript project use spark components?
    Thanks.

  • Tables and Rounding Errors on Board Game Gui

    Hello,
    So I am in a software development class , and my team and I are developing a software version of a board game that uses numbered tiles placed on a board in a somewhat scrabble-esque way.
    Here is a picture of the game board:
    [http://img90.imageshack.us/img90/1052/untitledqv3.png|http://img90.imageshack.us/img90/1052/untitledqv3.png]
    Currently, a problem that we are working on is that as the tiles get further and further away from the center of the board, they are displayed further and further askew from the board lines. I have another picture to demonstrate what I'm talking about more clearly.
    [http://img225.imageshack.us/img225/4605/untitled2nn0.png|http://img225.imageshack.us/img225/4605/untitled2nn0.png]
    As the tiles get further away from the center, they are displayed more askew.
    We think that this happens because we are using a gridbag layout to add tile objects to, which displays the tiles in a certain spacing and orientation, and then we draw the board ourselves. When we draw the board, we get rounding errors inherent in the use of ints, and the lines become a bit off, with the problem getting worse as it gets further and further away from the center.
    Here is the code that we use to initialize the layout and add the tiles to it:
         //set the layout
    setLayout(new GridLayout(7, 7, 7, 7));
    //initialize the array with the references to all the tiles that we are going to add
    //to the layout
    squares = new SquareView[7][7];
    for (int i = 0; i < 7; i++) {
         for (int j = 0; j < 7; j++) {
              //create the tile, put a reference to it in the array
              squares[i][j] = new SquareView(boardModel.getSquare(new Point(j, i)), listener, handler);
              //add the tile to the layout
              add(squares[i][j]);
    }And here is the code that we are using to draw the lines for the board:
    GridLayout layout = (GridLayout) getLayout();
    //getting the dimensions of the board
    int rows = layout.getRows();
    int columns = layout.getColumns();
    int width = (getWidth() / columns);
    int height = (getHeight() / rows);
    g2.drawImage(backgroundImage, 0, 0, getWidth(), getHeight(), null);
    for (int i = 0; i < 8; i++) {
         // Vertical lines
         g2.drawLine(i * width, 0, i * width, rows * height);
         // Horizontal lines
         g2.drawLine(0, i * height, columns * width, i * height);
    }I think that our problems come from the innacuracy of ints, but if there is some addition or subtraction trick that we could pull, then let me know.
    Also, I was sort of looking into tables, and I was wondering if maybe we could use tables to do this, and have Java do our resizing for us.

    j.law wrote:
    We think that this happens because we are using a gridbag layout to add tile objects to, From the snippets of code, it's looking as though you're using GridLayout. But that's OK as GridLayout should work fine here.
    GridLayout layout = (GridLayout) getLayout();
    //getting the dimensions of the board
    int rows = layout.getRows();
    int columns = layout.getColumns();
    int width = (getWidth() / columns);
    int height = (getHeight() / rows);
    g2.drawImage(backgroundImage, 0, 0, getWidth(), getHeight(), null);
    for (int i = 0; i < 8; i++) {
         // Vertical lines
         g2.drawLine(i * width, 0, i * width, rows * height);
         // Horizontal lines
         g2.drawLine(0, i * height, columns * width, i * height);
    }I have no idea of this will improve things, but what about:
    GridLayout layout = (GridLayout) getLayout();
    int rows = layout.getRows();
    int columns = layout.getColumns();
    double width = (getWidth() / columns); //** how about using doubles here
    double height = (getHeight() / rows);  //** how about using doubles here
    g2.drawImage(backgroundImage, 0, 0, getWidth(), getHeight(), null);
    for (int i = 0; i < 8; i++) {
         // Vertical lines
         g2.drawLine(i * width, 0, (int)(i * width), (int)(rows * height)); // and casting?
         // Horizontal lines
         g2.drawLine(0, (int)(i * height), (int)(columns * width), (int)(i * height));
    }

  • Flash Security Error

    I how can I solved the Flash Security Error? I can't view a chart that requires Flash.

    Has anyone been able to resolve this issue? There is also a similar older post (http://forums.adobe.com/message/32592#32592) that has not been answered.
    I have a Flex app on my website that downloads a file from the same place. Both are under the root directory. This works fine in IE7, IE9, Firefox, Chrome, and Opera. In IE8 I get the error (error text is "Error #2048"). This is on 32- and 64-bit XP machines.
    I even tried putting a crossdomain xml file (which should not be needed) to no avail.
    Any help would be appreciated.

  • Flash Content error......

    Hi
    I found the error popup windows "Flash content error : 9" is
    displayed when swf file is played in Flash Lite 2.0 on Symbian OS.
    What is this error popup mean?? And how can I solve this
    problem??
    Please, help me....
    Thank you.

    Hi Ashish,
    This is the actionscript stuck error, you are trying to do
    too much in a single frame. It could be that you are loading too
    much XML data or other data from a network connection. You may be
    trying to process a lot of Actionscript in a single frame.
    If you are using XML then you should consider a different
    format, maybe key value pairs.
    Another approach is to load pieces of the data and process
    them in batches. You can use setInterval to enable a fake
    asynchronous behaviour.
    Mark

  • Flash Content Error :4

    Hi Friends,
    Does any body here faced "Flash Content Error:4" problem and
    he was able to solve it.
    Regards
    Ashish

    Hi Ashish,
    This is the actionscript stuck error, you are trying to do
    too much in a single frame. It could be that you are loading too
    much XML data or other data from a network connection. You may be
    trying to process a lot of Actionscript in a single frame.
    If you are using XML then you should consider a different
    format, maybe key value pairs.
    Another approach is to load pieces of the data and process
    them in batches. You can use setInterval to enable a fake
    asynchronous behaviour.
    Mark

Maybe you are looking for

  • INDD to PDF: web-safe color palette?

    Context: currently, the Google Docs Viewer/Embedder, when used to display a PDF in a browser, heavily downsamples images in the PDF resulting in grisly color changes and posterization. This has been discussed for a long time elsewhere on the web (exa

  • Error while running  BDB tcl testsuite commands

    Hi, I build berkeley db (4.7.25) libraries with tcl test suite is enabled in the solaris 9 machine using below configuration ../dist/configure --enable-dynamic ${BUILD_TAG} enable-tcl with-tcl=/export/tcl8.5/lib enable-test enable-java -prefix ${BUIL

  • Error While Changing Contact Person in MSA

    Hi, When the users are trying to change the data of the already saved BP or CP it is giving out error "Value of Attribute Tile is Not Valid" This is happening only for some of the BP and CP not to all. We are not maintaing any entries in the "Title"

  • Outbound ECS XSD does not contain UNB Segment.

    Hello All, We are implementing B2B scenario of converting CUSDEC-D96B ECS file to XML file using B2B. The XML file is getting generated successfully in B2B_IN_Queue but it doesnot contain the UNB header segment element in XML. The structure of the ou

  • Acrobat Reader printing problem

    I am on Windows firefox. When I print a file, First page is ok, but following pages may contain or is almost full of chars replaced by other chars. So, the page layout seems the same but text and numbers are replaced by a scrambled version. On the sc