backup - no unique long long function
This commit is contained in:
parent
1e3367b0d3
commit
6464cf535d
|
|
@ -8,7 +8,7 @@ Copyright 1999 Emmanuel Rouat
|
|||
#ifndef MISSING_MATH_H_INCLUDED
|
||||
#define MISSING_MATH_H_INCLUDED
|
||||
|
||||
bool AlmostEqualUlps(double, double, long int);
|
||||
bool AlmostEqualUlps(float, float, int);
|
||||
|
||||
#ifndef HAVE_ERFC
|
||||
extern double erfc(double);
|
||||
|
|
|
|||
|
|
@ -11,17 +11,18 @@ $Id$
|
|||
#include "ngspice.h"
|
||||
#include "missing_math.h"
|
||||
|
||||
|
||||
/* Initial AlmostEqualULPs version - fast and simple, but */
|
||||
/* some limitations. */
|
||||
bool AlmostEqualUlps(double A, double B, long int maxUlps)
|
||||
bool AlmostEqualUlps(float A, float B, int maxUlps)
|
||||
{
|
||||
long int intDiff;
|
||||
assert(sizeof(double) == sizeof(long int));
|
||||
int intDiff;
|
||||
assert(sizeof(float) == sizeof(int));
|
||||
|
||||
if (A == B)
|
||||
return TRUE;
|
||||
|
||||
intDiff = abs(*(long int*)&A - *(long int*)&B);
|
||||
intDiff = abs(*(int*)&A - *(int*)&B);
|
||||
|
||||
if (intDiff <= maxUlps)
|
||||
return TRUE;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
#ifndef MISSING_MATH_H_INCLUDED
|
||||
#define MISSING_MATH_H_INCLUDED
|
||||
|
||||
bool AlmostEqualUlps(double, double, long int);
|
||||
bool AlmostEqualUlps(float, float, int);
|
||||
|
||||
#ifndef HAVE_ERFC
|
||||
double erfc(double);
|
||||
|
|
|
|||
Loading…
Reference in New Issue