{precision=>p} to reduce byte count
parent
f14417f32a
commit
9dbda93b4f
|
@ -267,7 +267,7 @@
|
||||||
<text>var result=</text>
|
<text>var result=</text>
|
||||||
<!-- if caller wants to yield a vector, don't cast -->
|
<!-- if caller wants to yield a vector, don't cast -->
|
||||||
<sequence select="if ( not( $dim gt 0 ) ) then
|
<sequence select="if ( not( $dim gt 0 ) ) then
|
||||||
concat( 'precision(', $precision, ', +(')
|
concat( 'p(', $precision, ', +(')
|
||||||
else
|
else
|
||||||
'('" />
|
'('" />
|
||||||
<choose>
|
<choose>
|
||||||
|
@ -442,7 +442,7 @@
|
||||||
|
|
||||||
<text>Math.</text>
|
<text>Math.</text>
|
||||||
<value-of select="local-name()" />
|
<value-of select="local-name()" />
|
||||||
<text>(precision(</text>
|
<text>(p(</text>
|
||||||
<value-of select="$precision" />
|
<value-of select="$precision" />
|
||||||
<text>, +(</text>
|
<text>, +(</text>
|
||||||
<apply-templates select="./c:*" mode="compile" />
|
<apply-templates select="./c:*" mode="compile" />
|
||||||
|
|
|
@ -1402,7 +1402,7 @@
|
||||||
|
|
||||||
<!-- store the premium -->
|
<!-- store the premium -->
|
||||||
<value-of select="$store" />
|
<value-of select="$store" />
|
||||||
<text>=precision(</text>
|
<text>=p(</text>
|
||||||
<value-of select="$precision" />
|
<value-of select="$precision" />
|
||||||
<!-- return the result of the calculation for this rate block -->
|
<!-- return the result of the calculation for this rate block -->
|
||||||
<text>,+(</text>
|
<text>,+(</text>
|
||||||
|
@ -1654,7 +1654,8 @@
|
||||||
<template name="compiler:static">
|
<template name="compiler:static">
|
||||||
<text>
|
<text>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
function precision(p, x)
|
// precision
|
||||||
|
function p(p, x)
|
||||||
{
|
{
|
||||||
if (x % 1 === 0) return x;
|
if (x % 1 === 0) return x;
|
||||||
return Math.round(x * p) / p;
|
return Math.round(x * p) / p;
|
||||||
|
|
Loading…
Reference in New Issue