Ignore:
Timestamp:
Mar 6, 2008, 9:49:43 PM (16 years ago)
Author:
イグトランス (egtra)
Message:

(SPrintF.ab) FormatIntegerExにStringBuilderを引数に取る版を追加。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Include/Classes/System/Math.ab

    r299 r457  
    127127
    128128    Static Function Ceiling(x As Double) As Long
    129         If Floor(x) = x then
    130             Return x As Long
    131         Else
    132             Return Floor(x) + 1
     129        Ceiling = Floor(x)
     130        If Ceiling <> x Then
     131            Ceiling++
    133132        End If
    134133    End Function
     
    145144
    146145    Static Function Cosh(value As Double) As Double
    147         Dim t As Double
    148         t = Math.Exp(value)
     146        Dim t = Math.Exp(value)
    149147        return (t + 1 / t) * 0.5
    150148    End Function
     
    156154
    157155    Static Function DivRem(x As Int64, y As Int64, ByRef ret As Int64) As Int64
    158         ret = x - (x \ y) * y
    159         return x \ y
     156        DivRem = x \ y
     157        ret = x - (DivRem) * y
    160158    End Function
    161159
     
    196194        Return Int(value)
    197195    End Function
    198 
    199     'GetHashCode
    200 
    201     'GetType
    202196
    203197    Static Function IEEERemainder(x As Double, y As Double) As Double
     
    513507
    514508    Static Function Sqrt(x As Double) As Double
    515         Dim s As Double, last As Double
    516         Dim i As *Word, j As Long, jj As Long, k As Long
    517509        If x > 0 Then
    518510            If ActiveBasic.Math.IsInf(x) Then
     
    520512            Else
    521513                Sqrt = x
    522                 i = (VarPtr(Sqrt) + 6) As *Word
    523                 jj = GetWord(i)
    524                 j = jj >> 5
    525                 k = jj And &h0000001f
    526                 j = (j+ 511) << 4 + k
     514                Dim i = (VarPtr(Sqrt) + 6) As *Word
     515                Dim jj = GetWord(i) As Long
     516                Dim j = jj >> 5 As Long
     517                Dim k = (jj And &h0000001f) As Long
     518                j = (j + 511) << 4 + k
    527519                SetWord(i, j)
     520                Dim last As Double
    528521                Do
    529522                    last = Sqrt
    530                     Sqrt = (x /Sqrt + Sqrt) * 0.5
     523                    Sqrt = (x / Sqrt + Sqrt) * 0.5
    531524                Loop While Sqrt <> last
    532525            End If
Note: See TracChangeset for help on using the changeset viewer.