## RE: [pcgen] [DOCS] [798013] DEFINE TAG Doc improvement

Expand Messages
• ... I believe this is what happens. ... It is not truncated until all processing is done unless the .TRUNC tag is used in the formula. ... No, the above
Message 1 of 6 , Nov 3, 2003
> -----Original Message-----
> From: Eddy Anthony [mailto:eddyba@...]

>From my own experience with formulas I found that after all
>the math is done PCGen will return a whole number, discarding any
>decimal, is this right.

I believe this is what happens.

>Is this kind of truncation going on in division during the
>working of any formulas (I would guess not as this seems to
>be what the .TRUNC tag is for)

It is not truncated until all processing is done unless the .TRUNC tag
is used in the formula.

>Speaking of .TRUNC I find the example confusing, I'm not a
>programmer so I'm not familiar with the concept. it reads:

>(TL/3.TRUNC)*2
>Truncation - would divide TL by 3, truncate and then multiply by 2.

No, the above example would truncate 3 (useless) divide TL by that and
then multiply by 2 and then truncate that answer again.

(TL/3).TRUNC*2 would divide TL by 3, then truncate, then multiply by 2
and truncate again.

>This is a circular definition, my guess is that .TRUNC simply drops
>the decimal in effect rounding down. Is there any case
>where it rounds up?

It always truncates. No rounding up.

>Is there an operator to make a number round up, or round to the
>nearest integer?

No.

>Is there even a need for that?

Not that I've come across.

Barak
~ PCGen BoD
~ OS Silverback
• Thanks Barak So to sum up- 1) To truncate is to drop the decimal or in other words round down. 2) To truncate an operation one should enclose it in perenthisis
Message 2 of 6 , Nov 3, 2003
Thanks Barak

So to sum up-
1) To truncate is to drop the decimal or in other words round down.

2) To truncate an operation one should enclose it in perenthisis like so:
(a+b).TRUNC (I'll be fixing the example in the docs).

One last question, can you truncate a variable? or this even nessissary?

For example DEFINE:FooDoo|CL/3
Will FooDoo already be truncated as it is the result of a completed formula?

Thanks for the info on the Total variable for the CONTAINS tag, I think I
have enough to make some edits.

--
Eddy
PCGen Doc Gibbon
• ... No problem. ... Correct. ... Correct again (as I understand it)... PCGen has some strange ways of determining precedence, but the above will guarantee that
Message 3 of 6 , Nov 3, 2003
> Thanks Barak

No problem.

> So to sum up-
> 1) To truncate is to drop the decimal or in other words round down.

Correct.

> 2) To truncate an operation one should enclose it in perenthisis
> like so:(a+b).TRUNC (I'll be fixing the example in the docs).

Correct again (as I understand it)... PCGen has some strange ways of
determining precedence, but the above will guarantee that the
operation gets truncated and not just the last operand.

> One last question, can you truncate a variable? or this even
> nessissary?

I think you could, but unless someone enters a decimal in the variable
in a .lst file, I wouldn't see any need to.

> For example DEFINE:FooDoo|CL/3
> Will FooDoo already be truncated as it is the result of a completed
> formula?

Yes. That's how a lot of our SA tags that use variables work. To use

SA:Foo Doo Ability %/day|FooDoo

This would show nothing until third level and then it would show Foo
Doo Ability 1/day until sixth level where it would show Foo Doo
Ability 2/day, etc.

> Thanks for the info on the Total variable for the CONTAINS tag, I
> think I have enough to make some edits.

Good! it's nice to see the docs being fixed up. Thanks to you and
Shane!

Barak (at the local CC)
~ PCGen BoD
~ OS Silverback
Your message has been successfully submitted and would be delivered to recipients shortly.