If you want to solve the problem, integer does round, yes. If you just
want to get past the problem, the DateMaster Xtra does Julian to Gregorian
conversions. http://www.penworks.com/xtras/datemast/index.cgi
- Tab
At 02:36 PM 11/20/01 -0800, Kevan Dettelbach wrote:
>Hi all,
>
>It's been almost two years since I've visited the list after my breakdo...
>err sabatical. My current project requires that I be able to convert
>Gregorian/Julain dates to a lunar based calendar system. I was fortunate
>enough to find the code I needed on the web, though it was written in C ( a
>language I've grown rather rusty in).
>
>The conversion to Lingo went quite well ( I found myself wishing Lingo
>accepted the ++ and += symbols) but I soon ran into some trouble. As would
>be expected, the code to convert the dates is heavily based on mathematics
>and involves a mixture of floating point and integer calculations.
>
>When I ran my program, it did not give me any errors, but it was not
>returning the correct lunar date. The trouble lay in the different ways C
>and Lingo convert floating point to integer values.
>
>In C, if you assign a value such as 5.67 to an integer variable, the number
>is truncated to 5. In Lingo, (5.67).integer is rounded to the nearest
>integer, in this case 6.
>
>What I ended up having to do is to write a simple floor function and apply
>it carefully anywhere an integer variable was given a floating point value.
>
>This required me to study in detail both versions of the code andled me to
>wonder if a better way existed. I could not find any documentation in Lingo
>on built-in floor or ceiling functions, nor could I find any information on
>changing the way Lingo converted floats to ints. (ideally a system flag to
>turn off rounding would be nice).
>
>If anyone has any ideas, I'd appreciate hearing them.
>
>It's great to be back and I look forward to hearing from you...
>
>Kevan Dettelbach
>Lunny Communications
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo. Thanks!]