-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Artur Bać
committed
Jul 23, 2024
1 parent
50ce6e4
commit edc23c5
Showing
21 changed files
with
276 additions
and
411 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 0 additions & 8 deletions
8
fixed_lib/include/fixedmath/detail/static_call_operator_epilog.h
This file was deleted.
Oops, something went wrong.
23 changes: 0 additions & 23 deletions
23
fixed_lib/include/fixedmath/detail/static_call_operator_prolog.h
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,21 @@ | ||
// MIT License | ||
// | ||
// Copyright (c) 2020-2021 Artur Bac | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in all | ||
// copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
// SOFTWARE. | ||
// SPDX-FileCopyrightText: 2020-2024 Artur Bać | ||
// SPDX-License-Identifier: BSL-1.0 | ||
// SPDX-PackageHomePage: https://github.com/arturbac/fixed_math | ||
|
||
#pragma once | ||
#include "math.h" | ||
|
||
#include <iostream> | ||
#include <iomanip> | ||
|
||
namespace fixedmath | ||
{ | ||
inline std::ostream & operator << ( std::ostream & outstr, fixed_t src ) | ||
{ | ||
if( src != std::numeric_limits<fixed_t>::quiet_NaN() ) | ||
outstr << std::fixed << std::setprecision( 16 ) << static_cast<double>( src ); | ||
else | ||
outstr << "NaN"; | ||
return outstr; | ||
} | ||
} | ||
{ | ||
inline std::ostream & operator<<(std::ostream & outstr, fixed_t src) | ||
{ | ||
if(src != std::numeric_limits<fixed_t>::quiet_NaN()) | ||
outstr << std::fixed << std::setprecision(16) << static_cast<double>(src); | ||
else | ||
outstr << "NaN"; | ||
return outstr; | ||
} | ||
} // namespace fixedmath |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,66 @@ | ||
// MIT License | ||
// | ||
// Copyright (c) 2020-2021 Artur Bac | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in all | ||
// copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
// SOFTWARE. | ||
// SPDX-FileCopyrightText: 2020-2024 Artur Bać | ||
// SPDX-License-Identifier: BSL-1.0 | ||
// SPDX-PackageHomePage: https://github.com/arturbac/fixed_math | ||
|
||
#pragma once | ||
|
||
#include "types.h" | ||
|
||
namespace fixedmath | ||
{ | ||
|
||
} | ||
{ | ||
} | ||
|
||
namespace std | ||
{ | ||
template<> | ||
struct numeric_limits<fixedmath::fixed_t> | ||
{ | ||
using value_type = fixedmath::fixed_t; | ||
using fixed_internal = fixedmath::fixed_internal; | ||
using fix_carrier_t = fixedmath::fix_carrier_t; | ||
|
||
static constexpr bool is_integer { false }; | ||
static constexpr bool is_specialized { true }; | ||
static constexpr bool is_signed { true }; | ||
static constexpr bool is_exact{ true }; | ||
static constexpr bool has_infinity{}; | ||
static constexpr bool has_quiet_NaN{ true }; | ||
static constexpr bool has_signaling_NaN{}; | ||
static constexpr bool has_denorm_loss{}; | ||
static constexpr float_round_style round_style{round_toward_zero}; | ||
static constexpr bool is_iec559{}; | ||
static constexpr bool is_bounded{true}; | ||
static constexpr bool is_modulo{}; | ||
static constexpr int digits{16}; | ||
static constexpr int digits10{4}; | ||
static constexpr int max_digits10{6}; | ||
static constexpr int radix{2}; | ||
static constexpr bool traps{true}; | ||
static constexpr bool tinyness_before{}; | ||
|
||
static consteval value_type min() noexcept{ return fix_carrier_t{fixed_internal{1}}; } | ||
static consteval value_type lowest() noexcept{ return fix_carrier_t{fixed_internal{-0x7FFFFFFFFFFFFFFEll}}; } | ||
static consteval value_type max() noexcept { return fix_carrier_t{fixed_internal{0x7FFFFFFFFFFFFFFEll}}; } | ||
static consteval value_type one() noexcept { return fix_carrier_t{fixed_internal{65536}}; } | ||
static consteval value_type epsilon() noexcept { return fix_carrier_t{fixed_internal{1}}; } | ||
static consteval value_type round_error() noexcept { return fix_carrier_t{fixed_internal{1}}; } | ||
static consteval value_type quiet_NaN() noexcept { return fix_carrier_t{fixed_internal{0x7FFFFFFFFFFFFFFFll}}; } | ||
|
||
static consteval int32_t max_integral() noexcept { return 2147483647; } | ||
static consteval int32_t min_integral() noexcept{ return -2147483647; } | ||
}; | ||
|
||
} | ||
{ | ||
template<> | ||
struct numeric_limits<fixedmath::fixed_t> | ||
{ | ||
using value_type = fixedmath::fixed_t; | ||
using fixed_internal = fixedmath::fixed_internal; | ||
using fix_carrier_t = fixedmath::fix_carrier_t; | ||
|
||
static constexpr bool is_integer{false}; | ||
static constexpr bool is_specialized{true}; | ||
static constexpr bool is_signed{true}; | ||
static constexpr bool is_exact{true}; | ||
static constexpr bool has_infinity{}; | ||
static constexpr bool has_quiet_NaN{true}; | ||
static constexpr bool has_signaling_NaN{}; | ||
static constexpr bool has_denorm_loss{}; | ||
static constexpr float_round_style round_style{round_toward_zero}; | ||
static constexpr bool is_iec559{}; | ||
static constexpr bool is_bounded{true}; | ||
static constexpr bool is_modulo{}; | ||
static constexpr int digits{16}; | ||
static constexpr int digits10{4}; | ||
static constexpr int max_digits10{6}; | ||
static constexpr int radix{2}; | ||
static constexpr bool traps{true}; | ||
static constexpr bool tinyness_before{}; | ||
|
||
static consteval value_type min() noexcept { return fix_carrier_t{fixed_internal{1}}; } | ||
|
||
static consteval value_type lowest() noexcept { return fix_carrier_t{fixed_internal{-0x7FFFFFFFFFFFFFFEll}}; } | ||
|
||
static consteval value_type max() noexcept { return fix_carrier_t{fixed_internal{0x7FFFFFFFFFFFFFFEll}}; } | ||
|
||
static consteval value_type one() noexcept { return fix_carrier_t{fixed_internal{65536}}; } | ||
|
||
static consteval value_type epsilon() noexcept { return fix_carrier_t{fixed_internal{1}}; } | ||
|
||
static consteval value_type round_error() noexcept { return fix_carrier_t{fixed_internal{1}}; } | ||
|
||
static consteval value_type quiet_NaN() noexcept { return fix_carrier_t{fixed_internal{0x7FFFFFFFFFFFFFFFll}}; } | ||
|
||
static consteval int32_t max_integral() noexcept { return 2147483647; } | ||
|
||
static consteval int32_t min_integral() noexcept { return -2147483647; } | ||
}; | ||
|
||
} // namespace std | ||
|
||
namespace fixedmath | ||
{ | ||
{ | ||
inline consteval auto quiet_NaN_result() -> fixed_t { return std::numeric_limits<fixed_t>::quiet_NaN(); } | ||
} | ||
} // namespace fixedmath | ||
|
Oops, something went wrong.