real-datatype

Z3 real arithmetic and statistics

耗尽温柔 提交于 2020-01-20 08:43:24
问题 Given a problem that is encoded using Z3's reals, which of the statistics that Z3 /smt2 /st produces might be helpful in order to judge if the reals engine "has problems/does lots of work"? In my case, I have two mostly equivalent encodings of the problem, both using reals. The "small" difference in the encoding, however, makes a big difference in runtime, namely, that encoding A takes 2:30min and encoding B 13min. The Z3 statistics show that conflicts and quant-instantiations are mostly

Calculations with Real Numbers, Verilog HDL

懵懂的女人 提交于 2020-01-04 06:33:52
问题 I noticed that Verilog rounds my real number results into integer results. For example when I look at simulator, it shows the result of 17/2 as 9. What should I do? Is there anyway to define something like a: output real reg [11:0] output_value ? Or is it something that has to be done by simulator settings? Simulation only (no synthesis). Example: x defined as a signed input and output_value defined as output reg. output_value = ((x >>> 1) + x) + 5; If x=+1 then output value has to be: 13/2=6

gfortran REAL not accurate to 8 decimal places [duplicate]

╄→尐↘猪︶ㄣ 提交于 2019-12-25 20:00:31
问题 This question already exists : gfortran represents REAL incorrectly [duplicate] Closed 5 years ago . This question has not been previously answered. I am trying to represent a real or any number for that matter in Fortran correctly. What gfortran is doing for me is way off. For example when I declare the variable REAL pi=3.14159 fortran prints pi = 3.14159012 rather than say 3.14159000. See below: PROGRAM Test IMPLICIT NONE REAL:: pi = 3.14159 PRINT *, "PI = ",pi END PROGRAM Test This prints:

Gfortran complex actual to real dummy argument

左心房为你撑大大i 提交于 2019-12-20 04:27:10
问题 I am trying to use fftpack with gfortran, but I am getting errors that i think relate to that some routines are passed complex arrays when the dummy argument is declared as real. I read a comment on an intel fortran page that one could disable " check routine interface ". Does anyone know if there is a similar option for gfortran? I would like to not have to edit the fftpack... ( i guess this is because complex in memory is represented by two reals and the array arguments are passed as

Haskell multiply Int and real number

丶灬走出姿态 提交于 2019-12-19 03:44:28
问题 I have coefficient :: ??????? coefficient = 1.0 and val :: Int and I would like to do result :: ??????? result val coefficient = val * coefficient What type signatures and conversion functions do I need to do to make this work? What must I do on top of that if I want to have ability to generalize val to any kind of Num? This: coefficient = 1.0 val :: Int val = 3 result :: Num a => a result = coefficient * (fromIntegral val) gives me this compiler warning: Could not deduce (a ~ Double) from

Fortran type mismatch error

断了今生、忘了曾经 提交于 2019-12-13 20:15:05
问题 In this fortran program I've been given and told to debug, I'm getting the error: "type mismatch in argument 'p1' at (1); passed REAL(4) to TYPE(point)" and I can't seem to figure out where the error is occuring. I've tried defining different variables to pass to each function instead of p1 and p2 with the same error. Any ideas? MODULE PointType TYPE POINT REAL:: x REAL:: y END TYPE CONTAINS FUNCTION arePointsEqual(p1, p2) REAL:: arePointsEqual TYPE(POINT), INTENT(IN):: p1 TYPE(POINT), INTENT

gfortran - Is unspecified decimal length allowed for real output?

我只是一个虾纸丫 提交于 2019-12-12 22:08:22
问题 Is there a way to format a real number for output such that both the width and decimal parts are left unspecified? This is possible with ifort by just doing the following: write (*, '(F)') num ...but I understand that that usage is a compiler-specific extension. Gfortran does accept the standard-compliant 0-width specifier, but I can't find anything in the standard nor in gfortran's documentation about how to leave the decimal part unspecified. The obvious guess is to just use 0 for that as

Real data type fortran 90

可紊 提交于 2019-12-11 14:25:28
问题 A simple question. A similar question was there, but I did not get the exact one I am looking for. I was just checking the limits of real data type in fortran 90 (using ifort compiler), reason being my actual code might reach that limit. To test, I simply gave a parameter mval1 (see code) and multiplied by 2. In ifort manual it says that the maximum value it can take is 10E38 and my value is much smaller than this. But while printing it is taking random digits towards the end (output is given

Counting the number of decimal places in pascal

心已入冬 提交于 2019-12-04 02:29:55
问题 I just started studying pascal and I have to do a pascal program as homework. I made it but I don't know how to count the number of decimal places in a real number (the number of digit after the "."). I need it just to format well a real number (like write(real:0:dec) where dec is the number of decimal digit i don't know how to know). I'd like to do that because i don't want it in scientific notation or with many unnecessary zeros. For example if a real number is 1.51 (x) and I write writeln

Haskell multiply Int and real number

試著忘記壹切 提交于 2019-11-30 22:43:12
I have coefficient :: ??????? coefficient = 1.0 and val :: Int and I would like to do result :: ??????? result val coefficient = val * coefficient What type signatures and conversion functions do I need to do to make this work? What must I do on top of that if I want to have ability to generalize val to any kind of Num? This: coefficient = 1.0 val :: Int val = 3 result :: Num a => a result = coefficient * (fromIntegral val) gives me this compiler warning: Could not deduce (a ~ Double) from the context (Num a) bound by the type signature for result :: Num a => a at Move.hs:17:1-41 `a' is a