FPEqual.h File Reference

This file contains declaration and implementation of functions that check floating point numbers for equalty. More...

#include <stdlib.h>
#include "Platform.h"

Namespaces

namespace  Common

Defines

#define FLOAT_AS_INT(x)   ( ( *(int*)&( x ) ) )
 This macro interprets float as int for easier bitwies access.
#define DOUBLE_AS_LONGLONG(x)   ( ( *(long long*)&( x ) ) )
 This macro interprets double as long long for easier bitwies access.
#define FLOAT_SIGN   0x80000000UL
 Extracts sign from single precision floating point number.
#define DOUBLE_SIGN   0x8000000000000000ULL
 Extracts sign from double precision floating point number.

Functions

bool GAL_API Common::FloatsEqual (float x, float y, int ulpTolerance=10)
 This method compares two single precision floating point numbers for equality with defined level of tolerance.
bool GAL_API Common::DoublesEqual (double x, double y, int ulpTolerance=10)
 This method compares two double precision floating point numbers for equality with defined level of tolerance.


Detailed Description

This file contains declaration and implementation of functions that check floating point numbers for equalty.


Define Documentation

#define DOUBLE_AS_LONGLONG (  )     ( ( *(long long*)&( x ) ) )

This macro interprets double as long long for easier bitwies access.

#define DOUBLE_SIGN   0x8000000000000000ULL

Extracts sign from double precision floating point number.

#define FLOAT_AS_INT (  )     ( ( *(int*)&( x ) ) )

This macro interprets float as int for easier bitwies access.

#define FLOAT_SIGN   0x80000000UL

Extracts sign from single precision floating point number.


Genetic Algorithm Library
Coolsoft Software Development