473,403 Members | 2,366 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

some numeric function

Where I can find the tutorial about numeric function..
e.g x = 15/6, i need to get the result (2) but not (2.5)
also get the reminder y = 15/6 , i can get the result (3)

Thanks
Nov 20 '05 #1
9 4122
Look at the system.Math namespace, there is a round function within there
"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:uB****************@TK2MSFTNGP12.phx.gbl...
Where I can find the tutorial about numeric function..
e.g x = 15/6, i need to get the result (2) but not (2.5)
also get the reminder y = 15/6 , i can get the result (3)

Thanks

Nov 20 '05 #2
Hi Agnes,

Watch the rounding in dotNet, the only posibility is the banker's rounding.
Do you use that in Honkong, because I ask it to everybody however never got
an answer and I am curious where it is used.

For the rest of your question you have to look at the different values, they
all are for this reason.

Numeric datatypes
http://msdn.microsoft.com/library/de...cdatatypes.asp

Rounding
http://msdn.microsoft.com/library/de...oundtopic1.asp

Cor
Where I can find the tutorial about numeric function..
e.g x = 15/6, i need to get the result (2) but not (2.5)
also get the reminder y = 15/6 , i can get the result (3)

Thanks

Nov 20 '05 #3
Thanks a lot

"microsoft" <as*******@hotmail.com> ¦b¶l¥ó
news:eE**************@TK2MSFTNGP12.phx.gbl ¤¤¼¶¼g...
Look at the system.Math namespace, there is a round function within there
"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:uB****************@TK2MSFTNGP12.phx.gbl...
Where I can find the tutorial about numeric function..
e.g x = 15/6, i need to get the result (2) but not (2.5)
also get the reminder y = 15/6 , i can get the result (3)

Thanks


Nov 20 '05 #4
"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:uB****************@TK2MSFTNGP12.phx.gbl...
Where I can find the tutorial about numeric function..
e.g x = 15/6, i need to get the result (2) but not (2.5)
also get the reminder y = 15/6 , i can get the result (3)


if you want "15/6" to give you "2":

dim whole as Integer
whole = Int(15/6)

That will do the division, which will give you a real number (with possible
decimals), and just take the integer portion of the answer.
To get the remainder you need to do the MOD function:

dim remainder as Double
remainder = 15 Mod 6
remainder will now equal 3.

Nov 20 '05 #5
Agnes wrote:
Where I can find the tutorial about numeric function..
e.g x = 15/6, i need to get the result (2) but not (2.5)


You can also use

Dim whole as Integer
whole = 15 \ 6

This performs an integer division -- i.e., it discards the fractional part
of the result (rounds down).

--

(O)enone
Nov 20 '05 #6
Thanks To all.
I solve my numeric problem ~~~~

"Oenone" <no***@nowhere.com> ¦b¶l¥ó
news:e5**************@TK2MSFTNGP09.phx.gbl ¤¤¼¶¼g...
Agnes wrote:
Where I can find the tutorial about numeric function..
e.g x = 15/6, i need to get the result (2) but not (2.5)


You can also use

Dim whole as Integer
whole = 15 \ 6

This performs an integer division -- i.e., it discards the fractional part
of the result (rounds down).

--

(O)enone

Nov 20 '05 #7
"Oenone" <no***@nowhere.com> wrote in message
news:e5**************@TK2MSFTNGP09.phx.gbl...
Agnes wrote:
Where I can find the tutorial about numeric function..
e.g x = 15/6, i need to get the result (2) but not (2.5)


You can also use

Dim whole as Integer
whole = 15 \ 6

This performs an integer division -- i.e., it discards the fractional part
of the result (rounds down).


So it will automatically covert the answer to whatever type the receiving
variable is? Do all functions in VB.NET round down no matter what? even for
say 1.999?
Nov 20 '05 #8
Ricky,
In addition to integer division you could use the Math.Round function.

x = Math.Round(15/6, 0)

http://msdn.microsoft.com/library/de...hfunctions.asp

Hope this helps
Jay

"Ricky W. Hunt" <rh*****@hotmail.com> wrote in message
news:posNc.39982$eM2.20658@attbi_s51...
"Oenone" <no***@nowhere.com> wrote in message
news:e5**************@TK2MSFTNGP09.phx.gbl...
Agnes wrote:
Where I can find the tutorial about numeric function..
e.g x = 15/6, i need to get the result (2) but not (2.5)
You can also use

Dim whole as Integer
whole = 15 \ 6

This performs an integer division -- i.e., it discards the fractional part of the result (rounds down).


So it will automatically covert the answer to whatever type the receiving
variable is? Do all functions in VB.NET round down no matter what? even

for say 1.999?

Nov 20 '05 #9
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Ricky,
In addition to integer division you could use the Math.Round function.

x = Math.Round(15/6, 0)


Thanks.
Nov 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Davide | last post by:
Hi all, Please, can somebody help me to understand how calculate this number in php? I've got 4.7554844644e+06 and I need to have 4.7Mbits Is there a php function can helps me? Really...
0
by: David | last post by:
I want to use MD5, the framework has MD5 but the problem is that the php crypt function use a "salt" to encrypt the information. :( Thanks
6
by: komal | last post by:
hi all basically my problem is i have to write a function such that when ever i call this function in some other function .it should give me tha data type and value of calling function...
2
by: lovecreatesbeauty | last post by:
Hello, I'm confused by some complex function prototypes. Would you please explain those to me in detail with C language syntax itself with your rich knowledge & experiences. Thank you. 1....
2
by: Arthur Dent | last post by:
Hi all... I'm playing around experimenting with Extensions and R&D'ing what's new. There's a procedure I would like to add to numbers, and I was wondering, is there any "base" number type,...
4
by: John Nagle | last post by:
Python's own loader searches "sys.path" for module names, but is there some function that makes that search functionality accessible to Python programs? I need the absolute pathname of a module,...
6
by: Max | last post by:
i have a event bind function like this(though it is not so robust): bind$=function(o,evt,fn,cb){ var aE='attachEvent'; var aEL='addEventListener'; if(!o&&o){ return o(evt,fn,!!cb); } return...
1
by: Abubakar | last post by:
Hi, I'm looking for a function that could just create a string with given character and they should be repeated n number of times. I remember this function used to be there in vb 6 if i remember...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.