forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Fast sqrt

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
siberianstar



Joined: 22 Jun 2006
Posts: 70

PostPosted: Wed Jul 19, 2006 8:07 am    Post subject: Fast sqrt Reply with quote

Hello,

for the float type i've made

inline float fastsqrt(float c)
{
float output;
asm("sqrt.s %0,%1" : "=f" (output) : "f" (c));
return output;
}

but this does not work for double type. There is an asm instruction that is "sqrt.d" that is for double type, but if i try to compile:


inline double fastsqrt(double c)
{
double output;
asm("sqrt.d %0,%1" : "=f" (output) : "f" (c));
return output;
}

it gives operand error. Why ?
Back to top
View user's profile Send private message
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Wed Jul 19, 2006 10:53 am    Post subject: Reply with quote

The allegrex FPU doesn't do doubles
Back to top
View user's profile Send private message
ector



Joined: 12 May 2005
Posts: 195

PostPosted: Wed Jul 19, 2006 6:28 pm    Post subject: Reply with quote

If you're writing games, you don't need doubles. If you think you do, you're wrong :) That's why there is no hardware support.
_________________
http://www.dtek.chalmers.se/~tronic/PSPTexTool.zip Free texture converter for PSP with source. More to come.
Back to top
View user's profile Send private message
siberianstar



Joined: 22 Jun 2006
Posts: 70

PostPosted: Thu Jul 20, 2006 2:35 am    Post subject: Reply with quote

sure.

I found in the MIPS R4000 manual that double were supported. After i read that psp has a custom cpu and there is no support for double.
Back to top
View user's profile Send private message
RATiX



Joined: 30 Apr 2005
Posts: 48

PostPosted: Thu Jul 20, 2006 5:49 am    Post subject: Reply with quote

comparing squares is much more efficient than comparing roots.
Back to top
View user's profile Send private message
siberianstar



Joined: 22 Jun 2006
Posts: 70

PostPosted: Thu Jul 20, 2006 9:45 am    Post subject: Reply with quote

i know =) don't take me like a stupid
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group