Fixed math.round, added math.ceil and fixed times.format.
This commit is contained in:
parent
4105a91c48
commit
41a9a941ab
3 changed files with 5 additions and 3 deletions
|
|
@ -192,7 +192,7 @@ __clang__
|
||||||
** long int lrint (double x);
|
** long int lrint (double x);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(__LCC__) || (defined(__GNUC__) && defined(WIN32))
|
#if defined(__LCC__) || (defined(__GNUC__))
|
||||||
/* Linux' GCC does not seem to have these. Why? */
|
/* Linux' GCC does not seem to have these. Why? */
|
||||||
# define HAVE_LRINT
|
# define HAVE_LRINT
|
||||||
# define HAVE_LRINTF
|
# define HAVE_LRINTF
|
||||||
|
|
|
||||||
|
|
@ -186,10 +186,12 @@ when not defined(ECMAScript):
|
||||||
|
|
||||||
proc trunc*(x: float): float {.importc: "trunc", nodecl.}
|
proc trunc*(x: float): float {.importc: "trunc", nodecl.}
|
||||||
proc floor*(x: float): float {.importc: "floor", nodecl.}
|
proc floor*(x: float): float {.importc: "floor", nodecl.}
|
||||||
|
proc ceil*(x: float): float {.importc: "ceil", nodecl.}
|
||||||
|
|
||||||
else:
|
else:
|
||||||
proc mathrandom(): float {.importc: "Math.random", nodecl.}
|
proc mathrandom(): float {.importc: "Math.random", nodecl.}
|
||||||
proc floor*(x: float): float {.importc: "Math.floor", nodecl.}
|
proc floor*(x: float): float {.importc: "Math.floor", nodecl.}
|
||||||
|
proc ceil*(x: float): float {.importc: "Math.ceil", nodecl.}
|
||||||
proc random*(max: int): int = return int(floor(mathrandom() * float(max)))
|
proc random*(max: int): int = return int(floor(mathrandom() * float(max)))
|
||||||
proc randomize*() = nil
|
proc randomize*() = nil
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -557,9 +557,9 @@ proc format*(info: TTimeInfo, f: string): string =
|
||||||
result.add("0")
|
result.add("0")
|
||||||
result.add($info.monthday)
|
result.add($info.monthday)
|
||||||
of "ddd":
|
of "ddd":
|
||||||
result.add(($info.monthday)[0 .. 2])
|
result.add(($info.weekday)[0 .. 2])
|
||||||
of "dddd":
|
of "dddd":
|
||||||
result.add($info.monthday)
|
result.add($info.weekday)
|
||||||
of "h":
|
of "h":
|
||||||
result.add($(info.hour - 12))
|
result.add($(info.hour - 12))
|
||||||
of "hh":
|
of "hh":
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue