jsp & java 소수점 연산에 관련하여 질문드립니다..
모두가람
Float str_sumA = (Float)Float.parseFloat(str_14_1)+(Float)Float.parseFloat(str_15_1)+(Float)Float.parseFloat(str_21_1);
이런식으로 소수점 끼리 연산을 하고 싶습니다..
여러방법을 사용해보았지만 소수점 연산이 되지않습니다..
Float.parseFloat(12333.22) ; ---이런식으로 데이터가 들어가게 되면 부동소수점이 된다고 들었습니다..
근대 왜 연산이 안되는지..
소수점 끼리 연산할수 있는 방법좀 알려주십시요..
소수점은 이미 변수에 저장되어있는 상태입니다..
많은도움부탁드려요 ㅠㅠ
-
알버트 2025-12-02
이런 저런 방법으로;;;
-
연연두 2025-12-02
System.out.println(value + \ * 100 = \ +(value*100));
System.out.println(\(int)(\+ value + \ * 100 + 0.5) = \ + (int)(value*100+0.5));
System.out.println(\(int)(\+ value + \ * 100 + 0.5) / 100.0 = \ + (int)(value*100+0.5)/100.0);
System.out.println(); -
아잉형님 2025-12-02
double value = 123.45678;
System.out.println(\ = 소수점 3째자리 이하 버림 = \);
System.out.println(value + \ * 100 = \ +(value*100));
System.out.println(\(int)(\+ value + \ * 100) = \ + (int)(value*100));
System.out.println(\(int)(\+ value + \ * 100) / 100.0 = -
돌삥 2025-12-02
인트로 변환 될때 소수점이 없어지지않나요?? 그방법은
-
푸른마을 2025-12-02
저는..double로 계산했는데요;;
정말 무식하게 했다는;;
double per = 0.00;
double per2 = 0.00;
double per3 = 0.00;
per = Integer.parseInt((String)uniqoutTotalMap.get(befDay));
per2 = Integer.parseInt((String)incomTotalMap.get(befDay));
per3 = per/per2;
df.format(per3*10
