Fast sqrt

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
siberianstar
Posts: 70
Joined: Thu Jun 22, 2006 9:24 pm

Fast sqrt

Post by siberianstar »

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 ?
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

The allegrex FPU doesn't do doubles
ector
Posts: 195
Joined: Thu May 12, 2005 10:22 pm

Post by ector »

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.
siberianstar
Posts: 70
Joined: Thu Jun 22, 2006 9:24 pm

Post by siberianstar »

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.
RATiX
Posts: 48
Joined: Sat Apr 30, 2005 5:02 pm

Post by RATiX »

comparing squares is much more efficient than comparing roots.
siberianstar
Posts: 70
Joined: Thu Jun 22, 2006 9:24 pm

Post by siberianstar »

i know =) don't take me like a stupid
Post Reply