**Next message:**wen-long sang: "Re: about Write2"**Previous message:**wen-long sang: "Re: about Write2"**In reply to:**wen-long sang: "Re: about Write2"**Next in thread:**wen-long sang: "Re: about Write2"**Messages sorted by:**[ date ] [ thread ] [ subject ] [ author ]**Mail actions:**[ respond to this message ] [ mail a new topic ]

Dear Wen-Long,

I see. Sorry that I apparently overlooked the wrong results of the

D-conversion.

This is of course a bug, that I hopefully managed to fix. I also added

a Precision option to Write2, for handling cases like 2/3, which gives a

repeating decimal so that one has to know where to cut it. There also

was a problem with Mathematica 10, where Write refused to apply the

custom format on expressions, although the same code works perfectly

fine on versions 8 and 9.

Anyhow, now the results look like this:

Write2["sang.abc", abc = 0.6*(-8 + 12 Log[5 + y[1]]),

abc1 = 1/x^(2/3), FormatType -> FortranForm, Precision -> 10];

Import["sang.abc", "Text"]

abc = 6.D-1*(-8D0 + 1.2D1*Log(5D0 + y(1D0)))

abc1 = x**-6.666666667D-1

Write2["sang.abc", abc = 0.6*(-8 + 12 Log[5 + y[1]]),

abc1 = 1/x^(2/3), FormatType -> FortranForm, Precision -> 3];

Import["sang.abc", "Text"]

abc = 6.D-1*(-8D0 + 1.2D1*Log(5D0 + y(1D0)))

abc1 = x**-6.67D-1

Write2["sang.abc", abc = 0.6*(-8 + 12 Log[5 + y[1]]),

abc1 = 1/x^(2/3), FormatType -> FortranForm,

FortranFormatDoublePrecision -> False]

Import["sang.abc", "Text"]

abc = 0.6*(-8. + 12.*Log(5. + y(1.)))

abc1 = x**(-0.6666666666666666)

For the moment I pushed the patch to the development branch:

<https://github.com/FeynCalc/feyncalc/commit/ea03857c4f8b7b38c9cd724d8f1f183a74f8b8b7>

that you can install via

Import["https://raw.githubusercontent.com/FeynCalc/feyncalc/master/install.m"]

InstallFeynCalc[InstallFeynCalcDevelopmentVersion -> True]

Please let me know, if this fixes your issues and if it introduces any

new problems. If everything is ok, I will push it also to the stable branch.

Cheers,

Vladyslav

Am 17.02.2016 um 06:49 schrieb wen-long sang:

*> Dear Vladyslav,
*

*>
*

*> Thank you for your reply! You are right, "D" corresponds to double precision in fortran. Actually, I need a double precision expression in fortran. However, abc = 0.6*(-8 + 12 Log[5 + y[1]]) and abc1 = 1/x^(2/3) will be translated to abc = 6.D-1*(-8D0 + 12D1*Log(5D0 + y(1D0))) and abc1 = x**-6.666666666666666D0D-1, where 12 ==> 12D1 (12D1=120), and -2/3 ==> -6.666666666666666D0D-1 (fortran may not understand D0D-1). So is this a bug?
*

*>
*

*> Best Regards
*

*> Wen-Long
*

*>
*

**Next message:**wen-long sang: "Re: about Write2"**Previous message:**wen-long sang: "Re: about Write2"**In reply to:**wen-long sang: "Re: about Write2"**Next in thread:**wen-long sang: "Re: about Write2"**Messages sorted by:**[ date ] [ thread ] [ subject ] [ author ]**Mail actions:**[ respond to this message ] [ mail a new topic ]

*
This archive was generated by hypermail 2b29
: 04/24/17-07:20:02 AM Z CEST
*