Very quick and simple question about a simple sum going wrong.

Ive noticed that im having lots of ocurrences where my maths goes wrong - usually i trace this to ints multiplying doubles and stuff , or its in degrees not radians .
But this one is too simple to seem to cause problems :
screenY = 180 + ( 420 - (( 420 / 2200 ) * xE ) );
heres the code line which does the calculation, and for a particular loop it
ran as xE = 223 .
xE is an int by the way.
For some reason this code always produces screenY = 600 ,
which should only be the case if xE = 0 .
any suggestions as to how i should help the VM get it right?
thanks in advance guys.

Ive noticed that im having lots of ocurrences where
my maths goes wrong - usually i trace this to ints
multiplying doubles and stuff , or its in degrees
not radians .
But this one is too simple to seem to cause problems
screenY = 180 + ( 420 - (( 420 / 2200 ) * xE ) );
heres the code line which does the calculation, and
for a particular loop it
ran as xE = 223 .
xE is an int by the way.
For some reason this code always produces screenY =
600 ,
which should only be the case if xE = 0 .It happens because in integer division 420/2200 is always equal to zero. So, regardless of the value of xE, you're adding 420 + 180, which is 600.
any suggestions as to how i should help the VM get it right? Yes:
double value = 180.0 + (420.0 - ((420.0/ 2200.0)*xE));
screenY = (int)value;You can simplify all this, of course. Why not do that 420/2200 = 0.19090909... calculation once and just substitute the constant value?
%

