2
0
mirror of https://github.com/boostorg/math.git synced 2026-02-26 16:52:27 +00:00

Fix llround for non-representable numbers

This commit is contained in:
Matt Borland
2023-03-16 19:26:23 -07:00
parent 53766896dd
commit 73b8ffc13c
3 changed files with 59 additions and 3 deletions

View File

@@ -890,6 +890,7 @@ test-suite distribution_tests :
[ run complex_test.cpp ../../test/build//boost_unit_test_framework ]
[ compile test_dist_deduction_guides.cpp : [ requires cpp_deduction_guides cpp_variadic_templates ] ]
[ run git_issue_430.cpp ../../test/build//boost_unit_test_framework ]
[ run git_issue_800.cpp ../../test/build//boost_unit_test_framework ]
[ run git_issue_845.cpp ../../test/build//boost_unit_test_framework ]
[ run scipy_issue_14901.cpp ../../test/build//boost_unit_test_framework ]

17
test/git_issue_430.cpp Normal file
View File

@@ -0,0 +1,17 @@
// Copyright Matt Borland, 2023
// 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 <boost/math/special_functions/round.hpp>
#include <cstdint>
#include "math_unit_test.hpp"
double x = 9223372036854775807.0; // can't be represented as double, will have a different value at runtime.
int main()
{
int64_t result = boost::math::llround(x);
CHECK_EQUAL(result, INT64_C(9223372036854775807));
return boost::math::test::report_errors();
}