Click here to Skip to main content
15,122,149 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Get rid of _ftol2_sse Pin
Chris Losinger19-May-12 5:46
professionalChris Losinger19-May-12 5:46 
GeneralRe: Get rid of _ftol2_sse Pin
SystemFiles19-May-12 14:02
MemberSystemFiles19-May-12 14:02 
QuestionArccosinus and Arcsinus using floating point assembly Pin
SystemFiles19-May-12 3:54
MemberSystemFiles19-May-12 3:54 
AnswerRe: Arccosinus and Arcsinus using floating point assembly Pin
Luc Pattyn19-May-12 4:28
sitebuilderLuc Pattyn19-May-12 4:28 
GeneralRe: Arccosinus and Arcsinus using floating point assembly Pin
SystemFiles19-May-12 14:05
MemberSystemFiles19-May-12 14:05 
GeneralRe: Arccosinus and Arcsinus using floating point assembly Pin
SystemFiles21-May-12 11:36
MemberSystemFiles21-May-12 11:36 
AnswerRe: Arccosinus and Arcsinus using floating point assembly Pin
Luc Pattyn21-May-12 12:02
sitebuilderLuc Pattyn21-May-12 12:02 
AnswerRe: Arccosinus and Arcsinus using floating point assembly Pin
cmk21-May-12 13:29
Membercmk21-May-12 13:29 
Here's some old code that may help:

double  Vk05Pi = 1.5707963267948966192313216916398;


#define  MTH_ASM_IS0(LABEL_IS0)  __asm \
{ \
	__asm  ftst        \
	__asm  fnstsw  ax  \
	__asm  test    ah, 40h   \
	__asm  jne     LABEL_IS0 \
}
#define  MTH_ASM_IS1(LABEL_IS1)  __asm \
{ \
	__asm  fld1        \
	__asm  fcomp       \
	__asm  fnstsw  ax  \
	__asm  test    ah, 40h   \
	__asm  jne     LABEL_IS1 \
}


//  arcsine:   atan( sqrt( A*A / (1-A*A) ) )
//
double  FkASinR( double A )
{
	if( A > 1 )  return(0);
	#ifndef  MTH_ASM_USE
	A *= A;
	if( FkIs1(A, DBL_MIN) )  return(Vk05Pi);
	return( atan( sqrt(A/(1-A)) ) );
	#else
	__asm {
		fld    A
		fmul   A
		MTH_ASM_IS1(isone)
		fld    st(0)
		fld1
		fsubr  // 1 - A*A
		fdiv   // A*A / (1-A*A)
		fsqrt
		fld1
		fpatan
		jmp    end
		isone:
		fstp   A
		fld    Vk05Pi
		end:
		fstp   A
	}
	return(A);
	#endif
}


//  arccosine: atan( sqrt( (1-A*A) / (A*A) ) )
//
double  FkACosR( double A )
{
	#ifndef  MTH_ASM_USE
	A *= A;
	if( FkIs0(A, DBL_MIN) )  return(Vk05Pi);
	return( atan( sqrt((1-A)/A) ) );
	#else
	__asm {
		fld    A
		fmul   A
		MTH_ASM_IS0(iszero)
		fld    st(0)
		fld1
		fsubr  // 1 - A*A
		fdivr  // (1-A*A) / A*A
		fsqrt
		fld1
		fpatan
		jmp    end
		iszero:
		fstp   A
		fld    Vk05Pi
		end:
		fstp   A
	}
	return(A);
	#endif
}

...cmk

The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack

GeneralRe: Arccosinus and Arcsinus using floating point assembly Pin
SystemFiles19-Jun-12 4:21
MemberSystemFiles19-Jun-12 4:21 
GeneralDriver development help & tips Pin
Brandon-X1200018-May-12 22:45
MemberBrandon-X1200018-May-12 22:45 
GeneralRe: Driver development help & tips Pin
Richard MacCutchan18-May-12 22:56
mveRichard MacCutchan18-May-12 22:56 
GeneralRe: Driver development help & tips Pin
Brandon-X1200018-May-12 23:12
MemberBrandon-X1200018-May-12 23:12 
GeneralRe: Driver development help & tips Pin
Richard MacCutchan19-May-12 1:31
mveRichard MacCutchan19-May-12 1:31 
GeneralRe: Driver development help & tips Pin
«_Superman_»19-May-12 18:37
professional«_Superman_»19-May-12 18:37 
GeneralRe: Driver development help & tips Pin
Erudite_Eric20-May-12 22:37
MemberErudite_Eric20-May-12 22:37 
GeneralRe: Driver development help & tips Pin
Brandon-X1200020-May-12 23:49
MemberBrandon-X1200020-May-12 23:49 
GeneralRe: Driver development help & tips Pin
Erudite_Eric21-May-12 0:02
MemberErudite_Eric21-May-12 0:02 
QuestionBest way to handle errors (esp. in games) Pin
forkbomber18-May-12 12:15
Memberforkbomber18-May-12 12:15 
AnswerRe: Best way to handle errors (esp. in games) Pin
TomasRiker218-May-12 14:23
MemberTomasRiker218-May-12 14:23 
GeneralRe: Best way to handle errors (esp. in games) Pin
Stefan_Lang22-May-12 0:54
mveStefan_Lang22-May-12 0:54 
AnswerRe: Best way to handle errors (esp. in games) Pin
David Crow18-May-12 17:19
MemberDavid Crow18-May-12 17:19 
GeneralRe: Best way to handle errors (esp. in games) Pin
charlieg21-May-12 6:50
Membercharlieg21-May-12 6:50 
GeneralRe: Best way to handle errors (esp. in games) Pin
David Crow21-May-12 6:59
MemberDavid Crow21-May-12 6:59 
AnswerRe: Best way to handle errors (esp. in games) Pin
Aescleal18-May-12 23:39
MemberAescleal18-May-12 23:39 
GeneralRe: Best way to handle errors (esp. in games) Pin
forkbomber19-May-12 0:34
Memberforkbomber19-May-12 0:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.