You'd get pretty far if the FPU could be persuaded to treat an arbitrary FP expression as a unit and perform optimisation and specifically isolate mantissa and exponent internally. But it seems that FPU designers are a long way from adopting APL as the programming language for the devices they design (or even ivy :-).
Lucio. On Friday, 18 August 2017 23:09:17 UTC+2, Michael Jones wrote: > > Integer is a different matter because of truncation. The order is > significant. > > Floating point is tricky there. the fractional parts can be multiplied in > any order in terms of precision. however, the exponents add so best of all > would be a kind of alternating summation that keeps them in the +/- 308 > range. (1e200 * 1e-199 * 1e180 * 1e-170 and so on). > > basically...it would be nicer if they were real numbers. :-) > > On Fri, Aug 18, 2017 at 11:49 AM, John Souvestre <jo...@souvestre.com > <javascript:>> wrote: > >> Ø "multiply first, then divide." >> >> >> >> While often the right method, I don’t think that it always is. Consider: >> >> - Integer: It is as long as the product doesn’t overflow (before the >> divide). >> >> - Floating: I’m inclined to think that combining numbers of the same >> magnitude first might be a better approach. >> >> >> >> John >> >> John Souvestre - New Orleans LA >> >> >> >> *From:* golan...@googlegroups.com <javascript:> [mailto: >> golan...@googlegroups.com <javascript:>] *On Behalf Of *Michael Jones >> *Sent:* 2017 August 18, Fri 11:50 >> *To:* golang-nuts >> *Subject:* [go-nuts] multiply and divide >> >> >> >> Here is a minor musing from something that came up yesterday. >> >> >> >> Sometimes we see a real number expression as simple as... >> >> >> >> x*y/z >> >> >> >> ...and knowing from basic algebra that... >> >> >> >> (x*y)/z == x*(y/z) >> >> >> >> ...we might not expect much difference between the two in our code. Alas, >> computer floating point does not involve real numbers, rather it uses an >> approximation of them. If you will copy >> https://play.golang.org/p/IlDxtvx7IY to your computer, build and run it, >> (too much CPU for the playground) you'll find that the order makes a >> difference. Or, you can just remember this phrase, "multiply first, then >> divide." >> >> >> >> -- >> >> Michael T. Jones >> michae...@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...@googlegroups.com <javascript:>. >> 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...@googlegroups.com <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Michael T. Jones > michae...@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.