gnuastro-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-commits] master ab6eaed: Edited Numeric data types section of


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master ab6eaed: Edited Numeric data types section of book
Date: Sat, 13 May 2017 22:01:23 -0400 (EDT)

branch: master
commit ab6eaed6e07303c8c48efe99994b158aae80b0bc
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>

    Edited Numeric data types section of book
    
    This section referenced the old subjective types (like `int' or `long') at
    its start. So it was updated to reflect the way Gnuastro looks at integer
    types now.
---
 doc/gnuastro.texi | 76 +++++++++++++++++++++++++++----------------------------
 1 file changed, 38 insertions(+), 38 deletions(-)

diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index 5e9b801..e767421 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -5344,56 +5344,56 @@ At the lowest level, the computer stores everything in 
terms of @code{1} or
 @code{0}. For example, each program in Gnuastro, or each astronomical image
 you take with the telescope is actually a string of millions of these zeros
 and ones. The space required to keep a zero or one is the smallest unit of
-storage, and is known as a @emph{bit}. Understanding and manipulating this
-string of bits is extremely hard for most people, therefore, we define
-packages of these bits along with a standard on how to interpret the bits
-in each package as @emph{type}s.
-
-The most basic standard for reading the bits is integer numbers. Since we
-use CFITSIO, we define the @code{char}, @code{short}, or @code{long}
-integer types. These types can store an integer number (@mymath{..., -2,
--1, 0, 1, 2, ...}), with an increasing number of bytes/bits (and thus
-larger limits). The range of integers each can represent is: @mymath{(-2^7,
-..., 2^7-1)}, @mymath{(-2^{15}, ..., 2^{15}-1}), and @mymath{(-2^{32}, ...,
-2^{31}-1)} respectively. One bit in the above types is dedicated to the
-number's sign (positive or negative). So, there is also an @code{unsigned}
-version where all the bits are counted in calculating the number. The
address@hidden types thus have larger positive limits, but no negative
-value with ranges @mymath{(0, ..., 2^8-1)}, @mymath{(0, ..., 2^{16}-1}),
-and @mymath{(0, ..., 2^{32}-1)} respectively. When the context of your work
-doesn't involve negative numbers (for example labeled images, where pixels
-can only have zero or positive integer values), it is best to use the
address@hidden types.
+storage, and is known as a @emph{bit}. However, nderstanding and
+manipulating this string of bits is extremely hard for most
+people. Therefore, we define packages of these bits along with a standard
+on how to interpret the bits in each package as a @emph{type}.
+
address@hidden Byte
address@hidden Signed integer
address@hidden Unsigned integer
address@hidden Integer, Signed
+The most basic standard for reading the bits is integer numbers
+(@mymath{..., -2, -1, 0, 1, 2, ...}, more bits will give larger
+limits). The common integer types are 8, 16, 32, and 64 bits wide. For each
+width, there are two standards for reading the bits: signed and unsigned
+integers. In the former, negative numbers are allowed and in the latter,
+they aren't. The @code{unsigned} types thus have larger positive limits
+(one extra bit), but no negative value. When the context of your work
+doesn't involve negative numbers (for example counting, where negative is
+not defined), it is best to use the @code{unsigned} types. For full
+numerical range of all integer types, see below.
 
 Another standard of converting a given number of bits to numbers is the
 floating point standard, this standard can approximately store any real
-number with a given precision. There are two floating point types in
-CFITSIO: @code{float} and @code{double}, for single and double precision
-floating point numbers respectively. The former is sufficient for data with
-less than 8 significant decimal digits (most astronomical data), while the
-latter is good for less than 16 significant decimal digits. The
-representation of real numbers as bits is much more complex than integers,
-so we won't explain any further, if you are interested have a look in the
+number with a given precision. There are two common floating point types:
+32-bit and 64-bit, for single and double precision floating point numbers
+respectively. The former is sufficient for data with less than 8
+significant decimal digits (most astronomical data), while the latter is
+good for less than 16 significant decimal digits. The representation of
+real numbers as bits is much more complex than integers. If you are
+interested, you can start with the
 @url{https://en.wikipedia.org/wiki/Floating_point, Wikipedia article}.
 
 With the conversion operators in Gnuastro's Arithmetic, you can change the
 types of data to each other, which is necessary in some contexts. For
 example the program/library, that you intend to feed the data into, only
 accepts floating point values, but you have an integer image. Another
-example can be that you know that your data only has values that fit within
address@hidden or @code{short} types, however it is currently formatted in the
address@hidden type. Operations involving floating point or larger integer
-types are significantly slower than integer or smaller types
-respectively. In the latter case, it also requires much more (by 8 or 4
-times in the example above) storage space. So when you confront such
-situations and want to store/archive/transfter/process the data, it is best
-convert them to the most efficient type.
+situation that conversion can be helpful is when you know that your data
+only has values that fit within @code{int8} or @code{uint16}. However it is
+currently formatted in the @code{float64} type. Operations involving
+floating point or larger integer types are significantly slower than
+integer or smaller-width types respectively. In the latter case, it also
+requires much more (by 8 or 4 times in the example above) storage space. So
+when you confront such situations and want to store/archive/transfter the
+data, it is best convert them to the most efficient type.
 
 The short and long names for the recognized numeric data types in Gnuastro
 are listed below. Both short and long names can be used when you want to
-speicy a type. For example, as a value to the common option @option{--type}
-(see @ref{Input output options}), or in the information comment lines of
address@hidden text table format}. The ranges listed below are inclusive.
+specify a type. For example, as a value to the common option
address@hidden (see @ref{Input output options}), or in the information
+comment lines of @ref{Gnuastro text table format}. The ranges listed below
+are inclusive.
 
 @table @code
 @item u8



reply via email to

[Prev in Thread] Current Thread [Next in Thread]