#include <iostream>
using namespace std;
int main( )
{
{
int i = 0 ;
float epsilon_f = 1.0 ;
while ( 1.0f + epsilon_f > 1.0f )
{
epsilon_f = epsilon_f / 2.0f ;
i++ ;
}
cout << "Machine epsilon for float type: " << epsilon_f << endl;
cout << "The amount of iterations for float type: " << i << endl;
}
{
int i = 0 ;
float epsilon_f = 1.0 ;
while ( 1.0 + epsilon_f > 1.0 )
{
epsilon_f = epsilon_f / 2.0 ;
i++ ;
}
cout << "Machine epsilon for double type: " << epsilon_f << endl;
cout << "The amount of iterations for double type: " << i << endl;
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKCkKewogICAgewogICAgICAgIGludCBpID0gMDsKICAgICAgICBmbG9hdCBlcHNpbG9uX2YgPSAxLjA7CiAgICAgICAgd2hpbGUoMS4wZiArIGVwc2lsb25fZiA+IDEuMGYpCiAgICAgICAgewogICAgICAgICAgICBlcHNpbG9uX2YgPSBlcHNpbG9uX2YgLyAyLjBmOwogICAgICAgICAgICBpKys7CiAgICAgICAgfQogICAgICAgIGNvdXQgPDwgIk1hY2hpbmUgZXBzaWxvbiBmb3IgZmxvYXQgdHlwZTogIiA8PCBlcHNpbG9uX2YgPDwgZW5kbDsKICAgICAgICBjb3V0IDw8ICJUaGUgYW1vdW50IG9mIGl0ZXJhdGlvbnMgZm9yIGZsb2F0IHR5cGU6ICIgPDwgaSA8PCBlbmRsOwogICAgfQogICAgewogICAgICAgIGludCBpID0gMDsKICAgICAgICBmbG9hdCBlcHNpbG9uX2YgPSAxLjA7CiAgICAgICAgd2hpbGUoMS4wICsgZXBzaWxvbl9mID4gMS4wKQogICAgICAgIHsKICAgICAgICAgICAgZXBzaWxvbl9mID0gZXBzaWxvbl9mIC8gMi4wOwogICAgICAgICAgICBpKys7CiAgICAgICAgfQogICAgICAgIGNvdXQgPDwgIk1hY2hpbmUgZXBzaWxvbiBmb3IgZG91YmxlIHR5cGU6ICIgPDwgZXBzaWxvbl9mIDw8IGVuZGw7CiAgICAgICAgY291dCA8PCAiVGhlIGFtb3VudCBvZiBpdGVyYXRpb25zIGZvciBkb3VibGUgdHlwZTogIiA8PCBpIDw8IGVuZGw7CiAgICB9Cgp9Cg==