[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |

__Function:__**make-rectangular***x1 x2*__Function:__**make-polar***x1 x2*- [R5RS]
Creates a complex number from two real numbers,
`x1`and`x2`.`make-rectangular`

returns`x1`+**i**`x2`.`make-polar`

returns`x1`**e**^(**i**`x2`).

__Function:__**real-part***z*__Function:__**imag-part***z*__Function:__**magnitude***z*__Function:__**angle***z*- [R5RS]
Decompose a complex number
`z`and returns a real number.`real-part`

and`imag-part`

return`z`'s real and imaginary part, respectively.`magnitude`

and`angle`

return`z`'s magnitude and angle, respectively.

__Function:__**decode-float***x*- Given floating-point number (inexact real number), returns
a vector of three exact integers,
`#(`

, where`m`,`e`,`sign`)

The API is taken from ChezScheme.`x`= (*`sign``m`(expt 2.0`e`))`sign`is either 1, 0 or -1.(decode-float 3.1415926) => #(7074237631354954 -51 1) (* 7074237631354954 (expt 2.0 -51)) => 3.1415926

__Function:__**fmod***x y*__Function:__**modf***x*__Function:__**frexp***x*__Function:__**ldexp***x n*- [POSIX]
These procedures can be used to compose and decompose floating
point numbers.
`Fmod`

computes the remainder of dividing`x`by`y`, that is, it returns`x`-`n`*`y`where`n`is the quotient of`x`/`y`rounded towards zero to an integer.`Modf`

returns two values; a fractional part of`x`and an integral part of`x`.`Frexp`

returns two values,`fraction`and`exponent`of`x`, where`x`=`fraction`* 2^`exponent`, and 0 <=`fraction`<= 0.5.`Ldexp`is a reverse operation of`frexp`

; it returns a real number`x`* 2^`n`.(fmod 32.1 10.0) => 2.1 (fmod 1.5 1.4) => 0.1 (modf 12.5) => 0.5 and 12.0 (frexp 3.14) => 0.785 and 2 (ldexp 0.785 2) => 3.14

__Function:__**exact->inexact***z*__Function:__**inexact->exact***z*- [R5RS]
Converts an exact number to an inexact number, or vice versa.
Since Gauche doesn't support general rational numbers, the result of

`inexact->exact`

is always a whole number. If the passed number is not an integer, the fraction part is rounded. Note that it is an implementation dependent behavior. If you want to get a closest exact integer of the given inexact real number, it's better to use`round`

explicitly before`inexact->exact`

.If you pass an inexact number to

`exact->inexact`

or an exact number to`inexact->exact`

, Gauche returns the argument as is, instead of reporting an error. This is also an implementation dependent behavior and you shouldn't count on that.

__Function:__**number->string***z &optional radix use-upper?*__Function:__**string->number***string &optional radix*- [R5RS+]
These procedurs convert a number and its string representation
in radix
`radix`system.`radix`must be between 2 and 36 inclusive. If`radix`is omitted, 10 is assumed.`Number->string`

takes a number`z`and returns a string. If`z`is not an exact integer,`radix`must be 10. For the numbers with radix more than 10, lower case alphabet character is used for digits, unless the optional argument`use-upper?`is true, in that case upper case characters are used. The argument`use-upper?`is Gauche's extension.`String->number`

takes a string`string`and parses it as a number in radix`radix`system. If the number looks like non-exact number, only radix 10 is allowed. If the given string can't be a number,`#f`

is returned.

__Generic Function:__**x->number***obj*__Generic Function:__**x->integer***obj*- Generic coercion functions. Returns `natural' interpretation of
`obj`as a number or an exact integer, respectively. The default methods are defined for numbers and strings; a string is interpreted by`string->number`, and if the string can't be interpreted as a number, 0 is returned. Other`obj`is simply converted to 0. If`obj`is naturally interpreted as a number that is not an exact integer,`x->integer`

uses`round`

and`inexact->exact`

to obtain an integer.Other class may provide a method to customize the behavior.

[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |

This document was generated by