Almost forgot... Some weeks(?) ago I noticed that people tend have problems with floating point precision (problem with all general purpose languages). So, I'll share my quick & dirty solution.
Short but useful code if you need very precise numbers for math, but speed is not crucial. I personally use it for prototyping. This is for class (name it BcClass): Private hPro As Process Public Function _call(sFunc As String) As String Dim ss As String Print #hPro, sFunc Input #hPro, ss Return ss End Public Sub _new(Optional iPrecision As Integer = 100) hPro = Exec ["env", "BC_LINE_LENGTH=0", "bc"] For Read Write Print #hPro, "scale=" & CStr(iPrecision) End Public Sub Stop() hPro.Close() End This is how you use it: Dim Calculate As New BcClass(8) Print Calculate("1+2/7^2.4") 1.04081632 And when all calculations are done, end your code with "Calculate.Stop()". BTW. Is there some place for code snippets? Jussi ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user