Questions tagged [floating-point]

Approximate representation of numbers as a fixed number of digits multiplied by a logarithmic scale.

Filter by
Sorted by
Tagged with
0
votes
2answers
50 views

How to determine the set of real numbers corresponding to a given floating point number?

Let's say we consider IEEE 754 double precision floating-point numbers, and we use RNTE - Round To Nearest, Ties to Even - rounding. I know that the RNTE rounding works this way: given two consecutive ...
2
votes
1answer
30 views

Logic behind choosing the exponent bias as $2^7 -1$ instead of $2^7$ in $32$ bits IEEE-754 floating point representation

The $\text{IEEE-754}$ uses $32$ bits to represent single precision floating point numbers. The partitions of the register are as follows: ...
0
votes
0answers
8 views

What is the currently know fastest algorithms to convert each individual Java primitive and Number types to a Char Array/String

What is the currently know fastest algorithms to convert each individual Java primitive and Number types to a Char Array/String number representation while ...
1
vote
1answer
32 views

How to represent zero as floating point number?

For the floating-point number, we have the form $\pm d_0.d_1d_2···d_{P-1}\times\beta^E$ $\pm$ --------------------------- sign $d_0.d_1d_2···d_{p-1}$ --------- significant $\beta$ --------------------...
0
votes
0answers
36 views

Are floating-point numbers normalised by computers or humans?

I keep seeing posts and articles about how to normalise a floating-point number, why that's done and how such a number is represented in binary. But no one seems to mention who/what the normalisation ...
0
votes
1answer
40 views

How are bitwise operators used in normalisation of floating-point numbers?

After having spent a significant amount of time googling this topic, I am still struggling to confidently answer the following question: ...
1
vote
1answer
47 views

Converting Decimal Numbers between 0 and 1 to Binary

I've been playing around with a program I wrote that converts decimal numbers to binary numbers and i've noticed that eventually, after applying the algorithm (multiply by 2, subtract 1 if greater ...
1
vote
2answers
37 views

Floating-point oblivious way to compute multiset numbers

I have to compute $R = \left(\!\!{n + 1\choose k}\!\!\right)$, which happens to be: $$ R = \left(\!\!{n+1\choose k }\!\!\right) = \binom{n+k}{k} = \frac{(n + k)!}{n!k!} = \frac{(n+1)(n+2)\cdots(n+k)}{...
1
vote
2answers
37 views

Validity of Algorithm for Testing Two Floating Point Numbers

This question is related to the epsilon- (or delta- if you prefer) test for floating point equality. But my question is not how to do it. Instead I have a related algorithm for testing equality, and I ...
0
votes
0answers
35 views

New way of representing floating point

I want to create a new way of representing floating point. In standard IEEE floating point, we have 1 bit to represent sign, 8 bits to represent exponential and 23 bits to represent significand. In ...
0
votes
1answer
45 views

IEEE 754 addition wrong result floating point numbers

I want to add two IEEE 754 numbers. I followed the steps to add two 754 numbers. However the result it not correct. Number 1: S:0 E:01111111 M:11111111111111111111111 Number 2: S:0 E:01111111 M:...
0
votes
0answers
41 views

Is $x$ in the working range [3,2]?

Consider $x$ = $(0.1001)_b$ and $F$[3,2]. ($F$[3,2] is the set of all floating point numbers with 3 digits in the mantissa and 2 digits in the exponent.) The question is $x$ in the working range [3,2]?...
0
votes
2answers
50 views

Cancellation of inequalities in floating point arithmetic

In finite precision floating point arithmetic the associative property of addition is not satisfied. This is, it is not always the case that $$(a+b)+c=a+(b+c)$$ Even $a=(a+b)-b$ is not always true. To ...
0
votes
0answers
14 views

Why do many floating point numbers appear compact in base16 and base32 representation? (IEEE 754)

Consider 3 randomly chosen floating point values and their base conversions: ...
0
votes
1answer
23 views

How does value decompression work for Facebook's Gorilla in the case where count of leading zeroes is not stored

I am referring to this paper: http://www.vldb.org/pvldb/vol8/p1816-teller.pdf My question is regarding section 4.1.2 where it says: When XOR is non-zero, calculate the number of leading and ...
1
vote
1answer
13 views

Help comparing relative error for different parenthesizations of addition

I am given two functions: $ fl(fl(x+y)+z) $ and $ fl(x+fl(y+z)) $ and asked to derive their relative error. Then, given a set of conditions: a) $ x < y < x $ b) $ x > 0, y < 0, z > 0 $...
0
votes
0answers
39 views

