Skip to content

Instantly share code, notes, and snippets.

@alecgrieser
Created June 6, 2016 15:02
Show Gist options
  • Save alecgrieser/ab285f4ee6b445ec66f38dcbb91f0568 to your computer and use it in GitHub Desktop.
Save alecgrieser/ab285f4ee6b445ec66f38dcbb91f0568 to your computer and use it in GitHub Desktop.
Math overflow problem in Cool equality
class Main inherits IO {
main() : SELF_TYPE {
{
out_eq(2147483647+2147483647, ~2);
out_eq(2*2147483647, ~2);
}
};
out_eq(a : Int, b : Int) : SELF_TYPE {
out_int(a).out_string(" = ").out_int(b).out_string(" <==> ")
.out_string(if a = b then "true\n" else "false\n" fi)
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment