Even if fixed supports 7 decimal places, those 7 decimal places should have the same value (after rounding) as the result provided by math.Big. I suspect the precision loss is in the Div method: https://github.com/robaho/fixed/blob/master/fixed.go#L232
Manlio Perillo On Sunday, February 2, 2020 at 12:11:08 AM UTC+1, Robert Engels wrote: > > fixed only supports 8 decimals places - fixed. Without digging into the > algorithm I’m sure that is the source of your issue. > > > On Feb 1, 2020, at 4:03 PM, crate...@gmail.com <javascript:> wrote: > > > Perhaps I'm doing something wrong or using the library outside of its > intended purpose, but I found that this library doesn't handle Muller's > Recurrence correctly. For those not familiar, Muller's Recurrence is 108 > - (815-1500/z)/y > > https://play.golang.org/p/sePTgjZzHeY > > See > https://latkin.org/blog/2014/11/22/mullers-recurrence-roundoff-gone-wrong/ > > On Sunday, January 26, 2020 at 8:46:16 AM UTC-8, Robert Engels wrote: >> >> Which is exactly what github.com/robaho/fixed and many others do! >> >> On Jan 26, 2020, at 10:34 AM, Michael Jones <michae...@gmail.com> wrote: >> >> >> ...thus the virtue of scaled integers. scaling by 100 makes cents whole, >> scaling by 10000*100 gives four decimal places beyond that. There is >> nothing bad about floating point despite the reputation, it's just not the >> number system from algebra; nor is binary floating point the same as >> decimal floating point. The problems all start with false presumptions. >> >> On Sun, Jan 26, 2020 at 8:20 AM Robert Engels <ren...@ix.netcom.com> >> wrote: >> >>> Just an FYI, often that is not correct. Many financial systems require >>> fractional pennies due to the volume of transactions. Think about taxing >>> stock exchanges.... the pennies add up quickly at any tax rate, so they use >>> fractional pennies to reduce the size of the error bucket. >>> >>> On Jan 26, 2020, at 8:50 AM, Pat Farrell <pat2...@gmail.com> wrote: >>> >>> >>> never use floating point if you are trying to represent money, say >>> dollars and cents or decimal values of the euro. >>> Store the money as integer number of pennies. >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "golang-nuts" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to golan...@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/golang-nuts/cc852ce3-6f88-40fd-8b19-877c76deec10%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/golang-nuts/cc852ce3-6f88-40fd-8b19-877c76deec10%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "golang-nuts" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to golan...@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/golang-nuts/AF9827F5-C849-4F4E-8229-005D6C9A0E03%40ix.netcom.com >>> >>> <https://groups.google.com/d/msgid/golang-nuts/AF9827F5-C849-4F4E-8229-005D6C9A0E03%40ix.netcom.com?utm_medium=email&utm_source=footer> >>> . >>> >> >> >> -- >> >> *Michael T. jonesmichae...@gmail.com* >> >> -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golan...@googlegroups.com <javascript:>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/46cadc14-9c8e-4c3a-9c6b-d0af7b621061%40googlegroups.com > > <https://groups.google.com/d/msgid/golang-nuts/46cadc14-9c8e-4c3a-9c6b-d0af7b621061%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/7e232e7a-3177-4a8a-bbcb-7271e58110b3%40googlegroups.com.