Click here to Skip to main content
15,886,110 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Get rid of _ftol2_sse Pin
Chris Losinger19-May-12 4:46
professionalChris Losinger19-May-12 4:46 
GeneralRe: Get rid of _ftol2_sse Pin
SystemFiles19-May-12 13:02
SystemFiles19-May-12 13:02 
QuestionArccosinus and Arcsinus using floating point assembly Pin
SystemFiles19-May-12 2:54
SystemFiles19-May-12 2:54 
AnswerRe: Arccosinus and Arcsinus using floating point assembly Pin
Luc Pattyn19-May-12 3:28
sitebuilderLuc Pattyn19-May-12 3:28 
GeneralRe: Arccosinus and Arcsinus using floating point assembly Pin
SystemFiles19-May-12 13:05
SystemFiles19-May-12 13:05 
GeneralRe: Arccosinus and Arcsinus using floating point assembly Pin
SystemFiles21-May-12 10:36
SystemFiles21-May-12 10:36 
AnswerRe: Arccosinus and Arcsinus using floating point assembly Pin
Luc Pattyn21-May-12 11:02
sitebuilderLuc Pattyn21-May-12 11:02 
AnswerRe: Arccosinus and Arcsinus using floating point assembly Pin
cmk21-May-12 12:29
cmk21-May-12 12: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 3:21
SystemFiles19-Jun-12 3:21 
GeneralDriver development help & tips Pin
Brandon-X1200018-May-12 21:45
Brandon-X1200018-May-12 21:45 
GeneralRe: Driver development help & tips Pin
Richard MacCutchan18-May-12 21:56
mveRichard MacCutchan18-May-12 21:56 
GeneralRe: Driver development help & tips Pin
Brandon-X1200018-May-12 22:12
Brandon-X1200018-May-12 22:12 
GeneralRe: Driver development help & tips Pin
Richard MacCutchan19-May-12 0:31
mveRichard MacCutchan19-May-12 0:31 
GeneralRe: Driver development help & tips Pin
«_Superman_»19-May-12 17:37
professional«_Superman_»19-May-12 17:37 
GeneralRe: Driver development help & tips Pin
Erudite_Eric20-May-12 21:37
Erudite_Eric20-May-12 21:37 
GeneralRe: Driver development help & tips Pin
Brandon-X1200020-May-12 22:49
Brandon-X1200020-May-12 22:49 
GeneralRe: Driver development help & tips Pin
Erudite_Eric20-May-12 23:02
Erudite_Eric20-May-12 23:02 
QuestionBest way to handle errors (esp. in games) Pin
forkbomber18-May-12 11:15
forkbomber18-May-12 11:15 
AnswerRe: Best way to handle errors (esp. in games) Pin
TomasRiker218-May-12 13:23
TomasRiker218-May-12 13:23 
GeneralRe: Best way to handle errors (esp. in games) Pin
Stefan_Lang21-May-12 23:54
Stefan_Lang21-May-12 23:54 
AnswerRe: Best way to handle errors (esp. in games) Pin
David Crow18-May-12 16:19
David Crow18-May-12 16:19 
GeneralRe: Best way to handle errors (esp. in games) Pin
charlieg21-May-12 5:50
charlieg21-May-12 5:50 
GeneralRe: Best way to handle errors (esp. in games) Pin
David Crow21-May-12 5:59
David Crow21-May-12 5:59 
AnswerRe: Best way to handle errors (esp. in games) Pin
Aescleal18-May-12 22:39
Aescleal18-May-12 22:39 
GeneralRe: Best way to handle errors (esp. in games) Pin
forkbomber18-May-12 23:34
forkbomber18-May-12 23: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.