gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 5b61ae3 032/125: Arithmetic functions/macros o


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 5b61ae3 032/125: Arithmetic functions/macros out of data.h
Date: Sun, 23 Apr 2017 22:36:31 -0400 (EDT)

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

    Arithmetic functions/macros out of data.h
    
    The arithmetic operators were declared in `gnuastro/data.h'. However, this
    header is only for low-level operations on (a single) data structure. Its
    thus not good to complicate this header/library with arithmetic operations
    on (possibly) multiple data types. Thus with this commit, the
    arithmetic-related functions and macros in `gnuastro/arithmetic.h' are now
    in a more specific `gnuastro/arithmetic.h' header.
---
 bin/arithmetic/arithmetic.c                        | 101 ++--
 doc/gnuastro.texi                                  |  21 +-
 lib/Makefile.am                                    |  30 +-
 ...ata-arithmetic-binary.c => arithmetic-binary.c} |  44 +-
 ...ata-arithmetic-binary.h => arithmetic-binary.h} |   8 +-
 ...a-arithmetic-onlyint.c => arithmetic-onlyint.c} |  29 +-
 ...a-arithmetic-onlyint.h => arithmetic-onlyint.h} |   6 +-
 lib/{data-arithmetic-other.c => arithmetic.c}      | 566 ++++++++++++++++++---
 lib/data-arithmetic-other.h                        |  52 --
 lib/data.c                                         | 417 ---------------
 lib/gnuastro/arithmetic.h                          | 124 +++++
 lib/gnuastro/data.h                                |  78 +--
 12 files changed, 741 insertions(+), 735 deletions(-)

diff --git a/bin/arithmetic/arithmetic.c b/bin/arithmetic/arithmetic.c
index 3932831..678f8af 100644
--- a/bin/arithmetic/arithmetic.c
+++ b/bin/arithmetic/arithmetic.c
@@ -29,10 +29,9 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 #include <string.h>
 #include <stdlib.h>
 
-#include <gnuastro/data.h>
 #include <gnuastro/fits.h>
 #include <gnuastro/array.h>
-#include <gnuastro/statistics.h>
+#include <gnuastro/arithmetic.h>
 
 #include <checkset.h>
 
@@ -188,101 +187,101 @@ reversepolish(struct imgarithparams *p)
           /* Order is the same as in the manual. */
           /* Simple arithmetic operators. */
           if      (!strcmp(token->v, "+" ))
-            { op=GAL_DATA_OPERATOR_PLUS;          nop=2;  }
+            { op=GAL_ARITHMETIC_OP_PLUS;          nop=2;  }
           else if (!strcmp(token->v, "-" ))
-            { op=GAL_DATA_OPERATOR_MINUS;         nop=2;  }
+            { op=GAL_ARITHMETIC_OP_MINUS;         nop=2;  }
           else if (!strcmp(token->v, "*" ))
-            { op=GAL_DATA_OPERATOR_MULTIPLY;      nop=2;  }
+            { op=GAL_ARITHMETIC_OP_MULTIPLY;      nop=2;  }
           else if (!strcmp(token->v, "/" ))
-            { op=GAL_DATA_OPERATOR_DIVIDE;        nop=2;  }
+            { op=GAL_ARITHMETIC_OP_DIVIDE;        nop=2;  }
           else if (!strcmp(token->v, "%" ))
-            { op=GAL_DATA_OPERATOR_MODULO;        nop=2;  }
+            { op=GAL_ARITHMETIC_OP_MODULO;        nop=2;  }
 
           /* Mathematical Operators. */
           else if (!strcmp(token->v, "abs"))
-            { op=GAL_DATA_OPERATOR_ABS;           nop=1;  }
+            { op=GAL_ARITHMETIC_OP_ABS;           nop=1;  }
           else if (!strcmp(token->v, "pow"))
-            { op=GAL_DATA_OPERATOR_POW;           nop=2;  }
+            { op=GAL_ARITHMETIC_OP_POW;           nop=2;  }
           else if (!strcmp(token->v, "sqrt"))
-            { op=GAL_DATA_OPERATOR_SQRT;          nop=1;  }
+            { op=GAL_ARITHMETIC_OP_SQRT;          nop=1;  }
           else if (!strcmp(token->v, "log"))
-            { op=GAL_DATA_OPERATOR_LOG;           nop=1;  }
+            { op=GAL_ARITHMETIC_OP_LOG;           nop=1;  }
           else if (!strcmp(token->v, "log10"))
-            { op=GAL_DATA_OPERATOR_LOG10;         nop=1;  }
+            { op=GAL_ARITHMETIC_OP_LOG10;         nop=1;  }
 
           /* Statistical/higher-level operators. */
           else if (!strcmp(token->v, "minvalue"))
-            { op=GAL_DATA_OPERATOR_MINVAL;        nop=1;  }
+            { op=GAL_ARITHMETIC_OP_MINVAL;        nop=1;  }
           else if (!strcmp(token->v, "maxvalue"))
-            { op=GAL_DATA_OPERATOR_MAXVAL;        nop=1;  }
+            { op=GAL_ARITHMETIC_OP_MAXVAL;        nop=1;  }
           else if (!strcmp(token->v, "min"))
-            { op=GAL_DATA_OPERATOR_MIN;           nop=-1; }
+            { op=GAL_ARITHMETIC_OP_MIN;           nop=-1; }
           else if (!strcmp(token->v, "max"))
-            { op=GAL_DATA_OPERATOR_MAX;           nop=-1; }
+            { op=GAL_ARITHMETIC_OP_MAX;           nop=-1; }
           else if (!strcmp(token->v, "sum"))
-            { op=GAL_DATA_OPERATOR_SUM;           nop=-1; }
+            { op=GAL_ARITHMETIC_OP_SUM;           nop=-1; }
           else if (!strcmp(token->v, "average"))
-            { op=GAL_DATA_OPERATOR_AVERAGE;       nop=-1; }
+            { op=GAL_ARITHMETIC_OP_AVERAGE;       nop=-1; }
           else if (!strcmp(token->v, "median"))
-            { op=GAL_DATA_OPERATOR_MEDIAN;        nop=-1; }
+            { op=GAL_ARITHMETIC_OP_MEDIAN;        nop=-1; }
 
           /* Conditional operators. */
           else if (!strcmp(token->v, "lt" ))
-            { op=GAL_DATA_OPERATOR_LT;            nop=2;  }
+            { op=GAL_ARITHMETIC_OP_LT;            nop=2;  }
           else if (!strcmp(token->v, "le"))
-            { op=GAL_DATA_OPERATOR_LE;            nop=2;  }
+            { op=GAL_ARITHMETIC_OP_LE;            nop=2;  }
           else if (!strcmp(token->v, "gt" ))
-            { op=GAL_DATA_OPERATOR_GT;            nop=2;  }
+            { op=GAL_ARITHMETIC_OP_GT;            nop=2;  }
           else if (!strcmp(token->v, "ge"))
-            { op=GAL_DATA_OPERATOR_LE;            nop=2;  }
+            { op=GAL_ARITHMETIC_OP_LE;            nop=2;  }
           else if (!strcmp(token->v, "eq"))
-            { op=GAL_DATA_OPERATOR_EQ;            nop=2;  }
+            { op=GAL_ARITHMETIC_OP_EQ;            nop=2;  }
           else if (!strcmp(token->v, "ne"))
-            { op=GAL_DATA_OPERATOR_NE;            nop=2;  }
+            { op=GAL_ARITHMETIC_OP_NE;            nop=2;  }
           else if (!strcmp(token->v, "and"))
-            { op=GAL_DATA_OPERATOR_AND;           nop=2;  }
+            { op=GAL_ARITHMETIC_OP_AND;           nop=2;  }
           else if (!strcmp(token->v, "or"))
-            { op=GAL_DATA_OPERATOR_OR;            nop=2;  }
+            { op=GAL_ARITHMETIC_OP_OR;            nop=2;  }
           else if (!strcmp(token->v, "not"))
-            { op=GAL_DATA_OPERATOR_NOT;           nop=1;  }
+            { op=GAL_ARITHMETIC_OP_NOT;           nop=1;  }
           else if (!strcmp(token->v, "isblank"))
-            { op=GAL_DATA_OPERATOR_ISBLANK;       nop=1;  }
+            { op=GAL_ARITHMETIC_OP_ISBLANK;       nop=1;  }
           else if (!strcmp(token->v, "where"))
-            { op=GAL_DATA_OPERATOR_WHERE;         nop=3;  }
+            { op=GAL_ARITHMETIC_OP_WHERE;         nop=3;  }
 
           /* Bitwise operators. */
           else if (!strcmp(token->v, "bitand"))
-            { op=GAL_DATA_OPERATOR_BITAND;        nop=2;  }
+            { op=GAL_ARITHMETIC_OP_BITAND;        nop=2;  }
           else if (!strcmp(token->v, "bitor"))
-            { op=GAL_DATA_OPERATOR_BITOR;         nop=2;  }
+            { op=GAL_ARITHMETIC_OP_BITOR;         nop=2;  }
           else if (!strcmp(token->v, "bitxor"))
-            { op=GAL_DATA_OPERATOR_BITXOR;        nop=2;  }
+            { op=GAL_ARITHMETIC_OP_BITXOR;        nop=2;  }
           else if (!strcmp(token->v, "lshift"))
-            { op=GAL_DATA_OPERATOR_BITLSH;        nop=2;  }
+            { op=GAL_ARITHMETIC_OP_BITLSH;        nop=2;  }
           else if (!strcmp(token->v, "rshift"))
-            { op=GAL_DATA_OPERATOR_BITRSH;        nop=2;  }
+            { op=GAL_ARITHMETIC_OP_BITRSH;        nop=2;  }
           else if (!strcmp(token->v, "bitnot"))
-            { op=GAL_DATA_OPERATOR_BITNOT;        nop=1;  }
+            { op=GAL_ARITHMETIC_OP_BITNOT;        nop=1;  }
 
           /* Type conversion. */
           else if (!strcmp(token->v, "uchar"))
-            { op=GAL_DATA_OPERATOR_TO_UCHAR;      nop=1;  }
+            { op=GAL_ARITHMETIC_OP_TO_UCHAR;      nop=1;  }
           else if (!strcmp(token->v, "char"))
-            { op=GAL_DATA_OPERATOR_TO_CHAR;       nop=1;  }
+            { op=GAL_ARITHMETIC_OP_TO_CHAR;       nop=1;  }
           else if (!strcmp(token->v, "ushort"))
-            { op=GAL_DATA_OPERATOR_TO_USHORT;     nop=1;  }
+            { op=GAL_ARITHMETIC_OP_TO_USHORT;     nop=1;  }
           else if (!strcmp(token->v, "short"))
-            { op=GAL_DATA_OPERATOR_TO_SHORT;      nop=1;  }
+            { op=GAL_ARITHMETIC_OP_TO_SHORT;      nop=1;  }
           else if (!strcmp(token->v, "ulong"))
-            { op=GAL_DATA_OPERATOR_TO_ULONG;      nop=1;  }
+            { op=GAL_ARITHMETIC_OP_TO_ULONG;      nop=1;  }
           else if (!strcmp(token->v, "long"))
-            { op=GAL_DATA_OPERATOR_TO_LONG;       nop=1;  }
+            { op=GAL_ARITHMETIC_OP_TO_LONG;       nop=1;  }
           else if (!strcmp(token->v, "longlong"))
-            { op=GAL_DATA_OPERATOR_TO_LONGLONG;   nop=1;  }
+            { op=GAL_ARITHMETIC_OP_TO_LONGLONG;   nop=1;  }
           else if (!strcmp(token->v, "float"))
-            { op=GAL_DATA_OPERATOR_TO_FLOAT;      nop=1;  }
+            { op=GAL_ARITHMETIC_OP_TO_FLOAT;      nop=1;  }
           else if (!strcmp(token->v, "double"))
-            { op=GAL_DATA_OPERATOR_TO_DOUBLE;     nop=1;  }
+            { op=GAL_ARITHMETIC_OP_TO_DOUBLE;     nop=1;  }
 
           /* Finished checks with known operators */
           else
@@ -330,12 +329,12 @@ reversepolish(struct imgarithparams *p)
             }
 
 
-          /* Run the arithmetic operation. Note that `gal_data_arithmetic'
-             is a variable argument function (like printf). So the number
-             of arguments it uses depend on the operator. So when the
-             operator doesn't need three operands, the extra arguments will
-             be ignored. */
-          add_operand(p, NULL, gal_data_arithmetic(op, flags, d1, d2, d3));
+          /* Run the arithmetic operation. Note that `gal_arithmetic' is a
+             variable argument function (like printf). So the number of
+             arguments it uses depend on the operator. So when the operator
+             doesn't need three operands, the extra arguments will be
+             ignored. */
+          add_operand(p, NULL, gal_arithmetic(op, flags, d1, d2, d3));
         }
     }
 
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index f770892..e274fd5 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -3149,7 +3149,7 @@ end).
 
 Binary operators, for example @code{+} or @code{>} (greater than), are some
 of the most common operators to the @ref{Arithmetic} program or the
