Python Forum
any code around to do float in base 16?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
any code around to do float in base 16?
#1
is there any code around to do float in base 16 or do i need to write some?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
What should that be ?
Could you make an example
or have a link to the format?
Reply
#3
Maybe this:
https://en.wikipedia.org/wiki/IBM_hexade...ting_point
Reply
#4
that's not hexadecimal as you might see it printed in characters from 0 to 9 and from a to f. this about the format IBM mainframes store floating point in registers and memory. it is referred to as "hexadecimal" because an increment of 1 in the exponent multiplies the number by 16 instead of by 2 as in the IEEE format. i know this well, having worked with it in assembler for a couple decades. i remember doing quad precision floating point fractals on some very big (at the time) mainframes i administered. i wrote lots of different conversion functions for its floating point. unfortunately, all that code was lost because i was unable to retrieve my 42 reel tapes i had everything backed up on when i moved to Texas. that, and i have never had access to a 1/2-inch reel-to-reel 6250 BPI tape machine since then,anyway.

however, what i am looking for is conversion to and from generic looking floating point that is in base 16 instead of base 10. for example the number "21.375" in base 10 would be "15.6" in base 16. i do not want a "hexadecimal dump" of floating point format representation of any machine type. one aspect of converting floating point to base 16 like that is that it can represent the binary stored values exactly with a finite number of digits. in order to have precisely reproducible results when input, storing, or outputting boundaries of my Mandelbrot set images, i used base 16 for them. i could read base 16 easily back then. do you really know how big "345.69140625" is in base 10? most people read the digits and at best can repeat the digits and would know what numbers are larger and smaller. in base 16 it would be "159.b1". you can repeat it and know that "159.aa4" is slightly smaller. you really can start reading base 16 floating point if all you need from it is what most people already get out of base 10.

i guess i have some code to write. i still remember how i did this in C so i don't need to go look for that code. base 10 was harder but i did it way back when i found a bug in libc's strtod() function (they did it in x86 assembly).
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Analyzing a code base pitosalas 0 540 Jul-20-2023, 03:59 PM
Last Post: pitosalas

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020