I'm making an OS. While working on the calculator, I realized that most of the division didn't end. I've tried rounding, but it just keeps reporting an error. Is there a way to round an infinite value in Scratch?
Offline
Are you sure your problem isn't a big amount of decimals? You can reduce those by rounding the number to an arbitrary amount of decimals:
set [number v] to (3.14159265) set [decimals v] to (3) say ( (round ( (number) * (decimals) )) / (decimals) )Or eliminate all decimals by just rounding it to the nearest integer:
(round (number))
Offline
I've been trying to do:
set [display v] to <round<<(number1)/(number2)>*[1000]>/1000>It's pretty much the same as what you put, but i'll try what you suggested to see if it works. Thanks!
Last edited by Programmer_112 (2012-12-29 21:44:02)
Offline
Oh, I found the problem. I was forgetting to set number1 and number 2. Thanks for helping!
Offline
OK, so I have another problem. Whenever I join a number to another number that ends in zero, the new number replaces 0. How can I keep the 0?
Offline
Programmer_112 wrote:
OK, so I have another problem. Whenever I join a number to another number that ends in zero, the new number replaces 0. How can I keep the 0?
what? why are you using string operations on numbers? just use math. what is it you're trying to achieve?
Offline
I'm trying to make a calculator without using "questions". I have buttons, and the buttons provide input. The digits 1-9 all join together fine when i use
<join[][]>, but if the number that I'm trying to join to ends in 0, the zero is replaced.
Offline
so like (join [850] [9]) turns into 859 not 8509? thats weird, it sounds like it might be a bug.
Offline
Oh, I found the problem. The 0 wasn't using the same system of changing the display because of a different bug with that system, so the old display wasn't being recorded. Fixed. Thanks for helping!
Offline