The above video goes away if you are a member and logged in, so log in now!

 Would you like to get all the newest Gaming News fromQJ.NET in your email each day? Want to learn more about the team who brings you the QJ news?

## What are these numbers??

This is a discussion on What are these numbers?? within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; I see in people's source code these type of numbers: 0.4f, 0.1f, 1.0f What are these and what numbers do ...

 Tweet
1. ## What are these numbers??

I see in people's source code these type of numbers:

0.4f, 0.1f, 1.0f

What are these and what numbers do they represent?

2. They are floating point numbers. The 'f' at the end means to treat the value as a float, rather than the default 'double'.

Correct me if Im wrong please, but thats just how I have seen it.

3. Originally Posted by SG57
They are floating point numbers. The 'f' at the end means to treat the value as a float, rather than the default 'double'.

Correct me if Im wrong please, but thats just how I have seen it.
I see, so instead of making a number a float using a variable every time:

Code:
`float floatNumber = 23.4;`
you can just use:

Code:
`23.4f`
when you are only using it once.

4. that would make sense, but in Java you have to do both, e.g:
Long Number = 1231423548123749817298374 8192489217L

5. JaSo - Not quite... You need to brush up on your data types a little.

double is used to define BIG floating point numbers. It reserves twice the storage for the number (8 bytes i believe), so in cases such as supplying a function with a vertex, you want to be specific, down to ~tenth decimal place. Anything more specific most likely wont make a difference, therefore using a float would make sense, stack memory wise (thats where its sent/stored right?).

6. Something I heard about floats/doubles:

The PSP apparently doesn't actually support doubles. If you use doubles gcc will include double emulating code, which is really slow. So you should use floats for when you need maximum efficiency.

7. Originally Posted by SG57
JaSo - Not quite... You need to brush up on your data types a little.

double is used to define BIG floating point numbers. It reserves twice the storage for the number (8 bytes i believe), so in cases such as supplying a function with a vertex, you want to be specific, down to ~tenth decimal place. Anything more specific most likely wont make a difference, therefore using a float would make sense, stack memory wise (thats where its sent/stored right?).
hmmmm

8. float aNumber = 10.0;

This casts 10.0 from a double to a float before assigning it aNumber. You should only use doubles if you need the extra precision. Since the PSP has a FPU (floating point unit), float operations are hardware accelerated where as doubles and integers are not and emulated in software.

I recommend reading up on the IEEE format.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

All times are GMT -8. The time now is 10:44 AM.

Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY