Astro-PAL

 view release on metacpan or  search on metacpan

palsrc/palDfltin.c  view on Meta::CPAN

*     - The code is more robust if the C99 copysign() function is available.
*     This can recognize the -0.0 values returned by strtod. If copysign() is
*     missing we try to scan the string looking for minus signs.

*  History:
*     2012-03-08 (TIMJ):
*        Initial version based on strtod
*        Adapted with permission from the Fortran SLALIB library
*        although this is a completely distinct implementation of the SLA API.
*     2012-06-21 (TIMJ):
*        Provide a backup for missing copysign.
*     2012-06-22 (TIMJ):
*        Check __STDC_VERSION__
*     {enter_further_changes_here}

*  Copyright:
*     Copyright (C) 2012 Science and Technology Facilities Council.
*     All Rights Reserved.

*  Licence:
*     This program is free software; you can redistribute it and/or

palsrc/palmac.h  view on Meta::CPAN


/* DNINT(A) - round to nearest whole number (double) */
#define DNINT(A) ((A)<0.0?ceil((A)-0.5):floor((A)+0.5))

/* DMAX(A,B) - return maximum value - evaluates arguments multiple times */
#define DMAX(A,B) ((A) > (B) ? (A) : (B) )

/* DMIN(A,B) - return minimum value - evaluates arguments multiple times */
#define DMIN(A,B) ((A) < (B) ? (A) : (B) )

/* We actually prefer to use C99 copysign() but we define this here as a backup
   but it will not detect -0.0 so is not useful for palDfltin. */
/* DSIGN(A,B) - magnitude of A with sign of B (double) */
#define DSIGN(A,B) ((B)<0.0?-fabs(A):fabs(A))

#endif



( run in 0.481 second using v1.01-cache-2.11-cpan-49f99fa48dc )