NaN cannot be returned in an int so not possible. > On Nov 29, 2018, at 4:41 AM, messju mohr <li...@lammfellpuschen.de> wrote: > > Hello, > > this looks like a really nice and useful library! :) > > Just one thing: At first glance i saw that fixed.Cmp() returns 0 when both > operands are NaN. > I think it would be more consistent if fixed.Cmp() would return NaN if any of > it's operands are NaN. > > just my 2ct > messju > > >> On Thu, Nov 29, 2018 at 12:47:05AM -0600, robert engels wrote: >> For those interesting in financial apps, I have released ‘fixed' >> at [1]https://github.com/robaho/fixed a high performance fixed-point math >> library primarily designed for to work with currencies. >> The benchmarks: (Decimal is the shopspring library, big Int/Float are the >> stdlib) >> >> BenchmarkAddFixed-8 2000000000 0.83 ns/op >> 0 B/op 0 allocs/op >> BenchmarkAddDecimal-8 3000000 457 ns/op >> 400 B/op 10 allocs/op >> BenchmarkAddBigInt-8 100000000 19.2 ns/op >> 0 B/op 0 allocs/op >> BenchmarkAddBigFloat-8 20000000 110 ns/op >> 48 B/op 1 allocs/op >> BenchmarkMulFixed-8 100000000 12.4 ns/op >> 0 B/op 0 allocs/op >> BenchmarkMulDecimal-8 20000000 94.2 ns/op >> 80 B/op 2 allocs/op >> BenchmarkMulBigInt-8 100000000 22.0 ns/op >> 0 B/op 0 allocs/op >> BenchmarkMulBigFloat-8 30000000 50.0 ns/op >> 0 B/op 0 allocs/op >> BenchmarkDivFixed-8 100000000 19.3 ns/op >> 0 B/op 0 allocs/op >> BenchmarkDivDecimal-8 1000000 1152 ns/op >> 928 B/op 22 allocs/op >> BenchmarkDivBigInt-8 20000000 68.4 ns/op >> 48 B/op 1 allocs/op >> BenchmarkDivBigFloat-8 10000000 151 ns/op >> 64 B/op 2 allocs/op >> BenchmarkCmpFixed-8 2000000000 0.28 ns/op >> 0 B/op 0 allocs/op >> BenchmarkCmpDecimal-8 100000000 10.8 ns/op >> 0 B/op 0 allocs/op >> BenchmarkCmpBigInt-8 200000000 8.37 ns/op >> 0 B/op 0 allocs/op >> BenchmarkCmpBigFloat-8 200000000 7.74 ns/op >> 0 B/op 0 allocs/op >> BenchmarkStringFixed-8 20000000 99.0 ns/op >> 16 B/op 1 allocs/op >> BenchmarkStringDecimal-8 5000000 326 ns/op >> 144 B/op 5 allocs/op >> BenchmarkStringBigInt-8 10000000 209 ns/op >> 80 B/op 3 allocs/op >> BenchmarkStringBigFloat-8 3000000 571 ns/op >> 272 B/op 8 allocs/op >> >> -- >> 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 [2]golang-nuts+unsubscr...@googlegroups.com. >> For more options, visit [3]https://groups.google.com/d/optout. >> >> References >> >> Visible links >> 1. https://github.com/robaho/fixed >> 2. mailto:golang-nuts+unsubscr...@googlegroups.com >> 3. https://groups.google.com/d/optout > > -- > 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. > For more options, visit https://groups.google.com/d/optout.
-- 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. For more options, visit https://groups.google.com/d/optout.