double-double
Version:
Pure double-double precision functions *with strict error bounds*.
1 lines • 5.42 kB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([[31],{168:function(e,t,n){"use strict";n.r(t),n.d(t,"frontMatter",(function(){return o})),n.d(t,"metadata",(function(){return c})),n.d(t,"rightToc",(function(){return i})),n.d(t,"default",(function(){return p}));var r=n(2),a=n(9),b=(n(0),n(207)),o={id:"_basic_fast_two_diff_",title:"fastTwoDiff",sidebar_label:"fastTwoDiff"},c={id:"modules/_basic_fast_two_diff_",isDocsHomePage:!1,title:"fastTwoDiff",description:"fastTwoDiff(a number): number[]",source:"@site/docs\\modules\\_basic_fast_two_diff_.md",permalink:"/double-double/docs/modules/_basic_fast_two_diff_",sidebar_label:"fastTwoDiff",sidebar:"sidebar",previous:{title:"Introduction",permalink:"/double-double/docs/"},next:{title:"fastTwoSum",permalink:"/double-double/docs/modules/_basic_fast_two_sum_"}},i=[],l={rightToc:i};function p(e){var t=e.components,n=Object(a.a)(e,["components"]);return Object(b.b)("wrapper",Object(r.a)({},l,n,{components:t,mdxType:"MDXLayout"}),Object(b.b)("p",null,Object(b.b)("strong",{parentName:"p"},"fastTwoDiff"),"(",Object(b.b)("inlineCode",{parentName:"p"},"a"),": number, ",Object(b.b)("inlineCode",{parentName:"p"},"b"),": number): ",Object(b.b)("em",{parentName:"p"},"number[]")),Object(b.b)("p",null,Object(b.b)("em",{parentName:"p"},"Defined in ",Object(b.b)("a",Object(r.a)({parentName:"em"},{href:"https://github.com/FlorisSteenkamp/double-double/blob/d35ae52/src/basic/fast-two-diff.ts#L13"}),"basic/fast-two-diff.ts:13"))),Object(b.b)("p",null,"Returns the difference and exact error of subtracting two floating point\nnumbers.\nUses an EFT (error-free transformation), i.e. ",Object(b.b)("inlineCode",{parentName:"p"},"a-b === x+y")," exactly.\nThe returned result is a non-overlapping expansion (smallest value first!)."),Object(b.b)("ul",null,Object(b.b)("li",{parentName:"ul"},Object(b.b)("strong",{parentName:"li"},"precondition:")," ",Object(b.b)("inlineCode",{parentName:"li"},"abs(a) >= abs(b)")," (a fast test that can be used is\n",Object(b.b)("inlineCode",{parentName:"li"},"(a > b) === (a > -b)"),")")),Object(b.b)("p",null,"See ",Object(b.b)("a",Object(r.a)({parentName:"p"},{href:"https://people.eecs.berkeley.edu/~jrs/papers/robustr.pdf"}),"https://people.eecs.berkeley.edu/~jrs/papers/robustr.pdf")),Object(b.b)("p",null,Object(b.b)("strong",{parentName:"p"},"Parameters:")),Object(b.b)("table",null,Object(b.b)("thead",{parentName:"table"},Object(b.b)("tr",{parentName:"thead"},Object(b.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"Name"),Object(b.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"Type"))),Object(b.b)("tbody",{parentName:"table"},Object(b.b)("tr",{parentName:"tbody"},Object(b.b)("td",Object(r.a)({parentName:"tr"},{align:null}),Object(b.b)("inlineCode",{parentName:"td"},"a")),Object(b.b)("td",Object(r.a)({parentName:"tr"},{align:null}),"number")),Object(b.b)("tr",{parentName:"tbody"},Object(b.b)("td",Object(r.a)({parentName:"tr"},{align:null}),Object(b.b)("inlineCode",{parentName:"td"},"b")),Object(b.b)("td",Object(r.a)({parentName:"tr"},{align:null}),"number")))),Object(b.b)("p",null,Object(b.b)("strong",{parentName:"p"},"Returns:")," ",Object(b.b)("em",{parentName:"p"},"number[]")))}p.isMDXComponent=!0},207:function(e,t,n){"use strict";n.d(t,"a",(function(){return u})),n.d(t,"b",(function(){return m}));var r=n(0),a=n.n(r);function b(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(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 c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){b(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},b=Object.keys(e);for(r=0;r<b.length;r++)n=b[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(e);for(r=0;r<b.length;r++)n=b[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=a.a.createContext({}),p=function(e){var t=a.a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},u=function(e){var t=p(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)}},f=a.a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,b=e.originalType,o=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),u=p(n),f=r,m=u["".concat(o,".").concat(f)]||u[f]||s[f]||b;return n?a.a.createElement(m,c(c({ref:t},l),{},{components:n})):a.a.createElement(m,c({ref:t},l))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var b=n.length,o=new Array(b);o[0]=f;var c={};for(var i in t)hasOwnProperty.call(t,i)&&(c[i]=t[i]);c.originalType=e,c.mdxType="string"==typeof e?e:r,o[1]=c;for(var l=2;l<b;l++)o[l]=n[l];return a.a.createElement.apply(null,o)}return a.a.createElement.apply(null,n)}f.displayName="MDXCreateElement"}}]);