Lost Password?


Go Back   CodeCall Programming Forum > Software Development > C and C++

C and C++ C and C++ forum for discussing all forms of C except for C#. These languages are powerful low level languages used for creating Operating Systems, Device Drivers, compilers and much more.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-08-2008, 08:15 AM
payam.a payam.a is offline
Newbie
 
Join Date: Jun 2008
Posts: 12
Rep Power: 0
payam.a is on a distinguished road
Question fabs()function

Hi dear friends;
please explain for me what does fabs() function do?
if you can please attach a code that is contained fabs() function's job.
thanks
payam
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 07-08-2008, 11:12 AM
Aereshaa's Avatar   
Aereshaa Aereshaa is offline
Guru
 
Join Date: Apr 2008
Posts: 539
Rep Power: 9
Aereshaa is a jewel in the roughAereshaa is a jewel in the roughAereshaa is a jewel in the roughAereshaa is a jewel in the rough
Default Re: fabs()function

It gives the absolute (unsigned) value of a floating-point number.
Code:
fabs(-0.3) // 0.3
fabs(+0.3) // 0.3
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 07-09-2008, 07:26 AM
payam.a payam.a is offline
Newbie
 
Join Date: Jun 2008
Posts: 12
Rep Power: 0
payam.a is on a distinguished road
Question Re: fabs()function

thanks my dear friend;
I didn't undrestand what you mean by absolute?
can you explain more for me?
thanks
payam
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 07-09-2008, 08:31 AM
Aereshaa's Avatar   
Aereshaa Aereshaa is offline
Guru
 
Join Date: Apr 2008
Posts: 539
Rep Power: 9
Aereshaa is a jewel in the roughAereshaa is a jewel in the roughAereshaa is a jewel in the roughAereshaa is a jewel in the rough
Default Re: fabs()function

Well, I guess the best way to explain it is by giving source:
Code:
unsigned double fabs(signed double n){
    if(n >= 0)return n; //if positive, return without ant change
    else return 0 - n; //if negative, return a positive version
    }
So, it strips away the sign, leaving an unsigned version.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 07-09-2008, 08:57 AM
payam.a payam.a is offline
Newbie
 
Join Date: Jun 2008
Posts: 12
Rep Power: 0
payam.a is on a distinguished road
Smile Re: fabs()function

thanks dear friend for your fast reply;
let me know if I am wrong about your reply.
you mean that with fabs() function bouth positive and negativ numbers will be positive.
thanks
payam
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 07-09-2008, 10:11 AM
Aereshaa's Avatar   
Aereshaa Aereshaa is offline
Guru
 
Join Date: Apr 2008
Posts: 539
Rep Power: 9
Aereshaa is a jewel in the roughAereshaa is a jewel in the roughAereshaa is a jewel in the roughAereshaa is a jewel in the rough
Default Re: fabs()function

That's exactly right.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 07-11-2008, 07:41 AM
payam.a payam.a is offline
Newbie
 
Join Date: Jun 2008
Posts: 12
Rep Power: 0
payam.a is on a distinguished road
Question Re: fabs()function

thanks dear friend that you answer my questions.
now I have a new question :
what are the differences between abs() and fabs() functions?
because you know abs() function do the same job.
thanks
payam
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 07-11-2008, 09:38 AM
MeTh0Dz MeTh0Dz is offline
SLICE OWNZ YOUR SOUL
 
Join Date: May 2008
Posts: 294
Last Blog:
Ternary Operator CPP
Rep Power: 0
MeTh0Dz has a spectacular aura aboutMeTh0Dz has a spectacular aura aboutMeTh0Dz has a spectacular aura about
Default Re: fabs()function

DELETED

Yeah, Slice Ownz Your Posts.

Get over it

/Talk

Last edited by xXHalfSliceXx; 07-14-2008 at 10:02 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 07-11-2008, 04:04 PM
dargueta dargueta is offline
Guru
 
Join Date: Oct 2007
Age: 18
Posts: 793
Last Blog:
Programs Under the Hoo...
Rep Power: 13
dargueta is a jewel in the roughdargueta is a jewel in the roughdargueta is a jewel in the roughdargueta is a jewel in the rough
Default Re: fabs()function

MeTh0Dz, what is your problem? Instead of calling people various names which you're too "polite" to print in full, just shut up and help them or take your attitude somewhere else.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 07-11-2008, 04:38 PM
MeTh0Dz MeTh0Dz is offline
SLICE OWNZ YOUR SOUL
 
Join Date: May 2008
Posts: 294
Last Blog:
Ternary Operator CPP
Rep Power: 0
MeTh0Dz has a spectacular aura aboutMeTh0Dz has a spectacular aura aboutMeTh0Dz has a spectacular aura about
Default Re: fabs()function

To polite to print in full? See there you go again, commenting when you don't even know what you are talking about. The site automatically blocks some of the words I like to use bud. All I am saying is there are too many people who won't even go look up stuff on their own, they just want people to hand them information.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT -5. The time now is 11:36 AM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 101%


Complete - Celebrate!

Ads