|
Boost Users : |
From: A.Dmitrovsky (tdiff_at_[hidden])
Date: 2020-05-18 17:42:56
On 18/05/2020 17:32, A.Dmitrovsky via Boost-users wrote:Hi,
Strictly speaking, if I get it correct, that passage is about
compatibility between different boost::multiprecision types (e.g.
mp::int128 to mp::int256 conversion) and tells nothing about being
able to convert to some other arithmetic type.
Yes that's correct, like I said I thought I had this fixed, but
apparently not fixed enough :(
Can you please file a defect report on github so we don't forget?
Thanks! John.
So that's why I am here :)
Regards,
Anton
18.05.2020, 16:51, "Paul A. Bristow via Boost-users"
<boost-users@lists.boost.org>:
From: Boost-users <boost-users-bounces@lists.boost.org
<mailto:boost-users-bounces@lists.boost.org>> On Behalf Of
A.Dmitrovsky via Boost-users
Sent: 15 May 2020 11:03
To: boost-users@lists.boost.org <mailto:boost-users@lists.boost.org>
Cc: A.Dmitrovsky <tdiff@yandex.ru <mailto:tdiff@yandex.ru>>
Subject: [Boost-users] [Multiprecision] number conversion to __int128
Hi,
Boost::multiprecision docs [1] mentions that the type parameter of
number::convert_to method should be "fundamental", pointing to the
list of standard types ('A number can be converted to any
https://en.cppreference.com/w/cpp/language/types type)'.
This is different to number::convert_to reference [2], which
states that "Type T may be any arithmetic type".
Can [unsigned] __int128 be treated as "fundamental" on
compilers/platforms which support it?
[1]
https://www.boost.org/doc/libs/1_73_0/libs/multiprecision/doc/html/boost_multiprecision/tut/conversions.html
[2]
https://www.boost.org/doc/libs/1_73_0/libs/multiprecision/doc/html/boost_multiprecision/ref/number.html
Does
“
*Interconversions between number types of the same family are
allowed and are implicit conversions if no loss of precision is
involved, and explicit if it is:
…
"
In
https://www.boost.org/doc/libs/1_73_0/libs/multiprecision/doc/html/boost_multiprecision/tut/conversions.html
Not cover your case _uint128 ? and thus allowed for conversion.
Even if the _uint* and _int* types are not fundamental builtin
types (regrettably - blame the glacial process of C and C++
standardization and the millstone of C (don't ask) - but they
might as well be for most purposes, including this one).
HTH
Paul
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org <mailto:Boost-users@lists.boost.org>
https://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
https://lists.boost.org/mailman/listinfo.cgi/boost-users--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net