findRoot optimization and bugfix

and minor std.math cleanup
do not use real for double and float types.