https://bugzilla.wikimedia.org/show_bug.cgi?id=13172

--- Comment #25 from Lupo <[email protected]> 2010-01-28 22:59:37 UTC ---
There's an even simpler way to convert to a single fraction: given that
apparently the conversion via float is faster, and given that we're dealing
with values in the range 0.0 .. 180.0 only, we could just accumulate the value
in a float, round that float to 7 fractional digits, set the numerator to
intval (float * 10000000) and fix the denominator at 10000000.

The values are all be within the 32bit range, and a precision of 7 fractional
digits is sufficient: that corresponds to about 1cm. That is, AFAIK, better
than what's possible with current GPS, and in any case certainly good enough to
pinpoint a photographer's location.

An implementation of this on my private wiki is twice as fast as the toRational
method, passes all the tests from my test program, and has far less code that
is easier to understand to boot.

Ilmari, would it be OK if I obsoleted your patch with a new one doing all the
formatting stuff from your patch, but using this method to calculate the single
rational value?

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are watching all bug changes.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to