2021年12月3日 星期五

delphi System.Math round trunc ceil floor RoundTo delphi Floating-Point Rounding Routines System.Math round trunc ceil floor RoundTo

 https://github.com/rvelthuis/DelphiBigNumbers/blob/master/Source/Velthuis.BigDecimals.pas

Math.Floor, which rounds down towards negative infinity.
Math.Ceiling, which rounds up towards positive infinity.
Math.Truncate, which rounds up or down towards zero.Truncation
Math.Round, Rounding

https://people.cs.nctu.edu.tw/~tsaiwn/sisc/runtime_error_200_div_by_0/www.merlyn.demon.co.uk/pas-chop.htm

delphi  System.Math round trunc ceil floor RoundTo delphi  Floating-Point Rounding Routines System.Math round trunc ceil floor RoundTo

System

Succ    increments an ordinal value, and returns this value
Dec         Decrement an ordinal variable
Inc         Increment an ordinal variable
Pred         Decrement an ordinal variable
Sqr         Gives the square of a number
Sqrt         Gives the square root of a number
Sum         Return the sum of an array of floating point values


Frac         The fractional part of a floating point number
Int         The integer part of a floating point number as a float
Round         Rounds a floating point number to an integer
Trunc         The integer part of a floating point number

PExtended    Pointer to a Extended floating point value
Str    Converts an integer or floating point number to a string
Val    Converts number strings to integer and floating point values


Rounding Algorithms

http://www.delphibasics.co.uk/ByUnit.asp?Unit=System

    System.Random
    System.Single
    System.SysUtils.TFormatSettings
    TSingleHelper.Mantissa
    TSingleHelper.Exponent
    TSingleHelper.BuildUp
    TSingleHelper.ToString

https://docwiki.embarcadero.com/CodeExamples/Sydney/en/Float_Type_Helpers_(Delphi)

    Class and Record Helpers (Delphi)
    System.SysUtils.TSingleHelper
    System.SysUtils.TDoubleHelper
    System.SysUtils.TExtendedHelper



https://en.wikipedia.org/wiki/Floating-point_arithmetic

沒有留言: