Lo que todo programador debería saber sobre aritmética de punto flotante
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fixed issue #2 - Add language section for SQL

+40
+39
content/languages/sql.html
··· 1 + --- 2 + title: Floating-point cheat sheet for SQL 3 + description: Tips for using floating-point and decimal numbers in SQL 4 + --- 5 + 6 + Floating-Point Types 7 + -------- 8 + The SQL standard defines three binary floating-point types: 9 + 10 + * `REAL` has implementation-dependant precision (usually maps to a hardware-supported type like IEEE 754 single or double precision) 11 + * `DOUBLE PRECISION` has implementation-dependant precision which is greater than `REAL` (usually maps to IEEE 754 double precision) 12 + * `FLOAT(N)` has at least `N` binary digits of precision, with an implementation-dependant maximum for `N` 13 + 14 + The exponent range for all three types is implementation-dependant as well. 15 + 16 + Decimal Types 17 + ------------- 18 + The standard defines two fixed-point decimal types: 19 + 20 + * `NUMERIC(M,N)` has exactly `M` total digits, `N` of them after the decimal point 21 + * `DECIMAL(M,N)` is the same as `NUMERIC(M,N)`, except that it is allowed to have more than `M` total digits 22 + 23 + The maximum values of `M` and `M` are implementation-dependant. Vendors often implement the two types identically. 24 + 25 + How to Round 26 + ------------ 27 + 28 + The SQL standard defines no explicit rounding, but most vendors provide a `ROUND()` or `TRUNC()` function. 29 + 30 + However, it usually makes little sense to round within the database, since its job is *storing* data, while rounding is an aspect of *displaying* data, and should therefore be done by the code in the presentation layer. 31 + 32 + 33 + Resources 34 + --------- 35 + * [Official ISO SQL 2008 standard (non-free)](http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=38640) 36 + * [SQL 92 draft (free)](http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt) 37 + * [MySQL numeric types](http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html) 38 + * [PostgreSQL data types](http://www.postgresql.org/docs/8.1/static/datatype.html) 39 + * [MS SQL Server data types](http://msdn.microsoft.com/en-US/library/ms187752%28v=SQL.90%29.aspx)
+1
layouts/default.html
··· 54 54 <li><a href="/languages/java/">Java</a></li> 55 55 <li><a href="/languages/javascript/">JavaScript</a></li> 56 56 <li><a href="/languages/php/">PHP</a></li> 57 + <li><a href="/languages/sql/">SQL</a></li> 57 58 </ul> 58 59 </div> 59 60 <a href="http://github.com/brazzy/floating-point-gui.de"><img style="position: absolute; top: 0; right: 0; border: 0;" src="http://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png" alt="Fork me on GitHub" /></a>