add toDouble and fromDouble