Why doesn’t Java throw an Exception when dividing by 0.0?

Java’s float and double types, like pretty much any other language out there (and pretty much any hardware FP unit), implement the IEEE 754 standard for floating point math, which mandates division by zero to return a special “infinity” value. Throwing an exception would actually violate that standard. Integer arithmetic (implemented as two’s complement representation … Read more

inheritance from str or int

>>> class C(str): … def __new__(cls, *args, **kw): … return str.__new__(cls, *args, **kw) … >>> c = C(“hello world”) >>> type(c) <class ‘__main__.C’> >>> c.__class__.__mro__ (<class ‘__main__.C’>, <type ‘str’>, <type ‘basestring’>, <type ‘object’>) Since __init__ is called after the object is constructed, it is too late to modify the value for immutable types. Note that … Read more

How to handle very large numbers in Java without using java.math.BigInteger

I think a programmer should have implemented his own bignum-library once, so welcome here. (Of course, later you’ll get that BigInteger is better, and use this, but it is a valuable learning experience.) (You can follow the source code of this course life on github. Also, I remade this (a bit polished) into a 14-part … Read more

SQLite3 Integer Max Value

Look at http://www.sqlite.org/datatype3.html Minimum is -(263) == -9223372036854775808 and maximum is 263 – 1 == 9223372036854775807 I would think you should use a varchar http://www.sqlite.org/lang_attach.html http://www.sqlite.org/lang_createtable.html might be of help SQLite ‘no such table’ error in general check out the sqlite documentation