fixes #850. throws exception on nan input
fixes #850. throws exception on nan input

stan-dev/math,stan-dev/math,stan-dev/math,stan-dev/stan,stan-dev/math,stan-dev/stan,stan-dev/stan,stan-dev/stan,stan-dev/stan,stan-dev/math,stan-dev/math,stan-dev/math,stan-dev/math,stan-dev/math