Multiply sets f to the product f*g: the result is correctly rounded, but not normalized.
(g extFloat)
| 233 | // Multiply sets f to the product f*g: the result is correctly rounded, |
| 234 | // but not normalized. |
| 235 | func (f *extFloat) Multiply(g extFloat) { |
| 236 | fhi, flo := f.mant>>32, uint64(uint32(f.mant)) |
| 237 | ghi, glo := g.mant>>32, uint64(uint32(g.mant)) |
| 238 | |
| 239 | // Cross products. |
| 240 | cross1 := fhi * glo |
| 241 | cross2 := flo * ghi |
| 242 | |
| 243 | // f.mant*g.mant is fhi*ghi << 64 + (cross1+cross2) << 32 + flo*glo |
| 244 | f.mant = fhi*ghi + (cross1 >> 32) + (cross2 >> 32) |
| 245 | rem := uint64(uint32(cross1)) + uint64(uint32(cross2)) + ((flo * glo) >> 32) |
| 246 | // Round up. |
| 247 | rem += (1 << 31) |
| 248 | |
| 249 | f.mant += (rem >> 32) |
| 250 | f.exp = f.exp + g.exp + 64 |
| 251 | } |
| 252 | |
| 253 | var uint64pow10 = [...]uint64{ |
| 254 | 1, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, |
no outgoing calls
no test coverage detected