Comments (6)
Hi. Thanks for filing this issue. It has since been addressed in the latest version:
1.x: https://godbolt.org/z/1Y53M5Knj
2.x: https://godbolt.org/z/exxafsKjx
Is it possible for you to upgrade?
I am confusing that why can't be default_scale<(Digits < 0), (Radix != 2)>?
The specialisation that was provided in v1 is likely to be using a bit shift operation and so only works for the binary base.
from cnl.
Still in v1 since the C++17 we used.
I try to add these code in cnl/_impl/num_traits/scale.h
( https://github.com/johnmcfarlane/cnl/blob/v1.x/include/cnl/_impl/num_traits/scale.h#L48 )
And then the problem solved.
namespace cnl {
template<int Digits, int Radix, template<typename, typename> class TNUM, typename S, typename Tag>
struct scale<Digits, Radix, TNUM<S, Tag>, _impl::enable_if_t<(
Digits<0 && cnl::_impl::is_integral<S>::value)>>
{
CNL_NODISCARD constexpr auto operator()(TNUM<S, Tag> const& s) const
-> decltype(s/_impl::power_value<S, -Digits, Radix>())
{
return s/_impl::power_value<S, -Digits, Radix>();
}
};
}
Could you please help me to review these code?
- Is that a right change?
- Any other improvement suggestion?
from cnl.
Hi. Thanks for the feedback and suggestion. I should be able to take a look at it later today.
The great thing about DVCS and CI is that you can safely break things without causing harm or disruption to others. So while I'm happy to help, you don't have to wait.
- fork the project under your own user account,
- See whether GitHub Actions runs and builds the project for you (it may not or there may have been degradations in the build system over the past few months; I'm not sure),
- make a branch off of v1.x,
- add a test which fails - it doesn't have to be perfect or ready for merging but shows the problem,
- apply the change,
- push the branch to GitHub,
- see whether the fix prevents the test from failing.
from cnl.
CI for v1.x is not currently working, likely due to updates to the docker images used to build the project. I'll need to fix the v1.x branch first.
from cnl.
Test case pushed and confirmed.
@vrqq did you add the specialisation of cnl::scale
or did you replace an existing specialisation?
from cnl.
After one years I retry to fix this issue, and there still some bug I cannot fixed. (I made a pull request into 991 branch it into branch)
The code previous I posted, was break the coding style of template partial specialization. For the third argument, I should keep it fixed on the special type, instead of using template<typename, typename>
to match any _impl::number type.
After reading the code in project, I found out the design-rule of struct scale
. The third argument class Rep
should be specialized in different files, such as rouding_integer.h
So It may more suitable to move into https://github.com/johnmcfarlane/cnl/blob/991/include/cnl/rounding_integer.h#L74
There's some problem on test like std::hash<path>
in cppcon2017.cpp. In the code below, there still have problem on GCC and Clang compiler.
https://github.com/johnmcfarlane/cnl/blob/main/test/unit/presentations/cppcon2017.cpp#L23
And conan in pip has been updated into 2.0, but a lot of package hasn't upgraded in there repo.
from cnl.
Related Issues (20)
- Don't reopen std::
- remove cnl/bit.h
- Clang-Tidy won't re-run when .clang-tidy changes
- ensure FetchContent-able
- Put slowest tests first
- the godbolt link in the readme does not compile
- Build error on v1.1.2: redefinition of βstruct std::hash<std::filesystem::__cxx11::path>β HOT 5
- Poor performance when using composition of core numeric types HOT 12
- v1.1.7 crash after multiplication HOT 1
- Publishing CNL 1.x libraries to platformio HOT 3
- Serialization. HOT 3
- Missing rounding conversion operators HOT 1
- MSVC sanitizers HOT 2
- Simplify `__int128` support. HOT 1
- CMake via Conan? HOT 1
- Add base parameter to to_chars HOT 2
- Only build CNL as Debug HOT 1
- to_chars_static allocates buffer too small for -ve numbers HOT 1
- Replace CMAKE_TOOLCHAIN_FILE with CMAKE_PROJECT_INCLUDE_BEFORE HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cnl.