diff options
| author | Christoph Berg <myon@debian.org> | 2018-12-19 22:58:32 +0100 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2018-12-19 22:58:32 +0100 |
| commit | e0737c56c1e384e05064a0c6e1ac46979371041b (patch) | |
| tree | a0123d694a2d36c43dabdf0a3907392fce11d457 /boost/libs/math/doc/fp_utilities | |
| parent | b4aebf2d137b892f53503b13785ecae900062ff7 (diff) | |
New upstream version 2.0.0+repackupstream/2.0.0+repack
Diffstat (limited to 'boost/libs/math/doc/fp_utilities')
| -rw-r--r-- | boost/libs/math/doc/fp_utilities/float_comparison.qbk | 122 | ||||
| -rw-r--r-- | boost/libs/math/doc/fp_utilities/float_next.qbk | 272 | ||||
| -rw-r--r-- | boost/libs/math/doc/fp_utilities/fp_facets.qbk | 568 | ||||
| -rw-r--r-- | boost/libs/math/doc/fp_utilities/fpclassify.qbk | 124 | ||||
| -rw-r--r-- | boost/libs/math/doc/fp_utilities/rounding_func.qbk | 129 | ||||
| -rw-r--r-- | boost/libs/math/doc/fp_utilities/sign.qbk | 137 |
6 files changed, 1352 insertions, 0 deletions
diff --git a/boost/libs/math/doc/fp_utilities/float_comparison.qbk b/boost/libs/math/doc/fp_utilities/float_comparison.qbk new file mode 100644 index 00000000..795d6092 --- /dev/null +++ b/boost/libs/math/doc/fp_utilities/float_comparison.qbk @@ -0,0 +1,122 @@ +[section:float_comparison Floating-point Comparison] + +[import ../../example/float_comparison_example.cpp] + +Comparison of floating-point values has always been a source of endless difficulty and confusion. + +Unlike integral values that are exact, all floating-point operations +will potentially produce an inexact result that will be rounded to the nearest +available binary representation. Even apparently inocuous operations such as assigning +0.1 to a double produces an inexact result (as this decimal number has no +exact binary representation). + +Floating-point computations also involve rounding so that some 'computational noise' is added, +and hence results are also not exact (although repeatable, at least under identical platforms and compile options). + +Sadly, this conflicts with the expectation of most users, as many articles and innumerable cries for help show all too well. + +Some background reading is: + +* Knuth D.E. The art of computer programming, vol II, section 4.2, especially Floating-Point Comparison 4.2.2, pages 198-220. +* [@http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html David Goldberg, "What Every Computer Scientist Should Know About Floating-Point Arithmetic"] +* [@http://adtmag.com/articles/2000/03/16/comparing-floatshow-to-determine-if-floating-quantities-are-close-enough-once-a-tolerance-has-been-r.aspx +Alberto Squassabia, Comparing floats listing] +* [@https://code.google.com/p/googletest/wiki/AdvancedGuide#Floating-Point_Comparison Google Floating-Point_Comparison guide] +* [@boost:/libs/test/doc/html/boost_test/users_guide/testing_tools/testing_floating_points.html Boost.Test Floating-Point_Comparison] + +Boost provides a number of ways to compare floating-point values to see if they are tolerably close enough to each other, +but first we must decide what kind of comparison we require: + +* Absolute difference/error: the absolute difference between two values ['a] and ['b] is simply `fabs(a-b)`. +This is the only meaningful comparison to make if we know that the result may have cancellation error (see below). +* The edit distance between the two values: i.e. how many (binary) floating-point values are between two values ['a] and ['b]? +This is provided by the function __float_distance, but is probably only useful when you know that the distance should be very small. +This function is somewhat difficult to compute, and doesn't scale to values that are very far apart. In other words, use with care. +* The relative distance/error between two values. This is quick and easy to compute, and is generally the method of choice when +checking that your results are "tolerably close" to one another. However, it is not as exact as the edit distance when dealing +with small differences, and due to the way floating-point values are encoded can "wobble" by a factor of 2 compared to the "true" +edit distance. This is the method documented below: if `float_distance` is a surgeon's scalpel, then `relative_difference` is more +like a Swiss army knife: both have important but different use cases. + + +[h5:fp_relative Relative Comparison of Floating-point Values] + + +`#include <boost/math/special_functions/relative_difference.hpp>` + + template <class T, class U> + ``__sf_result`` relative_difference(T a, U b); + + template <class T, class U> + ``__sf_result`` epsilon_difference(T a, U b); + +The function `relative_difference` returns the relative distance/error ['E] between two values as defined by: + +[pre E = fabs((a - b) / min(a,b))] + +The function `epsilon_difference` is a convenience function that returns `relative_difference(a, b) / eps` where +`eps` is the machine epsilon for the result type. + +The following special cases are handled as follows: + +* If either of ['a] or ['b] is a NaN, then returns the largest representable value for T: for example for type `double`, this +is `std::numeric_limits<double>::max()` which is the same as `DBL_MAX` or `1.7976931348623157e+308`. +* If ['a] and ['b] differ in sign then returns the largest representable value for T. +* If both ['a] and ['b] are both infinities (of the same sign), then returns zero. +* If just one of ['a] and ['b] is an infinity, then returns the largest representable value for T. +* If both ['a] and ['b] are zero then returns zero. +* If just one of ['a] or ['b] is a zero or a denormalized value, then it is treated as if it were the +smallest (non-denormalized) value representable in T for the purposes of the above calculation. + +These rules were primarily designed to assist with our own test suite, they are designed to be robust enough +that the function can in most cases be used blindly, including in cases where the expected result is actually +too small to represent in type T and underflows to zero. + +[h5 Examples] + +[compare_floats_using] + +[compare_floats_example_1] +[compare_floats_example_2] +[compare_floats_example_3] +[compare_floats_example_4] +[compare_floats_example_5] +[compare_floats_example_6] + +All the above examples are contained in [@../../example/float_comparison_example.cpp float_comparison_example.cpp]. + +[h5:small Handling Absolute Errors] + +Imagine we're testing the following function: + + double myspecial(double x) + { + return sin(x) - sin(4 * x); + } + +This function has multiple roots, some of which are quite predicable in that both +`sin(x)` and `sin(4x)` are zero together. Others occur because the values returned +from those two functions precisely cancel out. At such points the relative difference +between the true value of the function and the actual value returned may be ['arbitrarily +large] due to [@http://en.wikipedia.org/wiki/Loss_of_significance cancellation error]. + +In such a case, testing the function above by requiring that the values returned by +`relative_error` or `epsilon_error` are below some threshold is pointless: the best +we can do is to verify that the ['absolute difference] between the true +and calculated values is below some threshold. + +Of course, determining what that threshold should be is often tricky, +but a good starting point would be machine epsilon multiplied by the largest +of the values being summed. In the example above, the largest value returned +by `sin(whatever)` is 1, so simply using machine epsilon as the target for +maximum absolute difference might be a good start (though in practice we may need +a slightly higher value - some trial and error will be necessary). + +[endsect] [/section:float_comparison Floating-point comparison] + +[/ + Copyright 2015 John Maddock and Paul A. Bristow. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] diff --git a/boost/libs/math/doc/fp_utilities/float_next.qbk b/boost/libs/math/doc/fp_utilities/float_next.qbk new file mode 100644 index 00000000..4c9de91a --- /dev/null +++ b/boost/libs/math/doc/fp_utilities/float_next.qbk @@ -0,0 +1,272 @@ +[section:next_float Floating-Point Representation Distance (ULP), + and Finding Adjacent Floating-Point Values] + +[@http://en.wikipedia.org/wiki/Unit_in_the_last_place Unit of Least Precision or Unit in the Last Place] +is the gap between two different, but as close as possible, floating-point numbers. + +Most decimal values, for example 0.1, cannot be exactly represented as floating-point values, +but will be stored as the +[@http://en.wikipedia.org/wiki/Floating_point#Representable_numbers.2C_conversion_and_rounding +closest representable floating-point]. + +Functions are provided for finding adjacent greater and lesser floating-point values, +and estimating the number of gaps between any two floating-point values. + +The floating-point type (FPT) must have has a fixed number of bits in the representation. +The number of bits may set at runtime, but must be the same for all numbers. +For example, __NTL_quad_float type (fixed 128-bit representation), +__NTL_RR type (arbitrary but fixed decimal digits, default 150) or +__multiprecision __cpp_dec_float and__cpp_bin_float are fixed at runtime, +but [*not] a type that extends the representation to provide an exact representation +for any number, for example [@http://keithbriggs.info/xrc.html XRC eXact Real in C]. + +[section:nextafter Finding the Next Representable Value in a Specific Direction (nextafter)] + +[h4 Synopsis] + +`` +#include <boost/math/special_functions/next.hpp> +`` + + namespace boost{ namespace math{ + + template <class FPT> + FPT nextafter(FPT val, FPT direction); + + }} // namespaces + +[h4 Description - nextafter] + +This is an implementation of the `nextafter` function included in the C99 standard. +(It is also effectively an implementation of the C99 `nexttoward` legacy function +which differs only having a `long double` direction, +and can generally serve in its place if required). + +[note The C99 functions must use suffixes f and l to distinguish `float` and `long double` versions. +C++ uses the template mechanism instead.] + +Returns the next representable value after /x/ in the direction of /y/. If +`x == y` then returns /x/. If /x/ is non-finite then returns the result of +a __domain_error. If there is no such value in the direction of /y/ then +returns an __overflow_error. + +[warning The template parameter FTP must be a floating-point type. +An integer type, for example, will produce an unhelpful error message.] + +[tip Nearly always, you just want the next or prior representable value, +so instead use `float_next` or `float_prior` below.] + +[h4 Examples - nextafter] + +The two representations using a 32-bit float either side of unity are: +`` +The nearest (exact) representation of 1.F is 1.00000000 +nextafter(1.F, 999) is 1.00000012 +nextafter(1/f, -999) is 0.99999994 + +The nearest (not exact) representation of 0.1F is 0.100000001 +nextafter(0.1F, 10) is 0.100000009 +nextafter(0.1F, 10) is 0.099999994 +`` + +[endsect] [/section:nextafter Finding the Next Representable Value in a Specific Direction (nextafter)] + +[section:float_next Finding the Next Greater Representable Value (float_next)] + +[h4 Synopsis] + +`` +#include <boost/math/special_functions/next.hpp> +`` + + namespace boost{ namespace math{ + + template <class FPT> + FPT float_next(FPT val); + + }} // namespaces + +[h4 Description - float_next] + +Returns the next representable value which is greater than /x/. +If /x/ is non-finite then returns the result of +a __domain_error. If there is no such value greater than /x/ then +returns an __overflow_error. + +Has the same effect as + + nextafter(val, (std::numeric_limits<FPT>::max)()); + +[endsect] [/section:float_next Finding the Next Greater Representable Value (float_prior)] + +[section:float_prior Finding the Next Smaller Representable Value (float_prior)] + +[h4 Synopsis] + +`` +#include <boost/math/special_functions/next.hpp> +`` + + namespace boost{ namespace math{ + + template <class FPT> + FPT float_prior(FPT val); + + }} // namespaces + + +[h4 Description - float_prior] + +Returns the next representable value which is less than /x/. +If /x/ is non-finite then returns the result of +a __domain_error. If there is no such value less than /x/ then +returns an __overflow_error. + +Has the same effect as + + nextafter(val, -(std::numeric_limits<FPT>::max)()); // Note most negative value -max. + +[endsect] [/section:float_prior Finding the Next Smaller Representable Value (float_prior)] + +[section:float_distance Calculating the Representation Distance + Between Two floating-point Values (ULP) float_distance] + +Function float_distance finds the number of gaps/bits/ULP between any two floating-point values. +If the significands of floating-point numbers are viewed as integers, +then their difference is the number of ULP/gaps/bits different. + +[h4 Synopsis] + +`` +#include <boost/math/special_functions/next.hpp> +`` + + namespace boost{ namespace math{ + + template <class FPT> + FPT float_distance(FPT a, FPT b); + + }} // namespaces + +[h4 Description - float_distance] + +Returns the distance between /a/ and /b/: the result is always +a signed integer value (stored in floating-point type FPT) +representing the number of distinct representations between /a/ and /b/. + +Note that + +* `float_distance(a, a)` always returns 0. +* `float_distance(float_next(a), a)` always returns -1. +* `float_distance(float_prior(a), a)` always returns 1. + +The function `float_distance` is equivalent to calculating the number +of ULP (Units in the Last Place) between /a/ and /b/ except that it +returns a signed value indicating whether `a > b` or not. + +If the distance is too great then it may not be able +to be represented as an exact integer by type FPT, +but in practice this is unlikely to be a issue. + +[endsect] [/section:float_distance Calculating the Representation Distance + Between Two floating-point Values (ULP) float_distance] + +[section:float_advance Advancing a floating-point Value by a Specific +Representation Distance (ULP) float_advance] + +Function `float_advance` advances a floating-point number by a specified number +of ULP. + +[h4 Synopsis] + +`` +#include <boost/math/special_functions/next.hpp> +`` + + namespace boost{ namespace math{ + + template <class FPT> + FPT float_advance(FPT val, int distance); + + }} // namespaces + +[h4 Description - float_advance] + +Returns a floating-point number /r/ such that `float_distance(val, r) == distance`. + +[endsect] [/section:float_advance] + +[section:ulp Obtaining the Size of a Unit In the Last Place - ULP] + +Function `ulp` gives the size of a unit-in-the-last-place for a specified floating-point value. + +[h4 Synopsis] + +`` +#include <boost/math/special_functions/ulp.hpp> +`` + + namespace boost{ namespace math{ + + template <class FPT> + FPT ulp(const FPT& x); + + template <class FPT, class Policy> + FPT ulp(const FPT& x, const Policy&); + + }} // namespaces + +[h4 Description - ulp] + +Returns one [@http://en.wikipedia.org/wiki/Unit_in_the_last_place unit in the last place] of ['x]. + +Corner cases are handled as followes: + +* If the argument is a NaN, then raises a __domain_error. +* If the argument is an infinity, then raises an __overflow_error. +* If the argument is zero then returns the smallest representable value: for example for type +`double` this would be either `std::numeric_limits<double>::min()` or `std::numeric_limits<double>::denorm_min()` +depending whether denormals are supported (which have the values 2.`2250738585072014e-308` and `4.9406564584124654e-324` respectively). +* If the result is too small to represent, then returns the smallest representable value. +* Always returns a positive value such that `ulp(x) == ulp(-x)`. + +[*Important:] The behavior of this function is aligned to that of [@http://docs.oracle.com/javase/7/docs/api/java/lang/Math.html#ulp%28double%29 +Java's ulp function], please note +however that this function should only ever be used for rough and ready calculations as there are enough +corner cases to trap even careful programmers. In particular: + +* The function is asymetrical, which is to say, given `u = ulp(x)` if `x > 0` then `x + u` is the +next floating-point value, but `x - u` is not necessarily the previous value. Similarly, if +`x < 0` then `x - u` is the previous floating-point value, but `x + u` is not necessarily the next +value. The corner cases occur at power of 2 boundaries. +* When the argument becomes very small, it may be that there is no floating-point value that +represents one ULP. Whether this is the case or not depends not only on whether the hardware +may ['sometimes] support denormals (as signalled by `std::numeric_limits<FPT>::has_denorm`), but also whether these are +currently enabled at runtime (for example on SSE hardware, the DAZ or FTZ flags will disable denormal support). +In this situation, the `ulp` function may return a value that is many orders of magnitude too large. + +In light of the issues above, we recomend that: + +* To move between adjacent floating-point values always use __float_next, __float_prior or __nextafter (`std::nextafter` +is another candidate, but our experience is that this also often breaks depending which optimizations and +hardware flags are in effect). +* To move several floating-point values away use __float_advance. +* To calculate the edit distance between two floats use __float_distance. + +There is none the less, one important use case for this function: + +If it is known that the true result of some function is x[sub t] and the calculated result +is x[sub c], then the error measured in ulp is simply [^fabs(x[sub t] - x[sub c]) / ulp(x[sub t])]. + +[endsect] [/section ulp] + +[endsect] [/ section:next_float Floating-Point Representation Distance (ULP), + and Finding Adjacent Floating-Point Values] + +[/ + Copyright 2008 John Maddock and Paul A. Bristow. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + diff --git a/boost/libs/math/doc/fp_utilities/fp_facets.qbk b/boost/libs/math/doc/fp_utilities/fp_facets.qbk new file mode 100644 index 00000000..33e9c807 --- /dev/null +++ b/boost/libs/math/doc/fp_utilities/fp_facets.qbk @@ -0,0 +1,568 @@ +[section:fp_facets Facets for Floating-Point Infinities and NaNs] + +[import ../../example/nonfinite_facet_sstream.cpp] + +[h4 Synopsis] + + namespace boost{ namespace math + { + // Values for flags. + const int legacy; + const int signed_zero; + const int trap_infinity; + const int trap_nan; + + template< + class CharType, + class OutputIterator = std::ostreambuf_iterator<CharType> + > + class nonfinite_num_put : public std::num_put<CharType, OutputIterator> + { + public: + explicit nonfinite_num_put(int flags = 0); + }; + + template< + class CharType, + class InputIterator = std::istreambuf_iterator<CharType> + > + class nonfinite_num_get : public std::num_get<CharType, InputIterator> + { + public: + explicit nonfinite_num_get(int flags = 0); // legacy, sign_zero ... + }; + }} // namespace boost namespace math + +To use these facets + + #include <boost\math\special_functions\nonfinite_num_facets.hpp> + + +[section:facets_intro Introduction] + +[h5 The Problem] + +The C++98 standard does not specify how ['infinity] and ['NaN] are represented in text streams. +As a result, different platforms use different string representations. +This can cause undefined behavior when text files are moved between different platforms. +Some platforms cannot even input parse their own output! +So 'route-tripping' or loopback of output to input is not possible. +For instance, the following test fails with MSVC: + + stringstream ss; + double inf = numeric_limits<double>::infinity(); + double r; + ss << inf; // Write out. + ss >> r; // Read back in. + + cout << "infinity output was " << inf << endl; // 1.#INF + cout << "infinity input was " << r << endl; // 1 + + assert(inf == y); // Fails! + +[h5 The Solution] + +The facets `nonfinite_num_put` and `nonfinite_num_get` +format and parse all floating-point numbers, +including `infinity` and `NaN`, in a consistent and portable manner. + +The following test succeeds with MSVC. + +[nonfinite_facets_sstream_1] + +[tip To add two facets, `nonfinite_num_put` and `nonfinite_num_get`, +you may have to add one at a time, using a temporary locale. + +Or you can create a new locale in one step + +`std::locale new_locale(std::locale(std::locale(std::locale(), new boost::math::nonfinite_num_put<char>), new boost::math::nonfinite_num_get<char>));` + +and, for example, use it to imbue an input and output stringstream. +] + +[tip To just change an input or output stream, you can concisely write +`cout.imbue (std::locale(std::locale(), new boost::math::nonfinite_num_put<char>));` +or +`cin.imbue (std::locale(std::locale(), new boost::math::nonfinite_num_get<char>));` +] + +[nonfinite_facets_sstream_2] + +[h4 C++0X standard for output of infinity and NaN] + +[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf C++0X (final) draft standard] +does not explicitly specify the representation (and input) of nonfinite values, +leaving it implementation-defined. +So without some specific action, input and output of nonfinite values is not portable. + +[h4 C99 standard for output of infinity and NaN] + +The [@http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1256.pdf C99 standard] +[*does] specify how infinity and NaN +are formatted by printf and similar output functions, +and parsed by scanf and similar input functions. + +The following string representations are used: + +[table C99 Representation of Infinity and NaN +[[number] [string]] +[[Positive infinity]["inf" or "infinity"]] +[[Positive NaN]["nan" or "nan(...)"]] +[[Negative infinity]["-inf" or "-infinity"]] +[[Negative NaN]["-nan" or "-nan(...)"]] +] + +So following C99 provides a sensible 'standard' way +of handling input and output of nonfinites in C++, +and this implementation follows most of these formats. + +[h5 Signaling NaNs] +A particular type of NaN is the signaling NaN. +The usual mechanism of signaling is by raising a floating-point exception. +Signaling NaNs are defined by +[@http://en.wikipedia.org/wiki/IEEE_floating-point_standard IEEE 754-2008]. + +Floating-point values with layout ['s]111 1111 1['a]xx xxxx xxxx xxxx xxxx xxxx +where ['s] is the sign, ['x] is the payload, and bit ['a] determines the type of NaN. + +If bit ['a] = 1, it is a quiet NaN. + +If bit ['a] is zero and the payload ['x] is nonzero, then it is a signaling NaN. + +Although there has been theoretical interest in the ability of a signaling NaN +to raise an exception, for example to prevent use of an uninitialised variable, +in practice there appears to be no useful application of signaling NaNs for +most current processors. +[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf C++0X 18.3.2.2] +still specifies a (implementation-defined) representation for signaling NaN, +and `static constexpr bool has_signaling_NaN` +a method of checking if a floating-point type has a representation for signaling NaN. + +But in practice, most platforms treat signaling NaNs in the same as quiet NaNs. +So, for example, they are represented by "nan" on output in +[@http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1256.pdf C99] format, +and output as `1.#QNAN` by Microsoft compilers. + +[note The C99 standard does not distinguish +between the quiet NaN and signaling NaN values. +A quiet NaN propagates through almost every arithmetic operation +without raising a floating-point exception; +a signaling NaN generally raises a floating-point exception +when occurring as an arithmetic operand. + +C99 specification does not define the behavior of signaling NaNs. +NaNs created by IEC 60559 operations are always quiet. +Therefore this implementation follows C99, and treats the signaling NaN bit +as just a part of the NaN payload field. +So this implementation does not distinguish between the two classes of NaN.] + +[note An implementation may give zero and non-numeric values (such as infinities and NaNs) +a sign or may leave them unsigned. Wherever such values are unsigned, +any requirement in the C99 Standard to retrieve the sign shall produce an unspecified sign, +and any requirement to set the sign shall be ignored. + +This might apply to user-defined types, but in practice built-in floating-point +types `float`, `double` and `long double` have well-behaved signs.] + +The numbers can be of type `float`, `double` and `long double`. +An optional + sign can be used with positive numbers (controlled by ios manipulator `showpos`). +The function `printf` and similar C++ functions use standard formatting flags +to put all lower or all upper case +(controlled by `std::ios` manipulator `uppercase` and `lowercase`). + +The function `scanf` and similar input functions are case-insensitive. + +The dots in `nan(...)` stand for an arbitrary string. +The meaning of that string is implementation dependent. +It can be used to convey extra information about the NaN, from the 'payload'. +A particular value of the payload might be used to indicate a ['missing value], for example. + +This library uses the string representations specified by the C99 standard. + +An example of an implementation that optionally includes the NaN payload information is at +[@http://publib.boulder.ibm.com/infocenter/zos/v1r10/index.jsp?topic=/com.ibm.zos.r10.bpxbd00/fprints.htm AIX NaN fprintf]. +That implementation specifies for Binary Floating Point NANs: + +* A NaN ordinal sequence is a left-parenthesis character '(', +followed by a digit sequence representing +an integer n, where 1 <= n <= INT_MAX-1, +followed by a right-parenthesis character ')'. + +* The integer value, n, is determined by the fraction bits of the NaN argument value as follows: + +* For a signalling NaN value, NaN fraction bits are reversed (left to right) +to produce bits (right to left) of an even integer value, 2*n. +Then formatted output functions produce a (signalling) NaN ordinal sequence +corresponding to the integer value n. + +* For a quiet NaN value, NaN fraction bits are reversed (left to right) +to produce bits (right to left) of an odd integer value, 2*n-1. +Then formatted output functions produce a (quiet) NaN ordinal sequence +corresponding to the integer value n. + +[warning This implementation does not (yet) provide output of, or access to, the NaN payload.] + +[endsect] [/section:intro Introduction] + +[section:reference Reference] + +[h5 The Facet `nonfinite_num_put`] + + template< + class CharType, class OutputIterator = std::ostreambuf_iterator<CharType> + > + class nonfinite_num_put; + +The `class nonfinite_num_put<CharType, OutputIterator>` +is derived from `std::num_put<CharType, OutputIterator>`. +Thus it is a facet that formats numbers. +The first template argument is the character type of the formatted strings, +usually `char` or `wchar_t`. +The second template argument is the type of iterator used to write the strings. +It is required to be an output iterator. +Usually the default `std::ostreambuf_iterator` is used. +The public interface of the class consists of a single constructor only: + + nonfinite_num_put(int flags = 0); + +The flags argument (effectively optional because a default of ` no_flags` is provided) +is discussed below. +The class template `nonfinite_num_put` is defined in the +header `boost/math/nonfinite_num_facets.hpp` +and lives in the namespace `boost::math`. + +Unlike the C++ Standard facet `std::num_put`, the facet `nonfinite_num_put` +formats `infinity` and `NaN` in a consistent and portable manner. +It uses the following string representations: + +[table +[[Number][String]] +[[Positive infinity][inf]] +[[Positive NaN][nan]] +[[Negative infinity][-inf]] +[[Negative NaN][-nan]] +] + +The numbers can be of type `float`, `double` and `long double`. +The strings can be in all lower case or all upper case. +An optional + sign can be used with positive numbers. +This can be controlled with the `uppercase`, `lowercase`, `showpos` and `noshowpos` manipulators. +Formatting of integers, boolean values and finite floating-point numbers is simply delegated to the normal `std::num_put`. + + +[h5 Facet `nonfinite_num_get`] + + template<class CharType, class InputIterator = std::istreambuf_iterator<CharType> > class nonfinite_num_get; + +The class `nonfinite_num_get<CharType, InputIterator>` is derived from `std::num_get<CharType, IntputIterator>`. +Thus it is a facet that parses strings that represent numbers. +The first template argument is the character type of the strings, +usually `char` or `wchar_t`. +The second template argument is the type of iterator used to read the strings. +It is required to be an input iterator. Usually the default is used. +The public interface of the class consists of a single constructor only: + + nonfinite_num_get(int flags = 0); + +The flags argument is discussed below. +The `class template nonfinite_num_get` is defined +in the header `boost/math/nonfinite_num_facets.hpp` +and lives in the `namespace boost::math`. + +Unlike the facet `std::num_get`, the facet `nonfinite_num_get` parses strings +that represent `infinity` and `NaN` in a consistent and portable manner. +It recognizes precisely the string representations specified by the C99 standard: + +[table +[[Number][String]] +[[Positive infinity][inf, infinity]] +[[Positive NaN][nan, nan(...)]] +[[Negative infinity][-inf, -infinity]] +[[Negative NaN][-nan, -nan(...)]] +] + +The numbers can be of type `float`, `double` and `long double`. +The facet is case-insensitive. An optional + sign can be used with positive numbers. +The dots in nan(...) stand for an arbitrary string usually containing the ['NaN payload]. +Parsing of strings that represent integers, boolean values +and finite floating-point numbers is delegated to `std::num_get`. + +When the facet parses a string that represents `infinity` on a platform that lacks infinity, +then the fail bit of the stream is set. + +When the facet parses a string that represents `NaN` on a platform that lacks NaN, +then the fail bit of the stream is set. + +[h4 Flags] + +The constructors for `nonfinite_num_put` and `nonfinite_num_get` +take an optional bit flags argument. +There are four different bit flags: + +* legacy +* signed_zero +* trap_infinity +* trap_nan + +The flags can be combined with the OR `operator|`. + +The flags are defined in the header `boost/math/nonfinite_num_facets.hpp` +and live in the `namespace boost::math`. + +[h5 legacy] + +The legacy flag has no effect with the output facet `nonfinite_num_put`. + +If the legacy flag is used with the `nonfinite_num_get` input facet, +then the facet will recognize all the following string representations of `infinity` and `NaN`: + +[table +[[Number][String]] +[[Positive infinity][inf, infinity, one#inf]] +[[Positive NaN][nan, nan(...), nanq, nans, qnan, snan, one#ind, one#qnan, one#snan]] +[[Negative infinity][-inf, -infinity, -one#inf]] +[[Negative NaN][-nan, -nan(...), -nanq, -nans, -qnan, -snan, -one#ind, - one#qnan, -one#snan]] +] + +* The numbers can be of type `float`, `double` and `long double`. +* The facet is case-insensitive. +* An optional `+` sign can be used with the positive values. +* The dots in `nan(...)` stand for an arbitrary string. +* `one` stands for any string that `std::num_get` parses as the number `1`, +typically "1.#INF", "1.QNAN" but also "000001.#INF"... + +The list includes a number of non-standard string representations of infinity and NaN +that are used by various existing implementations of the C++ standard library, +and also string representations used by other programming languages. + +[h5 signed_zero] + +If the `signed_zero` flag is used with `nonfinite_num_put`, +then the facet will always distinguish between positive and negative zero. +It will format positive zero as "0" or "+0" and negative zero as "-0". +The string representation of positive zero can be controlled +with the `showpos` and `noshowpos` manipulators. + +The `signed_zero flag` has no effect with the input facet `nonfinite_num_get`. +The input facet `nonfinite_num_get` always parses "0" and "+0" +as positive zero and "-0" as negative zero, +as do most implementations of `std::num_get`. + +[note If the `signed_zero` flag is not set (the default), then a negative zero value +will be displayed on output in whatever way the platform normally handles it. +For most platforms, this it will format positive zero as "0" or "+0" and negative zero as "-0". +But setting the `signed_zero` flag may be more portable.] + +[tip A negative zero value can be portably produced using the changesign function +`(changesign)(static_cast<ValType>(0))` where `ValType` is `float`, `double` or `long double`, + or a User-Defined floating-point type (UDT) provided that this UDT has a sign +and that the changesign function is implemented.] + +[h5 trap_infinity] + +If the `trap_infinity` flag is used with `nonfinite_num_put`, +then the facet will throw an exception of type `std::ios_base::failure` +when an attempt is made to format positive or negative infinity. +If the facet is called from a stream insertion operator, +then the stream will catch that exception and set either its `fail bit` or its `bad bit`. +Which bit is set is platform dependent. + +If the `trap_infinity` flag is used with `nonfinite_num_get`, +then the facet will set the `fail bit` of the stream when an attempt is made +to parse a string that represents positive or negative infinity. + + +(See Design Rationale below for a discussion of this inconsistency.) + +[h5 trap_nan] + +Same as `trap_infinity`, but positive and negative NaN are trapped instead. + +[endsect] [/section:reference Reference] + + +[section:examples Examples] + +[h5 Simple example with std::stringstreams] + +[nonfinite_facets_sstream_1] +[nonfinite_facets_sstream_2] + +[h5 Use with lexical_cast] + +[note From Boost 1.48, lexical_cast no longer uses stringstreams internally, +and is now able to handle infinities and NaNs natively on most platforms.] + +Without using a new locale that contains the nonfinite facets, +previous versions of `lexical_cast` using stringstream were not portable +(and often failed) if nonfinite values are found. + +[nonfinite_facets_sstream_1] + +Although other examples imbue individual streams with the new locale, +for the streams constructed inside lexical_cast, +it was necesary to assign to a global locale. + + locale::global(new_locale); + +`lexical_cast` then works as expected, even with infinity and NaNs. + + double x = boost::lexical_cast<double>("inf"); + assert(x == std::numeric:limits<double>::infinity()); + + string s = boost::lexical_cast<string>(numeric_limits<double>::infinity()); + assert(s == "inf"); + +[warning If you use stringstream inside your functions, +you may still need to use a global locale to handle nonfinites correctly. +Or you need to imbue your stringstream with suitable get and put facets.] + +[warning You should be aware that the C++ specification does not explicitly require +that input from decimal digits strings converts with rounding to the +nearest representable floating-point binary value. +(In contrast, decimal digits read by the compiler, +for example by an assignment like `double d = 1.234567890123456789`, +are guaranteed to assign the nearest representable value to double d). +This implies that, no matter how many decimal digits you provide, +there is a potential uncertainty of 1 least significant bit in the resulting binary value.] + +See [@http://en.wikipedia.org/wiki/Floating_point#Representable_numbers.2C_conversion_and_rounding conversion and rounding] +for more information on ['nearest representable] and ['rounding] and +[@http://www.exploringbinary.com/ Exploring Binary] for much detail on input and round-tripping difficulties. + +Most iostream libraries do in fact achieve the desirable +['nearest representable floating-point binary value] for all values of input. +However one popular STL library does not quite achieve this for 64-bit doubles. See +[@http://connect.microsoft.com/VisualStudio/feedback/details/98770/decimal-digit-string-input-to-double-may-be-1-bit-wrong +Decimal digit string input to double may be 1 bit wrong] for the bizarre full details. + +If you are expecting to 'round-trip' `lexical_cast` or `serialization`, +for example archiving and loading, +and want to be [*absolutely certain that you will +always get an exactly identical double value binary pattern], +you should use the suggested 'workaround' below that is believed to work on all platforms. + +You should output using all potentially significant decimal digits, +by setting stream precision to `std::numeric_limits<double>::max_digits10`, +(or for the appropriate floating-point type, if not double) +and crucially, [*require `scientific` format], not `fixed` or automatic (default), for example: + + double output_value = any value; + std::stringstream s; + s << setprecison(std::numeric_limits<double>::max_digits10) << scientific << output_value; + s >> input_value; + + +[h4 Use with serialization archives] + +It is vital that the same locale is used +when an archive is saved and when it is loaded. +Otherwise, loading the archive may fail. +By default, archives are saved and loaded with a classic C locale +with a `boost::archive::codecvt_null` facet added. +Normally you do not have to worry about that. + +The constructors for the archive classes, as a side-effect, +imbue the stream with such a locale. +However, if you want to use the +facets `nonfinite_num_put` and `nonfinite_num_get` with archives, +then you have to manage the locale manually. +That is done by calling the archive constructor with the flag +`boost::archive::no_codecvt`, thereby ensuring that the archive constructor +will [*not imbue the stream with a new locale]. + +The following code shows how to use `nonfinite_num_put` with a `text_oarchive`. + + locale default_locale(locale::classic(), new boost::archive::codecvt_null<char>); + locale my_locale(default_locale, new nonfinite_num_put<char>); + + ofstream ofs("test.txt"); + ofs.imbue(my_locale); + + boost::archive::text_oarchive oa(ofs, no_codecvt); + + double x = numeric_limits<double>::infinity(); + oa & x; + +The same method works with `nonfinite_num_get` and `text_iarchive`. + +If you use the `nonfinite_num_put` with `trap_infinity` +and/or `trap_nan` flag with a serialization archive, +then you must set the exception mask of the stream. +Serialization archives do not check the stream state. + + +[h5 Other examples] + +[@../../example/nonfinite_facet_simple.cpp nonfinite_facet_simple.cpp] +give some more simple demonstrations of the difference between using classic C locale +and constructing a C99 infinty and NaN compliant locale for input and output. + +See [@../../example/nonfinite_facet_sstream.cpp nonfinite_facet_sstream.cpp] +for this example of use with `std::stringstream`s. + +For an example of how to enforce the MSVC 'legacy' +"1.#INF" and "1.#QNAN" representations of infinity and NaNs, +for input and output, +see [@../../example/nonfinite_legacy.cpp nonfinite_legacy.cpp]. + +Treatment of signaling NaN is demonstrated at +[@../../example/nonfinite_signaling_NaN.cpp] + +Example [@../../example/nonfinite_loopback_ok.cpp] shows loopback works OK. + +Example [@../../example/nonfinite_num_facet.cpp] shows output and re-input +of various finite and nonfinite values. + +A simple example of trapping nonfinite output is at +[@../../example/nonfinite_num_facet_trap.cpp nonfinite_num_facet_trap.cpp]. + +A very basic example of using Boost.Archive is at +[@../../example/nonfinite_serialization_archives.cpp]. + +A full demonstration of serialization by Francois Mauger is at +[@../../example/nonfinite_num_facet_serialization.cpp] + +[endsect] [/section:examples Examples] + +[section:portability Portability] + +This library uses the floating-point number classification and sign-bit from Boost.Math library, +and should work on all platforms where that library works. +See the portability information for that library. + +[endsect] [/section:portability Portability] + +[section:rationale Design Rationale] + +* The flags are implemented as a const data member of the facet. +Facets are reference counted, and locales can share facets. +Therefore changing the flags of a facet would have effects that are hard to predict. +An alternative design would be to implement the flags +using `std::ios_base::xalloc` and `std::ios_base::iword`. +Then one could safely modify the flags, and one could define manipulators that do so. +However, for that to work with dynamically linked libraries, +a `.cpp` file would have to be added to the library. +It was judged be more desirable to have a header-only library, +than to have mutable flags and manipulators. + +* The facet `nonfinite_num_put` throws an exception when +the `trap_infinity` or `trap_nan` flag is set +and an attempt is made to format infinity or NaN. +It would be better if the facet set the `fail bit` of the stream. +However, facets derived from `std::num_put` do not have access to the stream state. + +[endsect] [/section:rationale Design Rationale] + +[endsect] [/section:fp_facets Facets for Floating-Point Infinities and NaNs] + +[/ + Copyright Johan Rade and Paul A. Bristow 2011. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + + + + diff --git a/boost/libs/math/doc/fp_utilities/fpclassify.qbk b/boost/libs/math/doc/fp_utilities/fpclassify.qbk new file mode 100644 index 00000000..d140abdd --- /dev/null +++ b/boost/libs/math/doc/fp_utilities/fpclassify.qbk @@ -0,0 +1,124 @@ +[section:fpclass Floating-Point Classification: Infinities and NaNs] + +[h4 Synopsis] + + #define FP_ZERO /* implementation specific value */ + #define FP_NORMAL /* implementation specific value */ + #define FP_INFINITE /* implementation specific value */ + #define FP_NAN /* implementation specific value */ + #define FP_SUBNORMAL /* implementation specific value */ + + template <class T> + int fpclassify(T t); + + template <class T> + bool isfinite(T z); // Neither infinity nor NaN. + + template <class T> + bool isinf(T t); // Infinity (+ or -). + + template <class T> + bool isnan(T t); // NaN. + + template <class T> + bool isnormal(T t); // isfinite and not denormalised. + + #include <boost\math\special_functions\fpclassify.hpp> + +to use these functions. + +[h4 Description] + +These functions provide the same functionality as the macros with the same +name in C99, indeed if the C99 macros are available, then these functions +are implemented in terms of them, otherwise they rely on `std::numeric_limits<>` +to function. + +Note that the definition of these functions +['does not suppress the definition of these names as macros by math.h] +on those platforms that already provide +these as macros. That mean that the following have differing meanings: + + using namespace boost::math; + + // This might call a global macro if defined, + // but might not work if the type of z is unsupported + // by the std lib macro: + isnan(z); + // + // This calls the Boost version + // (found via the "using namespace boost::math" declaration) + // it works for any type that has numeric_limits support for type z: + (isnan)(z); + // + // As above but with explicit namespace qualification. + (boost::math::isnan)(z); + // + // This will cause a compiler error if isnan is a native macro: + boost::math::isnan(z); + // So always use instead: + (boost::math::isnan)(z); + // + // You can also add a using statement, + // globally to a .cpp file, or to a local function in a .hpp file. + using boost::math::isnan; + // so you can write the shorter and less cluttered + (isnan)(z) + // But, as above, if isnan is a native macro, this causes a compiler error, + // because the macro always 'gets' the name first, unless enclosed in () brackets. + +Detailed descriptions for each of these functions follows: + + template <class T> + int fpclassify(T t); + +Returns an integer value that classifies the value /t/: + +[table +[[fpclassify value] [class of t.]] +[[FP_ZERO] [If /t/ is zero.]] +[[FP_NORMAL] [If /t/ is a non-zero, non-denormalised finite value.]] +[[FP_INFINITE] [If /t/ is plus or minus infinity.]] +[[FP_NAN] [If /t/ is a NaN.]] +[[FP_SUBNORMAL] [If /t/ is a denormalised number.]] +] + + template <class T> + bool isfinite(T z); + +Returns true only if /z/ is not an infinity or a NaN. + + template <class T> + bool isinf(T t); + +Returns true only if /z/ is plus or minus infinity. + + template <class T> + bool isnan(T t); + +Returns true only if /z/ is a [@http://en.wikipedia.org/wiki/NaN NaN]. + + template <class T> + bool isnormal(T t); + +Returns true only if /z/ is a normal number (not zero, infinite, NaN, or denormalised). + +[h5 Floating-point format] + +If you wish to find details of the floating-point format for any particular processor, +there is a program + +[@../../example/inspect_fp.cpp inspect_fp.cpp] + +by Johan Rade which can be used to print out the processor type, +endianness, and detailed bit layout of a selection of floating-point values, +including infinity and NaNs. + +[endsect] [/section:fpclass Floating Point Classification: Infinities and NaNs] + +[/ + Copyright 2006, 2008, 2011 John Maddock, Johan Rade and Paul A. Bristow. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] diff --git a/boost/libs/math/doc/fp_utilities/rounding_func.qbk b/boost/libs/math/doc/fp_utilities/rounding_func.qbk new file mode 100644 index 00000000..eed32054 --- /dev/null +++ b/boost/libs/math/doc/fp_utilities/rounding_func.qbk @@ -0,0 +1,129 @@ + +[section:rounding Rounding Truncation and Integer Conversion] + +[section:round Rounding Functions] + +``#include <boost/math/special_functions/round.hpp>`` + + template <class T> + T round(const T& v); + + template <class T, class Policy> + T round(const T& v, const Policy&); + + template <class T> + int iround(const T& v); + + template <class T, class Policy> + int iround(const T& v, const Policy&); + + template <class T> + long lround(const T& v); + + template <class T, class Policy> + long lround(const T& v, const Policy&); + + template <class T> + long long llround(const T& v); + + template <class T, class Policy> + long long llround(const T& v, const Policy&); + +These functions return the closest integer to the argument /v/. + +Halfway cases are rounded away from zero, regardless of the current rounding +direction. + +If the argument /v/ is either non-finite or else outside the range +of the result type, then returns the result of __rounding_error: by +default this throws an instance of `boost::math::rounding_error`. + +[endsect] + +[section:trunc Truncation Functions] + +``#include <boost/math/special_functions/trunc.hpp>`` + + template <class T> + T trunc(const T& v); + + template <class T, class Policy> + T trunc(const T& v, const Policy&); + + template <class T> + int itrunc(const T& v); + + template <class T, class Policy> + int itrunc(const T& v, const Policy&); + + template <class T> + long ltrunc(const T& v); + + template <class T, class Policy> + long ltrunc(const T& v, const Policy&); + + template <class T> + long long lltrunc(const T& v); + + template <class T, class Policy> + long long lltrunc(const T& v, const Policy&); + +The trunc functions round their argument to the integer value, +nearest to but no larger in magnitude than the argument. + +For example `itrunc(3.7)` would return `3` and `ltrunc(-4.6)` +would return `-4`. + +If the argument /v/ is either non-finite or else outside the range +of the result type, then returns the result of __rounding_error: by +default this throws an instance of `boost::math::rounding_error`. + +[endsect] + +[section:modf Integer and Fractional Part Splitting (modf)] + +``#include <boost/math/special_functions/modf.hpp>`` + + template <class T> + T modf(const T& v, T* ipart); + + template <class T, class Policy> + T modf(const T& v, T* ipart, const Policy&); + + template <class T> + T modf(const T& v, int* ipart); + + template <class T, class Policy> + T modf(const T& v, int* ipart, const Policy&); + + template <class T> + T modf(const T& v, long* ipart); + + template <class T, class Policy> + T modf(const T& v, long* ipart, const Policy&); + + template <class T> + T modf(const T& v, long long* ipart); + + template <class T, class Policy> + T modf(const T& v, long long* ipart, const Policy&); + +The `modf` functions store the integer part of /v/ in `*ipart` +and return the fractional part of /v/. The sign of the integer +and fractional parts are the same as the sign of /v/. + +If the argument /v/ is either non-finite or else outside the range +of the result type, then returns the result of __rounding_error: by +default this throws an instance of `boost::math::rounding_error`. + +[endsect] + + +[endsect] [/section:rounding Rounding Truncation and Integer Conversion] + +[/ + Copyright 2006 John Maddock and Paul A. Bristow. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] diff --git a/boost/libs/math/doc/fp_utilities/sign.qbk b/boost/libs/math/doc/fp_utilities/sign.qbk new file mode 100644 index 00000000..372b30c1 --- /dev/null +++ b/boost/libs/math/doc/fp_utilities/sign.qbk @@ -0,0 +1,137 @@ +[section:sign_functions Sign Manipulation Functions] + +[h4 Synopsis] + +`` +#include <boost/math/special_functions/sign.hpp> +`` + + namespace boost{ namespace math{ + + template<class T> + int signbit(T x); + + template <class T> + int sign (const T& z); + + template <class T, class U> + T copysign (const T& x, const U& y); + + template <class T> + ``__sf_result`` changesign (const T& z); + + }} // namespaces + +[h4 Description] + + template<class T> + int signbit(T x); + +Returns a non-zero value if the sign bit is set in variable /x/, otherwise `0`. + +[important The return value from this function is zero or /not-zero/ and [*not] zero or one.] + + template <class T> + int sign (const T& z); + +Returns `1` if /x/ `> 0`, `-1` if /x/ `< 0`, and `0` if /x/ is zero. + + template <class T, class U> + ``__sf_result`` copysign (const T& x, const U& y); + +Sets the sign of /x/ to be the same as the sign of /y/. + +See [@http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1256.pdf C99 7.12.11.1 The copysign functions] +for more detail. + + template <class T> + T changesign (const T& z); + +Returns a floating-point number with a binary representation +where the signbit is the opposite of the sign bit in /x/, +and where the other bits are the same as in /x/. + +This function is widely available, but not specified in any standards. + +Rationale: Not specified by TR1, but `changesign(x)` +is both easier to read and more efficient than + + copysign(x, signbit(x) ? 1.0 : -1.0); + +For finite values, this function has the same effect as simple negation, +the assignment z = -z, but for nonfinite values, +[@http://en.wikipedia.org/wiki/Infinity#Computing infinities] +and [@http://en.wikipedia.org/wiki/NaN NaNs], +the `changesign(x)` function may be the only portable way +to ensure that the sign bit is changed. + +[h5 Sign bits] +One of the bits in the binary representation of a floating-point number gives the sign, +and the remaining bits give the absolute value. +That bit is known as the sign bit. +The sign bit is set = 1 for negative numbers, and is not set = 0 for positive numbers. +(This is true for all binary representations of floating-point numbers +that are used by modern microprocessors.) + +[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf C++ TR1] +specifies `copysign` functions and function templates for accessing the sign bit. + +For user-defined types (UDT), the sign may be stored in some other way. +They may also not provide infinity or NaNs. +To use these functions with a UDT, +it may be necessary to explicitly specialize them for UDT type T. + +[h5 Examples] + + signbit(3.5) is zero (or false) + signbit(-7.1) is 1 (or true) + copysign(4.2, 7.9) is 4.2 + copysign(3.5 -1.4) is -3.5 + copysign(-4.2, 1.0) is 4.2 + copysign(-8.6, -3.3) is -8.6 + changesign(6.9) is -6.9 + changesign(-1.8) is 1.8 + +[h5 Portability] + +The library supports the following binary floating-point formats: + +* IEEE 754 single precision +* IEEE 754 double precision +* IEEE 754 extended double precision with 15 exponent bits +* Intel extended double precision +* PowerPC extended double precision +* Motorola 68K extended double precision + +The library does not support the VAX floating-point formats. +(These are available on VMS, but the default on VMS is the IEEE 754 floating-point format.) + +The main portability issues are: + +* Unsupported floating-point formats. +* The library depends on the header `boost/detail/endian.hpp` to detemine endianness. +* Code such as `#if defined(__ia64) || defined(__ia64__) || defined(_M_IA64)` +is used to determine the processor type. + +The library has passed all tests on the following platforms: + +* Win32 / MSVC 7.1 / 10.0 / x86 32 and 64-bit, and later Win32 +* Win32 / Intel C++ 7.1, 8.1, 9.1 / x86 +* Mac OS X / GCC 3.3, 4.0 / ppc +* Linux / Intel C++ 9.1 / x86, ia64 +* Linux / GCC 3.3 / x86, x64, ia64, ppc, hppa, mips, m68k +* Linux / GCC 3.4 / x64 +* HP-UX / aCC, GCC 4.1 / ia64 +* HP-UX / aCC / hppa +* Tru64 / Compaq C++ 7.1 / alpha +* VMS / HP C++ 7.1 / alpha (in IEEE floating-point mode) +* VMS / HP C++ 7.2 / ia64 (in IEEE floating-point mode) + +[endsect] [/section:sign_functions Sign Manipulation Functions] +[/ + Copyright 2006 John Maddock and Paul A. Bristow 2011. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +] + |
