I ran the same C program on three machines. Same code. Same inputs. Three different answers. Here's exactly why The Experiment #include int main() { long double x = 0.1L + 0.2L; printf("%.20Lf\n", x); unsigned char *p = (unsigned char *)&x; for (int i = 0; i sizeof(x); i++) printf("%02x ", p[i]); printf("\n"); return 0; } Three machines. All running the same binary-equivalent logic:
Why Blockchains Exclude Floating Point at the Architecture Level
Dharrsan Amarnath·Dev.to··1 min read
D
Continue reading on Dev.to
This article was sourced from Dev.to's RSS feed. Visit the original for the complete story.