-
$tmp = 0xc0211082;
-
$tmp1 = 0xc0000082;
-
Hello friends,
I got doubt when i am converting negative hexadecimal to a decimal number.Please look at mentioned example below.
In the below example my question is when i am converting an hexadecimal to an decimal number i am getting integer overflow in hexadecimal? But the actual values of $tmp & $tmp1 in decimal is signed numbers i.e -1071574910,-1073741694 respectively.
How to manipulate this type of situations? -
$tmp = 0xc0211082;
-
$tmp1 = 0xc0000082;
-
-
$tmp2_dec = hex($tmp);
-
$tmp3_dec = hex($tmp1);
-
-
printf("Decimal Value tmp is %d \n",$tmp);
-
printf("Decimal Value tmp1 is %d \n",$tmp1);
-
printf("Decimal Value tmp2 is %d \n",$tmp2_dec);
-
printf("Decimal Value tmp3 is %d \n",$tmp3_dec);
-
-
if($tmp2_dec >0 && $tmp3_dec >0){
-
print("Temporary values are greater than Zero \n");
-
}else {
-
print("Temporary values are less than zero \n");
-
}
-
Thanks
Raghavendra
5 6388
Hello,
Can you please be clear about what your are trying to explain me.
Thanks
Raghavendra
KevinADC 4,059
Recognized Expert Specialist
please read the links next time: - $tmp2_dec = oct('0xc0211082');
-
$tmp3_dec = oct('0xc0000082');
-
-
print "$tmp2_dec $tmp3_dec\n";
-
-
$t2 = sprintf "%d", $tmp2_dec;
-
$t3 = sprintf "%d", $tmp3_dec;
-
-
print "$t2 $t3\n";
-
-
printf ("Decimal Value tmp is %d \n",$tmp2_dec);
-
printf("Decimal Value tmp1 is %d \n",$tmp3_dec);
-
-
if($t2 > 0 && $t3 > 0){
-
print("Temporary values $t2 and $t3 are greater than Zero \n");
-
}else {
-
print("Temporary values $t2 and $t3 are less than zero \n");
-
}
Thank you very much kevin
Can u please provide me some useful links of perl, i need to write automation script for assembly instructions & need to generate .asm file..
Thanks
Raghvendra
KevinADC 4,059
Recognized Expert Specialist Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Tom Goulet |
last post by:
Hello,
My question basically is: What is the opposite of the following?
| "%08X" % -1
I want to convert a string of hexadecimal characters to the signed
integer they would have been before the <print> statement converted
them. How do I do this in such a way that is compatible with Python
versions 1.5.2 through 2.4, and not machine-dependent?
|
by: Keith |
last post by:
I've been reading and looking on the internet - but I just can't fin
this. Perhaps I'm approaching this the wrong way - code-wise
I'm attempting to learn how "things" work in VBNET by creating
small app - 3 textbox objects. I want the user to input data int
textbox1 and textbox2 - and then click on a button - which will tak
the values to textbox1 and textbox2 and multiply them together. Th
result - displays in textbox 3
I think I'm...
|
by: junky_fellow |
last post by:
Is there any way by which the overflow during addition of two integers
may
be detected ?
eg.
suppose we have three unsigned integers, a ,b, c.
we are doing a check like
if ((a +b) > c)
do something;
|
by: Chris Botha |
last post by:
Hi, I have an UInt32 and want to stick the value into an Integer and get an
Overflow exception, BUT using C# the same value can be casted into an int
and the value is as expected. The Hex value is FFFFFFDB, which should
be -37.
Thanks.
|
by: jaks.maths |
last post by:
How to convert negative integer to hexadecimal or octal number?
Ex: -568
What is the equivalent hexadecimal and octal number??
| |
by: Robert Seacord |
last post by:
The CERT/CC has released a beta version of a secure integer library for
the C Programming Language. The library is available for download from
the CERT/CC Secure Coding Initiative web page at:
http://www.cert.org/secure-coding/
The purpose of this library is to provide a collection of utility
functions that can assist software developers in writing C programs that
are free from common integer problems such as integer overflow, integer...
|
by: Freaker85 |
last post by:
Hello,
I am new at programming in C and I am searching a manner to parse a
string into an integer.
I know how to do it in Java, but that doesn't work in C ;o)
I searched the internet but I didn't found it yet.
help please
thank you
Freaker85
|
by: thomas.mertes |
last post by:
Is it possible to use some C or compiler extension to catch
integer overflow?
The situation is as follows:
I use C as target language for compiled Seed7 programs.
For integer computions the C type 'long' is used.
That way native C speed can be reached.
Now I want to experiment with raising a Seed7 exception
(which is emulated with setjmp(), longjmp() in C) for integer
|
by: Chris Becke |
last post by:
I *know* my CPU has opcodes that can do this - when adding (or subtracting) there is a carry flag that can be invoked to make the result essentially 1 bit longer than the data size used in calculations.
When multiplying two numbers, the CPU automatically returns a double width result.
c & c++ give programmers these bloody ridiculous integer types of undetermined size and no really optimal way to even build a variable width number library...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |