Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4973 right-hear 1
/* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
2
#include
3
NaN:
4
	.long	0xFFC00000
5
 
6
ninf:
7
	.long	0xFF800000
8
 
9
pinf:
10
	.long	0x7F800000
11
 
12
.text
13
MK_C_SYM(log1p)					/* ln(1.+x) */
14
					/* log1p(x) */
15
	movl	8(%esp), %eax
16
	movl	%eax, %edx
17
 
18
	cmpl	$0xBFF00000,%eax	/* x <= -1 ? */
19
	jae	nonpos
20
 
21
	andl	$0x7FF00000,%eax
22
	cmpl	$0x7FF00000,%eax
23
	je	abarg			/* x == +inf or +NaN */
24
 
25
	movl	%edx, %eax
26
	andl	$0x7FFFFFFF,%eax
27
	cmpl	$0x3FD2BEC3,%eax	/* 1 - sqrt(0.5) */
28
	fldln2				/* ln(2) */
29
	jbe	1f
30
	fld1
31
	faddl	4(%esp)
32
	fyl2x				/* logi(x) */
33
	ret
34
1:					/* log1pi(x) */
35
	fldl	4(%esp)
36
	fyl2xp1
37
	ret
38
 
39
nonpos:
40
	cmpl	$0xBFF00000,%eax
41
	ja	badarg			/* x == -1 ? */
42
	movl	4(%esp), %eax
43
	testl %eax, %eax
44
	jz	negone
45
 
46
badarg:
47
	movl	$1, C_SYM(errno)
48
	flds	NaN
49
	ret
50
 
51
negone:
52
	movl	$2, C_SYM(errno)
53
	flds	ninf			/* arg == -1; load -inf. */
54
	ret
55
 
56
abarg:
57
	movl	%edx, %eax
58
	testl	$0x000FFFFF, %eax
59
	jnz	badarg
60
	movl	4(%esp), %eax
61
	testl	%eax, %eax
62
	jnz	badarg
63
 
64
	flds	pinf			/* arg = +inf */
65
	ret