Similar Messages

  • Quick (and urgent) Question about Intel G5's

    Just a quick question about the new intel G5's.
    I currently have bunch of software for my PPC G5 which is a Dual 2ghz. Software includes Adobe CS2, Macromedia Studio, Quark 6, etc, etc.
    If I purchase the new intel mac, would I be able to use the same software? or would I be forced to purchase a whole new set of everything I currently have?
    If the software will work on the intel G5, would it perform at the same rate/better than how it performs now on my PPC g5?
    Thanks in advance for any help.

    Rosetta:
    Most of the time you get a real 'hit' when a program first opens that is PPC. Very sluggish. They will require and use more memory than otherwise, too.
    Tests from last August aren't as helpful, there have been improvements, letting the Mac Pro pull even further ahead.
    http://www.barefeats.com/quad06.html
    Comparison Mac Models shows scores of all models. So there is 2x as much or more processing power, bandwidth, better video, as well as disk drives. A 'base' configuration would be 4-6GB RAM.
    And there are differences, more than between G4 and G5.
    People with experience would be Mac Pro Discussions
    Don't use Migration Assistant, and upgrade to CS3 etc. reinstall all your applications fresh.
    There are some drivers and plug-ins, that can be problems, and known.
    Mac Pro 2GHz 4GB 10K Raptor RAID Cinema HD   Mac OS X (10.4.9)   WD RE RAID Aaxeon FW800 PCIe MDD-G4 APC RS1500 Vista

  • A Quick and EZ question about Symbols

    Hi everyone! I have a really quick question:
    I'm making a cartoon movie at 30 fps. I've split up my
    cartoon character's body parts and I've made them into graphic
    symbols. I want the symbols to be as efficient and "right sized" as
    possible. So, as far as playback is concerned, what would you
    suggest I do:
    Make 1 symbol with 5 layers and 50 frames... (to be used by
    itself)
    OR
    Make 5 symbols with 1 layer and 50 frames?? (to be used all
    at once)
    Hopefully, my question is not too confusing. I'm basically
    asking what's better to do: use one large symbol by itself or many
    smaller symbols at once.
    It's important to me because eventually i could have all 7 of
    my cartoon characters on stage at once which would mean using 7
    large sized symbols at once or 35 smaller symbols at once
    The symbols are all mostly graphic symbols. And, when i'm
    done, my library will be containing hundreds of symbols.
    Note: I'll be converting the movie to video format so
    internet loading time isn't so much my concern as is general
    playback and avoiding "slowdown". I want to avoid lag at all costs.
    Thank you for the feedback in advance!!! :)
    Frank

    I really don't understand 100% what you are asking - when you
    say "large" what do you mean? file
    size or scale? And why would it matter? And what does "at
    once" mean? On the timeline at the same
    time? If so...why is that an issue?
    What do you want to do?
    If you are exporting to video then the issue of "slowdown and
    lag" is off the table as video is a
    fixed-frame rate format.
    Chris Georgenes / mudbubble.com / keyframer.com / Adobe
    Community Expert
    Fr8TrainAnim8tor wrote:
    > Hi everyone! I have a really quick question:
    >
    > I'm making a cartoon movie at 30 fps. I've split up my
    cartoon character's
    > body parts and I've made them into graphic symbols. I
    want the symbols to be as
    > efficient and "right sized" as possible. So, as far as
    playback is concerned,
    > what would you suggest I do:
    >
    > Make 1 symbol with 5 layers and 50 frames... (to be used
    by itself)
    > OR
    > Make 5 symbols with 1 layer and 50 frames?? (to be used
    all at once)
    >
    > Hopefully, my question is not too confusing. I'm
    basically asking what's
    > better to do: use one large symbol by itself or many
    smaller symbols at once.
    >
    > It's important to me because eventually i could have all
    7 of my cartoon
    > characters on stage at once which would mean using 7
    large sized symbols at
    > once or 35 smaller symbols at once
    >
    > The symbols are all mostly graphic symbols. And, when
    i'm done, my library
    > will be containing hundreds of symbols.
    >
    > Note: I'll be converting the movie to video format so
    internet loading time
    > isn't so much my concern as is general playback and
    avoiding "slowdown". I want
    > to avoid lag at all costs.
    >
    > Thank you for the feedback in advance!!! :)
    >
    > Frank
    >

  • Quick and easy question about creating folder

    Total Mac newbie with basic question.
    I want to put all my user manuals right on my desktop. All in a folder called user manuals. How would I do this? Smart folder? Just drag 'n drop? how can I quickly find them all?
    Thanks in advance!

    Hi MarieBoyer
    You can easily create a Folder on the desktop, by mouse click + contol to open the contextual menu, where you can choose New Folder, then give it a name.
    Or, more easily still just drag one of the existing folders onto the desktop and use it.
    As for finding all manual documents, they are just documents in general, and may not even have the word manual in their name, so searching by that criteria will in that case miss them. Otherwise you may have to search by each of their names, which would be rather tedious.
    So I suggest, of the manuals that you know of or come across, drag them into your new Folder on the desktop as you find them.
    regards roam

  • A quick and easy question about my NEW Ipod Touch.

    Okay, I broke down and replaced my old ipod. This new one came with earphones, a cord to connect it to my computer and a little plastic piece that obviously fits on one end of the ipod. Here's my question: WHAT IS IT FOR?
    Thanks in advance!
    Annie

    It's a dock adaptor. There are some devices (eg. speaker systems) which have a slot that fits the 30-pin dock connector for iPods, but the slot is the same size as the iPod Classic, as it is the largest iPod that is compatible with such systems. The dock adaptor that came with your iPod is supposed to fit around the base of your iPod and prevent it from being bent forwards or backwards, as this can damage or even break the dock connector.

  • Ok. quick and easy question about my Zen Vision

    i'm thinking that my zen can no longer have anything added to it, although there is about 5 gbs worth of space left. it sucks has sucked for a while, but i'm trying to get over it.
    my brother noticed that in the bottom of it, the part where it connects so you can make transfers and stuff, is bent. i tried unbending it but that didn't work.
    and when i connect it to my comp, it says "overload" and my comp freezes for a bit.
    so that's a sign to get another mp3 player right? it's a shame that this happened. he thinks i was too rough with it.
    i admit that i have spent some time pushing it in when it wasn't properly fitting. but i didn't "see" it then. now looking back, i kinda laugh.
    btw, there are no shops around here to repair the bend to the best of my knowledge..actually, maybe Weiss Hardware...just maybe.

    Yes. LOL You word it so much nicer!
    lol...
    if customer support actually does help, for a nice price, you will be -my new saviour-!
    (My music is literally my life.)
    OK. I checked there. They have an option of support (while the warranty is still good) and another option (that's non-technical).
    I got my first Zen Vision (30 GB) March 2007. Then a replacement (this one) in May 2007. Is it still covered? I have my doubts. :P?

  • Very quick and easy question

    I am making a catalogue, so I need a set of place-holder images which I am able to change he actual image on the following pages after the master one so that I can then move the master image place holders and have all the pages follow accordingly whilst respectivly keeping their different image assigned.
    In other words, is there any way I am able to set a 'place-holder' on master page, then assign different images to the following pages, then if I need to move the layout I can just move the place-holders on the master frame whilst keeping their own set images within the place holders.
    Thank you very much.

    There are a couple of approaches.
    Automatic page numbering is accomplished by putting a text frame on the master page and inserting a current page number marker. You can add additional information or text in the frame if you wish, and format to taste. The number will appear on all pages based on that master.
    Now for the different approaches. The first way is to just add them independently to each master page. However, if you use masters based on one or more other masters to control things that are basically the same (i.e. you have repeating elements on at least two masters, but something else that's different) you can create a "parent" page and put the numbers on that, then base other master pages on the parent, and everything on the parent will be included in the "child" page. You can Ctrl + Shift Click to select and remove an item if necessary. If you want to edit the repeating elements you do it on the parent page, and the change propagates through to the children.
    If you want to have some pages with no numbers you can either make special masters without numbers for them, or just override and delete the number frames on the live pages.
    Peter

  • HT201516 My iMac is running very slowly and it takes about 1 hour more to install stuff on it than my other imacs

    My iMac is running very slowly and it takes about 1 hour more to install stuff on it than my other imacs

    It would help us to help you if we could have some more technical info about your iMac.
    If you like, please go ahead and download, install and run Etrecheck.
    Etrecheck was developed as a simple Mac diagnostic report tool by a regular Apple Support forum user and technical support contributor named Etresoft. Etrecheck is a small, unobstrusive app that compiles a static snapshot of your entire Mac hardware system and installed software.
    This is a free app that has been honestly created to provided help in diagnosing issues with Macs running the new OS X 10.9 Mavericks.
    It is not malware and can be safely downloaded and installed onto your Mac.
    http://www.etresoft.com/etrecheck
    Copy/paste and post its report here in another reply thread so that we have a complete profile of your Mac's hardware and installed software so we can all help with your Mac performance issues.
    Thank You.

  • I have what is hopefully a quick and easy question. I kno...

    I have what is hopefully a quick and easy question. I know almost nothing about this stuff so go easy on me . All I need to do is find out if my DHCP is enabled. I'm having problems with my Xbox 360 and one of the possible problems is this DHCP thing. However I have no idea how to find the settings for my router on my computer. If it helps I have a Wirless model BEFW11S4. Thanks in advance for any help.

    You need to access your router to check if the DHCP is on.  To access the router open your browser and type in http://192.168.1.1 into the address field and hit enter.  That should open the routers log on screen and by default the user is left blank (some routers it is admin) and the password is abmin.  If you changed your routers password as you should for security reasons then use that password.  That will bring you to your routers user interface and on the main set up page should be your DHCP.
    Richard Aichner (Ikester)

  • HT1476 I have a big problem in my phone charger . I have Iphone 5s . I don't know what is the problem but the bettery is not working true . A decrease in the battery very quickly and then turns off the machine . Please, I want to address this problem quic

    I have a big problem in my phone charger . I have Iphone 5s . I don't know what is the problem but the bettery is not working true . A decrease in the battery very quickly and then turns off the machine . Please, I want to address this problem quickly .

    http://osxdaily.com/2013/09/19/ios-7-battery-life-fix/

  • In my iPhone 4s, since I updated to the latest iOS 6.1.2 I have noticed that my battery drains very quickly, and that after 15 days after date, I lost the cell signal, I have 3g, but I can not call or receive calls or sms. HELP!

    In my iPhone 4s, since I updated to the latest iOS 6.1.2 I have noticed that my battery drains very quickly, and that after 15 days after date, I lost the cell signal, I have 3g, but I can not call or receive calls or sms. HELP!
    Sorry for my bad english :S
    Please, please help me

    Contact the carrier.

  • My ipad's battery is going flat very quickly and is using a lot of data when I am barely using it - any suggestions?

    My ipad's battery is going flat very quickly and is using a lot of data when I am barely using it - any suggestions?

    This is likely coming from a third-party program. You can try to Reset Firefox. [[Reset Firefox – easily fix most problems]]

  • When I try to open a picture it does open but closes very quickly and the screen displays a black border with a white circle and a ! in the middle????? Help!!! GM

    WHEN I OPEN A PICTURE FROM IPHOTO IT CLOSES VERY QUICKLY AND A BLACK BORDER WITH A WHITE CIRCLE WITH AN ! IN THE MIDDLE OF IT. WHEN IT START A SLICE SHOW THE PICTURES ARE NOT THERE. HELP!!!!

    The ! turns up when iPhoto loses the connection between the thumbnail in the iPhoto Window and the file it represents.
    Other than that, what version of iPhoto do you have? Assuming 09 or later try
    Option 1
    Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Choose to Rebuild iPhoto Library Database from automatic backup.
    If that fails:
    Option 2
    Download iPhoto Library Manager and use its rebuild function. This will create a new library based on data in the albumdata.xml file. Not everything will be brought over - no slideshows, books or calendars, for instance - but it should get all your albums and keywords back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one. .
    Regards
    TD
    P.S. Please don't type in block capitals. They are harder to read and on the forum it looks like you're having a tantrum

  • I'm looking to buy a new Macbook Pro, and have questions about the Applecare extended warranty?

    I'm looking to buy a new Macbook Pro, and have questions about the Applecare extended warranty? I want to know if the 3 year extended warranty covers what damage. Like water damage, accidental damage, lost or stolen macbook, manufactory defects, or any other kind of damage, maybe be even cosmetic damage. Can anyone help me?

    If you are talking about features of the MBP itself, as long as you are not looking at  the Retina models, then the memory you can upgrade yourself for a lot less than Apple charges, and that does not affect the warranty as Apple considers memory a user permitted upgrade.  Great sources are Crucial and OWC, both are Mac specialists and have on-line videos on how to do the install.
    If the 15" is what you are looking at, a good upgrade is the 7200 rpm hard drive, gives a little better performance over the standard 5400 rpm drive.
    The Hi Res screen is good if you do a lot of graphics work.
    Comparing the 13" amd 15" you will notice the 15" has a second, discrete graphic processor...helps when you get into heavy duty videos, games, graphics...but keep in mind that kicking in the second processor uses a lot of power and will run the battery down faster.
    If you are looking at the Retina models, then keep in mind there are no post-purchase upgrade options...you have to buy with everything you want at the start.
    Just some thoughts.

  • IPad 2 losing power very quickly and feels warm.

    My iPad 2 (Model MC916B/A) has started to lose battery power very quickly and feels warmer than usual. I'm no teckie so can anyone offer straightforward help please?

    Here's a cheap, temporary solution available through Amazon

Maybe you are looking for

  • AIA 2.0.1 O2B Order synchronization fails after the SOA Upgrade to 10.1.3.4

    Hi, I have the AIA 2.0.1 installed on the system with the Order to Bill PIP flow working fine until I upgraded the SOA Suite from 10.1.3.3 to 10.1.3.4. After the SOA upgrade the order synchronization from CRM(8.1.1) to BRM(7.3) fails with the error m

  • I have problem in downloading and updating softwares

    The syndrome is: The first 99.96% of the softwares can be downloaded well and sound, but after that, they stopped. While, strangely enough, some of the softwares can fully download. I guess sth. happens to those can't at the moment of 99.96%. Help me

  • Problem in starting infrastructure and middletier

    on application server 10gAS(10.1.2.0.2) changed listener port number both on infrastructure tier and middletier. now when i run opmnctl startall command on infrastructure tier its taking too long than usual. please tell me whats the reason

  • Oracle Performance Manager error VTM-0002

    Hi, when i am trying to display charts using Oracle Performance Manager it's throwing errors like VTM-0002: Error displaying chart CPU Breakdown ODG-05185: Error: message decode: VP_START_COLLECT_REQ: vppcallbb failed can any one help?

  • Execution order of objects into a Portal page

    Hi, to all. I have a portal page (Oracle Portal 10.1.4) with many Areas (Items and Portlets). Every area contains one or more components (java portlet, plsql portlet, dynamic page, plsql item, html portlet and so on). Let say 5 areas and 10 objects.