Skip to content

Commit e4f2173

Browse files
authored
Precision checks and increased efficiency for _cos (#51)
# Precision checks and increased efficiency for `_cos` This PR addresses issue #50.
2 parents a7c2c43 + 5c504c4 commit e4f2173

File tree

190 files changed

+309
-199
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

190 files changed

+309
-199
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#####################################################################################################
2-
# Copyright (c) 2023-2024 NWSOFT #
2+
# Copyright (c) 2023-2025 NWSOFT #
33
# #
44
# Permission is hereby granted, free of charge, to any person obtaining a copy #
55
# of this software and associated documentation files (the "Software"), to deal #

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2024 Andy Zhang
3+
Copyright (c) 2023-2025 Andy Zhang
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#####################################################################################################
2-
# Copyright (c) 2023-2024 NWSOFT #
2+
# Copyright (c) 2023-2025 NWSOFT #
33
# #
44
# Permission is hereby granted, free of charge, to any person obtaining a copy #
55
# of this software and associated documentation files (the "Software"), to deal #

cpp.hint

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**************************************************************************************************
2-
* Copyright (c) 2023-2024 NWSOFT *
2+
* Copyright (c) 2023-2025 NWSOFT *
33
* *
44
* Permission is hereby granted, free of charge, to any person obtaining a copy *
55
* of this software and associated documentation files (the "Software"), to deal *

include/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#####################################################################################################
2-
# Copyright (c) 2023-2024 NWSOFT #
2+
# Copyright (c) 2023-2025 NWSOFT #
33
# #
44
# Permission is hereby granted, free of charge, to any person obtaining a copy #
55
# of this software and associated documentation files (the "Software"), to deal #

include/argParse.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**************************************************************************************************
2-
* Copyright (c) 2023-2024 NWSOFT *
2+
* Copyright (c) 2023-2025 NWSOFT *
33
* *
44
* Permission is hereby granted, free of charge, to any person obtaining a copy *
55
* of this software and associated documentation files (the "Software"), to deal *

include/colors.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**************************************************************************************************
2-
* Copyright (c) 2023-2024 NWSOFT *
2+
* Copyright (c) 2023-2025 NWSOFT *
33
* *
44
* Permission is hereby granted, free of charge, to any person obtaining a copy *
55
* of this software and associated documentation files (the "Software"), to deal *

include/constants.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**************************************************************************************************
2-
* Copyright (c) 2023-2024 NWSOFT *
2+
* Copyright (c) 2023-2025 NWSOFT *
33
* *
44
* Permission is hereby granted, free of charge, to any person obtaining a copy *
55
* of this software and associated documentation files (the "Software"), to deal *

include/exceptions.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**************************************************************************************************
2-
* Copyright (c) 2023-2024 NWSOFT *
2+
* Copyright (c) 2023-2025 NWSOFT *
33
* *
44
* Permission is hereby granted, free of charge, to any person obtaining a copy *
55
* of this software and associated documentation files (the "Software"), to deal *

include/factors.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**************************************************************************************************
2-
* Copyright (c) 2023-2024 NWSOFT *
2+
* Copyright (c) 2023-2025 NWSOFT *
33
* *
44
* Permission is hereby granted, free of charge, to any person obtaining a copy *
55
* of this software and associated documentation files (the "Software"), to deal *

include/fn/calc.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**************************************************************************************************
2-
* Copyright (c) 2023-2024 NWSOFT *
2+
* Copyright (c) 2023-2025 NWSOFT *
33
* *
44
* Permission is hereby granted, free of charge, to any person obtaining a copy *
55
* of this software and associated documentation files (the "Software"), to deal *

include/fn/calculus.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**************************************************************************************************
2-
* Copyright (c) 2023-2024 NWSOFT *
2+
* Copyright (c) 2023-2025 NWSOFT *
33
* *
44
* Permission is hereby granted, free of charge, to any person obtaining a copy *
55
* of this software and associated documentation files (the "Software"), to deal *

include/fn/root.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**************************************************************************************************
2-
* Copyright (c) 2023-2024 NWSOFT *
2+
* Copyright (c) 2023-2025 NWSOFT *
33
* *
44
* Permission is hereby granted, free of charge, to any person obtaining a copy *
55
* of this software and associated documentation files (the "Software"), to deal *

include/format.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**************************************************************************************************
2-
* Copyright (c) 2023-2024 NWSOFT *
2+
* Copyright (c) 2023-2025 NWSOFT *
33
* *
44
* Permission is hereby granted, free of charge, to any person obtaining a copy *
55
* of this software and associated documentation files (the "Software"), to deal *

include/fraction.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**************************************************************************************************
2-
* Copyright (c) 2023-2024 NWSOFT *
2+
* Copyright (c) 2023-2025 NWSOFT *
33
* *
44
* Permission is hereby granted, free of charge, to any person obtaining a copy *
55
* of this software and associated documentation files (the "Software"), to deal *

include/getString.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**************************************************************************************************
2-
* Copyright (c) 2023-2024 NWSOFT *
2+
* Copyright (c) 2023-2025 NWSOFT *
33
* *
44
* Permission is hereby granted, free of charge, to any person obtaining a copy *
55
* of this software and associated documentation files (the "Software"), to deal *

include/gui.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**************************************************************************************************
2-
* Copyright (c) 2023-2024 NWSOFT *
2+
* Copyright (c) 2023-2025 NWSOFT *
33
* *
44
* Permission is hereby granted, free of charge, to any person obtaining a copy *
55
* of this software and associated documentation files (the "Software"), to deal *

include/internals.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**************************************************************************************************
2-
* Copyright (c) 2023-2024 NWSOFT *
2+
* Copyright (c) 2023-2025 NWSOFT *
33
* *
44
* Permission is hereby granted, free of charge, to any person obtaining a copy *
55
* of this software and associated documentation files (the "Software"), to deal *

include/logging.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**************************************************************************************************
2-
* Copyright (c) 2023-2024 NWSOFT *
2+
* Copyright (c) 2023-2025 NWSOFT *
33
* *
44
* Permission is hereby granted, free of charge, to any person obtaining a copy *
55
* of this software and associated documentation files (the "Software"), to deal *

include/number.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**************************************************************************************************
2-
* Copyright (c) 2023-2024 NWSOFT *
2+
* Copyright (c) 2023-2025 NWSOFT *
33
* *
44
* Permission is hereby granted, free of charge, to any person obtaining a copy *
55
* of this software and associated documentation files (the "Software"), to deal *

include/output.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**************************************************************************************************
2-
* Copyright (c) 2023-2024 NWSOFT *
2+
* Copyright (c) 2023-2025 NWSOFT *
33
* *
44
* Permission is hereby granted, free of charge, to any person obtaining a copy *
55
* of this software and associated documentation files (the "Software"), to deal *

include/platform.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**************************************************************************************************
2-
* Copyright (c) 2023-2024 NWSOFT *
2+
* Copyright (c) 2023-2025 NWSOFT *
33
* *
44
* Permission is hereby granted, free of charge, to any person obtaining a copy *
55
* of this software and associated documentation files (the "Software"), to deal *

include/rounding.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**************************************************************************************************
2-
* Copyright (c) 2023-2024 NWSOFT *
2+
* Copyright (c) 2023-2025 NWSOFT *
33
* *
44
* Permission is hereby granted, free of charge, to any person obtaining a copy *
55
* of this software and associated documentation files (the "Software"), to deal *

include/symbols.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**************************************************************************************************
2-
* Copyright (c) 2023-2024 NWSOFT *
2+
* Copyright (c) 2023-2025 NWSOFT *
33
* *
44
* Permission is hereby granted, free of charge, to any person obtaining a copy *
55
* of this software and associated documentation files (the "Software"), to deal *

include/testing.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**************************************************************************************************
2-
* Copyright (c) 2023-2024 NWSOFT *
2+
* Copyright (c) 2023-2025 NWSOFT *
33
* *
44
* Permission is hereby granted, free of charge, to any person obtaining a copy *
55
* of this software and associated documentation files (the "Software"), to deal *

include/types/result.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**************************************************************************************************
2-
* Copyright (c) 2023-2024 NWSOFT *
2+
* Copyright (c) 2023-2025 NWSOFT *
33
* *
44
* Permission is hereby granted, free of charge, to any person obtaining a copy *
55
* of this software and associated documentation files (the "Software"), to deal *

include/util.hpp

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**************************************************************************************************
2-
* Copyright (c) 2023-2024 NWSOFT *
2+
* Copyright (c) 2023-2025 NWSOFT *
33
* *
44
* Permission is hereby granted, free of charge, to any person obtaining a copy *
55
* of this software and associated documentation files (the "Software"), to deal *
@@ -35,17 +35,22 @@
3535
#pragma once
3636

3737
#include "colors.hpp"
38+
#include "output.hpp"
39+
#include "platform.hpp"
3840

3941
#include <algorithm>
4042
#include <array>
4143
#include <chrono>
4244
#include <clocale>
45+
#include <cstddef>
4346
#include <iomanip>
4447
#include <iostream>
4548
#include <sstream>
4649
#include <string>
4750
#include <vector>
4851

52+
using namespace std::literals;
53+
4954
#ifndef TIC
5055
/**
5156
* @brief Starts a timer for profiling code execution time.
@@ -72,6 +77,11 @@
7277
}
7378
#endif
7479

80+
#ifndef MAX_DECIMALS
81+
/// @brief The maximum number of decimals to output
82+
#define MAX_DECIMALS 50
83+
#endif
84+
7585
namespace steppable::__internals::utils
7686
{
7787
#ifndef MS_STDLIB_BUGS
@@ -183,6 +193,26 @@ namespace steppable::__internals::utils
183193
Utf8CodePage() { ; }
184194
};
185195
#endif
196+
197+
/**
198+
* @brief Checks whether the decimal number is correctly specified.
199+
* @details Compares the argument `decimal` to `MAX_DECIMALS`. If too much decimals are requested, prints an error
200+
* and quits the program.
201+
*
202+
* @tparam NumberT Type of the number.
203+
* @param decimal A pointer to the number of decimals.
204+
*/
205+
template<typename NumberT>
206+
void checkDecimalArg(const NumberT* decimal)
207+
{
208+
if (*decimal > MAX_DECIMALS)
209+
{
210+
output::error("checkDecimalArg"s,
211+
"The number of decimals ({0}) is more than the accepted {1} digits."s,
212+
{ std::to_string(*decimal), std::to_string(MAX_DECIMALS) });
213+
programSafeExit(1);
214+
}
215+
}
186216
} // namespace steppable::__internals::utils
187217

188218
/**

lib/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#####################################################################################################
2-
# Copyright (c) 2023-2024 NWSOFT #
2+
# Copyright (c) 2023-2025 NWSOFT #
33
# #
44
# Permission is hereby granted, free of charge, to any person obtaining a copy #
55
# of this software and associated documentation files (the "Software"), to deal #

lib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#####################################################################################################
2-
# Copyright (c) 2023-2024 NWSOFT #
2+
# Copyright (c) 2023-2025 NWSOFT #
33
# #
44
# Permission is hereby granted, free of charge, to any person obtaining a copy #
55
# of this software and associated documentation files (the "Software"), to deal #

lib/bindings.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**************************************************************************************************
2-
* Copyright (c) 2023-2024 NWSOFT *
2+
* Copyright (c) 2023-2025 NWSOFT *
33
* *
44
* Permission is hereby granted, free of charge, to any person obtaining a copy *
55
* of this software and associated documentation files (the "Software"), to deal *

0 commit comments

Comments
 (0)