address@hidden function in @ref{Gnuastro library}. To operate
address@hidden function in @ref{Gnuastro library}. To operate
 most efficiently (as fast as possible without using extra memory or CPU
 resources), it is best to rely on the native types of the input data. For
 example, if you want to add an integer array with a floating point array,
@@ -3173,16 +3173,19 @@ compilation time will be directly felt (more 
significantly on large
 images/datasets) each time you run Gnuastro programs or libraries, because
 no internal type conversion will be necessary.
 
-If build time is important for you and you commonly work with very specific
-data-types, you can add them (and remove the default ones you don't need)
-with these configuration options to speed up your work. Alternatively,
-GNU/Linux distribution package managers who compile once (for a large
-audience of users who just download the compiled programs and executables),
-can enable all types to help their users. Since the outputs of comparison
-operators are @code{unsigned char} type and most astronomical datasets are
-in @code{float}, the recommended minimum enabled types are @code{unsigned
+If build time is important for you (mainly developers), disabling shared
+libraries and optimizations (as in @ref{Building and debugging}) is the
+first step to take. If you commonly work with very specific data-types, you
+can enable them (and disable the default types that you don't need) with
+these configuration options. Since the outputs of comparison operators are
address@hidden char} type and most astronomical datasets are in
address@hidden, the recommended minimum enabled types are @code{unsigned
 char} and @code{float}.
 
+GNU/Linux distribution package managers who compile once, for a large
+audience of users who just download the compiled programs and executables,
+are recommended to enable all types to help their users.
+
 
 
 
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 196ba34..e01c3a9 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -40,11 +40,10 @@ libgnuastro_la_LDFLAGS = -version-info $(GAL_LT_VERSION)
 
 
 # Specify the library .c files
-libgnuastro_la_SOURCES = array.c box.c checkset.c configfiles.c data.c  \
-  data-arithmetic-binary.c data-arithmetic-onlyint.c                    \
-  data-arithmetic-other.c data-copy.c fits.c git.c linkedlist.c mesh.c  \
-  mode.c polygon.c qsort.c spatialconvolve.c statistics.c table.c       \
-  threads.c timing.c txt.c wcs.c
+libgnuastro_la_SOURCES = arithmetic.c arithmetic-binary.c               \
+  arithmetic-onlyint.c array.c box.c checkset.c configfiles.c data.c    \
+  data-copy.c fits.c git.c linkedlist.c mesh.c mode.c polygon.c qsort.c \
+  spatialconvolve.c statistics.c table.c threads.c timing.c txt.c wcs.c
 
 
 
@@ -54,10 +53,10 @@ libgnuastro_la_SOURCES = array.c box.c checkset.c 
configfiles.c data.c  \
 # in the $(headersdir) directory. Some of the header files don't need to be
 # installed.
 headersdir=$(top_srcdir)/lib/gnuastro
-pkginclude_HEADERS = gnuastro/config.h $(headersdir)/array.h            \
-  $(headersdir)/box.h $(headersdir)/data.h $(headersdir)/fits.h         \
-  $(headersdir)/git.h $(headersdir)/linkedlist.h $(headersdir)/mesh.h   \
-  $(headersdir)/polygon.h $(headersdir)/qsort.h                         \
+pkginclude_HEADERS = gnuastro/config.h $(headersdir)/arithmetic.h       \
+  $(headersdir)/array.h $(headersdir)/box.h $(headersdir)/data.h        \
+  $(headersdir)/fits.h $(headersdir)/git.h $(headersdir)/linkedlist.h   \
+  $(headersdir)/mesh.h $(headersdir)/polygon.h $(headersdir)/qsort.h    \
   $(headersdir)/spatialconvolve.h $(headersdir)/statistics.h            \
   $(headersdir)/table.h $(headersdir)/threads.h $(headersdir)/wcs.h     \
   $(headersdir)/txt.h
@@ -71,10 +70,10 @@ pkginclude_HEADERS = gnuastro/config.h 
$(headersdir)/array.h            \
 # and if they are not explicitly mentioned somewhere in the Makefile, they
 # will not distributed, so we need to explicitly tell Automake to
 # distribute them here.
-EXTRA_DIST = gnuastro.pc.in data-arithmetic.h data-arithmetic-binary.h \
-  data-arithmetic-onlyint.h data-arithmetic-other.h data-copy.h         \
-  config.h.in checkset.h commonargs.h commonparams.h configfiles.h      \
-  fixedstringmacros.h mode.h neighbors.h timing.h $(headersdir)/README
+EXTRA_DIST = gnuastro.pc.in arithmetic-binary.h        arithmetic-onlyint.h    
\
+  arithmetic-other.h data-copy.h config.h.in checkset.h commonargs.h    \
+  commonparams.h configfiles.h fixedstringmacros.h mode.h neighbors.h   \
+  timing.h $(headersdir)/README
 
 
 
@@ -90,8 +89,8 @@ CLEANFILES = gnuastro.pc gnuastro/config.h
 
 
 
-# Build Gnuastro's pkg-config file and `config.h' based on the
-# information in the Makefile after the Makefile has been built.
+# Build `gnuastro/config.h' based on the information in the Makefile after
+# the Makefile has been built.
 gnuastro/config.h: Makefile config.h.in
        rm -f $@ address@hidden
        $(MKDIR_P) gnuastro
@@ -118,6 +117,7 @@ gnuastro/config.h: Makefile config.h.in
 
 
 
+# Build Gnuastro's pkg-config file similar to `gnuastro/config.h'.
 gnuastro.pc: Makefile $(srcdir)/gnuastro.pc.in
        rm -f $@ address@hidden
        $(SED)                                      \
diff --git a/lib/data-arithmetic-binary.c b/lib/arithmetic-binary.c
similarity index 93%
rename from lib/data-arithmetic-binary.c
rename to lib/arithmetic-binary.c
index 4accfd1..7a4cb74 100644
--- a/lib/data-arithmetic-binary.c
+++ b/lib/arithmetic-binary.c
@@ -27,7 +27,7 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 #include <error.h>
 #include <stdlib.h>
 
-#include <gnuastro/data.h>
+#include <gnuastro/arithmetic.h>
 
 
 
@@ -295,40 +295,40 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 #define BINARY_RT_LT_SET(RT, LT)                                   \
   switch(operator)                                                 \
     {                                                              \
-    case GAL_DATA_OPERATOR_PLUS:                                   \
+    case GAL_ARITHMETIC_OP_PLUS:                                   \
       BINARY_OP_RT_LT_SET(+, RT, LT);                              \
       break;                                                       \
-    case GAL_DATA_OPERATOR_MINUS:                                  \
+    case GAL_ARITHMETIC_OP_MINUS:                                  \
       BINARY_OP_RT_LT_SET(-, RT, LT);                              \
       break;                                                       \
-    case GAL_DATA_OPERATOR_MULTIPLY:                               \
+    case GAL_ARITHMETIC_OP_MULTIPLY:                               \
       BINARY_OP_RT_LT_SET(*, RT, LT);                              \
       break;                                                       \
-    case GAL_DATA_OPERATOR_DIVIDE:                                 \
+    case GAL_ARITHMETIC_OP_DIVIDE:                                 \
       BINARY_OP_RT_LT_SET(/, RT, LT);                              \
       break;                                                       \
-    case GAL_DATA_OPERATOR_LT:                                     \
+    case GAL_ARITHMETIC_OP_LT:                                     \
       BINARY_OP_OT_RT_LT_SET(<, unsigned char, RT, LT);            \
       break;                                                       \
-    case GAL_DATA_OPERATOR_LE:                                     \
+    case GAL_ARITHMETIC_OP_LE:                                     \
       BINARY_OP_OT_RT_LT_SET(<=, unsigned char, RT, LT);           \
       break;                                                       \
-    case GAL_DATA_OPERATOR_GT:                                     \
+    case GAL_ARITHMETIC_OP_GT:                                     \
       BINARY_OP_OT_RT_LT_SET(>, unsigned char, RT, LT);            \
       break;                                                       \
-    case GAL_DATA_OPERATOR_GE:                                     \
+    case GAL_ARITHMETIC_OP_GE:                                     \
       BINARY_OP_OT_RT_LT_SET(>=, unsigned char, RT, LT);           \
       break;                                                       \
-    case GAL_DATA_OPERATOR_EQ:                                     \
+    case GAL_ARITHMETIC_OP_EQ:                                     \
       BINARY_OP_OT_RT_LT_SET(==, unsigned char, RT, LT);           \
       break;                                                       \
-    case GAL_DATA_OPERATOR_NE:                                     \
+    case GAL_ARITHMETIC_OP_NE:                                     \
       BINARY_OP_OT_RT_LT_SET(!=, unsigned char, RT, LT);           \
       break;                                                       \
-    case GAL_DATA_OPERATOR_AND:                                    \
+    case GAL_ARITHMETIC_OP_AND:                                    \
       BINARY_OP_INCR_OT_RT_LT_SET(&&, unsigned char, RT, LT);      \
       break;                                                       \
-    case GAL_DATA_OPERATOR_OR:                                     \
+    case GAL_ARITHMETIC_OP_OR:                                     \
       BINARY_OP_INCR_OT_RT_LT_SET(||, unsigned char, RT, LT);      \
       break;                                                       \
     default:                                                       \
@@ -388,10 +388,10 @@ set_binary_out_type(int operator, gal_data_t *l, 
gal_data_t *r)
 {
   switch(operator)
     {
-    case GAL_DATA_OPERATOR_PLUS:
-    case GAL_DATA_OPERATOR_MINUS:
-    case GAL_DATA_OPERATOR_MULTIPLY:
-    case GAL_DATA_OPERATOR_DIVIDE:
+    case GAL_ARITHMETIC_OP_PLUS:
+    case GAL_ARITHMETIC_OP_MINUS:
+    case GAL_ARITHMETIC_OP_MULTIPLY:
+    case GAL_ARITHMETIC_OP_DIVIDE:
       return gal_data_out_type(l, r);
 
     default:
@@ -405,8 +405,8 @@ set_binary_out_type(int operator, gal_data_t *l, gal_data_t 
*r)
 
 
 gal_data_t *
-data_arithmetic_binary(int operator, unsigned char flags, gal_data_t *lo,
-                       gal_data_t *ro)
+arithmetic_binary(int operator, unsigned char flags, gal_data_t *lo,
+                  gal_data_t *ro)
 {
   /* Read the variable arguments. `lo' and `ro' keep the original data, in
      case their type isn't built (based on configure options are configure
@@ -420,14 +420,14 @@ data_arithmetic_binary(int operator, unsigned char flags, 
gal_data_t *lo,
   if( !( (flags & GAL_DATA_ARITH_NUMOK) && (lo->size==1 || ro->size==1))
       && gal_data_dsize_is_different(lo, ro) )
     error(EXIT_FAILURE, 0, "the non-number inputs to %s don't have the "
-          "same dimension/size", gal_data_operator_string(operator));
+          "same dimension/size", gal_arithmetic_operator_string(operator));
 
 
   /* Make sure the input arrays have one of the compiled types. From this
      point on, until the cleaning up section of this function, we won't be
      using the `lo' and `ro' pointers. */
-  l=data_arithmetic_convert_to_compiled_type(lo, flags);
-  r=data_arithmetic_convert_to_compiled_type(ro, flags);
+  l=gal_arithmetic_convert_to_compiled_type(lo, flags);
+  r=gal_arithmetic_convert_to_compiled_type(ro, flags);
 
 
   /* Set the output type. For the comparison operators, the output type is
diff --git a/lib/data-arithmetic-binary.h b/lib/arithmetic-binary.h
similarity index 84%
rename from lib/data-arithmetic-binary.h
rename to lib/arithmetic-binary.h
index 9b6c31d..bd498ef 100644
--- a/lib/data-arithmetic-binary.h
+++ b/lib/arithmetic-binary.h
@@ -20,13 +20,13 @@ General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
 **********************************************************************/
-#ifndef __GAL_ARITHMETIC_BINARY_H__
-#define __GAL_ARITHMETIC_BINARY_H__
+#ifndef __ARITHMETIC_BINARY_H__
+#define __ARITHMETIC_BINARY_H__
 
 
 gal_data_t *
-data_arithmetic_binary(int operator, unsigned char flags, gal_data_t *lo,
-                       gal_data_t *ro);
+arithmetic_binary(int operator, unsigned char flags, gal_data_t *lo,
+                  gal_data_t *ro);
 
 
 #endif
diff --git a/lib/data-arithmetic-onlyint.c b/lib/arithmetic-onlyint.c
similarity index 95%
rename from lib/data-arithmetic-onlyint.c
rename to lib/arithmetic-onlyint.c
index 7544127..5e1af3e 100644
--- a/lib/data-arithmetic-onlyint.c
+++ b/lib/arithmetic-onlyint.c
@@ -27,8 +27,9 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 #include <error.h>
 #include <stdlib.h>
 
-#include <gnuastro/data.h>
-#include <data-arithmetic-onlyint.h>
+#include <gnuastro/arithmetic.h>
+
+#include <arithmetic-onlyint.h>
 
 
 
@@ -245,22 +246,22 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 #define BINOIN_RT_LT_SET(RT, LT)                                   \
   switch(operator)                                                 \
     {                                                              \
-    case GAL_DATA_OPERATOR_MODULO:                                 \
+    case GAL_ARITHMETIC_OP_MODULO:                                 \
       BINOIN_OP_RT_LT_SET(%, RT, LT);                              \
       break;                                                       \
-    case GAL_DATA_OPERATOR_BITAND:                                 \
+    case GAL_ARITHMETIC_OP_BITAND:                                 \
       BINOIN_OP_RT_LT_SET(&, RT, LT);                              \
       break;                                                       \
-    case GAL_DATA_OPERATOR_BITOR:                                  \
+    case GAL_ARITHMETIC_OP_BITOR:                                  \
       BINOIN_OP_RT_LT_SET(|, RT, LT);                              \
       break;                                                       \
-    case GAL_DATA_OPERATOR_BITXOR:                                 \
+    case GAL_ARITHMETIC_OP_BITXOR:                                 \
       BINOIN_OP_RT_LT_SET(^, RT, LT);                              \
       break;                                                       \
-    case GAL_DATA_OPERATOR_BITLSH:                                 \
+    case GAL_ARITHMETIC_OP_BITLSH:                                 \
       BINOIN_OP_RT_LT_SET(<<, RT, LT);                             \
       break;                                                       \
-    case GAL_DATA_OPERATOR_BITRSH:                                 \
+    case GAL_ARITHMETIC_OP_BITRSH:                                 \
       BINOIN_OP_RT_LT_SET(>>, RT, LT);                             \
       break;                                                       \
     default:                                                       \
@@ -314,8 +315,8 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 /*************              Top level function          *****************/
 /************************************************************************/
 gal_data_t *
-data_arithmetic_onlyint_binary(int operator, unsigned char flags,
-                               gal_data_t *lo, gal_data_t *ro)
+arithmetic_onlyint_binary(int operator, unsigned char flags,
+                          gal_data_t *lo, gal_data_t *ro)
 {
   /* Read the variable arguments. `lo' and `ro' keep the original data, in
      case their type isn't built (based on configure options are configure
@@ -323,7 +324,7 @@ data_arithmetic_onlyint_binary(int operator, unsigned char 
flags,
   int otype;
   size_t out_size, minmapsize;
   gal_data_t *l, *r, *o=NULL, *tmp_o;
-  char *opstring=gal_data_operator_string(operator);
+  char *opstring=gal_arithmetic_operator_string(operator);
 
 
   /* Simple sanity check on the input sizes and types */
@@ -341,8 +342,8 @@ data_arithmetic_onlyint_binary(int operator, unsigned char 
flags,
   /* Make sure the input arrays have one of the compiled types. From this
      point on, until the cleaning up section of this function, we won't be
      using the `lo' and `ro' pointers. */
-  l=data_arithmetic_convert_to_compiled_type(lo, flags);
-  r=data_arithmetic_convert_to_compiled_type(ro, flags);
+  l=gal_arithmetic_convert_to_compiled_type(lo, flags);
+  r=gal_arithmetic_convert_to_compiled_type(ro, flags);
 
 
   /* Set the output type. */
@@ -438,7 +439,7 @@ data_arithmetic_onlyint_binary(int operator, unsigned char 
flags,
 
 
 gal_data_t *
-data_arithmetic_bitwise_not(unsigned char flags, gal_data_t *in)
+arithmetic_onlyint_bitwise_not(unsigned char flags, gal_data_t *in)
 {
   gal_data_t *o;
   unsigned char    *iuc=in->array, *iucf=in->array+in->size, *ouc;
diff --git a/lib/data-arithmetic-onlyint.h b/lib/arithmetic-onlyint.h
similarity index 84%
rename from lib/data-arithmetic-onlyint.h
rename to lib/arithmetic-onlyint.h
index f9d8153..16c36e2 100644
--- a/lib/data-arithmetic-onlyint.h
+++ b/lib/arithmetic-onlyint.h
@@ -25,11 +25,11 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 
 
 gal_data_t *
-data_arithmetic_onlyint_binary(int operator, unsigned char flags,
-                               gal_data_t *lo, gal_data_t *ro);
+arithmetic_onlyint_binary(int operator, unsigned char flags, gal_data_t *lo,
+                          gal_data_t *ro);
 
 gal_data_t *
-data_arithmetic_bitwise_not(unsigned char flags, gal_data_t *in);
+arithmetic_onlyint_bitwise_not(unsigned char flags, gal_data_t *in);
 
 
 #endif
diff --git a/lib/data-arithmetic-other.c b/lib/arithmetic.c
similarity index 72%
rename from lib/data-arithmetic-other.c
rename to lib/arithmetic.c
index 0478c2a..c45c743 100644
--- a/lib/data-arithmetic-other.c
+++ b/lib/arithmetic.c
@@ -1,5 +1,5 @@
 /*********************************************************************
-Arithmetic operations on data structures.
+Arithmetic operations on data structures
 This is part of GNU Astronomy Utilities (Gnuastro) package.
 
 Original author:
@@ -22,17 +22,15 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 **********************************************************************/
 #include <config.h>
 
-#include <math.h>
-#include <stdio.h>
 #include <errno.h>
 #include <error.h>
-#include <stdlib.h>
+#include <stdarg.h>
 
-#include <gnuastro/data.h>
 #include <gnuastro/qsort.h>
+#include <gnuastro/arithmetic.h>
 
-
-
+#include <arithmetic-binary.h>
+#include <arithmetic-onlyint.h>
 
 
 
@@ -43,9 +41,8 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 /***************        Unary functions/operators         **************/
 /***********************************************************************/
 /* Change input data structure type. */
-gal_data_t *
-data_arithmetic_change_type(gal_data_t *data, int operator,
-                            unsigned char flags)
+static gal_data_t *
+arithmetic_change_type(gal_data_t *data, int operator, unsigned char flags)
 {
   int type=-1;
   gal_data_t *out;
@@ -53,20 +50,20 @@ data_arithmetic_change_type(gal_data_t *data, int operator,
   /* Set the output type. */
   switch(operator)
     {
-    case GAL_DATA_OPERATOR_TO_UCHAR:    type=GAL_DATA_TYPE_UCHAR;    break;
-    case GAL_DATA_OPERATOR_TO_CHAR:     type=GAL_DATA_TYPE_UCHAR;    break;
-    case GAL_DATA_OPERATOR_TO_USHORT:   type=GAL_DATA_TYPE_USHORT;   break;
-    case GAL_DATA_OPERATOR_TO_SHORT:    type=GAL_DATA_TYPE_SHORT;    break;
-    case GAL_DATA_OPERATOR_TO_UINT:     type=GAL_DATA_TYPE_UINT;     break;
-    case GAL_DATA_OPERATOR_TO_INT:      type=GAL_DATA_TYPE_INT;      break;
-    case GAL_DATA_OPERATOR_TO_ULONG:    type=GAL_DATA_TYPE_ULONG;    break;
-    case GAL_DATA_OPERATOR_TO_LONG:     type=GAL_DATA_TYPE_LONG;     break;
-    case GAL_DATA_OPERATOR_TO_LONGLONG: type=GAL_DATA_TYPE_LONGLONG; break;
-    case GAL_DATA_OPERATOR_TO_FLOAT:    type=GAL_DATA_TYPE_FLOAT;    break;
-    case GAL_DATA_OPERATOR_TO_DOUBLE:   type=GAL_DATA_TYPE_DOUBLE;   break;
+    case GAL_ARITHMETIC_OP_TO_UCHAR:    type=GAL_DATA_TYPE_UCHAR;    break;
+    case GAL_ARITHMETIC_OP_TO_CHAR:     type=GAL_DATA_TYPE_UCHAR;    break;
+    case GAL_ARITHMETIC_OP_TO_USHORT:   type=GAL_DATA_TYPE_USHORT;   break;
+    case GAL_ARITHMETIC_OP_TO_SHORT:    type=GAL_DATA_TYPE_SHORT;    break;
+    case GAL_ARITHMETIC_OP_TO_UINT:     type=GAL_DATA_TYPE_UINT;     break;
+    case GAL_ARITHMETIC_OP_TO_INT:      type=GAL_DATA_TYPE_INT;      break;
+    case GAL_ARITHMETIC_OP_TO_ULONG:    type=GAL_DATA_TYPE_ULONG;    break;
+    case GAL_ARITHMETIC_OP_TO_LONG:     type=GAL_DATA_TYPE_LONG;     break;
+    case GAL_ARITHMETIC_OP_TO_LONGLONG: type=GAL_DATA_TYPE_LONGLONG; break;
+    case GAL_ARITHMETIC_OP_TO_FLOAT:    type=GAL_DATA_TYPE_FLOAT;    break;
+    case GAL_ARITHMETIC_OP_TO_DOUBLE:   type=GAL_DATA_TYPE_DOUBLE;   break;
     default:
       error(EXIT_FAILURE, 0, "operator value of %d not recognized in "
-            "`data_arithmetic_change_type'", operator);
+            "`arithmetic_change_type'", operator);
     }
 
   /* Copy to the new type. */
@@ -92,8 +89,8 @@ data_arithmetic_change_type(gal_data_t *data, int operator,
       break;                                                            \
   }
 
-gal_data_t *
-data_arithmetic_not(gal_data_t *data, unsigned char flags)
+static gal_data_t *
+arithmetic_not(gal_data_t *data, unsigned char flags)
 {
   gal_data_t *out;
 
@@ -143,7 +140,7 @@ data_arithmetic_not(gal_data_t *data, unsigned char flags)
 
     default:
       error(EXIT_FAILURE, 0, "type value (%d) not recognized "
-            "in `data_arithmetic_not'", data->type);
+            "in `arithmetic_not'", data->type);
     }
 
   /* Delete the input structure if the user asked for it. */
@@ -162,8 +159,8 @@ data_arithmetic_not(gal_data_t *data, unsigned char flags)
    case of the absolute operator. This is because there are multiple
    versions of this function in the C library for different types, which
    can greatly improve speed. */
-gal_data_t *
-data_arithmetic_abs(unsigned char flags, gal_data_t *in)
+static gal_data_t *
+arithmetic_abs(unsigned char flags, gal_data_t *in)
 {
   gal_data_t *out;
 
@@ -227,7 +224,7 @@ data_arithmetic_abs(unsigned char flags, gal_data_t *in)
       break;
     default:
       error(EXIT_FAILURE, 0, "type code %d not recognized in "
-            "`data_arithmetic_abs'", in->type);
+            "`arithmetic_abs'", in->type);
     }
 
   /* Clean up and return */
@@ -258,13 +255,12 @@ data_arithmetic_abs(unsigned char flags, gal_data_t *in)
 /***********************************************************************/
 /***************          Checking functions              **************/
 /***********************************************************************/
-
 /* Some functions are only for a floating point operand, so if the input
    isn't floating point, inform the user to change the type explicitly,
    doing it implicitly/internally puts too much responsability on the
    program. */
 static void
-check_float_input(gal_data_t *in, int operator, char *numstr)
+arithmetic_check_float_input(gal_data_t *in, int operator, char *numstr)
 {
   switch(in->type)
     {
@@ -280,8 +276,8 @@ check_float_input(gal_data_t *in, int operator, char 
*numstr)
             "originally a typed number (string of characters), add an `f' "
             "after it so it is directly read into the proper precision "
             "floating point number (based on the number of non-zero "
-            "decimals it has)", gal_data_operator_string(operator), numstr,
-            gal_data_type_string(in->type, 1));
+            "decimals it has)", gal_arithmetic_operator_string(operator),
+            numstr, gal_data_type_string(in->type, 1));
     }
 }
 
@@ -342,10 +338,10 @@ check_float_input(gal_data_t *in, int operator, char 
*numstr)
     IT *ia=in->array, *oa=o->array, *iaf=ia + in->size;                 \
     switch(operator)                                                    \
       {                                                                 \
-      case GAL_DATA_OPERATOR_MINVAL:                                    \
+      case GAL_ARITHMETIC_OP_MINVAL:                                    \
         UNIFUNC_MINVALUE;                                               \
         break;                                                          \
-      case GAL_DATA_OPERATOR_MAXVAL:                                    \
+      case GAL_ARITHMETIC_OP_MAXVAL:                                    \
         UNIFUNC_MAXVALUE;                                               \
         break;                                                          \
       default:                                                          \
@@ -449,9 +445,8 @@ check_float_input(gal_data_t *in, int operator, char 
*numstr)
 
 
 
-gal_data_t *
-data_arithmetic_unary_function(int operator, unsigned char flags,
-                               gal_data_t *in)
+static gal_data_t *
+arithmetic_unary_function(int operator, unsigned char flags, gal_data_t *in)
 {
   long dsize=1;
   gal_data_t *o;
@@ -462,12 +457,12 @@ data_arithmetic_unary_function(int operator, unsigned 
char flags,
     {
 
     /* Operators with only one value as output. */
-    case GAL_DATA_OPERATOR_MINVAL:
+    case GAL_ARITHMETIC_OP_MINVAL:
       o = gal_data_alloc(NULL, in->type, 1, &dsize, NULL, 0, -1,
                          NULL, NULL, NULL);
       gal_data_type_max(o->type, o->array);
       break;
-    case GAL_DATA_OPERATOR_MAXVAL:
+    case GAL_ARITHMETIC_OP_MAXVAL:
       o = gal_data_alloc(NULL, in->type, 1, &dsize, NULL, 0, -1,
                          NULL, NULL, NULL);
       gal_data_type_min(o->type, o->array);
@@ -485,26 +480,26 @@ data_arithmetic_unary_function(int operator, unsigned 
char flags,
   /* Start setting the operator and operands. */
   switch(operator)
     {
-    case GAL_DATA_OPERATOR_SQRT:
+    case GAL_ARITHMETIC_OP_SQRT:
       UNIARY_FUNCTION_ON_ELEMENT( sqrt );
       break;
 
-    case GAL_DATA_OPERATOR_LOG:
+    case GAL_ARITHMETIC_OP_LOG:
       UNIARY_FUNCTION_ON_ELEMENT( log );
       break;
 
-    case GAL_DATA_OPERATOR_LOG10:
+    case GAL_ARITHMETIC_OP_LOG10:
       UNIARY_FUNCTION_ON_ELEMENT( log10 );
       break;
 
-    case GAL_DATA_OPERATOR_MINVAL:
-    case GAL_DATA_OPERATOR_MAXVAL:
+    case GAL_ARITHMETIC_OP_MINVAL:
+    case GAL_ARITHMETIC_OP_MAXVAL:
       UNIARY_FUNCTION_ON_ARRAY;
       break;
 
     default:
       error(EXIT_FAILURE, 0, "operator code %d not recognized in "
-            "data_arithmetic_unary_function", operator);
+            "arithmetic_unary_function", operator);
     }
 
 
@@ -615,9 +610,9 @@ data_arithmetic_unary_function(int operator, unsigned char 
flags,
 
 
 
-gal_data_t *
-data_arithmetic_binary_function_flt(int operator, unsigned char flags,
-                                    gal_data_t *l, gal_data_t *r)
+static gal_data_t *
+arithmetic_binary_function_flt(int operator, unsigned char flags,
+                               gal_data_t *l, gal_data_t *r)
 {
   int final_otype;
   gal_data_t *o=NULL;
@@ -631,8 +626,8 @@ data_arithmetic_binary_function_flt(int operator, unsigned 
char flags,
           "dimension/size in data_arithmetic_binary_function");
 
   /* Check for the types of the left and right operands. */
-  check_float_input(l, operator, "first");
-  check_float_input(r, operator, "second");
+  arithmetic_check_float_input(l, operator, "first");
+  arithmetic_check_float_input(r, operator, "second");
 
   /* Set the output type. */
   final_otype = gal_data_out_type(l, r);
@@ -669,7 +664,7 @@ data_arithmetic_binary_function_flt(int operator, unsigned 
char flags,
   /* Start setting the operator and operands. */
   switch(operator)
     {
-    case GAL_DATA_OPERATOR_POW:  BINFUNC_F_OPERATOR_SET( pow  ); break;
+    case GAL_ARITHMETIC_OP_POW:  BINFUNC_F_OPERATOR_SET( pow  ); break;
     default:
       error(EXIT_FAILURE, 0, "Operator code %d not recognized in "
             "data_arithmetic_binary_function", operator);
@@ -775,18 +770,17 @@ data_arithmetic_binary_function_flt(int operator, 
unsigned char flags,
 
 
 
-void
-data_arithmetic_where(unsigned char flags, gal_data_t *out,
-                      gal_data_t *cond, gal_data_t *iftrue)
+static void
+arithmetic_where(unsigned char flags, gal_data_t *out, gal_data_t *cond,
+                 gal_data_t *iftrue)
 {
   unsigned char *c=cond->array;
 
   /* The condition operator has to be unsigned char. */
   if(cond->type!=GAL_DATA_TYPE_UCHAR)
-    error(EXIT_FAILURE, 0, "the condition operand to "
-          "`data_arithmetic_where' must be an `unsigned char' type, but "
-          "the given condition operator has a `%s' type",
-          gal_data_type_string(cond->type, 1));
+    error(EXIT_FAILURE, 0, "the condition operand to `arithmetic_where' "
+          "must be an `unsigned char' type, but the given condition "
+          "operator has a `%s' type", gal_data_type_string(cond->type, 1));
 
   /* The dimension and sizes of the out and condition data sets must be the
      same. */
@@ -832,7 +826,7 @@ data_arithmetic_where(unsigned char flags, gal_data_t *out,
       break;
     default:
       error(EXIT_FAILURE, 0, "type code %d not recognized for the `out' "
-            "dataset of `data_arithmetic_where'", out->type);
+            "dataset of `arithmetic_where'", out->type);
     }
 
   /* Clean up if necessary. */
@@ -1027,23 +1021,23 @@ data_arithmetic_where(unsigned char flags, gal_data_t 
*out,
     /* Do the operation. */                                             \
     switch(operator)                                                    \
       {                                                                 \
-      case GAL_DATA_OPERATOR_MIN:                                       \
+      case GAL_ARITHMETIC_OP_MIN:                                       \
         MULTIOPERAND_MIN(TYPE);                                         \
         break;                                                          \
                                                                         \
-      case GAL_DATA_OPERATOR_MAX:                                       \
+      case GAL_ARITHMETIC_OP_MAX:                                       \
         MULTIOPERAND_MAX(TYPE);                                         \
         break;                                                          \
                                                                         \
-      case GAL_DATA_OPERATOR_SUM:                                       \
+      case GAL_ARITHMETIC_OP_SUM:                                       \
         MULTIOPERAND_SUM;                                               \
         break;                                                          \
                                                                         \
-      case GAL_DATA_OPERATOR_AVERAGE:                                   \
+      case GAL_ARITHMETIC_OP_AVERAGE:                                   \
         MULTIOPERAND_AVERAGE;                                           \
         break;                                                          \
                                                                         \
-      case GAL_DATA_OPERATOR_MEDIAN:                                    \
+      case GAL_ARITHMETIC_OP_MEDIAN:                                    \
         MULTIOPERAND_MEDIAN(TYPE, QSORT_F);                             \
         break;                                                          \
                                                                         \
@@ -1064,9 +1058,8 @@ data_arithmetic_where(unsigned char flags, gal_data_t 
*out,
 /* The single operator in this function is assumed to be a linked list. The
    number of operators is determined from the fact that the last node in
    the linked list must have a NULL pointer as its `next' element.*/
-gal_data_t *
-data_arithmetic_multioperand(int operator, unsigned char flags,
-                             gal_data_t *list)
+static gal_data_t *
+arithmetic_multioperand(int operator, unsigned char flags, gal_data_t *list)
 {
   int *hasblank;
   size_t i=0, dnum=1;
@@ -1089,13 +1082,13 @@ data_arithmetic_multioperand(int operator, unsigned 
char flags,
       if(tmp->type!=list->type)
         error(EXIT_FAILURE, 0, "the types of all operands to the %s "
               "operator must be same",
-              gal_data_operator_string(operator));
+              gal_arithmetic_operator_string(operator));
 
       /* Check the sizes. */
       if( gal_data_dsize_is_different(list, tmp) )
         error(EXIT_FAILURE, 0, "the sizes of all operands to the %s "
               "operator must be same",
-              gal_data_operator_string(operator));
+              gal_arithmetic_operator_string(operator));
     }
 
 
@@ -1112,7 +1105,7 @@ data_arithmetic_multioperand(int operator, unsigned char 
flags,
   hasblank=malloc(dnum*sizeof *hasblank);
   if(hasblank==NULL)
     error(EXIT_FAILURE, 0, "%zu bytes for hasblank in "
-          "`data_arithmetic_multioperand", dnum*sizeof *hasblank);
+          "`arithmetic_multioperand", dnum*sizeof *hasblank);
 
 
   /* Fill in the hasblank array. */
@@ -1147,7 +1140,7 @@ data_arithmetic_multioperand(int operator, unsigned char 
flags,
       MULTIOPERAND_TYPE_SET(double,         gal_qsort_double_increasing);
     default:
       error(EXIT_FAILURE, 0, "type code %d not recognized in "
-            "`data_arithmetic_multioperand'", list->type);
+            "`arithmetic_multioperand'", list->type);
     }
 
 
@@ -1167,3 +1160,434 @@ data_arithmetic_multioperand(int operator, unsigned 
char flags,
   free(hasblank);
   return out;
 }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/**********************************************************************/
+/****************      Compiled binary op types       *****************/
+/**********************************************************************/
+static int
+data_arithmetic_nearest_compiled_type(int intype)
+{
+  switch(intype)
+    {
+    case GAL_DATA_TYPE_UCHAR:
+      if(GAL_CONFIG_BIN_OP_UCHAR) return GAL_DATA_TYPE_UCHAR;
+      else
+        {
+          if     (GAL_CONFIG_BIN_OP_USHORT)   return GAL_DATA_TYPE_USHORT;
+          else if(GAL_CONFIG_BIN_OP_SHORT)    return GAL_DATA_TYPE_SHORT;
+          else if(GAL_CONFIG_BIN_OP_UINT)     return GAL_DATA_TYPE_UINT;
+          else if(GAL_CONFIG_BIN_OP_INT)      return GAL_DATA_TYPE_INT;
+          else if(GAL_CONFIG_BIN_OP_ULONG)    return GAL_DATA_TYPE_ULONG;
+          else if(GAL_CONFIG_BIN_OP_LONG)     return GAL_DATA_TYPE_LONG;
+          else if(GAL_CONFIG_BIN_OP_LONGLONG) return GAL_DATA_TYPE_LONGLONG;
+          else if(GAL_CONFIG_BIN_OP_FLOAT)    return GAL_DATA_TYPE_FLOAT;
+          else if(GAL_CONFIG_BIN_OP_DOUBLE)   return GAL_DATA_TYPE_DOUBLE;
+        }
+      break;
+
+    case GAL_DATA_TYPE_CHAR:
+      if(GAL_CONFIG_BIN_OP_CHAR) return GAL_DATA_TYPE_CHAR;
+      else
+        {
+          if     (GAL_CONFIG_BIN_OP_SHORT)    return GAL_DATA_TYPE_SHORT;
+          else if(GAL_CONFIG_BIN_OP_INT)      return GAL_DATA_TYPE_INT;
+          else if(GAL_CONFIG_BIN_OP_LONG)     return GAL_DATA_TYPE_LONG;
+          else if(GAL_CONFIG_BIN_OP_LONGLONG) return GAL_DATA_TYPE_LONGLONG;
+          else if(GAL_CONFIG_BIN_OP_FLOAT)    return GAL_DATA_TYPE_FLOAT;
+          else if(GAL_CONFIG_BIN_OP_DOUBLE)   return GAL_DATA_TYPE_DOUBLE;
+        }
+      break;
+
+    case GAL_DATA_TYPE_USHORT:
+      if(GAL_CONFIG_BIN_OP_USHORT) return GAL_DATA_TYPE_USHORT;
+      else
+        {
+          if     (GAL_CONFIG_BIN_OP_UINT)     return GAL_DATA_TYPE_UINT;
+          else if(GAL_CONFIG_BIN_OP_INT)      return GAL_DATA_TYPE_INT;
+          else if(GAL_CONFIG_BIN_OP_ULONG)    return GAL_DATA_TYPE_ULONG;
+          else if(GAL_CONFIG_BIN_OP_LONG)     return GAL_DATA_TYPE_LONG;
+          else if(GAL_CONFIG_BIN_OP_LONGLONG) return GAL_DATA_TYPE_LONGLONG;
+          else if(GAL_CONFIG_BIN_OP_FLOAT)    return GAL_DATA_TYPE_FLOAT;
+          else if(GAL_CONFIG_BIN_OP_DOUBLE)   return GAL_DATA_TYPE_DOUBLE;
+        }
+      break;
+
+    case GAL_DATA_TYPE_SHORT:
+      if(GAL_CONFIG_BIN_OP_SHORT) return GAL_DATA_TYPE_SHORT;
+      else
+        {
+          if     (GAL_CONFIG_BIN_OP_INT)      return GAL_DATA_TYPE_INT;
+          else if(GAL_CONFIG_BIN_OP_LONG)     return GAL_DATA_TYPE_LONG;
+          else if(GAL_CONFIG_BIN_OP_LONGLONG) return GAL_DATA_TYPE_LONGLONG;
+          else if(GAL_CONFIG_BIN_OP_FLOAT)    return GAL_DATA_TYPE_FLOAT;
+          else if(GAL_CONFIG_BIN_OP_DOUBLE)   return GAL_DATA_TYPE_DOUBLE;
+        }
+      break;
+
+    case GAL_DATA_TYPE_UINT:
+      if(GAL_CONFIG_BIN_OP_UINT) return GAL_DATA_TYPE_UINT;
+      else
+        {
+          if     (GAL_CONFIG_BIN_OP_ULONG)    return GAL_DATA_TYPE_ULONG;
+          else if(GAL_CONFIG_BIN_OP_LONG)     return GAL_DATA_TYPE_LONG;
+          else if(GAL_CONFIG_BIN_OP_LONGLONG) return GAL_DATA_TYPE_LONGLONG;
+          else if(GAL_CONFIG_BIN_OP_FLOAT)    return GAL_DATA_TYPE_FLOAT;
+          else if(GAL_CONFIG_BIN_OP_DOUBLE)   return GAL_DATA_TYPE_DOUBLE;
+        }
+      break;
+
+    case GAL_DATA_TYPE_INT:
+      if(GAL_CONFIG_BIN_OP_INT) return GAL_DATA_TYPE_INT;
+      else
+        {
+          if     (GAL_CONFIG_BIN_OP_LONG)     return GAL_DATA_TYPE_LONG;
+          else if(GAL_CONFIG_BIN_OP_LONGLONG) return GAL_DATA_TYPE_LONGLONG;
+          else if(GAL_CONFIG_BIN_OP_FLOAT)    return GAL_DATA_TYPE_FLOAT;
+          else if(GAL_CONFIG_BIN_OP_DOUBLE)   return GAL_DATA_TYPE_DOUBLE;
+        }
+      break;
+
+    case GAL_DATA_TYPE_ULONG:
+      if(GAL_CONFIG_BIN_OP_ULONG) return GAL_DATA_TYPE_ULONG;
+      else
+        {
+          if     (GAL_CONFIG_BIN_OP_LONGLONG) return GAL_DATA_TYPE_LONGLONG;
+          else if(GAL_CONFIG_BIN_OP_FLOAT)    return GAL_DATA_TYPE_FLOAT;
+          else if(GAL_CONFIG_BIN_OP_DOUBLE)   return GAL_DATA_TYPE_DOUBLE;
+        }
+      break;
+
+    case GAL_DATA_TYPE_LONG:
+      if(GAL_CONFIG_BIN_OP_LONG) return GAL_DATA_TYPE_LONG;
+      else
+        {
+          if     (GAL_CONFIG_BIN_OP_LONGLONG) return GAL_DATA_TYPE_LONGLONG;
+          else if(GAL_CONFIG_BIN_OP_FLOAT)    return GAL_DATA_TYPE_FLOAT;
+          else if(GAL_CONFIG_BIN_OP_DOUBLE)   return GAL_DATA_TYPE_DOUBLE;
+        }
+      break;
+
+    case GAL_DATA_TYPE_LONGLONG:
+      if(GAL_CONFIG_BIN_OP_LONGLONG) return GAL_DATA_TYPE_LONGLONG;
+      else
+        {
+          if     (GAL_CONFIG_BIN_OP_FLOAT)    return GAL_DATA_TYPE_FLOAT;
+          else if(GAL_CONFIG_BIN_OP_DOUBLE)   return GAL_DATA_TYPE_DOUBLE;
+        }
+      break;
+
+    case GAL_DATA_TYPE_FLOAT:
+      if(GAL_CONFIG_BIN_OP_FLOAT) return GAL_DATA_TYPE_FLOAT;
+      else
+        {
+          if     (GAL_CONFIG_BIN_OP_DOUBLE)   return GAL_DATA_TYPE_DOUBLE;
+        }
+      break;
+
+    case GAL_DATA_TYPE_DOUBLE:
+      if         (GAL_CONFIG_BIN_OP_DOUBLE)   return GAL_DATA_TYPE_DOUBLE;
+      break;
+
+    default:
+      error(EXIT_FAILURE, 0, "type %d not recognized in "
+            "binary_type_for_convert_to_compiled_type", intype);
+    }
+
+  return 0;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/**********************************************************************/
+/****************         High-level functions        *****************/
+/**********************************************************************/
+char *
+gal_arithmetic_operator_string(int operator)
+{
+  switch(operator)
+    {
+    case GAL_ARITHMETIC_OP_PLUS:         return "+";
+    case GAL_ARITHMETIC_OP_MINUS:        return "-";
+    case GAL_ARITHMETIC_OP_MULTIPLY:     return "*";
+    case GAL_ARITHMETIC_OP_DIVIDE:       return "/";
+    case GAL_ARITHMETIC_OP_MODULO:       return "%";
+
+    case GAL_ARITHMETIC_OP_LT:           return "<";
+    case GAL_ARITHMETIC_OP_LE:           return "<=";
+    case GAL_ARITHMETIC_OP_GT:           return ">";
+    case GAL_ARITHMETIC_OP_GE:           return ">=";
+    case GAL_ARITHMETIC_OP_EQ:           return "==";
+    case GAL_ARITHMETIC_OP_NE:           return "!=";
+    case GAL_ARITHMETIC_OP_AND:          return "and";
+    case GAL_ARITHMETIC_OP_OR:           return "or";
+    case GAL_ARITHMETIC_OP_NOT:          return "not";
+    case GAL_ARITHMETIC_OP_ISBLANK:      return "isblank";
+    case GAL_ARITHMETIC_OP_WHERE:        return "where";
+
+    case GAL_ARITHMETIC_OP_BITAND:       return "bitand";
+    case GAL_ARITHMETIC_OP_BITOR:        return "bitor";
+    case GAL_ARITHMETIC_OP_BITXOR:       return "bitxor";
+    case GAL_ARITHMETIC_OP_BITLSH:       return "lshift";
+    case GAL_ARITHMETIC_OP_BITRSH:       return "rshift";
+    case GAL_ARITHMETIC_OP_BITNOT:       return "bitnot";
+
+    case GAL_ARITHMETIC_OP_ABS:          return "abs";
+    case GAL_ARITHMETIC_OP_POW:          return "pow";
+    case GAL_ARITHMETIC_OP_SQRT:         return "sqrt";
+    case GAL_ARITHMETIC_OP_LOG:          return "log";
+    case GAL_ARITHMETIC_OP_LOG10:        return "log10";
+
+    case GAL_ARITHMETIC_OP_MINVAL:       return "minvalue";
+    case GAL_ARITHMETIC_OP_MAXVAL:       return "maxvalue";
+    case GAL_ARITHMETIC_OP_MIN:          return "min";
+    case GAL_ARITHMETIC_OP_MAX:          return "max";
+    case GAL_ARITHMETIC_OP_AVERAGE:      return "average";
+    case GAL_ARITHMETIC_OP_MEDIAN:       return "median";
+
+    case GAL_ARITHMETIC_OP_TO_UCHAR:     return "uchar";
+    case GAL_ARITHMETIC_OP_TO_CHAR:      return "char";
+    case GAL_ARITHMETIC_OP_TO_USHORT:    return "ushort";
+    case GAL_ARITHMETIC_OP_TO_SHORT:     return "short";
+    case GAL_ARITHMETIC_OP_TO_UINT:      return "uint";
+    case GAL_ARITHMETIC_OP_TO_INT:       return "int";
+    case GAL_ARITHMETIC_OP_TO_ULONG:     return "ulong";
+    case GAL_ARITHMETIC_OP_TO_LONG:      return "long";
+    case GAL_ARITHMETIC_OP_TO_LONGLONG:  return "longlong";
+    case GAL_ARITHMETIC_OP_TO_FLOAT:     return "float";
+    case GAL_ARITHMETIC_OP_TO_DOUBLE:    return "double";
+
+    default:
+      error(EXIT_FAILURE, 0, "Operator code %d not recognized in "
+            "gal_data_operator_to_string", operator);
+    }
+
+  error(EXIT_FAILURE, 0, "A bug! Please contact us to fix the problem. "
+        "for some reason, control of the `gal_data_operator_to_string' "
+        "function has reached its end! This should not have happened");
+  return NULL;
+}
+
+
+
+
+
+/* Note that for signed types, we won't be considering the unsigned types
+   of the larger types. */
+gal_data_t *
+gal_arithmetic_convert_to_compiled_type(gal_data_t *in, unsigned char flags)
+{
+  int ntype;
+  char *typestring;
+  gal_data_t *out=NULL;
+
+  /* Set the best compiled type. */
+  ntype=data_arithmetic_nearest_compiled_type(in->type);
+
+  /* If type is not compiled, then convert the dataset to the first
+     compiled larger type. */
+  if(in->type==ntype)
+    out=in;
+  else
+    {
+      if(ntype)
+        {
+          out=gal_data_copy_to_new_type(in, ntype);
+          if(flags & GAL_DATA_ARITH_FREE)
+            { gal_data_free(in, 0); in=NULL; }
+        }
+      else
+        {
+          typestring=gal_data_type_string(in->type, 1);
+          error(EXIT_FAILURE, 0, "The given %s type data given to "
+                "binary operators is not compiled for native operation "
+                "and no larger types are compiled either.\n\nThe "
+                "largest type (which can act as a fallback for any "
+                "input type is double, so configure Gnuastro again "
+                "with `--enable-bin-op-double' to not get this error "
+                "any more. However, if you commonly deal with %s type "
+                "data, also enable %s with a similar option at "
+                "configure time to greatly decrease running time and "
+                "avoid unnecessary RAM and CPU resources. Run"
+                "`./configure --help' in Gnuastro's top source "
+                "directory (after unpacking the tarball) for the full "
+                "list of options", typestring, typestring, typestring);
+        }
+    }
+
+  /* Return the output data structure */
+  if(out==NULL)
+    error(EXIT_FAILURE, 0, "A bug! Please contact us at %s, so we can fix "
+          "the problem. For some reason, the `out' array in "
+          "`binary_convert_to_compiled_type' is not set", PACKAGE_BUGREPORT);
+  return out;
+}
+
+
+
+
+
+gal_data_t *
+gal_arithmetic(int operator, unsigned char flags, ...)
+{
+  va_list va;
+  gal_data_t *d1, *d2, *d3, *out=NULL;
+
+  /* Prepare the variable arguments (starting after the flags argument). */
+  va_start(va, flags);
+
+  /* Depending on the operator do the job: */
+  switch(operator)
+    {
+
+    /* Binary operators with any data type. */
+    case GAL_ARITHMETIC_OP_PLUS:
+    case GAL_ARITHMETIC_OP_MINUS:
+    case GAL_ARITHMETIC_OP_MULTIPLY:
+    case GAL_ARITHMETIC_OP_DIVIDE:
+    case GAL_ARITHMETIC_OP_LT:
+    case GAL_ARITHMETIC_OP_LE:
+    case GAL_ARITHMETIC_OP_GT:
+    case GAL_ARITHMETIC_OP_GE:
+    case GAL_ARITHMETIC_OP_EQ:
+    case GAL_ARITHMETIC_OP_NE:
+    case GAL_ARITHMETIC_OP_AND:
+    case GAL_ARITHMETIC_OP_OR:
+      d1 = va_arg(va, gal_data_t *);
+      d2 = va_arg(va, gal_data_t *);
+      out=arithmetic_binary(operator, flags, d1, d2);
+      break;
+
+    case GAL_ARITHMETIC_OP_NOT:
+      d1 = va_arg(va, gal_data_t *);
+      out=arithmetic_not(d1, flags);
+      break;
+
+    case GAL_ARITHMETIC_OP_ISBLANK:
+      d1 = va_arg(va, gal_data_t *);
+      out = gal_data_flag_blank(d1);
+      if(flags & GAL_DATA_ARITH_FREE) gal_data_free(d1, 0);
+      break;
+
+    case GAL_ARITHMETIC_OP_WHERE:
+      d1 = va_arg(va, gal_data_t *);    /* Output value/array.        */
+      d2 = va_arg(va, gal_data_t *);    /* Condition (unsigned char). */
+      d3 = va_arg(va, gal_data_t *);    /* If true value/array.       */
+      arithmetic_where(flags, d1, d2, d3);
+      out=d1;
+      break;
+
+
+    /* Unary function operators. */
+    case GAL_ARITHMETIC_OP_SQRT:
+    case GAL_ARITHMETIC_OP_LOG:
+    case GAL_ARITHMETIC_OP_LOG10:
+    case GAL_ARITHMETIC_OP_MINVAL:
+    case GAL_ARITHMETIC_OP_MAXVAL:
+      d1 = va_arg(va, gal_data_t *);
+      out=arithmetic_unary_function(operator, flags, d1);
+      break;
+
+    case GAL_ARITHMETIC_OP_ABS:
+      d1 = va_arg(va, gal_data_t *);
+      out=arithmetic_abs(flags, d1);
+      break;
+
+    case GAL_ARITHMETIC_OP_MIN:
+    case GAL_ARITHMETIC_OP_MAX:
+    case GAL_ARITHMETIC_OP_SUM:
+    case GAL_ARITHMETIC_OP_AVERAGE:
+    case GAL_ARITHMETIC_OP_MEDIAN:
+      d1 = va_arg(va, gal_data_t *);
+      out=arithmetic_multioperand(operator, flags, d1);
+      break;
+
+
+    /* Binary function operators. */
+    case GAL_ARITHMETIC_OP_POW:
+      d1 = va_arg(va, gal_data_t *);
+      d2 = va_arg(va, gal_data_t *);
+      out=arithmetic_binary_function_flt(operator, flags, d1, d2);
+      break;
+
+
+    /* Binary operators that only work on integer types. */
+    case GAL_ARITHMETIC_OP_BITAND:
+    case GAL_ARITHMETIC_OP_BITOR:
+    case GAL_ARITHMETIC_OP_BITXOR:
+    case GAL_ARITHMETIC_OP_BITLSH:
+    case GAL_ARITHMETIC_OP_BITRSH:
+    case GAL_ARITHMETIC_OP_MODULO:
+      d1 = va_arg(va, gal_data_t *);
+      d2 = va_arg(va, gal_data_t *);
+      out=arithmetic_onlyint_binary(operator, flags, d1, d2);
+      break;
+
+    case GAL_ARITHMETIC_OP_BITNOT:
+      d1 = va_arg(va, gal_data_t *);
+      out=arithmetic_onlyint_bitwise_not(flags, d1);
+      break;
+
+
+    /* Conversion operators. */
+    case GAL_ARITHMETIC_OP_TO_UCHAR:
+    case GAL_ARITHMETIC_OP_TO_CHAR:
+    case GAL_ARITHMETIC_OP_TO_USHORT:
+    case GAL_ARITHMETIC_OP_TO_SHORT:
+    case GAL_ARITHMETIC_OP_TO_UINT:
+    case GAL_ARITHMETIC_OP_TO_INT:
+    case GAL_ARITHMETIC_OP_TO_ULONG:
+    case GAL_ARITHMETIC_OP_TO_LONG:
+    case GAL_ARITHMETIC_OP_TO_LONGLONG:
+    case GAL_ARITHMETIC_OP_TO_FLOAT:
+    case GAL_ARITHMETIC_OP_TO_DOUBLE:
+      d1 = va_arg(va, gal_data_t *);
+      out=arithmetic_change_type(d1, operator, flags);
+      break;
+
+
+    /* When operator is not recognized. */
+    default:
+      error(EXIT_FAILURE, 0, "the argument \"%d\" could not be "
+            "interpretted as an operator", operator);
+    }
+
+  /* End the variable argument structure and return. */
+  va_end(va);
+  return out;
+}
diff --git a/lib/data-arithmetic-other.h b/lib/data-arithmetic-other.h
deleted file mode 100644
index dec1451..0000000
--- a/lib/data-arithmetic-other.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*********************************************************************
-Arithmetic operations on data structures.
-This is part of GNU Astronomy Utilities (Gnuastro) package.
-
-Original author:
-     Mohammad Akhlaghi <address@hidden>
-Contributing author(s):
-Copyright (C) 2015, Free Software Foundation, Inc.
-
-Gnuastro is free software: you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation, either version 3 of the License, or (at your
-option) any later version.
-
-Gnuastro is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
-**********************************************************************/
-#ifndef __GAL_ARITHMETIC_OTHER_H__
-#define __GAL_ARITHMETIC_OTHER_H__
-
-gal_data_t *
-data_arithmetic_change_type(gal_data_t *data, int operator,
-                            unsigned char flags);
-
-gal_data_t *
-data_arithmetic_not(gal_data_t *data, unsigned char flags);
-
-gal_data_t *
-data_arithmetic_abs(unsigned char flags, gal_data_t *in);
-
-gal_data_t *
-data_arithmetic_unary_function(int operator, unsigned char flags,
-                               gal_data_t *in);
-
-gal_data_t *
-data_arithmetic_binary_function_flt(int operator, unsigned char flags,
-                                  gal_data_t *l, gal_data_t *r);
-
-void
-data_arithmetic_where(unsigned char flags, gal_data_t *out,
-                      gal_data_t *cond, gal_data_t *iftrue);
-
-gal_data_t *
-data_arithmetic_multioperand(int operator, unsigned char flags,
-                             gal_data_t *list);
-
-#endif
diff --git a/lib/data.c b/lib/data.c
index f93f45c..f3189db 100644
--- a/lib/data.c
+++ b/lib/data.c
@@ -27,7 +27,6 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 #include <fcntl.h>
 #include <float.h>
 #include <ctype.h>
-#include <stdarg.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <string.h>
@@ -39,9 +38,6 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 
 #include <checkset.h>
 #include <data-copy.h>
-#include <data-arithmetic-other.h>
-#include <data-arithmetic-binary.h>
-#include <data-arithmetic-onlyint.h>
 
 
 
@@ -1705,416 +1701,3 @@ gal_data_type_max(int type, void *in)
             "`gal_data_type_min'", type);
     }
 }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-/*************************************************************
- **************      Arithmetic operations     ***************
- *************************************************************/
-char *
-gal_data_operator_string(int operator)
-{
-  switch(operator)
-    {
-    case GAL_DATA_OPERATOR_PLUS:         return "+";
-    case GAL_DATA_OPERATOR_MINUS:        return "-";
-    case GAL_DATA_OPERATOR_MULTIPLY:     return "*";
-    case GAL_DATA_OPERATOR_DIVIDE:       return "/";
-    case GAL_DATA_OPERATOR_MODULO:       return "%";
-
-    case GAL_DATA_OPERATOR_LT:           return "<";
-    case GAL_DATA_OPERATOR_LE:           return "<=";
-    case GAL_DATA_OPERATOR_GT:           return ">";
-    case GAL_DATA_OPERATOR_GE:           return ">=";
-    case GAL_DATA_OPERATOR_EQ:           return "==";
-    case GAL_DATA_OPERATOR_NE:           return "!=";
-    case GAL_DATA_OPERATOR_AND:          return "and";
-    case GAL_DATA_OPERATOR_OR:           return "or";
-    case GAL_DATA_OPERATOR_NOT:          return "not";
-    case GAL_DATA_OPERATOR_ISBLANK:      return "isblank";
-    case GAL_DATA_OPERATOR_WHERE:        return "where";
-
-    case GAL_DATA_OPERATOR_BITAND:       return "bitand";
-    case GAL_DATA_OPERATOR_BITOR:        return "bitor";
-    case GAL_DATA_OPERATOR_BITXOR:       return "bitxor";
-    case GAL_DATA_OPERATOR_BITLSH:       return "lshift";
-    case GAL_DATA_OPERATOR_BITRSH:       return "rshift";
-    case GAL_DATA_OPERATOR_BITNOT:       return "bitnot";
-
-    case GAL_DATA_OPERATOR_ABS:          return "abs";
-    case GAL_DATA_OPERATOR_POW:          return "pow";
-    case GAL_DATA_OPERATOR_SQRT:         return "sqrt";
-    case GAL_DATA_OPERATOR_LOG:          return "log";
-    case GAL_DATA_OPERATOR_LOG10:        return "log10";
-
-    case GAL_DATA_OPERATOR_MINVAL:       return "minvalue";
-    case GAL_DATA_OPERATOR_MAXVAL:       return "maxvalue";
-    case GAL_DATA_OPERATOR_MIN:          return "min";
-    case GAL_DATA_OPERATOR_MAX:          return "max";
-    case GAL_DATA_OPERATOR_AVERAGE:      return "average";
-    case GAL_DATA_OPERATOR_MEDIAN:       return "median";
-
-    case GAL_DATA_OPERATOR_TO_UCHAR:     return "uchar";
-    case GAL_DATA_OPERATOR_TO_CHAR:      return "char";
-    case GAL_DATA_OPERATOR_TO_USHORT:    return "ushort";
-    case GAL_DATA_OPERATOR_TO_SHORT:     return "short";
-    case GAL_DATA_OPERATOR_TO_UINT:      return "uint";
-    case GAL_DATA_OPERATOR_TO_INT:       return "int";
-    case GAL_DATA_OPERATOR_TO_ULONG:     return "ulong";
-    case GAL_DATA_OPERATOR_TO_LONG:      return "long";
-    case GAL_DATA_OPERATOR_TO_LONGLONG:  return "longlong";
-    case GAL_DATA_OPERATOR_TO_FLOAT:     return "float";
-    case GAL_DATA_OPERATOR_TO_DOUBLE:    return "double";
-
-    default:
-      error(EXIT_FAILURE, 0, "Operator code %d not recognized in "
-            "gal_data_operator_to_string", operator);
-    }
-
-  error(EXIT_FAILURE, 0, "A bug! Please contact us to fix the problem. "
-        "for some reason, control of the `gal_data_operator_to_string' "
-        "function has reached its end! This should not have happened");
-  return NULL;
-}
-
-
-
-
-
-static int
-data_arithmetic_nearest_compiled_type(int intype)
-{
-  switch(intype)
-    {
-    case GAL_DATA_TYPE_UCHAR:
-      if(GAL_CONFIG_BIN_OP_UCHAR) return GAL_DATA_TYPE_UCHAR;
-      else
-        {
-          if     (GAL_CONFIG_BIN_OP_USHORT)   return GAL_DATA_TYPE_USHORT;
-          else if(GAL_CONFIG_BIN_OP_SHORT)    return GAL_DATA_TYPE_SHORT;
-          else if(GAL_CONFIG_BIN_OP_UINT)     return GAL_DATA_TYPE_UINT;
-          else if(GAL_CONFIG_BIN_OP_INT)      return GAL_DATA_TYPE_INT;
-          else if(GAL_CONFIG_BIN_OP_ULONG)    return GAL_DATA_TYPE_ULONG;
-          else if(GAL_CONFIG_BIN_OP_LONG)     return GAL_DATA_TYPE_LONG;
-          else if(GAL_CONFIG_BIN_OP_LONGLONG) return GAL_DATA_TYPE_LONGLONG;
-          else if(GAL_CONFIG_BIN_OP_FLOAT)    return GAL_DATA_TYPE_FLOAT;
-          else if(GAL_CONFIG_BIN_OP_DOUBLE)   return GAL_DATA_TYPE_DOUBLE;
-        }
-      break;
-
-    case GAL_DATA_TYPE_CHAR:
-      if(GAL_CONFIG_BIN_OP_CHAR) return GAL_DATA_TYPE_CHAR;
-      else
-        {
-          if     (GAL_CONFIG_BIN_OP_SHORT)    return GAL_DATA_TYPE_SHORT;
-          else if(GAL_CONFIG_BIN_OP_INT)      return GAL_DATA_TYPE_INT;
-          else if(GAL_CONFIG_BIN_OP_LONG)     return GAL_DATA_TYPE_LONG;
-          else if(GAL_CONFIG_BIN_OP_LONGLONG) return GAL_DATA_TYPE_LONGLONG;
-          else if(GAL_CONFIG_BIN_OP_FLOAT)    return GAL_DATA_TYPE_FLOAT;
-          else if(GAL_CONFIG_BIN_OP_DOUBLE)   return GAL_DATA_TYPE_DOUBLE;
-        }
-      break;
-
-    case GAL_DATA_TYPE_USHORT:
-      if(GAL_CONFIG_BIN_OP_USHORT) return GAL_DATA_TYPE_USHORT;
-      else
-        {
-          if     (GAL_CONFIG_BIN_OP_UINT)     return GAL_DATA_TYPE_UINT;
-          else if(GAL_CONFIG_BIN_OP_INT)      return GAL_DATA_TYPE_INT;
-          else if(GAL_CONFIG_BIN_OP_ULONG)    return GAL_DATA_TYPE_ULONG;
-          else if(GAL_CONFIG_BIN_OP_LONG)     return GAL_DATA_TYPE_LONG;
-          else if(GAL_CONFIG_BIN_OP_LONGLONG) return GAL_DATA_TYPE_LONGLONG;
-          else if(GAL_CONFIG_BIN_OP_FLOAT)    return GAL_DATA_TYPE_FLOAT;
-          else if(GAL_CONFIG_BIN_OP_DOUBLE)   return GAL_DATA_TYPE_DOUBLE;
-        }
-      break;
-
-    case GAL_DATA_TYPE_SHORT:
-      if(GAL_CONFIG_BIN_OP_SHORT) return GAL_DATA_TYPE_SHORT;
-      else
-        {
-          if     (GAL_CONFIG_BIN_OP_INT)      return GAL_DATA_TYPE_INT;
-          else if(GAL_CONFIG_BIN_OP_LONG)     return GAL_DATA_TYPE_LONG;
-          else if(GAL_CONFIG_BIN_OP_LONGLONG) return GAL_DATA_TYPE_LONGLONG;
-          else if(GAL_CONFIG_BIN_OP_FLOAT)    return GAL_DATA_TYPE_FLOAT;
-          else if(GAL_CONFIG_BIN_OP_DOUBLE)   return GAL_DATA_TYPE_DOUBLE;
-        }
-      break;
-
-    case GAL_DATA_TYPE_UINT:
-      if(GAL_CONFIG_BIN_OP_UINT) return GAL_DATA_TYPE_UINT;
-      else
-        {
-          if     (GAL_CONFIG_BIN_OP_ULONG)    return GAL_DATA_TYPE_ULONG;
-          else if(GAL_CONFIG_BIN_OP_LONG)     return GAL_DATA_TYPE_LONG;
-          else if(GAL_CONFIG_BIN_OP_LONGLONG) return GAL_DATA_TYPE_LONGLONG;
-          else if(GAL_CONFIG_BIN_OP_FLOAT)    return GAL_DATA_TYPE_FLOAT;
-          else if(GAL_CONFIG_BIN_OP_DOUBLE)   return GAL_DATA_TYPE_DOUBLE;
-        }
-      break;
-
-    case GAL_DATA_TYPE_INT:
-      if(GAL_CONFIG_BIN_OP_INT) return GAL_DATA_TYPE_INT;
-      else
-        {
-          if     (GAL_CONFIG_BIN_OP_LONG)     return GAL_DATA_TYPE_LONG;
-          else if(GAL_CONFIG_BIN_OP_LONGLONG) return GAL_DATA_TYPE_LONGLONG;
-          else if(GAL_CONFIG_BIN_OP_FLOAT)    return GAL_DATA_TYPE_FLOAT;
-          else if(GAL_CONFIG_BIN_OP_DOUBLE)   return GAL_DATA_TYPE_DOUBLE;
-        }
-      break;
-
-    case GAL_DATA_TYPE_ULONG:
-      if(GAL_CONFIG_BIN_OP_ULONG) return GAL_DATA_TYPE_ULONG;
-      else
-        {
-          if     (GAL_CONFIG_BIN_OP_LONGLONG) return GAL_DATA_TYPE_LONGLONG;
-          else if(GAL_CONFIG_BIN_OP_FLOAT)    return GAL_DATA_TYPE_FLOAT;
-          else if(GAL_CONFIG_BIN_OP_DOUBLE)   return GAL_DATA_TYPE_DOUBLE;
-        }
-      break;
-
-    case GAL_DATA_TYPE_LONG:
-      if(GAL_CONFIG_BIN_OP_LONG) return GAL_DATA_TYPE_LONG;
-      else
-        {
-          if     (GAL_CONFIG_BIN_OP_LONGLONG) return GAL_DATA_TYPE_LONGLONG;
-          else if(GAL_CONFIG_BIN_OP_FLOAT)    return GAL_DATA_TYPE_FLOAT;
-          else if(GAL_CONFIG_BIN_OP_DOUBLE)   return GAL_DATA_TYPE_DOUBLE;
-        }
-      break;
-
-    case GAL_DATA_TYPE_LONGLONG:
-      if(GAL_CONFIG_BIN_OP_LONGLONG) return GAL_DATA_TYPE_LONGLONG;
-      else
-        {
-          if     (GAL_CONFIG_BIN_OP_FLOAT)    return GAL_DATA_TYPE_FLOAT;
-          else if(GAL_CONFIG_BIN_OP_DOUBLE)   return GAL_DATA_TYPE_DOUBLE;
-        }
-      break;
-
-    case GAL_DATA_TYPE_FLOAT:
-      if(GAL_CONFIG_BIN_OP_FLOAT) return GAL_DATA_TYPE_FLOAT;
-      else
-        {
-          if     (GAL_CONFIG_BIN_OP_DOUBLE)   return GAL_DATA_TYPE_DOUBLE;
-        }
-      break;
-
-    case GAL_DATA_TYPE_DOUBLE:
-      if         (GAL_CONFIG_BIN_OP_DOUBLE)   return GAL_DATA_TYPE_DOUBLE;
-      break;
-
-    default:
-      error(EXIT_FAILURE, 0, "type %d not recognized in "
-            "binary_type_for_convert_to_compiled_type", intype);
-    }
-
-  return 0;
-}
-
-
-
-
-
-/* Note that for signed types, we won't be considering the unsigned types
-   of the larger types. */
-gal_data_t *
-data_arithmetic_convert_to_compiled_type(gal_data_t *in, unsigned char flags)
-{
-  int ntype;
-  char *typestring;
-  gal_data_t *out=NULL;
-
-  /* Set the best compiled type. */
-  ntype=data_arithmetic_nearest_compiled_type(in->type);
-
-  /* If type is not compiled, then convert the dataset to the first
-     compiled larger type. */
-  if(in->type==ntype)
-    out=in;
-  else
-    {
-      if(ntype)
-        {
-          out=gal_data_copy_to_new_type(in, ntype);
-          if(flags & GAL_DATA_ARITH_FREE)
-            { gal_data_free(in, 0); in=NULL; }
-        }
-      else
-        {
-          typestring=gal_data_type_string(in->type, 1);
-          error(EXIT_FAILURE, 0, "The given %s type data given to "
-                "binary operators is not compiled for native operation "
-                "and no larger types are compiled either.\n\nThe "
-                "largest type (which can act as a fallback for any "
-                "input type is double, so configure Gnuastro again "
-                "with `--enable-bin-op-double' to not get this error "
-                "any more. However, if you commonly deal with %s type "
-                "data, also enable %s with a similar option at "
-                "configure time to greatly decrease running time and "
-                "avoid unnecessary RAM and CPU resources. Run"
-                "`./configure --help' in Gnuastro's top source "
-                "directory (after unpacking the tarball) for the full "
-                "list of options", typestring, typestring, typestring);
-        }
-    }
-
-  /* Return the output data structure */
-  if(out==NULL)
-    error(EXIT_FAILURE, 0, "A bug! Please contact us at %s, so we can fix "
-          "the problem. For some reason, the `out' array in "
-          "`binary_convert_to_compiled_type' is not set", PACKAGE_BUGREPORT);
-  return out;
-}
-
-
-
-
-
-gal_data_t *
-gal_data_arithmetic(int operator, unsigned char flags, ...)
-{
-  va_list va;
-  gal_data_t *d1, *d2, *d3, *out=NULL;
-
-  /* Prepare the variable arguments (starting after the flags argument). */
-  va_start(va, flags);
-
-  /* Depending on the operator do the job: */
-  switch(operator)
-    {
-
-    /* Binary operators with any data type. */
-    case GAL_DATA_OPERATOR_PLUS:
-    case GAL_DATA_OPERATOR_MINUS:
-    case GAL_DATA_OPERATOR_MULTIPLY:
-    case GAL_DATA_OPERATOR_DIVIDE:
-    case GAL_DATA_OPERATOR_LT:
-    case GAL_DATA_OPERATOR_LE:
-    case GAL_DATA_OPERATOR_GT:
-    case GAL_DATA_OPERATOR_GE:
-    case GAL_DATA_OPERATOR_EQ:
-    case GAL_DATA_OPERATOR_NE:
-    case GAL_DATA_OPERATOR_AND:
-    case GAL_DATA_OPERATOR_OR:
-      d1 = va_arg(va, gal_data_t *);
-      d2 = va_arg(va, gal_data_t *);
-      out=data_arithmetic_binary(operator, flags, d1, d2);
-      break;
-
-    case GAL_DATA_OPERATOR_NOT:
-      d1 = va_arg(va, gal_data_t *);
-      out=data_arithmetic_not(d1, flags);
-      break;
-
-    case GAL_DATA_OPERATOR_ISBLANK:
-      d1 = va_arg(va, gal_data_t *);
-      out = gal_data_flag_blank(d1);
-      if(flags & GAL_DATA_ARITH_FREE) gal_data_free(d1, 0);
-      break;
-
-    case GAL_DATA_OPERATOR_WHERE:
-      d1 = va_arg(va, gal_data_t *);    /* Output value/array.        */
-      d2 = va_arg(va, gal_data_t *);    /* Condition (unsigned char). */
-      d3 = va_arg(va, gal_data_t *);    /* If true value/array.       */
-      data_arithmetic_where(flags, d1, d2, d3);
-      out=d1;
-      break;
-
-
-    /* Unary function operators. */
-    case GAL_DATA_OPERATOR_SQRT:
-    case GAL_DATA_OPERATOR_LOG:
-    case GAL_DATA_OPERATOR_LOG10:
-    case GAL_DATA_OPERATOR_MINVAL:
-    case GAL_DATA_OPERATOR_MAXVAL:
-      d1 = va_arg(va, gal_data_t *);
-      out=data_arithmetic_unary_function(operator, flags, d1);
-      break;
-
-    case GAL_DATA_OPERATOR_ABS:
-      d1 = va_arg(va, gal_data_t *);
-      out=data_arithmetic_abs(flags, d1);
-      break;
-
-    case GAL_DATA_OPERATOR_MIN:
-    case GAL_DATA_OPERATOR_MAX:
-    case GAL_DATA_OPERATOR_SUM:
-    case GAL_DATA_OPERATOR_AVERAGE:
-    case GAL_DATA_OPERATOR_MEDIAN:
-      d1 = va_arg(va, gal_data_t *);
-      out=data_arithmetic_multioperand(operator, flags, d1);
-      break;
-
-
-    /* Binary function operators. */
-    case GAL_DATA_OPERATOR_POW:
-      d1 = va_arg(va, gal_data_t *);
-      d2 = va_arg(va, gal_data_t *);
-      out=data_arithmetic_binary_function_flt(operator, flags, d1, d2);
-      break;
-
-
-    /* Binary operators that only work on integer types. */
-    case GAL_DATA_OPERATOR_BITAND:
-    case GAL_DATA_OPERATOR_BITOR:
-    case GAL_DATA_OPERATOR_BITXOR:
-    case GAL_DATA_OPERATOR_BITLSH:
-    case GAL_DATA_OPERATOR_BITRSH:
-    case GAL_DATA_OPERATOR_MODULO:
-      d1 = va_arg(va, gal_data_t *);
-      d2 = va_arg(va, gal_data_t *);
-      out=data_arithmetic_onlyint_binary(operator, flags, d1, d2);
-      break;
-
-    case GAL_DATA_OPERATOR_BITNOT:
-      d1 = va_arg(va, gal_data_t *);
-      out=data_arithmetic_bitwise_not(flags, d1);
-      break;
-
-
-    /* Conversion operators. */
-    case GAL_DATA_OPERATOR_TO_UCHAR:
-    case GAL_DATA_OPERATOR_TO_CHAR:
-    case GAL_DATA_OPERATOR_TO_USHORT:
-    case GAL_DATA_OPERATOR_TO_SHORT:
-    case GAL_DATA_OPERATOR_TO_UINT:
-    case GAL_DATA_OPERATOR_TO_INT:
-    case GAL_DATA_OPERATOR_TO_ULONG:
-    case GAL_DATA_OPERATOR_TO_LONG:
-    case GAL_DATA_OPERATOR_TO_LONGLONG:
-    case GAL_DATA_OPERATOR_TO_FLOAT:
-    case GAL_DATA_OPERATOR_TO_DOUBLE:
-      d1 = va_arg(va, gal_data_t *);
-      out=data_arithmetic_change_type(d1, operator, flags);
-      break;
-
-
-    /* When operator is not recognized. */
-    default:
-      error(EXIT_FAILURE, 0, "the argument \"%d\" could not be "
-            "interpretted as an operator", operator);
-    }
-
-  /* End the variable argument structure and return. */
-  va_end(va);
-  return out;
-}
diff --git a/lib/gnuastro/arithmetic.h b/lib/gnuastro/arithmetic.h
new file mode 100644
index 0000000..a1764f6
--- /dev/null
+++ b/lib/gnuastro/arithmetic.h
@@ -0,0 +1,124 @@
+/*********************************************************************
+data -- Structure and functions to represent/work with data
+This is part of GNU Astronomy Utilities (Gnuastro) package.
+
+Original author:
+     Mohammad Akhlaghi <address@hidden>
+Contributing author(s):
+Copyright (C) 2015, Free Software Foundation, Inc.
+
+Gnuastro is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation, either version 3 of the License, or (at your
+option) any later version.
+
+Gnuastro is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
+**********************************************************************/
+#ifndef __GAL_ARITHMETIC_H__
+#define __GAL_ARITHMETIC_H__
+
+/* Include other headers if necessary here. Note that other header files
+   must be included before the C++ preparations below */
+#include <gnuastro/data.h>
+
+/* C++ Preparations */
+#undef __BEGIN_C_DECLS
+#undef __END_C_DECLS
+#ifdef __cplusplus
+# define __BEGIN_C_DECLS extern "C" {
+# define __END_C_DECLS }
+#else
+# define __BEGIN_C_DECLS                /* empty */
+# define __END_C_DECLS                  /* empty */
+#endif
+/* End of C++ preparations */
+
+
+
+/* Actual header contants (the above were for the Pre-processor). */
+__BEGIN_C_DECLS  /* From C++ preparations */
+
+
+
+
+
+enum gal_arithmetic_operators
+{
+  GAL_ARITHMETIC_OP_PLUS,         /*   +     */
+  GAL_ARITHMETIC_OP_MINUS,        /*   -     */
+  GAL_ARITHMETIC_OP_MULTIPLY,     /*   *     */
+  GAL_ARITHMETIC_OP_DIVIDE,       /*   /     */
+  GAL_ARITHMETIC_OP_MODULO,       /*   %     */
+
+  GAL_ARITHMETIC_OP_LT,           /*   <     */
+  GAL_ARITHMETIC_OP_LE,           /*   <=    */
+  GAL_ARITHMETIC_OP_GT,           /*   >     */
+  GAL_ARITHMETIC_OP_GE,           /*   >=    */
+  GAL_ARITHMETIC_OP_EQ,           /*   ==    */
+  GAL_ARITHMETIC_OP_NE,           /*   !=    */
+  GAL_ARITHMETIC_OP_AND,          /*   &&    */
+  GAL_ARITHMETIC_OP_OR,           /*   ||    */
+  GAL_ARITHMETIC_OP_NOT,          /*   !     */
+  GAL_ARITHMETIC_OP_ISBLANK,      /* Similar to isnan() for floats. */
+  GAL_ARITHMETIC_OP_WHERE,        /*   ?:    */
+
+  GAL_ARITHMETIC_OP_BITAND,       /*   &     */
+  GAL_ARITHMETIC_OP_BITOR,        /*   |     */
+  GAL_ARITHMETIC_OP_BITXOR,       /*   ^     */
+  GAL_ARITHMETIC_OP_BITLSH,       /*   <<    */
+  GAL_ARITHMETIC_OP_BITRSH,       /*   >>    */
+  GAL_ARITHMETIC_OP_BITNOT,       /*   ~     */
+
+  GAL_ARITHMETIC_OP_ABS,          /* abs()   */
+  GAL_ARITHMETIC_OP_POW,          /* pow()   */
+  GAL_ARITHMETIC_OP_SQRT,         /* sqrt()  */
+  GAL_ARITHMETIC_OP_LOG,          /* log()   */
+  GAL_ARITHMETIC_OP_LOG10,        /* log10() */
+
+  GAL_ARITHMETIC_OP_MINVAL,       /* Minimum value of array.               */
+  GAL_ARITHMETIC_OP_MAXVAL,       /* Maximum value of array.               */
+  GAL_ARITHMETIC_OP_MIN,          /* Minimum per pixel of multiple arrays. */
+  GAL_ARITHMETIC_OP_MAX,          /* Maximum per pixel of multiple arrays. */
+  GAL_ARITHMETIC_OP_SUM,          /* Sum per pixel of multiple arrays.     */
+  GAL_ARITHMETIC_OP_AVERAGE,      /* Average per pixel of multiple arrays. */
+  GAL_ARITHMETIC_OP_MEDIAN,       /* Median per pixel of multiple arrays.  */
+
+  GAL_ARITHMETIC_OP_TO_UCHAR,     /* Convert to unsigned char.             */
+  GAL_ARITHMETIC_OP_TO_CHAR,      /* Convert to char.                      */
+  GAL_ARITHMETIC_OP_TO_USHORT,    /* Convert to unsigned short.            */
+  GAL_ARITHMETIC_OP_TO_SHORT,     /* Convert to short.                     */
+  GAL_ARITHMETIC_OP_TO_UINT,      /* Convert to unsigned int.              */
+  GAL_ARITHMETIC_OP_TO_INT,       /* Convert to int.                       */
+  GAL_ARITHMETIC_OP_TO_ULONG,     /* Convert to unsigned long.             */
+  GAL_ARITHMETIC_OP_TO_LONG,      /* Convert to long.                      */
+  GAL_ARITHMETIC_OP_TO_LONGLONG,  /* Convert to LONGLONG.                  */
+  GAL_ARITHMETIC_OP_TO_FLOAT,     /* Convert to float.                     */
+  GAL_ARITHMETIC_OP_TO_DOUBLE,    /* Convert to double.                    */
+};
+
+
+
+
+
+char *
+gal_arithmetic_operator_string(int operator);
+
+gal_data_t *
+gal_arithmetic_convert_to_compiled_type(gal_data_t *in, unsigned char flags);
+
+gal_data_t *
+gal_arithmetic(int operator, unsigned char flags, ...);
+
+
+
+
+
+__END_C_DECLS    /* From C++ preparations */
+
+#endif           /* __GAL_ARITHMETIC_H__ */
diff --git a/lib/gnuastro/data.h b/lib/gnuastro/data.h
index 170d507..4230e9b 100644
--- a/lib/gnuastro/data.h
+++ b/lib/gnuastro/data.h
@@ -103,6 +103,7 @@ __BEGIN_C_DECLS  /* From C++ preparations */
 
 
 
+
 /* Macros to identify the type of data. The macros in the comment
    parenthesis is the equivalent macro in CFITSIO. */
 enum gal_data_types
@@ -129,64 +130,6 @@ enum gal_data_types
 
 
 
-enum gal_data_operators
-{
-  GAL_DATA_OPERATOR_PLUS,         /*   +     */
-  GAL_DATA_OPERATOR_MINUS,        /*   -     */
-  GAL_DATA_OPERATOR_MULTIPLY,     /*   *     */
-  GAL_DATA_OPERATOR_DIVIDE,       /*   /     */
-  GAL_DATA_OPERATOR_MODULO,       /*   %     */
-
-  GAL_DATA_OPERATOR_LT,           /*   <     */
-  GAL_DATA_OPERATOR_LE,           /*   <=    */
-  GAL_DATA_OPERATOR_GT,           /*   >     */
-  GAL_DATA_OPERATOR_GE,           /*   >=    */
-  GAL_DATA_OPERATOR_EQ,           /*   ==    */
-  GAL_DATA_OPERATOR_NE,           /*   !=    */
-  GAL_DATA_OPERATOR_AND,          /*   &&    */
-  GAL_DATA_OPERATOR_OR,           /*   ||    */
-  GAL_DATA_OPERATOR_NOT,          /*   !     */
-  GAL_DATA_OPERATOR_ISBLANK,      /* Similar to isnan() for floats. */
-  GAL_DATA_OPERATOR_WHERE,        /*   ?:    */
-
-  GAL_DATA_OPERATOR_BITAND,       /*   &     */
-  GAL_DATA_OPERATOR_BITOR,        /*   |     */
-  GAL_DATA_OPERATOR_BITXOR,       /*   ^     */
-  GAL_DATA_OPERATOR_BITLSH,       /*   <<    */
-  GAL_DATA_OPERATOR_BITRSH,       /*   >>    */
-  GAL_DATA_OPERATOR_BITNOT,       /*   ~     */
-
-  GAL_DATA_OPERATOR_ABS,          /* abs()   */
-  GAL_DATA_OPERATOR_POW,          /* pow()   */
-  GAL_DATA_OPERATOR_SQRT,         /* sqrt()  */
-  GAL_DATA_OPERATOR_LOG,          /* log()   */
-  GAL_DATA_OPERATOR_LOG10,        /* log10() */
-
-  GAL_DATA_OPERATOR_MINVAL,       /* Minimum value of array.               */
-  GAL_DATA_OPERATOR_MAXVAL,       /* Maximum value of array.               */
-  GAL_DATA_OPERATOR_MIN,          /* Minimum per pixel of multiple arrays. */
-  GAL_DATA_OPERATOR_MAX,          /* Maximum per pixel of multiple arrays. */
-  GAL_DATA_OPERATOR_SUM,          /* Sum per pixel of multiple arrays.     */
-  GAL_DATA_OPERATOR_AVERAGE,      /* Average per pixel of multiple arrays. */
-  GAL_DATA_OPERATOR_MEDIAN,       /* Median per pixel of multiple arrays.  */
-
-  GAL_DATA_OPERATOR_TO_UCHAR,     /* Convert to unsigned char.             */
-  GAL_DATA_OPERATOR_TO_CHAR,      /* Convert to char.                      */
-  GAL_DATA_OPERATOR_TO_USHORT,    /* Convert to unsigned short.            */
-  GAL_DATA_OPERATOR_TO_SHORT,     /* Convert to short.                     */
-  GAL_DATA_OPERATOR_TO_UINT,      /* Convert to unsigned int.              */
-  GAL_DATA_OPERATOR_TO_INT,       /* Convert to int.                       */
-  GAL_DATA_OPERATOR_TO_ULONG,     /* Convert to unsigned long.             */
-  GAL_DATA_OPERATOR_TO_LONG,      /* Convert to long.                      */
-  GAL_DATA_OPERATOR_TO_LONGLONG,  /* Convert to LONGLONG.                  */
-  GAL_DATA_OPERATOR_TO_FLOAT,     /* Convert to float.                     */
-  GAL_DATA_OPERATOR_TO_DOUBLE,    /* Convert to double.                    */
-};
-
-
-
-
-
 /* Main data structure.
 
    Notes
@@ -371,25 +314,6 @@ gal_data_type_max(int type, void *in);
 
 
 
-
-/*************************************************************
- **************           Arithmetic           ***************
- *************************************************************/
-char *
-gal_data_operator_string(int operator);
-
-gal_data_t *
-data_arithmetic_convert_to_compiled_type(gal_data_t *in, unsigned char flags);
-
-
-
-gal_data_t *
-gal_data_arithmetic(int operator, unsigned char flags, ...);
-
-
-
-
-
 __END_C_DECLS    /* From C++ preparations */
 
 #endif           /* __GAL_DATA_H__ */



reply via email to

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