473,395 Members | 1,577 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

GMP and finding MSB of type mpz_t

I am learning about the GMP library and it is installed correctly
here.

My question, which I found no match (so far) in the reading of the
past few weeks of posting to this group,the FAQ, by searching the
newsgroup and web and by reading the docs, is : how do I find the MSB
of mpz_t?

I hope I didn't miss it if it was there.

Ernst
Nov 13 '05 #1
6 2451
On 6 Dec 2003 14:58:29 -0800, Er********@sbcglobal.net (Ernst Berg)
wrote in comp.lang.c:
I am learning about the GMP library and it is installed correctly
here.

My question, which I found no match (so far) in the reading of the
past few weeks of posting to this group,the FAQ, by searching the
newsgroup and web and by reading the docs, is : how do I find the MSB
of mpz_t?

I hope I didn't miss it if it was there.

Ernst


mpz_t is not a C language data type, we have no idea what it is.
Third party libraries are non-standard and therefore not topical here.
Try a group like gnu.gcc.help, perhaps.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq
Nov 13 '05 #2
On Sun, 07 Dec 2003 00:23:11 GMT, in comp.lang.c , Jack Klein
<ja*******@spamcop.net> wrote:
On 6 Dec 2003 14:58:29 -0800, Er********@sbcglobal.net (Ernst Berg)
wrote in comp.lang.c:
I am learning about the GMP library and it is installed correctly
here.
As Jack says, GMP is offtopic here.

My question, which I found no match (so far) in the reading of the
past few weeks of posting to this group,the FAQ, by searching the
newsgroup and web and by reading the docs, is : how do I find the MSB
of mpz_t?

Again as Jack says without knowing the type of an mpz_t its tough to
say.Third party libraries are non-standard and therefore not topical here.


I disagree - the answer to the question is in fact topical and can be
achieved using only standard C, once you know what the heck an mpz_t
is . Typically you right-shift the object by one less bit than its
width, to get the most significant bit.

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 13 '05 #3
On Sun, 07 Dec 2003 01:07:31 +0000, Mark McIntyre
<ma**********@spamcop.net> wrote in comp.lang.c:
On Sun, 07 Dec 2003 00:23:11 GMT, in comp.lang.c , Jack Klein
<ja*******@spamcop.net> wrote:
On 6 Dec 2003 14:58:29 -0800, Er********@sbcglobal.net (Ernst Berg)
wrote in comp.lang.c:
I am learning about the GMP library and it is installed correctly
here.
As Jack says, GMP is offtopic here.

My question, which I found no match (so far) in the reading of the
past few weeks of posting to this group,the FAQ, by searching the
newsgroup and web and by reading the docs, is : how do I find the MSB
of mpz_t?


Again as Jack says without knowing the type of an mpz_t its tough to
say.
Third party libraries are non-standard and therefore not topical here.


I disagree - the answer to the question is in fact topical and can be
achieved using only standard C, once you know what the heck an mpz_t
is . Typically you right-shift the object by one less bit than its
width, to get the most significant bit.


First, the term "MSB" is ambiguous, because it is used by different
people at different times to mean either "most significant byte" or
"most significant bit".

In the second place, without knowing the type of an mps_t, it is not
just tough but impossible to know whether your suggestion is feasible
or not. What if mpz_t is a floating point type? An array? A
structure? Even if it is a signed integer, on typical implementations
your suggestion will yield the sign bit, not a value bit.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq
Nov 13 '05 #4
On Sun, 07 Dec 2003 05:06:40 GMT, in comp.lang.c , Jack Klein
<ja*******@spamcop.net> wrote:
First, the term "MSB" is ambiguous, because it is used by different
people at different times to mean either "most significant byte" or
"most significant bit".
Agreed. It could also mean Major Stomatchromous Bolide. Clarity, thats
the OP's problem, but it doesn't ipso factor make it OT here, merely
unclear.
In the second place, without knowing the type of an mps_t, it is not
just tough but impossible to know whether your suggestion is feasible or not.
No so. The suggestion works irrespective of the underlying data type.
It is of course not the /entire/ solution but heck people are expected
to do a little thinking of their own round here.
What if mpz_t is a floating point type? An array? A
structure?
So what? Its still a block of memory. It still some bits. Which is the
most significant is open to interpretation of course. The OP should
make clear what precisely he wanted but I strongly suspect that the
hint of using bit shifts will get him to where he needs to be, once he
things about it.
Even if it is a signed integer, on typical implementations
your suggestion will yield the sign bit, not a value bit.


