82 }); |
82 }); |
83 |
83 |
84 |
84 |
85 |
85 |
86 function ebc_to_srm(ebc) { |
86 function ebc_to_srm(ebc) { |
87 return -1.32303E-12 * Math.pow(ebc, 4) - 0.00000000291515 * Math.pow(ebc, 3) + 0.00000818515 * Math.pow(ebc, 2) + 0.372038 * ebc + 0.596351; |
87 var srm = -1.32303E-12 * Math.pow(ebc, 4) - 0.00000000291515 * Math.pow(ebc, 3) + 0.00000818515 * Math.pow(ebc, 2) + 0.372038 * ebc + 0.596351; |
|
88 if ((ebc < 0) || (srm < 0)) |
|
89 console.log("ebc_to_srm("+ebc+") = "+srm); |
|
90 return srm |
88 } |
91 } |
89 |
92 |
90 |
93 |
91 |
94 |
92 function srm_to_ebc(srm) |
95 function srm_to_ebc(srm) |
93 { |
96 { |
94 var ebc = 0.000000000176506 * Math.pow(srm, 4) + 0.000000154529 * Math.pow(srm, 3) - 0.000159428 * Math.pow(srm, 2) + 2.68837 * srm - 1.6004; |
97 var ebc = Math.round(0.000000000176506 * Math.pow(srm, 4) + 0.000000154529 * Math.pow(srm, 3) - 0.000159428 * Math.pow(srm, 2) + 2.68837 * srm - 1.6004); |
95 return Math.round(ebc); |
98 if ((ebc < 0) || (srm < 0)) |
|
99 console.log("srm_to_ebc("+srm+") = "+ebc); |
|
100 return ebc; |
96 } |
101 } |
97 |
102 |
98 |
103 |
99 |
104 |
100 /* |
105 /* |