strange results in the calculation

Hello

I need another pair of eyes, or maybe another brain here: a miniature of a large area, I want to calculate the position of an object from the position in the big screen. The calculation is
original pos / large size of the area * size small area
I think it should be good to get the relative position in the small screen.
However, Flash comes up with some strange results:
(20 + 5000) / (2 * 5000) * 119 = 2439.5
This should result in 59.738 for this calculation. The code for this looks like this:

OMC._x = (omc.x + this.controlr.MAX) / (2 * this.controlr.MAX) * this.display.width;

where omc.x is the x position in the big screen (here 20), MAX is 5000, 2 * MAX is the full size (the point 0,0 is in the Middle, so he has 10000 big), and the small screen is display.width.
Values seem to be right; the calculation above (20 + 5000...) has been traced from the code. However, the result is totally wrong, and I have no idea why. Any ideas on that?


blemmo

Oh... just realized the numbers came as strings... so it all seemed well in the trace, but calculation of strings with numbers is not very accurate...

Heck... I remember using the debugger more often.

see you soon,
blemmo

Tags: Adobe Animate

Similar Questions

  • Manually change the result of the calculation

    I have a form that I want to be able to manually change the answer to the calculation. The goal is to accept a value calculated, unless the user enters a different value in the calculated field. The calculated value will usually be the desired value, but not always.

    I was almost able to achieve using several fields (that I have that knowledge base of javascript), but there is just one problem where a value appears only a touch later. I know not yet why, as the other field is fine.

    I have attached the form using: https://dl.dropboxusercontent.com/u/11052710/Adobe%20Acrobat/Overriding%20LVEF.pdf

    Hello.

    This topic answers the same question: http://abracadabrapdf.net/forum/index.php/topic, 3009.0.html

    You can download the sample PDF content in the 4th answer here: http://abracadabrapdf.net/forum/index.php?action=dlattach;topic=3009.0;attach=2506

  • Result of the calculation were separated to the whole and decimal, number not rounding correctly

    I have 2 fields as a result of sharing: the whole and decimal number (1 decimal place). I Math.floor the result to get the whole number and everything is fine until I hit a case where the result is 92,97.

    This should give "93" in the whole of the field and '0' in the decimal field, instead it gives me '92' and '10' (even though I'm only hosting 1 character in the field).

    How can I get the '93' and '0' in the following code?

    fieldLVEDV = this.getField("LVEDV").value;

    fieldBSA = this.getField("BSA").value;

    If (fieldLVEDV! = "" & & fieldBSA! = "") {}

    totalLVEDV = this.getField("LVEDV").value + ((this.getField("LVEDVDec").value)/10);

    calculation = (totalLVEDV / fieldBSA);

    calculationDecimal = calculation;

    partWhole = Math.floor (calculation);

    if(partWhole <0) {partWhole =' ' ;}}

    this.getField("Index").value = partWhole;

    this.getField("IndexDecimal").value = Math.round (10 *(calculationDecimal-partWhole));

    {If (this.getField("IndexDecimal").value = '10')

    {

    this.getField("Index").value = partWhole + 1;

    this.getField("IndexDecimal").value = "0".

    }}

    } else {}

    this.getField("Index").value = "";

    this.getField("IndexDecimal").value = "";

    }

    I thought I'd add the blue part would do the job, but obviously it did not work.

    Ah, your problem is that you do not use the correct comparison operator. To check if two values are equal, the operator is "==" not not "=". Using "=", you assign the value 10 to the field which you then pass in 0 a few lines down. Use 'is' and things should work correctly.

  • change the result of the calculation to the negative

    I have a calculation script custom in an Acrobat form field:

    var myFormat = "mm/dd/yyyy".

    var startDt = this.getField("PolicyEffectiveDate").value
    var endDt = this.getField("ChngDate").value

    startDate = util.scand (myFormat, startDt) var;
    var endDate = util.scand (myFormat, endDt);

    xdays var = Math.round (Math.abs ((startDate.getTime () - endDate.getTime (()) / (86400000)))

    Event.Value = ((365-(xdays)) / 365) .toFixed (3) * (this.getField("AnnualPremium2").value)

    How would the total resulting calculation to the negative change?

    Thanks in advance for any help!

    I found a solution... I just multiplied the event.value by negative 1.

  • Strange results, of the points within the polygon query

    Hi all -

    This weekend I upgraded to 11.1.0.7 and apply the latest patch for 64-bit Windows (which seems to include that of space, ORA-13243 )

    To recall a previous post, I have two tables:
    GEO_POINTS:
    (
    DEP_ID NUMBER (12) NOT NULL,
    LINE NUMBER 4 NOT NULL,.
    MDSYS. POINT_LOC SDO_GEOMETRY
    )

    and POLYGON_AREAS:
    (
    POLY_NAME VARCHAR2 (120 CHAR),
    POLY_DESC VARCHAR2 (120 CHAR),
    MDSYS POLY_POINTS. SDO_GEOMETRY
    )

    Can I get an application to work correctly for the points at a distance from another point, but I can't now get a list of all the points in a polygon. I tried all sorts of different permutations without success. I either recover all or none.

    On a previous thread I saw where someone (reggie?), suggested to someone that they check the data with SDO_RELATE, and that is what I have:
    SELECT   poly_name, dep_id, SDO_GEOM.RELATE (P.point_loc,
                                          'determine',
                                          poly_points,
                                          0.0005) relation, point_loc
      FROM   polygon_areas A, geo_points P
     WHERE   poly_name = 'Test polygon 2'
     and sdo_within_distance (
    point_loc, poly_points,
    'distance=.5 unit=KM') = 'TRUE';
    
    Test polygon 2     10033733     DISJOINT     MDSYS.SDO_GEOMETRY(2001,8307,MDSYS.SDO_POINT_TYPE(-122.99056,40.134829348511,null),null,null)
    Test polygon 2     10214613     INSIDE     MDSYS.SDO_GEOMETRY(2001,8307,MDSYS.SDO_POINT_TYPE(-123.0094,40.1389892964955,null),null,null)
    Say most of the records returned "INSIDE" a handful only seem to say "DISJOINT".

    My polygon (3D) is defined as:
    INSERT INTO polygon_areas (poly_name, poly_desc, poly_points)
    VALUES)
    "Polygon of test 2',
    "Polygon"
    sdo_geometry (3003, 8307, null, sdo_elem_info_array (1,1003,1),)
    sdo_ordinate_array (-122.0964560075894,46.30771933405131,0)
    -122.0972586160512,46.30776603954445,0-122.0979453045886,46.30775572181209,0
    -122.0985334819956,46.30786533360153,0-122.099123700718,46.30779394701457,0
    -122.0998599545021,46.30764987505434,0-122.1005382096634,46.30746110208141,0
    -122.101326745694,46.30725380166289,0-122.1020786809103,46.30711506779254,0
    -122.1026951262488,46.30700016188705,0-122.1035181114156,46.30708532675261,0
    -122.1040365310453,46.30718342118976,0-122.1046786530477,46.30731880865087,0
    -122.1052722538113,46.3074574038917,0-122.1059987733943,46.30759676662286,0
    -122.1066135560114,46.30762026982092,0-122.107424410801,46.30770302649447,0
    -122.1080550935476,46.30762084571995,0-122.108746234047,46.30740774945418,0
    -122.10937359006,46.30729761128382,0-122.1100646417299,46.30714433883676,0
    -122.1105582889429,46.3069148535724,0-122.1112424328653,46.30673924798984,0
    -122.1118583117779,46.30655124816924,0-122.1123792992415,46.30625620936262,0
    -122.1129469500482,46.30586492598907,0-122.1133879475662,46.30552644690658,0
    -122.1138881417885,46.30519890535538,0-122.1142563739051,46.30478653178479,0
    -122.1145727728044,46.30435698252731,0-122.1149405876922,46.30400540617813,0
    -122.1152438944599,46.30353655099154,0-122.1153926533235,46.30310263815314,0
    -122.1154930418943,46.3026438525083,0-122.1155465318717,46.30227910845313,0
    -122.1155460578878,46.30184016484801,0-122.1155125313209,46.3014098821799,0
    -122.1155096519663,46.30093026865168,0-122.1155608294837,46.30049629380712,0
    -122.1156091083421,46.30009499519977,0-122.1157053861092,46.29972055773055,0
    -122.115760057761,46.29927471296439,0-122.1157313924571,46.2988898486807,0
    -122.1156359044943,46.29845780132688,0-122.1155964027547,46.29806176680103,0
    -122.115497397242,46.29766481786432,0-122.1152629640372,46.29730033931028,0
    -122.1149123880282,46.2969384915262,0-122.1146047092177,46.29660813484444,0
    -122.1142729906227,46.29610218210313,0-122.114129480908,46.29568258694918,0
    -122.1140445631658,46.29522306882703,0-122.1137792523926,46.29476638544778,0
    -122.1133991541599,46.29439487649638,0-122.1129044572885,46.29410744244564,0
    -122.1124115408205,46.29382101043342,0-122.1120258682855,46.29341113849787,0
    -122.1115713280984,46.29308325131224,0-122.1109310112231,46.29287767817464,0
    -122.1103502973562,46.29267460727225,0-122.1096675994897,46.29267107652063,0
    -122.1090662864219,46.29266881956065,0-122.1085381831469,46.2928983897998,0
    -122.1083085173859,46.2932820188678,0-122.1083135200142,46.29366815074521,0
    -122.1083216917668,46.29405755081569,0-122.1081500113631,46.29444132056023,0
    -122.1083937683288,46.29480203039793,0-122.1087590296771,46.29517019740266,0
    -122.1090062022728,46.29553641921602,0-122.1091433251551,46.29598906324692,0
    -122.1092197934307,46.29640318538178,0-122.1090473697216,46.29684097388007,0
    -122.1088741842866,46.29723867989154,0-122.1085733732482,46.29749920125438,0
    -122.108275429804,46.29791598573875,0-122.1079835519625,46.29830261263341,0
    -122.1077454788967,46.29867221178163,0-122.1075069644332,46.29899213519031,0
    -122.1071579725203,46.29935618253118,0-122.106754980223,46.29960929039363,0
    -122.1064686406685,46.29997605830629,0-122.106412384199,46.30031570325313,0
    -122.1061858294833,46.30073313120077,0-122.1057885702821,46.30104316873193,0
    -122.1052779521816,46.30125865231757,0-122.1049388492519,46.30160047014105,0
    -122.1046010364788,46.30193421026415,0-122.1043767457976,46.30231141703782,0
    -122.1040954619466,46.30269248072795,0-122.1039221949925,46.3031055071681,0
    -122.1034669714409,46.30330597227303,0-122.1028484841032,46.30331988824609,0
    -122.1021910294617,46.3032493533724,0-122.101711761657,46.30294476023612,0
    -122.1011645802931,46.30280256913363,0-122.1005447743755,46.30281600088056,0
    -122.099927372097,46.30282247816702,0-122.0993034748202,46.3028386313971,0
    -122.0986869119303,46.3030411668907,0-122.0980410374456,46.30335216401479,0
    -122.0975276320658,46.30386407205707,0-122.0971770391533,46.3042659531001,0
    -122.0969551928034,46.3047699651079,0-122.0967233514249,46.30525030573208,0
    -122.0964414955943,46.3058054153648,0-122.0960589774954,46.30642296217163,0
    -122.0958540181483,46.30709385539263,0-122.0962198823426,46.30753180536824,0
    -122.09646054927,46.30766952392737,0-122.0964560075894,46.30771933405131,0
    ))
    );


    So, how can we the second returned row above say "INSIDE" when the degrees are - 123.xxxxx, and none of the polygon dimensions fall into this longitude?

    A I saw something with the insert statement? I know as I don't need that level of precision (it's pretty ridiculous), but I'm prototyping how a user can create a polygon in Google Earth and then paste the information into a box in my application so I can "convert" Oracle format. Near as I can tell, there isn't an easy way to enter the coordinates 3D GE creates in a simpler 2D coordinate, so I created the column like 3D polygon (hopefully correctly).

    I have something simple and obvious to those who know what you are missing.

    Thank you

    Bill Ferguson

    could you please email me (baris kazar at oracle dot com dot) your sql script?
    I would like to see what you do exactly.
    Thank you

  • Strange behavior of the WHILE loop

    Dear experts LabVIEW

    I would ask you to give me an explanation of the behavior of the very simple VI as an attachment. This VI contains a WHILE loop with three parameters, input and STEP. The table of RESULTS shows the calculated values. Considering the input parameters OF = 0 TO = 1 LEVEL = 0.1, then the RESULTS table contains the values 0, 0.1, 0.2,..., 0.9, 1. Considering the input settings ON = 1, TO = 2, STEP = 0.1, then RESULT table contains values 1, 1.1, 1.2,..., 1.8, 1.9. The question is, why the number 2 is missing?  (I also tried to use different types of data, but without success). Thanks for your thoughts.

    Juraj

    Because you compare floating point numbers.

    For example, 0.1 cannot be represented in exactly in binary, cela repetitive additions probably will not end in an exact integer later.

    Since the three entries, you can calculate the number of values exactly and use a loop FOR. Do not use the convoluted code...

    Why not just use ramp model?

  • Negative numbers does not work in the calculation

    I'm new to calculations of form fields and have encountered a problem that I can't solve. I have a form with calculations. There are four columns (beginning balance, revenue, expenditure and balance) the problem occurs when a negative number is specified for the opening balance. My calculation should start balance + revenue - expenses = balance but if a negative balance of start's ed and you tab to end receptions, enter received, expenses tab, enter the expenses, balance tab I get error "the value entered does not match the format of the field". "." If the opening balance is a positive number, there is not a problem. I can send someone a copy of the form if this help solve this problem. For any help or suggestion would be greatly appreciated.

    I use Acrobat 9 Pro

    Here is a sample of my closing balance calculation:

    Get the first value in the field
    "var v1 = getField (start Balance.7") .value;

    Get the second field value
    var v2 = getField("Receipts7").value;

    Get the first value in the field
    var v3 = getField("Expenditures7").value;

    The value of this field value equal to the difference
    Event.Value = v1 + v2 - v3;

    Computers don't perform calculations using decimal values but convert decimal values in binary values, perform the calculation of the binary base and then convert decimal values. Since for many decimal value, there is not an exact conversion value a little mistake gets introduced in the values and the calculation. Change the 'None' format and expand the field for the result, we see a value-1.8189894035458565e - 12 or the value of-'0.' followed by 12 zeros, then the 1.8189894035458565 value. A very small value. If we round the value of the calculation (not the format displayed in the Format option) you can get the answer of $0.00. We can check this result by changing the 'Format', 'None' option and expanding the field to account for the long value.

    I would use the util.printf method to perform the rounding for the result of the calculation.

    Your calculation script could be:

    Get the first value in the field
    "var v1 = getField (start Balance.7") .value;

    Get the second field value
    var v2 = getField("Receipts7").value;

    Get the first value in the field
    var v3 = getField("Expenditures7").value;

    The value of this field value equal to the difference
    Event.Value = util.printf ("%,101.10f", Number (v1) + Number (v2) - Number (v3));

    This script rounds to 10 decimal paces ensuring that the result will be the value that can be displayed using the number format.

  • IR: result of the aggregation in footer of report

    Hello!

    This quote from 'beginning Oracle Application Express 4.2' at page 174 (on the aggregation to IR):

    "The results are displayed at the end of the report."

    There is a simple method to print the results of the aggregation for the report footer on each page?

    I asked - and I said

    To do what I create processes on demand for the results of the calculations of aggregation (via APEX_IR_PKG) and make ajax request to him in the event "discount for after ' IR

    There is the manual detailed with the sample http://devsonia.ru/2013/11/14/oracle-apex-aggregation-in-interactive-report-on-each-page-en/.

  • How to reuse the calculation

    Hello

    I do a calculation, and I show in my report to the depose1 and a second field3

    Now I have a third, which is = FIELD1 Field2 FIELD3

    My question how do the math of the re calculation Field1 and Field2 Field3

    Example:

    FIELD1 = (X 1 + Y1) * Z1
    FIELD2 = (X 2 + Y2) * Z2

    field3, I do not want to FIELD3 = (X 1 + Y1) * Z1-(X 2 + Y2) * Z2
    but
    I want to use only a calculated by referencing Field1 and Field2

    Field1 and Field2 are not the QUERY FIELD (they are only in the report (calculated field))

    I try to use
    FIELD3=@FIELD1-@FIELD2, but that does not work...

    Any help?

    Thank you

    You can store the results of the calculations in a variable and then refer to these variables.

    Thank you!

  • Bad results using the scientific calculator

    When you use the scientific calculator of Wondows 7, when I type 126/(3.6*6.48), I get a wrong result: 23.328. When I use Excel to do the same, I get the correct result: 5.40. Any idea?

    I tried this using the scientific calculator and got the correct results, enter the numbers exactly how you wrote them and then hit equal.

  • Please can someone help me on how toedit calculation result to the point

    Please can someone help me on how toedit calculation result to the point

    Can you post an example page upward on the hosted site for Oracle?  Apex. Oracle.com (you need a workspace).

    So to repeat what you have posted:

    You have a page with 3 items P1_N1, P1_N2 and P1_SOM...  You want to P1_N1 and P1_N2 to be text boxes that accept input, and when you enter the values you want the sum of these values to be stored in P1_SOM, correct?

    Take a look at this page: http://glassfish1.revion.com/apex/f?p=227:1:12047078745989:

    I will explain further if you think you want it...  Use any value for a connection. Enter a number in N1 and click in the field of N2, the display option takes the sum of the two numbers when you let one of the fields...

    Thank you

    Tony Miller
    Software LuvMuffin
    Ruckersville, WILL

  • Make the result of the empty calculation if a factor is equal to 0

    I found a similar discussion with this thread, but it didn't answer exactly what I needed. I wish that the result of a calculation that is simple to be empty if a factor is empty or zero.

    For example, I have a calcuation C field that is the sum of the fields A and B. A will always have a value, but B does not. If B is empty or 0, I C does not show any output value. Is this possible in Acrobat? Thank you.

    Sure. A custom calculation script might look like:

    (function () {}

    Get the first value in the field, as a number

    var v1 = + getField("text1").value;

    Get the second field value, as a string

    var S2 = getField("text2").valueAsString;

    Converts a string to a number;

    var v2 = + s2

    Set this field to the sum value if the second field is not empty or if not equal to zero

    Event.Value = s2 & v2! == 0 ? v1 + v2;:

    })();

  • Result of the incorrect calculation

    Hi all

    I am creating a new logic of the columns in the business layer based on two existing columns:

    Column1/Column2 * 100 (columns 1 and 2 are aggregate amount)

    When I test the multiplication in the report is not made. I have just the result of the division

    What could be the problem?

    Concerning

    Published by: aharrab_be on January 14, 2009 07:59

    try 100 * (column1/column2)
    or
    (100 * column1) /column2

    with the brackets.

    If 100 does not work, try 100.00

  • Strange shadows on the Sierra of the Mac OS on an external monitor

    After upgrading to Mac OS Sierra, I noticed that there are these strange shadows. It of almost like the gradient of a shadow is not fluid and smooth:

    Screenshots:

    https://www.dropbox.com/s/dj6g3x68c9ggwez/screenshot%202016-09-24%2008.34.42.PNG? DL = 0

    https://www.dropbox.com/s/2ql2prnhn2k27rz/screenshot%202016-09-24%2008.35.43.PNG? DL = 0

    Is this normal, or is there a problem? Recommend a fix?

    I'm on Mac mini (mid-2011) and a screen LCD Dell UltraSharp U2913WM 29 inches.

    ... However, if the screenshots are picking up, it seems less like a problem of monitor and more like an incompatibility of graphics cards with MacOS Sierra?

    This seems to be quite normal. The windows are translucent, and what I see, this is the result of the image behind the window.

    It was the same thing in El Capitan (and, I suppose, Yosemite, as well).

    You can go to system preferences - > accessibility-> display and select "reduce transparency" if it bothers you.

  • After I login, strange "resizing" and the bar menu solid white

    MacBook Pro (retina, 13 inch, mid-2014)

    3 GHz Intel Core i7

    16 GB 1600 MHz DDR3

    Hi, I recently noticed this strange event with my mac. After I typed my password to connect I see my photo account reappear down and right a little and a larger size as if the screen was resized or zoomed in. Then, the display "adjusts" to the expected size, but the menu bar appears as a white line continues. After a few seconds, everything becomes normal. Everything happens all the beachball comes in and out... once almost immediately after, I hit return to log in and the second time after everything seems normal.

    Is not exactly a brick wall, as it does not prevent me from doing anything either, but it seems to be symptomatic of something causing a slower connection speed.

    Something unrelated with is that my mac seems to freeze randomly for a few seconds when I run the network connectivity. It's strange to me because of the plug of my macbook.

    I'm generally taken care to make sure that I have not bogged down my computer with the software shit etc, so I'm not sure what gives.

    Thanks for ANY help at all!

    Please read this message before doing anything.

    This procedure is a diagnostic test. It is unlikely to solve your problem. Don't be disappointed when you find that nothing has changed after you complete it.

    The test is intended to determine if the problem is caused by a third-party software that loads automatically at startup or logon, by a device, by a police conflict or corruption of system files or some system caches.

    Disconnect all devices wired except those required to test and remove all the expansion cards from secondary market, as appropriate. Start in safe mode and log on to the account of the problem.

    Note: If FileVault is enabled in OS X 10.9 or an earlier version, or if a firmware password is defined, or if the boot volume is a software RAID, you can not do this. Ask for additional instructions.

    Safe mode is much slower to boot and run as normal, with limited graphics performance, and some things work at all, including an audio output and a Wi - Fi connection on some models. The next normal boot can also be a bit slow.

    The login screen is displayed even if you usually connect automatically. You need your password to log on. If you have forgotten the password, you will have to reset it before you begin.

    Test in safe mode. Same problem?

    After testing, restart as usual (not in safe mode) and make sure you always have the problem. View the results of the test.

Maybe you are looking for

  • Complaint driver Lenovo G550 Wi - Fi and porting Windows 8.1

    Hello! This is my first post on this forum and I hope that I have the right place to post, as I've seen other topics concerning the g550 on this forum. I have read the discussions about the use of Windows 8 and its drivers and also problems with the

  • customer of Hyper-v is not visible in the windows backup utility

    Hello We use windows server and veeam backup to back up hyper-v customers. last week one of the server is missing from the backup window and he said "06/08/2016 21:42:20: task impossible error: document Writer does not contain information about the v

  • Why keep DEP close iTunes when I try to save my iPad?

    I installed the new ios 5 iTunes and I can't save my iPad; It stops at step 6 of 7.

  • How can I fix error code 39?

    Hello.I have a laptop Acer Aspire 7530. Today when I tried to play a cd, the CD drive has failed. I looked at the State of the disk and it said that the pilot program is damaged or is missing... (code 39) I do not understand how this can happen, I di

  • Have lost the ability to RIP music with WIN7.

    When I hit the Rip CD button, I get the following error message."Windows Media Player cannot find the file. If you try to play, burn, or sync an item that is in your library, the element can point to a file that has been moved, renamed or deleted' Wh