Evaluating a floating point variable in Scheme language

后端 未结 2 549
眼角桃花
眼角桃花 2021-01-24 18:36

I want to read multiple data files (10 in total) in Ansys Fluent. I wrote a journal file which uses scheme language

(Do ((count 11.100 (+ count 0.100))) ((>=         


        
2条回答
  •  难免孤独
    2021-01-24 19:16

    Try this:

    (do ((count 111/10 (+ count 1/10))) ((>= count 12))
      (ti-menu-load-string 
       (format #f "file read-data data-~2,3F.dat" count)))
    

    I assume format is from SRFI-48 Intermediate Format Strings. I've changed the numbers to rational numbers because adding 0.1 gives you rounding errors in floating point.

提交回复
热议问题