extended-precision

How can i add two numbers with 12 bytes each-one?

有些话、适合烂在心里 提交于 2020-12-26 11:02:10
问题 I want to add two numbers that have 12 bytes and to store the result in a 16 bytes var. How can i do this? section .data big_num1 dd 0x11111111, 0x22222222, 0x33333333 big_num2 dd 0xffffffff, 0x22222222, 0x33333333 section .bss result_4word resd 4 I think i can add the first 4 bytes number from number 1 with the other first 4 bytes from number 2 and so on.. but i don't know how to concatenate results in in my result variable. How should i do the carry,if it's needed? Is this solution the

How can i add two numbers with 12 bytes each-one?

血红的双手。 提交于 2020-12-26 11:00:20
问题 I want to add two numbers that have 12 bytes and to store the result in a 16 bytes var. How can i do this? section .data big_num1 dd 0x11111111, 0x22222222, 0x33333333 big_num2 dd 0xffffffff, 0x22222222, 0x33333333 section .bss result_4word resd 4 I think i can add the first 4 bytes number from number 1 with the other first 4 bytes from number 2 and so on.. but i don't know how to concatenate results in in my result variable. How should i do the carry,if it's needed? Is this solution the

manipulating 32 bit numbers with 16 bit registers in 8086

五迷三道 提交于 2020-12-25 04:00:57
问题 Im trying to write a program which get two 6-digit decimal numbers and show the addition of them, but in 16 bit 8086 i defined numbers as double word and put LO in WORD 1 and HO in word 2. similar to below code but i dont have any idea to do next, can any body suggest me algorithm for next operations? Thnx x dd(?) next_no: mov cl,2 mov ch,4 two_bit: getch sub al,30h mov bl,10 mul bl mov di,ax add word ptr x+2,di dec cl jnz two_bit fourbit: getch sub al,30h mov bl,10 mul bl mov di,ax add word

C++ handling of excess precision

喜你入骨 提交于 2019-12-28 05:35:26
问题 I'm currently looking at code which does multi-precision floating-point arithmetic. To work correctly, that code requires values to be reduced to their final precision at well-defined points. So even if an intermediate result was computed to an 80 bit extended precision floating point register, at some point it has to be rounded to 64 bit double for subsequent operations. The code uses a macro INEXACT to describe this requirement, but doesn't have a perfect definition. The gcc manual mentions

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

你说的曾经没有我的故事 提交于 2019-12-11 07:47:59
问题 This question already has answers here : Why _umul128 works slower than scalar code for mul128x64x2 function? (1 answer) SIMD signed with unsigned multiplication for 64-bit * 64-bit to 128-bit (2 answers) Is there hardware support for 128bit integers in modern processors? (3 answers) Is there a 128 bit integer in gcc? (3 answers) Closed 3 months ago . 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

Is it possible to use extended precision (80-bit) floating point arithmetic in GHC/Haskell?

吃可爱长大的小学妹 提交于 2019-12-03 10:26:56
The standard Haskell's Double uses the standard double-precision arithmetic : data Double Double-precision floating point numbers. It is desirable that this type be at least equal in range and precision to the IEEE double-precision type. Does GHC/Haskell offer somewhere also the extended precision (80-bit) floating point numbers, perhaps using some external library? As chuff has pointed out, you might want to take a look a the numbers package on hackage. You can install it with cabal install numbers . Here is an example: import Data.Number.CReal -- from numbers main :: IO () main = putStrLn

Can XMM registers be used to do any 128 bit integer math? [duplicate]

流过昼夜 提交于 2019-11-28 14:04:01
This question already has an answer here: Is it possible to use SSE and SSE2 to make a 128-bit wide integer? 1 answer My impression is definitely not but perhaps there is a clever trick? Thanks. Not directly, but there are 64 bit arithmetic operations which can be easily combined to perform 128 bit (or greater) precision. The xmm registers can do arithmetics on 8, 16, 32 and 64 bit integers. It doesn't produce a carry flag so you can't extend the precision beyond 64 bits. The extended precision math libraries use the general purpose registers which are 32 bit or 64 bit, depending on the OS. 来源

Does gcc support 128-bit int on amd64? [duplicate]

て烟熏妆下的殇ゞ 提交于 2019-11-27 23:29:10
This question already has an answer here: Is there a 128 bit integer in gcc? 3 answers Does gcc support 128-bit int on amd64? How to define it? How to use scanf/printf to read/write it? rkhayrov GCC supports built-in __int128 and unsigned __int128 types (on 64-bit platforms only), but it looks like formatting support for 128-bit integers is less common in libc. Note: <stdint.h> defines __int128_t and __uint128_t on versions before gcc4.6. See also Is there a 128 bit integer in gcc? for a table of gcc/clang/ICC versions. How to know if __uint128_t is defined for detecting __int128 void f(_

Is there a document describing how Clang handles excess floating-point precision?

白昼怎懂夜的黑 提交于 2019-11-27 12:59:42
It is nearly impossible(*) to provide strict IEEE 754 semantics at reasonable cost when the only floating-point instructions one is allowed to used are the 387 ones. It is particularly hard when one wishes to keep the FPU working on the full 64-bit significand so that the long double type is available for extended precision. The usual “solution” is to do intermediate computations at the only available precision, and to convert to the lower precision at more or less well-defined occasions. Recent versions of GCC handle excess precision in intermediate computations according to the

Can XMM registers be used to do any 128 bit integer math? [duplicate]

坚强是说给别人听的谎言 提交于 2019-11-27 08:09:57
问题 This question already has an answer here : Is it possible to use SSE and SSE2 to make a 128-bit wide integer? (1 answer) Closed 2 years ago . My impression is definitely not but perhaps there is a clever trick? Thanks. 回答1: Not directly, but there are 64 bit arithmetic operations which can be easily combined to perform 128 bit (or greater) precision. 回答2: The xmm registers can do arithmetics on 8, 16, 32 and 64 bit integers. It doesn't produce a carry flag so you can't extend the precision