Using math.floor to program an adobe form to calculate a premium


hello,

 

i’m trying program adobe form calculate premium using below formula.

 

var f = this.getfield("accidentdeathbenefit");

  1. event.value = math.floor(f.value* 0.206/1000);

 

the premium rounded down per state regulations, problem i’m having in using math.floor formula formula round down using whole numbers. need premium rounded down hundredths place. tried using math.pow option wasn’t calculating needed either. help, or suggestions appreciated.

i shift decimal point 100 , apply math.florr , reverse shift of decimal point final answer.

 

var f = this.getfield("accidentdeathbenefit");
var premium = f.value * 0.26 / 1000; // compugte premium;
premium = premium * 100; // shift decimal place 100;
premium = math.floor(premium); // truncate premium;
premium = premium / 100; // restore decimal place original position;
event.value = premium;

// or
 
var f = this.getfield("accidentdeathbenefit");
math.floor((f.value* 0.206/1000) * 100) / 100;



More discussions in PDF Forms


adobe

Comments

Popular posts from this blog

after effects warning: unable to create drawing surface

Maximum number of authorizations reached!