Author Topic: Floating Point in Axe  (Read 4602 times)

0 Members and 1 Guest are viewing this topic.

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Floating Point in Axe
« on: September 02, 2010, 09:17:59 pm »
so i was thinking about making my own "floating point data type" if you will. it'll probably be more of a tutorial on how one might manage floating point numbers if one wants. it would probably not use mantissa-exponent notation, as although it's very fast, it's expensive on memory. instead i was thinking of having a sign bit, then 12 bits for the integer part and 11 bits for the floating part. this would allow your maximum number to be 4095.2047. i know, it's small. i was thinking of having them be stored as four bytes, making the highest number 65535.32767, which i think is more reasonable since you get 4 digits in the floating point guaranteed, and a pretty high number as your integer part. this would allow for some basic floating point in axe. (quadratic solver anyone?) unless this is a feature quigibo plans to put in the final release and i'm just blabbing about floating point for nothing.


Offline Raylin

  • Godslayer
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1392
  • Rating: +83/-25
  • I am a certifiable squirrel ninja.
    • View Profile
    • Ray M. Perry
Re: Floating Point in Axe
« Reply #1 on: September 02, 2010, 09:22:46 pm »
Uhm...
Aren't there floating points in Axe now?
Bug me about my book.

Sarah: TI-83 Plus Silver Edition [OS 1.19]
Cassie: TI-86 [OS 1.XX]
Elizabeth: TI-81 [OS 1.XX]
Jehuty: TI-83 Plus Silver Edition [OS 1.19]
Tesla: CASIO Prizm







Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Floating Point in Axe
« Reply #2 on: September 02, 2010, 09:23:01 pm »
I think it'd be cool :) I've often wondered how to create floating points from none but never took the time to try and learn how.
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Floating Point in Axe
« Reply #3 on: September 02, 2010, 09:24:51 pm »
so i was thinking about making my own "floating point data type" if you will. it'll probably be more of a tutorial on how one might manage floating point numbers if one wants. it would probably not use mantissa-exponent notation, as although it's very fast, it's expensive on memory. instead i was thinking of having a sign bit, then 12 bits for the integer part and 11 bits for the floating part. this would allow your maximum number to be 4095.2047. i know, it's small. i was thinking of having them be stored as four bytes, making the highest number 65535.32767, which i think is more reasonable since you get 4 digits in the floating point guaranteed, and a pretty high number as your integer part. this would allow for some basic floating point in axe. (quadratic solver anyone?) unless this is a feature quigibo plans to put in the final release and i'm just blabbing about floating point for nothing.
That would actually be fixed-point (cause the decimal point is in a fixed position)
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Floating Point in Axe
« Reply #4 on: September 02, 2010, 09:28:21 pm »
so i was thinking about making my own "floating point data type" if you will. it'll probably be more of a tutorial on how one might manage floating point numbers if one wants. it would probably not use mantissa-exponent notation, as although it's very fast, it's expensive on memory. instead i was thinking of having a sign bit, then 12 bits for the integer part and 11 bits for the floating part. this would allow your maximum number to be 4095.2047. i know, it's small. i was thinking of having them be stored as four bytes, making the highest number 65535.32767, which i think is more reasonable since you get 4 digits in the floating point guaranteed, and a pretty high number as your integer part. this would allow for some basic floating point in axe. (quadratic solver anyone?) unless this is a feature quigibo plans to put in the final release and i'm just blabbing about floating point for nothing.
That would actually be fixed-point (cause the decimal point is in a fixed position)

so i would have to use mantissa-exponent notation, or something similar for it to be floating point? is there an advantage to floating point?

raylin, i don't think there is. i mean there are 9 byte floats that are organized by the OS, but there's no way to multiply, add, subtract or divide them in an axe program. i'm just asking if attempting to make this sort of system is a good idea, and then have subroutines to add/subtract/multiply/divide.

i'm just wondering if it's worth the effort or if anyone would use them.


Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Floating Point in Axe
« Reply #5 on: September 02, 2010, 10:30:52 pm »
Well, there is already the 8.8 multiplication built in.  What might be more useful would be an extended precision math engine that uses 32-bit numbers instead of 16-bit (so 16.16).  That gives signed numbers as high as 32,768 with a precision of (1/2)^16 which is around 0.00001  Unfortunately, the drawback is that the numbers need to take up 4 bytes or 2 Axe variables each.

If you know the math, it's not very difficult to write since you can use the *^ and ** commands which were designed for this purpose.  You could alternatively try 24.8 or 8.24 notations for applications requiring larger numbers or higher precision.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Floating Point in Axe
« Reply #6 on: September 02, 2010, 11:54:53 pm »
I'm not too sure if I would use them, but they may make certain programs (such as 3D stuff and... erm... quadratic solvers) easier to create in Axe.

Would it be very slow, though?