Author Topic: Fraction String to real  (Read 1917 times)

0 Members and 1 Guest are viewing this topic.

Shade

  • Guest
Fraction String to real
« on: April 09, 2008, 03:54:33 PM »
How would one convert a string fraction (ie. "3/32") into a real number (ie. 0.09375)?
I tried using atof but it rounded the fraction up and I want the full decimal place, if possible.


I think I have posted this question before, but I can't seem to find it with the search.

Any help would be appreciated!  :mrgreen:

deegeecees

  • Guest
Re: Fraction String to real
« Reply #1 on: April 09, 2008, 04:00:39 PM »
I believe it's DISTOF... Check the Developer Help Files though.

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4076
Re: Fraction String to real
« Reply #2 on: April 09, 2008, 04:09:16 PM »
(distof "3/32" 5)

worked for me
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Fraction String to real
« Reply #3 on: April 09, 2008, 05:14:42 PM »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

rude dog

  • Guest
Re: Fraction String to real
« Reply #4 on: April 09, 2008, 10:30:55 PM »
This Worked for me

Code: [Select]
Command: (distof "3/32" 2)
0.09375