diff options
author | Arne Döring <arne.doering@gmx.net> | 2018-04-15 19:59:11 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-04-15 19:59:11 +0200 |
commit | efae3668570b51fa14483663d1979a6a8a6852fe (patch) | |
tree | 6db0ac8604f30ceb67b2689b3ab37263dc225b62 /lib | |
parent | b98cd3bf348a41778f475e835b86ab9175125789 (diff) | |
download | Nim-efae3668570b51fa14483663d1979a6a8a6852fe.tar.gz |
rename SomeReal to SomeFloat (#7617)
* rename SomeReal to SomeFloat * added changelog entry
Diffstat (limited to 'lib')
-rw-r--r-- | lib/js/jscore.nim | 14 | ||||
-rw-r--r-- | lib/pure/lenientops.nim | 24 | ||||
-rw-r--r-- | lib/pure/strformat.nim | 8 | ||||
-rw-r--r-- | lib/system.nim | 12 |
4 files changed, 30 insertions, 28 deletions
diff --git a/lib/js/jscore.nim b/lib/js/jscore.nim index 94aadf87a..91f3ff8bb 100644 --- a/lib/js/jscore.nim +++ b/lib/js/jscore.nim @@ -30,15 +30,15 @@ proc asinh*(m: MathLib, a: SomeNumber): float proc atan*(m: MathLib, a: SomeNumber): float proc atan2*(m: MathLib, a: SomeNumber): float proc atanh*(m: MathLib, a: SomeNumber): float -proc cbrt*(m: MathLib, f: SomeReal): SomeReal -proc ceil*(m: MathLib, f: SomeReal): SomeReal +proc cbrt*(m: MathLib, f: SomeFloat): SomeFloat +proc ceil*(m: MathLib, f: SomeFloat): SomeFloat proc clz32*(m: MathLib, f: SomeInteger): int proc cos*(m: MathLib, a: SomeNumber): float proc cosh*(m: MathLib, a: SomeNumber): float proc exp*(m: MathLib, a: SomeNumber): float proc expm1*(m: MathLib, a: SomeNumber): float -proc floor*(m: MathLib, f: SomeReal): int -proc fround*(m: MathLib, f: SomeReal): float32 +proc floor*(m: MathLib, f: SomeFloat): int +proc fround*(m: MathLib, f: SomeFloat): float32 proc hypot*(m: MathLib, args: varargs[distinct SomeNumber]): float proc imul*(m: MathLib, a, b: int32): int32 proc log*(m: MathLib, a: SomeNumber): float @@ -49,14 +49,14 @@ proc max*(m: MathLib, a, b: SomeNumber): SomeNumber proc min*[T: SomeNumber | JsRoot](m: MathLib, a, b: T): T proc pow*(m: MathLib, a, b: distinct SomeNumber): float proc random*(m: MathLib): float -proc round*(m: MathLib, f: SomeReal): int +proc round*(m: MathLib, f: SomeFloat): int proc sign*(m: MathLib, f: SomeNumber): int proc sin*(m: MathLib, a: SomeNumber): float proc sinh*(m: MathLib, a: SomeNumber): float -proc sqrt*(m: MathLib, f: SomeReal): SomeReal +proc sqrt*(m: MathLib, f: SomeFloat): SomeFloat proc tan*(m: MathLib, a: SomeNumber): float proc tanh*(m: MathLib, a: SomeNumber): float -proc trunc*(m: MathLib, f: SomeReal): int +proc trunc*(m: MathLib, f: SomeFloat): int # Date library proc now*(d: DateLib): int diff --git a/lib/pure/lenientops.nim b/lib/pure/lenientops.nim index b124a9512..cc7784c19 100644 --- a/lib/pure/lenientops.nim +++ b/lib/pure/lenientops.nim @@ -26,33 +26,33 @@ import typetraits -proc `+`*[I: SomeInteger, F: SomeReal](i: I, f: F): F {.noSideEffect, inline.} = +proc `+`*[I: SomeInteger, F: SomeFloat](i: I, f: F): F {.noSideEffect, inline.} = F(i) + f -proc `+`*[I: SomeInteger, F: SomeReal](f: F, i: I): F {.noSideEffect, inline.} = +proc `+`*[I: SomeInteger, F: SomeFloat](f: F, i: I): F {.noSideEffect, inline.} = f + F(i) -proc `-`*[I: SomeInteger, F: SomeReal](i: I, f: F): F {.noSideEffect, inline.} = +proc `-`*[I: SomeInteger, F: SomeFloat](i: I, f: F): F {.noSideEffect, inline.} = F(i) - f -proc `-`*[I: SomeInteger, F: SomeReal](f: F, i: I): F {.noSideEffect, inline.} = +proc `-`*[I: SomeInteger, F: SomeFloat](f: F, i: I): F {.noSideEffect, inline.} = f - F(i) -proc `*`*[I: SomeInteger, F: SomeReal](i: I, f: F): F {.noSideEffect, inline.} = +proc `*`*[I: SomeInteger, F: SomeFloat](i: I, f: F): F {.noSideEffect, inline.} = F(i) * f -proc `*`*[I: SomeInteger, F: SomeReal](f: F, i: I): F {.noSideEffect, inline.} = +proc `*`*[I: SomeInteger, F: SomeFloat](f: F, i: I): F {.noSideEffect, inline.} = f * F(i) -proc `/`*[I: SomeInteger, F: SomeReal](i: I, f: F): F {.noSideEffect, inline.} = +proc `/`*[I: SomeInteger, F: SomeFloat](i: I, f: F): F {.noSideEffect, inline.} = F(i) / f -proc `/`*[I: SomeInteger, F: SomeReal](f: F, i: I): F {.noSideEffect, inline.} = +proc `/`*[I: SomeInteger, F: SomeFloat](f: F, i: I): F {.noSideEffect, inline.} = f / F(i) -proc `<`*[I: SomeInteger, F: SomeReal](i: I, f: F): bool {.noSideEffect, inline.} = +proc `<`*[I: SomeInteger, F: SomeFloat](i: I, f: F): bool {.noSideEffect, inline.} = F(i) < f -proc `<`*[I: SomeInteger, F: SomeReal](f: F, i: I): bool {.noSideEffect, inline.} = +proc `<`*[I: SomeInteger, F: SomeFloat](f: F, i: I): bool {.noSideEffect, inline.} = f < F(i) -proc `<=`*[I: SomeInteger, F: SomeReal](i: I, f: F): bool {.noSideEffect, inline.} = +proc `<=`*[I: SomeInteger, F: SomeFloat](i: I, f: F): bool {.noSideEffect, inline.} = F(i) <= f -proc `<=`*[I: SomeInteger, F: SomeReal](f: F, i: I): bool {.noSideEffect, inline.} = +proc `<=`*[I: SomeInteger, F: SomeFloat](f: F, i: I): bool {.noSideEffect, inline.} = f <= F(i) # Note that we must not defined `>=` and `>`, because system.nim already has a diff --git a/lib/pure/strformat.nim b/lib/pure/strformat.nim index 421e5e683..abdb655d7 100644 --- a/lib/pure/strformat.nim +++ b/lib/pure/strformat.nim @@ -375,7 +375,7 @@ type ## ``parseStandardFormatSpecifier`` returned. proc formatInt(n: SomeNumber; radix: int; spec: StandardFormatSpecifier): string = - ## Converts ``n`` to string. If ``n`` is `SomeReal`, it casts to `int64`. + ## Converts ``n`` to string. If ``n`` is `SomeFloat`, it casts to `int64`. ## Conversion is done using ``radix``. If result's length is lesser than ## ``minimumWidth``, it aligns result to the right or left (depending on ``a``) ## with ``fill`` char. @@ -503,8 +503,8 @@ proc format*(value: SomeInteger; specifier: string; res: var string) = " of 'x', 'X', 'b', 'd', 'o' but got: " & spec.typ) res.add formatInt(value, radix, spec) -proc format*(value: SomeReal; specifier: string; res: var string) = - ## Standard format implementation for ``SomeReal``. It makes little +proc format*(value: SomeFloat; specifier: string; res: var string) = + ## Standard format implementation for ``SomeFloat``. It makes little ## sense to call this directly, but it is required to exist ## by the ``&`` macro. let spec = parseStandardFormatSpecifier(specifier) @@ -678,4 +678,4 @@ when isMainModule: doAssert fmt"{'a'} {'b'}" == "a b" - echo("All tests ok") \ No newline at end of file + echo("All tests ok") diff --git a/lib/system.nim b/lib/system.nim index 969527828..3761a35f8 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -105,12 +105,14 @@ type ## type class matching all ordinal types; however this includes enums with ## holes. - SomeReal* = float|float32|float64 + SomeFloat* = float|float32|float64 ## type class matching all floating point number types - SomeNumber* = SomeInteger|SomeReal + SomeNumber* = SomeInteger|SomeFloat ## type class matching all number types +{.deprecated: [SomeReal: SomeFloat].} + proc defined*(x: untyped): bool {.magic: "Defined", noSideEffect, compileTime.} ## Special compile-time procedure that checks whether `x` is ## defined. @@ -128,7 +130,7 @@ when defined(nimalias): TSignedInt: SomeSignedInt, TUnsignedInt: SomeUnsignedInt, TInteger: SomeInteger, - TReal: SomeReal, + TReal: SomeFloat, TNumber: SomeNumber, TOrdinal: SomeOrdinal].} @@ -2171,8 +2173,8 @@ proc max*[T](x, y: T): T = if y <= x: x else: y {.pop.} -proc high*(T: typedesc[SomeReal]): T = Inf -proc low*(T: typedesc[SomeReal]): T = NegInf +proc high*(T: typedesc[SomeFloat]): T = Inf +proc low*(T: typedesc[SomeFloat]): T = NegInf proc clamp*[T](x, a, b: T): T = ## limits the value ``x`` within the interval [a, b] |