@philmoz I forgot to ask, when using imath there are limits one has to ensure numbers don’t break, eg sqrtWhat are the limits in the fmath library, say, for sqrt?CheersGarry
--[[@fmath@chdk_version 1.5--]] u = 567 -- focus distance from the front principalf = 11000 -- simulating CHDK focal length, ie 11mm = 11000ff = fmath.new(f,1000) -- convert f to 11.000h = 1500 -- hyperfocal distancep = 3 -- pupil magndof = (ff*ff*p - ff*ff - ff*p*u + ff*u - h*p*u)/(p*(ff-h-u)) -- near DoF as measured from the front principalndof = ndof:tostr()print(ndof)sleep(5000)
if ndof < 45 then print(1) else print (2) end
I get the error "attempt to compare userdata with number", eg where ndof is a realCode: [Select]if ndof < 45 then print(1) else print (2) end
Do you believe it is fit enough to put into the main trunk? Or will it be added to cameras as and when users request it?
It looks like you can't mix fmath and integer values in the comparison operators - this appears to be a Lua limitation.
A metamethod only is selected when both objects being compared have the same type and the same metamethod for the selected operation.
I would still like to add the ability for Lua to load C based modules for things like this and imath, but it shouldn't be a show stopper for this feature.
Started by mattkime
Started by maestrodellatorre
Creative Uses of CHDK
Started by LukeSkaff
Started by Aged
Completed and Working Scripts
Started by rudi
« 1 2 »
General Discussion and Assistance