6.1.2170 S>D s-to-d CORE

( n -- d )

Convert the number n to the double-cell number d with the same numerical value.

Testing:

T{       0 S>D ->       0  0 }T
T{       1 S>D ->       1  0 }T
T{       2 S>D ->       2  0 }T
T{      -1 S>D ->      -1 -1 }T
T{      -2 S>D ->      -2 -1 }T
T{ MIN-INT S>D -> MIN-INT -1 }T
T{ MAX-INT S>D -> MAX-INT  0 }T

ContributeContributions

ruvavatar of ruv [135] Word set of S>D wordRequest for clarification2020-05-29 10:10:51

Why S>D word is placed into CORE word set? What we can do with a double number (that S>D produces) without other words for double numbers?

It seems this word should be in Double-Number word set. What do you think?

MarcelHendrixavatar of MarcelHendrix

Didn't you forget about number formatting, interfacing with FM/MOD, SM/REM, REPOSITION-FILE and FILE-SIZE ?

MarcelHendrixavatar of MarcelHendrix

Didn't you forget about number formatting, interfacing with FM/MOD, SM/REM, REPOSITION-FILE and FILE-SIZE ?

AntonErtlavatar of AntonErtl

A quick (and possibly incomplete) search of words found the following words that take a d as input and do not require the double wordset to be present:

core: fm/mod sm/rem

float: d>f

Number conversion words and REPOSITION-FILE take an ud, so do not need S>D. Anyway, the words above seem to be good reasons for having s>d in core.

But in any case, it's water down the river. There is very little point in changing the wordset of a word in a later release. There is probably also little harm in this case, because most (all?) standard systems include double by default, but that reinforces the point that there is little point.

StephenPelcavatar of StephenPelc

The Technical committee has considered your submission.

The number conversion words <# # #S #> and friends require double numbers.

In order to use these words to display both single and double numbers S>D is required. Therefore we leave S>D in the CORE word set.

Closed
Reply New Version