[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
format in m4
From: |
Andrew Collier |
Subject: |
format in m4 |
Date: |
Wed, 8 Jun 2005 08:27:46 +0200 |
User-agent: |
Mutt/1.5.9i |
hello,
i have come across something unexpected using 'format' with m4. i am wanting to
just trim off the decimal portion of a number. however, when the 'trimmed'
number ends with zeros these get removed as well. for example:
m4_format(`%.0f', 293408.883333)
m4_format(`%.0f', 293409.883333)
m4_format(`%.0f', 293499.883333)
which produces:
293409
29341
2935
so, the first line works fine. the second and third lines do not produce what i
expected at all. i thought that maybe i had misunderstood the implementation of
'format', so i coded the above in c:
printf("%.0f\n", 293408.883333);
printf("%.0f\n", 293409.883333);
printf("%.0f\n", 293499.883333);
and in this case i get precisely what i wanted:
293409
293410
293500
i am using GNU m4 1.4.1.
best regards,
andrew collier.
--
Andrew B. Collier
Antarctic Research Fellow tel: +27 31 2601157
Space Physics Research Institute fax: +27 31 2616550
University of KwaZulu-Natal, Durban, 4041, South Africa
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- format in m4,
Andrew Collier <=