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 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
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
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
"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.
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
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
"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?
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?
"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. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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
|
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...
|
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....
|
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,...
|
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,...
|
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...
|
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...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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,...
|
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...
|
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...
|
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,...
|
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...
| |