<commit_before>// Package implements a fixed-point decimal
package fpd

import (
	"fmt"
	"math"
	"strconv"
	"strings"
)

// Decimal represents a fixed-point decimal.
type Decimal struct {
	value int
	scale int
}

// New returns a new fixed-point decimal
func New(value int, scale int) *Decimal {
	return &Decimal{value, scale}
}

// Rescale returns a rescaled version of the decimal. Returned 
// decimal may be less precise if the given scale is bigger 
// than the initial scale of the Decimal
//
// Example:
//
// 	d := New(12345, -4)
//	d2 := d.rescale(-1)
//	d3 := d2.rescale(-4)
//	println(d1)
//	println(d2)
//	println(d3)
//	
// Output: 
//
//	1.2345
//	1.2
//	1.2000
//
func (d *Decimal) rescale(scale int) *Decimal {
	var value int
	if scale > d.scale {<commit_msg>Add NewFromInt()<commit_after>// Package implements a fixed-point decimal
package fpd

import (
	"fmt"
	"math"
	"strconv"
	"strings"
)

// Decimal represents a fixed-point decimal.
type Decimal struct {
	value int
	scale int
}

// New returns a new fixed-point decimal
func New(value int, scale int) *Decimal {
	return &Decimal{value, scale}
}

// NewFromInt is a shorthand version of New(value, 1)
func NewFromInt(value int) *Decimal {
	return New(value, 1)
}

// Rescale returns a rescaled version of the decimal. Returned 
// decimal may be less precise if the given scale is bigger 
// than the initial scale of the Decimal
//
// Example:
//
// 	d := New(12345, -4)
//	d2 := d.rescale(-1)
//	d3 := d2.rescale(-4)
//	println(d1)
//	println(d2)
//	println(d3)
//	
// Output: 
//
//	1.2345
//	1.2
//	1.2000
//
func (d *Decimal) rescale(scale int) *Decimal {
	var value int
	if scale > d.scale {
{'fraction_non_alphanumeric': 0.144311377245509, 'fraction_numerical': 0.032335329341317366, 'mean_word_length': 2.9042056074766354, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5018768', 'n_tokens_mistral': 641, 'n_tokens_neox': 615, 'n_words': 204}