(Error in documentation?) Math operator precedence problem

Hello,
I apologize in advance, while I do know programming (I'm a PHP and Perl programmer) I'm fairly new to Java so this may well be a silly question, but that's why I am here. I hope you'll show me where my error is so I can finally set this to rest before it drives me mad :)
(Also, I hope I'm posting this in the right forum?)
So, I am taking a Java class, and the question in the homework related to operand precendence. When dealing with multiplication, division and addition, things were fine, the documentation is clear and it also makes sense math-wise (multiplication comes before addition, etc etc).
However, we got this exercise to solve:
If u=2, v=3, w=5, x=7 and y=11, find the value assuming int variables:
u++ / v+u++ *w
Now, according to the operator precedence table (http://docs.oracle.com/javase/tutorial/java/nutsandbolts/operators.html) the unary operator u++ comes first, before multiplication, division and addition.
This would mean I could rewrite the exercise as:
((u+1)/v) + ((u+1)*w) = (3/3) + (4*5) = 1+20 = 21
However, if I run this in Java, the result I get is 15.
I tried breaking up the result for the two values in the Java code, so I could see where the problem is with my calculation.
For
System.out.println(u++ /v);
I get 0
For
System.out.println("u++ *w");
I get 15
My professor suggested I attempt to change the values from int to float, so I can see if the division came out to be something illogical. I did so, and now I get:
For
System.out.println(u++ /v);
I get 0.66667
For
System.out.println("u++ *w");
I get 15.0000
Which means that for the first operation (the division) the division happens on 2/3 (which is 0.6667) and only afterwards the u value is increased. That is, the u++ operation is done after the division, not before. The same happens with the multiplication; when that is carried out, the value of u is now 3 (after it was raised by one in the previous operation) and the first to be carried out is the multiplication (3*5=15) and only then the u++.
That is entirely against the documentation.
This is the script I wrote to test the issue:
public class MathTest {
     public static void main (String [] args) {
          float u=2, v=3, w=5, x=7, y=11;
          System.out.println("Initial value for 'u': " + u);
          float tmp1 = u++ /v;
          System.out.println("u++ /v = " + tmp1);
          System.out.println("First ++ value for 'u': " + u);
          float tmp2 = u++ *w;
          System.out.println("u++ *w= " + tmp2);
          System.out.println("Second ++ value for 'u': " + u);
          System.out.println(tmp1+tmp2);
The output:
Initial value for 'u': 2.0
u++ /v = 1.0
First ++ value for 'u': 3.0
u++ *w= 20.0
Second ++ value for 'u': 4.0
21.0
Clearly, the ++ operation is done after the division and after the multiplication.
Am I missing something here? Is the documentation wrong, or have I missed something obvious? This is driving me crazy!
Thanks in advance,
Mori

>
The fact that u++ is evaluated but in the calculation itself the "previously stored" value of u is used is completely confusing.
>
Yes it can be confusing - and no one is claiming otherwise. Here are some more thread links from other users about the same issue.
Re: Code Behavior is different in C and Java.
Re: diffcult to understand expression computaion having operator such as i++
Operator Precedence for Increment Operator
>
So, when they explain that ++ has a higher precedence, the natural thing to consider is that you "do that first" and then do the rest.
>
And, as you have discovered, that would be wrong and, to a large degree, is the nut of the issue.
What you just said illustrates the difference between 'precedence' and 'evaluation order'. Precedence determines which operators are evaluated first. Evaluation order determines the order that the 'operands' of those operators are evaluated. Those are two different, but related, things.
See Chapter 15 Expressions
>
This chapter specifies the meanings of expressions and the rules for their evaluation.
>
Sections in the chapter specify the requirements - note the word 'guarantees' in the quoted text - see 15.7.1
Also read carefully section 15.7.2
>
15.7. Evaluation Order
The Java programming language guarantees that the operands of operators appear to be evaluated in a specific evaluation order, namely, from left to right.
15.7.1. Evaluate Left-Hand Operand First
The left-hand operand of a binary operator appears to be fully evaluated before any part of the right-hand operand is evaluated.
If the operator is a compound-assignment operator (§15.26.2), then evaluation of
the left-hand operand includes both remembering the variable that the left-hand
operand denotes and fetching and saving that variable's value for use in the implied
binary operation.
15.7.2. Evaluate Operands before Operation
The Java programming language guarantees that every operand of an operator (except the conditional operators &&, ||, and ? appears to be fully evaluated before any part of the operation itself is performed.
15.7.3. Evaluation Respects Parentheses and Precedence
The Java programming language respects the order of evaluation indicated explicitly by parentheses and implicitly by operator precedence.
>
So when there are multiple operators in an expression 'precedence' determines which is evaluated first. And, the chart in your link shows 'postfix' is at the top of the list.
But, as the quote from the java language spec shows, the result of 'postfix' is the ORIGINAL value before incrementation. If it makes it easier for then consider that this 'original' value is saved on the stack or a temp variable for use in the calculation for that operand.
Then the evalution order determines how the calculation proceeds.
It may help to look at a different, simpler, but still confusing example. What should the value of 'test' be in this example?
i = 0;
test = i++; The value of 'test' will be zero. The value of i++ is the 'original' value before incrementing and that 'original' value is assigned to 'test'.
At the risk of further confusion here are the actual JVM instructions executed for your example. I just used
javap -c -l Test1to disassemble this. I manually added the actual source code so you can try to follow this
        int u = 2;
   4:iconst_2       
   5:istore  5
        int v = 3;
   7:iconst_3       
   8:istore          6
        int w = 5;
  10:iconst_5       
  11:istore          7
        int z;
        z = z = u++ / v + u++ * w;
   13:  iload   5
   15:  iinc    5, 1
   18:  iload   6
   20:  idiv
   21:  iload   5
   23:  iinc    5, 1
   26:  iload   7
   28:  imul
   29:  iadd
   30:  dup
   31:  istore  8
   33:  istore  8The Java Virtual Machine Specification has all of the JVM instructions and what they do.
http://docs.oracle.com/javase/specs/jvms/se7/jvms7.pdf
Your assignment to z and formula starts with line 13: above
13: iload 5 - 'Load int from local variable' page 466
15: iinc 5, 1 - 'Increment local variable by constant' page 465
18: iload 6 - another load
20: idiv - do the division page
21: iload 5 - load variable 5 again
23: iinc 5, 1 - inc variable 5 again
26: iload 7 - load variable 7
28: imul - do the multiply
29: iadd - do the addition
30: dup - duplicate the top stack value and put it on the stack
31: istore 8 - store the duplicated top stack value
33: istore 8 - store the original top stack value
Note the description of 'iload'
>
The value of the local variable at index
is pushed onto the operand stack.
>
IMPORTANT - now note the description of 'iinc'
>
The value const is first sign-extended to an int, and then
the local variable at index is incremented by that amount.
>
The 'iload' loads the ORIGINAL value of the variable and saves it on the stack.
Then the 'iinc' increments the VARIABLE value - it DOES NOT increment the ORIGINAL value which is now on the stack.
Now note the description of 'idiv'
>
The values are popped
from the operand stack. The int result is the value of the Java
programming language expression value1 / value2. The result is
pushed onto the operand stack.
>
The two values on the stack include the ORIGINAL value of the variable - not the incremented value.
The above three instructions explain the result you are seeing. For postfix the value is loaded onto the stack and then the variable itself (not the loaded original value) is incremented.
Then you can see what this line does
  21:  iload   5 - load variable 5 againIt loads the variable again. This IS the incremented value. It was incremented by the 'iinc' on line 15 that I discussed above.
Sorry to get so detailed but this question seems to come up a lot and maybe now you have enough information and doc links to explore this to any level of detail that you want.

Similar Messages

  • HT1222 I am trying to update my phone so I can save my info on my old phone & get a new phone, but I get a error that says "There was a problem with downloading teh software, the network connection timed out.."  HELP!  Not sure what my settings shoud be..

    I am trying to update my phone so I can save my info on my old phone & get a new phone, but I get a error that says "There was a problem with downloading teh software, the network connection timed out.."  HELP!  Not sure what my settings shoud be...
    I never updated anything until now...I want o update my iPhone to the newest version, but i do not want ot loose all that I have on this phone. I was told I needed to update the operating systems so i can put things into the cloud for transport to new phone, but I am just not sure how to do this..Can you help out here??

    Dear Jody..jone5
    Good for you that can't update your iphone because I did it and my iphone dosen't work for example I can't download any app like Wecaht or Twitter..
    Goodluck
    Atousa

  • Error while consolidating (The operation couldn't be completed. Permission denied)

    I have just bought a new MacBook and that has given me extra harddrive space, and now I am trying to consolidate some masters in Aperture, that I have on my Time Capsule. But I get this error:
    Error while consolidating (The operation couldn’t be completed. Permission denied)
    I can access my Time Capsule in Finder perfectly well. Can anyone help?

    I think that error was due to the fact that I hadn't upgraded MAC OSX after installing it. I have done that now and now I get another error saying the masters are offline.
    I found this old thread: https://discussions.apple.com/thread/1965601?start=0&tstart=0 which seems to be the same problem. This is a whole other topic so I will start a new thread, but leave this in case anyone gets the same problem as me. Upgrade your OSX. That's the solution :-)

  • TNS-12560: TNS:protocol adapter error, ORA-12535: TNS:operation timed out

    I installed Oracle 9i (9.2.0.1.0) on a Windows XP machine (the machine is in a domain). There were no errors during the instalation, but I have problems connecting from the same machine using the sid. Here are some examples from a command promt:
    D:\>tnsping orcl9i
    TNS Ping Utility for 32-bit Windows: Version 9.2.0.1.0 - Production on 31-OCT-20
    08 17:43:22
    Copyright (c) 1997 Oracle Corporation.  All rights reserved.
    Used parameter files:
    Used TNSNAMES adapter to resolve the alias
    Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)
    (HOST = timisoara01)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = orcl9i)))
    TNS-12560: TNS:protocol adapter error
    D:\>sqlplus "sys/pass@orcl9i as sysdba"
    SQL*Plus: Release 9.2.0.1.0 - Production on Fri Oct 31 17:54:54 2008
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    ERROR:
    ORA-12535: TNS:operation timed out
    Enter user-name:If I don't use the sid I can connect:
    D:\>sqlplus "sys/pass as sysdba"
    SQL*Plus: Release 9.2.0.1.0 - Production on Fri Oct 31 18:05:46 2008
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
    With the OLAP and Oracle Data Mining options
    JServer Release 9.2.0.1.0 - Production
    SQL>If I go to services I see that the service is running: OracleServiceORCL9I Started.
    Thx.

    Yes, the XP firewall is running. During the Oracle instalation it poped up twice, but I selected 'Unblock'. I can't turn it off because it is running using the domain settings, but I can add exceptions (programs or ports). Port 1521, tnsping or sqlplus are not blocked and there is an option 'Display a notification when Windows Firewall blocks a program' witch is checked.

  • I get the error message in QuickTime "operation stopped the operation is not supported for this media" most times when I try and export an .AVI file as something else (.m4v). I have not touched the file in any way (no trimming, clipping or other editing)

    I get the error message in QuickTime "operation stopped the operation is not supported for this media" most times when I try and export an .AVI file as something else (e.g. .m4v). I have not touched the file in any way (no trimming, clipping or other editing), all I want QuickTime to do is export the file in a compressed format. Bizzarely, if I shutdown and open QuickTime many times I can occasionally export a clip as another format (maybe one in 10 times). I have seen that other users have had a similar problem after clipping files in QuickTime but this seems to be a slightly different bug in that all I do is open the file and then try and export the file as is - either way, this is a very annoying bug

    @Z_B-B, thank you for taking the time to respond to my cry for help. However, the link you supplied does not address the problem: I am not trying to export from Final Cut Pro to QuickTime, I am trying to export from QuickTime to the rest of the world (like people's iPhones and Ipads) in .m4v format (so I am not emailing my freinds such huge files).
    If I were to spend hundreds of Dollars on a copy of Final Pro I could export directly from there and not have to bother with QuickTime, but I do not take enough video clips to justify the cost. I must say that I never had any of these problems before I decided to switch from Snow Leopard to Mountai Lion.

  • Could not open error log file ''. Operating system error = 5(failed to retrieve text for this error. Reason: 15105).

    Hello
    When I try to start the SQl server service i get the following error:
    Event id 17058
    Could not open error log file ''. Operating system error = 5(failed to retrieve text for this error. Reason: 15105).
    As a test I have made sure the errorlog file ,and the entire drive it is, has everyone full control permissions, but to no avail. Does anyone have any ideas to resolve this issue?
    Thank you

    Hi,
    Try running:
    SELECT SERVERPROPERTY('ErrorLogFileName')
    Then verify that the account being used to run the SQL Server service account has access to the path output above.  If possible, you could try logging onto the server with the same account used to run SQL Server then navigate to the errorlog folder.
    Thanks,
    Andrew Bainbridge
    SQL Server DBA
    Please click "Propose As Answer" if a post solves your problem, or "Vote As Helpful" if a post has been useful to you

  • ERROR [B3108]: Unrecoverable out of memory error during a cluster operation

    We are using Sun Java(tm) System Message Queue Version: 3.5 SP1 (Build 48-G). We are using two JMS servers as a cluster.
    But we frequently getting the out of memory issue during the cluster operation.
    Messages also got queued up in the Topics. Eventhough listeners have the capability to reconnect with the Server after the broker restarting, usually we are restarting consumer instances to get work this.
    Here is detailed log :
    Jan 5 13:45:40 polar1-18.eastern.com imqbrokerd_cns-jms-18[8980]: [ID 478930 daemon.error] ERROR [B3108]: Unrecoverable out of memory error during a cluster operation. Shutting down the broker.
    Jan 5 13:45:57 polar1-18.eastern18.chntva1-dc1.cscehub.com imqbrokerd: [ID 702911 daemon.notice] Message Queue broker terminated abnormally -- restarting.
    Expecting your attention on this.
    Thanks

    Hi,
    If you do not use any special cmdline options, how do you configure your servers/
    brokers to 1 Gb or 2 Gb JVM heap ?
    Regarding your question on why the consumers appear to be connecting to just
    one of the brokers -
    How are the connection factories that the consumers use configured ?
    Is the connection factory configured using the imqAddressList and
    imqAddressListBehavior attributes ? Documentation for this is at:
    http://docs.sun.com/source/819-2571/ref_adminobj_props.html#wp62463
    imqAddressList should contain a list of brokers (i.e. 2 for you) in the cluster
    e.g.
    mq://server1:7676/jms,mq://server2:7676/jms
    imqAddressListBehavior defines how the 2 brokers in the above list are picked.
    The default is in the order of the list - so mq://server1:7676/jms will always be
    picked by default. If you want random behavior (which will hopefully even out the
    load), set imqAddressListBehavior to RANDOM.
    regards,
    -i
    http://www.sun.com/software/products/message_queue/index.xml

  • Create process error 740 the requested operation requires elevation

    Hi Friends,
    I'm trying to launch Virtual KeyBoard from my application. I'm using jdk1.6.0_02. (I also tried on jdk1.3 , which throws same exception as of jdk1.6.0_02)
    try{
                Runtime.getRuntime().exec("C:\\Windows\\system32\\osk.exe");
            catch(IOException ex){
                System.out.println(ex.getMessage());This works fine on Windows XP , but on Windows Vista it throws exception :
    Can not run Program "C:\Windows\System32\osk.exe" :create process error 740 the requested operation requires elevation
    It works on Vista if I turn off user Account control from User Account in ControlPanel.
    While If I try to launch (Calculator)Calc.exe instead of (Virtual KeyBoard)osk.exe then it launch successfully without turning off User Account Control.
    Does any one has an idea how can I launch Virtual Keyboard ("osk.exe") without turning off user Account Control on Windows Vista.
    I'll appreciate any help regarding this topic.
    Thanks.

    Thanks for your promt reply.
    The llink you write is not launching the page.
    My question is why it launching Calculator without any privillage, while it has problem in launching Visual KeyBoard.
    Thanks

  • SharePoint 2013 - Server Error in '/' Application - This operation can be performed only on a computer that is joined to a server farm by users who have permissions in SQL Server to read from the configuration database

    Hi
    After I ran SharePoint configuration wizard successfully to upgrade to SharePoint 2013 / SP1.
    I can open Central Administration site just fine.
    but now when I open any Site collection,  I got this error.
    Server Error in '/' Application
    This operation can be performed only on a computer that is joined to a server farm by users who have permissions in SQL Server to read from the configuration database. To connect this server to the server farm, use the SharePoint Products Configuration
    Wizard, located on the Start menu in Microsoft SharePoint 2010 Products
    I have restarted all the servers:  SQL server, WFE and APP servers but still cann't get this resolve.
    Services on all servers are running,  IIS - application pools are running.
    Can someone help with where that could be a problem or if there is a solution.
    Thanks in advance for your comments or advices.
    Swanl

    Please verify the followings:
    Make sure that from the SharePoint front end and application servers that you can ping your SQL server.
    Make sure that your Farm account has permission to the configuration database.
    Lastly verify that your database didn't for some reasons go into recovery mode.
    once everything is fine and you are still having issues, restart the SQL host service on the SQL server.
    Once the service is restarted you will need to reboot Central Admin and then your front end servers.
    In addition, as you built your farm inside the firewall, please disable the firwall, or create rules for SQL Server service in the firwall on SQL server.
    More information about creating rules in firewall, please refer to the following posts: http://social.technet.microsoft.com/Forums/en-US/c5d4d0d0-9a3b-4431-8150-17ccfbc6fb82/can-not-create-data-source-to-an-sql-server http://www.mssqltips.com/sqlservertip/1929/configure-windows-firewall-to-work-with-sql-server/
    Here is a similar post for you to take a look at: http://social.technet.microsoft.com/Forums/en-US/ea54e26c-1728-48d4-b2c5-2a3376a1082c/this-operation-can-be-performed-only-on-a-computer-that-is-joined-to-a-server-farm-by-users-who-have?forum=sharepointgeneral 
    Please 'propose as answer' if it helped you, also 'vote helpful' if you like this reply.

  • DPM encountered an error while performing an operation for \\?\Volume{fc1f0549-9865-4349-b4df-8596a19ad7fe}\FolderPath\Work\ on FileServer (ID 2033 Details: The system cannot find the path specified (0x80070003))

    DPM encountered an error while performing an operation for \\?\Volume{fc1f0549-9865-4349-b4df-8596a19ad7fe}\FolderPath\Work\ on FileServer (ID 2033 Details: The system cannot find the path specified (0x80070003))
    Can I know what this mean? It completely fail all entire job.
    Backup was on half way go, it already took about 3TB data and it fail.

    Hi Oneoa,
    Please verify the antivirus exeptions. Look at this two links for more information:
    http://technet.microsoft.com/en-us/library/ff399439.aspx
    http://support.microsoft.com/kb/928840
    I hope this solves your problem, please post your progress so I may assist you further.
    Best Regards
    Robert Hedblom
    MVP DPM
    Check out my DPM blog @ http://robertanddpm.blogspot.com

  • Failed to mount database "General Users". Error: An Active Manager operation failed

    Failed to mount database "General Users". Error: An Active Manager operation failed. Error: The database action failed. Error: Database 'General Users' on server 'EX02' cannot be mounted due to a previous error: At '12/3/2014
    3:52:17 PM' the Exchange store database 'General Users' copy on this server appears to be inconsistent with the active database copy or is corrupted. For more details about the failure, consult the Event log on the server for other storage and "ExchangeStoreDb"
    events. A successful failover restored service. If you have addressed the underlying problem, or if you have decided to attempt to mount the database despite this error, the mount operation may be attempted by using the '-Force' parameter of the Mount-Database
    cmdlet. [Database: General Users, Server: EX02.domain.com]
    Md. Ramin Hossain

    Hi,
    From your description, it is recommended to suspend the failed database copy at first using the cmdlet below.
    Suspend-MailboxDatabaseCopy -Identity "xxx"
    And then reseed the database with a new copy using Update-MailboxDatabaseCopy -Identity "xxx" -DeleteExistingFiles cmdlet.
    What's more, here is a helpful thread for your reference.
    Update-MailboxDatabaseCopy
    http://technet.microsoft.com/en-us/library/dd335201(v=exchg.150).aspx
    Hope this can be helpful to you.
    Best regards,
    Amy Wang
    TechNet Community Support

  • HT5568 when i try to install the Safari 6.0.2 update i get the message an error has occured The operation couldn't be completed. (NSURLErrorDomain error -3001.)(102) - can anyone help my get the update please

    when I try to install this update I get the message an error has occured The operation couldn’t be completed. (NSURLErrorDomain error -3001.)(102) - can anyone help my get the update please?

    There are problems with the servers. Download and install that update > http://swcdn.apple.com/content/downloads/53/02/041-8081/2jwp4wjrwygtm4lc608qy4h0 n4a9yyq37g/Safari6.0.2Mountain.pkg

  • Math Operations on LV for Palm

    I am trying to write a program for a Treo 680 running PalmOS 5.4 (Garnet) using LV for PDA 8.0, and I observe some strange behavior in math operations. The test that I did was to calculate B = log10(A). Both A and B are defined as DBL. The B field is programmed to show 16 decimal places. When I run this program on the PC, I get the following results:
    log10(10) = 1.0000000000000000
    log10(50) = 1.6989700043360187
    log10(100)= 2.0000000000000000
    When I run the same program on the Treo (or on Palm OS Garnet Simulator - same results), I get
    log10(10) = 1.0000000000
    log10(50) = 1.2694732747
    log10(100)= 2.0000000000
    A couple more interesting results:
    log10(72) = 1.4278357668
    log10(73) = 1.0043294009
    Two questions:
    1) Why do the results on Palm have only 10 decimal places?
    2) Why are non-integer results so far from the correct values?
    A few notes:
    1) This is not a question of DBL vs. SGL: log10(50) in SGL arithmetic is 1.6989699602127075
    on the PC - the difference starts only in the 7th decimal place.
    2) I have MathLib.prc installed on the Treo (and on the simulator).
    3) The Palm calculator works correctly: e.g. log10(50) = 1.698970004336
    TIA,
    Sergey

    Cepera wrote:
    I mean, how can you have a bug in such a fundamental operation as log(a)?
    As mentioned, the PDA module converts your code to C, which is an error prone process.
    Couple that with the fact that the PDA module has a relatively small market (and the Palm version an even smaller one, as evidenced by its scrubbing), and you can see how bugs like this can slip through the cracks. As you mentioned, the error does not occur for all values of a.
    Try to take over the world!

  • Error: Overloading ambiguity between "operator+(const RWCString&, const RWC

    We always get the following error when we are compiling our source codes:
    Error: Overloading ambiguity between "operator+(const RWCString&, const RWCString&)" and "RWCString::operator const char*() const"
    Our compiler is Workshop 6 update 1. We can compile the same source codes in Workshop 5.0. We found out that we can solve this problem if we explicitly cast the const strings to RWCString. However, since we are building on previous source codes and modules, we find this solution close to impossible. Is there other solution for this problem? Are there any patch which we can use?
    Thanks!

    The code really does have an ambiguity in it.
    The RWCString class operator() member function, which you invoke as str1(...) with an integer value, returns a char. You then have the operation
            RWCString + char
    The RWCString class does not have an associated operator+ that takes a RWCString and a character. The compiler could convert the string to a char* via "operator const char*" and add the value of the char to it, or it could convert the char to a RWCString via a constructor and use the operator+ that takes two RCWCstrings.
    The compiler has no way to prefer one choice over the other.
    You can write an explicit cast, or you can store the result of the str1(...) operation in an explicit RWCString temp, or you could use the += operator:
    str2 = str2 + RWCString(str1(str1.length()-1));
    RWCString temp = str1(str1.length()-1);
    str2 = str2 + temp;
    str2 += str1(str1.length()-1);
    BTW, this problem illustrates why it's usually a bad idea to have multiple constructors and also type conversion operators in a class. It's hard to write code that doesn't lead to ambiguities.

  • Why do I get an error msg that reads "operation not allowed" whenever I try to Remove Attributes from my timeline?

    On any given project, whenever I select everything in my timeline and try to remove all the attributes, I get an error message that reads "operation not allowed."
    If I select a smaller chuck of files on my timeline and hit remove attributes, it works, but this isn't the case if I select everything in my timeline.
    How do I fix this? Thanks!

    Have you tried trashing your Final Cut Pro preferences? It is usually the first step when FCP begins to act in unexpected ways.
    Download Preference Manager (free) from Digital Rebellion
    http://www.digitalrebellion.com/prefman/
    and use it to trash your preferences - they will be set to default the next time you open FCP.
    If that does not remedy the problem, do you have any still images in your timeline that are not RGB, or are greater than 4000 pixels in the widest dimension?
    Is your source material in an FCP7 edit friendly codec?
    MtD

Maybe you are looking for