Nemoticchigga 0 Junior Poster in Training 16 Years Ago How would one seperate a decimal into 2 numbers, the left and right sides of the decimal? float example = 131.14567 into... int left = 131 float right = .14567 thanks. c++ 0 0 Share iamthwee 16 Years Ago http://www.cplusplus.com/reference/clibrary/cmath/modf.html 0 0 Share Nick Evan 4,005 Industrious Poster Team Colleague Featured Poster 16 Years Ago One option is something like: float in = 131.14567f; int left = (int)in; float right = left - in; 0 0 Share raul15791 27 Junior Poster 16 Years Ago Or may be convert the double into string. Then split the string using "." as the delimiter?? 0 0 Share ArkM 1,090 Postaholic 16 Years Ago Stop indulge in fantasies. See iamthwee's exhaustive answer... 0 0 Share Share Facebook Twitter LinkedIn Reply to this topic Be a part of the DaniWeb community We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge. Sign Up — It's Free!
Nick Evan 4,005 Industrious Poster Team Colleague Featured Poster 16 Years Ago One option is something like: float in = 131.14567f; int left = (int)in; float right = left - in; 0 0 Share
raul15791 27 Junior Poster 16 Years Ago Or may be convert the double into string. Then split the string using "." as the delimiter?? 0 0 Share
ArkM 1,090 Postaholic 16 Years Ago Stop indulge in fantasies. See iamthwee's exhaustive answer... 0 0 Share