m4-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: floating point in M4


From: Eric Blake
Subject: Re: floating point in M4
Date: Mon, 03 May 2010 10:00:38 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100330 Fedora/3.0.4-1.fc12 Lightning/1.0b1 Thunderbird/3.0.4

On 05/03/2010 08:30 AM, Amaury Ampe wrote:
> Hi,
> I've been asked to change the program of a robot in a way that will
> allow users to change the values of its controllor in an easy way. Those
> values have to be floating point numbers.
> The current program uses M4 to "transport" values from the memory to the
> processor. The processor makes al its calculations with 64bit floating
> point numbers.
> If I understood correctly M4 is only capable of doing Integer
> arithmetic. Since I won't be doing any arithmetic with M4 I'm wondering
> if I can use it to "transport" floating point numbers. Or will it just
> convert them into strings?

Eventually, M4 2.0 will support use of libgmp to support arbitrary
precision floating point via a loadable library (the code is already in
git, but is not ready for a release yet).

In the meantime, m4 1.4.x supports floating point in its format builtin,
but not in the eval builtin.  So you can parse floating point in one
format and display it in another, but that's about the extent of current
support.

But everything in m4 is a string unless treated contextually by a
builtin that knows how to treat it otherwise.  So yes, you can transport
floating point numbers, as strings, using m4.

-- 
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]