Created
August 18, 2019 18:47
-
-
Save moustachio-belvedere/d9aeca8037a007c9ed6de1aaa804475b to your computer and use it in GitHub Desktop.
Corrected Floating Point machine epsilon calculation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(void) | |
{ | |
float foo; | |
double bar; | |
foo = (float)((float)(7.0f/3.0f) - (float)(4.0f/3.0f) - 1.0f); | |
bar = (double)((double)(7.0/3.0) - (double)(4.0/3.0) - 1.0); | |
printf("\nM.E. for float: %e \n\n", foo); | |
printf("M.E. for double: %e \n\n", bar); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment