473,769 Members | 2,643 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4162
Look at the system.Math namespace, there is a round function within there
"Agnes" <ag***@dynamict ech.com.hk> wrote in message
news:uB******** ********@TK2MSF TNGP12.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*******@hotm ail.com> ¦b¶l¥ó
news:eE******** ******@TK2MSFTN GP12.phx.gbl ¤¤¼¶¼g...
Look at the system.Math namespace, there is a round function within there
"Agnes" <ag***@dynamict ech.com.hk> wrote in message
news:uB******** ********@TK2MSF TNGP12.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***@dynamict ech.com.hk> wrote in message
news:uB******** ********@TK2MSF TNGP12.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******** ******@TK2MSFTN GP09.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******** ******@TK2MSFTN GP09.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*****@hotmai l.com> wrote in message
news:posNc.3998 2$eM2.20658@att bi_s51...
"Oenone" <no***@nowhere. com> wrote in message
news:e5******** ******@TK2MSFTN GP09.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******** ********@TK2MSF TNGP09.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
1495
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 thanx Cheers
0
1172
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
1970
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 parameter.and no of parameter is calling function can be anything. for example.suppose my function is function2. then when i call function1(int i ,char j,float d) { function2()
2
1902
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. The prototype of function signal in signal.h: void (*signal(int sig, void (*func)(int)))(int);
2
1274
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, that I could put an extension on, as opposed to manually adding it to all the numeric types... decimal, double, single, long, short, etc... ?? Cheers!
4
1360
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, with the search being done exactly the same way "import" does it. The loader for "egg" files has this functionality, but I'd like to find out if there's a standard way to do this before looking into that source code. Also, it seems that the...
6
2076
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 o('on'+evt,fn); };
1
2106
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 correctly. Anyway I know i can make my own pretty easily but just wondering if its present in the framework. regards,
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10212
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10047
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9995
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9863
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7410
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6674
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3962
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.