473,378 Members | 1,110 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,378 software developers and data experts.

extract fraction values from decimal

Hi,
I have a decimal value and i need to take the digits after decimal
places(fraction part only).
Is there any simple functions available other than using string
functions(searching for '.' and take the string after that)
decimal decimalValue=12.745
I need to take .745 as another decimal value only from the
decimalValue

Thanks,
Sony
Feb 12 '08 #1
1 10179
Sony,

You can always call the Truncate method to get the integral part of the
decimal, and subtract it from the original:

decimal decimalValue = 12.745;
decimal fractionalValue = decimalValue - Decimal.Truncate(decimalValue);

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<so*********@googlemail.comwrote in message
news:53**********************************@l16g2000 hsh.googlegroups.com...
Hi,
I have a decimal value and i need to take the digits after decimal
places(fraction part only).
Is there any simple functions available other than using string
functions(searching for '.' and take the string after that)
decimal decimalValue=12.745
I need to take .745 as another decimal value only from the
decimalValue

Thanks,
Sony

Feb 12 '08 #2

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

Similar topics

0
by: Bacci | last post by:
This isn't necessarily a php-specific question, but I'm looking for a formula to determine the fraction portion of a decimal number. For instance, 8.25. I could simply search the number (as a...
10
by: David Zaret | last post by:
i have a dict with a particular key - the values for this key will be None, one valid scalar, or a list: {mykey, None} {mykey, "foo"} {mykey, } let's ignore the None case - in the case of...
8
by: Fabian Braennstroem | last post by:
Hi, I would like to remove certain lines from a log files. I had some sed/awk scripts for this, but now, I want to use python with its re module for this task. Actually, I have two different...
2
by: indhu | last post by:
Hi, form name: person_wise i ve insert a option group. framename=date tracker option 1= track by date option 2=by task....( not implemented now) preview command button is there.
19
by: bing3121 | last post by:
Hello, The following C++ code is what I am trying to use in a fraction class to convert a fraction to a decimal. the num and den are both ints. When I make a call to the function...
2
by: dh87lfc | last post by:
Hi, I am currently working on a task which requires me to extract the top 10 maximum values from a column in a text file and print them to a new file. I am just wondering what would be the best way...
2
by: thomasrye | last post by:
I'm not extremely well versed in MySQL... this may end up being a fundamental or basic in database design and implementation. (by the way I'm using PHP) I'll give the trimmed down example of what...
5
by: sathumenon | last post by:
Hi Am a new bie - and in need of some helo Please find the attachment here. I would like to know how I can extract the values from this and list properly? What I need is to list the Hotel...
3
by: Johan Simpson | last post by:
Hi all. I need a good way of extracting values from certain bits inside a unsigned short: The definition of the 4 alarms inside the ushort: Name......Range.......Bits...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.