// AsScale adjusts this amount to set a minimum scale, rounding up, and returns true iff no precision
// was lost. (1.1e5).AsScale(5) would return 1.1e5, but (1.1e5).AsScale(6) would return 1e6.
973624
func (a infDecAmount) AsScale(scale Scale) (infDecAmount, bool) {
	tmp := &inf.Dec{}
	tmp.Round(a.Dec, scale.infScale(), inf.RoundUp)
	return infDecAmount{tmp}, tmp.Cmp(a.Dec) == 0
}
739361
func (tr Matrix) GetScale() float64 {
	x := 0.707106781*tr[0] + 0.707106781*tr[1]
	y := 0.707106781*tr[2] + 0.707106781*tr[3]
	return math.Sqrt(x*x + y*y)
}
306792
func scalex(x uint64, scale int) (sx uint64, ok bool) {
	if scale > 0 {
		if sx, ok = arith.MulPow10(x, uint64(scale)); !ok {
			return 0, false
		}
		return sx, true
	}
	p, ok := arith.Pow10(uint64(-scale))
	if !ok {
		return 0, false
	}
	return x / p, true
}
1126480
func (m *MockExtensionsV1beta1Interface) Scales(arg0 string) v1beta10.ScaleInterface {
	ret := m.ctrl.Call(m, "Scales", arg0)
	ret0, _ := ret[0].(v1beta10.ScaleInterface)
	return ret0
}
792528
func (w *Waveform) SetScale(x uint, y uint) error {
	return w.SetOptions(Scale(x, y))
}
653696
func (s *ColumnInfo) SetScale(v int64) *ColumnInfo {
	s.Scale = &v
	return s
}
123782
func runScale(args *docopt.Args, client controller.Client) error {
	app := mustApp()

	typeSpecs := args.All["<type>=<spec>"].([]string)

	showAll := args.Bool["--all"]

	if len(typeSpecs) > 0 && showAll {
		return fmt.Errorf("ERROR: Can't use --all when scaling")
	}

	releaseID := args.String["--release"]
	if releaseID != "" && showAll {
		return fmt.Errorf("ERROR: Can't use --all in combination with --release")
	}

	if len(typeSpecs) == 0 {
		return showFormations(client, releaseID, showAll, app)
	}

	release, err := determineRelease(client, releaseID, app)
	if err != nil {
		return err
	}

	processes := make(map[string]int, len(typeSpecs))
	tags := make(map[string]map[string]string, len(typeSpecs))
	invalid := make([]string, 0, len(release.Processes))
	for _, arg := range typeSpecs {
		i := strings.IndexRune(arg, '=')
		if i < 0 {
			return fmt.Errorf("ERROR: scale args must be of the form <typ>=<spec>")
		}

		countTags := strings.Split(arg[i+1:], ",")

		count, err := strconv.Atoi(countTags[0])
		if err != nil {
			return fmt.Errorf("ERROR: could not parse quantity in %q", arg)
		} else if count < 0 {
			return fmt.Errorf("ERROR: process quantities cannot be negative in %q", arg)
		}

		processType := arg[:i]
		if _, ok := release.Processes[processType]; ok {
			processes[processType] = count
		} else {
			invalid = append(invalid, fmt.Sprintf("%q", processType))
			continue
		}

		if len(countTags) > 1 {
			processTags := make(map[string]string, len(countTags)-1)
			for i := 1; i < len(countTags); i++ {
				keyVal := strings.SplitN(countTags[i], "=", 2)
				if len(keyVal) == 1 && keyVal[0] != "" {
					processTags[keyVal[0]] = "true"
				} else if len(keyVal) == 2 {
					processTags[keyVal[0]] = keyVal[1]
				}
			}
			tags[processType] = processTags
		}
	}
	if len(invalid) > 0 {
		return fmt.Errorf("ERROR: unknown process types: %s", strings.Join(invalid, ", "))
	}

	opts := ct.ScaleOptions{
		Processes: processes,
		Tags:      tags,
		NoWait:    args.Bool["--no-wait"],
	}

	status, err := client.Status()
	if err != nil {
		return err
	}
	v := version.Parse(status.Version)
	if !v.Dev && v.Before(version.Parse(minScaleRequestVersion)) {
		return runScaleWithJobEvents(client, app, release, opts)
	}
	return runScaleWithScaleRequest(client, app, release, opts)
}
665998
func (a *PrintToPDFArgs) SetScale(scale float64) *PrintToPDFArgs {
	a.Scale = &scale
	return a
}
1212978
func Convert_v1beta2_ScaleSpec_To_autoscaling_ScaleSpec(in *v1beta2.ScaleSpec, out *autoscaling.ScaleSpec, s conversion.Scope) error {
	return autoConvert_v1beta2_ScaleSpec_To_autoscaling_ScaleSpec(in, out, s)
}
13748
func (m *metricUnit) CountScale() CountUnit {
	d := m.CountDim()
	if d == 0 {
		panic("no count scale on unit")
	}

	return CountUnit(1<<20 | (uint32((m.repr>>8)&0xF))>>8)
}
467253
func (x *Big) Precision() int {
	// Cannot call validate since validate calls this method.
	if !x.IsFinite() {
		return 0
	}
	if x.precision == 0 {
		return 1
	}
	return x.precision
}
525502
func (c *Client) ApplicationScale(applicationName string) (int, error) {
	var results params.IntResults
	args := params.Entities{
		Entities: []params.Entity{{Tag: names.NewApplicationTag(applicationName).String()}},
	}
	err := c.facade.FacadeCall("ApplicationsScale", args, &results)
	if err != nil {
		return 0, errors.Trace(err)
	}
	if len(results.Results) != len(args.Entities) {
		return 0, errors.Errorf("expected %d result(s), got %d", len(args.Entities), len(results.Results))
	}
	return results.Results[0].Result, nil
}
495477
func (mat *T) SetScaling(s *vec2.T) *T {
	mat[0][0] = s[0]
	mat[1][1] = s[1]
	return mat
}
889852
func (mat *T) Scale(f float64) *T {
	mat[0][0] *= f
	mat[1][1] *= f
	mat[2][2] *= f
	return mat
}
321449
func (cr *Context) Scale(sx, sy float64) {
	C.cairo_scale(cr.Ptr, C.double(sx), C.double(sy))
	if err := cr.status(); err != nil {
		panic(err)
	}
}
1070611
func (api *API) Rescale(applications []string) error {
	args := params.Entities{
		Entities: make([]params.Entity, len(applications)),
	}
	for i, application := range applications {
		if !names.IsValidApplication(application) {
			return errors.NotValidf("application name %q", application)
		}
		tag := names.NewApplicationTag(application)
		args.Entities[i].Tag = tag.String()
	}
	var results params.ErrorResults
	err := api.caller.FacadeCall("Rescale", args, &results)
	if err != nil {
		return errors.Trace(err)
	}
	for _, result := range results.Results {
		if result.Error != nil {
			if err == nil {
				err = result.Error
			} else {
				logger.Errorf("additional rescale error: %v", err)
			}
		}
	}
	return errors.Trace(err)
}
519777
func Scale(x uint, y uint) OptionsFunc {
	return func(w *Waveform) error {
		return w.setScale(x, y)
	}
}