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

Negative scalar variable comparision

Hello Friends,
Expand|Select|Wrap|Line Numbers
  1.             If 
  2.         $tmp = -524219359 ;
  3.        $tmp1= -532676607;
  4.  
  5.                 if($tmp >0 && $tmp1>0){
  6.                      print(Temporary values are greater than Zero);
  7.                 else {
  8.                     print(Temporary values are less than zero);
  9.                 }
  10.  
May i know what is the result we can get & with some explanation?


Thanks
Raghavendra
Nov 1 '08 #1
3 1883
Hello friends,
I got doubt in doing signed hexadecimal comparision.
Here $tmp & tmp1 are negative decimal values , when i convert that numbers as hexadecimal & comparing with the mentioned below i am getting wrong result.
May i the ultimate solution for signed comparision in perl
Expand|Select|Wrap|Line Numbers
  1.  $tmp  = 0xc0211082;
  2.  $tmp1 = 0xc0000082;
  3.  
  4. if($tmp >0 && $tmp1>0){
  5. print("Temporary values are greater than Zero");
  6. }else {
  7. print("Temporary values are less than zero");
  8. }
  9.  
Nov 1 '08 #2
KevinADC
4,059 Expert 2GB
Hello Friends,
Expand|Select|Wrap|Line Numbers
  1.             If 
  2.         $tmp = -524219359 ;
  3.        $tmp1= -532676607;
  4.  
  5.                 if($tmp >0 && $tmp1>0){
  6.                      print(Temporary values are greater than Zero);
  7.                 else {
  8.                     print(Temporary values are less than zero);
  9.                 }
  10.  
May i know what is the result we can get & with some explanation?


Thanks
Raghavendra
Correct all syntax errors and retry your code. Its pretty much worthless to ask a question then post bad code, we have no way of knowing if you are getting an error from the bad code or if you are using good code and getting an unusual return value, or what? So please try and always post code that has no syntax errors.
Nov 1 '08 #3
Hello KevinADC,
I am new to perl , i am learning now, please let me know where i did wrong in my code which i have posted? & it would be helpful for me if u guide me by giving answers to my questions,i am very thankfull for you & its very proud for me by learing perl under your guidance.

Thanks
Raghavendra
Nov 3 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: roger | last post by:
I'm having difficulties invoking a user defined table function, when passing to it a parameter that is the result of another user defined function. My functions are defined like so: drop...
2
by: Tom | last post by:
In C, I can just read the K&R book and know how everything is pretty much coded at the machine level. At least to some extent. But how does Perl know when you type print $ref for example...
1
by: G Fernandes | last post by:
Hi, can someone tell me what the following words mean as per C/clc: 1) token 2) token sequence 3) scalar variable 4) vector
3
by: Ken Adeniji | last post by:
Must declare the scalar variable '@FirstName' ContactGridViewWebForm.aspx <aspqlDataSource RunAt="server" ID="SqlDataSourceContact" ...
3
by: kd | last post by:
Hi All, How to perform case-insensitive comparision of strings? Would there be some kind of an indicator, which when set to true, would allow case-insenitive comparision of strings using...
5
by: Eli | last post by:
Hi, I want to check whether a value is a scalar. A scalar can be: - None (null) - string - number (integer, float) - boolean How can I validate a value is one of these types? I care about...
2
by: Oded Dror | last post by:
Hi there, Please take a look at the source code and tell me whats wrong? Imports System.Data Imports System.Data.SqlClient Partial Class Test Inherits System.Web.UI.Page Const conString As...
5
by: robert | last post by:
Turning algs for old NumPy modules into numpy code I suffer from this: Upon further processing of returns of numpy calculations, lots of data in an apps object tree will become elementary numpy...
0
by: roamnet | last post by:
hi i created database file with .mdf extention ,sql server as a source and use grid view to display data there're no problem in data retrieve and display,but i want to edit it or insert new...
1
by: Tony M | last post by:
vs 2005 - vb .net - web forms - xp pro Can't figure out why I keep getting the error Must declare the scalar variable "@CheckUser". The error happens on SqlDA.Fill(SqlDS). Just trying to make...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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?
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
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.