avoiding number_format expects double error

Under some circumstances `number_format` can return an error since it expects the var type to be `double`.

Now we're casting to make sure we get the proper type of var.
Merge pull request #2306 from curtismchale/patch-1

avoiding number_format expects double error