Area of a circle error, help

This is a discussion on Area of a circle error, help within the C Programming forums, part of the General Programming Boards category; Geez, people. area = PI*(d_gasket*d_gasket-d_hole*d_hole)/4.0 is the correct formula as long as the #define for PI is corrected....

  1. #16
    Registered User
    Join Date
    Sep 2008
    Location
    Toronto, Canada
    Posts
    1,831
    Geez, people.
    area = PI*(d_gasket*d_gasket-d_hole*d_hole)/4.0
    is the correct formula as long as the #define for PI is corrected.

  2. #17
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by nonoob View Post
    Geez, people.
    area = PI*(d_gasket*d_gasket-d_hole*d_hole)/4.0
    is the correct formula as long as the #define for PI is corrected.
    It may be the correct mathamatical formula but it may not code in C as you would do it by hand.

    The sequence plays left to right... but in computer space you need some things done before others for it to make any sense...

    area = (PI * ((d_gasket * d_gasket) - (d_hole * d_hole) )) / 4;

    It's about the C language "Order of Evaluation" rules.
    Last edited by CommonTater; 09-14-2010 at 06:29 PM.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. area of a circle
    By wise_ron in forum C Programming
    Replies: 2
    Last Post: 10-02-2006, 03:15 PM
  2. Circle Area
    By Zophixan in forum C++ Programming
    Replies: 3
    Last Post: 11-05-2002, 11:50 AM
  3. Whats wrong with my find Circle Area program?[compiles fine]
    By Golden Bunny in forum C++ Programming
    Replies: 22
    Last Post: 06-16-2002, 02:49 PM
  4. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21