Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
Data Structures | Macros | Functions | Variables
18.numeric.special.float.cpp File Reference
#include <rw/_defs.h>
#include <limits>
#include <climits>
#include <cstdlib>
#include <cstdio>
#include <float.h>
#include <math.h>
#include <ieeefp.h>
#include <rw_driver.h>
Include dependency graph for 18.numeric.special.float.cpp:

Go to the source code of this file.

Data Structures

struct  limits_values< float >
 
struct  limits_values< double >
 
struct  limits_values< long double >
 

Macros

#define FLT_ROUNDS   _RWSTD_FLT_ROUNDS
 
#define CHECK_CONST(const_int)
 
#define VERIFY_DATA(member)
 
#define VERIFY_CONST(member, value)
 
#define VERIFY_FUNCTION(member)
 
#define VERIFY_SIGNATURE(member)
 
#define VERIFY_CONST(x, value)
 

Functions

template<class FloatT >
void test_infinity (FloatT inf, FloatT max, const char *tname)
 
template<class FloatT >
void test_quiet_NaN (FloatT qnan, FloatT qnan2, const char *tname)
 
template<class FloatT >
void test_signaling_NaN (FloatT snan, FloatT snan2, const char *tname)
 
template<class FloatT >
void test_limits (FloatT, const char *tname, const char *fmt)
 
int main (int argc, char *argv[])
 

Variables

const bool big_endian = !*(const char*)&endian_test
 
volatile float flt_zero = 0
 
volatile double dbl_zero = 0
 
volatile long double ldbl_zero = 0
 

Macro Definition Documentation

◆ CHECK_CONST

#define CHECK_CONST (   const_int)
Value:
enum { e = const_int }; \
(void)&const_int
#define e
Definition 17.names.cpp:118

◆ FLT_ROUNDS

#define FLT_ROUNDS   _RWSTD_FLT_ROUNDS

18.numeric.special.float.cpp

test to exercise floating point specializations of the numeric_limits class template

$Id$

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2000-2008 Rogue Wave Software, Inc.

Definition at line 59 of file 18.numeric.special.float.cpp.

◆ VERIFY_CONST [1/2]

#define VERIFY_CONST (   member,
  value 
)
Value:
do { \
/* verify that member if a constant integral expression */ \
CHECK_CONST (FLim::member); \
/* verify value */ \
rw_assert (FLim::member == value, 0, __LINE__, \
"numeric_limits<%s>::" #member " == %i, got %i", \
tname, FVal::member (), value); \
} while (0)
T value(const T &val)

◆ VERIFY_CONST [2/2]

#define VERIFY_CONST (   x,
  value 
)
Value:
do { \
enum { e = x }; \
rw_assert (value == x, 0, __LINE__, \
#x " == %d, got %d", value, x); \
} while (0)
#define x
Definition 17.names.cpp:140

◆ VERIFY_DATA

#define VERIFY_DATA (   member)
Value:
do { \
/* verify that member is a constant integral expression */ \
CHECK_CONST (FLim::member); \
/* verify value */ \
rw_assert (FLim::member == FVal::member (), 0, __LINE__, \
"numeric_limits<%s>::" #member " == %i, got %i", \
tname, FVal::member (), FLim::member); \
} while (0)

◆ VERIFY_FUNCTION

#define VERIFY_FUNCTION (   member)
Value:
do { \
/* verify function signature */ \
FloatT (*pf)() _PTR_THROWS(()) = &FLim::member; \
_RWSTD_UNUSED (pf); \
/* verify value */ \
rw_assert ( FLim::member () == FVal::member () \
|| ( FLim::member () != FLim::member () \
&& FVal::member () != FVal::member ()), \
0, __LINE__, \
"numeric_limits<%s>::" #member "() == %{@}, got %{@}", \
tname, fmt, FVal::member (), fmt, FLim::member ()); \
} while (0)
#define pf
Definition 17.names.cpp:516
#define _PTR_THROWS(spec)

◆ VERIFY_SIGNATURE

#define VERIFY_SIGNATURE (   member)
Value:
do { \
/* verify function signature */ \
FloatT (*pf)() _PTR_THROWS(()) = &FLim::member; \
_RWSTD_UNUSED (pf); \
} while (0)

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 1447 of file 18.numeric.special.float.cpp.

◆ test_infinity()

template<class FloatT >
void test_infinity ( FloatT  inf,
FloatT  max,
const char *  tname 
)

Definition at line 189 of file 18.numeric.special.float.cpp.

◆ test_limits()

template<class FloatT >
void test_limits ( FloatT  ,
const char *  tname,
const char *  fmt 
)

Definition at line 1194 of file 18.numeric.special.float.cpp.

◆ test_quiet_NaN()

template<class FloatT >
void test_quiet_NaN ( FloatT  qnan,
FloatT  qnan2,
const char *  tname 
)

Definition at line 249 of file 18.numeric.special.float.cpp.

◆ test_signaling_NaN()

template<class FloatT >
void test_signaling_NaN ( FloatT  snan,
FloatT  snan2,
const char *  tname 
)

Definition at line 319 of file 18.numeric.special.float.cpp.

Variable Documentation

◆ big_endian

const bool big_endian = !*(const char*)&endian_test
extern

◆ dbl_zero

volatile double dbl_zero = 0

Definition at line 73 of file 18.numeric.special.float.cpp.

◆ flt_zero

volatile float flt_zero = 0

Definition at line 72 of file 18.numeric.special.float.cpp.

◆ ldbl_zero

volatile long double ldbl_zero = 0

Definition at line 77 of file 18.numeric.special.float.cpp.