Super Newbie questions!

BlitzMax Forums/BlitzMax Beginners Area/Super Newbie questions!

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

1. Because floats are not precise enough, you need to use double for more accurate values.

2. There is no function for that. The simplest way might be
function round:string(value:double,digit:int)
  ' return type must be string otherwise it will have more than 2 digit
  value :* (10:double)^digit
  local valuei:int = int(value)
  local result:string = string(valuei)
  result = left(result, result.length - digit) + "." + right(result,digit)
  return result
end function


3. Better is a thing of definition. You could use some kind of an ini file and parsing, would perhaps be cleaner. Or if you know the order in which the data are in the file, you can simply assign them. (I do that with my language file, only the content, no key names in front etc. Allows straight reading into a string reference)