Documentation
¶
Overview ¶
Copyright 2025 Dmitry Spasibenko
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IntWrapper ¶
type IntWrapper struct {
// V contains all digits of a decimal value
V int
// E is an exponent value the real decimal value is V*10^E. So
// if E is less than zero, it means that least significant E digits of V
// goes to the decimal fraction. For example, IntWrapper{V:1234, E:-2} means 12.34
// if E is greater than 0, than it is a decimal multiplier, so IntWrapper{V:1234, E:2}
// means 123400 etc.
E int
}
IntWrapper is a lightweight container to represent a decimal value in int value.
func FromFloat64 ¶
func FromFloat64(v float64, e int) IntWrapper
FromFloat64 returns the wrapper for the float64 value v and the decimal exponent e