Results 1 to 5 of 5

Thread: Simulate Excel's Ceiling function in Delphi?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Hi Lifepower, thanks for the info

    I don't suppose you could still help with the code conversion?

    I am having trouble converting the Visual Basic code below to Pascal; I don't know if my translation is correct or not.

    Code:
    Public Function Ceiling(ByVal X As Double, Optional ByVal Factor As Double = 1) As Double
        ' X is the value you want to round
        ' is the multiple to which you want to round
        Ceiling = (Int(X / Factor) - (X / Factor - Int(X / Factor) > 0)) * Factor
    End Function
    The bit that is throwing me off is this
    Code:
    Int(X / Factor) > 0
    .

    cheers,
    Paul
    Last edited by paul_nicholls; 24-02-2011 at 03:31 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •