From d07b79d37764c81a9370d0a0b2d0eb1d9250d989 Mon Sep 17 00:00:00 2001 From: ckormanyos Date: Fri, 11 Apr 2025 12:49:36 +0200 Subject: [PATCH] Handle issue 1255 and update docs --- README.md | 28 +++++++++-------- .../special_functions/detail/bessel_yn.hpp | 2 +- test/Jamfile.v2 | 1 + test/git_issue_1255.cpp | 30 +++++++++++++++++++ 4 files changed, 48 insertions(+), 13 deletions(-) create mode 100644 test/git_issue_1255.cpp diff --git a/README.md b/README.md index a20120e8a..39b0bddd6 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,12 @@ Boost Math Library >ANNOUNCEMENT: This library requires a compliant C++14 compiler. + | | Master | Develop | |------------------|----------|-------------| -| Drone | [![Build Status](https://drone.cpp.al/api/badges/boostorg/math/status.svg?ref=refs/heads/master)](https://drone.cpp.al/boostorg/math) | [![Build Status](https://drone.cpp.al/api/badges/boostorg/math/status.svg)](https://drone.cpp.al/boostorg/math) | -| Github Actions | [![Build Status](https://github.com/boostorg/math/workflows/CI/badge.svg?branch=master)](https://github.com/boostorg/math/actions) | [![Build Status](https://github.com/boostorg/math/workflows/CI/badge.svg?branch=develop)](https://github.com/boostorg/math/actions) | -| Codecov | [![codecov](https://codecov.io/gh/boostorg/math/branch/master/graph/badge.svg)](https://codecov.io/gh/boostorg/math/branch/master) | [![codecov](https://codecov.io/gh/boostorg/math/branch/develop/graph/badge.svg)](https://codecov.io/gh/boostorg/math/branch/develop) | +| Drone | [![Build Status](https://drone.cpp.al/api/badges/boostorg/math/status.svg?ref=refs/heads/master)](https://drone.cpp.al/boostorg/math) | [![Build Status](https://drone.cpp.al/api/badges/boostorg/math/status.svg)](https://drone.cpp.al/boostorg/math) | +| Github Actions | [![Build Status](https://github.com/boostorg/math/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/boostorg/math/actions?query=branch%3Amaster) | [![Build Status](https://github.com/boostorg/math/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/boostorg/math/actions?query=branch%3Adevelop) | +| Codecov | [![codecov](https://codecov.io/gh/boostorg/math/branch/master/graph/badge.svg)](https://codecov.io/gh/boostorg/math/branch/master) | [![codecov](https://codecov.io/gh/boostorg/math/branch/develop/graph/badge.svg)](https://codecov.io/gh/boostorg/math/branch/develop) | The Math library provides numerous advanced mathematical functions @@ -26,11 +27,11 @@ Utility functions for dealing with floating point arithmetic, includes functions ### Specific Width Floating Point Types -A set of typedefs similar to those provided by `` but for floating point types. +A set of `typedef`s similar to those provided by C++20's `` but in `namespace boost`. ### Mathematical Constants -A wide range of constants ranging from various multiples of π, fractions, Euler's constant, etc. +A wide range of constants ranging from fractions to various multiples of $\pi$, Euler's constant, etc. These are of course usable from template code, or as non-templates with a simplified interface if that is more appropriate. @@ -100,12 +101,12 @@ The full documentation is available on [boost.org](http://www.boost.org/doc/libs ### Standalone Mode -Defining BOOST_MATH_STANDALONE allows Boost.Math to be used without any Boost dependencies. +Defining `BOOST_MATH_STANDALONE` allows Boost.Math to be used without any Boost dependencies. Some functionality is reduced in this mode. A static_assert message will alert you if a particular feature has been disabled by standalone mode. Standalone mode is not designed to be used with the rest of boost, and may result in compiler errors. -## Supported Compilers ## +## Supported Compilers The following compilers are tested with the CI system, and are known to work. Currently a compiler that is fully compliant with C++14 is required to use Boost.Math. @@ -114,7 +115,7 @@ Currently a compiler that is fully compliant with C++14 is required to use Boost * clang++ 5 or later * Visual Studio 2015 (14.0) or later -## Support, bugs and feature requests ## +## Support, bugs and feature requests Bugs and feature requests can be reported through the [GitHub issue tracker](https://github.com/boostorg/math/issues) (see [open issues](https://github.com/boostorg/math/issues) and @@ -125,7 +126,7 @@ You can submit your changes through a [pull request](https://github.com/boostorg There is no mailing-list specific to Boost Math, although you can use the general-purpose Boost [mailing-list](http://lists.boost.org/mailman/listinfo.cgi/boost-users) using the tag [math]. -## Development ## +## Development Clone the whole boost project, which includes the individual Boost projects as submodules ([see boost+git doc](https://github.com/boostorg/boost/wiki/Getting-Started)): @@ -135,7 +136,8 @@ Clone the whole boost project, which includes the individual Boost projects as s The Boost Math Library is located in `libs/math/`. -### Running tests ### +### Running tests + First, make sure you are in `libs/math/test`. You can either run all the tests listed in `Jamfile.v2` or run a single test: @@ -144,7 +146,8 @@ You can either run all the tests listed in `Jamfile.v2` or run a single test: test$ # A more advanced syntax, demoing various options for building the tests: test$ ../../../b2 -a -j2 -q --reconfigure toolset=clang cxxflags="--std=c++14 -fsanitize=address -fsanitize=undefined" linkflags="-fsanitize=undefined -fsanitize=address" -### Continuous Integration ### +### Continuous Integration + The default action for a PR or commit to a PR is for CI to run the full complement of tests. The following can be appended to the end of a commit message to modify behavior: * [ci skip] to skip all tests @@ -153,7 +156,8 @@ The default action for a PR or commit to a PR is for CI to run the full compleme * [windows] to test MSVC-14.0, MSVC-14.2, MSVC-14.3, CYGWIN, and mingw on the latest version of Windows. * [standalone] to run standalone mode compile tests -### Building documentation ### + +### Building documentation Full instructions can be found [here](https://svn.boost.org/trac10/wiki/BoostDocs/GettingStarted), but to reiterate slightly: diff --git a/include/boost/math/special_functions/detail/bessel_yn.hpp b/include/boost/math/special_functions/detail/bessel_yn.hpp index a45d1761c..f95167a73 100644 --- a/include/boost/math/special_functions/detail/bessel_yn.hpp +++ b/include/boost/math/special_functions/detail/bessel_yn.hpp @@ -59,7 +59,7 @@ BOOST_MATH_GPU_ENABLED T bessel_yn(int n, T x, const Policy& pol) value = bessel_yn_small_z(n, x, &scale, pol); if (tools::max_value() * fabs(scale) < fabs(value)) return boost::math::sign(scale) * boost::math::sign(value) * policies::raise_overflow_error(function, nullptr, pol); - value /= scale; + value = (factor * value) / scale; } else if(asymptotic_bessel_large_x_limit(n, x)) { diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 4adb29d16..92e56e736 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -194,6 +194,7 @@ test-suite special_fun : [ run git_issue_1139.cpp ] [ run git_issue_1175.cpp ] [ run git_issue_1194.cpp ] + [ run git_issue_1255.cpp ] [ run special_functions_test.cpp /boost/test//boost_unit_test_framework ] [ run test_airy.cpp test_instances//test_instances pch_light /boost/test//boost_unit_test_framework ] [ run test_bessel_j.cpp test_instances//test_instances pch_light /boost/test//boost_unit_test_framework ] diff --git a/test/git_issue_1255.cpp b/test/git_issue_1255.cpp new file mode 100644 index 000000000..56d692331 --- /dev/null +++ b/test/git_issue_1255.cpp @@ -0,0 +1,30 @@ +// (C) Copyright Christopher Kormanyos 2025. +// Use, modification and distribution are subject to 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) + +#include +#include + +#include +#include + +auto main() -> int +{ + using float_type = float; + + const float_type x { 0x1.03ebbp-128F }; + + const float_type ctrl { 0x1.41085ep+127F }; + + const float_type result = ::boost::math::cyl_neumann(-1, x); + + const float_type tol = std::numeric_limits::epsilon() * 16; + + using std::fabs; + + BOOST_TEST(result > 0); + BOOST_TEST(fabs(1 - (result / ctrl)) < tol); + + return boost::report_errors(); +}