Wiki source for KeyPgFix


Show raw source

{{fbdoc item="title" value="FIX"}}----
Returns the integer part of a number, rounding towards zero

{{fbdoc item="syntax"}}##
[[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Fix** ( [[KeyPgByval|byval]] //number// [[KeyPgAs|as]] [[KeyPgSingle|single]] ) [[KeyPgAs|as]] [[KeyPgSingle|single]]
[[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Fix** ( [[KeyPgByval|byval]] //number// [[KeyPgAs|as]] [[KeyPgDouble|double]] ) [[KeyPgAs|as]] [[KeyPgDouble|double]]
[[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Fix** ( [[KeyPgByval|byval]] //number// [[KeyPgAs|as]] [[KeyPgInteger|integer]] ) [[KeyPgAs|as]] [[KeyPgInteger|integer]]
[[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Fix** ( [[KeyPgByval|byval]] //number// [[KeyPgAs|as]] [[KeyPgUinteger|uinteger]] ) [[KeyPgAs|as]] [[KeyPgUinteger|uinteger]]
##
{{fbdoc item="usage"}}##
//result// = **Fix**( //number// )
##
{{fbdoc item="param"}}
##//number//##
the floating-point number to truncate

{{fbdoc item="ret"}}
Returns the integer part of ##//number//##, rounding towards zero.

{{fbdoc item="desc"}}
Equivalent to: ##[[KeyPgSgn|Sgn]](//number//) * [[KeyPgInt|Int]]([[KeyPgAbs|Abs]](//number//))##. For example, ##**Fix**(1.3)## will return ##1.0##, and ##**Fix**(-4.9)## will return ##-4.0##. For integer types, the number is returned unchanged.

Note: this function is also equivalent to ##//number// - [[KeyPgFrac|Frac]](//number//)##.

The ##**Fix**## unary ##[[KeyPgOperator|operator]]## can be overloaded with user defined types.

{{fbdoc item="ex"}}
{{fbdoc item="filename" value="examples/manual/math/fix.bas"}}%%(freebasic)
Print fix(1.9) '' will print 1
Print fix(-1.9) '' will print -1
%%

{{fbdoc item="lang"}}
- In the //[[CompilerOptlang|-lang qb]]// dialect, this operator cannot be overloaded.

{{fbdoc item="diff"}}
- None

{{fbdoc item="see"}}
- ##[[KeyPgInt|Int]]##
- ##[[KeyPgFrac|Frac]]##
- ##[[KeyPgCint|Cint]]##
- ##[[KeyPgOperator|Operator]]##

{{fbdoc item="back" value="CatPgMath|Math"}}
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode