Re: Supporting fractional values for a unit converter function

Manuel Giraud <[email protected]>
Newsgroups gmane.emacs.help
Message-ID <[email protected]>
Heime <[email protected]> writes:

> On Sunday, March 22nd, 2026 at 2:05 AM, Heime <[email protected]> wrote:
>
>> I want to extend a unit conversion framework that accepts fractional
>> inches by letting value be a Lisp rational (like 7/64) and then treating
>> it as a normal number in the conversion.
>> 
>> To write (units 7/64 :inch :mm) rather than the cumbersome
>> (units ((float 7) / (float 64)) :inch :mm)
>
> Can a function be made to take an argument 7/64 and interpret 
> it inside the function as (/ (float 7) (float 64))?

For this a user have to write (/ 7.0 64) as input.  See 3rd paragraph of
the info node "(elisp) Float Basics".
-- 
Manuel Giraud
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.