[GiNaC-devel] Patches for compilation with MSVC

Alexei Sheplyakov alexei.sheplyakov at gmail.com
Wed Jun 3 17:01:05 CEST 2015


Hi, Jan,

I'm afraid your patch is not quite correct.

-       ex e2 = log(7)+log(p)+log(pow(q,3))+log(-z*a*w*pow(b,2));
+       ex e2 = log(7.0)+log(p)+log(pow(q,3))+log(-z*a*w*pow(b,2));

log(7) is an exact quantity, and log(7.0) is not (it's a floating
point number). In general
GiNaC does not apply numerical evaluation automatically. Could you
please try replacing
log(7) with log(ex(7))?

Best regards,
      Alexei


On Mon, May 25, 2015 at 3:32 PM, Jan Rheinländer <jrheinlaender at gmx.de> wrote:
> Hi,
>
> here are some simple patches to allow the current version (from git) of
> GiNaC to be compiled with MS Visual C++:
>
> 1. Fix problem with min() and max() macros in MSVC:
>
> --- a/ginac/compiler.h
> +++ b/ginac/compiler.h
> @@ -34,6 +34,8 @@
>  #ifdef _MSC_VER
>  #define __func__ __FUNCTION__
>  #define __alignof__ __alignof
> +#define NOMINMAX
> +#include <algorithm>
>  #endif
>
>  #endif // ndef GINAC_COMPILER_DEP_H
>
> --- a/check/exam_cra.cpp
> +++ b/check/exam_cra.cpp
> @@ -21,6 +21,7 @@
>   */
>
>  #include "polynomial/cra_garner.h"
> +#include "../ginac/compiler.h"
>
>  #include <cln/integer.h>
>  #include <cln/integer_io.h>
>
> 2. Fix ambiguous overload of log() (MSVC is more exact here than gcc):
>
> --- a/check/exam_inifcns.cpp
> +++ b/check/exam_inifcns.cpp
> @@ -312,7 +312,7 @@ static unsigned inifcns_consist_log()
>
>         // a bit more complicated
>         ex e1 =
> log(-7*p*pow(q,3)*a*pow(b,2)*z*w).expand(expand_options::expand_transcendental);
> -       ex e2 = log(7)+log(p)+log(pow(q,3))+log(-z*a*w*pow(b,2));
> +       ex e2 = log(7.0)+log(p)+log(pow(q,3))+log(-z*a*w*pow(b,2));
>         if (!e1.is_equal(e2))
>                 ++result;
>
>
>
> _______________________________________________
> GiNaC-devel mailing list
> GiNaC-devel at ginac.de
> https://www.cebix.net/mailman/listinfo/ginac-devel


More information about the GiNaC-devel mailing list