1package sheet23import "src.rest/cat/012/internal/functions"45// Decimal arithmetic is a per-workbook calculation setting; what it6// computes in decimal is the function library's (functions/decimal.go).78// arith returns the formula to evaluate under the workbook's arithmetic9// setting.10func (w *Workbook) arith(n Node) Node {11 if w.decimal {12 return functions.Decimalize(n)13 }14 return n15}1617// Decimal reports whether the workbook computes in decimal.18func (w *Workbook) Decimal() bool { return w.decimal }1920// SetDecimal turns decimal arithmetic on or off for every sheet, as one21// undo step, and recalculates every formula.22func (w *Workbook) SetDecimal(on bool) {23 if on == w.decimal {24 return25 }26 label := "turn off decimal arithmetic"27 if on {28 label = "turn on decimal arithmetic"29 }30 w.change(w.sheets[w.Active()], label, Rect{}, func() {31 w.recordSettings()32 w.decimal = on33 w.structural = true // every formula computes differently34 })35}3637// Decimal and SetDecimal on a sheet are its workbook's.38func (s *Sheet) Decimal() bool { return s.wb.Decimal() }39func (s *Sheet) SetDecimal(on bool) { s.wb.SetDecimal(on) }