You don't indicate how B and H are determined so it is impossible to say why that IF condition in not working. I suggest using a string type parameter with a values list to pick your rafter type so that the statement can read, for example:
IF rafter_type = "4x6" THEN
Conditions based on exact real number values can be tricky. It seems they can be undone by internal rounding errors. I have always tried to use greater than and less than to keep these reliable. For example, if I need to trap for 90 degrees (to avoid a divide by zero or some such) I would use:
IF angle > 89.99 & angle < 90.01 THEN
I started doing this when I found library parts which had worked in previous versions started to break in the new version of ArchiCAD at the time (AC6.0 if I recall correctly). I assume that it had to do with internal changes in the code or ways of handling precision and rounding errors. I also remember noticing that elements rotated or mirrored with the shift constrain would end up at 359.9997 degrees rather than zero.