| View previous topic :: View next topic |
| Author |
Message |
pspflashsystem
Joined: 24 Mar 2008 Posts: 31
|
Posted: Sun Nov 09, 2008 5:21 am Post subject: Float variable in kernel mode? |
|
|
Hi everybody,
I want to know why when my prx is in kernel mode float variable doesn't work anymore. Indeed, when I use blit.c with:
| Code: | float psp = 5.648;
sprintf(table, "%f", psp);
|
I can only see the character string "f" instead of 5.648 :S
In user mode there's no problem with float
Thanks in advance :) _________________ I'm apologize for my bad English because I am French :)
.::pspflashsystem::. |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Sun Nov 09, 2008 8:41 am Post subject: |
|
|
| The kernel mode c lib is rather limited on what it supports. Printf formatting is not one of the things you can do. You'll have to add extra code to do that formatting for you. |
|
| Back to top |
|
 |
pspflashsystem
Joined: 24 Mar 2008 Posts: 31
|
Posted: Tue Nov 11, 2008 7:36 am Post subject: |
|
|
Well thanks JF for this information but how I can do the same type of thing like this variable?
Best regards. _________________ I'm apologize for my bad English because I am French :)
.::pspflashsystem::. |
|
| Back to top |
|
 |
OldPrisoneR
Joined: 20 Mar 2008 Posts: 53
|
Posted: Tue Nov 11, 2008 8:22 am Post subject: |
|
|
| pspflashsystem wrote: | but how I can do the same type of thing like this variable?
Best regards. |
f.e. this tricky way
| Code: | #define PRECISION 1000
#define f(a) (int)((a-(int)a)*PRECISION)
#define i(a) (int)(a)
float fl = 5.456;
printf("%d.%d\n",i(fl),f(fl)); |
LOL |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Tue Nov 11, 2008 8:42 am Post subject: |
|
|
| I don't think you get ANY formatting... you'll have to swipe the code from one of the foss implementations. I remember this from a test I did a year or so back, and it's not just floats. I'll have to check my old archives to see if I still have that, but I had to swipe some BSD formatting code to make the string to print. |
|
| Back to top |
|
 |
pspflashsystem
Joined: 24 Mar 2008 Posts: 31
|
Posted: Tue Nov 11, 2008 8:55 pm Post subject: |
|
|
Thanks a lot oldprisoner and JF:
I will wait JF for your archives :)
Thanks again
EDIT : It works fine thanks oldprisoner :) _________________ I'm apologize for my bad English because I am French :)
.::pspflashsystem::. |
|
| Back to top |
|
 |
pspflashsystem
Joined: 24 Mar 2008 Posts: 31
|
Posted: Sat Nov 15, 2008 6:06 am Post subject: |
|
|
OldPrisoneR---->>> if I want to display "0.0030" it displays only "0.30" but I want to display "0.0030"
Thanks for your help
EDIT: I find how I can do it thanks again ;) _________________ I'm apologize for my bad English because I am French :)
.::pspflashsystem::. |
|
| Back to top |
|
 |
|