가능한 중복 두 배 : 내가 무엇을 기대
Precision error with floats in Java
Double number's multiplication with out precision and commas변환 문자열
public class Test {
public static void main(String[] args) {
double d = Double.parseDouble("64.4");
d -= 1;
System.out.println(d);
}
}
이 63.4입니다하지만 63.400000000000006
,536,913를 인쇄어떻게이 문제를 해결할 수 있습니까? 감사합니다. Format Number - Java 및 Decimal Format Example과 docs
이렇게 많은 중복 부동 ... 없애 (http://stackoverflow.com/questions/6713673/precision-error-with-floats-in- 자바), [자바 이중 정밀도] (http://stackoverflow.com/questions/6713673/precision-error-with-floats-in-ja VA). –
빼기를 수행 할 때까지 d에 오류가 표시되지 않습니다. 파싱이 아닌 에러를 보여주는 산술 에러가 발생합니다. –