Page 1 of 1

Double as Fraction String

PostPosted: March 9th, 2004, 11:06 pm
by w2m
Dumb question I guess...

If I have a variable ShutterSpeed: double that is 0.02 or 1/200 how can I display ShutterSpeed as 1/200 as a string?
0.05 = 1/50sec
0.01 = 1/100sec
0.02 = 1/200sec
0.50 = 1/2sec


I googled for a while but could not find anything that works.

Regards
Bill

PostPosted: March 17th, 2004, 9:20 am
by Kambiz
Code: Select all
ShutterSpeedLabel.Caption := Format('1/%d sec', [Round(1 / ShutterSpeed)]);


Hope that it helps.
Kambiz

Thanks...

PostPosted: March 20th, 2004, 3:19 pm
by w2m
Thanks... that did the trick... the method I was using was too complicated and used the lowest common denometer so it did not work with typical shutter speeds.

Bill