Browse files

add Float16 to the manual + a few minor contrib tweaks

  • Loading branch information...
1 parent 7fe393e commit b526b765f764af846d0481f5e7e893e106bc1912 @nolta nolta committed Aug 9, 2013
Showing with 21 additions and 9 deletions.
  1. +1 −1 contrib/julia.lang
  2. +2 −1 contrib/julia.xml
  3. +18 −7 doc/manual/integers-and-floating-point-numbers.rst
View
2 contrib/julia.lang
@@ -250,7 +250,7 @@
<keyword>Signed|Unsigned</keyword>
<keyword>Int(eger|Set|8|16|32|64|128)?</keyword>
<keyword>Uint(8|16|32|64|128)?</keyword>
- <keyword>Float(ingPoint|32|64)</keyword>
+ <keyword>Float(ingPoint|16|32|64)</keyword>
<keyword>Complex(Pair|64|128)?</keyword>
<keyword>Big(Int|Float)</keyword>
<keyword>C(float|double|ptrdiff_t|u?(int|long(long)?|char|short)|s?size_t|wchar_t)</keyword>
View
3 contrib/julia.xml
@@ -115,7 +115,8 @@
<item> FileMonitor </item>
<item> FileOffset </item>
<item> Filter </item>
- <item> Float </item>
+ <item> FloatingPoint </item>
+ <item> Float16 </item>
<item> Float32 </item>
<item> Float64 </item>
<item> Function </item>
View
25 doc/manual/integers-and-floating-point-numbers.rst
@@ -49,12 +49,13 @@ Type Signed? Number of bits Smallest value Largest value
- **Floating-point types:**
-=========== ========= ============== ===============================================================================
-Type Precision Number of bits Precision
------------ --------- -------------- -------------------------------------------------------------------------------
-``Float32`` single 32 `single <http://en.wikipedia.org/wiki/Single_precision_floating-point_format>`_
-``Float64`` double 64 `double <http://en.wikipedia.org/wiki/Double_precision_floating-point_format>`_
-=========== ========= ============== ===============================================================================
+=========== =============================================================================== ==============
+Type Precision Number of bits
+----------- ------------------------------------------------------------------------------- --------------
+``Float16`` `half <http://en.wikipedia.org/wiki/Half-precision_floating-point_format>`_ 16
+``Float32`` `single <http://en.wikipedia.org/wiki/Single_precision_floating-point_format>`_ 32
+``Float64`` `double <http://en.wikipedia.org/wiki/Double_precision_floating-point_format>`_ 64
+=========== =============================================================================== ==============
Additionally, full support for :ref:`man-complex-and-rational-numbers` is built
on top of these primitive numeric types. All numeric types interoperate
@@ -192,7 +193,7 @@ Overflow behavior
~~~~~~~~~~~~~~~~~
In Julia, exceeding the maximum representable value of a given type results in
-a wraparound behavior.::
+a wraparound behavior::
julia> x = typemax(Int64)
9223372036854775807
@@ -270,6 +271,16 @@ Hexadecimal floating-point literals are also valid, but only as ``Float64`` valu
julia> typeof(ans)
Float64
+Half-precision floating-point numbers are also supported (``Float16``), but
+only as a storage format. In calculations they'll be converted to ``Float32``::
+
+ julia> sizeof(float16(4.))
+ 2
+
+ julia> 2*float16(4.)
+ 8.0f0
+
+
Floating-point zero
~~~~~~~~~~~~~~~~~~~

0 comments on commit b526b76

Please sign in to comment.