Questions tagged [mantissa]

The mantissa of a floating-point number is the value m in the representation m × 2ᵉ, where e is the exponent. Use this tag for questions specifically about the mantissa of a floating-point number. For questions about floating-point numbers, use the [floating-point] tag instead. Do not use this tag for questions relating to the Divmod Mantissa application server.

The mantissa or significand of a floating-point number is the value m in the representation m × 2e, where e is the exponent.

60 questions
2
votes
3 answers

How to operate (fast) on mantissa and exponent part of double or float at c++?

I use c++ for computation of various type of special functions (e.g Lambert function, iteration methods for evaluate inversions etc.). In many cases there is an obviously better approach to work with a mantissa and exponent directly. I found many…
2
votes
5 answers

Using C: How can I determine the sizes of the components of a floating point?

I am looking for suggestions on how to find the sizes (in bits) and range of floating point numbers in an architecture independent manner. The code could be built on various platforms (AIX, Linux, HPUX, VMS, maybe Windoze) using different flags -…
zippy
2
votes
2 answers

Simulation of Floating Point Representation

I'm taking an introductory Python course and we have an assignment that asks us to simulate the way the floating point numbers are stored. Basically, we have to demonstrate 5 digits of Mantissa. For example, you input 123 and it must come out as…
user2961792
  • 49
  • 1
  • 4
2
votes
1 answer

Calculating value from 5-bit float representation

I have worked on this quite a bit, and think I'm missing something about the "frac" part. In this 5-bit float, the sign bit is the most significant, the next two bits are the exponent and the exponent bias is 1. The last two bits are the…
singmotor
  • 3,930
  • 12
  • 45
  • 79
2
votes
3 answers

How do ldexp and frexp work in python?

The python frexp and ldexp functions splits floats into mantissa and exponent. Do anybody know if this process exposes the actual float structure, or if it requires python to do expensive logarithmic calls?
Thomas Ahle
  • 30,774
  • 21
  • 92
  • 114
2
votes
4 answers

What is the most efficient way to convert an integer to the fractional part of a number in javascript?

I want to convert an integer to the fractional part of a number using javascript. For example: 10030 -> 0.10030 123 -> 0.123 I've come up with two ways of doing this: var convertIntegerPartToFractionalPart1 = function(integerPart) { var…
alexbirkett
  • 2,604
  • 2
  • 26
  • 30
1
vote
1 answer

Get the Mantissa of a Java BigDecimal

I want to do some simple math with some very small and very large numbers. I figured I'd start with BigDecimal: scala> java.math.BigDecimal.valueOf(54, 45) res0: java.math.BigDecimal = 5.4E-44 How do I then get the the mantissa? Either 54 or 5.4…
pr1001
  • 21,727
  • 17
  • 79
  • 125
1
vote
3 answers

Getting the mantissa (of a float) of either an unsigned int or a float (C)

So, i am trying to program a function which prints a given float number (n) in its (mantissa * 2^exponent) format. I was abled to get the sign and the exponent, but not the mantissa (whichever the number is, mantissa is always equal to 0.000000).…
Khosrow
  • 43
  • 1
  • 5
1
vote
1 answer

C#: Exponential Format Specifier

I have a double number: element.MaxAllowableConcLimitPpm = 0.077724795640326971; I need to display it as 7.7725e-2 when I try to use it: element.MaxAllowableConcLimitPpm.ToString("e4", CultureInfo.InvariantCulture) it returns 7.7725e-002 How…
Oleg Sh
  • 8,496
  • 17
  • 89
  • 159
1
vote
0 answers

Multiplication order changes result. Why?

We are currently experimenting with floating point numbers and came over a program in Fortran where we weren't able to figure out what happens. program test a=0.1 print*, a * .1 * 10. print*, .1 * a * 10. print*, .1 * 10. * a end program…
1
vote
1 answer

Having trouble converting a floating point to its binary representation

Below is a tutorial I'm trying to follow. When attempting to convert the number back to its binary representation I get it wrong. Could someone tell me what I'm doing incorrectly? -0.21875 binary representation: .00111 = 1.11 * 2^-3 since.. 0.5^3…
Ben Marconi
  • 161
  • 1
  • 1
  • 7
1
vote
2 answers

Creating a NaN float value from the sign, exponent and mantissa parts in C++

I need to create a floating point variable in C++ that has a NaN value. I also need to be able to see which NaN has a larger value. To compare the NaNs you will need to look at the mantissa part of the float. Creating a NaN using the standard…
1
vote
1 answer

large integer to single point float

Im trying to convert a large integer to a 32 bit single precision float but I can't get past this problem I'm having. What if the binary representation of the big integer is larger than the 23 bit mantissa. For example, take the integer…
1
vote
1 answer

How to extract the sign, mantissa and exponent from a 32-Bit float

so I got a task where I have to extract the sign, exponent and mantissa from a floating point number given as uint32_t. I have to do that in C and as you might expect, how do I do that ? For the sign I would search for the MSB (Most Significant Bit,…
Kaseop
  • 29
  • 1
  • 5
1
vote
3 answers

Java/Android - set DecimalFormat to show only mantissa

I want to display only the mantissa of a number independently of what the exponent is. 12.4e-6 after formatting => 12.4 12.4e-12 after formatting => 12.4 To do the calculation manually is trivial. But the problem is that I need to use the class…
Cocomico
  • 878
  • 7
  • 18