Floating point binary number to a 7 segment decimal display

I have covered floating point (32 bit) conversion from float to decimal and decimal to float. I am happy with the theory and I have created a conversion tool in Excel VBA which works just fine ...
1
vote
1answer
58 views

What is the 2's complement answer of 16.5?

According to this post it is saying Two's complement is only for integers, but in Wolframalpha is is saying the Two's complement of 16.5 is 0010000.1, how?
5
votes
5answers
286 views

fast and stable x * tanh(log1pexp(x)) computation

$$f(x) = x \tanh(\log(1 + e^x))$$ The function (mish activation) can be easily implemented using a stable log1pexp without any significant loss of precision. Unfortunately, this is computationally ...
0
votes
1answer
54 views

Converting a number to 16-bit Floating Point Format

I want to convert the number -29.375 to IEEE 745 16-bit floating point format. Here is my solution: The format of the floating point number is: 1 sign bit unbiased exponent in 4 bits plus a ...
2
votes
1answer
47 views

Numerical Accuracy & Sorting Algorithms?

Sedgewick and Wayne talk about how sorting algorithms and, specifically, priority queues are used in devising ways to improve accuracy in floating-point calculations: https://algs4.cs.princeton.edu/...
-1
votes
2answers
372 views

Write the smallest positive number that can be represented by the floating point system

Using a normalised floating point representation box with an 8-bit mantissa and a 4-bit exponent, both stored using two’s complement. (a) Write the smallest positive number that can be represented by ...
1
vote
1answer
42 views

Is the exponent bias $2^{n-1}-1$ or $2^{n-1}$

I'm a bit confused with the exponent bias. The sources I found online claim that it is either $2^{n-1}-1$ or $2^{n-1}$, $n$ is the number of bits used for the exponent. In my book when given examples ...
0
votes
1answer
41 views

Understanding How Double Precision Numbers are Stored in a Computer

I am reading Numerical Analysis by Walter Gautschi. I am somewhat confused by the following quote from page $5$: To increase the precision, one can use two machine registers to represent a machine ...
2
votes
1answer
40 views

Question About Floating Point System

I have begun reading Numerical Analysis by Walter Gautschi. On page $3$, the author introduces the floating point number system as follows: a floating point number is a number representible as $$ \...
0
votes
2answers
384 views

Why is there a precision loss for floating-point numbers?

It could be a silly question, yet I'm not able to understand. In modern day, computers, we have integers with million digits length. Even in my ordinary 2GB laptop, I can calculate values of numbers ...
2
votes
1answer
56 views

Max flow algorithm for floating-point weights and E~=10*V

Could you, please, suggest a maximum flow algorithm for a graph with floating-point weights and the number of edges approximately equal to the number of vertices? I.e. ...
0
votes
1answer
119 views

Normalization in IBM hexadecimal floating point

According to the Wikipedia link of IBM hexadecimal floating point: Consider encoding the value −118.625 as an IBM single-precision floating-point value. The value is negative, so the sign ...
1
vote
1answer
51 views

Convert scientific notation decimal number to binary

I'm given the number: $$8.881784197001252 \cdot 10^{-16}$$ I know it is $2^{-50}$ but suppose I didn't know. I need to convert it to binary. One way is to apply the school taught algorithm on the ...
2
votes
1answer
125 views

Do all programming languages adhere to the IEEE 754-2008 standard?

I am well aware that the float data type's maximum value is approximately 1.8E308, which means that across the various ...
1
vote
0answers
286 views

What are the smallest and biggest negative floating point numbers in IEEE 754 32 bit?

