UNPKG

double-double

Version:

Pure double-double precision functions *with strict error bounds*.

1 lines 5.66 kB
(window.webpackJsonp=window.webpackJsonp||[]).push([[25],{162:function(e,t,n){"use strict";n.r(t),n.d(t,"frontMatter",(function(){return c})),n.d(t,"metadata",(function(){return b})),n.d(t,"rightToc",(function(){return o})),n.d(t,"default",(function(){return u}));var r=n(2),a=n(9),i=(n(0),n(207)),c={id:"_basic_reduce_significand_",title:"reduceSignificand",sidebar_label:"reduceSignificand"},b={id:"modules/_basic_reduce_significand_",isDocsHomePage:!1,title:"reduceSignificand",description:"reduceSignificand(a number): number",source:"@site/docs\\modules\\_basic_reduce_significand_.md",permalink:"/double-double/docs/modules/_basic_reduce_significand_",sidebar_label:"reduceSignificand",sidebar:"sidebar",previous:{title:"fastTwoSum",permalink:"/double-double/docs/modules/_basic_fast_two_sum_"},next:{title:"split",permalink:"/double-double/docs/modules/_basic_split_"}},o=[],l={rightToc:o};function u(e){var t=e.components,n=Object(a.a)(e,["components"]);return Object(i.b)("wrapper",Object(r.a)({},l,n,{components:t,mdxType:"MDXLayout"}),Object(i.b)("p",null,Object(i.b)("strong",{parentName:"p"},"reduceSignificand"),"(",Object(i.b)("inlineCode",{parentName:"p"},"a"),": number, ",Object(i.b)("inlineCode",{parentName:"p"},"bits"),": number): ",Object(i.b)("em",{parentName:"p"},"number")),Object(i.b)("p",null,Object(i.b)("em",{parentName:"p"},"Defined in ",Object(i.b)("a",Object(r.a)({parentName:"em"},{href:"https://github.com/FlorisSteenkamp/double-double/blob/d35ae52/src/basic/reduce-significand.ts#L17"}),"basic/reduce-significand.ts:17"))),Object(i.b)("p",null,"Truncates a floating point value's significand and returns the result.\nSimilar to split, but with the ability to specify the number of bits to keep."),Object(i.b)("p",null,"Theorem 17 (Veltkamp-Dekker): Let a be a p-bit floating-point number, where\np >= 3. Choose a splitting point s such that p/2 <= s <= p-1. Then the\nfollowing algorithm will produce a (p-s)-bit value a_hi and a\nnonoverlapping (s-1)-bit value a_lo such that abs(a_hi) >= abs(a_lo) and\na = a_hi + a_lo."),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},"see ",Object(i.b)("a",Object(r.a)({parentName:"li"},{href:"https://people.eecs.berkeley.edu/~jrs/papers/robustr.pdf"}),"Shewchuk"))),Object(i.b)("p",null,Object(i.b)("strong",{parentName:"p"},"Parameters:")),Object(i.b)("table",null,Object(i.b)("thead",{parentName:"table"},Object(i.b)("tr",{parentName:"thead"},Object(i.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"Name"),Object(i.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"Type"),Object(i.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"Description"))),Object(i.b)("tbody",{parentName:"table"},Object(i.b)("tr",{parentName:"tbody"},Object(i.b)("td",Object(r.a)({parentName:"tr"},{align:null}),Object(i.b)("inlineCode",{parentName:"td"},"a")),Object(i.b)("td",Object(r.a)({parentName:"tr"},{align:null}),"number"),Object(i.b)("td",Object(r.a)({parentName:"tr"},{align:null}),"a double")),Object(i.b)("tr",{parentName:"tbody"},Object(i.b)("td",Object(r.a)({parentName:"tr"},{align:null}),Object(i.b)("inlineCode",{parentName:"td"},"bits")),Object(i.b)("td",Object(r.a)({parentName:"tr"},{align:null}),"number"),Object(i.b)("td",Object(r.a)({parentName:"tr"},{align:null}),"the number of significand bits to leave intact")))),Object(i.b)("p",null,Object(i.b)("strong",{parentName:"p"},"Returns:")," ",Object(i.b)("em",{parentName:"p"},"number")))}u.isMDXComponent=!0},207:function(e,t,n){"use strict";n.d(t,"a",(function(){return p})),n.d(t,"b",(function(){return m}));var r=n(0),a=n.n(r);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function b(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=a.a.createContext({}),u=function(e){var t=a.a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):b(b({},t),e)),n},p=function(e){var t=u(e.components);return a.a.createElement(l.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return a.a.createElement(a.a.Fragment,{},t)}},d=a.a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,c=e.parentName,l=o(e,["components","mdxType","originalType","parentName"]),p=u(n),d=r,m=p["".concat(c,".").concat(d)]||p[d]||s[d]||i;return n?a.a.createElement(m,b(b({ref:t},l),{},{components:n})):a.a.createElement(m,b({ref:t},l))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,c=new Array(i);c[0]=d;var b={};for(var o in t)hasOwnProperty.call(t,o)&&(b[o]=t[o]);b.originalType=e,b.mdxType="string"==typeof e?e:r,c[1]=b;for(var l=2;l<i;l++)c[l]=n[l];return a.a.createElement.apply(null,c)}return a.a.createElement.apply(null,n)}d.displayName="MDXCreateElement"}}]);