[squeak-dev] The Trunk: Kernel-fbs.699.mcz

Frank Shearar frank.shearar at gmail.com
Mon Jun 11 20:18:14 UTC 2012


On 11 June 2012 21:15,  <commits at source.squeak.org> wrote:
> Frank Shearar uploaded a new version of Kernel to project The Trunk:
> http://source.squeak.org/trunk/Kernel-fbs.699.mcz
>
> ==================== Summary ====================
>
> Name: Kernel-fbs.699
> Author: fbs
> Time: 11 June 2012, 9:15:23.072 pm
> UUID: 82d9060f-aaf6-4a84-934f-c7bcdd053e56
> Ancestors: Kernel-fbs.698, Kernel-nice.695
>
> Remerge Kernel-nice.695:
>
> Provides a new version of significandAsInteger that relies on regular Float arithmetic and regular asInteger conversion.
> In case of exceptional values, use the old behaviour, that is directly extract the bit pattern, but without implied one at position 53.
> Marginally faster than old version - sorry, not significantly.
>
> =============== Diff against Kernel-fbs.698 ===============
>
> Item was changed:
>  ----- Method: Float>>significandAsInteger (in category 'truncation and round off') -----
>  significandAsInteger
> +       "Answer the mantissa of a Float shifted so as to have the ulp equal to 1.
> +       For exceptional values, infinity and nan, just answer the bit pattern."
>
> +       self isFinite ifTrue:
> +               [^(self timesTwoPower: self class precision - 1 - (self exponent max: self class emin)) truncated abs].
> +       ^(((self basicAt: 1) bitAnd: 16r000FFFFF) bitShift: 32) bitOr: (self basicAt: 2)!
> -       | exp sig |
> -       exp := self exponent.
> -       sig := (((self at: 1) bitAnd: 16r000FFFFF) bitShift: 32) bitOr: (self at: 2).
> -       (exp > -1023 and: [self ~= 0.0])
> -               ifTrue: [sig := sig bitOr: (1 bitShift: 52)].
> -       ^ sig.!

Right, that ought to repair my little SNAFU there.

frank


More information about the Squeak-dev mailing list