Pow {2.,} ???

This is a discussion on Pow {2.,} ??? within the C++ Programming forums, part of the General Programming Boards category; What does this function ? The ., is messing me up! I have never seen this syntax before....

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    52

    Pow {2.,} ???

    What does this function ? The ., is messing me up! I have never seen this syntax before.

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    A 2. is a double with the value of 2, whereas 2 is an int with a value of 2.

    But providing full context would make this less of a guess as to what you are asking.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  3. #3
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,048
    What does this function ?
    I don't think it's a function. It looks more like an initializer list.

    Maybe it looks something like this:
    Code:
    double Pow[size] = {2.,};
    If so, it initializes the first element in Pow to 2.0, and the others to 0.0.

    BTW, you can use 2.0 or (double)2 if it's more readable for you.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. What's the difference between pow() vs shift?
    By Overworked_PhD in forum C Programming
    Replies: 9
    Last Post: 01-06-2008, 01:04 PM
  2. Help with pow()
    By jedi_jinn in forum C Programming
    Replies: 7
    Last Post: 10-09-2006, 03:17 AM
  3. trying to use pow()
    By Mikecore in forum C Programming
    Replies: 9
    Last Post: 10-09-2005, 07:30 PM
  4. pow function returns wrong value
    By ckbales in forum C Programming
    Replies: 5
    Last Post: 02-01-2003, 09:46 PM
  5. Problem with pow()
    By RMacFly in forum C Programming
    Replies: 4
    Last Post: 09-18-2001, 12:54 PM

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