Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting absolute value of a float

Status
Not open for further replies.

kenshinofkin

Programmer
Dec 1, 2008
1
I am using Cygwin and gcc to create a function that gets the absolute value of a float. Is fabs the instruction to use to get the absolute value?
asm("lea %[nIn],%%edi \n"
"fabs \n"
"mov %%edi,%[nOut] \n"

: [nOut] "=m" (n)
: [nIn] "m" (n)

);

'n' is a double. What do I pass to fabs or does it check a register?

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top