Be careful in expressions for comps

Emmanuel Farhi farhi at ill.fr
Wed Feb 21 09:58:23 CET 2001


Hello McStas users,

I've experienced a stupid bug that occurs when you use expressions for a
component parameter, for instance:

COMPONENT SC1 = Channeled_guide(
  w1 = 0.031, h1 = 0.054,
  w2 = 0.031, h2 = 0.054,
  l = 0.9144, d = 0.28/1000, k = 3,
  R0 = 0.98,
  Qcx = 0.021, Qcy = 0.021,
  alphax = 6.07, alphay = 6.07,
  mx = 1, my = 1, W=(1/300) )
AT (0, 0, 2.7473) RELATIVE Source

Here all is ok (parameters are doubles) except parameter W because 1 is
an integer, 300 also, and the ratio as integers is 0.
You should use 1.0/300.0 (think of Fortran)
All is ok when using variables because they are usually already doubles
(e.g. W=2*PI/3+sqrt(2) ).

Cheers. Emmanuel.

--
What's up Doc ?
--------------------------------------------
Emmanuel FARHI, http://www.ill.fr/tas/people/Farhi.html   \|/ ____ \|/
CS-Group ILL4/156, Institut Laue-Langevin (ILL) Grenoble  ~@-/ oO \-@~
6 rue J. Horowitz, BP 156, 38042 Grenoble Cedex 9,France  /_( \__/ )_\
Work :Tel (33/0) 4 76 20 71 35. Fax (33/0) 4 76 48 39 06     \__U_/


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman2.mcstas.org/pipermail/mcstas-users/attachments/20010221/34b8438f/attachment.html>


More information about the mcstas-users mailing list