Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to get mantissa and decimal part
#1
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi All,

I have a decimal number 4.5, if decimal part less than 0.5 it should display
4, if decimal part greater than 0.5 it should display then next number 5.
without using built in function.






Thanks in advance
Hi All,

I have a decimal number 4.5,

if in that number , if decimal part is >0.5 it should display number as 4
and if the decimal part is <0.5 it should display number as the next number 5
how to do this without using built in functions.



Thanks in advande
Reply
#2
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi,

U can create a function that splits ur number. Get the number after decimal part if its <5 then display the 4 as result and if decimal part is > than 5 then add 1 in 4.
It would be a simple function. try this and let me know if u are facing some issues.

Regards,
Sankalp
Reply
#3
Solved: 11 Years, 3 Months, 3 Weeks ago
Code:
Dim oNum  
oNum=4.5
oDecNum=oNum- int(oNum)  

oDeccpart=.5
If oDecNum > oDeccpart   then
oNum=int(oNum)
msgbox  oNum
else
oNum=int(oNum)+1
msgbox  oNum
end if

Please check the above code.
Reply
#4
Solved: 11 Years, 3 Months, 3 Weeks ago
Try this as well

Code:
oNum = 4.5
If Split(oNum, ".")(1) > 0.5 Then
  Msgbox Int(oNum)
Else
  msgbox Int(oNum)+1
End If
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to extract part of a string between two particular characters. ACCBAJPA 7 5,752 08-22-2013, 02:39 PM
Last Post: ACCBAJPA
Exclamation Retrieve the complete height and width of a browser beyond the visible part as wel learnQtptips 0 2,114 05-22-2013, 09:36 AM
Last Post: learnQtptips
  Copying random length part of the string. unbeliever 5 4,860 01-07-2010, 02:55 PM
Last Post: unbeliever
  Trying to click on image which is a part of WebElement with Tag 'NOBR' poona13 0 2,005 04-15-2008, 12:40 AM
Last Post: poona13

Forum Jump:


Users browsing this thread: 1 Guest(s)