d07 ex00 ok

This commit is contained in:
hugogogo
2022-03-10 17:35:52 +01:00
parent 31c9d8af06
commit a8b1a6af1b
7 changed files with 127 additions and 36 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -1,36 +0,0 @@
#include <iostream>
#include <limits>
#include <cfloat>
#include <cmath>
#define MAX_INT 2147483647
#define MIN_INT -2147483648
#define MAX_FLOAT 340282346638528859811704183484516925440.0f
#define MIN_FLOAT -340282346638528859811704183484516925440.0f
void isFloat(double d) {
if (! (d <= std::numeric_limits<float>::max()
&& d >= std::numeric_limits<float>::min()) )
{
std::cout << d << "is outside range of floats\n";
return ;
}
std::cout << std::fixed << static_cast<float>(d) << "\n";
}
int main() {
double d;
double d2;
d = std::numeric_limits<float>::max();
std::cout << std::fixed << d << "\n";
d2 = std::nextafter(d, DBL_MAX);
std::cout << std::fixed << d2 << "\n";
// isFloat(MAX_FLOAT);
// d = std::numeric_limits<float>::lowest();
// std::cout << std::fixed << d << "\n";
// isFloat(d);
return 0;
}