Переход на версию 0.3: изменение подхода к именованию сущностей, добавление, изменение и удаление ряда функций

This commit is contained in:
Andrey Pokidov 2026-01-30 19:37:49 +07:00
parent d33daf4e2d
commit f7e41645fe
87 changed files with 4580 additions and 4051 deletions

View file

@ -12,22 +12,22 @@ static const TestNumberPairFP32 _TEST_FP32_DATA_CLOSE[] = {
{1.0f, 1.0f},
{-1.0f, -1.0f},
{-0.4f * BGC_EPSYLON_FP32, 0.4f * BGC_EPSYLON_FP32},
{-0.4f * BGC_FP32_EPSYLON, 0.4f * BGC_FP32_EPSYLON},
{1.0f, 1.0f + 0.75f * BGC_EPSYLON_FP32},
{1.0f, 1.0f - 0.75f * BGC_EPSYLON_FP32},
{1.0f + 0.75f * BGC_EPSYLON_FP32, 1.0f},
{1.0f - 0.75f * BGC_EPSYLON_FP32, 1.0f},
{1.0f, 1.0f + 0.75f * BGC_FP32_EPSYLON},
{1.0f, 1.0f - 0.75f * BGC_FP32_EPSYLON},
{1.0f + 0.75f * BGC_FP32_EPSYLON, 1.0f},
{1.0f - 0.75f * BGC_FP32_EPSYLON, 1.0f},
{-1.0f, -1.0f + 0.75f * BGC_EPSYLON_FP32},
{-1.0f, -1.0f - 0.75f * BGC_EPSYLON_FP32},
{-1.0f + 0.75f * BGC_EPSYLON_FP32, -1.0f},
{-1.0f - 0.75f * BGC_EPSYLON_FP32, -1.0f},
{-1.0f, -1.0f + 0.75f * BGC_FP32_EPSYLON},
{-1.0f, -1.0f - 0.75f * BGC_FP32_EPSYLON},
{-1.0f + 0.75f * BGC_FP32_EPSYLON, -1.0f},
{-1.0f - 0.75f * BGC_FP32_EPSYLON, -1.0f},
{100.0f, 100.0f * (1.0f + 0.75f * BGC_EPSYLON_FP32)},
{100.0f, 100.0f * (1.0f - 0.75f * BGC_EPSYLON_FP32)},
{-100.0f, -100.0f * (1.0f + 0.75f * BGC_EPSYLON_FP32)},
{-100.0f, -100.0f * (1.0f - 0.75f * BGC_EPSYLON_FP32)}
{100.0f, 100.0f * (1.0f + 0.75f * BGC_FP32_EPSYLON)},
{100.0f, 100.0f * (1.0f - 0.75f * BGC_FP32_EPSYLON)},
{-100.0f, -100.0f * (1.0f + 0.75f * BGC_FP32_EPSYLON)},
{-100.0f, -100.0f * (1.0f - 0.75f * BGC_FP32_EPSYLON)}
};
static const TestNumberPairFP32 _TEST_FP32_DATA_DIFFERENT[] = {
@ -35,31 +35,31 @@ static const TestNumberPairFP32 _TEST_FP32_DATA_DIFFERENT[] = {
{1.0f, 0.999f},
{-1.0f, -0.999f},
{-0.6f * BGC_EPSYLON_FP32, 0.6f * BGC_EPSYLON_FP32},
{-0.6f * BGC_FP32_EPSYLON, 0.6f * BGC_FP32_EPSYLON},
{1.0f, 1.0f + 1.25f * BGC_EPSYLON_FP32},
{1.0f, 1.0f - 1.25f * BGC_EPSYLON_FP32},
{1.0f + 1.25f * BGC_EPSYLON_FP32, 1.0f},
{1.0f - 1.25f * BGC_EPSYLON_FP32, 1.0f},
{1.0f, 1.0f + 1.25f * BGC_FP32_EPSYLON},
{1.0f, 1.0f - 1.25f * BGC_FP32_EPSYLON},
{1.0f + 1.25f * BGC_FP32_EPSYLON, 1.0f},
{1.0f - 1.25f * BGC_FP32_EPSYLON, 1.0f},
{-1.0f, -1.0f + 1.25f * BGC_EPSYLON_FP32},
{-1.0f, -1.0f - 1.25f * BGC_EPSYLON_FP32},
{-1.0f + 1.25f * BGC_EPSYLON_FP32, -1.0f},
{-1.0f - 1.25f * BGC_EPSYLON_FP32, -1.0f},
{-1.0f, -1.0f + 1.25f * BGC_FP32_EPSYLON},
{-1.0f, -1.0f - 1.25f * BGC_FP32_EPSYLON},
{-1.0f + 1.25f * BGC_FP32_EPSYLON, -1.0f},
{-1.0f - 1.25f * BGC_FP32_EPSYLON, -1.0f},
{100.0f, 100.0f * (1.0f + 1.25f * BGC_EPSYLON_FP32)},
{100.0f, 100.0f * (1.0f - 1.25f * BGC_EPSYLON_FP32)},
{-100.0f, -100.0f * (1.0f + 1.25f * BGC_EPSYLON_FP32)},
{-100.0f, -100.0f * (1.0f - 1.25f * BGC_EPSYLON_FP32)}
{100.0f, 100.0f * (1.0f + 1.25f * BGC_FP32_EPSYLON)},
{100.0f, 100.0f * (1.0f - 1.25f * BGC_FP32_EPSYLON)},
{-100.0f, -100.0f * (1.0f + 1.25f * BGC_FP32_EPSYLON)},
{-100.0f, -100.0f * (1.0f - 1.25f * BGC_FP32_EPSYLON)}
};
void test_are_close_fp32()
{
print_testing_name("bgc_are_close_fp32");
print_testing_name("bgc_fp32_are_close");
// Testing close pairs of values:
for (int i = 0; i < _TEST_FP32_CLOSE_NUMBERS_AMOUNT; i++) {
if (!bgc_are_close_fp32(_TEST_FP32_DATA_CLOSE[i].number1, _TEST_FP32_DATA_CLOSE[i].number2)) {
if (!bgc_fp32_are_close(_TEST_FP32_DATA_CLOSE[i].number1, _TEST_FP32_DATA_CLOSE[i].number2)) {
print_testing_error("A pair of close numbers was not recognized");
return;
}
@ -67,7 +67,7 @@ void test_are_close_fp32()
// Testing different pairs of values:
for (int i = 0; i < _TEST_FP32_DIFFERENT_NUMBERS_AMOUNT; i++) {
if (bgc_are_close_fp32(_TEST_FP32_DATA_DIFFERENT[i].number1, _TEST_FP32_DATA_DIFFERENT[i].number2)) {
if (bgc_fp32_are_close(_TEST_FP32_DATA_DIFFERENT[i].number1, _TEST_FP32_DATA_DIFFERENT[i].number2)) {
print_testing_error("A pair of close numbers was not recognized");
return;
}
@ -86,22 +86,22 @@ static const TestNumberPairFP64 _TEST_FP64_DATA_CLOSE[] = {
{1.0, 1.0},
{-1.0, -1.0},
{-0.4 * BGC_EPSYLON_FP64, 0.4 * BGC_EPSYLON_FP64},
{-0.4 * BGC_FP64_EPSYLON, 0.4 * BGC_FP64_EPSYLON},
{1.0, 1.0 + 0.75 * BGC_EPSYLON_FP64},
{1.0, 1.0 - 0.75 * BGC_EPSYLON_FP64},
{1.0 + 0.75 * BGC_EPSYLON_FP64, 1.0},
{1.0 - 0.75 * BGC_EPSYLON_FP64, 1.0},
{1.0, 1.0 + 0.75 * BGC_FP64_EPSYLON},
{1.0, 1.0 - 0.75 * BGC_FP64_EPSYLON},
{1.0 + 0.75 * BGC_FP64_EPSYLON, 1.0},
{1.0 - 0.75 * BGC_FP64_EPSYLON, 1.0},
{-1.0, -1.0 + 0.75 * BGC_EPSYLON_FP64},
{-1.0, -1.0 - 0.75 * BGC_EPSYLON_FP64},
{-1.0 + 0.75 * BGC_EPSYLON_FP64, -1.0},
{-1.0 - 0.75 * BGC_EPSYLON_FP64, -1.0},
{-1.0, -1.0 + 0.75 * BGC_FP64_EPSYLON},
{-1.0, -1.0 - 0.75 * BGC_FP64_EPSYLON},
{-1.0 + 0.75 * BGC_FP64_EPSYLON, -1.0},
{-1.0 - 0.75 * BGC_FP64_EPSYLON, -1.0},
{100.0, 100.0 * (1.0 + 0.75 * BGC_EPSYLON_FP64)},
{100.0, 100.0 * (1.0 - 0.75 * BGC_EPSYLON_FP64)},
{-100.0, -100.0 * (1.0 + 0.75 * BGC_EPSYLON_FP64)},
{-100.0, -100.0 * (1.0 - 0.75 * BGC_EPSYLON_FP64)}
{100.0, 100.0 * (1.0 + 0.75 * BGC_FP64_EPSYLON)},
{100.0, 100.0 * (1.0 - 0.75 * BGC_FP64_EPSYLON)},
{-100.0, -100.0 * (1.0 + 0.75 * BGC_FP64_EPSYLON)},
{-100.0, -100.0 * (1.0 - 0.75 * BGC_FP64_EPSYLON)}
};
static const TestNumberPairFP64 _TEST_FP64_DATA_DIFFERENT[] = {
@ -109,31 +109,31 @@ static const TestNumberPairFP64 _TEST_FP64_DATA_DIFFERENT[] = {
{1.0, 0.999999},
{-1.0, -0.999999},
{-0.6 * BGC_EPSYLON_FP64, 0.6 * BGC_EPSYLON_FP64},
{-0.6 * BGC_FP64_EPSYLON, 0.6 * BGC_FP64_EPSYLON},
{1.0, 1.0 + 1.25 * BGC_EPSYLON_FP64},
{1.0, 1.0 - 1.25 * BGC_EPSYLON_FP64},
{1.0 + 1.25 * BGC_EPSYLON_FP64, 1.0},
{1.0 - 1.25 * BGC_EPSYLON_FP64, 1.0},
{1.0, 1.0 + 1.25 * BGC_FP64_EPSYLON},
{1.0, 1.0 - 1.25 * BGC_FP64_EPSYLON},
{1.0 + 1.25 * BGC_FP64_EPSYLON, 1.0},
{1.0 - 1.25 * BGC_FP64_EPSYLON, 1.0},
{-1.0, -1.0 + 1.25 * BGC_EPSYLON_FP64},
{-1.0, -1.0 - 1.25 * BGC_EPSYLON_FP64},
{-1.0 + 1.25 * BGC_EPSYLON_FP64, -1.0},
{-1.0 - 1.25 * BGC_EPSYLON_FP64, -1.0},
{-1.0, -1.0 + 1.25 * BGC_FP64_EPSYLON},
{-1.0, -1.0 - 1.25 * BGC_FP64_EPSYLON},
{-1.0 + 1.25 * BGC_FP64_EPSYLON, -1.0},
{-1.0 - 1.25 * BGC_FP64_EPSYLON, -1.0},
{100.0, 100.0 * (1.0 + 1.25 * BGC_EPSYLON_FP64)},
{100.0, 100.0 * (1.0 - 1.25 * BGC_EPSYLON_FP64)},
{-100.0, -100.0 * (1.0 + 1.25 * BGC_EPSYLON_FP64)},
{-100.0, -100.0 * (1.0 - 1.25 * BGC_EPSYLON_FP64)}
{100.0, 100.0 * (1.0 + 1.25 * BGC_FP64_EPSYLON)},
{100.0, 100.0 * (1.0 - 1.25 * BGC_FP64_EPSYLON)},
{-100.0, -100.0 * (1.0 + 1.25 * BGC_FP64_EPSYLON)},
{-100.0, -100.0 * (1.0 - 1.25 * BGC_FP64_EPSYLON)}
};
void test_are_close_fp64()
{
print_testing_name("bgc_are_close_fp64");
print_testing_name("bgc_fp64_are_close");
// Testing close pairs of values:
for (int i = 0; i < _TEST_FP64_CLOSE_NUMBERS_AMOUNT; i++) {
if (!bgc_are_close_fp64(_TEST_FP64_DATA_CLOSE[i].number1, _TEST_FP64_DATA_CLOSE[i].number2)) {
if (!bgc_fp64_are_close(_TEST_FP64_DATA_CLOSE[i].number1, _TEST_FP64_DATA_CLOSE[i].number2)) {
print_testing_error("A pair of close numbers was not recognized");
return;
}
@ -141,7 +141,7 @@ void test_are_close_fp64()
// Testing different pairs of values:
for (int i = 0; i < _TEST_FP64_DIFFERENT_NUMBERS_AMOUNT; i++) {
if (bgc_are_close_fp64(_TEST_FP64_DATA_DIFFERENT[i].number1, _TEST_FP64_DATA_DIFFERENT[i].number2)) {
if (bgc_fp64_are_close(_TEST_FP64_DATA_DIFFERENT[i].number1, _TEST_FP64_DATA_DIFFERENT[i].number2)) {
print_testing_error("A pair of different numbers was recognized as close numbers");
return;
}

View file

@ -9,24 +9,24 @@ static const int _TEST_FP32_NONUNIT_NUMBERS_AMOUNT = 4;
static const float _TEST_FP32_UNIT_NUMBERS[] = {
1.0f,
1.0f + 0.75f * BGC_EPSYLON_FP32,
1.0f - 0.75f * BGC_EPSYLON_FP32
1.0f + 0.75f * BGC_FP32_EPSYLON,
1.0f - 0.75f * BGC_FP32_EPSYLON
};
static const float _TEST_FP32_NONUNIT_NUMBERS[] = {
0.0f,
-1.0f,
1.0f + 1.25f * BGC_EPSYLON_FP32,
1.0f - 1.25f * BGC_EPSYLON_FP32
1.0f + 1.25f * BGC_FP32_EPSYLON,
1.0f - 1.25f * BGC_FP32_EPSYLON
};
void test_is_unit_fp32()
{
print_testing_name("bgc_is_unit_fp32");
print_testing_name("bgc_fp32_is_unit");
// Testing unit values:
for (int i = 0; i < _TEST_FP32_UNIT_NUMBERS_AMOUNT; i++) {
if (!bgc_is_unit_fp32(_TEST_FP32_UNIT_NUMBERS[i])) {
if (!bgc_fp32_is_unit(_TEST_FP32_UNIT_NUMBERS[i])) {
print_testing_error("A unit value was not recognized");
return;
}
@ -34,7 +34,7 @@ void test_is_unit_fp32()
// Testing non-unit values:
for (int i = 0; i < _TEST_FP32_NONUNIT_NUMBERS_AMOUNT; i++) {
if (bgc_is_unit_fp32(_TEST_FP32_NONUNIT_NUMBERS[i])) {
if (bgc_fp32_is_unit(_TEST_FP32_NONUNIT_NUMBERS[i])) {
print_testing_error("A non-unit value was recognized as a unit value");
return;
}
@ -50,24 +50,24 @@ static const int _TEST_FP64_NONUNIT_NUMBERS_AMOUNT = 4;
static const double _TEST_FP64_UNIT_NUMBERS[] = {
1.0,
1.0 + 0.75 * BGC_EPSYLON_FP64,
1.0 - 0.75 * BGC_EPSYLON_FP64
1.0 + 0.75 * BGC_FP64_EPSYLON,
1.0 - 0.75 * BGC_FP64_EPSYLON
};
static const double _TEST_FP64_NONUNIT_NUMBERS[] = {
0.0,
-1.0,
1.0 + 1.25 * BGC_EPSYLON_FP64,
1.0 - 1.25 * BGC_EPSYLON_FP64
1.0 + 1.25 * BGC_FP64_EPSYLON,
1.0 - 1.25 * BGC_FP64_EPSYLON
};
void test_is_unit_fp64()
{
print_testing_name("bgc_is_unit_fp64");
print_testing_name("bgc_fp64_is_unit");
// Testing unit values:
for (int i = 0; i < _TEST_FP64_UNIT_NUMBERS_AMOUNT; i++) {
if (!bgc_is_unit_fp64(_TEST_FP64_UNIT_NUMBERS[i])) {
if (!bgc_fp64_is_unit(_TEST_FP64_UNIT_NUMBERS[i])) {
print_testing_error("A unit value was not recognized");
return;
}
@ -75,7 +75,7 @@ void test_is_unit_fp64()
// Testing non-unit values:
for (int i = 0; i < _TEST_FP64_NONUNIT_NUMBERS_AMOUNT; i++) {
if (bgc_is_unit_fp64(_TEST_FP64_NONUNIT_NUMBERS[i])) {
if (bgc_fp64_is_unit(_TEST_FP64_NONUNIT_NUMBERS[i])) {
print_testing_error("A non-unit value was recognized as a unit value");
return;
}
@ -91,24 +91,24 @@ static const int _TEST_FP32_DATA_SQUARE_NONUNIT_AMOUNT = 4;
static const float _TEST_FP32_DATA_SQUARE_UNIT[] = {
1.0f,
1.0f + 1.75f * BGC_EPSYLON_FP32,
1.0f - 1.75f * BGC_EPSYLON_FP32
1.0f + 1.75f * BGC_FP32_EPSYLON,
1.0f - 1.75f * BGC_FP32_EPSYLON
};
static const float _TEST_FP32_DATA_SQUARE_NONUNIT[] = {
0.0f,
-1.0f,
1.0f + 2.25f * BGC_EPSYLON_FP32,
1.0f - 2.25f * BGC_EPSYLON_FP32
1.0f + 2.25f * BGC_FP32_EPSYLON,
1.0f - 2.25f * BGC_FP32_EPSYLON
};
void test_is_sqare_unit_fp32()
void test_is_square_unit_fp32()
{
print_testing_name("bgc_is_sqare_unit_fp32");
print_testing_name("bgc_fp32_is_square_unit");
// Testing unit values:
for (int i = 0; i < _TEST_FP32_DATA_SQUARE_UNIT_AMOUNT; i++) {
if (!bgc_is_sqare_unit_fp32(_TEST_FP32_DATA_SQUARE_UNIT[i])) {
if (!bgc_fp32_is_square_unit(_TEST_FP32_DATA_SQUARE_UNIT[i])) {
print_testing_error("A square unit value was not recognized");
return;
}
@ -116,7 +116,7 @@ void test_is_sqare_unit_fp32()
// Testing non-unit values:
for (int i = 0; i < _TEST_FP32_DATA_SQUARE_NONUNIT_AMOUNT; i++) {
if (bgc_is_sqare_unit_fp32(_TEST_FP32_DATA_SQUARE_NONUNIT[i])) {
if (bgc_fp32_is_square_unit(_TEST_FP32_DATA_SQUARE_NONUNIT[i])) {
print_testing_error("A non-unit value was recognized as a square unit value");
return;
}
@ -132,24 +132,24 @@ static const int _TEST_FP64_DATA_SQUARE_NONUNIT_AMOUNT = 4;
static const double _TEST_FP64_DATA_SQUARE_UNIT[] = {
1.0,
1.0 + 1.75 * BGC_EPSYLON_FP64,
1.0 - 1.75 * BGC_EPSYLON_FP64
1.0 + 1.75 * BGC_FP64_EPSYLON,
1.0 - 1.75 * BGC_FP64_EPSYLON
};
static const double _TEST_FP64_DATA_SQUARE_NONUNIT[] = {
0.0,
-1.0,
1.0 + 2.25 * BGC_EPSYLON_FP64,
1.0 - 2.25 * BGC_EPSYLON_FP64
1.0 + 2.25 * BGC_FP64_EPSYLON,
1.0 - 2.25 * BGC_FP64_EPSYLON
};
void test_is_sqare_unit_fp64()
void test_is_square_unit_fp64()
{
print_testing_name("bgc_is_sqare_unit_fp64");
print_testing_name("bgc_fp64_is_square_unit");
// Testing unit values:
for (int i = 0; i < _TEST_FP64_DATA_SQUARE_UNIT_AMOUNT; i++) {
if (!bgc_is_sqare_unit_fp64(_TEST_FP64_DATA_SQUARE_UNIT[i])) {
if (!bgc_fp64_is_square_unit(_TEST_FP64_DATA_SQUARE_UNIT[i])) {
print_testing_error("A square unit value was not recognized");
return;
}
@ -157,7 +157,7 @@ void test_is_sqare_unit_fp64()
// Testing non-unit values:
for (int i = 0; i < _TEST_FP64_DATA_SQUARE_NONUNIT_AMOUNT; i++) {
if (bgc_is_sqare_unit_fp64(_TEST_FP64_DATA_SQUARE_NONUNIT[i])) {
if (bgc_fp64_is_square_unit(_TEST_FP64_DATA_SQUARE_NONUNIT[i])) {
print_testing_error("A non-unit value was recognized as a square unit value");
return;
}
@ -171,6 +171,6 @@ void test_is_unit()
test_is_unit_fp32();
test_is_unit_fp64();
test_is_sqare_unit_fp32();
test_is_sqare_unit_fp64();
test_is_square_unit_fp32();
test_is_square_unit_fp64();
}

View file

@ -5,9 +5,9 @@ void test_is_unit_fp32();
void test_is_unit_fp64();
void test_is_sqare_unit_fp32();
void test_is_square_unit_fp32();
void test_is_sqare_unit_fp64();
void test_is_square_unit_fp64();
void test_is_unit();

View file

@ -9,24 +9,24 @@ static const int _TEST_FP32_NONZERO_NUMBERS_AMOUNT = 4;
static const float _TEST_FP32_ZERO_NUMBERS[] = {
0.0f,
0.75f * BGC_EPSYLON_FP32,
-0.75f * BGC_EPSYLON_FP32
0.75f * BGC_FP32_EPSYLON,
-0.75f * BGC_FP32_EPSYLON
};
static const float _TEST_FP32_NONZERO_NUMBERS[] = {
1.0f,
-1.0f,
1.25f * BGC_EPSYLON_FP32,
-1.25f * BGC_EPSYLON_FP32
1.25f * BGC_FP32_EPSYLON,
-1.25f * BGC_FP32_EPSYLON
};
void test_is_zero_fp32()
{
print_testing_name("bgc_is_zero_fp32");
print_testing_name("bgc_fp32_is_zero");
// Testing zero values:
for (int i = 0; i < _TEST_FP32_ZERO_NUMBERS_AMOUNT; i++) {
if (!bgc_is_zero_fp32(_TEST_FP32_ZERO_NUMBERS[i])) {
if (!bgc_fp32_is_zero(_TEST_FP32_ZERO_NUMBERS[i])) {
print_testing_error("A zero value was not recognized");
return;
}
@ -34,7 +34,7 @@ void test_is_zero_fp32()
// Testing non-zero values:
for (int i = 0; i < _TEST_FP32_NONZERO_NUMBERS_AMOUNT; i++) {
if (bgc_is_zero_fp32(_TEST_FP32_NONZERO_NUMBERS[i])) {
if (bgc_fp32_is_zero(_TEST_FP32_NONZERO_NUMBERS[i])) {
print_testing_error("A non-zero value was recognized as a zero value");
return;
}
@ -50,24 +50,24 @@ static const int _TEST_FP64_NONZERO_NUMBERS_AMOUNT = 4;
static const double _TEST_FP64_ZERO_NUMBERS[] = {
0.0,
0.75 * BGC_EPSYLON_FP64,
-0.75 * BGC_EPSYLON_FP64
0.75 * BGC_FP64_EPSYLON,
-0.75 * BGC_FP64_EPSYLON
};
static const double _TEST_FP64_NONZERO_NUMBERS[] = {
1.0,
-1.0,
1.25 * BGC_EPSYLON_FP64,
-1.25 * BGC_EPSYLON_FP64
1.25 * BGC_FP64_EPSYLON,
-1.25 * BGC_FP64_EPSYLON
};
void test_is_zero_fp64()
{
print_testing_name("bgc_is_zero_fp64");
print_testing_name("bgc_fp64_is_zero");
// Testing zero values:
for (int i = 0; i < _TEST_FP64_ZERO_NUMBERS_AMOUNT; i++) {
if (!bgc_is_zero_fp64(_TEST_FP64_ZERO_NUMBERS[i])) {
if (!bgc_fp64_is_zero(_TEST_FP64_ZERO_NUMBERS[i])) {
print_testing_error("A zero value was not recognized");
return;
}
@ -75,7 +75,7 @@ void test_is_zero_fp64()
// Testing non-zero values:
for (int i = 0; i < _TEST_FP64_NONZERO_NUMBERS_AMOUNT; i++) {
if (bgc_is_zero_fp64(_TEST_FP64_NONZERO_NUMBERS[i])) {
if (bgc_fp64_is_zero(_TEST_FP64_NONZERO_NUMBERS[i])) {
print_testing_error("A non-zero value was recognized as a zero value");
return;
}