[Multiprecision] number conversion to __int128

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[Multiprecision] number conversion to __int128

Boost - Users mailing list
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 fundamental (built-in) 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?
 
 
Regards,
Anton

_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: [Multiprecision] number conversion to __int128

Boost - Users mailing list

On 15/05/2020 11:03, A.Dmitrovsky via Boost-users wrote:

> 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
> fundamental (built-in)
> <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?

Yes, it was an oversight - I thought I'd fixed this recently actually,
so I might need to investigate some more...


--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: [Multiprecision] number conversion to __int128

Boost - Users mailing list
In reply to this post by Boost - Users mailing list


From: Boost-users <[hidden email]> On Behalf Of A.Dmitrovsky via Boost-users
Sent: 15 May 2020 11:03
To: [hidden email]
Cc: A.Dmitrovsky <[hidden email]>
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
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: [Multiprecision] number conversion to __int128

Boost - Users mailing list
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.
 
So that's why I am here :)
 
Regards,
Anton
 
18.05.2020, 16:51, "Paul A. Bristow via Boost-users" <[hidden email]>:



From: Boost-users <[hidden email]> On Behalf Of A.Dmitrovsky via Boost-users
Sent: 15 May 2020 11:03
To: [hidden email]
Cc: A.Dmitrovsky <[hidden email]>
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
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users


_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: [Multiprecision] number conversion to __int128

Boost - Users mailing list

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"
> <[hidden email]>:
>
>
>
>     From: Boost-users <[hidden email]
>     <mailto:[hidden email]>> On Behalf Of
>     A.Dmitrovsky via Boost-users
>     Sent: 15 May 2020 11:03
>     To: [hidden email] <mailto:[hidden email]>
>     Cc: A.Dmitrovsky <[hidden email] <mailto:[hidden email]>>
>     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
>     [hidden email] <mailto:[hidden email]>
>     https://lists.boost.org/mailman/listinfo.cgi/boost-users
>
>
> _______________________________________________
> Boost-users mailing list
> [hidden email]
> 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
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: [Multiprecision] number conversion to __int128

Boost - Users mailing list
Sure, will file one. But could you please elaborate a bit, is it just a docs defect or something more?
 
Regards,
Anton
 
18.05.2020, 20:08, "John Maddock via Boost-users" <[hidden email]>:


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"
 <[hidden email]>:



     From: Boost-users <[hidden email]
     <mailto:[hidden email]>> On Behalf Of
     A.Dmitrovsky via Boost-users
     Sent: 15 May 2020 11:03
     To: [hidden email] <mailto:[hidden email]>
     Cc: A.Dmitrovsky <[hidden email] <mailto:[hidden email]>>
     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
     [hidden email] <mailto:[hidden email]>
     https://lists.boost.org/mailman/listinfo.cgi/boost-users


 _______________________________________________
 Boost-users mailing list
 [hidden email]
 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
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users


_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users