Created
June 30, 2017 11:54
-
-
Save nonchip/3cf3a2ba781e025a6f3d3b505b2a71ee to your computer and use it in GitHub Desktop.
divides stuff by 12 to test other stuff
This file contains hidden or 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> | |
void main(void){ | |
for(int i=-13;i<=13;i++){ | |
int iresult=i/12; | |
float fresult=((float)i)/12.0f; | |
printf("%d\t%d\t%d\t%f\n",i,iresult,((int)fresult),fresult); | |
} | |
} | |
/* | |
-13 -1 -1 -1.083333 | |
-12 -1 -1 -1.000000 | |
-11 0 0 -0.916667 | |
-10 0 0 -0.833333 | |
-9 0 0 -0.750000 | |
-8 0 0 -0.666667 | |
-7 0 0 -0.583333 | |
-6 0 0 -0.500000 | |
-5 0 0 -0.416667 | |
-4 0 0 -0.333333 | |
-3 0 0 -0.250000 | |
-2 0 0 -0.166667 | |
-1 0 0 -0.083333 | |
0 0 0 0.000000 | |
1 0 0 0.083333 | |
2 0 0 0.166667 | |
3 0 0 0.250000 | |
4 0 0 0.333333 | |
5 0 0 0.416667 | |
6 0 0 0.500000 | |
7 0 0 0.583333 | |
8 0 0 0.666667 | |
9 0 0 0.750000 | |
10 0 0 0.833333 | |
11 0 0 0.916667 | |
12 1 1 1.000000 | |
13 1 1 1.083333 | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment