## Search found 17 matches

Sat Jan 18, 2020 6:31 pm
Forum: Support and Development
Topic: Deterministic ln(x) approximation
Replies: 12
Views: 2348

### Re: Deterministic ln(x) approximation

Having error is fine as long as it's consistent. Dude, it's massive. See the graph. Sure, determinism is determinism, and any cases where you're pow-ing by huge exponents is probably going to be rare anyway, though if it's something like damage = pow(base, charge) the fact that a higher charge can ...
Fri Jan 17, 2020 5:31 pm
Forum: Support and Development
Topic: Deterministic ln(x) approximation
Replies: 12
Views: 2348

### Re: Deterministic ln(x) approximation

Huh. Replacing that pow with local function pow(x, y) local yint, yfract = modf(y) local xyint = intPow(x, yint) local xyfract = exp(log(x)*yfract) return xyint * xyfract -- x ^ (yint + yfract) end leaves me with some serious error magnification too. I plotted abs(systempow(x, 1.5) - mypow(x, 1.5)) ...
Fri Jan 17, 2020 11:09 am
Forum: Support and Development
Topic: Deterministic ln(x) approximation
Replies: 12
Views: 2348

### Re: Deterministic ln(x) approximation

Sorry I'm late replying, but... thank you!!! I got it done. Thank you so much :-) -- x raised to an integer is not deterministic local function intPow(x, n) -- Exponentiation by squaring if n == 0 then return 1 elseif n < 0 then x = 1 / x n = -n end local y = 1 while n > 1 do if n % 2 == 0 then -- e...
Mon Jan 13, 2020 5:54 pm
Forum: Support and Development
Topic: Deterministic ln(x) approximation
Replies: 12
Views: 2348

### Re: Deterministic ln(x) approximation

Of course!

Binary searches don't have to be searching a table for a value.
Sun Jan 12, 2020 3:52 pm
Forum: Support and Development
Topic: Deterministic ln(x) approximation
Replies: 12
Views: 2348

### Re: Deterministic ln(x) approximation

The idea for the reduction is to use: ln(a*e^b) = ln(a) + b (for any b, including negatives), so you need to find the power of e that leaves a in the range 1 to 2. That's a logarithm in itself, but you only need an integer approximation; you can use e.g. binary search in an exponential table to fin...
Fri Jan 10, 2020 6:44 pm
Forum: General
Topic: Rounding mode
Replies: 11
Views: 6149

### Re: Rounding mode

So provided you use stock LÖVE or compile it yourself without changing that setting (and I can't think of any reason to), we're ok? You could just detect the mode and say "oi, recompile or just download" if it isn't the right one. To test: https://gist.githubusercontent.com/wolfboyft/1a51b28f5beb496...
Thu Jan 09, 2020 6:34 pm
Forum: General
Topic: Rounding mode
Replies: 11
Views: 6149

### Re: Rounding mode

Round to nearest, ties at even seems most common according to some tests I did with the community. I didn't get back any others. Even so, I would very much appreciate this feature being added. That is to say: bump.
Thu Jan 09, 2020 2:34 am
Forum: Support and Development
Topic: Deterministic ln(x) approximation
Replies: 12
Views: 2348

### Deterministic ln(x) approximation

Hi. For my game I am looking for an approximation of the natural logarithm function that returns the exact same result on all IEEE 754 (still just all) platforms (with same rounding mode which seems garuanteed under "stock settings" LÖVE). So that means it's got to rely on only +-*/ and sqrt. Oh, an...
Wed Dec 12, 2018 1:50 pm
Forum: Support and Development
Topic: Changing one of the methods in a LÖVE object
Replies: 2
Views: 1005

### Changing one of the methods in a LÖVE object

I made a deterministic maths library, and I want to make LÖVE's Transform objects use my sine and cosine algorithms for its rotate method. How can I do this? I tried: local rotate = function(self, angle) -- TODO print("It worked.") end local originalNewTransform = love.math.newTransform function lov...
Mon May 28, 2018 9:52 am
Forum: Support and Development
Topic: Cross-platformly deterministic to-the-power-of function
Replies: 21
Views: 3055

### Re: Cross-platformly deterministic to-the-power-of function

I kinda thought that "library" meant FFI in this case, but that's obviously not right.
They're not cross-platform anyway.