The variables themselves seem to be set fine - Could it be the way you're using WRITELN LOG that's showing weird results? I tried the following program, and it worked fine:
getDegreesFromX(400, 400, 169)
wait key
end
//
// Retrieve the degrees of the sprite given its current X position against an origin
//
function getDegreesFromX( x, originX, radius )
// Calculate the degrees from the X values and the given radius
offsetX# = x - originX
radius# = radius
deg# = acos( offsetX# / radius# )
deg# = deg# - 90.0
//WRITELN LOG "x:%d originX:%d radius:%d", x, originX, radius
//WRITELN LOG "OffsetX:%f Radius:%f Degrees:%f", offsetX#, radius#, deg#
print "x: "+str$(x)+" originX: "+str$(originX)+" radius: "+str$(radius)
print "OffsetX: "+str$(offsetX#)+" Radius: "+str$(radius#)+" Degrees: "+str$(deg#)
endfunction deg#
I'm assuming that command is from MatrixUtils or some other plugin, unfortunately I can't test it right now.
EDIT: If I had to guess as to what the problem actually is, I'd assume that the %f is associating the variable as a FLOAT. When using the hash symbol (#) in DBP to define real numbers, I'm not sure whether it actually uses FLOATS or DOUBLES as the default - If DBP is treating them as doubles, that might cause weird results like what you're getting if that command expects them to be floats.
Have you tried explicitly defining the variables as float, something like
offsetX# as float
radius# as float
deg# as float
at the top of your function? I don't know if this is what's actually causing it, but couldn't hurt to try!