Raised This Month: $ Target: $400
 0% 

Digits of an Integer


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
PartialCloning
Senior Member
Join Date: Dec 2015
Old 12-05-2015 , 21:21   Re: Digits of an Integer
Reply With Quote #8

Quote:
Originally Posted by fysiks View Post
That will only work for values between 10,000 and 99,999,999.

What exactly are you trying to do? What situation would you only want the first 4 digits?
It worked for all the values I threw at it. I did have to adjust the zeros in the while check accordingly.

I needed to convert get_gametime() seconds to miliseconds and I found this post:

Quote:
Originally Posted by SchlumPF* View Post
this might help:

PHP Code:
public fnClimbtimeToStringFloat:climbtimeoutput[], len )
{
    new 
minutessecondsmiliseconds;
    
    
minutes floatroundclimbtime 60.0floatround_floor );
    
seconds floatroundclimbtime minutes 60floatround_floor );
    
miliseconds floatround( ( climbtime - ( minutes 60 seconds ) ) * 1000000floatround_floor );
    
    
formatoutputlen"%02i:%02i:%06i"minutessecondsmiliseconds );

I only wanted the first few digits of the miliseconds. But then I found out that miliseconds are actually seconds * 1000.

I'm still glad I learned the method you guys posted, I'm sure it'll come in handy one day.
PartialCloning 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 17:52.


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