FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
stackrox/pkg/mathutil/round.go at master · stackrox/stackrox · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
stackrox
/
stackrox
Public
Notifications
You must be signed in to change notification settings
Fork
191
Star
1.3k
Code
Issues
54
Pull requests
603
Actions
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
stackrox
/
pkg
/
mathutil
/
round.go
Copy path
More file actions
More file actions
Latest commit
History
History
History
9 lines (7 loc) · 236 Bytes
Breadcrumbs
stackrox
/
pkg
/
mathutil
/
round.go
Copy path
File metadata and controls
9 lines (7 loc) · 236 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
package
mathutil
import
"math"
// RoundToDecimal rounds a float64 number to a given precision in decimal digits.
func
RoundToDecimal
(
n
float64
,
d
int
)
float64
{
shift
:=
math
.
Pow
(
10
,
float64
(
d
))
return
math
.
Round
(
n
*
shift
)
/
shift
}
Back
|
FazBrowse Home
|
New Git URL