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.