Skip to content

Instantly share code, notes, and snippets.

@drinkcat
Last active January 2, 2016 04:39
Show Gist options
  • Save drinkcat/8252279 to your computer and use it in GitHub Desktop.
Save drinkcat/8252279 to your computer and use it in GitHub Desktop.
#include <stdio.h>
/* ARM output:
1000 / div = 10
-1000 / div = 42949662
-1000 / (long)div = -10
*/
int main() {
unsigned long div = 100;
long result;
result = 1000 / div;
printf("1000 / div = %ld\n", result);
result = -1000 / div;
printf("-1000 / div = %ld\n", result);
result = -1000 / (long)div;
printf("-1000 / (long)div = %ld\n", result);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment