Thread: vector<double> ranges

  1. #1
    TransparentMember correlcj's Avatar
    Join Date
    Jun 2002
    Posts
    378

    Question vector<double> ranges

    Greetings,
    I am trying to find some examples of a range of values stored in a vector<double>, i mean the difference between the largest value and smallest value. Can anyone show me some simple examples that i can learn from?
    "Be formless, shapeless, like water... You put water into a cup, it becomes the cup, you put water into a bottle, it becomes the bottle, you put it in a teapot, it becomes the teapot... Now water can flow, or it can crash, be water my friend."
    -Bruce Lee

  2. #2
    Evil Member
    Join Date
    Jan 2002
    Posts
    638
    Then you want the properties for a double. The fact that they are stored in a vector is of no consequence.

    So you want to get the numeric_limits, a la...

    Code:
    cout << numeric_limits<double>::max() << '\n';
    cout << numeric_limits<double>::min() << '\n';

  3. #3
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793


    What...you mean the biggest & smallest values in a double??

    Code:
    #include <iostream>
    #include <limits>
    
    int main(){
    
    	typedef std::numeric_limits<double> lim;
    
    	std::cout << lim::max() << std::endl;	
    	
    	std::cout << lim::min() << std::endl;
    	
    }
    <edit> Doh..beaten </edit>

  4. #4
    TransparentMember correlcj's Avatar
    Join Date
    Jun 2002
    Posts
    378

    Thanks guys!

    thanks for your input!
    "Be formless, shapeless, like water... You put water into a cup, it becomes the cup, you put water into a bottle, it becomes the bottle, you put it in a teapot, it becomes the teapot... Now water can flow, or it can crash, be water my friend."
    -Bruce Lee

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. strange error in inputting numbers from .txt file
    By angelica in forum C++ Programming
    Replies: 8
    Last Post: 04-10-2008, 11:28 PM
  2. Asserts and their ranges
    By Matamoros123 in forum C++ Programming
    Replies: 8
    Last Post: 10-07-2006, 12:32 PM
  3. C Ranges
    By EvoTone in forum C Programming
    Replies: 20
    Last Post: 09-28-2006, 05:40 AM
  4. iterators cursors and ranges in STL
    By superchritch in forum C++ Programming
    Replies: 0
    Last Post: 09-20-2005, 09:03 AM
  5. data type ranges, what is the largest?
    By timberwolf5480 in forum C++ Programming
    Replies: 9
    Last Post: 10-16-2003, 05:47 PM