Racket Libraries
5.1 
5.2 双 and 􏿴
5.3 􏻿
5.4 􏿰
5.5 
5.6 勺
5.7 
5.8 
5.9 
5.10 􏺃
5.11 Conditionals
5.12 
5.13 
5.14 未分类
On this page:
5.9.1 命名规则
5.9.2 大类概念:米?,夈?,宩?、􏻟?,粊?、䉾?
5.9.3 常用概念:􏻴?,𥥪?
5.9.4 常用概念:􏻛?、􏻚?,􏺧?、􏺦?
5.9.5 实现概念:釆?、􏻞?、􏻝?,􏻧?、􏺟?
5.9.6 组合表达:􏻲?,􏺡?
5.9.7 运算概念:􏽊、􏽉,􏺗、􏺘
5.9.8 数值修改:􏹚,􏹓、􏹒、􏹑、􏹐
5.9.9 类型转化:􏻧化、􏺟化、􏻞化、􏻝化,米化句、句化米,宩化􏹔句
5.9.10 数的类型例程
米?
夈?
宩?
粊?
􏻴?
􏻲?
􏺡?
􏺣?
􏺠?
􏻥?
釆?
􏻝?
􏻞?
可􏻞?
𥥪?
􏻛?
􏻚?
􏺦?
􏺧?
􏻧?
􏺟?
􏻧化
􏺟化
􏻞化
􏻝化
5.9.11 数的运算例程
+
-
*
/
􏻓
𥺌
􏻓和𥺌
􏽊
􏽉
􏹚
􏺗
􏺘
?最大公约数
?最小公约数
􏹓
􏹑
􏹒
􏹐
?分子
?分母
?粊化
=
>
<
>=
<=
?平方根
?整数平方根
?整数平方根余数
?次方
?欧拉次方???
?对数
?正弦
?余弦
?正切
?反正弦???
?反余弦
?反正切
?矩数???
?极式复数???
􏻟
?极式复数量???
?极式复数度???
米化句
句化米
宩化􏹔句
8.13.0.9

5.9 🔗

另见名扩展库:

“数”(numbers)是编程语言乃至现代科学中极其重要的一个概念。

5.9.1 命名规则🔗

被简写为偏旁,以便构造单字来表示跟其相关的概念
  • 现代汉语中“数”有关的概念和词汇很多都来对英文的直接翻译,并且大都使用词组来构造;

  • 但我认为仅单个汉字所能包含的意义很多时候就已经比英文中的单词多了,进而还构造使用词组进行表达就会显得“含意过剩”,反而显得啰唆,含意不清;

  • 故此,本语言对关于“数”的例程做了简化:剔除多余无效的表意偏旁,代之以简洁有效的偏旁组合成单字进行表达。

Naming Rules,有:

规则

含义

举例

下偏旁

大类概念

米?夈?􏻟粊?䉾?􏻥?

上偏旁

常用概念

􏻛?􏻚?􏺧?􏺦?

整体性结构的

常用概念

米?􏻴?釆?

偏旁

“准确”相关

􏻧?􏻲?􏺟?􏺡?

左偏旁

内部实现、运算或转化例程(进参、出参都是数字)

􏽉􏽊􏺗􏺘

偏旁􏻴

整数相关

􏹓􏻲?􏺡?

偏旁

近视值

􏹔􏹓􏹒􏹑􏹐

左偏旁

精确位数

􏻞?􏻝?

类型转化

􏻧化􏺟化􏻞化􏻝化米化句句化米宩化􏹔句

5.9.2 大类概念:米?,夈?,宩?、􏻟?,粊?、䉾?🔗


为古活字
为古活字
􏻟为新造字
为古活字
为古活字
  • 下偏旁:数相关的大类概念;

  • 的简写,更是的简写,,故也有所有的数终归都是复数之意;

  • 的简写;

  • 的简写;

  • :因为有理数是可以用两个整数之比表示的数;

  • 的简写,因为无理数是不能用两个整数之比表示的数(与之相违背);

所有的“米”(数)都是“夈”(复数);“夈”由“宩”(实数)和“􏻟”(虚数)组成;“宩”则由“粊”(有理数)和“䉾”(无理数)组成。

Examples:
> (米? 1)

#t

> (宩? 1)

#t

> (粊? 1)

#t

5.9.3 常用概念:􏻴?,𥥪?🔗


􏻴为新造字
𥥪为古活字
  • 􏻴+组成而成;

  • 的简写;

  • 的简写。

“􏻴”(整数)是非常基本和常用的数学概念;“𥥪”(空位的数字)也是非常基本的数学概念。

Examples:
> (􏻴? 1)

#t

> (𥥪? 0)

#t

