#include int main(){ int panel_x[] = {1400,1280,1024}; int panel_y[] = {1050,768,768}; int xres[] = {1400,1280,1280,1024,800,640}; int yres[] = {1050,960,768,768,600,480}; int i,x; int num_panelsizes = sizeof(panel_x)/sizeof(panel_x[0]); int num_res = sizeof(xres)/sizeof(xres[0]); for(x=0;x panel_x[x]) continue; if(yres[i] > panel_y[x]) continue; float hratio = (float)xres[i]/(float)panel_x[x]; float vratio = (float)yres[i]/(float)panel_y[x]; unsigned long h1 = ((unsigned long)(hratio * 4096 + 0.5)); unsigned long h2 = ((unsigned long)(hratio * 4096 + 0.0)); unsigned long v1 = ((unsigned long)(vratio * 4096 + 0.5)); unsigned long v2 = ((unsigned long)(vratio * 4096 + 0.0)); printf("%ix%i h: %i %i diff %i v: %i %i diff %i\n",xres[i],yres[i],h1,h2,h1-h2,v1,v2,v1-v2); } } return 0; }