Subversion Repositories Kolibri OS

Rev

Rev 4973 | Details | Compare with Previous | 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
 
5098 clevermous 9
	/* void sincos(double x, double *sine, double *cosine); */
4973 right-hear 10
 
5098 clevermous 11
	movl	8(%esp), %ecx
4973 right-hear 12
 
5098 clevermous 13
	movl	16(%esp), %eax		/* Point to cosine. */
14
	movl	12(%esp), %edx		/* Point to sine. */
4973 right-hear 15
 
16
	andl	$0x7FF00000, %ecx	/* Examine exponent of x. */
17
	cmpl	$0x43E00000, %ecx	/* |x| >= 2^63 */
18
	jae	bigarg
19
 
5098 clevermous 20
	fldl	4(%esp)
4973 right-hear 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