5.9.4 常用概念:􏻛?、􏻚?,􏺧?、􏺦?🔗


􏻛为新造字
􏻚为新造字
􏺧为新造字
􏺦为新造字
  • 上偏旁:数相关的常用概念;

  • :正数的;

  • :负数的,的简写;

  • :奇数的,“奇数”在古代叫“阳数”(阴阳是贯穿于本语言的基本概念);

  • :偶数的,“偶数”在古代叫“阴数”(阴阳是贯穿于本语言的基本概念)。

对于“粊”而言,最常使用的子概念是:“􏻛”(正数)、“􏻚”(负数);对于“􏻴”而言,最常使用的子概念是:“􏺧”(奇数)、“􏺦”(偶数)。

Examples:
> (􏻛? 1)

#t

> (􏻚? -1)

#t

> (􏺧? 1)

#t

> (􏺦? 2)

#t

5.9.5 实现概念:釆?、􏻞?、􏻝?,􏻧?、􏺟?🔗


为古活字
􏻞为新造字
􏻝为新造字
􏻧为新造字
􏺟为新造字
  • +组成而成;

  • 丿的简写;

  • 的简写。

  • 准确的简写;

  • :非;

在编程语言的具体实现中,“米”有“􏻧”(准确)和“􏺟”(不准确)之分;“􏻴”是“􏻧”,而“􏺟”是用“釆”(浮点数)实现的(见:WIKI:IEEE_754);“釆”按照精确度可分为“􏻞”(单倍精度浮点数)和“􏻝”(双倍精度浮点数)。

Examples:
> (釆? 1.1)

#t

> (􏻞? 1.1)

#f

> (􏻝? 1.1)

#t

> (􏻧? 1)

#t

> (􏺟? 1.1)

#t

5.9.6 组合表达:􏻲?,􏺡?🔗


􏻲为新造字
􏺡为新造字
  • 􏻴整数的简写;

  • 准确的简写;

  • :非;

  • 的简写;

  • 的简写;

Examples:
> (􏻲? 1)

#t

> (􏺡? 1)

#t

5.9.7 运算概念:􏽊、􏽉,􏺗、􏺘🔗


􏽊为新造字
􏽉为新造字
􏺗为新造字
􏺘为新造字
  • 的简写,是一种多层的蒸屉;

  • /的简写,本意是“球高从落下”;

  • :寻找,参见

  • :数值大的;

  • :数值小的。

Examples:
> (􏽊 1)

2

> (􏽉 1)

0

> (􏺗 1 2 3 4 5)

5

> (􏺘 1 2 3 4 5)

1

5.9.8 数值修改:􏹚,􏹓、􏹒、􏹑、􏹐🔗


􏹚为新造字
􏹓为新造字
􏹒为新造字
􏹑为新造字
􏹐为新造字
  • 􏻴:整数的简写;

  • 丨丨:绝对值(源自数学上的符号);

  • :数值修约、简化、近似值的;

  • :数值趋大的;

  • :数值趋小的。

  • :数值趋零的,𥥪的简写,见𥥪?

另见:􏹔

对于“数值修约”而言,可分为无条件修约与有条件修约。

前者方法有:上取整(􏹑)、下取整(􏹒)、截尾取整(􏹐)、无条件进位(􏹍);后者方法则有:四舍五入、五舍六入、四舍六入五留双(奇进偶舍)(􏹓)。

上述方法中,“四舍五入法”最广为人知:如遇0、1、2、3、4则退位,5、6、7、8、9则进位,进退位虽都各为五个数字。但是0其实是不处理值、准确无变化值,这样算来退位实为1、2、3、4这四个,所以从统计学角度讲平均值是偏大的。

而“四舍六入五留双”其实是更精确的规则,所以默认采用之。

Examples:
> (􏹚 -1)

1

> (􏹚 1)

1

> (􏹚 0)

0

> (􏹓 1.1)

1.0

> (􏹓 1.5)

2.0

> (􏹓 1.6)

2.0

> (􏹓 2.1)

2.0

> (􏹓 2.5)

2.0

> (􏹓 2.6)

3.0

> (􏹒 1.1)

2.0

> (􏹒 -1.1)

-1.0

> (􏹑 1.9)

1.0

> (􏹑 -1.9)

-2.0

> (􏹐 1.9)

1.0

> (􏹐 -1.9)

-1.0

5.9.9 类型转化:􏻧化、􏺟化、􏻞化、􏻝化,米化句、句化米,宩化􏹔句🔗


􏹔为新造字
  • :数值修约、简化、近似值的;

另见:􏹔

Examples:
> (􏻧化 1.1)

2476979795053773/2251799813685248

> (􏺟化 1)

1.0

> (􏻞化 1)

real->single-flonum: unsupported

