Fixed precision vs. arbitrary precision

antimatter

A lot of modern languages have support for arbitrary precision numbers. Java has BigInteger, Haskell has Integer, Python is de-facto arbitrary. But for a lot of these languages, arbitrary precision isn't de-facto, and is instead prefixed with 'Big'.

Why isn't arbitrary precision de-facto for all modern languages? is there a particular reason to use fixed-precision numbers over arbitrary-precision?

If I had to guess it would be because fixed precision somehow corresponds to assembly instructions, so it's more optimal and runs faster, which would be a worthwhile trade-off if you didn't have to worry about overflow because you knew the numeric ranges beforehand. Are there any particular use cases of fixed-precision over arbitrary-precision?

usr

It is a trade-off between performance and features/safety. I cannot think of any reason why I would prefer using overflowing integers other then performance. Also, I could easily emulate overflowing semantics with non-overflowing types if I ever needed to.

Also, overflowing a signed int is a very rare occurrence in practice. I happens almost never. I wish that modern CPUs supported raising an exception on overflow without performance cost.

Different languages emphasize different features (where performance is a feature as well). That's good.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

String format double with arbitrary precision, fixed decimal position

From Dev

LLVM arbitrary precision integer

From Dev

Python mpmath not arbitrary precision?

From Dev

LLVM arbitrary precision integer

From Dev

Fixed precision in C

From Dev

Rounding to a fixed relative precision

From Dev

arbitrary floating precision number to string

From Dev

"Multiplication of Arbitrary Precision Numbers" in Scheme

From Dev

stripe node arbitrary precision number

From Dev

Precision of Fortran vs that of Matlab

From Dev

Precision of Fortran vs that of Matlab

From Dev

Implementing fixed precision numbers in CUDA

From Dev

Arbitrary precision for decimals square roots in golang

From Dev

Fast arbitrary-precision logarithms with bcmath

From Dev

postgresql date_trunc to arbitrary precision?

From Dev

Arbitrary precision arithmetic with very big factorials

From Dev

Is Python incorrectly handling this "arbitrary precision integer"?

From Dev

Arbitrary precision arithmetic with very big factorials

From Dev

Calculate Pi with arbitrary precision digit by digit

From Dev

tcl formatting floating point with fixed precision

From Dev

R - write.csv with fixed precision

From Dev

How to format a double of fixed precision to a given length?

From Dev

Fixed precision always in js 0.5 -> 0.5000

From Dev

BBP-Algorithm in Python - Working with Arbitrary-precision arithmetic

From Dev

Calculating pi without arbitrary precision and only basic arithmetic

From Dev

Which programming languages have arbitrary precision floating-point literals?

From Dev

Is it possible to achieve arbitrary-precision arithmetic with no rounding issues in JavaScript?

From Dev

Hash an arbitrary precision value (boost::multiprecision::cpp_int)

From Dev

arbitrary precision linear algebra c/c++ library with complex numbers

Related Related

  1. 1

    String format double with arbitrary precision, fixed decimal position

  2. 2

    LLVM arbitrary precision integer

  3. 3

    Python mpmath not arbitrary precision?

  4. 4

    LLVM arbitrary precision integer

  5. 5

    Fixed precision in C

  6. 6

    Rounding to a fixed relative precision

  7. 7

    arbitrary floating precision number to string

  8. 8

    "Multiplication of Arbitrary Precision Numbers" in Scheme

  9. 9

    stripe node arbitrary precision number

  10. 10

    Precision of Fortran vs that of Matlab

  11. 11

    Precision of Fortran vs that of Matlab

  12. 12

    Implementing fixed precision numbers in CUDA

  13. 13

    Arbitrary precision for decimals square roots in golang

  14. 14

    Fast arbitrary-precision logarithms with bcmath

  15. 15

    postgresql date_trunc to arbitrary precision?

  16. 16

    Arbitrary precision arithmetic with very big factorials

  17. 17

    Is Python incorrectly handling this "arbitrary precision integer"?

  18. 18

    Arbitrary precision arithmetic with very big factorials

  19. 19

    Calculate Pi with arbitrary precision digit by digit

  20. 20

    tcl formatting floating point with fixed precision

  21. 21

    R - write.csv with fixed precision

  22. 22

    How to format a double of fixed precision to a given length?

  23. 23

    Fixed precision always in js 0.5 -> 0.5000

  24. 24

    BBP-Algorithm in Python - Working with Arbitrary-precision arithmetic

  25. 25

    Calculating pi without arbitrary precision and only basic arithmetic

  26. 26

    Which programming languages have arbitrary precision floating-point literals?

  27. 27

    Is it possible to achieve arbitrary-precision arithmetic with no rounding issues in JavaScript?

  28. 28

    Hash an arbitrary precision value (boost::multiprecision::cpp_int)

  29. 29

    arbitrary precision linear algebra c/c++ library with complex numbers

HotTag

Archive