|
|
(One intermediate revision by one other user not shown) |
Line 1: |
Line 1: |
| ==NumericTraits.cxx== | | {{warning|1=The media wiki content on this page is no longer maintained. The examples presented on the https://itk.org/Wiki/* pages likely require ITK version 4.13 or earlier releases. In many cases, the examples on this page no longer conform to the best practices for modern ITK versions. |
| <source lang="cpp">
| | }} |
| #include "itkNumericTraits.h"
| |
|
| |
|
| int main(int, char* [] )
| | [https://itk.org/ITKExamples[ITK Sphinx Examples]] |
| {
| |
| std::cout << "Min: " << itk::NumericTraits< float >::min() << std::endl;
| |
| std::cout << "Max: " << itk::NumericTraits< float >::max() << std::endl;
| |
| std::cout << "Zero: " << itk::NumericTraits< float >::Zero << std::endl;
| |
| std::cout << "Zero: " << itk::NumericTraits< float >::ZeroValue() << std::endl;
| |
| std::cout << "Is -1 negative? " << itk::NumericTraits< float >::IsNegative(-1) << std::endl;
| |
| std::cout << "Is 1 negative? " << itk::NumericTraits< float >::IsNegative(1) << std::endl;
| |
| std::cout << "One: " << itk::NumericTraits< float >::One << std::endl;
| |
| std::cout << "Epsilon: " << itk::NumericTraits< float >::epsilon() << std::endl;
| |
| std::cout << "Infinity: " << itk::NumericTraits< float >::infinity() << std::endl;
| |
| | |
| if(0 == itk::NumericTraits< float >::infinity())
| |
| {
| |
| std::cout << " 0 == inf!" << std::endl;
| |
| }
| |
| else
| |
| {
| |
| std::cout << "Good" << std::endl;
| |
| }
| |
|
| |
| return EXIT_SUCCESS;
| |
| }
| |
| </source>
| |
| | |
| {{ITKCMakeLists|NumericTraits}}
| |