{precision=>p} to reduce byte count

master
Mike Gerwitz 2021-01-27 16:52:31 -05:00
parent f14417f32a
commit 9dbda93b4f
2 changed files with 5 additions and 4 deletions

View File

@ -267,7 +267,7 @@
<text>var result=</text>
<!-- if caller wants to yield a vector, don't cast -->
<sequence select="if ( not( $dim gt 0 ) ) then
concat( 'precision(', $precision, ', +(')
concat( 'p(', $precision, ', +(')
else
'('" />
<choose>
@ -442,7 +442,7 @@
<text>Math.</text>
<value-of select="local-name()" />
<text>(precision(</text>
<text>(p(</text>
<value-of select="$precision" />
<text>, +(</text>
<apply-templates select="./c:*" mode="compile" />

View File

@ -1402,7 +1402,7 @@
<!-- store the premium -->
<value-of select="$store" />
<text>=precision(</text>
<text>=p(</text>
<value-of select="$precision" />
<!-- return the result of the calculation for this rate block -->
<text>,+(</text>
@ -1654,7 +1654,8 @@
<template name="compiler:static">
<text>
<![CDATA[
function precision(p, x)
// precision
function p(p, x)
{
if (x % 1 === 0) return x;
return Math.round(x * p) / p;