Raised This Month: $ Target: $400
 0% 

int to float?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
cheshire-
Junior Member
Join Date: Jul 2005
Old 05-20-2006 , 09:58   int to float?
Reply With Quote #1

I need to turn integers into floats so that they can be manipulated correctly, but i cant find a num_to_float or int_to_float function or something similar. Is there another way besides converting them to a string then a float?
__________________
cheshire- is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 05-20-2006 , 10:32  
Reply With Quote #2

Use float(integer):
Code:
new integer = 123 new Float:x = float(integer)
VEN is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 05-20-2006 , 14:28  
Reply With Quote #3

You can just cast it:

Code:
    new iNum = 0     new Float:flNum = Float:iNum
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
BAILOPAN
Join Date: Jan 2004
Old 05-20-2006 , 15:29  
Reply With Quote #4

Quote:
Originally Posted by Hawk552
You can just cast it:

Code:
    new iNum = 0     new Float:flNum = Float:iNum
In fact, that is wrong. You must use float(). A re-tag is a bitstring copy, not a type cast.
__________________
egg
BAILOPAN is offline
cheshire-
Junior Member
Join Date: Jul 2005
Old 05-20-2006 , 21:06  
Reply With Quote #5

thank you thank you
__________________
cheshire- is offline
Old 05-20-2006, 21:27
Hawk552
This message has been deleted by Hawk552.
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:32.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode