Fixed math.round, added math.ceil and fixed times.format.

This commit is contained in:
Dominik Picheta
2012-06-04 19:24:13 +01:00
parent 4105a91c48
commit 41a9a941ab
3 changed files with 5 additions and 3 deletions

View File

@@ -192,7 +192,7 @@ __clang__
** 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? */
# define HAVE_LRINT
# define HAVE_LRINTF

View File

@@ -186,10 +186,12 @@ when not defined(ECMAScript):
proc trunc*(x: float): float {.importc: "trunc", nodecl.}
proc floor*(x: float): float {.importc: "floor", nodecl.}
proc ceil*(x: float): float {.importc: "ceil", nodecl.}
else:
proc mathrandom(): float {.importc: "Math.random", 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 randomize*() = nil

View File

@@ -557,9 +557,9 @@ proc format*(info: TTimeInfo, f: string): string =
result.add("0")
result.add($info.monthday)
of "ddd":
result.add(($info.monthday)[0 .. 2])
result.add(($info.weekday)[0 .. 2])
of "dddd":
result.add($info.monthday)
result.add($info.weekday)
of "h":
result.add($(info.hour - 12))
of "hh":