On Wednesday, 24 October 2018 18:52:27 UTC+2, Michael Jones wrote:
>
> https://en.wikipedia.org/wiki/Q_(number_format) says it all.
>
> you can use fixed point all the way...just shift after multiplies and 
> before divides and use double-width (int32) or wider math.
>
>
Yes, that's close enough for many purposes.  But it gets more complicated 
with carries/rounding and other functions (such as trig).

Scott 

 

> On Mon, Oct 22, 2018 at 3:24 PM Vasiliy Tolstov <v.to...@selfip.ru 
> <javascript:>> wrote:
>
>> Thanks for suggestions.
>> If somebody can look at github.com/unistack-org/go-crush package
>> (ported ceph crush to go) i'l be happy.
>> Now weight represented as float32, i'm try to use
>> https://github.com/shopspring/decimal but code looks ugly with many
>> conversations. And also as i see ceph code (mapper.c for crush) they
>> does not use something
>> different for weights but uint32. may be i miss something but i don't
>> understand how they deal with weights like 0.580 in such cases.
>> So if somebody wants to help - i'l be happy.
>> пн, 22 окт. 2018 г. в 17:14, 'Ingo Oeser' via golang-nuts
>> <golan...@googlegroups.com <javascript:>>:
>> >
>> > https://godoc.org/golang.org/x/image/math/fixed might provide some 
>> hints how to work with this kind of type.
>> >
>> > The idea is to use a special type and provide all operations you need.
>> >
>> > https://godoc.org/math/big#Rat might be helpful to create first tests 
>> of the basic math operations with maximum precision, before reducing 
>> precision with a conversion to a more limited data type.
>> >
>> > --
>> > 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...@googlegroups.com <javascript:>.
>> > For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>> --
>> Vasiliy Tolstov,
>> e-mail: v.to...@selfip.ru <javascript:>
>>
>> -- 
>> 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...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> -- 
>
> *Michael T. jonesmichae...@gmail.com <javascript:>*
>

-- 
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.

Reply via email to