query_sql "SELECT ROUND((1.0 / (1.0 + POW(10.0, ((" + .@points1[1] + ".0 - " + .@points1[0] + ".0) / 400.0)))), 1)", .@E1$;
query_sql "SELECT ROUND((1.0 / (1.0 + POW(10.0, ((" + .@points1[0] + ".0 - " + .@points1[1] + ".0) / 400.0)))), 1)", .@E2$;
//debugmes ".@E1$: " + .@E1$ + " .@E2$: " + .@E2$;
.@S1$ = (.@bool == 1 ? "1.0" : .@bool == 2 ? "0.0" : "0.5");
.@S2$ = (.@bool == 1 ? "0.0" : .@bool == 2 ? "1.0" : "0.5");
//debugmes ".@S1$: " + .@S1$ + " .@S2$: " + .@S2$;
query_sql "SELECT ROUND((" + .@points1[0] + ".0 + 16.0 * (" + .@S1$ + " - " + .@E1$ + ")), 1)", .@R1d$;
query_sql "SELECT ROUND((" + .@points1[1] + ".0 + 16.0 * (" + .@S2$ + " - " + .@E2$ + ")), 1)", .@R2d$;
//debugmes ".@R1d$: " + .@R1d$ + " .@R2d$: " + .@R2d$;
if (atoi(.@R1d$) > 300) .@R1d$ = "300";
if (atoi(.@R2d$) > 300) .@R2d$ = "300";