Looking on the web there are many, many people trying to sort out how to overcome the INT rounding in programming and now I am one of the many.
Having said that there are lots of seemingly good looking answers to the problem, I have not found one that works for me.
I am trying to automatically resize photos and need the ratio to be precise to 2 decimal places, i.e.
Original image is 3000 W x 2400 H and the application resizes from the longest side, 3000, down to 800.
So 3000/800 = 3.75 then it works on the shorter side by applying the outcome of the first equation as the divisor thus, 2400/3.75 = 640.
Sounds really simple only it doesn't work.
It rounds the 1st equation down to 3 so the resized image becomes 800x800, not correct.
Here is a snippet of my code below:-
origW - original width
origH - original height
if (origW > origH){
int RorigW = origW/800;
int RorigH = origH/RorigW;
Any help would be lovely, I guess it is probably really simple because all the photo imaging software use resize but I have just missed it somewhere.
Regards..,
MT