Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Mod operation without integer rounding

Status
Not open for further replies.

realace112

Programmer
Jul 28, 2002
8
US
I'm trying to get the fraction part of a number. For example, if x = 115.5, I need 0.5 . What I tried using was a Mod operation to get the remainder however it converts and rounds the answer to an integer. Instead of getting 0.5, I get 1. Is there a way I can use Mod and get a decimal value instead of an integer? Please advise. I am a beginner to VB so please bare with me. Thank you.
 
per peekay and the ubiquitous {F1}] (aka help) the short and real answer is NO. mod, re the docs:

... Usually, the data type of result is a Byte, Byte variant, Integer, Integer variant, Long, or Variant containing a Long, regardless of whether or not result is a whole number. Any fractional portion is truncated. However, if any expression is Null, result is Null. Any expression that is Empty is treated as 0.



MichaelRed
mlred@verizon.net

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top