|
From: | David De La Harpe Golden |
Subject: | Re: numeri |
Date: | Sat, 29 Nov 2008 19:01:22 +0000 |
User-agent: | Mozilla-Thunderbird 2.0.0.17 (X11/20081018) |
Eli Zaretskii wrote:
Actually, why not make the above return the number 4? The Unicode Data File Format says that this property's value is ``an integer or rational number''. We could even use 0.2 for characters such as "VULGAR FRACTION ONE FIFTH". Isn't that better than `1/5'?
Bear in mind that 1/5 (0.2) isn't actually exactly representable by binary floating point, bit like the way 1/3 (0.333(3 recurring)) can't be written properly in decimal, so try in emacs lisp:
(format "%.20f" 0.2)I'd tend to hold off on allowing the vulgar fractions to map to numbers without the programmer to do a conversion step and "own" the associated potential information loss - at least until there is no loss: Emacs Lisp could one day get CL-like exact rational numbers I guess (though bignums would probably be a higher priority...)
[Prev in Thread] | Current Thread | [Next in Thread] |