vpiotr / decimal_for_cpp

Decimal data type for C++
273 stars 68 forks source link

no serialization/deserialization feature #2

Closed Offirmo closed 12 years ago

Offirmo commented 12 years ago

Nice lib. Tried it, it works OK.

It just miss a serialization/deserialization (to string) feature so I can save the values in my database without any loss.

Existing "to string" convert to double first, with potential precision loss. And there is no "from string", need to import from double, too.

Thanks.

vpiotr commented 12 years ago

You have already serialization (toString) which doesn't use "double" data type. What can be missing for you is deserialization without "double" but I assume the existing one works correctly.

Main features of decimal when comparing to double or int64:

From my point of view theoretically precision loss can appear only during calculations, not because of just using "double".

If I'm wrong, please send me a test case where the loss appears, I'll try to correct it.

Offirmo commented 11 years ago

Ok, I'll try again next time I work on this pet project.

On the other hand, are you planning to put mongoose-cpp http://code.google.com/r/vpiotr-mongoose-cpp/ on github ?

Thanks, I'm becoming more and more fan of your work ;)

vpiotr commented 11 years ago

No, I don't have any plans for such an operation. Actually I don't see any big difference between these two services.

vpiotr commented 10 years ago

fromString() function was added recently and it doesn't use double anymore.