Index: sasmodels/gen.py
===================================================================
--- sasmodels/gen.py	(revision 78356b315a2aafc7ad44548bed9f144a7c826cf8)
+++ sasmodels/gen.py	(revision 994d77f9b713691e41106d1f9af9661dfb2dc419)
@@ -37,14 +37,10 @@
 order so that functions are defined before they are used.
 
-Floating point values should be declared as *real*.  Depending on how the
-function is called, a macro will replace *real* with *float* or *double*.
-Unfortunately, MacOSX is picky about floating point constants, which
-should be defined with value + 'f' if they are of type *float* or just
-a bare value if they are of type *double*.  The solution is a macro
-*REAL(value)* which adds the 'f' if compiling for single precision
-floating point.  [Note: we could write a clever regular expression
-which automatically detects real-valued constants.  If we wanted to
-make our code more C-like, we could define variables with double but
-replace them with float before compiling for single precision.]
+Floating point values should be declared as *double*.  For single precision
+calculations, *double* will be replaced by *float*.  The single precision
+conversion will also tag floating point constants with "f" to make them
+single precision constants.  When using integral values in floating point
+expressions, they should be expressed as floating point values by including
+a decimal point.  This includes 0., 1. and 2.
 
 OpenCL has a *sincos* function which can improve performance when both
@@ -52,7 +48,8 @@
 this function does not exist in C99, all use of *sincos* should be
 replaced by the macro *SINCOS(value,sn,cn)* where *sn* and *cn* are
-previously declared *real* values.  *value* may be an expression.  When
-compiled for systems without OpenCL, *SINCOS* will be replaced by
-*sin* and *cos* calls.
+previously declared *double* variables.  When compiled for systems without
+OpenCL, *SINCOS* will be replaced by *sin* and *cos* calls.   If *value* is
+an expression, it will appear twice in this case; whether or not it will be
+evaluated twice depends on the quality of the compiler.
 
 If the input parameters are invalid, the scattering calculator should
@@ -172,9 +169,10 @@
 # TODO: identify model files which have changed since loading and reload them.
 
-__all__ = ["make, doc", "sources"]
+__all__ = ["make, doc", "sources", "use_single"]
 
 import sys
 import os
 import os.path
+import re
 
 import numpy as np
@@ -229,8 +227,4 @@
 #ifndef USE_OPENCL
 #  include <math.h>
-#  define REAL(x) (x)
-#  ifndef real
-#      define real double
-#  endif
 #  define global
 #  define local
@@ -253,16 +247,16 @@
 // is not enabled on the card, which is why these constants may be missing
 #ifndef M_PI
-#  define M_PI REAL(3.141592653589793)
+#  define M_PI 3.141592653589793
 #endif
 #ifndef M_PI_2
-#  define M_PI_2 REAL(1.570796326794897)
+#  define M_PI_2 1.570796326794897
 #endif
 #ifndef M_PI_4
-#  define M_PI_4 REAL(0.7853981633974483)
+#  define M_PI_4 0.7853981633974483
 #endif
 
 // Non-standard pi/180, used for converting between degrees and radians
 #ifndef M_PI_180
