(C++) std::pow
January 11, 2018 · View on GitHub
(C++) std::pow
std::pow is a mathematical STL function to take the power of two doubles.
To take the power of two integers, use IntPower instead.
Technical facts
Operating system(s) or programming environment(s)
Lubuntu 11.10 (oneiric)
C++ Builder 6.0
Enterprise edition
- G++ 4.6.1
Libraries used:
STL: GNU ISO C++ Library, version
4.6.1
Qt project file: CppPow.pro
#------------------------------------------------- # # Project created by QtCreator 2012-01-28T16:44:39 # #------------------------------------------------- QT += core QT -= gui TARGET = CppPow CONFIG += console CONFIG -= app_bundle TEMPLATE = app SOURCES += main.cpp
main.cpp
#include <cmath> #include <iostream> int main() { const double base = 1.1; const double exponent = 2.2; const double result = std::pow(1.1,2.2); std::cout << base << " to the power of " << exponent << " is " << result << '\n'; }