decimal icon indicating copy to clipboard operation
decimal copied to clipboard

long formula convert to decimal expression

Open huahuayu opened this issue 2 years ago • 3 comments

hi, I wonder if there's any way to convert a long formula into decimal expression, for example

A * D - B * C * E + C * D * E + C * E / F

huahuayu avatar Dec 20 '21 15:12 huahuayu

HI @huahuayu. Do you mean converting math formula (string representation) to code? For example: A * B + C to A.Mul(B).Add(C)? If so this library does not support such a feature, but I believe it would be quite fun side project that could use decimal as dependency :)

mwoss avatar Dec 21 '21 21:12 mwoss

Do you mean converting math formula (string representation) to code? For example: A * B + C to A.Mul(B).Add(C)?

Exactly! I am looking for helper tools like you description. For long formula it's so painful to convert it to decimal.

huahuayu avatar Dec 22 '21 00:12 huahuayu

I don't know any of such tools, unfortunately, but I believe there are a few of them already somewhere on the internet in different languages (at least for simple math formulas). Try to find them and rewrite them in Go using decimal :D

mwoss avatar Dec 26 '21 22:12 mwoss