Jump to content
Sign in to follow this  
AutoMathic

Division without the reminder

Recommended Posts

AutoMathic

Hi,

can I divide a number without the reminder? For example I have a $number = 9587 and I need to know how many thousands it is (the result should be 9).

 

The reason is I want to refine the output like this:
 

$Number = 9578
$Output = Round($Number/1000) & "." & Mod($Number, 1000)
Msgbox (0, "Result:", $Output)

Due to rounding the result looks like this: "10.587" but it should be like "9.587".

Thank you.

 

Share this post


Link to post
Share on other sites
kylomas

AutoMathic,

Like

Msgbox (0, "Result:", stringformat('%04.3f',$number/1000))

?

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites
Malkey

A few more methods.

$Number = 9578
$Output = Round($Number / 1000, 5) ; Round ( expression [, decimalplaces] )
; Or
$Output1 = Int($Number / 1000) & "." & Mod($Number, 1000)
;Or
$Output2 = $Number / 1000
MsgBox(0, "Result:", $Output & @CRLF & $Output1 & @CRLF & $Output2)

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×