In this exercises you will familiarize with basic proprerties of floating point represantation
- count the number of floating points between two of them
- extract the exponent of a float
-
produce NaN and inf, verify the value of their exponent
#include<iostream> #include<iomanip> #include<cmath> #include<limits> #include<cstdio> #include<cstring> int count(float x, float e) { // fill in } int exponent(float x) { // fill in } int main() { std::cout << count(.1f,1.f) << std::endl; std::cout << count(2.f,3.f) << std::endl; return 0; }