Code center > Darwinbots Program Source Code

Questions on Ceil and Floor

<< < (2/6) > >>

SyndLig:
So wait, in DB currently, 0 / 0 = 1 ?

PurpleYouko:
No Actually in DB 0/0 = "Division by zero error"

It is just that 0 is considered a positive number in Visual Basic.

SGN is Boolean. It can only have two states.

 :D  PY  :D

Botsareus:
(hint) Make it exactly like in vb:

+n -----> +1
0   -----> 0
-n ------> -1

shvarz:
So, a gene like

cond
start
0 0 div
end

would crash the program?  Or there are safeguards?

Numsgil:
0 0 div is undefine behavior.  Currently DB returns 0 for this.

And the VB sgn function works like this:

0 and + sgn = 1
- sng = -1

proof?

here's the code:


--- Code: ---'This one could be very useful
Private Sub DNASgn(robotnumber As Integer) 'returns sign of number on stack
    Dim a As Integer
    a = readst(robotnumber)
    
    writest robotnumber, Sgn(a)
End Sub
--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version