-#  define M_PI_180 REAL(0.017453292519943295)
+#  define M_PI_180 0.017453292519943295
 #endif
 """
@@ -274,6 +268,6 @@
 KERNEL_1D = {
     'fn': "Iq",
-    'q_par_decl': "global const real *q,",
-    'qinit': "const real qi = q[i];",
+    'q_par_decl': "global const double *q,",
+    'qinit': "const double qi = q[i];",
     'qcall': "qi",
     'qwork': ["q"],
@@ -282,6 +276,6 @@
 KERNEL_2D = {
     'fn': "Iqxy",
-    'q_par_decl': "global const real *qx,\n    global const real *qy,",
-    'qinit': "const real qxi = qx[i];\n    const real qyi = qy[i];",
+    'q_par_decl': "global const double *qx,\n    global const double *qy,",
+    'qinit': "const double qxi = qx[i];\n    const double qyi = qy[i];",
     'qcall': "qxi, qyi",
     'qwork': ["qx", "qy"],
@@ -296,12 +290,12 @@
 kernel void %(name)s(
     %(q_par_decl)s
-    global real *result,
+    global double *result,
 #ifdef USE_OPENCL
-    global real *loops_g,
+    global double *loops_g,
 #else
     const int Nq,
 #endif
-    local real *loops,
-    const real cutoff,
+    local double *loops,
+    const double cutoff,
     %(par_decl)s
     )
@@ -324,8 +318,8 @@
   {
     %(qinit)s
-    real ret=REAL(0.0), norm=REAL(0.0);
-    real vol=REAL(0.0), norm_vol=REAL(0.0);
+    double ret=0.0, norm=0.0;
+    double vol=0.0, norm_vol=0.0;
 %(loops)s
-    if (vol*norm_vol != REAL(0.0)) {
+    if (vol*norm_vol != 0.0) {
       ret *= norm_vol/vol;
     }
@@ -340,6 +334,6 @@
 LOOP_OPEN="""\
 for (int %(name)s_i=0; %(name)s_i < N%(name)s; %(name)s_i++) {
-  const real %(name)s = loops[2*(%(name)s_i%(offset)s)];
-  const real %(name)s_w = loops[2*(%(name)s_i%(offset)s)+1];\
+  const double %(name)s = loops[2*(%(name)s_i%(offset)s)];
+  const double %(name)s_w = loops[2*(%(name)s_i%(offset)s)+1];\
 """
 
@@ -349,8 +343,8 @@
 # it will also be added here.
 LOOP_BODY="""\
-const real weight = %(weight_product)s;
+const double weight = %(weight_product)s;
 if (weight > cutoff) {
-  const real I = %(fn)s(%(qcall)s, %(pcall)s);
-  if (I>=REAL(0.0)) { // scattering cannot be negative
+  const double I = %(fn)s(%(qcall)s, %(pcall)s);
+  if (I>=0.0) { // scattering cannot be negative
     ret += weight*I%(sasview_spherical)s;
     norm += weight;
@@ -365,10 +359,10 @@
 SPHERICAL_CORRECTION="""\
 // Correction factor for spherical integration p(theta) I(q) sin(theta) dtheta
-real spherical_correction = (Ntheta>1 ? fabs(sin(M_PI_180*theta)) : REAL(1.0));\
+double spherical_correction = (Ntheta>1 ? fabs(sin(M_PI_180*theta)) : 1.0);\
 """
 # Use this to reproduce sasview behaviour
 SASVIEW_SPHERICAL_CORRECTION="""\
 // Correction factor for spherical integration p(theta) I(q) sin(theta) dtheta
-real spherical_correction = (Ntheta>1 ? fabs(cos(M_PI_180*theta))*M_PI_2 : REAL(1.0));\
+double spherical_correction = (Ntheta>1 ? fabs(cos(M_PI_180*theta))*M_PI_2 : 1.0);\
 """
 
@@ -377,5 +371,5 @@
 # to call the form_volume function from the user supplied kernel, and accumulate
 # a normalized weight.
-VOLUME_NORM="""const real vol_weight = %(weight)s;
+VOLUME_NORM="""const double vol_weight = %(weight)s;
     vol += vol_weight*form_volume(%(pars)s);
     norm_vol += vol_weight;\
@@ -384,6 +378,6 @@
 # functions defined as strings in the .py module
 WORK_FUNCTION="""\
-real %(name)s(%(pars)s);
-real %(name)s(%(pars)s)
+double %(name)s(%(pars)s);
+double %(name)s(%(pars)s)
 {
 %(body)s
@@ -422,4 +416,15 @@
     """
     return info['name'] + "_" + ("Iqxy" if is_2D else "Iq")
+
+
+def use_single(source):
+    """
+    Convert code from double precision to single precision.
+    """
+    source = re.sub(r'(^|[^a-zA-Z0-9_])double($|[^a-zA-Z0-9_])',
+                    r'\1float\2', source)
+    source = re.sub(r'[^a-zA-Z_](\d*[.]\d+|\d+[.]\d*)([eE][+-]?\d+)?',
+                    r'\g<0>f', source)
+    return source
 
 
@@ -503,7 +508,7 @@
     # declarations for non-pd followed by pd pars
     # e.g.,
-    #     const real sld,
+    #     const double sld,
     #     const int Nradius
-    fixed_par_decl = ",\n    ".join("const real %s"%p for p in fixed_pars)
+    fixed_par_decl = ",\n    ".join("const double %s"%p for p in fixed_pars)
     pd_par_decl = ",\n    ".join("const int N%s"%p for p in pd_pars)
     if fixed_par_decl and pd_par_decl:
@@ -518,11 +523,11 @@
         # kernel name is, e.g., cylinder_Iq
         'name': kernel_name(info, is_2D),
-        # to declare, e.g., global real q[],
+        # to declare, e.g., global double q[],
         'q_par_decl': q_pars['q_par_decl'],
-        # to declare, e.g., real sld, int Nradius, int Nlength
+        # to declare, e.g., double sld, int Nradius, int Nlength
         'par_decl': par_decl,
         # to copy global to local pd pars we need, e.g., Nradius+Nlength
         'pd_length': "+".join('N'+p for p in pd_pars),
-        # the q initializers, e.g., real qi = q[i];
+        # the q initializers, e.g., double qi = q[i];
         'qinit': q_pars['qinit'],
         # the actual polydispersity loop
@@ -537,5 +542,5 @@
         subst = {
             'name': fn,
-            'pars': ", ".join("real "+p for p in q_pars['qwork']+fq_pars),
+            'pars': ", ".join("double "+p for p in q_pars['qwork']+fq_pars),
             'body': info[fn],
             }
@@ -607,5 +612,5 @@
         subst = {
             'name': "form_volume",
-            'pars': ", ".join("real "+p for p in info['partype']['volume']),
+            'pars': ", ".join("double "+p for p in info['partype']['volume']),
             'body': info['form_volume'],
             }
Index: sasmodels/gpu.py
===================================================================
--- sasmodels/gpu.py	(revision d087487be8e4898a912b0ee2eaf2cfb1c5f8b606)
+++ sasmodels/gpu.py	(revision 994d77f9b713691e41106d1f9af9661dfb2dc419)
@@ -29,16 +29,8 @@
 from . import gen
 
-F32_DEFS = """\
-#define REAL(x) (x##f)
-#define real float
-"""
-
-
 F64_DEFS = """\
 #ifdef cl_khr_fp64
 #  pragma OPENCL EXTENSION cl_khr_fp64: enable
 #endif
-#define REAL(x) (x)
-#define real double
 """
 
@@ -116,5 +108,7 @@
         raise RuntimeError("Double precision not supported for devices")
 
-    header = F64_DEFS if dtype == gen.F64 else F32_DEFS
+    header = F64_DEFS if dtype == gen.F64 else ""
+    if dtype == gen.F32:
+        source = gen.use_single(source)
     # Note: USE_SINCOS makes the intel cpu slower under opencl
     if context.devices[0].type == cl.device_type.GPU:
Index: sasmodels/models/capped_cylinder.c
===================================================================
--- sasmodels/models/capped_cylinder.c	(revision f4cf580e329add99780558498dbc8a8ab076ad24)
+++ sasmodels/models/capped_cylinder.c	(revision 994d77f9b713691e41106d1f9af9661dfb2dc419)
@@ -1,7 +1,7 @@
-real form_volume(real radius, real cap_radius, real length);
-real Iq(real q, real sld, real solvent_sld,
-    real radius, real cap_radius, real length);
-real Iqxy(real qx, real qy, real sld, real solvent_sld,
-    real radius, real cap_radius, real length, real theta, real phi);
+double form_volume(double radius, double cap_radius, double length);
+double Iq(double q, double sld, double solvent_sld,
+    double radius, double cap_radius, double length);
+double Iqxy(double qx, double qy, double sld, double solvent_sld,
+    double radius, double cap_radius, double length, double theta, double phi);
 
 // Integral over a convex lens kernel for t in [h/R,1].  See the docs for
@@ -13,13 +13,13 @@
 //   length is the cylinder length, or the separation between the lens halves
 //   alpha is the angle of the cylinder wrt q.
-real _cap_kernel(real q, real h, real cap_radius, real length,
-                 real sin_alpha, real cos_alpha);
-real _cap_kernel(real q, real h, real cap_radius, real length,
-                 real sin_alpha, real cos_alpha)
+double _cap_kernel(double q, double h, double cap_radius, double length,
+                 double sin_alpha, double cos_alpha);
+double _cap_kernel(double q, double h, double cap_radius, double length,
+                 double sin_alpha, double cos_alpha)
 {
     // For speed, we are pre-calculating terms which are constant over the
     // kernel.
-    const real upper = REAL(1.0);
-    const real lower = h/cap_radius; // integral lower bound
+    const double upper = 1.0;
+    const double lower = h/cap_radius; // integral lower bound
     // cos term in integral is:
     //    cos (q (R t - h + L/2) cos(alpha))
@@ -29,25 +29,25 @@
     //    m = q R cos(alpha)
     //    b = q(L/2-h) cos(alpha)
-    const real m = q*cap_radius*cos_alpha; // cos argument slope
-    const real b = q*(REAL(0.5)*length-h)*cos_alpha; // cos argument intercept
-    const real qrst = q*cap_radius*sin_alpha; // Q*R*sin(theta)
-    real total = REAL(0.0);
+    const double m = q*cap_radius*cos_alpha; // cos argument slope
+    const double b = q*(0.5*length-h)*cos_alpha; // cos argument intercept
+    const double qrst = q*cap_radius*sin_alpha; // Q*R*sin(theta)
+    double total = 0.0;
     for (int i=0; i<76 ;i++) {
         // translate a point in [-1,1] to a point in [lower,upper]
-        //const real t = ( Gauss76Z[i]*(upper-lower) + upper + lower )/2.0;
-        const real t = REAL(0.5)*(Gauss76Z[i]*(upper-lower)+upper+lower);
-        const real radical = REAL(1.0) - t*t;
-        const real arg = qrst*sqrt(radical); // cap bessel function arg
-        const real be = (arg == REAL(0.0) ? REAL(0.5) : J1(arg)/arg);
-        const real Fq = cos(m*t + b) * radical * be;
+        //const double t = ( Gauss76Z[i]*(upper-lower) + upper + lower )/2.0;
+        const double t = 0.5*(Gauss76Z[i]*(upper-lower)+upper+lower);
+        const double radical = 1.0 - t*t;
+        const double arg = qrst*sqrt(radical); // cap bessel function arg
+        const double be = (arg == 0.0 ? 0.5 : J1(arg)/arg);
+        const double Fq = cos(m*t + b) * radical * be;
         total += Gauss76Wt[i] * Fq;
     }
     // translate dx in [-1,1] to dx in [lower,upper]
-    //const real form = (upper-lower)/2.0*total;
-    const real integral = REAL(0.5)*(upper-lower)*total;
-    return REAL(4.0)*M_PI*cap_radius*cap_radius*cap_radius*integral;
+    //const double form = (upper-lower)/2.0*total;
+    const double integral = 0.5*(upper-lower)*total;
+    return 4.0*M_PI*cap_radius*cap_radius*cap_radius*integral;
 }
 
-real form_volume(real radius, real cap_radius, real length)
+double form_volume(double radius, double cap_radius, double length)
 {
     // cap radius should never be less than radius when this is called
@@ -60,69 +60,69 @@
     //        = pi r^2 L + pi hc (r^2 + hc^2/3)
     //        = pi * (r^2 (L+hc) + hc^3/3)
-    const real hc = cap_radius - sqrt(cap_radius*cap_radius - radius*radius);
-    return M_PI*(radius*radius*(length+hc) + REAL(0.333333333333333)*hc*hc*hc);
+    const double hc = cap_radius - sqrt(cap_radius*cap_radius - radius*radius);
+    return M_PI*(radius*radius*(length+hc) + 0.333333333333333*hc*hc*hc);
 }
 
-real Iq(real q,
-    real sld,
-    real solvent_sld,
-    real radius,
-    real cap_radius,
-    real length)
+double Iq(double q,
+    double sld,
+    double solvent_sld,
+    double radius,
+    double cap_radius,
+    double length)
 {
-    real sn, cn; // slots to hold sincos function output
+    double sn, cn; // slots to hold sincos function output
 
     // Exclude invalid inputs.
-    if (cap_radius < radius) return REAL(-1.0);
+    if (cap_radius < radius) return -1.0;
 
-    const real lower = REAL(0.0);
-    const real upper = M_PI_2;
-    const real h = sqrt(cap_radius*cap_radius - radius*radius); // negative h
-    real total = REAL(0.0);
+    const double lower = 0.0;
+    const double upper = M_PI_2;
+    const double h = sqrt(cap_radius*cap_radius - radius*radius); // negative h
+    double total = 0.0;
     for (int i=0; i<76 ;i++) {
         // translate a point in [-1,1] to a point in [lower,upper]
-        const real alpha= REAL(0.5)*(Gauss76Z[i]*(upper-lower) + upper + lower);
+        const double alpha= 0.5*(Gauss76Z[i]*(upper-lower) + upper + lower);
         SINCOS(alpha, sn, cn);
 
-        const real cap_Fq = _cap_kernel(q, h, cap_radius, length, sn, cn);
+        const double cap_Fq = _cap_kernel(q, h, cap_radius, length, sn, cn);
 
         // The following is CylKernel() / sin(alpha), but we are doing it in place
         // to avoid sin(alpha)/sin(alpha) for alpha = 0.  It is also a teensy bit
         // faster since we don't multiply and divide sin(alpha).
-        const real besarg = q*radius*sn;
-        const real siarg = q*REAL(0.5)*length*cn;
+        const double besarg = q*radius*sn;
+        const double siarg = q*0.5*length*cn;
         // lim_{x->0} J1(x)/x = 1/2,   lim_{x->0} sin(x)/x = 1
-        const real bj = (besarg == REAL(0.0) ? REAL(0.5) : J1(besarg)/besarg);
-        const real si = (siarg == REAL(0.0) ? REAL(1.0) : sin(siarg)/siarg);
-        const real cyl_Fq = M_PI*radius*radius*length*REAL(2.0)*bj*si;
+        const double bj = (besarg == 0.0 ? 0.5 : J1(besarg)/besarg);
+        const double si = (siarg == 0.0 ? 1.0 : sin(siarg)/siarg);
+        const double cyl_Fq = M_PI*radius*radius*length*2.0*bj*si;
 
         // Volume weighted average F(q)
-        const real Aq = cyl_Fq + cap_Fq;
+        const double Aq = cyl_Fq + cap_Fq;
         total += Gauss76Wt[i] * Aq * Aq * sn; // sn for spherical coord integration
     }
     // translate dx in [-1,1] to dx in [lower,upper]
-    const real form = total * REAL(0.5)*(upper-lower);
+    const double form = total * 0.5*(upper-lower);
 
     // Multiply by contrast^2, normalize by cylinder volume and convert to cm-1
     // NOTE that for this (Fournet) definition of the integral, one must MULTIPLY by Vcyl
     // The additional volume factor is for polydisperse volume normalization.
-    const real s = (sld - solvent_sld);
-    return REAL(1.0e-4) * form * s * s; // form_volume(radius, cap_radius, length);
+    const double s = (sld - solvent_sld);
+    return 1.0e-4 * form * s * s; // form_volume(radius, cap_radius, length);
 }
 
 
-real Iqxy(real qx, real qy,
-    real sld,
-    real solvent_sld,
-    real radius,
-    real cap_radius,
-    real length,
-    real theta,
-    real phi)
+double Iqxy(double qx, double qy,
+    double sld,
+    double solvent_sld,
+    double radius,
+    double cap_radius,
+    double length,
+    double theta,
+    double phi)
 {
-    real sn, cn; // slots to hold sincos function output
+    double sn, cn; // slots to hold sincos function output
 
     // Exclude invalid inputs.
-    if (cap_radius < radius) return REAL(-1.0);
+    if (cap_radius < radius) return -1.0;
 
     // Compute angle alpha between q and the cylinder axis
@@ -130,24 +130,24 @@
     // # The following correction factor exists in sasview, but it can't be
     // # right, so we are leaving it out for now.
-    const real q = sqrt(qx*qx+qy*qy);
-    const real cos_val = cn*cos(phi*M_PI_180)*(qx/q) + sn*(qy/q);
-    const real alpha = acos(cos_val); // rod angle relative to q
+    const double q = sqrt(qx*qx+qy*qy);
+    const double cos_val = cn*cos(phi*M_PI_180)*(qx/q) + sn*(qy/q);
+    const double alpha = acos(cos_val); // rod angle relative to q
     SINCOS(alpha, sn, cn);
 
-    const real h = sqrt(cap_radius*cap_radius - radius*radius); // negative h
-    const real cap_Fq = _cap_kernel(q, h, cap_radius, length, sn, cn);
+    const double h = sqrt(cap_radius*cap_radius - radius*radius); // negative h
+    const double cap_Fq = _cap_kernel(q, h, cap_radius, length, sn, cn);
 
-    const real besarg = q*radius*sn;
-    const real siarg = q*REAL(0.5)*length*cn;
+    const double besarg = q*radius*sn;
+    const double siarg = q*0.5*length*cn;
     // lim_{x->0} J1(x)/x = 1/2,   lim_{x->0} sin(x)/x = 1
-    const real bj = (besarg == REAL(0.0) ? REAL(0.5) : J1(besarg)/besarg);
-    const real si = (siarg == REAL(0.0) ? REAL(1.0) : sin(siarg)/siarg);
-    const real cyl_Fq = M_PI*radius*radius*length*REAL(2.0)*bj*si;
+    const double bj = (besarg == 0.0 ? 0.5 : J1(besarg)/besarg);
+    const double si = (siarg == 0.0 ? 1.0 : sin(siarg)/siarg);
+    const double cyl_Fq = M_PI*radius*radius*length*2.0*bj*si;
 
     // Volume weighted average F(q)
-    const real Aq = cyl_Fq + cap_Fq;
+    const double Aq = cyl_Fq + cap_Fq;
 
     // Multiply by contrast^2, normalize by cylinder volume and convert to cm-1
-    const real s = (sld - solvent_sld);
-    return REAL(1.0e-4) * Aq * Aq * s * s; // form_volume(radius, cap_radius, length);
+    const double s = (sld - solvent_sld);
+    return 1.0e-4 * Aq * Aq * s * s; // form_volume(radius, cap_radius, length);
 }
Index: sasmodels/models/core_shell_cylinder.c
===================================================================
--- sasmodels/models/core_shell_cylinder.c	(revision 5d4777d1f3042abc2b98b66609abf23d3bca1828)
+++ sasmodels/models/core_shell_cylinder.c	(revision 994d77f9b713691e41106d1f9af9661dfb2dc419)
@@ -1,70 +1,70 @@
-real form_volume(real radius, real thickness, real length);
-real Iq(real q, real core_sld, real shell_sld, real solvent_sld,
-    real radius, real thickness, real length);
-real Iqxy(real qx, real qy, real core_sld, real shell_sld, real solvent_sld,
-    real radius, real thickness, real length, real theta, real phi);
+double form_volume(double radius, double thickness, double length);
+double Iq(double q, double core_sld, double shell_sld, double solvent_sld,
+    double radius, double thickness, double length);
+double Iqxy(double qx, double qy, double core_sld, double shell_sld, double solvent_sld,
+    double radius, double thickness, double length, double theta, double phi);
 
 // twovd = 2 * volume * delta_rho
 // besarg = q * R * sin(alpha)
 // siarg = q * L/2 * cos(alpha)
-real _cyl(real twovd, real besarg, real siarg);
-real _cyl(real twovd, real besarg, real siarg)
+double _cyl(double twovd, double besarg, double siarg);
+double _cyl(double twovd, double besarg, double siarg)
 {
-    const real bj = (besarg == REAL(0.0) ? REAL(0.5) : J1(besarg)/besarg);
-    const real si = (siarg == REAL(0.0) ? REAL(1.0) : sin(siarg)/siarg);
+    const double bj = (besarg == 0.0 ? 0.5 : J1(besarg)/besarg);
+    const double si = (siarg == 0.0 ? 1.0 : sin(siarg)/siarg);
     return twovd*si*bj;
 }
 
-real form_volume(real radius, real thickness, real length)
+double form_volume(double radius, double thickness, double length)
 {
     return M_PI*(radius+thickness)*(radius+thickness)*(length+2*thickness);
 }
 
-real Iq(real q,
-    real core_sld,
-    real shell_sld,
-    real solvent_sld,
-    real radius,
-    real thickness,
-    real length)
+double Iq(double q,
+    double core_sld,
+    double shell_sld,
+    double solvent_sld,
+    double radius,
+    double thickness,
+    double length)
 {
     // precalculate constants
-    const real core_qr = q*radius;
-    const real core_qh = q*REAL(0.5)*length;
-    const real core_twovd = REAL(2.0) * form_volume(radius,0,length)
+    const double core_qr = q*radius;
+    const double core_qh = q*0.5*length;
+    const double core_twovd = 2.0 * form_volume(radius,0,length)
                             * (core_sld-shell_sld);
-    const real shell_qr = q*(radius + thickness);
-    const real shell_qh = q*(REAL(0.5)*length + thickness);
-    const real shell_twovd = REAL(2.0) * form_volume(radius,thickness,length)
+    const double shell_qr = q*(radius + thickness);
+    const double shell_qh = q*(0.5*length + thickness);
+    const double shell_twovd = 2.0 * form_volume(radius,thickness,length)
                              * (shell_sld-solvent_sld);
-    real total = REAL(0.0);
-    // real lower=0, upper=M_PI_2;
+    double total = 0.0;
+    // double lower=0, upper=M_PI_2;
     for (int i=0; i<76 ;i++) {
         // translate a point in [-1,1] to a point in [lower,upper]
-        //const real alpha = ( Gauss76Z[i]*(upper-lower) + upper + lower )/2.0;
-        real sn, cn;
-        const real alpha = REAL(0.5)*(Gauss76Z[i]*M_PI_2 + M_PI_2);
+        //const double alpha = ( Gauss76Z[i]*(upper-lower) + upper + lower )/2.0;
+        double sn, cn;
+        const double alpha = 0.5*(Gauss76Z[i]*M_PI_2 + M_PI_2);
         SINCOS(alpha, sn, cn);
-        const real fq = _cyl(core_twovd, core_qr*sn, core_qh*cn)
+        const double fq = _cyl(core_twovd, core_qr*sn, core_qh*cn)
             + _cyl(shell_twovd, shell_qr*sn, shell_qh*cn);
         total += Gauss76Wt[i] * fq * fq * sn;
     }
     // translate dx in [-1,1] to dx in [lower,upper]
-    //const real form = (upper-lower)/2.0*total;
-    return REAL(1.0e-4) * total * M_PI_4;
+    //const double form = (upper-lower)/2.0*total;
+    return 1.0e-4 * total * M_PI_4;
 }
 
 
-real Iqxy(real qx, real qy,
-    real core_sld,
-    real shell_sld,
-    real solvent_sld,
-    real radius,
-    real thickness,
-    real length,
-    real theta,
-    real phi)
+double Iqxy(double qx, double qy,
+    double core_sld,
+    double shell_sld,
+    double solvent_sld,
+    double radius,
+    double thickness,
+    double length,
+    double theta,
+    double phi)
 {
-    real sn, cn; // slots to hold sincos function output
+    double sn, cn; // slots to hold sincos function output
 
     // Compute angle alpha between q and the cylinder axis
@@ -72,21 +72,21 @@
     // # The following correction factor exists in sasview, but it can't be
     // # right, so we are leaving it out for now.
-    // const real correction = fabs(cn)*M_PI_2;
-    const real q = sqrt(qx*qx+qy*qy);
-    const real cos_val = cn*cos(phi*M_PI_180)*(qx/q) + sn*(qy/q);
-    const real alpha = acos(cos_val);
+    // const double correction = fabs(cn)*M_PI_2;
+    const double q = sqrt(qx*qx+qy*qy);
+    const double cos_val = cn*cos(phi*M_PI_180)*(qx/q) + sn*(qy/q);
+    const double alpha = acos(cos_val);
 
-    const real core_qr = q*radius;
-    const real core_qh = q*REAL(0.5)*length;
-    const real core_twovd = REAL(2.0) * form_volume(radius,0,length)
+    const double core_qr = q*radius;
+    const double core_qh = q*0.5*length;
+    const double core_twovd = 2.0 * form_volume(radius,0,length)
                             * (core_sld-shell_sld);
-    const real shell_qr = q*(radius + thickness);
-    const real shell_qh = q*(REAL(0.5)*length + thickness);
-    const real shell_twovd = REAL(2.0) * form_volume(radius,thickness,length)
+    const double shell_qr = q*(radius + thickness);
+    const double shell_qh = q*(0.5*length + thickness);
+    const double shell_twovd = 2.0 * form_volume(radius,thickness,length)
                              * (shell_sld-solvent_sld);
 
     SINCOS(alpha, sn, cn);
-    const real fq = _cyl(core_twovd, core_qr*sn, core_qh*cn)
+    const double fq = _cyl(core_twovd, core_qr*sn, core_qh*cn)
         + _cyl(shell_twovd, shell_qr*sn, shell_qh*cn);
-    return REAL(1.0e-4) * fq * fq;
+    return 1.0e-4 * fq * fq;
 }
Index: sasmodels/models/cylinder.c
===================================================================
--- sasmodels/models/cylinder.c	(revision 0496031792ca0787ae1d64698074bab7e3b6afce)
+++ sasmodels/models/cylinder.c	(revision 994d77f9b713691e41106d1f9af9661dfb2dc419)
@@ -1,71 +1,71 @@
-real form_volume(real radius, real length);
-real Iq(real q, real sld, real solvent_sld, real radius, real length);
-real Iqxy(real qx, real qy, real sld, real solvent_sld,
-    real radius, real length, real theta, real phi);
+double form_volume(double radius, double length);
+double Iq(double q, double sld, double solvent_sld, double radius, double length);
+double Iqxy(double qx, double qy, double sld, double solvent_sld,
+    double radius, double length, double theta, double phi);
 
 // twovd = 2 * volume * delta_rho
 // besarg = q * R * sin(alpha)
 // siarg = q * L/2 * cos(alpha)
-real _cyl(real twovd, real besarg, real siarg);
-real _cyl(real twovd, real besarg, real siarg)
+double _cyl(double twovd, double besarg, double siarg);
+double _cyl(double twovd, double besarg, double siarg)
 {
-    const real bj = (besarg == REAL(0.0) ? REAL(0.5) : J1(besarg)/besarg);
-    const real si = (siarg == REAL(0.0) ? REAL(1.0) : sin(siarg)/siarg);
+    const double bj = (besarg == 0.0 ? 0.5 : J1(besarg)/besarg);
+    const double si = (siarg == 0.0 ? 1.0 : sin(siarg)/siarg);
     return twovd*si*bj;
 }
 
-real form_volume(real radius, real length)
+double form_volume(double radius, double length)
 {
     return M_PI*radius*radius*length;
 }
 
-real Iq(real q,
-    real sld,
-    real solvent_sld,
-    real radius,
-    real length)
+double Iq(double q,
+    double sld,
+    double solvent_sld,
+    double radius,
+    double length)
 {
-    const real qr = q*radius;
-    const real qh = q*REAL(0.5)*length;
-    const real twovd = REAL(2.0)*(sld-solvent_sld)*form_volume(radius, length);
-    real total = REAL(0.0);
-    // real lower=0, upper=M_PI_2;
+    const double qr = q*radius;
+    const double qh = q*0.5*length;
+    const double twovd = 2.0*(sld-solvent_sld)*form_volume(radius, length);
+    double total = 0.0;
+    // double lower=0, upper=M_PI_2;
     for (int i=0; i<76 ;i++) {
         // translate a point in [-1,1] to a point in [lower,upper]
-        //const real alpha = ( Gauss76Z[i]*(upper-lower) + upper + lower )/2.0;
-        const real alpha = REAL(0.5)*(Gauss76Z[i]*M_PI_2 + M_PI_2);
-        real sn, cn;
+        //const double alpha = ( Gauss76Z[i]*(upper-lower) + upper + lower )/2.0;
+        const double alpha = 0.5*(Gauss76Z[i]*M_PI_2 + M_PI_2);
+        double sn, cn;
         SINCOS(alpha, sn, cn);
-        const real fq = _cyl(twovd, qr*sn, qh*cn);
+        const double fq = _cyl(twovd, qr*sn, qh*cn);
         total += Gauss76Wt[i] * fq * fq * sn;
     }
     // translate dx in [-1,1] to dx in [lower,upper]
-    //const real form = (upper-lower)/2.0*total;
-    return REAL(1.0e-4) * total * M_PI_4;
+    //const double form = (upper-lower)/2.0*total;
+    return 1.0e-4 * total * M_PI_4;
 }
 
 
-real Iqxy(real qx, real qy,
-    real sld,
-    real solvent_sld,
-    real radius,
-    real length,
-    real theta,
-    real phi)
+double Iqxy(double qx, double qy,
+    double sld,
+    double solvent_sld,
+    double radius,
+    double length,
+    double theta,
+    double phi)
 {
     // TODO: check that radius<0 and length<0 give zero scattering.
     // This should be the case since the polydispersity weight vector should
     // be zero length, and this function never called.
-    real sn, cn; // slots to hold sincos function output
+    double sn, cn; // slots to hold sincos function output
 
     // Compute angle alpha between q and the cylinder axis
     SINCOS(theta*M_PI_180, sn, cn);
-    const real q = sqrt(qx*qx+qy*qy);
-    const real cos_val = cn*cos(phi*M_PI_180)*(qx/q) + sn*(qy/q);
-    const real alpha = acos(cos_val);
+    const double q = sqrt(qx*qx+qy*qy);
+    const double cos_val = cn*cos(phi*M_PI_180)*(qx/q) + sn*(qy/q);
+    const double alpha = acos(cos_val);
 
-    const real twovd = REAL(2.0)*(sld-solvent_sld)*form_volume(radius, length);
+    const double twovd = 2.0*(sld-solvent_sld)*form_volume(radius, length);
     SINCOS(alpha, sn, cn);
-    const real fq = _cyl(twovd, q*radius*sn, q*REAL(0.5)*length*cn);
-    return REAL(1.0e-4) * fq * fq;
+    const double fq = _cyl(twovd, q*radius*sn, q*0.5*length*cn);
+    return 1.0e-4 * fq * fq;
 }
Index: sasmodels/models/cylinder_clone.c
===================================================================
--- sasmodels/models/cylinder_clone.c	(revision 5d4777d1f3042abc2b98b66609abf23d3bca1828)
+++ sasmodels/models/cylinder_clone.c	(revision 994d77f9b713691e41106d1f9af9661dfb2dc419)
@@ -1,5 +1,5 @@
-real form_volume(real radius, real length);
-real Iq(real q, real sld, real solvent_sld, real radius, real length);
-real Iqxy(real qx, real qy, real sld, real solvent_sld, real radius, real length, real theta, real phi);
+double form_volume(double radius, double length);
+double Iq(double q, double sld, double solvent_sld, double radius, double length);
+double Iqxy(double qx, double qy, double sld, double solvent_sld, double radius, double length, double theta, double phi);
 
 
@@ -7,50 +7,50 @@
 // besarg = q * R * sin(alpha)
 // siarg = q * L/2 * cos(alpha)
-real _cyl(real twovd, real besarg, real siarg, real alpha);
-real _cyl(real twovd, real besarg, real siarg, real alpha)
+double _cyl(double twovd, double besarg, double siarg, double alpha);
+double _cyl(double twovd, double besarg, double siarg, double alpha)
 {
-    const real bj = (besarg == REAL(0.0) ? REAL(0.5) : J1(besarg)/besarg);
-    const real si = (siarg == REAL(0.0) ? REAL(1.0) : sin(siarg)/siarg);
+    const double bj = (besarg == 0.0 ? 0.5 : J1(besarg)/besarg);
+    const double si = (siarg == 0.0 ? 1.0 : sin(siarg)/siarg);
     return twovd*si*bj;
 }
 
-real form_volume(real radius, real length)
+double form_volume(double radius, double length)
 {
     return M_PI*radius*radius*length;
 }
-real Iq(real q,
-    real sldCyl,
-    real sldSolv,
-    real radius,
-    real length)
+double Iq(double q,
+    double sldCyl,
+    double sldSolv,
+    double radius,
+    double length)
 {
-    const real qr = q*radius;
-    const real qh = q*REAL(0.5)*length;
-    const real twovd = REAL(2.0)*(sldCyl-sldSolv)*form_volume(radius, length);
-    real total = REAL(0.0);
-    // real lower=0, upper=M_PI_2;
+    const double qr = q*radius;
+    const double qh = q*0.5*length;
+    const double twovd = 2.0*(sldCyl-sldSolv)*form_volume(radius, length);
+    double total = 0.0;
+    // double lower=0, upper=M_PI_2;
     for (int i=0; i<76 ;i++) {
         // translate a point in [-1,1] to a point in [lower,upper]
-        //const real alpha = ( Gauss76Z[i]*(upper-lower) + upper + lower )/2.0;
-        const real alpha = REAL(0.5)*(Gauss76Z[i]*M_PI_2 + M_PI_2);
-        real sn, cn;
+        //const double alpha = ( Gauss76Z[i]*(upper-lower) + upper + lower )/2.0;
+        const double alpha = 0.5*(Gauss76Z[i]*M_PI_2 + M_PI_2);
+        double sn, cn;
         SINCOS(alpha, sn, cn);
-        const real fq = _cyl(twovd, qr*sn, qh*cn, alpha);
+        const double fq = _cyl(twovd, qr*sn, qh*cn, alpha);
         total += Gauss76Wt[i] * fq * fq * sn;
     }
     // translate dx in [-1,1] to dx in [lower,upper]
-    //const real form = (upper-lower)/2.0*total;
-    return REAL(1.0e8) * total * M_PI_4;
+    //const double form = (upper-lower)/2.0*total;
+    return 1.0e8 * total * M_PI_4;
 }
 
-real Iqxy(real qx, real qy,
-    real sldCyl,
-    real sldSolv,
-    real radius,
-    real length,
-    real cyl_theta,
-    real cyl_phi)
+double Iqxy(double qx, double qy,
+    double sldCyl,
+    double sldSolv,
+    double radius,
+    double length,
+    double cyl_theta,
+    double cyl_phi)
 {
-    real sn, cn; // slots to hold sincos function output
+    double sn, cn; // slots to hold sincos function output
 
     // Compute angle alpha between q and the cylinder axis
@@ -58,14 +58,14 @@
     // # The following correction factor exists in sasview, but it can't be
     // # right, so we are leaving it out for now.
-    const real spherical_integration = fabs(cn)*M_PI_2;
-    const real q = sqrt(qx*qx+qy*qy);
-    const real cos_val = cn*cos(cyl_phi*M_PI_180)*(qx/q) + sn*(qy/q);
-    const real alpha = acos(cos_val);
+    const double spherical_integration = fabs(cn)*M_PI_2;
+    const double q = sqrt(qx*qx+qy*qy);
+    const double cos_val = cn*cos(cyl_phi*M_PI_180)*(qx/q) + sn*(qy/q);
+    const double alpha = acos(cos_val);
 
-    const real qr = q*radius;
-    const real qh = q*REAL(0.5)*length;
-    const real twovd = REAL(2.0)*(sldCyl-sldSolv)*form_volume(radius, length);
+    const double qr = q*radius;
+    const double qh = q*0.5*length;
+    const double twovd = 2.0*(sldCyl-sldSolv)*form_volume(radius, length);
     SINCOS(alpha, sn, cn);
-    const real fq = _cyl(twovd, qr*sn, qh*cn, alpha);
-    return REAL(1.0e8) * fq * fq * spherical_integration;
+    const double fq = _cyl(twovd, qr*sn, qh*cn, alpha);
+    return 1.0e8 * fq * fq * spherical_integration;
 }
Index: sasmodels/models/ellipsoid.c
===================================================================
--- sasmodels/models/ellipsoid.c	(revision 5d4777d1f3042abc2b98b66609abf23d3bca1828)
+++ sasmodels/models/ellipsoid.c	(revision 994d77f9b713691e41106d1f9af9661dfb2dc419)
@@ -1,61 +1,61 @@
-real form_volume(real rpolar, real requatorial);
-real Iq(real q, real sld, real solvent_sld, real rpolar, real requatorial);
-real Iqxy(real qx, real qy, real sld, real solvent_sld,
-    real rpolar, real requatorial, real theta, real phi);
+double form_volume(double rpolar, double requatorial);
+double Iq(double q, double sld, double solvent_sld, double rpolar, double requatorial);
+double Iqxy(double qx, double qy, double sld, double solvent_sld,
+    double rpolar, double requatorial, double theta, double phi);
 
-real _ellipsoid_kernel(real q, real rpolar, real requatorial, real cos_alpha);
-real _ellipsoid_kernel(real q, real rpolar, real requatorial, real cos_alpha)
+double _ellipsoid_kernel(double q, double rpolar, double requatorial, double cos_alpha);
+double _ellipsoid_kernel(double q, double rpolar, double requatorial, double cos_alpha)
 {
-    real sn, cn;
-    real ratio = rpolar/requatorial;
-    const real u = q*requatorial*sqrt(REAL(1.0)
-                   + cos_alpha*cos_alpha*(ratio*ratio - REAL(1.0)));
+    double sn, cn;
+    double ratio = rpolar/requatorial;
+    const double u = q*requatorial*sqrt(1.0
+                   + cos_alpha*cos_alpha*(ratio*ratio - 1.0));
     SINCOS(u, sn, cn);
-    const real f = ( u==REAL(0.0) ? REAL(1.0) : REAL(3.0)*(sn-u*cn)/(u*u*u) );
+    const double f = ( u==0.0 ? 1.0 : 3.0*(sn-u*cn)/(u*u*u) );
     return f*f;
 }
 
-real form_volume(real rpolar, real requatorial)
+double form_volume(double rpolar, double requatorial)
 {
-    return REAL(1.333333333333333)*M_PI*rpolar*requatorial*requatorial;
+    return 1.333333333333333*M_PI*rpolar*requatorial*requatorial;
 }
 
-real Iq(real q,
-    real sld,
-    real solvent_sld,
-    real rpolar,
-    real requatorial)
+double Iq(double q,
+    double sld,
+    double solvent_sld,
+    double rpolar,
+    double requatorial)
 {
-    //const real lower = REAL(0.0);
-    //const real upper = REAL(1.0);
-    real total = REAL(0.0);
+    //const double lower = 0.0;
+    //const double upper = 1.0;
+    double total = 0.0;
     for (int i=0;i<76;i++) {
-        //const real cos_alpha = (Gauss76Z[i]*(upper-lower) + upper + lower)/2;
-        const real cos_alpha = REAL(0.5)*(Gauss76Z[i] + REAL(1.0));
+        //const double cos_alpha = (Gauss76Z[i]*(upper-lower) + upper + lower)/2;
+        const double cos_alpha = 0.5*(Gauss76Z[i] + 1.0);
         total += Gauss76Wt[i] * _ellipsoid_kernel(q, rpolar, requatorial, cos_alpha);
     }
-    //const real form = (upper-lower)/2*total;
-    const real form = REAL(0.5)*total;
-    const real s = (sld - solvent_sld) * form_volume(rpolar, requatorial);
-    return REAL(1.0e-4) * form * s * s;
+    //const double form = (upper-lower)/2*total;
+    const double form = 0.5*total;
+    const double s = (sld - solvent_sld) * form_volume(rpolar, requatorial);
+    return 1.0e-4 * form * s * s;
 }
 
-real Iqxy(real qx, real qy,
-    real sld,
-    real solvent_sld,
-    real rpolar,
-    real requatorial,
-    real theta,
-    real phi)
+double Iqxy(double qx, double qy,
+    double sld,
+    double solvent_sld,
+    double rpolar,
+    double requatorial,
+    double theta,
+    double phi)
 {
-    real sn, cn;
+    double sn, cn;
 
-    const real q = sqrt(qx*qx + qy*qy);
+    const double q = sqrt(qx*qx + qy*qy);
     SINCOS(theta*M_PI_180, sn, cn);
-    const real cos_alpha = cn*cos(phi*M_PI_180)*(qx/q) + sn*(qy/q);
-    const real form = _ellipsoid_kernel(q, rpolar, requatorial, cos_alpha);
-    const real s = (sld - solvent_sld) * form_volume(rpolar, requatorial);
+    const double cos_alpha = cn*cos(phi*M_PI_180)*(qx/q) + sn*(qy/q);
+    const double form = _ellipsoid_kernel(q, rpolar, requatorial, cos_alpha);
+    const double s = (sld - solvent_sld) * form_volume(rpolar, requatorial);
 
-    return REAL(1.0e-4) * form * s * s;
+    return 1.0e-4 * form * s * s;
 }
 
Index: sasmodels/models/lamellar.py
===================================================================
--- sasmodels/models/lamellar.py	(revision 19dcb93366741a275baa8ad855ce8a310dca78f8)
+++ sasmodels/models/lamellar.py	(revision 994d77f9b713691e41106d1f9af9661dfb2dc419)
@@ -77,11 +77,11 @@
 # This should perhaps be volume normalized?
 form_volume = """
-    return REAL(1.0);
+    return 1.0;
     """
 
 Iq = """
-    const real sub = sld - solvent_sld;
-    const real qsq = q*q;
-    return REAL(4.0e-4)*M_PI*sub*sub/qsq * (REAL(1.0)-cos(q*thickness))
+    const double sub = sld - solvent_sld;
+    const double qsq = q*q;
+    return 4.0e-4*M_PI*sub*sub/qsq * (1.0-cos(q*thickness))
         / (thickness*qsq);
     """
@@ -89,5 +89,5 @@
 Iqxy = """
     // never called since no orientation or magnetic parameters.
-    return REAL(-1.0);
+    return -1.0;
     """
 
Index: sasmodels/models/lib/J1.c
===================================================================
--- sasmodels/models/lib/J1.c	(revision 14de349c663ca9521843af50415c37aed27a9eef)
+++ sasmodels/models/lib/J1.c	(revision 994d77f9b713691e41106d1f9af9661dfb2dc419)
@@ -1,38 +1,38 @@
-real J1(real x);
-real J1(real x)
+double J1(double x);
+double J1(double x)
 {
-  const real ax = fabs(x);
-  if (ax < REAL(8.0)) {
-    const real y = x*x;
-    const real ans1 = x*(REAL(72362614232.0)
-              + y*(REAL(-7895059235.0)
-              + y*(REAL(242396853.1)
-              + y*(REAL(-2972611.439)
-              + y*(REAL(15704.48260)
-              + y*(REAL(-30.16036606)))))));
-    const real ans2 = REAL(144725228442.0)
-              + y*(REAL(2300535178.0)
-              + y*(REAL(18583304.74)
-              + y*(REAL(99447.43394)
-              + y*(REAL(376.9991397)
+  const double ax = fabs(x);
+  if (ax < 8.0) {
+    const double y = x*x;
+    const double ans1 = x*(72362614232.0
+              + y*(-7895059235.0
+              + y*(242396853.1
+              + y*(-2972611.439
+              + y*(15704.48260
+              + y*(-30.16036606))))));
+    const double ans2 = 144725228442.0
+              + y*(2300535178.0
+              + y*(18583304.74
+              + y*(99447.43394
+              + y*(376.9991397
               + y))));
     return ans1/ans2;
   } else {
-    const real y = REAL(64.0)/(ax*ax);
-    const real xx = ax - REAL(2.356194491);
-    const real ans1 = REAL(1.0)
-              + y*(REAL(0.183105e-2)
-              + y*(REAL(-0.3516396496e-4)
-              + y*(REAL(0.2457520174e-5)
-              + y*REAL(-0.240337019e-6))));
-    const real ans2 = REAL(0.04687499995)
-              + y*(REAL(-0.2002690873e-3)
-              + y*(REAL(0.8449199096e-5)
-              + y*(REAL(-0.88228987e-6)
-              + y*REAL(0.105787412e-6))));
-    real sn,cn;
+    const double y = 64.0/(ax*ax);
+    const double xx = ax - 2.356194491;
+    const double ans1 = 1.0
+              + y*(0.183105e-2
+              + y*(-0.3516396496e-4
+              + y*(0.2457520174e-5
+              + y*-0.240337019e-6)));
+    const double ans2 = 0.04687499995
+              + y*(-0.2002690873e-3
+              + y*(0.8449199096e-5
+              + y*(-0.88228987e-6
+              + y*0.105787412e-6)));
+    double sn,cn;
     SINCOS(xx, sn, cn);
-    const real ans = sqrt(REAL(0.636619772)/ax) * (cn*ans1 - (REAL(8.0)/ax)*sn*ans2);
-    return (x < REAL(0.0)) ? -ans : ans;
+    const double ans = sqrt(0.636619772/ax) * (cn*ans1 - (8.0/ax)*sn*ans2);
+    return (x < 0.0) ? -ans : ans;
   }
 }
Index: sasmodels/models/lib/gauss150.c
===================================================================
--- sasmodels/models/lib/gauss150.c	(revision 14de349c663ca9521843af50415c37aed27a9eef)
+++ sasmodels/models/lib/gauss150.c	(revision 994d77f9b713691e41106d1f9af9661dfb2dc419)
@@ -9,307 +9,307 @@
 
 // Gaussians
-constant real Gauss150Z[150]={
-  	REAL(-0.9998723404457334),
-  	REAL(-0.9993274305065947),
-  	REAL(-0.9983473449340834),
-  	REAL(-0.9969322929775997),
-  	REAL(-0.9950828645255290),
-  	REAL(-0.9927998590434373),
-  	REAL(-0.9900842691660192),
-  	REAL(-0.9869372772712794),
-  	REAL(-0.9833602541697529),
-  	REAL(-0.9793547582425894),
-  	REAL(-0.9749225346595943),
-  	REAL(-0.9700655145738374),
-  	REAL(-0.9647858142586956),
-  	REAL(-0.9590857341746905),
-  	REAL(-0.9529677579610971),
-  	REAL(-0.9464345513503147),
-  	REAL(-0.9394889610042837),
-  	REAL(-0.9321340132728527),
-  	REAL(-0.9243729128743136),
-  	REAL(-0.9162090414984952),
-  	REAL(-0.9076459563329236),
-  	REAL(-0.8986873885126239),
-  	REAL(-0.8893372414942055),
-  	REAL(-0.8795995893549102),
-  	REAL(-0.8694786750173527),
-  	REAL(-0.8589789084007133),
-  	REAL(-0.8481048644991847),
-  	REAL(-0.8368612813885015),
-  	REAL(-0.8252530581614230),
-  	REAL(-0.8132852527930605),
-  	REAL(-0.8009630799369827),
-  	REAL(-0.7882919086530552),
-  	REAL(-0.7752772600680049),
-  	REAL(-0.7619248049697269),
-  	REAL(-0.7482403613363824),
-  	REAL(-0.7342298918013638),
-  	REAL(-0.7198995010552305),
-  	REAL(-0.7052554331857488),
-  	REAL(-0.6903040689571928),
-  	REAL(-0.6750519230300931),
-  	REAL(-0.6595056411226444),
-  	REAL(-0.6436719971150083),
-  	REAL(-0.6275578900977726),
-  	REAL(-0.6111703413658551),
-  	REAL(-0.5945164913591590),
-  	REAL(-0.5776035965513142),
-  	REAL(-0.5604390262878617),
-  	REAL(-0.5430302595752546),
-  	REAL(-0.5253848818220803),
-  	REAL(-0.5075105815339176),
-  	REAL(-0.4894151469632753),
-  	REAL(-0.4711064627160663),
-  	REAL(-0.4525925063160997),
-  	REAL(-0.4338813447290861),
-  	REAL(-0.4149811308476706),
-  	REAL(-0.3959000999390257),
-  	REAL(-0.3766465660565522),
-  	REAL(-0.3572289184172501),
-  	REAL(-0.3376556177463400),
-  	REAL(-0.3179351925907259),
-  	REAL(-0.2980762356029071),
-  	REAL(-0.2780873997969574),
-  	REAL(-0.2579773947782034),
-  	REAL(-0.2377549829482451),
-  	REAL(-0.2174289756869712),
-  	REAL(-0.1970082295132342),
-  	REAL(-0.1765016422258567),
-  	REAL(-0.1559181490266516),
-  	REAL(-0.1352667186271445),
-  	REAL(-0.1145563493406956),
-  	REAL(-0.0937960651617229),
-  	REAL(-0.0729949118337358),
-  	REAL(-0.0521619529078925),
-  	REAL(-0.0313062657937972),
-  	REAL(-0.0104369378042598),
-  	REAL(0.0104369378042598),
-  	REAL(0.0313062657937972),
-  	REAL(0.0521619529078925),
-  	REAL(0.0729949118337358),
-  	REAL(0.0937960651617229),
-  	REAL(0.1145563493406956),
-  	REAL(0.1352667186271445),
-  	REAL(0.1559181490266516),
-  	REAL(0.1765016422258567),
-  	REAL(0.1970082295132342),
-  	REAL(0.2174289756869712),
-  	REAL(0.2377549829482451),
-  	REAL(0.2579773947782034),
-  	REAL(0.2780873997969574),
-  	REAL(0.2980762356029071),
-  	REAL(0.3179351925907259),
-  	REAL(0.3376556177463400),
-  	REAL(0.3572289184172501),
-  	REAL(0.3766465660565522),
-  	REAL(0.3959000999390257),
-  	REAL(0.4149811308476706),
-  	REAL(0.4338813447290861),
-  	REAL(0.4525925063160997),
-  	REAL(0.4711064627160663),
-  	REAL(0.4894151469632753),
-  	REAL(0.5075105815339176),
-  	REAL(0.5253848818220803),
-  	REAL(0.5430302595752546),
-  	REAL(0.5604390262878617),
-  	REAL(0.5776035965513142),
-  	REAL(0.5945164913591590),
-  	REAL(0.6111703413658551),
-  	REAL(0.6275578900977726),
-  	REAL(0.6436719971150083),
-  	REAL(0.6595056411226444),
-  	REAL(0.6750519230300931),
-  	REAL(0.6903040689571928),
-  	REAL(0.7052554331857488),
-  	REAL(0.7198995010552305),
-  	REAL(0.7342298918013638),
-  	REAL(0.7482403613363824),
-  	REAL(0.7619248049697269),
-  	REAL(0.7752772600680049),
-  	REAL(0.7882919086530552),
-  	REAL(0.8009630799369827),
-  	REAL(0.8132852527930605),
-  	REAL(0.8252530581614230),
-  	REAL(0.8368612813885015),
-  	REAL(0.8481048644991847),
-  	REAL(0.8589789084007133),
-  	REAL(0.8694786750173527),
-  	REAL(0.8795995893549102),
-  	REAL(0.8893372414942055),
-  	REAL(0.8986873885126239),
-  	REAL(0.9076459563329236),
-  	REAL(0.9162090414984952),
-  	REAL(0.9243729128743136),
-  	REAL(0.9321340132728527),
-  	REAL(0.9394889610042837),
-  	REAL(0.9464345513503147),
-  	REAL(0.9529677579610971),
-  	REAL(0.9590857341746905),
-  	REAL(0.9647858142586956),
-  	REAL(0.9700655145738374),
-  	REAL(0.9749225346595943),
-  	REAL(0.9793547582425894),
-  	REAL(0.9833602541697529),
-  	REAL(0.9869372772712794),
-  	REAL(0.9900842691660192),
-  	REAL(0.9927998590434373),
-  	REAL(0.9950828645255290),
-  	REAL(0.9969322929775997),
-  	REAL(0.9983473449340834),
-  	REAL(0.9993274305065947),
-  	REAL(0.9998723404457334)
+constant double Gauss150Z[150]={
+  	-0.9998723404457334,
+  	-0.9993274305065947,
+  	-0.9983473449340834,
+  	-0.9969322929775997,
+  	-0.9950828645255290,
+  	-0.9927998590434373,
+  	-0.9900842691660192,
+  	-0.9869372772712794,
+  	-0.9833602541697529,
+  	-0.9793547582425894,
+  	-0.9749225346595943,
+  	-0.9700655145738374,
+  	-0.9647858142586956,
+  	-0.9590857341746905,
+  	-0.9529677579610971,
+  	-0.9464345513503147,
+  	-0.9394889610042837,
+  	-0.9321340132728527,
+  	-0.9243729128743136,
+  	-0.9162090414984952,
+  	-0.9076459563329236,
+  	-0.8986873885126239,
+  	-0.8893372414942055,
+  	-0.8795995893549102,
+  	-0.8694786750173527,
+  	-0.8589789084007133,
+  	-0.8481048644991847,
+  	-0.8368612813885015,
+  	-0.8252530581614230,
+  	-0.8132852527930605,
+  	-0.8009630799369827,
+  	-0.7882919086530552,
+  	-0.7752772600680049,
+  	-0.7619248049697269,
+  	-0.7482403613363824,
+  	-0.7342298918013638,
+  	-0.7198995010552305,
+  	-0.7052554331857488,
+  	-0.6903040689571928,
+  	-0.6750519230300931,
+  	-0.6595056411226444,
+  	-0.6436719971150083,
+  	-0.6275578900977726,
+  	-0.6111703413658551,
+  	-0.5945164913591590,
+  	-0.5776035965513142,
+  	-0.5604390262878617,
+  	-0.5430302595752546,
+  	-0.5253848818220803,
+  	-0.5075105815339176,
+  	-0.4894151469632753,
+  	-0.4711064627160663,
+  	-0.4525925063160997,
+  	-0.4338813447290861,
+  	-0.4149811308476706,
+  	-0.3959000999390257,
+  	-0.3766465660565522,
+  	-0.3572289184172501,
+  	-0.3376556177463400,
+  	-0.3179351925907259,
+  	-0.2980762356029071,
+  	-0.2780873997969574,
+  	-0.2579773947782034,
+  	-0.2377549829482451,
+  	-0.2174289756869712,
+  	-0.1970082295132342,
+  	-0.1765016422258567,
+  	-0.1559181490266516,
+  	-0.1352667186271445,
+  	-0.1145563493406956,
+  	-0.0937960651617229,
+  	-0.0729949118337358,
+  	-0.0521619529078925,
+  	-0.0313062657937972,
+  	-0.0104369378042598,
+  	0.0104369378042598,
+  	0.0313062657937972,
+  	0.0521619529078925,
+  	0.0729949118337358,
+  	0.0937960651617229,
+  	0.1145563493406956,
+  	0.1352667186271445,
+  	0.1559181490266516,
+  	0.1765016422258567,
+  	0.1970082295132342,
+  	0.2174289756869712,
+  	0.2377549829482451,
+  	0.2579773947782034,
+  	0.2780873997969574,
+  	0.2980762356029071,
+  	0.3179351925907259,
+  	0.3376556177463400,
+  	0.3572289184172501,
+  	0.3766465660565522,
+  	0.3959000999390257,
+  	0.4149811308476706,
+  	0.4338813447290861,
+  	0.4525925063160997,
+  	0.4711064627160663,
+  	0.4894151469632753,
+  	0.5075105815339176,
+  	0.5253848818220803,
+  	0.5430302595752546,
+  	0.5604390262878617,
+  	0.5776035965513142,
+  	0.5945164913591590,
+  	0.6111703413658551,
+  	0.6275578900977726,
+  	0.6436719971150083,
+  	0.6595056411226444,
+  	0.6750519230300931,
+  	0.6903040689571928,
+  	0.7052554331857488,
+  	0.7198995010552305,
+  	0.7342298918013638,
+  	0.7482403613363824,
+  	0.7619248049697269,
+  	0.7752772600680049,
+  	0.7882919086530552,
+  	0.8009630799369827,
+  	0.8132852527930605,
+  	0.8252530581614230,
+  	0.8368612813885015,
+  	0.8481048644991847,
+  	0.8589789084007133,
+  	0.8694786750173527,
+  	0.8795995893549102,
+  	0.8893372414942055,
+  	0.8986873885126239,
+  	0.9076459563329236,
+  	0.9162090414984952,
+  	0.9243729128743136,
+  	0.9321340132728527,
+  	0.9394889610042837,
+  	0.9464345513503147,
+  	0.9529677579610971,
+  	0.9590857341746905,
+  	0.9647858142586956,
+  	0.9700655145738374,
+  	0.9749225346595943,
+  	0.9793547582425894,
+  	0.9833602541697529,
+  	0.9869372772712794,
+  	0.9900842691660192,
+  	0.9927998590434373,
+  	0.9950828645255290,
+  	0.9969322929775997,
+  	0.9983473449340834,
+  	0.9993274305065947,
+  	0.9998723404457334
 };
 
-constant real Gauss150Wt[150]={
-  	REAL(0.0003276086705538),
-  	REAL(0.0007624720924706),
-  	REAL(0.0011976474864367),
-  	REAL(0.0016323569986067),
-  	REAL(0.0020663664924131),
-  	REAL(0.0024994789888943),
-  	REAL(0.0029315036836558),
-  	REAL(0.0033622516236779),
-  	REAL(0.0037915348363451),
-  	REAL(0.0042191661429919),
-  	REAL(0.0046449591497966),
-  	REAL(0.0050687282939456),
-  	REAL(0.0054902889094487),
-  	REAL(0.0059094573005900),
-  	REAL(0.0063260508184704),
-  	REAL(0.0067398879387430),
-  	REAL(0.0071507883396855),
-  	REAL(0.0075585729801782),
-  	REAL(0.0079630641773633),
-  	REAL(0.0083640856838475),
-  	REAL(0.0087614627643580),
-  	REAL(0.0091550222717888),
-  	REAL(0.0095445927225849),
-  	REAL(0.0099300043714212),
-  	REAL(0.0103110892851360),
-  	REAL(0.0106876814158841),
-  	REAL(0.0110596166734735),
-  	REAL(0.0114267329968529),
-  	REAL(0.0117888704247183),
-  	REAL(0.0121458711652067),
-  	REAL(0.0124975796646449),
-  	REAL(0.0128438426753249),
-  	REAL(0.0131845093222756),
-  	REAL(0.0135194311690004),
-  	REAL(0.0138484622795371),
-  	REAL(0.0141714592928592),
-  	REAL(0.0144882814685445),
-  	REAL(0.0147987907597169),
-  	REAL(0.0151028518701744),
-  	REAL(0.0154003323133401),
-  	REAL(0.0156911024699895),
-  	REAL(0.0159750356447283),
-  	REAL(0.0162520081211971),
-  	REAL(0.0165218992159766),
-  	REAL(0.0167845913311726),
-  	REAL(0.0170399700056559),
-  	REAL(0.0172879239649355),
-  	REAL(0.0175283451696437),
-  	REAL(0.0177611288626114),
-  	REAL(0.0179861736145128),
-  	REAL(0.0182033813680609),
-  	REAL(0.0184126574807331),
-  	REAL(0.0186139107660094),
-  	REAL(0.0188070535331042),
-  	REAL(0.0189920016251754),
-  	REAL(0.0191686744559934),
-  	REAL(0.0193369950450545),
-  	REAL(0.0194968900511231),
-  	REAL(0.0196482898041878),
-  	REAL(0.0197911283358190),
-  	REAL(0.0199253434079123),
-  	REAL(0.0200508765398072),
-  	REAL(0.0201676730337687),
-  	REAL(0.0202756819988200),
-  	REAL(0.0203748563729175),
-  	REAL(0.0204651529434560),
-  	REAL(0.0205465323660984),
-  	REAL(0.0206189591819181),
-  	REAL(0.0206824018328499),
-  	REAL(0.0207368326754401),
-  	REAL(0.0207822279928917),
-  	REAL(0.0208185680053983),
-  	REAL(0.0208458368787627),
-  	REAL(0.0208640227312962),
-  	REAL(0.0208731176389954),
-  	REAL(0.0208731176389954),
-  	REAL(0.0208640227312962),
-  	REAL(0.0208458368787627),
-  	REAL(0.0208185680053983),
-  	REAL(0.0207822279928917),
-  	REAL(0.0207368326754401),
-  	REAL(0.0206824018328499),
-  	REAL(0.0206189591819181),
-  	REAL(0.0205465323660984),
-  	REAL(0.0204651529434560),
-  	REAL(0.0203748563729175),
-  	REAL(0.0202756819988200),
-  	REAL(0.0201676730337687),
-  	REAL(0.0200508765398072),
-  	REAL(0.0199253434079123),
-  	REAL(0.0197911283358190),
-  	REAL(0.0196482898041878),
-  	REAL(0.0194968900511231),
-  	REAL(0.0193369950450545),
-  	REAL(0.0191686744559934),
-  	REAL(0.0189920016251754),
-  	REAL(0.0188070535331042),
-  	REAL(0.0186139107660094),
-  	REAL(0.0184126574807331),
-  	REAL(0.0182033813680609),
-  	REAL(0.0179861736145128),
-  	REAL(0.0177611288626114),
-  	REAL(0.0175283451696437),
-  	REAL(0.0172879239649355),
-  	REAL(0.0170399700056559),
-  	REAL(0.0167845913311726),
-  	REAL(0.0165218992159766),
-  	REAL(0.0162520081211971),
-  	REAL(0.0159750356447283),
-  	REAL(0.0156911024699895),
-  	REAL(0.0154003323133401),
-  	REAL(0.0151028518701744),
-  	REAL(0.0147987907597169),
-  	REAL(0.0144882814685445),
-  	REAL(0.0141714592928592),
-  	REAL(0.0138484622795371),
-  	REAL(0.0135194311690004),
-  	REAL(0.0131845093222756),
-  	REAL(0.0128438426753249),
-  	REAL(0.0124975796646449),
-  	REAL(0.0121458711652067),
-  	REAL(0.0117888704247183),
-  	REAL(0.0114267329968529),
-  	REAL(0.0110596166734735),
-  	REAL(0.0106876814158841),
-  	REAL(0.0103110892851360),
-  	REAL(0.0099300043714212),
-  	REAL(0.0095445927225849),
-  	REAL(0.0091550222717888),
-  	REAL(0.0087614627643580),
-  	REAL(0.0083640856838475),
-  	REAL(0.0079630641773633),
-  	REAL(0.0075585729801782),
-  	REAL(0.0071507883396855),
-  	REAL(0.0067398879387430),
-  	REAL(0.0063260508184704),
-  	REAL(0.0059094573005900),
-  	REAL(0.0054902889094487),
-  	REAL(0.0050687282939456),
-  	REAL(0.0046449591497966),
-  	REAL(0.0042191661429919),
-  	REAL(0.0037915348363451),
-  	REAL(0.0033622516236779),
-  	REAL(0.0029315036836558),
-  	REAL(0.0024994789888943),
-  	REAL(0.0020663664924131),
-  	REAL(0.0016323569986067),
-  	REAL(0.0011976474864367),
-  	REAL(0.0007624720924706),
-  	REAL(0.0003276086705538)
+constant double Gauss150Wt[150]={
+  	0.0003276086705538,
+  	0.0007624720924706,
+  	0.0011976474864367,
+  	0.0016323569986067,
+  	0.0020663664924131,
+  	0.0024994789888943,
+  	0.0029315036836558,
+  	0.0033622516236779,
+  	0.0037915348363451,
+  	0.0042191661429919,
+  	0.0046449591497966,
+  	0.0050687282939456,
+  	0.0054902889094487,
+  	0.0059094573005900,
+  	0.0063260508184704,
+  	0.0067398879387430,
+  	0.0071507883396855,
+  	0.0075585729801782,
+  	0.0079630641773633,
+  	0.0083640856838475,
+  	0.0087614627643580,
+  	0.0091550222717888,
+  	0.0095445927225849,
+  	0.0099300043714212,
+  	0.0103110892851360,
+  	0.0106876814158841,
+  	0.0110596166734735,
+  	0.0114267329968529,
+  	0.0117888704247183,
+  	0.0121458711652067,
+  	0.0124975796646449,
+  	0.0128438426753249,
+  	0.0131845093222756,
+  	0.0135194311690004,
+  	0.0138484622795371,
+  	0.0141714592928592,
+  	0.0144882814685445,
+  	0.0147987907597169,
+  	0.0151028518701744,
+  	0.0154003323133401,
+  	0.0156911024699895,
+  	0.0159750356447283,
+  	0.0162520081211971,
+  	0.0165218992159766,
+  	0.0167845913311726,
+  	0.0170399700056559,
+  	0.0172879239649355,
+  	0.0175283451696437,
+  	0.0177611288626114,
+  	0.0179861736145128,
+  	0.0182033813680609,
+  	0.0184126574807331,
+  	0.0186139107660094,
+  	0.0188070535331042,
+  	0.0189920016251754,
+  	0.0191686744559934,
+  	0.0193369950450545,
+  	0.0194968900511231,
+  	0.0196482898041878,
+  	0.0197911283358190,
+  	0.0199253434079123,
+  	0.0200508765398072,
+  	0.0201676730337687,
+  	0.0202756819988200,
+  	0.0203748563729175,
+  	0.0204651529434560,
+  	0.0205465323660984,
+  	0.0206189591819181,
+  	0.0206824018328499,
+  	0.0207368326754401,
+  	0.0207822279928917,
+  	0.0208185680053983,
+  	0.0208458368787627,
+  	0.0208640227312962,
+  	0.0208731176389954,
+  	0.0208731176389954,
+  	0.0208640227312962,
+  	0.0208458368787627,
+  	0.0208185680053983,
+  	0.0207822279928917,
+  	0.0207368326754401,
+  	0.0206824018328499,
+  	0.0206189591819181,
+  	0.0205465323660984,
+  	0.0204651529434560,
+  	0.0203748563729175,
+  	0.0202756819988200,
+  	0.0201676730337687,
+  	0.0200508765398072,
+  	0.0199253434079123,
+  	0.0197911283358190,
+  	0.0196482898041878,
+  	0.0194968900511231,
+  	0.0193369950450545,
+  	0.0191686744559934,
+  	0.0189920016251754,
+  	0.0188070535331042,
+  	0.0186139107660094,
+  	0.0184126574807331,
+  	0.0182033813680609,
+  	0.0179861736145128,
+  	0.0177611288626114,
+  	0.0175283451696437,
+  	0.0172879239649355,
+  	0.0170399700056559,
+  	0.0167845913311726,
+  	0.0165218992159766,
+  	0.0162520081211971,
+  	0.0159750356447283,
+  	0.0156911024699895,
+  	0.0154003323133401,
+  	0.0151028518701744,
+  	0.0147987907597169,
+  	0.0144882814685445,
+  	0.0141714592928592,
+  	0.0138484622795371,
+  	0.0135194311690004,
+  	0.0131845093222756,
+  	0.0128438426753249,
+  	0.0124975796646449,
+  	0.0121458711652067,
+  	0.0117888704247183,
+  	0.0114267329968529,
+  	0.0110596166734735,
+  	0.0106876814158841,
+  	0.0103110892851360,
+  	0.0099300043714212,
+  	0.0095445927225849,
+  	0.0091550222717888,
+  	0.0087614627643580,
+  	0.0083640856838475,
+  	0.0079630641773633,
+  	0.0075585729801782,
+  	0.0071507883396855,
+  	0.0067398879387430,
+  	0.0063260508184704,
+  	0.0059094573005900,
+  	0.0054902889094487,
+  	0.0050687282939456,
+  	0.0046449591497966,
+  	0.0042191661429919,
+  	0.0037915348363451,
+  	0.0033622516236779,
+  	0.0029315036836558,
+  	0.0024994789888943,
+  	0.0020663664924131,
+  	0.0016323569986067,
+  	0.0011976474864367,
+  	0.0007624720924706,
+  	0.0003276086705538
 };
Index: sasmodels/models/lib/gauss20.c
===================================================================
--- sasmodels/models/lib/gauss20.c	(revision 14de349c663ca9521843af50415c37aed27a9eef)
+++ sasmodels/models/lib/gauss20.c	(revision 994d77f9b713691e41106d1f9af9661dfb2dc419)
@@ -9,47 +9,47 @@
 
 // Gaussians
-constant real Gauss20Wt[20]={
-	REAL(.0176140071391521),
-	REAL(.0406014298003869),
-	REAL(.0626720483341091),
-	REAL(.0832767415767047),
-	REAL(.10193011981724),
-	REAL(.118194531961518),
-	REAL(.131688638449177),
-	REAL(.142096109318382),
-	REAL(.149172986472604),
-	REAL(.152753387130726),
-	REAL(.152753387130726),
-	REAL(.149172986472604),
-	REAL(.142096109318382),
-	REAL(.131688638449177),
-	REAL(.118194531961518),
-	REAL(.10193011981724),
-	REAL(.0832767415767047),
-	REAL(.0626720483341091),
-	REAL(.0406014298003869),
-	REAL(.0176140071391521)
+constant double Gauss20Wt[20]={
+	.0176140071391521,
+	.0406014298003869,
+	.0626720483341091,
+	.0832767415767047,
+	.10193011981724,
+	.118194531961518,
+	.131688638449177,
+	.142096109318382,
+	.149172986472604,
+	.152753387130726,
+	.152753387130726,
+	.149172986472604,
+	.142096109318382,
+	.131688638449177,
+	.118194531961518,
+	.10193011981724,
+	.0832767415767047,
+	.0626720483341091,
+	.0406014298003869,
+	.0176140071391521
 };
 
-constant real Gauss20Z[20]={
-	REAL(-.993128599185095),
-	REAL(-.963971927277914),
-	REAL(-.912234428251326),
-	REAL(-.839116971822219),
-	REAL(-.746331906460151),
-	REAL(-.636053680726515),
-	REAL(-.510867001950827),
-	REAL(-.37370608871542),
-	REAL(-.227785851141645),
-	REAL(-.076526521133497),
-	REAL(.0765265211334973),
-	REAL(.227785851141645),
-	REAL(.37370608871542),
-	REAL(.510867001950827),
-	REAL(.636053680726515),
-	REAL(.746331906460151),
-	REAL(.839116971822219),
-	REAL(.912234428251326),
-	REAL(.963971927277914),
-	REAL(.993128599185095)
+constant double Gauss20Z[20]={
+	-.993128599185095,
+	-.963971927277914,
+	-.912234428251326,
+	-.839116971822219,
+	-.746331906460151,
+	-.636053680726515,
+	-.510867001950827,
+	-.37370608871542,
+	-.227785851141645,
+	-.076526521133497,
+	.0765265211334973,
+	.227785851141645,
+	.37370608871542,
+	.510867001950827,
+	.636053680726515,
+	.746331906460151,
+	.839116971822219,
+	.912234428251326,
+	.963971927277914,
+	.993128599185095
 };
Index: sasmodels/models/lib/gauss76.c
===================================================================
--- sasmodels/models/lib/gauss76.c	(revision 14de349c663ca9521843af50415c37aed27a9eef)
+++ sasmodels/models/lib/gauss76.c	(revision 994d77f9b713691e41106d1f9af9661dfb2dc419)
@@ -9,159 +9,159 @@
 
 // Gaussians
-constant real Gauss76Wt[76]={
-	REAL(.00126779163408536),		//0
-	REAL(.00294910295364247),
-	REAL(.00462793522803742),
-	REAL(.00629918049732845),
-	REAL(.00795984747723973),
-	REAL(.00960710541471375),
-	REAL(.0112381685696677),
-	REAL(.0128502838475101),
-	REAL(.0144407317482767),
-	REAL(.0160068299122486),
-	REAL(.0175459372914742),		//10
-	REAL(.0190554584671906),
-	REAL(.020532847967908),
-	REAL(.0219756145344162),
-	REAL(.0233813253070112),
-	REAL(.0247476099206597),
-	REAL(.026072164497986),
-	REAL(.0273527555318275),
-	REAL(.028587223650054),
-	REAL(.029773487255905),
-	REAL(.0309095460374916),		//20
-	REAL(.0319934843404216),
-	REAL(.0330234743977917),
-	REAL(.0339977794120564),
-	REAL(.0349147564835508),
-	REAL(.0357728593807139),
-	REAL(.0365706411473296),
-	REAL(.0373067565423816),
-	REAL(.0379799643084053),
-	REAL(.0385891292645067),
-	REAL(.0391332242205184),		//30
-	REAL(.0396113317090621),
-	REAL(.0400226455325968),
-	REAL(.040366472122844),
-	REAL(.0406422317102947),
-	REAL(.0408494593018285),
-	REAL(.040987805464794),
-	REAL(.0410570369162294),
-	REAL(.0410570369162294),
-	REAL(.040987805464794),
-	REAL(.0408494593018285),		//40
-	REAL(.0406422317102947),
-	REAL(.040366472122844),
-	REAL(.0400226455325968),
-	REAL(.0396113317090621),
-	REAL(.0391332242205184),
-	REAL(.0385891292645067),
-	REAL(.0379799643084053),
-	REAL(.0373067565423816),
-	REAL(.0365706411473296),
-	REAL(.0357728593807139),		//50
-	REAL(.0349147564835508),
-	REAL(.0339977794120564),
-	REAL(.0330234743977917),
-	REAL(.0319934843404216),
-	REAL(.0309095460374916),
-	REAL(.029773487255905),
-	REAL(.028587223650054),
-	REAL(.0273527555318275),
-	REAL(.026072164497986),
-	REAL(.0247476099206597),		//60
-	REAL(.0233813253070112),
-	REAL(.0219756145344162),
-	REAL(.020532847967908),
-	REAL(.0190554584671906),
-	REAL(.0175459372914742),
-	REAL(.0160068299122486),
-	REAL(.0144407317482767),
-	REAL(.0128502838475101),
-	REAL(.0112381685696677),
-	REAL(.00960710541471375),		//70
-	REAL(.00795984747723973),
-	REAL(.00629918049732845),
-	REAL(.00462793522803742),
-	REAL(.00294910295364247),
-	REAL(.00126779163408536)		//75 (indexed from 0)
+constant double Gauss76Wt[76]={
+	.00126779163408536,		//0
+	.00294910295364247,
+	.00462793522803742,
+	.00629918049732845,
+	.00795984747723973,
+	.00960710541471375,
+	.0112381685696677,
+	.0128502838475101,
+	.0144407317482767,
+	.0160068299122486,
+	.0175459372914742,		//10
+	.0190554584671906,
+	.020532847967908,
+	.0219756145344162,
+	.0233813253070112,
+	.0247476099206597,
+	.026072164497986,
+	.0273527555318275,
+	.028587223650054,
+	.029773487255905,
+	.0309095460374916,		//20
+	.0319934843404216,
+	.0330234743977917,
+	.0339977794120564,
+	.0349147564835508,
+	.0357728593807139,
+	.0365706411473296,
+	.0373067565423816,
+	.0379799643084053,
+	.0385891292645067,
+	.0391332242205184,		//30
+	.0396113317090621,
+	.0400226455325968,
+	.040366472122844,
+	.0406422317102947,
+	.0408494593018285,
+	.040987805464794,
+	.0410570369162294,
+	.0410570369162294,
+	.040987805464794,
+	.0408494593018285,		//40
+	.0406422317102947,
+	.040366472122844,
+	.0400226455325968,
+	.0396113317090621,
+	.0391332242205184,
+	.0385891292645067,
+	.0379799643084053,
+	.0373067565423816,
+	.0365706411473296,
+	.0357728593807139,		//50
+	.0349147564835508,
+	.0339977794120564,
+	.0330234743977917,
+	.0319934843404216,
+	.0309095460374916,
+	.029773487255905,
+	.028587223650054,
+	.0273527555318275,
+	.026072164497986,
+	.0247476099206597,		//60
+	.0233813253070112,
+	.0219756145344162,
+	.020532847967908,
+	.0190554584671906,
+	.0175459372914742,
+	.0160068299122486,
+	.0144407317482767,
+	.0128502838475101,
+	.0112381685696677,
+	.00960710541471375,		//70
+	.00795984747723973,
+	.00629918049732845,
+	.00462793522803742,
+	.00294910295364247,
+	.00126779163408536		//75 (indexed from 0)
 };
 
-constant real Gauss76Z[76]={
-	REAL(-.999505948362153),		//0
-	REAL(-.997397786355355),
-	REAL(-.993608772723527),
-	REAL(-.988144453359837),
-	REAL(-.981013938975656),
-	REAL(-.972229228520377),
-	REAL(-.961805126758768),
-	REAL(-.949759207710896),
-	REAL(-.936111781934811),
-	REAL(-.92088586125215),
-	REAL(-.904107119545567),		//10
-	REAL(-.885803849292083),
-	REAL(-.866006913771982),
-	REAL(-.844749694983342),
-	REAL(-.822068037328975),
-	REAL(-.7980001871612),
-	REAL(-.77258672828181),
-	REAL(-.74587051350361),
-	REAL(-.717896592387704),
-	REAL(-.688712135277641),
-	REAL(-.658366353758143),		//20
-	REAL(-.626910417672267),
-	REAL(-.594397368836793),
-	REAL(-.560882031601237),
-	REAL(-.526420920401243),
-	REAL(-.491072144462194),
-	REAL(-.454895309813726),
-	REAL(-.417951418780327),
-	REAL(-.380302767117504),
-	REAL(-.342012838966962),
-	REAL(-.303146199807908),		//30
-	REAL(-.263768387584994),
-	REAL(-.223945802196474),
-	REAL(-.183745593528914),
-	REAL(-.143235548227268),
-	REAL(-.102483975391227),
-	REAL(-.0615595913906112),
-	REAL(-.0205314039939986),
-	REAL(.0205314039939986),
-	REAL(.0615595913906112),
-	REAL(.102483975391227),			//40
-	REAL(.143235548227268),
-	REAL(.183745593528914),
-	REAL(.223945802196474),
-	REAL(.263768387584994),
-	REAL(.303146199807908),
-	REAL(.342012838966962),
-	REAL(.380302767117504),
-	REAL(.417951418780327),
-	REAL(.454895309813726),
-	REAL(.491072144462194),		//50
-	REAL(.526420920401243),
-	REAL(.560882031601237),
-	REAL(.594397368836793),
-	REAL(.626910417672267),
-	REAL(.658366353758143),
-	REAL(.688712135277641),
-	REAL(.717896592387704),
-	REAL(.74587051350361),
-	REAL(.77258672828181),
-	REAL(.7980001871612),	//60
-	REAL(.822068037328975),
-	REAL(.844749694983342),
-	REAL(.866006913771982),
-	REAL(.885803849292083),
-	REAL(.904107119545567),
-	REAL(.92088586125215),
-	REAL(.936111781934811),
-	REAL(.949759207710896),
-	REAL(.961805126758768),
-	REAL(.972229228520377),		//70
-	REAL(.981013938975656),
-	REAL(.988144453359837),
-	REAL(.993608772723527),
-	REAL(.997397786355355),
-	REAL(.999505948362153)		//75
+constant double Gauss76Z[76]={
+	-.999505948362153,		//0
+	-.997397786355355,
+	-.993608772723527,
+	-.988144453359837,
+	-.981013938975656,
+	-.972229228520377,
+	-.961805126758768,
+	-.949759207710896,
+	-.936111781934811,
+	-.92088586125215,
+	-.904107119545567,		//10
+	-.885803849292083,
+	-.866006913771982,
+	-.844749694983342,
+	-.822068037328975,
+	-.7980001871612,
+	-.77258672828181,
+	-.74587051350361,
+	-.717896592387704,
+	-.688712135277641,
+	-.658366353758143,		//20
+	-.626910417672267,
+	-.594397368836793,
+	-.560882031601237,
+	-.526420920401243,
+	-.491072144462194,
+	-.454895309813726,
+	-.417951418780327,
+	-.380302767117504,
+	-.342012838966962,
+	-.303146199807908,		//30
+	-.263768387584994,
+	-.223945802196474,
+	-.183745593528914,
+	-.143235548227268,
+	-.102483975391227,
+	-.0615595913906112,
+	-.0205314039939986,
+	.0205314039939986,
+	.0615595913906112,
+	.102483975391227,			//40
+	.143235548227268,
+	.183745593528914,
+	.223945802196474,
+	.263768387584994,
+	.303146199807908,
+	.342012838966962,
+	.380302767117504,
+	.417951418780327,
+	.454895309813726,
+	.491072144462194,		//50
+	.526420920401243,
+	.560882031601237,
+	.594397368836793,
+	.626910417672267,
+	.658366353758143,
+	.688712135277641,
+	.717896592387704,
+	.74587051350361,
+	.77258672828181,
+	.7980001871612,	//60
+	.822068037328975,
+	.844749694983342,
+	.866006913771982,
+	.885803849292083,
+	.904107119545567,
+	.92088586125215,
+	.936111781934811,
+	.949759207710896,
+	.961805126758768,
+	.972229228520377,		//70
+	.981013938975656,
+	.988144453359837,
+	.993608772723527,
+	.997397786355355,
+	.999505948362153		//75
 };
Index: sasmodels/models/sphere.py
===================================================================
--- sasmodels/models/sphere.py	(revision 19dcb93366741a275baa8ad855ce8a310dca78f8)
+++ sasmodels/models/sphere.py	(revision 994d77f9b713691e41106d1f9af9661dfb2dc419)
@@ -86,14 +86,14 @@
 # This should perhaps be volume normalized?
 form_volume = """
-    return REAL(1.333333333333333)*M_PI*radius*radius*radius;
+    return 1.333333333333333*M_PI*radius*radius*radius;
     """
 
 Iq = """
-    const real qr = q*radius;
-    real sn, cn;
+    const double qr = q*radius;
+    double sn, cn;
     SINCOS(qr, sn, cn);
-    const real bes = qr==REAL(0.0) ? REAL(1.0) : REAL(3.0)*(sn-qr*cn)/(qr*qr*qr);
-    const real fq = bes * (sld - solvent_sld) * form_volume(radius);
-    return REAL(1.0e-4)*fq*fq;
+    const double bes = qr==0.0 ? 1.0 : 3.0*(sn-qr*cn)/(qr*qr*qr);
+    const double fq = bes * (sld - solvent_sld) * form_volume(radius);
+    return 1.0e-4*fq*fq;
     """
 
@@ -101,5 +101,6 @@
 Iqxy = """
     // never called since no orientation or magnetic parameters.
-    return REAL(-1.0);
+    //return -1.0;
+    return Iq(sqrt(qx*qx + qy*qy), sld, solvent_sld, radius);
     """
 
Index: sasmodels/models/triaxial_ellipsoid.c
===================================================================
--- sasmodels/models/triaxial_ellipsoid.c	(revision 5d4777d1f3042abc2b98b66609abf23d3bca1828)
+++ sasmodels/models/triaxial_ellipsoid.c	(revision 994d77f9b713691e41106d1f9af9661dfb2dc419)
@@ -1,85 +1,85 @@
-real form_volume(real req_minor, real req_major, real rpolar);
-real Iq(real q, real sld, real solvent_sld,
-    real req_minor, real req_major, real rpolar);
-real Iqxy(real qx, real qy, real sld, real solvent_sld,
-    real req_minor, real req_major, real rpolar, real theta, real phi, real psi);
+double form_volume(double req_minor, double req_major, double rpolar);
+double Iq(double q, double sld, double solvent_sld,
+    double req_minor, double req_major, double rpolar);
+double Iqxy(double qx, double qy, double sld, double solvent_sld,
+    double req_minor, double req_major, double rpolar, double theta, double phi, double psi);
 
-real form_volume(real req_minor, real req_major, real rpolar)
+double form_volume(double req_minor, double req_major, double rpolar)
 {
-    return REAL(1.333333333333333)*M_PI*req_minor*req_major*rpolar;
+    return 1.333333333333333*M_PI*req_minor*req_major*rpolar;
 }
 
-real Iq(real q,
-    real sld,
-    real solvent_sld,
-    real req_minor,
-    real req_major,
-    real rpolar)
+double Iq(double q,
+    double sld,
+    double solvent_sld,
+    double req_minor,
+    double req_major,
+    double rpolar)
 {
-    // if (req_minor > req_major || req_major > rpolar) return REAL(-1.0);  // Exclude invalid region
+    // if (req_minor > req_major || req_major > rpolar) return -1.0;  // Exclude invalid region
 
-    real sn, cn;
-    real st, ct;
-    //const real lower = REAL(0.0);
-    //const real upper = REAL(1.0);
-    real outer = REAL(0.0);
+    double sn, cn;
+    double st, ct;
+    //const double lower = 0.0;
+    //const double upper = 1.0;
+    double outer = 0.0;
     for (int i=0;i<76;i++) {
-        //const real cos_alpha = (Gauss76Z[i]*(upper-lower) + upper + lower)/2;
-        const real x = REAL(0.5)*(Gauss76Z[i] + REAL(1.0));
+        //const double cos_alpha = (Gauss76Z[i]*(upper-lower) + upper + lower)/2;
+        const double x = 0.5*(Gauss76Z[i] + 1.0);
         SINCOS(M_PI_2*x, sn, cn);
-        const real acosx2 = req_minor*req_minor*cn*cn;
-        const real bsinx2 = req_major*req_major*sn*sn;
-        const real c2 = rpolar*rpolar;
+        const double acosx2 = req_minor*req_minor*cn*cn;
+        const double bsinx2 = req_major*req_major*sn*sn;
+        const double c2 = rpolar*rpolar;
 
-        real inner = REAL(0.0);
+        double inner = 0.0;
         for (int j=0;j<76;j++) {
-            const real y = REAL(0.5)*(Gauss76Z[j] + REAL(1.0));
-            const real t = q*sqrt(acosx2 + bsinx2*(REAL(1.0)-y*y) + c2*y*y);
+            const double y = 0.5*(Gauss76Z[j] + 1.0);
+            const double t = q*sqrt(acosx2 + bsinx2*(1.0-y*y) + c2*y*y);
             SINCOS(t, st, ct);
-            const real fq = ( t==REAL(0.0) ? REAL(1.0) : REAL(3.0)*(st-t*ct)/(t*t*t) );
+            const double fq = ( t==0.0 ? 1.0 : 3.0*(st-t*ct)/(t*t*t) );
             inner += Gauss76Wt[j] * fq * fq ;
         }
-        outer += Gauss76Wt[i] * REAL(0.5) * inner;
+        outer += Gauss76Wt[i] * 0.5 * inner;
     }
-    //const real fq2 = (upper-lower)/2*outer;
-    const real fq2 = REAL(0.5)*outer;
-    const real s = (sld - solvent_sld) * form_volume(req_minor, req_major, rpolar);
-    return REAL(1.0e-4) * fq2 * s * s;
+    //const double fq2 = (upper-lower)/2*outer;
+    const double fq2 = 0.5*outer;
+    const double s = (sld - solvent_sld) * form_volume(req_minor, req_major, rpolar);
+    return 1.0e-4 * fq2 * s * s;
 }
 
-real Iqxy(real qx, real qy,
-    real sld,
-    real solvent_sld,
-    real req_minor,
-    real req_major,
-    real rpolar,
-    real theta,
-    real phi,
-    real psi)
+double Iqxy(double qx, double qy,
+    double sld,
+    double solvent_sld,
+    double req_minor,
+    double req_major,
+    double rpolar,
+    double theta,
+    double phi,
+    double psi)
 {
-    // if (req_minor > req_major || req_major > rpolar) return REAL(-1.0);  // Exclude invalid region
+    // if (req_minor > req_major || req_major > rpolar) return -1.0;  // Exclude invalid region
 
-    real stheta, ctheta;
-    real sphi, cphi;
-    real spsi, cpsi;
-    real st, ct;
+    double stheta, ctheta;
+    double sphi, cphi;
+    double spsi, cpsi;
+    double st, ct;
 
-    const real q = sqrt(qx*qx + qy*qy);
-    const real qxhat = qx/q;
-    const real qyhat = qy/q;
+    const double q = sqrt(qx*qx + qy*qy);
+    const double qxhat = qx/q;
+    const double qyhat = qy/q;
     SINCOS(theta*M_PI_180, stheta, ctheta);
     SINCOS(phi*M_PI_180, sphi, cphi);
     SINCOS(psi*M_PI_180, spsi, cpsi);
-    const real calpha = ctheta*cphi*qxhat + stheta*qyhat;
-    const real cnu = (-cphi*spsi*stheta + sphi*cpsi)*qxhat + spsi*ctheta*qyhat;
-    const real cmu = (-stheta*cpsi*cphi - spsi*sphi)*qxhat + ctheta*cpsi*qyhat;
-    const real t = q*sqrt(req_minor*req_minor*cnu*cnu
+    const double calpha = ctheta*cphi*qxhat + stheta*qyhat;
+    const double cnu = (-cphi*spsi*stheta + sphi*cpsi)*qxhat + spsi*ctheta*qyhat;
+    const double cmu = (-stheta*cpsi*cphi - spsi*sphi)*qxhat + ctheta*cpsi*qyhat;
+    const double t = q*sqrt(req_minor*req_minor*cnu*cnu
                           + req_major*req_major*cmu*cmu
                           + rpolar*rpolar*calpha*calpha);
     SINCOS(t, st, ct);
-    const real fq = ( t==REAL(0.0) ? REAL(1.0) : REAL(3.0)*(st-t*ct)/(t*t*t) );
-    const real s = (sld - solvent_sld) * form_volume(req_minor, req_major, rpolar);
+    const double fq = ( t==0.0 ? 1.0 : 3.0*(st-t*ct)/(t*t*t) );
+    const double s = (sld - solvent_sld) * form_volume(req_minor, req_major, rpolar);
 
-    return REAL(1.0e-4) * fq * fq * s * s;
+    return 1.0e-4 * fq * fq * s * s;
 }
 
