Floats in FOCAL

33 views
Skip to first unread message

Mike Markowski

unread,
May 16, 2026, 9:05:49 AM (8 days ago) May 16
to pid...@googlegroups.com
Exploring the 48-bit floats in FOCAL, I ran this little program to find bits in mantissa:

*W
C U/W-FOCAL:  16K-V4  NO/DA/TE

01.10 SET E=1
01.20 SET N=0

02.10 SET E=E/2
02.20 SET N=N+1
02.30 IF (1+E-1) 2.10,3.10,2.10

03.10 TYPE %,"FOCAL EPS = ",2*E,!
03.20 TYPE %2,"APPROX SIG BITS = "N-1,!
03.30 QUIT
*GOTO 1.10
FOCAL EPS =  5.820766092E-11
APPROX SIG BITS =  34

seems to show 34 bits are used for mantissa.  And this little test:

*T FEXP(1421),!
  1.4E+617
*T FEXP(1422),!
  0
2**n == exp(1421), or n is about 2050.  log2(2050) == 11 bits for exponent.  34+11=46 bits, though, so I've made a mistake of some sort not accounting for 2 extra bits.  What prompted this was noticing that IEEE uses less bits for exponent to provide better precision in mantissa.  So exp(709) is that max using IEEE format floats.

Does anyone spot a mistake or oversight in the above causing me to lose 2 bits?  

Thanks,
Mike Markowski

Steve Tockey

unread,
May 16, 2026, 10:40:50 AM (8 days ago) May 16
to Mike Markowski, pid...@googlegroups.com

Are you forgetting the two sign bits,mine on each of the mantissa and the exponent? It’s plus or minus mantissa raised to the plus or minus exponent power, right?


— steve


--
You received this message because you are subscribed to the Google Groups "PiDP-8" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pidp-8+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pidp-8/b5420f38-5605-4a47-86fc-abb511f13030%40gmail.com.

Mike Markowski

unread,
May 16, 2026, 11:27:14 AM (8 days ago) May 16
to Steve Tockey, PiDP-8
Thanks, Steve. Yes, that would explain it!  Much appreciated.  -Mike
Reply all
Reply to author
Forward
0 new messages