improve example.cpp
fix std::abs in gcc
fix version check in msvc