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 

ATan() possible?

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



Joined: 01 Jul 2005
Posts: 197

PostPosted: Thu Jul 14, 2005 7:20 pm    Post subject: ATan() possible? Reply with quote

I have come to a snag in my current project which requires an ATan function. I don't think that this can be solved by a simple array of numbers like sin and cos. There 'seems' to be sceFpuSin and sceFpuCos, but I can't see a sceFpuATan function. I couldn't see a function like this in the PSPSDK, and was wondering if somebody can think of a solution to this.

Thanks.
Back to top
View user's profile Send private message
nol33t



Joined: 10 Jul 2005
Posts: 1

PostPosted: Thu Jul 14, 2005 8:27 pm    Post subject: Reply with quote

use the math lib ( #include<math.h> and -lm at the link )

see also http://forums.ps2dev.org/viewtopic.php?p=19341#19341

Code:

Mathematical Library Functions                           atan(3M)

NAME
     atan - arc tangent function

SYNOPSIS
     cc [ flag ... ] file ... -lm [ library ... ]
     #include <math.h>

     double atan(double x);

DESCRIPTION
     The atan() function computes the principal value of the  arc
     tangent of x.
Back to top
View user's profile Send private message
Treat



Joined: 26 Sep 2004
Posts: 16

PostPosted: Thu Jul 14, 2005 8:35 pm    Post subject: Reply with quote

http://en.wikipedia.org/wiki/Taylor_series#List_of_Taylor_series_of_some_common_functions
Back to top
View user's profile Send private message
AnonymousTipster



Joined: 01 Jul 2005
Posts: 197

PostPosted: Fri Jul 15, 2005 4:01 am    Post subject: Reply with quote

Well, the compiler is finding s_atan.c (newlib/libm/math/s_atan.c), but it gives me lots of undefined referrences to '__adddf3' and '__muldf3'. I have #include <Math.h> and have put -lm for my linker. I think it is also finding the s_atan.o, which has been precompiled. It must be something simple, but i'm not sure what i'm doing wrong.
Back to top
View user's profile Send private message
ector



Joined: 12 May 2005
Posts: 195

PostPosted: Fri Jul 15, 2005 4:22 am    Post subject: Reply with quote

Avoid double precision math on the PSP as it is likely to be dog slow because of the lack of double precision floating point hardware. It has a fast single precision FPU though, not to speak of the VFPU which still has not been publically documented..
Back to top
View user's profile Send private message
pixel



Joined: 30 Jan 2004
Posts: 791

PostPosted: Fri Jul 15, 2005 4:25 am    Post subject: Reply with quote

Missing -lgcc, obviously.
_________________
pixel: A mischievous magical spirit associated with screen displays. The computer industry has frequently borrowed from mythology. Witness the sprites in computer graphics, the demons in artificial intelligence and the trolls in the marketing department.
Back to top
View user's profile Send private message
AnonymousTipster



Joined: 01 Jul 2005
Posts: 197

PostPosted: Fri Jul 15, 2005 5:25 am    Post subject: Reply with quote

I've put the -lgcc in, and that stops the errors, but the compiler complains : psp-ld: cannot find -lgcc.
Back to top
View user's profile Send private message
pixel



Joined: 30 Jan 2004
Posts: 791

PostPosted: Fri Jul 15, 2005 7:30 am    Post subject: Reply with quote

Something's wrong with your toolchain then. Look if the libgcc.a file is in the toolchain directory. If yes, the toolchain is misplaced, and you need a -L on the command line to specify the path to libgcc.a. If no, your toolchain is fucked up and there's nothing I can do about it.
_________________
pixel: A mischievous magical spirit associated with screen displays. The computer industry has frequently borrowed from mythology. Witness the sprites in computer graphics, the demons in artificial intelligence and the trolls in the marketing department.
Back to top
View user's profile Send private message
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Fri Jul 15, 2005 7:34 am    Post subject: Reply with quote

Well, you could just tell him to link with psp-gcc and not psp-ld, since that's what we've told everyone else who has the same problem.
Back to top
View user's profile Send private message
pixel



Joined: 30 Jan 2004
Posts: 791

PostPosted: Fri Jul 15, 2005 8:48 am    Post subject: Reply with quote

Aaaahhh, indeed, I didn't see he was using psp-ld and not psp-gcc...
_________________
pixel: A mischievous magical spirit associated with screen displays. The computer industry has frequently borrowed from mythology. Witness the sprites in computer graphics, the demons in artificial intelligence and the trolls in the marketing department.
Back to top
View user's profile Send private message
AnonymousTipster



Joined: 01 Jul 2005
Posts: 197

PostPosted: Fri Jul 15, 2005 7:33 pm    Post subject: Reply with quote

Well, the main part of my .sh file looks like this:
Code:
psp-gcc -g -c hellopsp.c
psp-gcc -g -c AnTi2D.c
psp-gcc -g -c -xassembler -O -o startup.o startup.S
psp-gcc -O0 startup.o hellopsp.o AnTi2D.o  -lgcc -lm -M -Ttext 8900000 -q -o  out > hellopsp.map
Whearas it looked like:
Code:
psp-gcc -g -c hellopsp.c
psp-gcc -g -c AnTi2D.c
psp-gcc -g -c -xassembler -O -o startup.o startup.S
psp-ld -O0 startup.o hellopsp.o AnTi2D.o  -lgcc -lm -M -Ttext 8900000 -q -o  out > hellopsp.map
When there was the -lgcc not found error.
With the new script, I am getting 'linker input file not used because linking not done'.
I haven't used cygwin and gcc before, so any help will be appreciated, and thanks for being understanding.
Back to top
View user's profile Send private message
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Sat Jul 16, 2005 4:06 am    Post subject: Reply with quote

Switch to PSPSDK and all of these problems will go away.

http://wiki.ps2dev.org/psp:programming_faq
Back to top
View user's profile Send private message
AnonymousTipster



Joined: 01 Jul 2005
Posts: 197

PostPosted: Sat Jul 16, 2005 10:25 pm    Post subject: Reply with quote

Ok, thanks, I'll get onto porting it after my first release.
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