jckarter / clay

The Clay programming language
http://claylabs.com/clay
Other
404 stars 34 forks source link

numeric type utils #318

Closed stepancheg closed 12 years ago

stepancheg commented 12 years ago

There is no FloatOfSize or ImaginaryOfSize, because there is no single float type for given size, for instance, 16 byte float types are Float80 and (not yet existing) Float128.

UnsignedIntegerOfSize can be used, for example, in generic cryptography algorithms. Most algorithms have state that is N words of size K each. So state data can be represented in generic code with expression

Array[UnsignedIntegerOfSize(K), N]

BuiltinIntegerTypes are useful in tests to check that generic code works properly with all data types.

jckarter commented 12 years ago

Looks good. Float80 is pretty much legacy at this point (Microsoft doesn't even support it in any recent version of their toolchain), so if you want a FloatOfSize I think it's fine if it only selects from among the standard Float32, Float64 and Float128 formats.