Re: [exim] Math

Pàgina inicial
Delete this message
Reply to this message
Autor: Philip Hazel
Data:  
A: JAS
CC: exim-users
Assumpte: Re: [exim] Math
On Thu, 16 Dec 2004, JAS wrote:

> From what I have read, I am gathering exim does not deal with real
> numbers?


Not in its expansion facilities, that's true.

> Is this true. I cannot do a test to see if 1.234>2.432?


If you know that you will always be dealing with numbers that have 3
decimal places, you can write this horrendous thing:

   ${if >\
     {\
     ${if match{..first number...}{\N^(\d+)\.(\d\d\d)$\N}\
       {${eval10:1000*$1 + $2}}fail}\
     }\
     {\
     ${if match{..second number...}{\N^(\d+)\.(\d\d\d)$\N}\
       {${eval10:1000*$1 + $2}}fail}\
     }\
     {.. yes string ..}{.. no string ..}\
    } 


(I have not tested that.) If the number of decimal places is variable,
you might be able to add some more gobbledegook to deal with those cases
you know will arise (e.g. to convert 1.23 into 1.230).

I know, it's yucky. But real numbers do not arise very much in email
processing. Adding something to Exim to handle them has been in the Wish
List since May 2003.

-- 
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.
Get the Exim 4 book:    http://www.uit.co.uk/exim-book