Welcome, Guest. Please login or register.

Author Topic: while() with float ?  (Read 3050 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline ChaosLord

  • Hero Member
  • *****
  • Join Date: Nov 2003
  • Posts: 2608
    • Show all replies
    • http://totalchaoseng.dbv.pl/news.php
Re: while() with float ?
« on: February 18, 2006, 02:44:24 AM »
I have always used the integer method with a scale factor of 32768 or 65536 in all my code for many years.  It works great and is super fast.  I work with only positive numbers so I can use bitshifts instead of slow multiply & divide.
This is called fixed point arithmetic.  It roxx0rizes my code. :-D

----------------------------------------------------
btw: If for some strange reason you wanted to,
you could store all your decimal numbers in decimal
and do all your math in decimal with your own functions.  That is how banks do it.

You could use EBCDIC packed decimal or 1 byte per digit or however you wanted to store your numbers.  Hell you could store them as ASCII strings if you wanted to.

But doing decimal arithmetic on a binary computer using above method will be both extremely accurate and extremely slow.:-o  
Wanna try a wonderfull strategy game with lots of handdrawn anims,
Magic Spells and Monsters, Incredible playability and lastability,
English speech, etc. Total Chaos AGA