Access to 128-bit floats on suitable (64bit ARM) platforms?

Noting the recent determination that long doubles are 128 bits on Raspberry Pi 4 (and Pi 3), I'm wondering if there's any way to access that facility from a BBC Basic?

Comments

  • (Oops, should have specified that they need to be running a 64 bit OS)
  • In Matrix Brandy, all floating point types (as with BASIC VI) are 64-bit, and that's available on all supported platforms including RISC OS on ARM-26. For some calculations, they are internally calculated using whatever "long double" offers to minimise loss of precision in intermediate steps, but the final value is returned as a 64-bit float. This could give rise to the same function returning subtly different values on different hardware, but the intention is to get the best result available in the available 64 bits. At this stage there is no facility to expose float128s in BASIC.
  • Thanks, that makes sense. (It looks as if these float128s might well be implemented in software and therefore be a lot slower than the corresponding 80 bit floats on Intel. But I'm not sure of this.)
  • BigEd wrote: »
    It looks as if these float128s might well be implemented in software and therefore be a lot slower than the corresponding 80 bit floats on Intel. But I'm not sure of this.
    That's right. No ARM CPU, so far as I'm aware, supports anything longer than 64-bit doubles in hardware, so the 128-bit 'long doubles' you refer to are purely a convention adopted by some C compilers, implemented in a software library. Traditionally, BBC BASIC supports only the CPU's native floats.

    Rather more interesting, from my perspective, is the support for 80-bit long-doubles (96-bits, once padded to the standard 16-byte alignment of 64-bit platforms) on the Apple M1 and M2 CPUs, by Apple's Rosetta 2 x86 emulation.

    The performance of this is so spectacular that I wonder whether Apple has incorporated some unadvertised instructions in its implementation of the ARM architecture to accelerate it. Probably not, but with Apple you never know!
Sign In or Register to comment.