Question: > 
> **Possible Duplicate:**  
> 
> [How to avoid scientific notation for large numbers in javascript?](https://stackoverflow.com/questions/1685680/how-to-avoid-scientific-notation-for-large-numbers-in-javascript)
> 
> 
> 

Hi All,

Doing something like this

```
alert(999999999999999999999999999999999999999999999999);

```

results in this

![Javascript Popup 1e+48](https://i.stack.imgur.com/YQVoz.png)

How to i stop converting a number to a string from saying 1e+XX or Infinity?

Answer: 
You're close:

```
validates_length_of  :some_field, :within => 0..10, :allow_blank => true

```

You can change the zero minimum size, since it will only be triggered when there is some input.

See also the validation [docs](http://apidock.com/rails/ActiveModel/Validations/HelperMethods/validates_length_of).
try:

validates\_length\_of :some\_field, :within => [0..10], :if => :some\_field?