/** *************************************************************************** * @remark c Program to compute 0.1 + 0.1 + ... 0.1 (ten times) * * * * @author Henry M. Walker * * @file arithmetic series.c * * @date August 14, 2022 * * * * @remark Reference * * @remark Consequences of Data Representation on Programming * https://blue.cs.sonoma.edu/~hwalker/courses/415-sonoma.sp25/readings/data-rep-consequences.php * * *****************************************************************************/ #include int main () { double one = 1.0; double ten = 10.0; double one_tenth = one / ten; double result = one_tenth + one_tenth + one_tenth + one_tenth + one_tenth + one_tenth + one_tenth + one_tenth + one_tenth + one_tenth; printf ("result is %20.16lf\n", result); if (result == one) printf ("adding one_tenth ten times IS one\n"); else printf ("adding one_tenth ten times IS NOT one\n"); return 0; }