473,383 Members | 1,735 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,383 software developers and data experts.

How to use 64 bit integer in 16 Bit Dos ?

Hi .!
This is my first post to this community..! I am trying to use
64 bit data in 16 Bit dos.Here i have a Borland C 3.1 Compiler in which
i have data types

int = 2 byte
long = 4 byte
float = 4 byte
double =8 byte
long double =80 byte

Here i was trying to use double ..but i couldn,t read it from
the buffer i don't know why ?

Is there is any good idea to use 64 bit integer data type in dos 16..?

Thanks in Advance ..
Imayam

Jun 15 '06 #1
3 4276
"Imayam" <pr**********@gmail.com> writes:
This is my first post to this community..! I am trying to use
64 bit data in 16 Bit dos.Here i have a Borland C 3.1 Compiler in which
i have data types

int = 2 byte
long = 4 byte
float = 4 byte
double =8 byte
long double =80 byte
If you want a 64-bit data type, you could try char[8] (I presume
CHAR_BIT==8), but I doubt that that's what you had in mind.
Here i was trying to use double ..but i couldn,t read it from
the buffer i don't know why ?
I don't know why either. Nobody can possibly guess why if you don't
show us the code.
Is there is any good idea to use 64 bit integer data type in dos 16..?


Oh, you want a 64-bit *integer* type. double is a floating-point
type. Type long long is guaranteed to be at least 64 bits, but it
might not be supported by your compiler.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Jun 15 '06 #2

Keith Thompson wrote:
"Imayam" <pr**********@gmail.com> writes:
This is my first post to this community..! I am trying to use
64 bit data in 16 Bit dos.Here i have a Borland C 3.1 Compiler in which
i have data types

int = 2 byte
long = 4 byte
float = 4 byte
double =8 byte
long double =80 byte
If you want a 64-bit data type, you could try char[8] (I presume
CHAR_BIT==8), but I doubt that that's what you had in mind.
Here i was trying to use double ..but i couldn,t read it from
the buffer i don't know why ?


I don't know why either. Nobody can possibly guess why if you don't
show us the code.
Is there is any good idea to use 64 bit integer data type in dos 16..?


Oh, you want a 64-bit *integer* type. double is a floating-point
type. Type long long is guaranteed to be at least 64 bits, but it
might not be supported by your compiler.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.

Hi ..Thanks you ..thanks a lot..:)
I don't know why either. Nobody can possibly guess why if you don't
show us the code.


Sorry ....I am not writing any code as of now but my basic need is
this ,i want to handle 64 bit data so I just written some test
program..that has nthg to do i have given my code below

memcpy(&Test1,&Buf[30],8); //I am trying to copy 64 bit data from
buffer

val1 = my_atof(Test1,8); //I am using function which will
convert this to double
printf("\n val1=%lf",val1);
////////////////////////////////////
double my_atof(char *src, int len)
{
double result = 0;
char tmp,str[32],str1[32],*endptr;
int i,j;

memset(str1,NULL,32);
for (i = 0,j=len; i <=len; i++,j--)
{
tmp =(int) src [j];
itoa(tmp,str,10);
strcat(str1,str);
}

str1[32]='\0';
printf("\n STRc = %s ",str1);
result = strtod(str1,&endptr);
printf("\n RESLUT = %lf",result);
return result;
}

//////////////////////////////////

Actually I was trying to perform above function it is also not working
for me...

Consider the memory area ..It is Little Endian
0x30 : C0 19 00 00 00 00 00 00 00 00 00 00 00 00 00
-----------------------------------

if I copy the value to my variable using -->
memcpy(&Test1,&Buf[30],8);
i wil get Test1[0] = 0xC0
Test1[1]=0x19;
Test1[1]=0x00; etc....

i calling function ...........

val1 = my_atof(Test1,8);
{
tmp =(int) src [j]; //In first routine i will get
0,0,0,0,0,0,25,192
itoa(tmp,str,10); //I have to convert it to string Other wise it
will take this as
//Ascii Value...so my str
contains ="192"

strcat(str1,str); //Concatinating the string
}

at the End of the Loop i have string ---> 25192
result = strtod(str1,&endptr);
if i convert this into double -------------> i Will get 25192.00000
but the Required Output is -----------> 6592.
More over it is time consuming function. So i want to handle 64 Bit
Data Type effectively .

so How can i achive this ..??

Regards
Imayam

Jun 15 '06 #3
On 15 Jun 2006 04:41:30 -0700, in comp.lang.c , "Imayam"
<pr**********@gmail.com> wrote:
Consider the memory area ..It is Little Endian
0x30 : C0 19 00 00 00 00 00 00 00 00 00 00 00 00 00 ....at the End of the Loop i have string ---> 25192 ....but the Required Output is -----------> 6592.


This isn't a C question, its all about algorithms and data storage.

Sit down with a pencil and paper, and work out how your platform is
storing the data, so that you can work out how to read it correctly.

THEN write an algorithm to perform that read.

For more advice, I'd suggest comp.programming or one of the DOS
groups.

--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
Jun 15 '06 #4

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

Similar topics

11
by: Tony Johansson | last post by:
Hello! I have some problem with STL function remove I have two classes called Handle which is a template class and Integer which is not a template class. The Integer class is just a wrapper...
11
by: nephish | last post by:
Hello there, i need a way to check to see if a certain value can be an integer. I have looked at is int(), but what is comming out is a string that may be an integer. i mean, it will be formatted...
21
by: Frederick Gotham | last post by:
I set about trying to find a portable way to set the value of UCHAR_MAX. At first, I thought the following would work: #define UCHAR_MAX ~( (unsigned char)0 ) However, it didn't work for me....
8
by: Candace | last post by:
I am using the following code to pick off each digit of a number, from right to left. The number I am working with is 84357. So for the first iteration it should return the number 7 and for the...
1
by: charles_gero | last post by:
Hi all, I had a question about the topics in the subject and posted to comp.std.c, but feel it may also be appropriate here. Please excuse this crosspost if it is in bad form. I have a...
7
by: laura | last post by:
Hi, I have a variable of type double. I need to know if there is an integer number store there. How can I test that ? I also have a default precision for doing this operation. Many thanks,...
9
by: jacob navia | last post by:
Hi I am incorporating 128 Bit integer code into lcc-win and it would be nice to have some code to test this feature. Has anyone here code that uses 128 bit integers? Thanks in advance ...
12
by: lithiumcat | last post by:
Hi, I bothered you a while back about storing integer values in void*. Now in a completely unrelated context, I'm trying to store pointer values in an integer type. So the basic question is,...
14
by: Default User | last post by:
Hi, If I have three 64 bit integers and I want to do this operation on them: x*y/z Lets say that what we are multiplying by (y) is offset by what we are dividing by (z) so that the final...
9
by: tsuyois | last post by:
Hi, I just signed in to this excellent network. I hope I could get some answers to many questions I have in writing C compilers. My first question is: Is "integer demotion" required in...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.