Topic: About N3965: Proposal for Unbounded-Precision Integer Types


Author: Vincent Reverdy <vince.rev@gmail.com>
Date: Wed, 12 Mar 2014 04:19:25 -0700 (PDT)
Raw View
------=_Part_536_6746847.1394623165741
Content-Type: text/plain; charset=UTF-8

Hello.

I have some questions about N3965:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3965.html
It is great without doubt, to standardize big integers. They have been used
for a long time with libraries like GMP and there is a lot of existing
practice and experience with them.
However I have several questions about this proposal.

To begin with a simple question: what the interface of std::bits will be?
Same as std::bitset or same as std::integer, or a mix between both? Because
I think an unsigned integer and a sequence of bits are not exactly "the
same thing". For example, std::bitset does not provide arithmetic
operators. Furthermore, how do you compare two std::bits? Lexicographically
or by their integral representation? This is not the same thing... I agree
that programmatically, std::bits and std::unsigned_integer are the same
thing, but I think that their mathematical meaning is not the same.

But my main concern is about performance for big numbers crunching. I think
that one of the main drawbacks of GMP is performance when one already know
the typical size of its integers (even if I've done some prime numbers
calculation in the past, I am not an expert in this field, so I would like
to have the point of view of more experienced user). So it would be great,
at least I think, for performance purpose (and for integers we need
performance) to have the possibility to choose between static or dynamic
size.

In fact, for an integer, I would have expected a generic class like
std::basic_integer that will allow to specify:
- the integral domain (signed/unsigned)
- the size in bits if static size / the allocator if dynamic size
- a conversion policy in order to handle proper conversions in arithmetic
operations (for example what occurs when we add an integer with an
Allocator1 and an integer with an Allocator2)

with predefined aliases for:
- dynamic signed integer
- dynamic unsigned integer
- static signed integer
- static unsigned integer

But I wonder if it is a very personnal feeling or if some people have the
same kind of opinion about that.

Thank you very much for your feedback and clarifications.

Vincent

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_536_6746847.1394623165741
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hello.<br><br>I have some questions about N3965: http://ww=
w.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3965.html<br>It is great wi=
thout doubt, to standardize big integers. They have been used for a long ti=
me with libraries like GMP and there is a lot of existing practice and expe=
rience with them.<br>However I have several questions about this proposal.<=
br><br>To begin with a simple question: what the interface of std::bits wil=
l be? Same as <span style=3D"font-family: courier new,monospace;">std::bits=
et</span> or same as <span style=3D"font-family: courier new,monospace;">st=
d::integer</span>, or a mix between both? Because I think an unsigned integ=
er and a sequence of bits are not exactly "the same thing". For example, <s=
pan style=3D"font-family: courier new,monospace;">std::bitset</span> does n=
ot provide arithmetic operators. Furthermore, how do you compare two <span =
style=3D"font-family: courier new,monospace;">std::bits</span>? Lexicograph=
ically or by their integral representation? This is not the same thing... I=
 agree that programmatically, <span style=3D"font-family: courier new,monos=
pace;">std::bits</span> and <span style=3D"font-family: courier new,monospa=
ce;">std::unsigned_integer</span> are the same thing, but I think that thei=
r mathematical meaning is not the same.<br><br>But my main concern is about=
 performance for big numbers crunching. I think that one of the main drawba=
cks of GMP is performance when one already know the typical size of its int=
egers (even if I've done some prime numbers calculation in the past, I am n=
ot an expert in this field, so I would like to have the point of view of mo=
re experienced user). So it would be great, at least I think, for performan=
ce purpose (and for integers we need performance) to have the possibility t=
o choose between static or dynamic size.<br><br>In fact, for an integer, I =
would have expected a generic class like <span style=3D"font-family: courie=
r new,monospace;">std::basic_integer</span> that will allow to specify:<br>=
- the integral domain (signed/unsigned)<br>- the size in bits if static siz=
e / the allocator if dynamic size<br>- a conversion policy in order to hand=
le proper conversions in arithmetic operations (for example what occurs whe=
n we add an integer with an Allocator1 and an integer with an Allocator2)<b=
r><br>with predefined aliases for:<br>- dynamic signed integer<br>- dynamic=
 unsigned integer<br>- static signed integer<br>- static unsigned integer<b=
r><br>But I wonder if it is a very personnal feeling or if some people have=
 the same kind of opinion about that.<br><br>Thank you very much for your f=
eedback and clarifications.<br><br>Vincent<br><br></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_536_6746847.1394623165741--

.