Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for SetPrec (0.1 sec)

  1. src/math/big/floatexample_test.go

    	// Operate on numbers of different precision.
    	var x, y, z big.Float
    	x.SetInt64(1000)          // x is automatically set to 64bit precision
    	y.SetFloat64(2.718281828) // y is automatically set to 53bit precision
    	z.SetPrec(32)
    	z.Add(&x, &y)
    	fmt.Printf("x = %.10g (%s, prec = %d, acc = %s)\n", &x, x.Text('p', 0), x.Prec(), x.Acc())
    	fmt.Printf("y = %.10g (%s, prec = %d, acc = %s)\n", &y, y.Text('p', 0), y.Prec(), y.Acc())
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Jun 06 15:46:54 UTC 2024
    - 4.1K bytes
    - Viewed (0)
  2. src/math/big/floatmarsh.go

    			return errors.New("Float.GobDecode: buffer too small for finite form float")
    		}
    		z.exp = int32(byteorder.BeUint32(buf[6:]))
    		z.mant = z.mant.setBytes(buf[10:])
    	}
    
    	if oldPrec != 0 {
    		z.mode = oldMode
    		z.SetPrec(uint(oldPrec))
    	}
    
    	if msg := z.validate0(); msg != "" {
    		return errors.New("Float.GobDecode: " + msg)
    	}
    
    	return nil
    }
    
    // MarshalText implements the [encoding.TextMarshaler] interface.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 13 21:31:58 UTC 2024
    - 3.6K bytes
    - Viewed (0)
  3. src/math/big/bits_test.go

    	if mode == ToNearestAway {
    		panic("not yet implemented")
    	}
    	if mode == ToNearestEven && rbit == 1 && (sbit == 1 || sbit == 0 && bit0 != 0) || mode == AwayFromZero {
    		// round away from zero
    		f.SetMode(ToZero).SetPrec(prec)
    		f.Add(f, Bits{int(r) + 1}.Float())
    	}
    	return f
    }
    
    // Float returns the *Float z of the smallest possible precision such that
    // z = sum(2**bits[i]), with i = range bits. If multiple bits[i] are equal,
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 5.1K bytes
    - Viewed (0)
Back to top