it also knows PI as a constant and it supports brackets as well.
Synthmaker doesn't support recursive algorithms, so I had to use a different approach -> loops 😈
Have fun!
adamszabo ·
wow thats badass! I wonder if we can further evolve this were we can have variables like x
trogluddite ·
Excellent work, Myco. 🙂 I haven't been able to catch it out yet - even the precedence of *,/ over +,- seems to work perfectly!
stw ·
MyCo wrote: Hi,
Here is a new tool, to play with. It's just a one-day project, so it might have some bugs.
Aha - one day!
Anyone else feeling like an complete idiot? 😉
DigitalWhiteByte ·
Excellent Lavorone 😉
1+1-6+(-1*2)
but this does not seem to work well
infuzion ·
stw wrote: Aha - one day! Anyone else feeling like an complete idiot? 😉
Yes 😊
MyCo, so nice you being active again! BTW, is "floor/ceil" = min/max?
DigitalWhiteByte ·
DigitalWhiteByte wrote: Excellent Lavorone 😉
1+1-6+(-1*2)
but this does not seem to work well
I do not know if this is the best method,
but I added a module to check if the equation has been solved or there are new elements to be calculated.
so it seems to work fine.
MyCo ·
infuzion wrote: BTW, is "floor/ceil" = min/max?
floor = round down
ceil = round up
DigitalWhiteByte wrote: I do not know if this is the best method, but I added a module to check if the equation has been solved or there are new elements to be calculated
The fix does work, but i'm not sure if this is a good solution, because inside a loop you restart it.
I guess the problem is the sign again. I tried to fix that before. But this case is not handled.
The calculator does 1+1-6+(-1*2) this way:
brackets first: -1*2 = -2
result: 1+1-6+-2
now it does the minus (from right): it has no left param so it does 0-2 = -2
result: 1+1-6+-2
now it does the same minus again, because it's the same equation, but it should do 1-6
now come plus (from right): -6+-2 = -8
result: 1+1-8
plus again (from right): 1+1 = 2
result: 2-8
DigitalWhiteByte ·
I noticed that the result would stop at 2-8,
so I decided to do a check on the string and see if it was empty,
it starts only if the string is not empty and still contains an operation there.
I also believe it is not the best solution. 😕
DigitalWhiteByte ·
Ok, I deleted the module created in the previous version,
and I believe I have located the problem, the first loop calculation was not initialized correctly.
I hope this works well now.
MyCo ·
What did you change ?
DigitalWhiteByte ·
In the screen that appears when you loads the schematic
I made the changes by adding links and reordering trig.
Trig order:
1. get the string equation
2. to loop through occurrences. (link added)
3. to loop through ops
I removed the S & H before the module "doubled signs", it seemed superfluous at this point.
MyCo ·
OK, here is my fix for the above problem, and also for another which happened with stuff like:
1-1*-1
The basic of the fix is, that the calculater now differentiates between a sign flag and a minus operation. A flag has high priority, and the operation has low priority.
Wrote something here? To have a post removed or your name hidden, write to [email protected].