+ 2
c++ float vs java float
i heard C use 32|64-bit IEEE 754 system to atore float number like Java and JS but this example rejects it. https://code.sololearn.com/cn94Wypvi7MN/?ref=app https://code.sololearn.com/c43Y3AWX2Jji/?ref=app
2 odpowiedzi
+ 3
Both C++ and Java use IEEE 754 system.
Also C++ acts the same way, it just rounds the value on cout.
This code will output ("not 0.3"):
#include <iostream>
using namespace std;
int main() {
if((0.1+0.2) == 0.3)
cout <<"0.3";
else
cout << "not 0.3";
}
+ 1
cout<< (0.1+0.2 == 0.30000000000000004);