Raised This Month: $ Target: $400
 0% 

Float number calculations


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-18-2013 , 20:39   Re: Float number calculations
Reply With Quote #5

This is how float works in pawn or in c++, so what i said that should be ok internally seems wrong.

You can read those interesting thread :
https://forums.alliedmods.net/showthread.php?t=53543
https://forums.alliedmods.net/showthread.php?t=53535
https://forums.alliedmods.net/showthread.php?t=47051

Anyway, in your case, multiply all by 10 and you can works with integers.

And if you want to print as Float, you can trick it like this :

PHP Code:
    static iNumber 800// instead of 80.0

    
new szNumber[32];
    new 
len formatex(szNumbercm(szNumber), "%d", ++iNumber); // add 1 instead of 0.1
    
szNumber[len] = szNumber[len-1];
    
szNumber[len-1] = '.';
    
client_print(idprint_chatszNumber); 
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 07-18-2013 at 20:49.
ConnorMcLeod is offline
 



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 06:30.


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