LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Closed Thread
  Search this Thread
Old 06-06-2008, 01:20 PM   #1
aonks
LQ Newbie
 
Registered: Jun 2008
Posts: 9

Rep: Reputation: 0
absolute value urgent


can someone please tell me the inline assembly code to find the absolute value of a double variable ??

it is very urgent ...


i'm using GCC in Cygwin

reply soon
 
Old 06-06-2008, 01:55 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
This isn't urgent for anyone but you. Flagging a post as urgent won't make people respond to you any quicker, and makes alot of folks ignore your post.

This is also a duplicate post on here, and you've posted this same question on Programmers heaven too. I found the answer via Google, on the first page of hits.
 
Old 06-06-2008, 02:02 PM   #3
aonks
LQ Newbie
 
Registered: Jun 2008
Posts: 9

Original Poster
Rep: Reputation: 0
i need a reply to my post .. which is urgent to me
so i flagged it urgent ... i can post it on as many
forums as i like .. i'm due an assignment .. and if i
don't do it .. i'll flunk .. so its really urgent 4 me
 
Old 06-06-2008, 02:20 PM   #4
snowtigger
Member
 
Registered: Mar 2005
Location: england
Distribution: slackware, win2k
Posts: 364

Rep: Reputation: 35
so go do what TB0ne done, go see the friendly google man and you will apparently find an answer, but then if you can't be bothered to look then you'll be flunking your assignment, which i'm sure you've had plenty of time to work on.

 
Old 06-06-2008, 02:31 PM   #5
aonks
LQ Newbie
 
Registered: Jun 2008
Posts: 9

Original Poster
Rep: Reputation: 0
don't u think .. i would have googled it up ... i'm doing everything i can .. and i dont understand
why people have to be so rude and inconsiderate about it.
 
Old 06-06-2008, 02:37 PM   #6
snowtigger
Member
 
Registered: Mar 2005
Location: england
Distribution: slackware, win2k
Posts: 364

Rep: Reputation: 35
i don't think any of us are being rude and inconsiderate about it. It looks like you've joined up here to get an answer for your assignment which you can't be bothered to look for.

Perhaps if you'd asked people if they know of any good online references to your problem, and not put urgent in your title then you would have got some better replies.

 
Old 06-06-2008, 02:47 PM   #7
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
People who only post to get random internet strangers to do their homework tend not to get very far here. Most of us left school some time ago and have little desire to do homework for fun.

Post your workings here, show us what you do know and you are likely to get helped (but not given the answer). If you don't understand the class, you have 2 options: talk to your teacher or leave the class.
 
Old 06-06-2008, 02:55 PM   #8
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by aonks View Post
i need a reply to my post .. which is urgent to me
so i flagged it urgent ... i can post it on as many
forums as i like .. i'm due an assignment .. and if i
don't do it .. i'll flunk .. so its really urgent 4 me
I didn't say you couldn't post it anywhere else. Doesn't matter if you post it to a ton of other forums. People here volunteer their time and knowledge, to help folks.

If you need this info, and it's for a school assignment, it's probably in your books or other reference material. I found it on Google, so playing the "I'm going to flunk, help me" pity card will get you nowhere.

In short: do your own homework, and if you can't (and don't want to ask professors/teachers for help), that's your problem. Real life is far worse than school, so if you're looking for handouts now, you're in for a real shock after graduation.
 
Old 06-06-2008, 03:06 PM   #9
aonks
LQ Newbie
 
Registered: Jun 2008
Posts: 9

Original Poster
Rep: Reputation: 0
now .. i'm not asking for a complete solution, just help me out a little to figure my way out.

i have 2 approaches 2 my problem -

1) if my no. is less than 0, i multiply it by -1

2) i 'logically and' the no. with '7FFFFFFFFFFFFFFFh' to clear the sign bit.

.. now logically i can solve it, but need help with the syntax ..
 
Old 06-06-2008, 04:20 PM   #10
dmail
Member
 
Registered: Oct 2005
Posts: 970

Rep: Reputation: Disabled
Quote:
Originally Posted by aonks View Post
...
2) i 'logically and' the no. with '7FFFFFFFFFFFFFFFh' to clear the sign bit.

...
That is not going to work, remember your logic tables? 0 & 1 = 0, 1 & 1 = 1. As one denotes a negative floating point number anding it with one has no effect it will still be negative.

Oops I must be sleepy you are not effecting the sign bit at all with "7FFFFFFFFFFFFFFF" (I read that as all F's)

Last edited by dmail; 06-06-2008 at 04:27 PM.
 
Old 06-06-2008, 04:29 PM   #11
aonks
LQ Newbie
 
Registered: Jun 2008
Posts: 9

Original Poster
Rep: Reputation: 0
do u know the syntax ??
 
Old 06-06-2008, 04:32 PM   #12
dmail
Member
 
Registered: Oct 2005
Posts: 970

Rep: Reputation: Disabled
I am sorry I am not going to post an answer to a homework question added to this that my assembly is poor If I needed to do this I would use two bit shifts maybe.
 
Old 06-06-2008, 04:42 PM   #13
aonks
LQ Newbie
 
Registered: Jun 2008
Posts: 9

Original Poster
Rep: Reputation: 0
can u guide me through the multiply approach ....
if(n<0)
{
__asm__ ( "fld %1;"
"fld %2;"
"fmul;"
"fstp %0;" : "=g" (n) : "g" (n), "g" (arg2) ) ;
}


the above instruction, works for a float value.
but i 've to look for a double value .. so getting stuck here
 
Old 06-06-2008, 04:58 PM   #14
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
aonks,

Please read this thread about your thread title: http://www.linuxquestions.org/questi...95#post1730795

You may think it's urgent but marking it as so doesn't help you get answers faster. Think in a logical sense. Members here come to help people like you seeking answers from your questions in their own spare time, no one is obligated to help you, this site is free for use and it's a community that drives it.

Promotion of your thread should be like selling yourself or selling a car, a good thread title tells members what your thread is about, what your asking and if they can help or not. The generic title you provided tells us nothing and might waste a lot of peoples time.

If you were to post your car for sale, is that all you would put in the title? "Car for Sale", with no other details? Or don't you think something like "2000 Silver Mercedes Benz SL500 Low Mileage, Non Smoker, 1 Owner, Beige Leather Interior" and so on would get more attention from the people looking for such a car?

You don't want your time wasted so don't waste our members time. Create a good thread title. You say we're being rude but in fact by you wasting our time creating generic undescriptive threat titles is actually being rude in itself.
 
Old 06-06-2008, 05:01 PM   #15
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
aonks;

You've got a minimum of 3 problems here:
1. You came in demanding instant attention and then acted surprised when people chided you for it.
2. I doubt if there are many folks here who know assembly.
3. If you are about to flunk your course over this assignment, then you waited WAY to long to seek help.

Three strikes.... you're out. I'm recommending this be closed.
 
  


Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
boot sector and lilo collapse !!!!! URGENT URGENT URGEN !!!!! frelihm Linux - Software 21 12-02-2009 10:21 AM
Absolute path qspares Linux - Software 6 10-02-2007 03:11 AM
LXer: Absolute Linux is an absolute winner LXer Syndicated Linux News 0 08-07-2007 06:32 PM
Absolute addressing Glemu Programming 2 10-13-2005 02:49 PM
absolute newb and need help Troubledyouth Linux - Newbie 6 05-18-2005 11:16 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:29 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration