For Development HEAD DRAFTSearch (procedure/syntax/module):

Next: , Previous: , Up: Library modules - Utilities   [Contents][Index]

12.5 compat.real-elementary-functions - Backward-compatible real elementary functions

Module: compat.real-elementary-functions

Gauche 0.9.12 and earlier had undocumented real-only elementary functions, such as %sin and %exp. They were intended to be a building block of the complex elementary functions, hence prefixed with %. However, they were visible in gauche module, and sometimes used directly because they were fast.

SRFI-94 introduced names for real-only elementary functions such as real-sin, so we changed built-in %sin etc. to follow that names. See Arithmetics, for those real-only elementary functions.

This module is to ease migration from the legacy code that uses old names. Just add the following form at the beginning of old code and the source would work with both versions.

(cond-expand
  [(library (compat real-elementary-functions))
   (use compat.real-elementary-functions)]
  [else])

New code must use real-sin etc. instead of the names provided here.

Function: %exp x
Function: %sin x
Function: %cos x
Function: %tan x
Function: %sinpi x
Function: %cospi x
Function: %tanpi x
Function: %asin x
Function: %acos x
Function: %atan x
Function: %sinh x
Function: %cosh x
Function: %tanh x
Function: %sqrt x
Function: %expt x a

{compat.real-elementary-functions} These are the same as the built-in procedures replacing preceding % with real-; e.g. %expreal-exp. See Arithmetics, for the description of built-in procedures.

Function: %log x :optional base

{compat.real-elementary-functions} This is a real-only logarithm of x base base. x must be a non-negative real number, and base must be a positive real number. If base is omitted, Napier’s number is assumed, that is, it returns a natural logarithm of x. If x is 0, -inf.0 is returned.

Gauche does not have built-in real-log, to avoid conflict with SRFI-94’s real-log which takes base argument first. For real-only natural logarithm, Gauche has real-ln.

See scheme.flonum - R7RS flonum, which defines flonum-only version of logarithms sich as fllog, fllog2, and fllog10.


Next: , Previous: , Up: Library modules - Utilities   [Contents][Index]


For Development HEAD DRAFTSearch (procedure/syntax/module):
DRAFT