Pastebin
API
tools
faq
paste
Login
Sign up
SHARE
TWEET
Function to truncate too much decimals
a guest
Jul 20th, 2013
531
0
Never
Add comment
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!
Java
0.16 KB
| None
|
0
0
raw
download
clone
embed
print
report
static
public
double
truncateDecimals
(
double
n,
int
numberOfDecimals
)
{
return
Math
.
floor
(
n
*
Math
.
pow
(
10
,numberOfDecimals
)
)
/
Math
.
pow
(
10
, numberOfDecimals
)
;
}
Advertisement
Add Comment
Please,
Sign In
to add comment
Public Pastes
Untitled
1 hour ago | 11.54 KB
Untitled
2 hours ago | 16.83 KB
Untitled
4 hours ago | 17.66 KB
Untitled
4 hours ago | 10.06 KB
Untitled
8 hours ago | 2.58 KB
Untitled
8 hours ago | 16.77 KB
A.Knight.of.the.Seven.Kingdoms.S01E04.Seven.2...
9 hours ago | 29.38 KB
Untitled
10 hours ago | 12.81 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the
Cookies Policy
.
OK, I Understand
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!