summaryrefslogtreecommitdiff
path: root/libc/i386fp/fabs.x
blob: fe81676c5e982c7a18235f41ba676bba9c6626de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
! bcc 386 floating point routines (version 2) -- _fabs
! author: Bruce Evans

#include "fplib.h"

! double fabs(double value);
! returns the absolute value of a number
! this works for all NaNs, like the 80*87 fabs, but perhaps we should check
! for exceptions that can happen when an 80*87 register is loaded

	.globl	_fabs
	.align	ALIGNMENT
_fabs:
	mov	eax,PC_SIZE+D_LOW[esp]
	mov	edx,PC_SIZE+D_HIGH[esp]
	and	edx,~D_SIGN_MASK
	ret