Code center > Darwinbots Program Source Code

Questions on Ceil and Floor

(1/6) > >>

Endy:
Thought of this code while converting Din, but can't seem to make it work correctly. :unsure:

A B sub sgn 0 floor  = 1 if A>B

A B sub sgn 0 ceil -1 mult = 1 if A<B

May be the dna itself, I've tried to check it but the sheer size of it is overwhelming right now. I suspect the ceil and floor commands are responsible. Possibly the new free store ability is causing some stack effects, and messing up the genes as a result but I would think Nums would have the values still be cleared from the stack.

Any help would be great,

Endy B)

Numsgil:
How exactly is it not working?

Note that A B sub sgn will return 1 if A = B since 0 sgn = 1

The free store still takes two values from the stack.

Endy:
Oops. :rolleyes:

Didn't realize that about sgn, I assumed that it would yield a zero since 0 is neutral. Darn DB math for not reflecting real math. :lol:

Endy B)

Numsgil:
I can change it no prob.  That's just how the VB sgn function works.

Endy:
I think it would be better if it was changed. I mainly use it for comparision between the two numbers, for stuff like greaterthan/lessthan and =/!=. With DB's 0/0 = 0 it is easier than normal to use the resulting zeros.

Endy B)

Navigation

[0] Message Index

[#] Next page

Go to full version