Which is still, by some interpretation, the MSB. After all, which has
the largest effect on the value of the number? The OP really needs to
clarify what they want....

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 13 '05 #5
On 6 Dec 2003 14:58:29 -0800
Er********@sbcglobal.net (Ernst Berg) wrote:
I am learning about the GMP library and it is installed correctly
here.

My question, which I found no match (so far) in the reading of the
past few weeks of posting to this group,the FAQ, by searching the
newsgroup and web and by reading the docs, is : how do I find the MSB
of mpz_t?

I hope I didn't miss it if it was there.


During all that reading didn't you notice that we only discus standard C
here? GMP is off topic and we have no idea what mpz_t is, it could be a
pointer to an array of structs for all we know.

My guess is that you are probably trying to solve the wrong problem and
if you ask on a GMP mailing list, or somewhere else that GPM is on
topic, saying what you actually want to achieve then they will be able
to give you a sensible answer.
--
Mark Gordon
Paid to be a Geek & a Senior Software Developer
Although my email address says spamtrap, it is real and I read it.
Nov 13 '05 #6
Mark Gordon <sp******@flash-gordon.me.uk> wrote in message news:<20031207002030.0ac66e8b.sp******@flash-gordon.me.uk>...
On 6 Dec 2003 14:58:29 -0800
Er********@sbcglobal.net (Ernst Berg) wrote:
I am learning about the GMP library and it is installed correctly
here.

My question, which I found no match (so far) in the reading of the
past few weeks of posting to this group,the FAQ, by searching the
newsgroup and web and by reading the docs, is : how do I find the MSB
of mpz_t?

I hope I didn't miss it if it was there.


During all that reading didn't you notice that we only discus standard C
here? GMP is off topic and we have no idea what mpz_t is, it could be a
pointer to an array of structs for all we know.

My guess is that you are probably trying to solve the wrong problem and
if you ask on a GMP mailing list, or somewhere else that GPM is on
topic, saying what you actually want to achieve then they will be able
to give you a sensible answer.

Yes indeed I see that it is off topic now.

To answer a question common to all replys it's the GNU Multiple
Precision Arithmetic Library. GNU MP is a portable library written in
C for arbitrary precision arithmetic on integers, rational numbers,
and floating-point numbers. It aims to provide the fastest possible
arithmetic for all applications that need higher precision than is
directly supported by the basic C types.
Also I did join the mailing list and do understand how to find the MSB
of type mpz_t now. I thank this group for reading my request.

I have other questions that will be on topic.

Again thank you for your time.

Ernst
Nov 14 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Noam Dekers | last post by:
Hi all, I would like to find a word stored in a text file. Structure: I have one file named keyWords.txt that stores some key words I'm interested in finding. In addition I also have a file...
3
by: Richard Cavell | last post by:
#include <gmp.h> vector<mpz_t> v_bigints; v_bigints.resize(20); This fails. error: ISO C++ forbids casting to an array type '__mpz_struct' (GCC on a G4) What's wrong with this? (GMP...
1
by: hazz | last post by:
"Value cannot be null.\r\nParameter name: type" is the exception thrown after the CreateInstance method below. Type t = Type.GetType(GetConfigValue("PasswordProvider")); IPasswordProvider ppdr=...
3
by: Tor Inge Rislaa | last post by:
Finding name and type In the activate procedure of a form I want to write to the debug window, name and type of all controls at that actual form. Is there a smart way to do that? Allso for...
2
by: Alex Maghen | last post by:
I want to create a utility function that will seach the current page for one of my UserControls by it's type. So, let's say that I have a UserControl whose class I defined as follows: namespace...
2
by: Bardo | last post by:
Hi all, I am a newbie to using the XML Schema Object Model (SOM) and would like a few pointers on how to perform a particular task. I am essentially trying to search for elements/attributes via...
6
by: vaidehikedlaya | last post by:
Hello, I am using gmp.h library. I am trying to put mpz_t variable into char buffer and back. I came across mpz_import/mpz_export to suffice this purpose. But, I am not very clear about using...
7
by: Brad Baker | last post by:
I am trying to programmatically set a placeholder control in csharp which is nested inside a repeater control between <ItemTemplateand </ItemTemplate> tags, however I am running into problems. I've...
2
by: kj | last post by:
I'm a Python noob, and haven't yet figured out my way around the Python documentation. For example, suppose I learn about some great module foo.bar.baz, and when I run the python interpreter and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.