math_bits.h File Reference

Provides some fairly low-level math support. More...

#include "geometric_dll.h"
#include <basis/istring.h>

Include dependency graph for math_bits.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

istring GEOMETRIC_FUNCTION_STYLE crop_numeric (const istring &input)
 Eats the numeric characters from the front of "input".
istring GEOMETRIC_FUNCTION_STYLE crop_non_numeric (const istring &input)
 Eats the non-numeric characters from the front of "input".
template<class numeric_type>
bool is_floating_point (numeric_type t)
 returns true if the specified numeric_type is a floating_point type.
template<class numeric_type>
bool is_integral (numeric_type t)
 returns true if the instantiation type is an integer.
template<class numeric_type>
bool is_short (numeric_type)
 returns true if the specified type is short on the PC.
template<class numeric_type>
bool is_unsigned (numeric_type t)
 returns true if the templated type is unsigned.
template<class numeric_type>
bool is_signed (numeric_type t)
 returns true if the templated type is signed.
template<class numeric_type>
istring numeric_specifier (numeric_type t)
 Guesses the formatting string needed for the type provided.


Detailed Description

Provides some fairly low-level math support.

Definition in file math_bits.h.


Function Documentation

istring GEOMETRIC_FUNCTION_STYLE crop_non_numeric ( const istring input  ) 

Eats the non-numeric characters from the front of "input".

Definition at line 36 of file math_bits.cpp.

References istring::length(), and istring::zap().

Referenced by geometric::point< numeric_type >::from_text(), and geometric::rectangle< numeric_type >::from_text().

istring GEOMETRIC_FUNCTION_STYLE crop_numeric ( const istring input  ) 

Eats the numeric characters from the front of "input".

This and crop_non_numeric() return a string that is constructed from "input" by chopping the numerical (or non-numerical) characters off of the beginning. The types of numbers supported are floating point, but it will generally work for integers also (problems arise when mixing in the period, e, E, +, and - characters with integer numbers).

Definition at line 22 of file math_bits.cpp.

References istring::length(), and istring::zap().

Referenced by geometric::point< numeric_type >::from_text(), and geometric::rectangle< numeric_type >::from_text().

template<class numeric_type>
bool is_floating_point ( numeric_type  t  ) 

returns true if the specified numeric_type is a floating_point type.

this is useful in templates where one wants to know about the templated type.

Definition at line 42 of file math_bits.h.

References absolute_value().

Referenced by is_integral(), and numeric_specifier().

template<class numeric_type>
bool is_integral ( numeric_type  t  ) 

returns true if the instantiation type is an integer.

Definition at line 48 of file math_bits.h.

References is_floating_point().

template<class numeric_type>
bool is_short ( numeric_type   ) 

returns true if the specified type is short on the PC.

Definition at line 55 of file math_bits.h.

Referenced by numeric_specifier().

template<class numeric_type>
bool is_signed ( numeric_type  t  ) 

returns true if the templated type is signed.

Definition at line 62 of file math_bits.h.

References is_unsigned().

template<class numeric_type>
bool is_unsigned ( numeric_type  t  ) 

returns true if the templated type is unsigned.

Definition at line 59 of file math_bits.h.

Referenced by is_signed(), and numeric_specifier().

template<class numeric_type>
istring numeric_specifier ( numeric_type  t  ) 

Guesses the formatting string needed for the type provided.

Returns a string that is appropriate as the format specifier of a printf (or the istring constructor) given the template type. templates can rely on this to print numerical types correctly.

Definition at line 69 of file math_bits.h.

References istring::insert(), is_floating_point(), is_short(), and is_unsigned().

Referenced by geometric::rectangle< numeric_type >::from_text(), and geometric::point< numeric_type >::text_form().


Generated on Fri Nov 28 04:30:05 2008 for HOOPLE Libraries by  doxygen 1.5.1