flowhistory 2020. 11. 4. 08:36

특정 숫자값의 percent 계산 로직

 

            float fRes = 10.0f;      // target value
            float fPercent = 10.0f;  // percent value

            // 전체값의 %값
            float fSubValue = (fRes * fPercent)/100;
            // 1
            
            // 값을 %값으로 증가
            float fPlusValue = fRes * (1 + fPercent / 100);
            // 11
            
            // 값을 %값으로 감소
            float fMinusValue = fRes * (1 - fPercent / 100);
            // 9                       

 

728x90