80 bit variables

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Guimauve wrote:
Fred wrote:Another important point is about other processors. Does them all support this 80 bit format ?
In theory, all modern processors can support 256 bit format. But this format is used for precisions, not for speed.

For bigger format you need to have a Super Computer, the computers used in astronomy or astrophysics for exemple. And you will not use PureBasic to write program for these computers. (Sorry Fred)
All modern processors supports integers in any number of bits, only limited by physical memory. I can make a 6 144 bit number if I care to wait for the computation time.
currency is a good idea !
Currency isn't an 80-bit float, it's a scaled 64-bit integer. (By a factor of 10000.)
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Trond wrote:All modern processors supports integers in any number of bits, only limited by physical memory. I can make a 6 144 bit number if I care to wait for the computation time.
Well, Trond; when say "a processor supports integers in x number of bits" is meant we are talking about the processors internal registers and buses widths, not about what can we do with the processors.
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Psychophanta wrote:
Trond wrote:All modern processors supports integers in any number of bits, only limited by physical memory. I can make a 6 144 bit number if I care to wait for the computation time.
Well, Trond; when say "a processor supports integers in x number of bits" is meant we are talking about the processors internal registers and buses widths, not about what can we do with the processors.
Then what Guimauve said is still wrong. "Normal" computers handle integers up to 32 bits, 64-bit computers handle integers up to 64 bit natively.
User avatar
Guimauve
Enthusiast
Enthusiast
Posts: 742
Joined: Wed Oct 22, 2003 2:51 am
Location: Canada

Post by Guimauve »

Trond wrote:All modern processors supports integers in any number of bits, only limited by physical memory. I can make a 6 144 bit number if I care to wait for the computation time.
Ok just show me how you can achive this. For 128 Bit Integer and 128 bit Float variables.

Because I'm highly interested.

Regards
Guimauve
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Only 128-bit integers. Floats are limited to the size of the fpu registers. But I'll show you, just wait a few seconds.

Code: Select all

; Apple.dq
Apple0.l
Apple1.l
Apple2.l
Apple3.l

; Orange.dq
Orange0.l
Orange1.l
Orange2.l
Orange3.l

; Orange = 92233720368547758
!mov [v_Apple0], 2061584302
!mov [v_Apple1], 21474836
!mov [v_Apple2], 0
!mov [v_Apple3], 0

; Orange = 92233720368547750
!mov [v_Orange0], 2061584294
!mov [v_Orange1], 21474836
!mov [v_Orange2], 0
!mov [v_Orange3], 0

; Apple = Apple + Orange
!mov eax, [v_Apple0]
!mov ecx, [v_Apple1]
!mov edx, [v_Apple2]
!add eax, [v_Orange0]
!adc ecx, [v_Orange1]
!adc edx, [v_Orange3]
!mov [v_Apple0], eax
!mov eax, [v_Apple3]
!adc eax, [v_Orange3]
!mov [v_Apple1], ecx
!mov [v_Apple2], edx
!mov [v_Apple3], eax

; Now how to display it?
Nik
Addict
Addict
Posts: 1017
Joined: Fri May 13, 2005 11:45 pm
Location: Germany
Contact:

Post by Nik »

I don't know much Assembly and even less about the inner orkings of a processor so here is what I could finbd out using my C++ compiler (g++ 4.0.1) on my Intel Mac, it can Cross Compile for PPC and the code runs in rosetta so here are the examples for both architectures:

x86 (-mcpu=Intel Core Duo Prescott core):
Sizeof(long long): 8 bytes
Sizeof(long double): 16 bytes

ppc:
Sizeof(long long):8 bytes
Sizeof(long double): 16 bytes

So it seems bot platforms work with 128 bit floats
jack
Addict
Addict
Posts: 1358
Joined: Fri Apr 25, 2003 11:10 pm

Post by jack »

Nik, I suspect that the 10 byte (80 bit) is padded with 6 bytes for code allignment.
Post Reply