> (􏻝化 1)

1.0

> (米化句 1.123)

"1.123"

> (句化米 "1.1")

1.1

> (句化米 "1.0")

1.0

> (句化米 "1")

1

> (宩化􏹔句 0.014)

"0.01"

> (宩化􏹔句 0.015)

"0.01"

> (宩化􏹔句 0.016)

"0.02"

> (宩化􏹔句 0.044)

"0.04"

> (宩化􏹔句 0.045)

"0.04"

> (宩化􏹔句 0.046)

"0.05"

5.9.10 数的类型例程🔗

composition

米? :  = number?

composition

夈?

 : elem + 复数?(各取偏旁得造,复数=实数+虚数;另 + needtofix + + needtofix + 的简写, + needtofix + + needtofix + ,故也有所有的数终归都是复数之意)
 = complex?

composition

宩? :  = real?

composition

粊?

 : elem + 有理数?(可以用两个整数之比表示的实数称为有理数(无理数用 + needtofix + 表示(北是背的原形)))
 = rational?

composition

􏻴? :  = integer?

composition

􏻲? :  = exact-integer?

composition

􏺡? :  = exact-nonnegative-integer?

composition

􏺣? :  = exact-positive-integer?

composition

􏺠? :  = inexact-real?

composition

􏻥? : elem + 固定数( + needtofix + 的一种具体实现) = fixnum?

composition

釆? :  = flonum?

composition

􏻝? : elem + 双倍精度浮点数(仿 + needtofix + ,且占用64位内存而得造)

 = double-flonum?

composition

􏻞?

 : elem + 单倍精度浮点数( + needtofix + + needtofix + 的简写,因其在实现上占用32位内存而得造)
 = single-flonum?

composition

可􏻞? :  + 􏻞 + ? = single-flonum-available?

composition

𥥪? :  = zero?

composition

􏻛? :  = positive?

composition

􏻚? :  = negative?

composition

􏺦? :  = even?

composition

􏺧? :  = odd?

composition

􏻧? :  = exact?

composition

􏺟? :  = inexact?

composition

􏻧化 : elem + needtofix + 转化为 + needtofix = inexact->exact

composition

􏺟化 : elem + needtofix + 转化为 + needtofix = exact->inexact

composition

􏻞化 : elem + needtofix + 转化为 + needtofix = real->single-flonum

composition

􏻝化 : elem + needtofix + 转化为 + needtofix = real->double-flonum

5.9.11 数的运算例程🔗

composition

+ :  = +

composition

- :  = -

composition

* :  = *

composition

/ :  = /

composition

􏻓 :  = quotient

composition

𥺌 :  = remainder

composition

􏻓和𥺌 :  = quotient/remainder

composition

 :  = modulo

composition

􏽊 :  = add1

composition

􏽉 :  = sub1

composition

􏹚 :  = abs

composition

􏺗 :  = max

composition

􏺘 :  = min

composition

?最大公约数 : ? + + + + +  = gcd

composition

?最小公约数 : ? + + + + +  = lcm

composition

􏹓 :  = round

composition

􏹑 :  = floor

composition

􏹒 :  = ceiling

composition

􏹐 :  = truncate

composition

?分子 : ? + +  = numerator

composition

?分母 : ? + +  = denominator

composition

?粊化 :  = rationalize

composition

= :  = =

composition

> :  = >

composition

< :  = <

composition

>= :  = >=

composition

<= :  = <=

composition

?平方根 : ? + + +  = sqrt

composition

?整数平方根 : ? + + + + +  = integer-sqrt

composition

?整数平方根余数 : ? + + + + + + +

 = integer-sqrt/remainder

composition

?次方 : ? + +  = expt

composition

?欧拉次方??? : ? + + + + + ? + ? + ? = exp

composition

?对数 : ? + +  = log

composition

?正弦 : ? + +  = sin

composition

?余弦 : ? + +  = cons

composition

?正切 : ? + +  = tan

composition

?反正弦??? : ? + + + + ? + ? + ? = asin

composition

?反余弦 : ? + + +  = acos

composition

?反正切 : ? + + +  = atan

composition

?矩数??? : ? + + + ? + ? + ? = make-rectangular

composition

?极式复数??? : ? + + + + + ? + ? + ? = make-polar

composition

 :  = real-part

composition

􏻟 :  = imag-part

composition

?极式复数量??? : ? + + + + + + ? + ? + ? = magnitude

composition

?极式复数度??? : ? + + + + + + ? + ? + ? = angle

composition

米化句 :  + +  = number->string

composition

句化米 :  + +  = string->number

composition

宩化􏹔句 : elem + + needtofix + 转化成 + needtofix + needtofix

 = real->decimal-string