Bug in the multiplication in AS3 (CS5)?

Hello

When I'm trying to multiply certain numbers, I get weird results.

I can't imagine that a simple multiplication could have bugs, but it seems to be the case...

Could someone please check the following?

Make a new flash AS3 project and in the first image, simply paste the following code:

/////////////////////////////////////////////////////////////////////

import flash.text.TextField

var a: number = 19.8;
var b:Number = 9;
result: var number = a * b;

var v_TextField = new TextField();
v_TextField.AutoSize = TextFieldAutoSize.LEFT;
v_TextField.WordWrap = false;
v_TextField.text = "Test:" + a + "*" b + "=" + result; "."

addChild (v_TextField);

/////////////////////////////////////////////////////////////////////

If I publish and run this, I get:

Test: 19.8 * 9 = 178.20000000000002


The same behavior with 19.8 * 18

I still looking other combinations.

What's up with that?

It's the right answer in the precision used by flash ~ 16 digits.  the inaccuracy is introduced because computers use binary (and no decimal) arithmetic.  You can use rounded up to get the answers that you want.

Tags: Adobe Animate

Similar Questions

  • Is there a bug in the as3 tween class

    Is there a bug in the as3 tween class that causes interpolations is stopped before completing. I read that there is and that a 3rd party tween class should be used. I'm starting to learn as3 and experimentation, but it would be good to know when I move on more complex projects.

    The solution for this would also make your overall function. It simply means place your feature in the top level of your film.

    I did some research on this topic, but I found a lot of conflicting answers.

    Any help is welcome thanks in advance.

    interpolations should NOT be local to a function.  otherwise, they are likely to be gc would be before they finish.

  • Bug in the Windows 7 calculator

    There is a basic bug in the calculator of windows 7 (only in the standard display)

    Equation 1 + 2 * 3 the answer 9.
    In fact, the answer should be 7.
    If we play a little, we discover that he is simply performing operations on from left to right, and failing to perform the multiplication and division before addition and subtraction.
    If I try the same equation in scientific display or programmer, you get the right answer (7)
    Concerning
    Geoff Scott

    Hello

    The hierarchy in the basic calculator is from left to right is

    1 + 2 = 3

    3 * 3 = 9

    The scientist and the programmer calculator use the hierarchy of mathematical operations
    and the Standard Calculator treats 1 both functions in the order entered.

    Hierarchy of mathematical operations
    http://www.tpub.com/content/DOE/h1014v1/CSS/h1014v1_36.htm

    http://www.tpub.com/content/DOE/h1014v1/CSS/h1014v1_37.htm

    This has been noticed in many versions of the calculator.

    I hope this helps.

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle=""><- mark="" twain="" said="" it="">

  • Bug with the embedded font.

    Hello


    I have a strange bug with the font Cooper (Std Black Italic)...

    Here's what looks like a multiline text in the Flash Editor:

    mlVXh7W.png

    Now, here's how it looks when I embed the fonts in a SWF file, and then load and use from the AS3 code:

    hXbpJ3S.png

    [this] is happening?

    Here are the parameters of line values I get from getLineMetrics (0):

    Ascent: 51.2

    descent: 51.2

    height: 102.4

    head: 0


    I tried to reexporting the police, the same problem. I also have the same problem when I export the scene editor and read it with Ctrl + Enter.

    It seems THAT the good in the editor... I don't know what to do. I reinstalled even the police. :/

    Also, I have this problem with all fonts... or at least every 5 different fonts, I tried.


    [moderate]

    I finally fixed it by recreating the Mac fla file.

    Looks like it is a problem with Windows.

  • Is there a bug with the maintenance of interaction of the Glossary for the entire project?

    Greetings,

    I've seen in other posts (Cp6) that there is a known bug with the maintenance of interaction available in a project glossary.

    Maybe my problem can help further this question - or maybe someone can post tips on how to solve this problem.

    I use a trial version of the Cp7 and followed the advice in this tutorial: http://www.YouTube.com/watch?v=wTEF-56V1Z4

    I found that if I left 'Visible output' box unchecked for the button closure (as in the tutorial), I don't see the glossary at all.

    Similarly for the button I created for the glossary - I couldn't have hidden or I don't see it.

    Another problem: the close button in the glossary (which is grouped in the interaction) in a first time appeared with the glossary, but then decided to appear on following slides without it (but in the same location).

    Everyone has been able to follow the advice on the above tutorial link successfully and is there another tutorial I can watch or read about it? I really want to provide access to the glossary on multiple slides and during quizzes. (And Yes, I'll buy a license - although the number of bugs I encounter creeps upward!)

    Thank you

    Jacqui.

    Hello

    Unchecking 'visible output' means the Group glossary will be invisible in the output until it is made visible by an action. In this case, the action that make visible is assigned to the Glossary button.

    Make sure that:

    • Glossary button, button Exit and the Widget are defined "Rest of project" accordion Timing.
    • EXIT button is set to Place object on top in the accordion of Timing.

    Anthony

  • Change the text with AS3 makes the invisible text

    Hi all

    Even for a total n00b like me, this is awkward: I can't even change a text on the stage with as3.

    I place a text on my stage, assign the dynamics, incorporate the police and give it an instance name. When I change the text, he evacuated the scene or if it remains invisible, I don't know.

    I thought it would be as simple as this: myText.text = "new text";   but apparently I am doing something wrong. When I put a trace (myText.text);  before and after, I see the old and the new text in the output window. Then he changes correctly, but why he disappears it? Also tried in a new white project, to ensure that it was not something somewhere.

    I'm totally distraught...

    BTW I use Flash CS5.5 on Win7

    do not enter text in the ide.  Use actionscript to assign the original text of your textfield and also change.

  • How can I change the color of the clipping path in CS5

    Just installed Photoshop CS5 I use the pen to create a clipping for insulation path. In CS4, the line always in contrast with the background, I was working on. In CS5 is just grey so I can't work on gray background pictures as I do not see the path. How can I change to multi color as CS4?

    In CS4 I could change between gray and color by activating or deactivating the drawing OpenGL from Edit-> Preferences-> Performance. This does not work for me in CS5. I really need the color that I isolate a dark grey bike againsr a lighter gray wall. I keep losing the curved handles against the wall.

    That means that the wall is not gray neutral, there a lot of color in it. In any case, it is not the question. In CS5, they changed the way they display paths when OpenGL is off (probably changed to an another API backstage) that caused these problems. As I understand it, this isn't a bug in itself, it's just a limitation of the API they use now (lack of blend modes, or something like).

    If you want the old way back, then you can try to do a story of request/bug here: https://www.adobe.com/go/wish

  • I can't open the FLA files in CS5 "UNEXPECTED FILE FORMAT" help!

    I desperately need help from someone.  For the second time, I can not open 2 FLAs I invested more than 100 hours of design.  I am running CS5 and need to know what can be done?  I'm afraid to do anything with the fear that this will happen, that I had open these files and complete projects.  How is this possible or which can solve the problem.

    I can't believe that ADOBE would release CS5 with as serious a problem.  It's pretty darn close to life and death, these two files constitute a $200 k account.

    Please HELP! My name is Kevin and my email is [email protected]

    Hi all

    Today we released Flash CS5.5 update. This update contains fixes to open and save files Flash Professional (FLA) in CS5.5 and other bug fixes.
     
    Please download Flash CS5.5 update.

    You can download Flash > help > updates.

    Thank you
    Stephanie

  • There seems to be a bug in the Pages.  I imported a text in my document to a different font.

    I imported a text in my document Pages.  The two texts were different.  Then I selected all the text and selected in Times New Roman for everything.  I saved and you leave.  I have then opened the document, and the types of two texts are still there.  How can I get everything to be Times New Roman?  That's why I think there is a bug in the Pages.

    Probably, you have two versions of the document and opened a bad.

    Peter

  • Are you aware of a possible bug in the version 3.6.23? In the browser, for example, "two /" appears with the slash through the 'o'. Is this a known bug? Thank you

    Are you aware of a possible bug in the version 3.6.23? In the browser, for example, "two /" appears with the slash through the 'o'. Is this a known bug?

    When the same text is seen in another browser, it is displayed correctly as "two."

    The same question is displayed on another computer.

    Thank you.

    Sounds that you use a font that supports ligatures (Palatino?).

  • Firefox 4 warn me / restore when I close the multiple tabs.

    Even if in the Options, I checked "Warn me when closing multiple tabs" Firefox 4 don't warn me or restore the tabs when I close the multiple tabs. I use Windows Xp SP2.

    If you want Firefox to display the message to save the session, it can be turned on again by changing some preferences.

    1. Type of topic: config in the address bar and press on enter
    2. Accept the warning message that appears, you will be taken to a list of preferences
    3. Find browser.tabs.warnOnClosepreference, if its value is set to false, double-click on it to change its value to true
    4. Repeat this for 3 preferences browser.warnOnQuit, the browser.warnOnRestart and the browser.showQuitWarning
  • The captain el + java + cs5 (cannot open cs5) how to fix?

    After succfully install the new Apple operating system: El Captin and the latest version of Java, I now find Photoshop CS5 won't open.

    Now, I read the different articles and underrstand the new JAVA is at the origin of the problem.

    If anyone has overcome this problem. You have cs5 to work? If so, how?

    For photographers:

    If the result is Photoshop cs5 will not work because it has been iincompatible with the latest Java, what alternatives photographers use to treat their photos?

    I don't want to use Photoshop CC.

    (I use an iMac)

    Thank you in advance.

    Tony

    That CS5 is probably seeking is the old Apple's Java.

  • IOS 9.3 there bugs for the iphone 6?

    Hi guys I have an iPhone 6 currently running in iOS 9.2.1 asked if it is wise to update the iOS to 9.3. Are they bugs in the new iPhone OS 6? Should I update the OS or not?

    just do the update via iTunes by keeping your connected phone. so far no bugs recorded

  • When I updated my iPhone 6 more iOS 9.3 my camera will not be to the point and seems blurred by far. I already reset my iPhone and my mother worked... Anything other ideas, might be a bug in the iOS update?

    When I updated my iPhone 6 more iOS 9.3 my camera will not be to the point and seems blurred by far. I already reset my iPhone and my mother worked... Anything other ideas, might be a bug in the iOS update?

    I would say "try and do a restore as new iPhone" like everyone else but I'm having a similar problem and nothing works! I've restored all the possible ways and nothing. I got my screen replaced and I still have the same home button but my phone updated with error 53 (makes the phone unusable) but the camera did work before the update. and Apple has released iOS 9.1.2 (13D 20) to correct the error 53 (mainly for other reasons) but when I go to use the camera, it is only black! If someone could help 'discovered' and I would be great!

  • First bug in the new HP update (7820)

    There is a bug in the application 2-var statistics.

    SHIFT + TRACE SETTINGS - see the image:

    Now look at the calculator after upgrade:

    Where the top menu of the page?

    In 7820, the brand is on the SYMB screen next to his color choices on the right (2nd line S1 config).  Line color selection is on the left (3rd line S1 config).

Maybe you are looking for

  • Two questions with Satellite A660-12th

    Hello I'm afraid that my English isn't the best but I think in English I get more answers, the German replies are alo ok. I have two problems, perhaps they are connected somehow. The first problem is that my laptop heats verry. In Windows 7 there are

  • I can't connect to my HP connect first try!

    I've just set up my new account and it says that my password is not valid. Just bought my printer HP 3510. Did not like your answer to my previous question, "what is a password for snapfish".

  • Computer cannot start an operating system STOP error message: 0 x 00000024

    Origianal title: computer can not boot the operating system Appeared in my computer: STOP: 0 x 00000024 (0 X 00190203, 0X82F4D5D0, 0x00000000 What is happen?

  • I want to move the folder Program Files to another hard drive.

    I have Windows 7 installed on a small primary partition on one of the two hard drives, double boot with Windows XP.  My installation of Windows XP is on a smaller primary partition (like Windows 7) and Program Files folder on a separate drive logic i

  • Defragmentation can be overdone?

    Microsoft recommends defragment whole drive with more than 10% of fragmentation.  Thus, it is harmful for the hard drive if I do a defrag regularly if my hard drive is less than 10% fragmented?  Since I defragment automatically each week I'm not sure