Code center > Darwinbots3
Make v3 support decimals
Botsareus:
Sounds good. But if too much trouble forget about it... I realise what Numsgil means when he says that the desimal math is a pain in the a$$...
gymsum:
Idea!
It might be easeir for both programmers, bot authors and DB if we supported decimals only as results in functions, we could use Sig Figs to round decimals up to a point easily used for aomparisons, say a sig fig limit of 3 numbers, so no matter what, the conditionals only use at best a y.xx number, or a yxx number depending on how we set it. I say use sig figs only for decimals that go beyond two places; you can still acurately calculate things, but could only compare the more relevant numbers, and since it would be Sig Fig, numbers such as 0.0000000000054 would still show up, only in as 5.4 or 0.54. Doing so, it might be wise to add a sysvar that returns the exponent for Scientific Notation, this could be usefull for decoding purposes, but yes I think this is how most biology handles so called floating numbers. Some insignificant numbers just aren't worth calculating, and it can be hard to identify repeating numbers which are better exspressed as some number over another I.e. .27272727272 = 27/99 so maybe instead of even using decimals, we switch to fractionals, as they are not decimals in form, and both numbers can be used for seperate functions.
bacillus:
People can easily look at a fraction and say Okay, that's 5/9 or something like that. The problem is putting it into code.
I found a link which might help this along, although I don't completely understand it myself:
DEC2FRAC.pdf
Numsgil:
We could maybe implement the idea of rational numbers. Basically just define the stack as operating with some m/n where m and n are integers. We'd need to do a range check to make sure that all the operations (add, sub, mult, div, etc. etc.) produce good results over the given range. If after an arbitrary number of operations the rational numerator and denominator are so large that they overflow the integer math, that's not any better than using floating points.
gymsum:
Yeah it would need limitations based on the programming.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version