Skip to content

Commit f9e8d47

Browse files
authored
Merge pull request mockingbirdnest#4228 from pleroy/RelativeError
A Mathematica function for evaluating intervals with relative error propagation
2 parents 5bcbddc + a82ccf7 commit f9e8d47

2 files changed

Lines changed: 261 additions & 21 deletions

File tree

mathematica/ieee754_floating_point_evaluation.wl

Lines changed: 150 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,35 @@ IEEEEvaluateWithAbsoluteError::usage =
3434
"intervals (assumed to not carry any error), or a list of two intervals " <>
3535
"for a value and its absolute error."
3636
IEEEEvaluateWithAbsoluteError::argnum =
37-
"IEEEEvaluate called with `1` arguments; 1 argument is expected.";
37+
"IEEEEvaluateWithAbsoluteError called with `1` arguments; 1 argument is expected.";
3838
IEEEEvaluateWithAbsoluteError::badass =
3939
"IEEEEvaluateWithAbsoluteError does not support associativity, expressions must be " <>
4040
"parenthesized."
4141

4242

43+
IEEEEvaluateWithRelativeError;
44+
IEEEEvaluateWithRelativeError::usage =
45+
"IEEEEvaluateWithRelativeeError[\!\(\*StyleBox[\"x\",\nFontSlant->\"Italic\"]\)] " <>
46+
"evaluates \!\(\*StyleBox[\"x\",\nFontSlant->\"Italic\"]\) using the rules of " <>
47+
"IEEE arithmetic, and propagates the relative error bounds at each stage of " <>
48+
"the computation. Returns a list of two intervals: the first one is the " <>
49+
"interval of the result evaluated with proper IEEE rounding, the second one is " <>
50+
"the range of the relative error on the result. The argument is an expression " <>
51+
"which can include numbers (assumed to be exact after correct rounding), " <>
52+
"intervals (assumed to not carry any error), or a list of two intervals " <>
53+
"for a value and its relative error.";
54+
IEEEEvaluateWithRelativeError::argnum =
55+
"IEEEEvaluateWithRelativeError called with `1` arguments; 1 argument is expected.";
56+
IEEEEvaluateWithRelativeError::badass =
57+
"IEEEEvaluateWithRelativeError does not support associativity, expressions must be " <>
58+
"parenthesized."
59+
60+
4361
UseFMA;
4462
UseFMA::usage =
45-
"UseFMA is an option for IEEEEvaluate and IEEEEvaluateWithAbsoluteError that " <>
46-
"specifies whether to use FMA for expressions of the form \!\(\*
63+
"UseFMA is an option for IEEEEvaluate, IEEEEvaluateWithAbsoluteError, and " <>
64+
"IEEEEvaluateWithRelativeError that specifies whether to use FMA for " <>
65+
"expressions of the form \!\(\*
4766
StyleBox[\"a\",\nFontSlant->\"Italic\"]\) * \!\(\*
4867
StyleBox[\"b\",\nFontSlant->\"Italic\"]\) + \!\(\*
4968
StyleBox[\"c\",\nFontSlant->\"Italic\"]\).";
@@ -91,37 +110,37 @@ errorBelow1:=If[
91110

92111

93112
(* ::Text:: *)
94-
(*Returns the error bound for the largest element (in absolute value) of its argument. The returned value is positive, regardless of the sign of the argument. The argument is an interval or an unbound variable. Note that if the largest element is a power of two, the error bound is the one below that power of two.*)
113+
(*Returns the error bound for the largest element (in absolute value) of its argument. The returned value is positive, regardless of the sign of the argument. The argument is an interval. Note that if the largest element is a power of two, the error bound is the one below that power of two.*)
95114

96115

97116
(* Would want to write Max[Log2[...]] below but that doesn't work somehow. *)
98117
absoluteErrorBound[x_]:=Block[{exponent=Log2[Max[Abs[x]]]},errorBelow1 2^Ceiling[exponent]];
99118

100119

101120
(* Special case because for an interval x*x^2 is not x^3. *)
102-
applyOp[cube,{va_,\[Delta]a_}]:=Block[
121+
applyOpWithAbsoluteError[cube,{va_,\[Delta]a_}]:=Block[
103122
{va2,\[Delta]a2,h,r,\[Delta]r},
104-
{va2,\[Delta]a2}=applyOp[#^2&,{va,\[Delta]a}];
123+
{va2,\[Delta]a2}=applyOpWithAbsoluteError[#^2&,{va,\[Delta]a}];
105124
r=va^3;(* Wrong! *)
106125
r=Interval[{CorrectlyRound[Min[r]],CorrectlyRound[Max[r]]}];
107126
h=absoluteErrorBound[r];
108127
\[Delta]r=ReplaceAll[Expand[(v2+\[Delta]2)(v+\[Delta])-(v2 v)],{v->va,\[Delta]->\[Delta]a,v2->va2,\[Delta]2->\[Delta]a2}]+Interval[{-h,h}];
109128
{r,\[Delta]r}];
110-
applyOp[op_,{va_,\[Delta]a_}]:=Block[
129+
applyOpWithAbsoluteError[op_,{va_,\[Delta]a_}]:=Block[
111130
{h,r,\[Delta]r},
112131
r=op[va];
113132
r=Interval[{CorrectlyRound[Min[r]],CorrectlyRound[Max[r]]}];
114133
h=absoluteErrorBound[r];
115134
\[Delta]r=ReplaceAll[Expand[op[v+\[Delta]]-op[v]],{v->va,\[Delta]->\[Delta]a}]+Interval[{-h,h}];
116135
{r,\[Delta]r}];
117-
applyOp[op_,{va_,\[Delta]a_},{vb_,\[Delta]b_}]:=Block[
136+
applyOpWithAbsoluteError[op_,{va_,\[Delta]a_},{vb_,\[Delta]b_}]:=Block[
118137
{h,r,\[Delta]r},
119138
r=op[va,vb];
120139
r=Interval[{CorrectlyRound[Min[r]],CorrectlyRound[Max[r]]}];
121140
h=absoluteErrorBound[r];
122141
\[Delta]r=ReplaceAll[Expand[op[v1+\[Delta]1,v2+\[Delta]2]-op[v1,v2]],{v1->va,\[Delta]1->\[Delta]a,v2->vb,\[Delta]2->\[Delta]b}]+Interval[{-h,h}];
123142
{r,\[Delta]r}];
124-
applyOp[op_,{va_,\[Delta]a_},{vb_,\[Delta]b_},{vc_,\[Delta]c_}]:=Block[
143+
applyOpWithAbsoluteError[op_,{va_,\[Delta]a_},{vb_,\[Delta]b_},{vc_,\[Delta]c_}]:=Block[
125144
{h,r,\[Delta]r},
126145
r=op[va,vb,vc];
127146
r=Interval[{CorrectlyRound[Min[r]],CorrectlyRound[Max[r]]}];
@@ -141,27 +160,140 @@ Block[
141160
SetAttributes[evae,HoldAll];
142161
evae[a_*b_+c_]:=If[
143162
usefma,
144-
applyOp[#1 #2+#3&,evae[a],evae[b],evae[c]],
145-
applyOp[Plus,applyOp[Times,evae[a],evae[b]],evae[c]]];
146-
evae[a_+b_]:=applyOp[Plus,evae[a],evae[b]];
163+
applyOpWithAbsoluteError[#1 #2+#3&,evae[a],evae[b],evae[c]],
164+
applyOpWithAbsoluteError[Plus,applyOpWithAbsoluteError[Times,evae[a],evae[b]],evae[c]]];
165+
evae[a_+b_]:=applyOpWithAbsoluteError[Plus,evae[a],evae[b]];
147166
evae[a_+b__]:=(Message[IEEEEvaluateWithAbsoluteError::badass]; $Failed);
148-
evae[a_*b_]:=applyOp[Times,evae[a],evae[b]];
167+
evae[a_*b_]:=applyOpWithAbsoluteError[Times,evae[a],evae[b]];
149168
evae[a_*b__]:=(Message[IEEEEvaluateWithAbsoluteError::badass]; $Failed);
150-
evae[a_/b_]:=applyOp[Divide,evae[a],evae[b]];
169+
evae[a_/b_]:=applyOpWithAbsoluteError[Divide,evae[a],evae[b]];
151170
(* Negation is exact. *)
152171
evae[-a_]:=-evae[a];
153172
(* Squaring an interval is not the same as multiplying two identical intervals. *)
154-
evae[a_^2]:=applyOp[#^2&,evae[a]];
155-
evae[a_^3]:=applyOp[cube,evae[a]];
156-
evae[a_^4]:=applyOp[#^2&,applyOp[#^2&,evae[a]]];
173+
evae[a_^2]:=applyOpWithAbsoluteError[#^2&,evae[a]];
174+
evae[a_^3]:=applyOpWithAbsoluteError[cube,evae[a]];
175+
evae[a_^4]:=applyOpWithAbsoluteError[#^2&,applyOpWithAbsoluteError[#^2&,evae[a]]];
157176
evae[a_?NumberQ]:=Block[{cra=CorrectlyRound[a]},evae[Interval[{cra,cra}]]];
158177
evae[{v_Interval,\[Delta]_Interval}]:={v,\[Delta]};
159178
evae[a_Interval]:={a,Interval[{0,0}]};
160179
evae[a_?ValueQ]:=evae[Evaluate[a]];
161180
evae[a_]:=a;
162181
evae[x]];
163182
IEEEEvaluateWithAbsoluteError[_, args__]:=
164-
(Message[IEEEEvaluate::argnum, Length[{args}] + 1]; $Failed);
183+
(Message[IEEEEvaluateWithAbsoluteError::argnum, Length[{args}] + 1]; $Failed);
184+
185+
186+
(* ::Text:: *)
187+
(*The relative error bound on an IEEE computation.*)
188+
189+
190+
relativeErrorBound := If[
191+
RoundingMode[]==NearestTiesToEven,
192+
FromRepresentation[Representation[1]+1/2]-1,
193+
FromRepresentation[Representation[1]+1]-1];
194+
195+
196+
(* ::Text:: *)
197+
(*Returns the relative error bound for a computation. The relative error is "small", i.e., close to 2^-53, not to (1+2^-53), and is an interval. The arguments are pairs of {value interval, relative error interval}.*)
198+
199+
200+
applyOpWithRelativeError[square,{va_,\[Delta]a_}]:=Block[
201+
{h,r,\[Delta]r},
202+
r=va^2;
203+
r=Interval[{CorrectlyRound[Min[r]],CorrectlyRound[Max[r]]}];
204+
h=relativeErrorBound;
205+
\[Delta]r=(1+\[Delta]a)^2 Interval[{1-h,1+h}]-1;
206+
{r,\[Delta]r}];
207+
applyOpWithRelativeError[cube,{va_,\[Delta]a_}]:=Block[
208+
{h,r,\[Delta]r},
209+
r=va^3;
210+
h=relativeErrorBound;
211+
\[Delta]r=(1+\[Delta]a)^3 Interval[{1-h,1+h}] Interval[{1-h,1+h}]-1;
212+
{r,\[Delta]r}];
213+
applyOpWithRelativeError[fourth,{va_,\[Delta]a_}]:=Block[
214+
{h,r,\[Delta]r},
215+
r=va^4;
216+
h=relativeErrorBound;
217+
\[Delta]r=(1+\[Delta]a)^4 Interval[{1-h,1+h}]Interval[{1-h,1+h}]-1;
218+
{r,\[Delta]r}];
219+
applyOpWithRelativeError[Plus,{va_,\[Delta]a_},{vb_,\[Delta]b_}]:=Block[
220+
{corners,err,h,\[Theta]2,\[Theta]\[Prime]2,r,\[Delta]r},
221+
r=va+vb;
222+
r=Interval[{CorrectlyRound[Min[r]],CorrectlyRound[Max[r]]}];
223+
If[
224+
Min[r]<0 && Max[r]>0,
225+
\[Delta]r=Interval[{-\[Infinity],+\[Infinity]}],
226+
h=relativeErrorBound;
227+
\[Theta]2=(1+\[Delta]a)Interval[{1-h,1+h}]-1;
228+
\[Theta]\[Prime]2=(1+\[Delta]b)Interval[{1-h,1+h}]-1;
229+
(* At the origin the function err has an indeterminate value
230+
bounded by \[Delta]wa and \[Delta]wb *)
231+
err[0,\[Delta]wa_,0,\[Delta]wb_]:=Interval[Min[{\[Delta]wa,\[Delta]wb}],Max[{\[Delta]wa,\[Delta]wb}]];
232+
err[wa_,\[Delta]wa_,wb_,\[Delta]wb_]:=(wa \[Delta]wa+wb \[Delta]wb)/(wa+wb);
233+
(* The function err is monotonic, and therefore its extrema
234+
are reached at the corners of its domain. *)
235+
corners=Outer[
236+
err,
237+
{Min[va],Max[va]},
238+
{Min[\[Theta]2],Max[\[Theta]2]},
239+
{Min[vb],Max[vb]},
240+
{Min[\[Theta]\[Prime]2],Max[\[Theta]\[Prime]2]}];
241+
\[Delta]r=Interval[{Min[corners],Max[corners]}]];
242+
{r,\[Delta]r}];
243+
applyOpWithRelativeError[Times,{va_,\[Delta]a_},{vb_,\[Delta]b_}]:=Block[
244+
{h,r,\[Delta]r},
245+
r=va vb;
246+
r=Interval[{CorrectlyRound[Min[r]],CorrectlyRound[Max[r]]}];
247+
h=relativeErrorBound;
248+
\[Delta]r=(1+\[Delta]a)(1+\[Delta]b)Interval[{1-h,1+h}]-1;
249+
{r,\[Delta]r}];
250+
applyOpWithRelativeError[Divide,{va_,\[Delta]a_},{vb_,\[Delta]b_}]:=Block[
251+
{h,r,\[Delta]r},
252+
r=va/vb;
253+
r=Interval[{CorrectlyRound[Min[r]],CorrectlyRound[Max[r]]}];
254+
h=relativeErrorBound;
255+
\[Delta]r=Interval[{1-h,1+h}](1+\[Delta]a)/(1+\[Delta]b)-1;
256+
{r,\[Delta]r}];
257+
applyOpWithRelativeError[fma,{va_,\[Delta]a_},{vb_,\[Delta]b_},{vc_,\[Delta]c_}]:=Block[
258+
{h,r,\[Delta]r},
259+
r=va vb+vc;
260+
r=Interval[{CorrectlyRound[Min[r]],CorrectlyRound[Max[r]]}];
261+
h=relativeErrorBound;
262+
\[Theta]3=(1+\[Delta]a)(1+\[Delta]b)Interval[{1-h,1+h}]-1;
263+
\[Theta]2=(1+\[Delta]c)Interval[{1-h,1+h}]-1;
264+
\[Delta]r=Interval[{Min[\[Theta]3,\[Theta]2],Max[\[Theta]3,\[Theta]2]}];
265+
{r,\[Delta]r}];
266+
267+
268+
SetAttributes[IEEEEvaluateWithRelativeError,HoldAll];
269+
Options[IEEEEvaluateWithRelativeError]={UseFMA->True};
270+
IEEEEvaluateWithRelativeError[x_,OptionsPattern[]]:=
271+
Block[
272+
{Plus,Times,evre,usefma=OptionValue[UseFMA]},
273+
SetAttributes[evre,HoldAll];
274+
evre[a_*b_+c_]:=If[
275+
usefma,
276+
applyOpWithRelativeError[fma,evre[a],evre[b],evre[c]],
277+
applyOpWithRelativeError[Plus,applyOpWithRelativeError[Times,evre[a],evre[b]],evre[c]]];
278+
evre[a_+b_]:=applyOpWithRelativeError[Plus,evre[a],evre[b]];
279+
evre[a_+b__]:=(Message[IEEEEvaluateWithRelativeError::badass]; $Failed);
280+
evre[a_*b_]:=applyOpWithRelativeError[Times,evre[a],evre[b]];
281+
evre[a_*b__]:=(Message[IEEEEvaluateWithRelativeError::badass]; $Failed);
282+
evre[a_/b_]:=applyOpWithRelativeError[Divide,evre[a],evre[b]];
283+
(* Negation is exact. *)
284+
evre[-a_]:=-evre[a];
285+
(* Squaring an interval is not the same as multiplying two identical intervals. *)
286+
evre[a_^2]:=applyOpWithRelativeError[square,evre[a]];
287+
evre[a_^3]:=applyOpWithRelativeError[cube,evre[a]];
288+
evre[a_^4]:=applyOpWithRelativeError[fourth,evre[a]];
289+
evre[a_?NumberQ]:=Block[{cra=CorrectlyRound[a]},evre[Interval[{cra,cra}]]];
290+
evre[{v_Interval,\[Delta]_Interval}]:={v,\[Delta]};
291+
evre[a_Interval]:={a,Interval[{0,0}]};
292+
evre[a_?ValueQ]:=evre[Evaluate[a]];
293+
evre[a_]:=a;
294+
evre[x]];
295+
IEEEEvaluateWithRelativeError[_, args__]:=
296+
(Message[IEEEEvaluateWithRelativeError::argnum, Length[{args}] + 1]; $Failed);
165297

166298

167299
End[]

mathematica/ieee754_floating_point_evaluation_test.wl

Lines changed: 111 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ On[Assert]
2121
?"IEEE754FloatingPointEvaluation`*"
2222

2323

24-
(* ::Section:: *)
24+
(* ::Section::Closed:: *)
2525
(*IEEEEvaluate*)
2626

2727

@@ -110,8 +110,8 @@ Assert[
110110
IEEEEvaluate[-1/10-1/10-1/10-1/10-1/10-1/10-1/10-1/10-1/10-1/10]==$Failed];
111111

112112

113-
(* ::Section:: *)
114-
(*IEEEEvaluateInterval*)
113+
(* ::Section::Closed:: *)
114+
(*IEEEEvaluateWithAbsoluteError*)
115115

116116

117117
(* ::Input::Initialization:: *)
@@ -290,3 +290,111 @@ bits[C\[FivePointedStar]]
290290

291291
(* ::Input::Initialization:: *)
292292
End[]
293+
294+
295+
(* ::Section:: *)
296+
(*IEEEEvaluateWithRelativeError*)
297+
298+
299+
(* ::Subsection:: *)
300+
(*Explicit Bounds*)
301+
302+
303+
(* ::Input::Initialization:: *)
304+
Assert[IEEEEvaluateWithRelativeError[2*3+4,UseFMA->True]=={Interval[{10,10}],Interval[{-2^-53,2^-53}]}];
305+
Assert[IEEEEvaluateWithRelativeError[2*3+4,UseFMA->False]=={Interval[{10,10}],Interval[{(6(-2 2^-53+2^-106)-4 2^-53)/10,(6(2 2^-53 +2^-106)+4 2^-53)/10}]}];
306+
307+
308+
(* ::Input::Initialization:: *)
309+
Assert[IEEEEvaluateWithRelativeError[1+2]=={Interval[{3,3}],Interval[{-2^-53,2^-53}]}];
310+
Assert[IEEEEvaluateWithRelativeError[2*3]=={Interval[{6,6}],Interval[{-2^-53,2^-53}]}];
311+
Assert[IEEEEvaluateWithRelativeError[2/3]=={Interval[{CorrectlyRound[2/3],CorrectlyRound[2/3]}],Interval[{-2^-53,2^-53}]}]
312+
313+
314+
(* ::Input::Initialization:: *)
315+
Assert[IEEEEvaluateWithRelativeError[-Interval[{-2,1}]]=={Interval[{-1,2}],Interval[{0,0}]}];
316+
317+
318+
(* ::Input::Initialization:: *)
319+
Assert[IEEEEvaluateWithRelativeError[Interval[{-1,2}]^2]=={Interval[{0,4}],Interval[{-2^-53,2^-53}]}];
320+
Assert[IEEEEvaluateWithRelativeError[Interval[{-1,3}]^3]=={Interval[{-1,27}],Interval[{-2 2^-53+2^-106,2 2^-53+2^-106}]}];
321+
Assert[IEEEEvaluateWithRelativeError[Interval[{-1,3}]^4]=={Interval[{0,81}],Interval[{-2 2^-53+ 2^-106,2 2^-53+ 2^-106}]}];
322+
323+
324+
(* ::Input::Initialization:: *)
325+
Assert[IEEEEvaluateWithRelativeError[1]=={Interval[{1,1}],Interval[{0,0}]}];
326+
Assert[IEEEEvaluateWithRelativeError[0.1]=={Interval[{CorrectlyRound[0.1],CorrectlyRound[0.1]}],Interval[{0,0}]}];
327+
328+
329+
(* ::Input::Initialization:: *)
330+
Assert[IEEEEvaluateWithRelativeError[Interval[{0,1}]+Interval[{0,2}]]==
331+
{Interval[{0,3}],Interval[{-2^-53,2^-53}]}];
332+
333+
334+
(* ::Input::Initialization:: *)
335+
Assert[IEEEEvaluateWithRelativeError[Interval[{0,1}]+Interval[{-2,0}]]==
336+
{Interval[{-2,1}],Interval[{-\[Infinity],\[Infinity]}]}];
337+
338+
339+
(* ::Input::Initialization:: *)
340+
Assert[IEEEEvaluateWithRelativeError[2,3]==$Failed];
341+
342+
343+
(* ::Subsection:: *)
344+
(*Higham' s \[Gamma] Model*)
345+
346+
347+
(* ::Text:: *)
348+
(*[Hig02], Lemma 3.1.*)
349+
350+
351+
(* ::Input::Initialization:: *)
352+
\[Gamma][n_]:=n 2^-53/(1-n 2^-53)
353+
354+
355+
(* ::Input::Initialization:: *)
356+
Assert[AllTrue[Table[Max[Abs[IEEEEvaluateWithRelativeError[Interval[{RandomReal[],RandomReal[]}]Interval[{RandomReal[],RandomReal[]}]]][[2]]]<=\[Gamma][1],{100}],TrueQ]]
357+
358+
359+
(* ::Input::Initialization:: *)
360+
Assert[AllTrue[Table[Max[Abs[IEEEEvaluateWithRelativeError[(Interval[{RandomReal[],RandomReal[]}]Interval[{RandomReal[],RandomReal[]}]) Interval[{RandomReal[],RandomReal[]}]]][[2]]]<=\[Gamma][2],{100}],TrueQ]]
361+
362+
363+
(* ::Input::Initialization:: *)
364+
Assert[AllTrue[Table[Max[Abs[IEEEEvaluateWithRelativeError[((Interval[{RandomReal[],RandomReal[]}]Interval[{RandomReal[],RandomReal[]}]) Interval[{RandomReal[],RandomReal[]}])Interval[{RandomReal[],RandomReal[]}]]][[2]]]<=\[Gamma][3],{100}],TrueQ]]
365+
366+
367+
(* ::Input::Initialization:: *)
368+
Assert[AllTrue[Table[Max[Abs[IEEEEvaluateWithRelativeError[Interval[{RandomReal[],RandomReal[]}]^2]][[2]]]<=\[Gamma][1],{100}],TrueQ]]
369+
370+
371+
(* ::Input::Initialization:: *)
372+
Assert[AllTrue[Table[Max[Abs[IEEEEvaluateWithRelativeError[Interval[{RandomReal[],RandomReal[]}]^3]][[2]]]<=\[Gamma][2],{100}],TrueQ]]
373+
374+
375+
(* ::Input::Initialization:: *)
376+
Assert[AllTrue[Table[Max[Abs[IEEEEvaluateWithRelativeError[Interval[{RandomReal[],RandomReal[]}]^4]][[2]]]<=\[Gamma][3],{100}],TrueQ]]
377+
378+
379+
(* ::Text:: *)
380+
(*[Hig02], equation 3.5.*)
381+
382+
383+
(* ::Input::Initialization:: *)
384+
Assert[AllTrue[Table[
385+
Max[Abs[IEEEEvaluateWithRelativeError[Interval[{RandomReal[],RandomReal[]}] Interval[{RandomReal[],RandomReal[]}]+Interval[{RandomReal[],RandomReal[]}] Interval[{RandomReal[],RandomReal[]}]][[2]]]]<=\[Gamma][2],{100}],TrueQ]]
386+
387+
388+
(* ::Input::Initialization:: *)
389+
Assert[AllTrue[Table[
390+
Max[Abs[IEEEEvaluateWithRelativeError[Interval[{RandomReal[],RandomReal[]}] Interval[{RandomReal[],RandomReal[]}]+(Interval[{RandomReal[],RandomReal[]}] Interval[{RandomReal[],RandomReal[]}]+Interval[{RandomReal[],RandomReal[]}] Interval[{RandomReal[],RandomReal[]}])][[2]]]]<=\[Gamma][3],{100}],TrueQ]]
391+
392+
393+
(* ::Input::Initialization:: *)
394+
Assert[AllTrue[Table[
395+
Max[Abs[IEEEEvaluateWithRelativeError[Interval[{RandomReal[],RandomReal[]}] Interval[{RandomReal[],RandomReal[]}]+(Interval[{RandomReal[],RandomReal[]}] Interval[{RandomReal[],RandomReal[]}]+Interval[{RandomReal[],RandomReal[]}] Interval[{RandomReal[],RandomReal[]}])][[2]]]]<=\[Gamma][3],{100}],TrueQ]]
396+
397+
398+
(* ::Input::Initialization:: *)
399+
Assert[AllTrue[Table[
400+
Max[Abs[IEEEEvaluateWithRelativeError[Interval[{RandomReal[],RandomReal[]}] Interval[{RandomReal[],RandomReal[]}]+(Interval[{RandomReal[],RandomReal[]}] Interval[{RandomReal[],RandomReal[]}]+(Interval[{RandomReal[],RandomReal[]}] Interval[{RandomReal[],RandomReal[]}]+Interval[{RandomReal[],RandomReal[]}] Interval[{RandomReal[],RandomReal[]}]))][[2]]]]<=\[Gamma][4],{100}],TrueQ]]

0 commit comments

Comments
 (0)