Questions tagged [extended-precision]

45 questions
1
vote
0 answers

How to shift bits between two different register?

I have two registers,R1 and R2. I need a shift operation between them. Is there any instruction for this operation or should I follow a different path? Actually, I can obtain the less significant digit of R1 by using AND instruction but, I also can…
1
vote
1 answer

Shift across registers efficiently

How can I efficiently fill the most significant bit of a register with the least significant bit of another register in x64-Assembly. The Intended use is efficient division of a 128bit value by two (essentially a cross-register shift). RDX:RAX…
Valentin Metz
  • 393
  • 6
  • 13
1
vote
0 answers

Optimize 128x128 to 256-bit multiply for Intel AVX[SIMD]

I'm trying to implement multiplication of 128 unsigned int on two 64 unsigned integers by Intel AVX. The problem is that non vectorised version works faster than hand-vectorised version. Here is my test benchmark. On my laptop i got next…
Ivan Kamynin
  • 51
  • 1
  • 6
1
vote
1 answer

Assembly multiplication of 16-bit x 32-bit => 48-bit

Assume I want to multiply a large number by another (maybe small) number in assembly. The big number (multiplicand) is saved in DX:AX and the multiplier is saved in BX. The MUL instruction only operates on AX. So what to do with DX? For example, the…
mahmood
  • 23,197
  • 49
  • 147
  • 242
1
vote
3 answers

How large numbers are stored in registers

This is a basic question but say I want to multiply 3 numbers together that are in registers $t2, $t3, and $t4. Hypothetically speaking, assume each register can only hold 8 bits and when we multiply the three numbers together and the result may be…
Justin Case
  • 787
  • 2
  • 15
  • 30
1
vote
0 answers

Precision problems with very large reals - Fortran

The problem I'm attempting to tackle at the moment involves computing the order of 10 modulo(n), where n could be any number less than 1000. I have a function to do exactly that, however, I am unable to obtain accurate results as the value of the…
1
vote
1 answer

Floating-point NaN depending on uncorrelated exception handling in C++

Really weird: double *data; // uncorrelated double a,b,c; double sigma = 1e-309; // denormalized number try { data = new double[10]; } // uncorrelated catch(...) { cout << "error"; return 1; } a = 1/sigma; // infinite b =…
mb84
  • 683
  • 1
  • 4
  • 13
0
votes
0 answers

896-bit integer? Or 16384-bit?

Since has x86_64 has 14 general-purpose registers (rsp and rbp are for stack), could you make a 896 bit integer? Or could you even use all 32 zmm registers (512-bit) to make a 16384-bit integer, by moving parts of it into the 64-bit registers and…
theoo3
  • 1
  • 1
0
votes
0 answers

How to merge two 16 bit dW in one DD number in 8086 assembly

with the following code I calculate first 30 elements of fibonacci sequence. Note that every two element of arr represent one element of the fibonacci sequence while the fibonnaci numbers after 26th element will need more than 2 byte to…
0
votes
0 answers

Finding factorial of a large number in assembly, not work when n>=15

I'm using MASM and dosbox to do this, basically converting the C version into assembly. int main() { int a[20001]; int temp,digit,n,i,j=0; scanf("%d",&n); a[0]=1; digit=1; for(i=2;i<=n;i++) { int num=0; …
0
votes
1 answer

What's the philosophy concerning the use of floating point values in Clojure?

Currently I'm working with Clojure-on-top-of-the-JVM. The Java language, which exposes the floating point functionality of the JVM, says that we get (exactly) IEEE-754 32-bit single-precision (Java "float") and 64-bit double precision (Java…
David Tonhofer
  • 14,559
  • 5
  • 55
  • 51
0
votes
1 answer

Multiplying 64-bit number by a 32-bit number in 8086 asm

I have been having problems even initiating the solution for the problem. I have tried considering the multiplication is repeated addition algorithm but whatever algorithm I consider, I seem to be fixated over a single issue- the max register size…
0
votes
0 answers

computing 64 bit unsigned integer multiplication and subtraction using 32 bit integers

I have a project to compute 64 bit unsigned integer addition, multiplication and subtraction using only 32 bit signed/unsigned integers in c. The 64 bit unsigned integer is newly defined like this : typedef struct { unsigned integer hi; unsigned…
0
votes
1 answer

Divide a Dword by a word nasm

I'm trying to do a signed division of a dword in DX:AX let's say 1234567 with a word [b]=10. a dd 1234567 b dw 10 mov ax,[a] mov dx,[a+2] idiv word [b] The quotient should be 123456 but its too big so it doesn't fit in ax. What should I do to solve…
Doull Owen
  • 21
  • 3
-1
votes
3 answers

Adding 32-bit numbers on a 32 machine, widening to a 64-bit sum in two registers

How to add couple of 32 bit numbers on a 32 bit machine but without precision loss, i.e. in a 64 bit "pseudo register" eax:edx. Using Intel syntax assembler.
Cartesius00
  • 23,584
  • 43
  • 124
  • 195
1 2
3