Finally got around to messing with that command again. I had no idea $(eval) was a thing! I’ll certainly have to keep that one in mind for some future weird commands.
So could this math API do for example 10 minus 15%? I am a creative streamer and it would be handy to work out the shrinkage rate for my clay while I am making on stream.
There is an error with the Log function. Any results that have a 0 after the decimal would remove the decimal point and the 0. Example: http://twitch.center/customapi/math?expr=log10(3.1622*32) should give 2.005139, but it gives 25139.
I guess this is actually a bug for any answer that has 0’s after the decimal point. (example: 0.1*0.1 gives 010000)
I am trying to get the sum of two numbers. I believe I am using the function correctly, I can get other modifiers to work i.e. multiplication, subtraction, etc.
@Kodirov There is nothing really wrong about any of those mathematical statements.
If you graph the function f(x)=1/tan(2x) you’ll see that as x approaches π from the left, the function explodes towards -infinity. That tells you that 1/tan(2π) is undefined.
But because π is an irrational number, the API can only approximate its value. It seems that the API approximates the value of π just slightly below its actual value, therefore 1/tan(2π) returns a very large negative value, but not infinity/-infinity/undefined.
Right, technically, 1/0 = ∞, but here tan(2/pi), due to precision errors, returns 0.0000000000000002, and therefore you end up with a really large number instead of infinity.