Hello Thiemo,

Thank you for this patch. It is correct for the amd64 architecture too, 
as far as the test suite can assert it.

I have included your patch in the revision 2.4 which is now available in
source form (and as binaries for i386) at ofset's repository, see 
http://debian.ofset.org/ .

I suppose that the program as you modified it should work even with 32
bits architectures, as the relevant variables are still declared as long
double, which is mandatory (as enthalpies of reactions can be computed
by combining two redox reaction halves, their values can be out of the
range allowed for the type double, but will remain still in the range
allowed for long double).

Best regards,                   Georges.



Thiemo Seufer a écrit :
> Package: chemeq
> Version: 2.3
> Severity: important
> Tags: patch
> 
> chemeq fails to build on at least mips/mipsel because it mixes up C and
> C++ namespaces. The appended patch removes the C includes, and uses the
> C++ "long double" function templates for exp() and log().
> 
> [The reason why it failed on mips is that "long double" is there an
> alias for "double", and the corresponding expl()/logl() functions
> are only defined in the header when c99 standard is requested.
> g++ however implies gnu++98 standard.]
> 
> 
> Thiemo
> 
> 
> --- chemeq-2.3.old/src/chemeq.cc      2007-09-16 16:57:31.000000000 +0100
> +++ chemeq-2.3/src/chemeq.cc  2007-11-13 01:21:15.000000000 +0000
> @@ -1,8 +1,7 @@
>  // -*- coding: utf-8 -*-
>  #include "chemeq.h"
> -#include <math.h>
> -#include <sstream>
> -#include <stdlib.h>
> +#include <cmath>
> +#include <cstdlib>
>  
>  atome lesatomes[] ={
>  {-1, "e"},
> @@ -574,7 +573,7 @@ void Chemeq::addChemeq(const Chemeq * c)
>      fraction n1=nbelectron(), n2=c->nbelectron();
>      long double e = e1+e2;
>      fraction n=n1+n2;
> -    if (n.i==0) val=expl(-e/R/T0);
> +    if (n.i==0) val=exp(-e/R/T0);
>      else val=-e*n.d/n.i/Faraday;
>    } else {
>      val=MINVAL;
> @@ -591,7 +590,7 @@ void Chemeq::subChemeq(const Chemeq * c)
>      long double e = e1-e2;
>      fraction n=n1-n2;
>      if (n.i==0) {
> -      val=expl(-e/R/T0);
> +    val=exp(-e/R/T0);
>      } else{
>        val=-e*n.d/n.i/Faraday;
>      }
> @@ -608,7 +607,7 @@ long double Chemeq::enthalpy() const{
>    if (redox()){
>      return -val*n.i/n.d*Faraday;
>    } else {
> -    return -R*T0*logl(val);
> +    return -R*T0*log(val);
>    }
>  }
>  
> --- chemeq-2.3.old/src/chemeq.h       2007-08-26 19:31:08.000000000 +0100
> +++ chemeq-2.3/src/chemeq.h   2007-11-13 01:22:43.000000000 +0000
> @@ -2,7 +2,7 @@
>  #ifndef CHEMEQ_H
>  #define CHEMEQ_H
>  
> -#include <string.h>
> +#include <cstring>
>  #include <sstream>
>  #include <iostream>
>  #include <vector>
> 
> 
> 

-- 
Georges KHAZNADAR et Jocelyne FOURNIER
22 rue des mouettes, 59240 Dunkerque France.
Téléphone +33 (0)3 28 29 17 70

Attachment: signature.asc
Description: Digital signature

Reply via email to