Skip to content

Instantly share code, notes, and snippets.

@physacco
Created September 19, 2016 11:33
Show Gist options
  • Select an option

  • Save physacco/9ff4c9916eab43f3f7e87a0992f15e31 to your computer and use it in GitHub Desktop.

Select an option

Save physacco/9ff4c9916eab43f3f7e87a0992f15e31 to your computer and use it in GitHub Desktop.

Revisions

  1. physacco created this gist Sep 19, 2016.
    18 changes: 18 additions & 0 deletions numeric_limits.cpp
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    #include <iostream>
    #include <limits>

    template <typename T>
    void test_limits() {
    T min = std::numeric_limits<T>::min();
    T max = std::numeric_limits<T>::max();
    std::cout << "min: " << min << std::endl;
    std::cout << "max: " << max << std::endl;
    }

    int main() {
    test_limits<int>();
    test_limits<long>();
    test_limits<float>();
    test_limits<double>();
    return 0;
    }