A
{AGUT2} {H}-IWIK
Hi,
Is it possible to compare / output two numbers to a certain precision?
for instance:
#include <stdlib>
#include <math>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
main()
{
double one = 0.987432100
double two = 0.987123456
if ( one == two ) // [[ to a precision of 3 d.p.]]
{
std::cout << "YES! ";
} else
{
cout << "No! ";
}
Thanks,
Alex
Is it possible to compare / output two numbers to a certain precision?
for instance:
#include <stdlib>
#include <math>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
main()
{
double one = 0.987432100
double two = 0.987123456
if ( one == two ) // [[ to a precision of 3 d.p.]]
{
std::cout << "YES! ";
} else
{
cout << "No! ";
}
Thanks,
Alex