This site is a static rendering of the Trac instance that was used by R7RS-WG1 for its work on R7RS-small (PDF), which was ratified in 2013. For more information, see Home.

Source for ticket #289

cc


    

changetime

2012-02-26 17:38:19

component

WG1 - Core

description

(I proposed this in #79 as `rational-expt` but misdesigned and misexplained it, so it was quite properly shot down).

The `expt` procedure is part of the inexact module, as its result is not necessarily rational.  This means that Schemes which do not provide inexact numbers will not provide `expt` either.

However, `expt` can safely return an exact result if its first argument is an exact number and its second argument an exact integer.  Providing a separate `exact-expt` procedure in the base module allows this restricted but very useful functionality in the absence of inexact number support.  `Exact-expt` would be analogous to `exact-integer-sqrt`, which is likewise in the base while `sqrt` is in the inexact module.  Implementations which do provide inexact numbers (the vast majority at present) can simply equate `exact-expt` with `expt`.

Alternatively, we could move `expt` to the base module.  In that  case, implementations without inexact numbers must report an implementation restriction when the second argument is not an integer.

id

289

keywords


    

milestone


    

owner

alexshinn

priority

major

reporter

cowan

resolution

invalid

severity


    

status

closed

summary

Exact exponentiation as a base module feature

time

2011-09-23 20:20:26

type

defect

Changes

Change at time 2012-02-26 17:38:19

author

alexshinn

field

comment

newvalue

expt is already in the base library and no one has suggested otherwise.

oldvalue

2

raw-time

1330249099269272

ticket

289

time

2012-02-26 17:38:19

Change at time 2012-02-26 17:38:19

author

alexshinn

field

resolution

newvalue

invalid

oldvalue


    

raw-time

1330249099269272

ticket

289

time

2012-02-26 17:38:19

Change at time 2012-02-26 17:38:19

author

alexshinn

field

status

newvalue

closed

oldvalue

new

raw-time

1330249099269272

ticket

289

time

2012-02-26 17:38:19

Change at time 2012-01-05 07:00:59

author

cowan

field

comment

newvalue

Actually, the second argument doesn't have to be an integer: the result of `(exact-expt (/ p q) (/ j k))`, where ''p q j k'' are all integers, is exact iff the ''k''th root of both ''p'' and ''q'' is an integer.  So the domain of `exact-expt` is any pair of exact rational numbers (but in some cases an exact result cannot be returned, in which case the behavior is unspecified).

oldvalue

1

raw-time

1325718059547796

ticket

289

time

2012-01-05 07:00:59