Code center > Darwinbots Program Source Code
Questions on Ceil and Floor
PurpleYouko:
As I said, in Visual Basic, SGN returns a Boolean state result with two possible outcomes. +1 or -1.
It cannot return zero unless you write a whole bunch of code to take the input of zero as a special case..
And yes there are safeguards against dividing by zero in DarwinBots.
:D PY :D
Botsareus:
'Microsoft Visual Basic 6.0
'Form1, no tricks
Private Sub Form_Load()
MsgBox Sgn(700) 'My vb is messed up it returns 1
MsgBox Sgn(0) 'My vb is messed up it returns 0
MsgBox Sgn(-700) 'My vb is messed up it returns -1
End Sub
'Enterpise Edition
Botsareus:
'This one could be very useful , once you figure out the rest of the code (hint)
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
Private Sub Form_Load()
MsgBox DNASgn(4) 'Good Luck with that, I dont have enough code to make it work
End Sub
Botsareus:
Endy, they are lieing about that "Sgn()" function , I have just porved it. :D , no really: how come no one replyed?
Numsgil:
Whatever the case, I can add a sepcial case to return 0 for 0.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version