*, fx*, fl* - multiplication


(import (rnrs))                     ;R6RS
(import (rnrs base))                ;R6RS
(import (rnrs arithmetic fixnums))  ;R6RS, fx*
(import (rnrs arithmetic flonums))  ;R6RS, fl*
(import (scheme r5rs))              ;R7RS
(import (scheme base))              ;R7RS


(* number ...)
(fl* fl1...)                        ;R6RS
(fx* fx1 fx2)                       ;R6RS


This procedure returns the product of its arguments.
Fixnum variant
An exception with condition type &implementation-restriction is raised if the product is not a fixnum.
Flonum variant
In general, this procedure should return the flonum that best approximates the mathematical product. For implementations that represent flonums using IEEE binary floating point, the meaning of "best" is defined by the IEEE standards.
(fl+ +inf.0 -inf.0) => +nan.0
(fl+ +nan.0 fl)     => +nan.0
(fl* +nan.0 fl)     => +nan.0


Chez Scheme
An exact zero is returned when any of the arguments to * is an exact zero.


Returns one value, which is a number object.

For the generic variant, the return value is exact if all arguments are exact. If any argument is inexact then the result is inexact, unless one of the arguments is an exact zero, in which case the return value can optionally be an exact zero.

Non-R6RS implementations may be missing parts of the numeric tower and can thus resort to inexact numbers even for exact computations.


; Examples apply to R6RS. An R5RS/R7RS implementation
; might e.g. not provide rational or complex numbers.
(* 6 7)           => 42
(* 2 1/3)         => 2/3
(* 2 1.57)        => 3.14
(* 5 1+2i)        => 5+10i

; Examples from R6RS
(* 4)             => 4
(*)               => 1
(* 5 +inf.0)      => +inf.0
(* -5 +inf.0)     => -inf.0
(* +inf.0 +inf.0) => +inf.0
(* +inf.0 -inf.0) => -inf.0
(* 0 +inf.0)      => 0 or +nan.0
(* 0 +nan.0)      => 0 or +nan.0
(* 1.0 0)         => 0 or 0.0


R6RS is the only RnRS report on Scheme to require a full implementation of the numeric tower. In R7RS code, the feature identifiers exact-closed, exact-complex, ieee-float, and ratios should be consulted before performing arithmetic that requires one of these features.

In R7RS, (* 0 +inf.0) may return 0, or +nan.0, or report that inexact numbers are not supported, or report that non-rational real numbers are not supported, or fail silently or noisily in other implementation-specific ways.


This procedure can raise exceptions with the following condition types:
&assertion (R6RS)
An argument was outside its domain.
&implementation-restriction (R6RS)
May be raised when applied to mixed non-rational real and non-real complex arguments. Otherwise an unspecified number object is returned. Raised by the fixnum variant if the mathematically correct result is not a fixnum.
The assertions described above are errors. Implementations may signal an error, extend the procedure's domain of definition to include such arguments, or fail catastrophically.




R4RS, IEEE Scheme, R5RS, R6RS, R7RS


This page is part of the scheme-manpages project. It includes materials from the RnRS documents. More information can be found at https://github.com/schemedoc/manpages/.

Markup created by unroff 1.0sc,    March 04, 2023.