Questions tagged [real-number]

40 questions
0
votes
1 answer

Plot real part of complex-valued function in Python

I am trying to plot the following function... f(k) = Re[k - 0.5*(sqrt(1 - 4*k) + 1)] for k = [-2, 2], but the best I can do is... import matplotlib.pyplot as plt import numpy as np k = np.linspace(-2, 2, 100) f = np.real(k - 0.5*(np.sqrt(1 - 4*k) +…
Landon
  • 528
  • 2
  • 4
  • 22
0
votes
1 answer

Large float and double numbers in java printing/persisting incorrectly. Is this behavior due to number of significant digits?

In an application I am working some numbers get converted and saved from long(18 digits) to float/double. These numbers are like Reference/Id's but not used for calculations. Recently I noticed some discrepancies in data being stored as…
Raj
  • 1,945
  • 20
  • 40
0
votes
2 answers

AssertionError - imaginary and real numbers adder

I'm getting error: java.lang.AssertionError: expected: learning.java.advancedoop2.MyComplex<(2.0+10.0i)> but was: learning.java.advancedoop2.MyComplex<(2.0+10.0i)> Expected :learning.java.advancedoop2.MyComplex<(2.0+10.0i)> Actual …
Ziemek
  • 1
  • 2
0
votes
1 answer

Read from Byte Array and convert to Double

I'm just trying to get an 8 BYTE REAL floating-point number from a BYTE array, which I've previously generated from the contents of a file, as a floating-point number. At the moment I know that an 8 BYTE Real is the same as a double. Therefore, it…
Sumsum
  • 3
  • 2
0
votes
1 answer

How to input and output real numbers in assembly language

We solve problems with real numbers in assembly language using FPU. Usually we write input and output code using C language or ready functions.For example: ; Receiving input and output descriptors for the console invoke GetStdHandle, …
Jane
  • 11
  • 2
0
votes
1 answer

Choco-solver: coefficients of the variables are real numbers

I am looking for a way to encode mathematical equations on Choco Solver. I see there's a way to encode constraints like: 3x + 4y < 9 But I am trying to encode something like 3.5*x + 4.3*y < 9.3 where x and y are int vars and coefficients are real…
Quang
  • 3
  • 1
0
votes
0 answers

What's the difference between `Reals` and `Coq.Reals.*` in Coq?

In proving general facts like inequalities and polynomial equations, what's the difference between importing Reals and things like Coq.Reals.{Rineq, R_sqrt, ...}? I started from searching specific facts/theorems and ended up in using the latter, but…
thor
  • 21,418
  • 31
  • 87
  • 173
-2
votes
3 answers

Two digits after the decimal point in a real number in Pascal

So for an example i have a real number let's say 17.4578 but i want to display it in pascal with only two digits after the point so it's 17.45. What do i write in my program?
Aloulou123
  • 3
  • 1
  • 6
-2
votes
1 answer

Bash script ignores the negative prefix on negative numbers

a=4; b=7; c=5; x =[ a-b ] if (x -gt c) then { echo "x is greater" } else { echo " something" } I want to compare x and c ignoring the negative prefix of c.
-3
votes
1 answer

gaussian noise in systemVerilog

I'm writing a Gaussian noise generator in verilog, the code work fine when the output is a vector of logic (16 bit) but i need this code to communicate with another block which is using Real inputs i had tryed the $bitstoreal function but it is not…
saketa
  • 1
  • 2
1 2
3