$par_values, which is used when calling $deriv, is already defined as map {$_->[1]} @parameters on line 154. So I imagine Steffen started writing the map in the call (the same as in the residual calculation down below), then realized he could make use of the existing variable… and then reached for the wrong variable my mistake. Happens to all of us now and then.
The similarity in magnitude to maxint is mostly coincidental, but yes, it’s evaluating the function sqrt( s*(x-x0)^2 + c) + y0 with most of the symbols (I think all of them except x) replaced by the refaddrs of array-refs instead of their correct values.
On most of the older perls sitting in my perlbrew dir, those values would typically be around 28 bits wide, while on my newer ones they’re 48 bits. All of them are 64-bit perls (use64bitint, use64bitall, ptrsize=8, ivsize=8, etc.), but it must be a difference of allocation, ASLR, or something like that. I say “most” of my older perls, but I notice I have one copy of perl-5.10.1 here that gives large addresses. It was built with GCC 6.3, whereas the ones that give me small addresses were built with GCC 4.x. Probably something in that.
But yeah, the finite difference calculation is entirely missing, and that code is entirely wrong even when it does pass the correct values. Presumably all it really succeeds in doing is launching the x value somewhere far away from the “bad derivative”, where it then converges by a different path. And the test is happy because it reaches the right answer eventually; it doesn’t really pay attention to what went wrong along the way.
$par_values, which is used when calling$deriv, is already defined asmap {$_->[1]} @parameterson line 154. So I imagine Steffen started writing the map in the call (the same as in the residual calculation down below), then realized he could make use of the existing variable… and then reached for the wrong variable my mistake. Happens to all of us now and then.The similarity in magnitude to maxint is mostly coincidental, but yes, it’s evaluating the function
sqrt( s*(x-x0)^2 + c) + y0with most of the symbols (I think all of them exceptx) replaced by the refaddrs of array-refs instead of their correct values.On most of the older perls sitting in my perlbrew dir, those values would typically be around 28 bits wide, while on my newer ones they’re 48 bits. All of them are 64-bit perls (
use64bitint,use64bitall,ptrsize=8,ivsize=8, etc.), but it must be a difference of allocation, ASLR, or something like that. I say “most” of my older perls, but I notice I have one copy of perl-5.10.1 here that gives large addresses. It was built with GCC 6.3, whereas the ones that give me small addresses were built with GCC 4.x. Probably something in that.But yeah, the finite difference calculation is entirely missing, and that code is entirely wrong even when it does pass the correct values. Presumably all it really succeeds in doing is launching the x value somewhere far away from the “bad derivative”, where it then converges by a different path. And the test is happy because it reaches the right answer eventually; it doesn’t really pay attention to what went wrong along the way.
I learned so much from this post! Thanks for submitting it.