Wrox Programmer Forums How to separate double number
 |
 Visual Basic 2008 Essentials If you are new to Visual Basic programming with version 2008, this is the place to start your questions.
 Welcome to the p2p.wrox.com Forums. You are currently viewing the Visual Basic 2008 Essentials section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com

April 17th, 2010, 11:09 AM
 draganp71 Authorized User Join Date: Apr 2010 Posts: 11 Thanks: 0 Thanked 0 Times in 0 Posts
How to separate double number

Hi everyone,
Somebody can help me , please? I have VB 2008 Exp edition and I'm starting to learn something about programing! The question is: how can I extract the numbers behind the point.
For example:
I have the double number 12.345 - so I need to separate the number 12 from 0.345, because I need them both, even the number 12 and even the number 0.345!! For example I'll use 12 * 123 and 0.345 * 456!!!!
I hope it's clear! Thank's very much in advance!

April 17th, 2010, 12:56 PM
 PeterPeiGuo Friend of Wrox Join Date: Dec 2008 Posts: 238 Thanks: 2 Thanked 20 Times in 19 Posts

Math.Floor can give you the integer part of the double, and then a simple minus should give you the decimal part.
Code:
```Module Module1

Sub Main()
Dim d As Double = 123.456
Dim i As Integer
i = Math.Floor(d)
'd - i can give you the decimal part
End Sub

End Module```

April 27th, 2010, 04:11 AM
 draganp71 Authorized User Join Date: Apr 2010 Posts: 11 Thanks: 0 Thanked 0 Times in 0 Posts
thanx

thanx for replaying!

 Similar Threads Thread Thread Starter Forum Replies Last Post Separate user tables? Clint PHP Databases 3 May 11th, 2012 06:06 AM How to add a line number/Row number- need to use it for page breaks naijacoder XSLT 7 September 27th, 2009 09:42 PM separate a string with whitespace petergoodman XSLT 8 July 8th, 2008 01:56 AM Two separate menu from one sitemap? KieshaJ310 ASP.NET 2.0 Basics 5 July 4th, 2007 01:31 AM Search separate C from CR topshed Classic ASP Databases 2 December 29th, 2005 08:58 AM