forked from boostorg/multiprecision
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
complete implementation of all required procedures in exact_arithmeti…
…c<> class
- Loading branch information
1 parent
29a1ac3
commit 38f02d9
Showing
2 changed files
with
70 additions
and
0 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
38f02d9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @sinandredemption this looks like exciting, clean work Fahad. It'll bee cool to start fashioning the
cpp_quad_float
class and in a while see how it plays.Nice!
38f02d9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, glad that you like it @ckormanyos :)
Please tell me if you have any suggestions on the
exact_arithmetic
class, and if you think this should be moved to a separate file of its own.38f02d9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I have several thoughts.
I think the location within the
cpp_double_float.hpp
header is a good choice. I am rather sure thatcpp_quad_float.hpp
will also includecpp_double_float.hpp
. So each class wil lhave access to these mathematical primitives.Why am I so sure that quad-float might include double-float? Although I do want to keep these classes as separate as possible, there will be some situations, such as
eval_log()
where it is highly convenient to first compute theexp()
function at half precision and use one iterative step to obtain full precision. This is convenient and we might use it for the pairseval_exp()
/eval_log()
,eval_sin()
/eval_asin()
, etc.exact_arithmetic
is something that could potentially help whenconstexpr
-ifying parts ofcpp_double_float
andcpp_quad_float
. So you might want to look at some of the subroutines and asses them regarding how you could maybe make them C++11constexpr
correct. It seems like the functionsplit()
might be a central part of that. This is something we can do later.Another question I have is if the use of
std::tie
is invisible regarding runtime overhead or not? It might make sense to actually check if using these functions incure overhead, or if they disappear when compiling with optimization on. I do not have that much experience withtie
, so I'm not sure. I know that STL container and algorithm stuff is mostly invisible, but some artifacts (rare indeed, but often used) are, in fact, significantly slower from the Library.The first step in all this is to first get the mathematics numerically correct. We usually say, get it working, then optimize it. I also find the process of full
constexpr
-ification to actually be better suited for a class when it is running deep within a test system. Then successively make parts of itconstexpr
while running the tests with each and every change along the way. So in summary, get it working, then optimize andconstexpr
-ify.Along the lines of getting stuff working, I will continue to bind
cpp_double_float
into more rigorous Boost-style testing with the JAM file and needed code changes in the test files. So when you are getting finished withcpp_quad_float
we can readily go through the same testing or a very similar procedure for it.@sinandredemption and @cosurgi
38f02d9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting point to check later. I would expect it to become invisible in newer compilers, namely those that support structured binding.