Subversion Repositories Kolibri OS

Rev

Go to most recent revision | 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
 
4
NaN:
5
	.long	  0x00000000, 0xFFF80000
6
 
7
MK_C_SYM(sincos)
8
 
9
	/* void sincos(double *cosine, double *sine, double x); */
10
 
11
	movl	16(%esp), %ecx
12
 
13
	movl	4(%esp), %eax		/* Point to cosine. */
14
	movl	8(%esp), %edx		/* Point to sine. */
15
 
16
	andl	$0x7FF00000, %ecx	/* Examine exponent of x. */
17
	cmpl	$0x43E00000, %ecx	/* |x| >= 2^63 */
18
	jae	bigarg
19
 
20
	fldl	12(%esp)
21
	fsincos
22
	fstpl	(%eax)			/* cos */
23
	fstpl	(%edx)			/* sin */
24
	ret
25
 
26
bigarg:
27
	cmpl	$0x7FF00000, %ecx	/* x is INF or NaN. */
28
	jb	finite
29
	movl	NaN, %ecx		/* Return -NaN */
30
	movl	%ecx, (%eax)
31
	movl	%ecx, (%edx)
32
	movl	NaN+4, %ecx
33
	movl	%ecx, 4(%eax)
34
	movl	%ecx, 4(%edx)
35
	movl	$1, C_SYM(errno)
36
	ret
37
 
38
finite:
39
	fld1
40
	fstpl	(%eax)			/* cos = 1. */
41
	fldz
42
	fstpl	(%edx)			/* sin = 0. */
43
	ret