Ignore:
Timestamp:
Nov 13, 2017 6:02:21 PM (7 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
a57ae07
Parents:
95d7c4f
Message:

hack around broken isfinite/isnan in tinycc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/calculator/c_extensions/librefl.c

    r4c29e4d ra1daf86  
    77#include <stdio.h> 
    88#include <stdlib.h> 
    9 #if defined(_MSC_VER) 
     9#if defined _MSC_VER  || defined __TINYCC__ 
    1010#define NEED_ERF 
    1111#endif 
     
    2121 
    2222 
    23 #ifdef _WIN32 
     23#ifdef __TINYCC__ 
     24# ifdef isnan 
     25#   undef isnan 
     26# endif 
     27# ifdef isfinite 
     28#   undef isfinite 
     29# endif 
     30# define isnan(x) (x != x) 
     31# define isfinite(x) (x != INFINITY && x != -INFINITY) 
     32#elif defined _WIN32 
    2433# include <float.h> 
    2534# if !defined __MINGW32__ || defined __NO_ISOCEXT 
     
    3039#   define isinf(x) (!_finite(x) && !_isnan(x)) 
    3140#  endif 
    32 #  ifndef finite 
    33 #   define finite(x) _finite(x) 
     41#  ifndef isfinite 
     42#   define isfinite(x) _finite(x) 
    3443#  endif 
    3544# endif 
     
    8493double erf(double x) 
    8594{ 
    86     if (!finite(x)) { 
     95    if (!isfinite(x)) { 
    8796        if (isnan(x)) return x;      /* erf(NaN)   = NaN   */ 
    8897        return (x>0 ? 1.0 : -1.0);   /* erf(+-inf) = +-1.0 */ 
     
    94103double erfc(double x) 
    95104{ 
    96     if (!finite(x)) { 
     105    if (!isfinite(x)) { 
    97106        if (isnan(x)) return x;      /* erfc(NaN)   = NaN      */ 
    98107        return (x>0 ? 0.0 : 2.0);    /* erfc(+-inf) = 0.0, 2.0 */ 
Note: See TracChangeset for help on using the changeset viewer.