blue-oil / blueoil

Bring Deep Learning to small devices
https://blueoil.org
Apache License 2.0
248 stars 86 forks source link

Avoid error comes from floating point literal decimal representation in code generation #1078

Open primenumber opened 4 years ago

primenumber commented 4 years ago

Conversion between floating point value ↔ decimal string representation cause some small error. Several solution exists:

I think that second solution may be more preferred.

tkng commented 4 years ago

I would like to know more about the second solution to prevent misunderstanding.

Do you intend to create a new binary file and load data from the file? Or do you intend to generate arrays like the one generated by the xxd -i command (an array of unsigned char that can be converted to an array of float or int with reinterpret_cast) and embed it in the source code?

It looks that the latter approch is better to me, because the amount of changes is likely less than the former.

primenumber commented 4 years ago

I supposed to embed data in the source code.

tkng commented 4 years ago

I see. I agree to your idea.

Are you already working on this issue? If you haven't, would you mind if I worked on it?

primenumber commented 4 years ago

No, I haven't started yet.

tkng commented 4 years ago

OK, I'll try.