Hi.
I've been looking into nimrod lately and really likes what i see. Im trying to port a BigInteger class i made in c# just to learn, and i'd need to cast from an int to int64 as if they were unsigned.
Problem: var t:int=0xffffffff #same as -1 if signed var q:int64=t #q is now -1. How can i cast the to the unsigned value? echo(q) #outputs '-1'
Another question I have is the formatting of floats: echo(formatFloat(1.2,ffDefault,6)) outputs 1.20000 (Why 5 digits after dot by the way?) I want to format 1.2 to .... "1.2" but i cant find how to do it.
echo(formatFloat(1.2,ffDefault,0))
PS: Yes the forum's wiki syntax parser is about to be improved...
toU32 looks nice for my purposes.
Is there a way to convert unsigned integers to strings?
Sorry for my English. I am recently familiar with the nimrod language and it was pleasant to me. I have simple test the formatting of floats:
var f: float
var s: string
var t = cpuTime()
for i in 0..99999:
f = float(i)
s = f.formatFloat(ffDecimal,4)
t = cpuTime() - t
stdout.writeln t
Average result for nimrod: 6.8700000000000006e-001 (0.687) sec. The similar test for Delphi passes for: 0.038 sec. The similar test for C# passes for: 0.047 sec.
Why nimrod formatFloat too slow?
parseFloat and formatFloat have known performance problems. formatFloat ends up calling C's sprintf with a format string that can't be optimized by the C compiler. Patches are welcome. ;-)
PS: This thread is old, the github version now has support for unsigned.
What is --gc:boehm?
It's a compiler switch to use Boehm GC instead of Nimrod's own GC. It relies on Boehm GC library.