Floating Point Comparison
public c v1 · immutable#include<stdio.h>int main() { float x, y; for(x = 0.0, y = 0.0; x < 20.0; x += 0.1, y += 0.1) { printf("x = %f, y = %f, Compare = %s\n", x, y, (x == y) ? "Equal" : "Not Equal"); }}#include<stdio.h>int main() { float x, y; for(x = 0.0, y = 0.0; x < 20.0; x += 0.1, y += 0.1) { printf("x = %f, y = %f, Compare = %s\n", x, y, (x == y) ? "Equal" : "Not Equal"); }}