Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert fraction to decimal & back?

Status
Not open for further replies.

SMCmtg

Programmer
Mar 27, 2000
90
US
Is there a better way? I have a bond price grid which is stated as:
104.17 which is 104 and 17/32 as a fraction(field=bondfrac)
104.18=104 and 18/32
104.19=104 and 19/32. . .etc.
I need to convert to decmial:
104.17 which is 104.53125 as a decmial (field=bonddec)
104.18=104.56250
104.19=104.59375. . .etc.
I have working. . .but seems discumbobulated.[blush]
Replace bondph WITH INT(bondfrac)
Replace bondtc WITH MOD(bondfrac,1)
Replace bonddec WITH (bondtc/.32)+bondph
Any feedback is appreciated. . .
 
HI

Try

REPLACE bondDec WITH INT(bondFrac)+(MOD(bondFrac,1)/32)

I have used REPLACE since you mentioned them as field names.
:) ramani :-9
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top