| View previous topic :: View next topic |
| Author |
Message |
AnonymousTipster
Joined: 01 Jul 2005 Posts: 197
|
Posted: Thu Jul 14, 2005 7:20 pm Post subject: ATan() possible? |
|
|
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 |
|
 |
nol33t
Joined: 10 Jul 2005 Posts: 1
|
Posted: Thu Jul 14, 2005 8:27 pm Post subject: |
|
|
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 |
|
 |
Treat
Joined: 26 Sep 2004 Posts: 16
|
|
| Back to top |
|
 |
AnonymousTipster
Joined: 01 Jul 2005 Posts: 197
|
Posted: Fri Jul 15, 2005 4:01 am Post subject: |
|
|
| 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 |
|
 |
ector
Joined: 12 May 2005 Posts: 195
|
Posted: Fri Jul 15, 2005 4:22 am Post subject: |
|
|
| 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 |
|
 |
pixel
Joined: 30 Jan 2004 Posts: 791
|
Posted: Fri Jul 15, 2005 4:25 am Post subject: |
|
|
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 |
|
 |
AnonymousTipster
Joined: 01 Jul 2005 Posts: 197
|
Posted: Fri Jul 15, 2005 5:25 am Post subject: |
|
|
| I've put the -lgcc in, and that stops the errors, but the compiler complains : psp-ld: cannot find -lgcc. |
|
| Back to top |
|
 |
pixel
Joined: 30 Jan 2004 Posts: 791
|
Posted: Fri Jul 15, 2005 7:30 am Post subject: |
|
|
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 |
|
 |
mrbrown
Joined: 17 Jan 2004 Posts: 1536
|
Posted: Fri Jul 15, 2005 7:34 am Post subject: |
|
|
| 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 |
|
 |
pixel
Joined: 30 Jan 2004 Posts: 791
|
Posted: Fri Jul 15, 2005 8:48 am Post subject: |
|
|
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 |
|
 |
AnonymousTipster
Joined: 01 Jul 2005 Posts: 197
|
Posted: Fri Jul 15, 2005 7:33 pm Post subject: |
|
|
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 |
|
 |
mrbrown
Joined: 17 Jan 2004 Posts: 1536
|
|
| Back to top |
|
 |
AnonymousTipster
Joined: 01 Jul 2005 Posts: 197
|
Posted: Sat Jul 16, 2005 10:25 pm Post subject: |
|
|
| Ok, thanks, I'll get onto porting it after my first release. |
|
| Back to top |
|
 |
|