flat assembler
Message board for the users of flat assembler.

Index > Windows > Floating point numbers - Extended precision

Author
Thread Post new topic Reply to topic
MattDiesel



Joined: 31 Oct 2010
Posts: 34
Location: England
MattDiesel 13 Apr 2011, 14:15
Sorry to be asking so many questions, but it's holiday time for me so I'm doing a lot of work in fasm (same project as last time still).

Moving on from lexical analysis in my programming language (which is going well btw) I am now implementing the variant type. I've written most of the structures and a few of the basic functions for casting etc. (when it's done it will practically be a library for dynamic typing in asm Razz ) But I have a problem with floats:

I originally said in my plan for the language that I'd have three types of ints: 32, 64 and 128 bit and also 3 types of float (single, double and quad), but I've now found out that the fpu registers only go up to extended precision (80 bit). I was always going by the IEEE standard (forgotten the number now) that specified those three sizes, so it was a bit of a surprise when I found that the registers don't go there.

The main thing is... How do I get around it? I could always go back and change it to extended precision, but I'd rather support quad so I can say its going by the standard, and the extra accuracy would be good (the language is designed for maths mostly). But I've struggled enough with trying to work with single precision floats converting to strings and have no intention of making life any harder than it is for me. Any suggestions?

I suppose another question would be why? why do the registers only go up to 80bit floats and what about other OS'??

I promise no questions till next week after this Razz

Mat
Post 13 Apr 2011, 14:15
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20445
Location: In your JS exploiting you and your system
revolution 13 Apr 2011, 14:58
I think you will find that there are no commercial CPUs that support quad precision natively. Your only choice is to roll your own quad precision engine.
MattDiesel wrote:
... have no intention of making life any harder than it is for me. Any suggestions?
Yes. Don't bother with quad precision unless you really have a need for it. Usually if someone needs really high precision (greater than double) then they also need to go much further than quad (i.e. an arbitrary precision requirement) so the quad precision is often not useful.
Post 13 Apr 2011, 14:58
View user's profile Send private message Visit poster's website Reply with quote
MattDiesel



Joined: 31 Oct 2010
Posts: 34
Location: England
MattDiesel 13 Apr 2011, 15:03
So why is it in the standard then? Grrrr....

I guess I'll be going back to just extended precision then. Makes much more sense that way (writing my own engine is not a prospect I look forward to, the registers make no sense as it is).
Post 13 Apr 2011, 15:03
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20445
Location: In your JS exploiting you and your system
revolution 13 Apr 2011, 15:08
MattDiesel wrote:
So why is it in the standard then?
It is much easier to write a standard than it is to actually implement it.

BTW: IEEE754 is the number you are thinking of.
Post 13 Apr 2011, 15:08
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.