473,387 Members | 3,820 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,387 software developers and data experts.

truncate number of decimals

i am using sqrt method and it gives me the result that is upto 16 decimal
places but i want the result to be round to only 2 decimal places.

Ceiling method only gives the upper bound and floor method truncates all the
decimals.

Does anybody know a method to do this.
TIA
nafri

Nov 21 '05 #1
2 5022
Hi Nafri

Have a look at Decimal.Round(...)

HTH

Charles
"nafri" <sp****@spam.net> wrote in message
news:7F**********************************@microsof t.com...
i am using sqrt method and it gives me the result that is upto 16 decimal
places but i want the result to be round to only 2 decimal places.

Ceiling method only gives the upper bound and floor method truncates all
the
decimals.

Does anybody know a method to do this.
TIA
nafri

Nov 21 '05 #2
thanks charles

"Charles Law" wrote:
Hi Nafri

Have a look at Decimal.Round(...)

HTH

Charles
"nafri" <sp****@spam.net> wrote in message
news:7F**********************************@microsof t.com...
i am using sqrt method and it gives me the result that is upto 16 decimal
places but i want the result to be round to only 2 decimal places.

Ceiling method only gives the upper bound and floor method truncates all
the
decimals.

Does anybody know a method to do this.
TIA
nafri


Nov 21 '05 #3

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

Similar topics

2
by: Andreas Emmert | last post by:
Hi there, I'm trying to import a csv file into my MySQL database. Unfortunately the number format for the price column is formatted in German style, i.e. XX,XX (decimals separated by comma not...
4
by: elyob | last post by:
How can I get -0.162058 to -0.1 rather than rounding to -0.2? I know I'm being stupid here, but it's really bugging me. The number before the decimal point could 0 - 999 Thanks
3
by: Oswald | last post by:
Hey, how can I set the number of decimals? Example: 5 decimals 2.12345 2 decimals 2.12 I've found something about NumberFormat in the API, but without an example I can't solve this...
9
by: Johnny Lee | last post by:
Hi, Pls take a look at this code: ---------- >>> t1 = "1130748744" >>> t2 = "461" >>> t3 = "1130748744" >>> t4 = "500" >>> time1 = t1+"."+t2 >>> time2 = t3+"."+t4
1
by: J.J. | last post by:
hi, I have in my report SUBTOTAL=Sum(), then TAX=*0,22 and TOTAL=+ The SUBTOTAL is 6029,80. I sholud get the following values for TAX=1326,556 and for TOTAL=7356,356. I don't need the third...
6
by: Donal McWeeney | last post by:
Hi, Is there a way to specify on the predefined format strings like P and N that you want displayed all the decimals in the number... for example 3 will display 3 2.1 will display 2.1...
4
by: Chris Davoli | last post by:
The folllowing will round to 526, but it should round to 527. It works correctly for all other numbers, except for this one. Does anybody know of a bug in Math.Round? Dim ldecWater As Decimal =...
13
by: Girish Sahani | last post by:
Hi, I want to truncate every number to 2 digits after the decimal point. I tried the following but it doesnt work. >>> a = 2 >>> b = 3 >>> round(a*1.0 / b,2) 0.67000000000000004
52
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I convert a Number into a String with exactly 2 decimal places?...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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...

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.