- From: Boris Zbarsky <notifications@github.com>
- Date: Fri, 11 Nov 2016 12:14:58 -0800
- To: heycam/webidl <webidl@noreply.github.com>
- Message-ID: <heycam/webidl/pull/235/review/8258877@github.com>
bzbarsky approved this pull request. > + +<div algorithm> + + <dfn lt="IntegerPart" abstract-op>IntegerPart(|n|)</dfn>: + + 1. Let |r| be [=floor=]([=abs=](|n|)) + 1. If |n| < 0, then return -1 × |r|. + 1. Otherwise return |r|. +</div> + +<div algorithm> + <dfn lt="ConvertToInt" abstract-op>ConvertToInt(|V|, |bitLength|, |signedness|)</dfn>: + 1. If |bitLength| is 64, then: + 1. Let |upperBound| be 2<sup>53</sup> − 1. + 1. If |signedness| is "unsigned", then let |lowerBound| be 0. + 1. Otherwise let |lowerBound| be −2<sup>53</sup>. This is missing a +1, no? > - 1. Set |x| to min(max(|x|, 0), 2<sup>53</sup> − 1). - 1. Round |x| to the nearest integer, choosing the even integer if it lies halfway between two, and choosing +0 rather than −0. - 1. Return the IDL {{unsigned long long}} value that represents the same numeric value as |x|. - 1. If |x| is <emu-val>NaN</emu-val>, +0, −0, +∞, or −∞, then return the IDL {{unsigned long long}} value that represents 0. - 1. Set |x| to [=sign=](|x|) * [=floor=]([=abs=](|x|)). - 1. Set |x| to |x| [=modulo=] 2<sup>64</sup>. - 1. Return the IDL {{unsigned long long}} value that represents the same numeric value as |x|. + 1. Set |x| to [=min=]([=max=](|x|, |lowerBound|), |upperBound|). + 1. Round |x| to the nearest integer, choosing the even integer if it lies halfway between two, + and choosing +0 rather than −0. + 1. Return |x|. + 1. If |x| is <emu-val>NaN</emu-val>, +0, −0, +∞, or −∞, + then return 0. + 1. Set |x| to [=!=] <a abstract-op>IntegerPart</a>(|x|). + 1. Set |x| to |x| [=modulo=] 2<sup>|bitLength|</sup>. + 1. If |signedness| is "unsigned" and |x| ≥ 2<sup>|bitLength| − 1</sup>, This should be happening for "signed" signedness. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/heycam/webidl/pull/235#pullrequestreview-8258877
Received on Friday, 11 November 2016 20:15:30 UTC