NAN is short for "Not A Number". You get this for values like infinity. Check the values of sss and (s*s)+(ss*ss). Most probably either both of them are 0 or the (s*s)+(ss*ss)value is zero. You should know already that 0 divided by 0 is undefined and any number defined by 0 is also undefined. You should check for these conditions before dividing.
Also use [code][/code] when posting code.