I am stuck with a question that asks for smallest and biggest negative floating point numbers in IEEE 754 32-bit (their representation and decimal numerical value from which one can approximate the ...
1
vote
0answers
33 views

How can I calculate the exponential integral?

(I'm not sure this is the right forum.) I'm writing a program that uses the prime-counting function. Right now, I'm using x/log(x), but I want to switch to ...
1
vote
1answer
27 views

What's the least signifcant bit of a mantissa system?

If Mantissa is a 1-dot-M fixed-point number whose most significant bit is always 1 then, how is the least significant bit calculated? I know the least and most significant bit of the mantissa ...
0
votes
2answers
175 views

Question about machine epsilon

I am studying over my notes, and there is something I don't understand about $e_m$. We represent the floating point numbers as $1.d_1d_2...d_t \times \beta^e$. Now, my professor defines $\epsilon_m$ ...
1
vote
1answer
36 views

Floating point arithmetic on division

I am trying to figure out how $(x/y)$ in floating point arithmetic $fl(fl(x) / fl(y))$ where $fl(x) = x(1-\delta_1)$, $fl(y) = y(1-\delta_2)$, $fl = (1-\delta_3)$ I have: $= x/y \cdot ((1-\delta_1)/...
2
votes
1answer
49 views

Smallest integer i stored as a float such that i+1=i

So I had an assignment which asked me to find the smallest integer $i$ which when represented as a float is such that $i+1=i$ My approach- By making a simple C++ program , we get $i=16777216$ or $i=2^...
2
votes
2answers
69 views

Why multiplying float number by multiple of 10 seems to preserve better precision?

It is famous that for float numbers: .1 + .2 != .3 but 1+2=3 It seems that multiplying floats by 10 allows you to preserve ...
1
vote
4answers
74 views

How does a computer compute negative(-) and positive(+) Infinity?

If we divide (1.0/0.0) we will get +Infinity and if we divide (-1.0/0.0) we will get -Infinity. How does a computer calculate this value internally?
1
vote
0answers
54 views

Can we represent $\sqrt{2}$ exactly even with infinite bits in mantissa [closed]

Can we represent $\sqrt{2}$ exactly even with infinite bits in mantissa in floating point notation or otherwise. We actually have to prove this is not possible. But why can't we if we have infinite ...
0
votes
0answers
28 views

Floating point substraction

if $x=1.0e38=1.0 * 10^{38}$ and $y=3.0$ i want to find $ (x-x)+y $ and $(x+y)-x$ i think the value of (x-x)+y will be just substract $x-x=0 + y=3.0 = 3.0$ but how can i perfom addition of different ...
2
votes
1answer
74 views

Polynomials - using Newton's method, or not?

I have to find a root of polynomial of degree $n\ge2$. I need to write code to calculate the root for different values of $n$. Only 1 real positive solution is needed. I can use general Newton's ...
1
vote
0answers
29 views

How many floating point ops were performed worldwide over a time interval [closed]

I am looking for information regarding the evolution of computing capability. Specifically I would like to know how many floating point operations were performed worldwide from, say, the deployment of ...
0
votes
1answer
62 views

Computing an Expression

I am writing code to evaluate the following expression: $$ \frac{(a+b+c)!}{a! b! c!} $$ where $a$, $b$ and $c$ are on the range of $10$ to $500$. The result is going to be a floating point number. ...
3
votes
2answers
108 views

How much can we trust mathematical software when working with large numbers, and how much memory it needs to work with these numbers?

For example, I want to evaluate the expression: $3^{3^{{3}^{3}}}$ so I used wolframalpha.com (it's free, and I don't own any software), which returned the scientific notation of the number above, ...
2
votes
1answer
152 views

numerically stable log1pexp calculation

What are good approximations for computing log1pexp for single precision and double precision floating point numbers? Note: ...
2
votes
1answer
110 views

Floating point arithmetic

I need to change x1 = 0.3 and x2 = -0.29 to a FP(floating point) number with one sign bit, a 4 bit mantissa, a 3 bit exponent. The results I got are: x1: 0 001 0011 x2: 1 001 0010 I am also trying ...
0
votes
2answers
261 views

Convert $1.75\times10^{15}$ to IEEE-32 format?

$1.75\times10^{15}$ I know how to convert decimal to binary $(1.75)_{10}$ is equal to $(1.11)_2$ But to represent $10^{15}$ is the main problem for me. I can solve the question but this is the ...
3
votes
3answers
66 views

Guarantees on computing $a+x(b-a)$ in floating point

I want to implement the function $f(x,a,b) = a + x(b-a)$ where all the inputs are floating point (doubles, say), such that (a) $f(0,a,b)=a$ exactly; (b) $f(1,a,b)=b$ exactly; (c) $f(x,a,b) \le f(y,a,b)...
0
votes
0answers
84 views

How does normalised floating point binary work with two's complement?

I'm doing AQA a-level computer science, and the specification for which states that: Exam questions on floating point numbers will use a format in which both the normalised mantissa and exponent are ...
1
vote
0answers
19 views

Where can I find some free benchmarks to evaluate a MCU? [closed]

At present, I'm designing a soft processor with single-precision floating point unit (FPU). I am going to put my soft core into an FPGA and do some performance evaluation. The benchmarks are supposed ...