SQLite ORDER BY string containing number starting with 0

You can use CAST http://www.sqlite.org/lang_expr.html#castexpr to cast the expression to an Integer. sqlite> CREATE TABLE T (value VARCHAR(2)); sqlite> INSERT INTO T (value) VALUES (’10’); sqlite> INSERT INTO T (value) VALUES (’11’); sqlite> INSERT INTO T (value) VALUES (’12’); sqlite> INSERT INTO T (value) VALUES (’01’); sqlite> INSERT INTO T (value) VALUES (’02’); sqlite> INSERT … Read more

How to get bc to handle numbers in scientific (aka exponential) notation?

Unfortunately, bc doesn’t support scientific notation. However, it can be translated into a format that bc can handle, using extended regex as per POSIX in sed: sed -E ‘s/([+-]?[0-9.]+)[eE]\+?(-?)([0-9]+)/(\1*10^\2\3)/g’ <<<“$value” you can replace the “e” (or “e+”, if the exponent is positive) with “*10^”, which bc will promptly understand. This works even if the exponent … Read more

Associativity math: (a + b) + c != a + (b + c)

On the range of the double type: double dbl1 = (double.MinValue + double.MaxValue) + double.MaxValue; double dbl2 = double.MinValue + (double.MaxValue + double.MaxValue); The first one is double.MaxValue, the second one is double.Infinity On the precision of the double type: double dbl1 = (double.MinValue + double.MaxValue) + double.Epsilon; double dbl2 = double.MinValue + (double.MaxValue + … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)