Largest/smallest Integer

Hi There,

A question about MATLAB. Is there any function by which we can find
largest Integer upto a real number. I will better put up with an
example. for example you have a real number 9.867 the larget integer
less than this number is 9. How you get it? similarly smallest integer
greater than this is 10 ! how to get that too? Any MATLAB function for
this?

Your help will be well appreciated. I couldn't figure out how/what to
query dumb computers!! so asking intelligent human beings :)

Any lead will be helpful.

Cheers !!

VPSA

0
vpsanand (16)
3/28/2006 5:06:57 AM
comp.soft-sys.matlab 207151 articles. 0 followers. lunamoonmoon (258) is leader. Post Follow

5 Replies
380 Views

Similar Articles

[PageSpeed] 48
In article <1143522417.678415.71590@g10g2000cwb.googlegroups.com>, "VPSA"
<vpsanand@gmail.com> wrote:

> Hi There,
> 
> A question about MATLAB. Is there any function by which we can find
> largest Integer upto a real number. I will better put up with an
> example. for example you have a real number 9.867 the larget integer
> less than this number is 9. How you get it? similarly smallest integer
> greater than this is 10 ! how to get that too? Any MATLAB function for
> this?
> 
> Your help will be well appreciated. I couldn't figure out how/what to
> query dumb computers!! so asking intelligent human beings :)
> 
> Any lead will be helpful.
> 
> Cheers !!
> 
> VPSA
---------------------
  Yes, they are called 'floor' and 'ceil' respectively:

floor(9.867) = 9
ceil(9.867) = 10

(Remove "xyzzy" and ".invalid" to send me email.)
Roger Stafford
0
3/28/2006 5:47:14 AM
Thanks Mate !! You are a legend.

Cheers ! :)

0
vpsanand (16)
3/28/2006 6:52:22 AM
"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in
message
news:ellieandrogerxyzzy-2703062147150001@dialup-4.232.63.199.dial1.losangeles1.level3.net...
> In article <1143522417.678415.71590@g10g2000cwb.googlegroups.com>, "VPSA"
> <vpsanand@gmail.com> wrote:
>
>> Hi There,
>>
>> A question about MATLAB. Is there any function by which we can find
>> largest Integer upto a real number. I will better put up with an
>> example. for example you have a real number 9.867 the larget integer
>> less than this number is 9. How you get it? similarly smallest integer
>> greater than this is 10 ! how to get that too? Any MATLAB function for
>> this?
>>
>> Your help will be well appreciated. I couldn't figure out how/what to
>> query dumb computers!! so asking intelligent human beings :)
>>
>> Any lead will be helpful.
>>
>> Cheers !!
>>
>> VPSA
> ---------------------
>  Yes, they are called 'floor' and 'ceil' respectively:
>
> floor(9.867) = 9
> ceil(9.867) = 10

I would also look into 'round' and 'fix' by typing in 'help round' and 'help
fix' at the command line...

Cheers!
-- 
Vig



0
vig (18)
3/28/2006 6:57:46 AM
Vig,

Thanks. This is another piece of useful information and is definately
gonna help in future. i have done what you said, type help fix ...
added to knowledge !! :)

as in the case of number say 9.687 round and fix are pretty much the
same as ceil and floor respectively. but what if the number is say,
9.34 !! I think they are useful in some other sense.

0
vpsanand (16)
3/28/2006 7:23:24 AM
In article
<ellieandrogerxyzzy-2703062147150001@dialup-4.232.63.199.dial1.losangeles1.level3.net>,
ellieandrogerxyzzy@mindspring.com.invalid (Roger Stafford) wrote:

> In article <1143522417.678415.71590@g10g2000cwb.googlegroups.com>, "VPSA"
> <vpsanand@gmail.com> wrote:
> 
> > A question about MATLAB. Is there any function by which we can find
> > largest Integer upto a real number. I will better put up with an
> > example. for example you have a real number 9.867 the larget integer
> > less than this number is 9. How you get it? similarly smallest integer
> > greater than this is 10 ! how to get that too? Any MATLAB function for
> > this?
> ---------------------
>   Yes, they are called 'floor' and 'ceil' respectively:
> 
> floor(9.867) = 9
> ceil(9.867) = 10
--------------------
  I just noticed that you said, "largest integer less than" and "smallest
integer greater than".  If you really meant "less than" as opposed to
"less than or equal to", and "greater than" rather than "greater than or
equal to", then you should use the following instead of the 'floor' and
'ceil' functions:

 -1-floor(-x)  % <-- is the largest integer less than x
  1-ceil(-x)   % <-- is the smallest integer greater than x

  Note: Remember that all of these inequalities above are the algebraic
kind of inequalities where, for example, -5 is less than -4.

(Remove "xyzzy" and ".invalid" to send me email.)
Roger Stafford
0
3/28/2006 7:38:21 AM
Reply:
Similar Artilces:

Updated List 2012 Solutions Manuals, Instructor Manuals & Test Banks Collection. Largest Collection Over The Net !!! #2
Hello, We would like to inform you that we have updated our list with the following new titles. You can contact us directly at tbwork.ads(at)gmail.com . =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 2011 Federal Taxation, 5th Edition 2011, Pratt.Kulsrud, Instructor Manual & Solutions Manual 2011 Federal Taxation, 5th Edition 2011, Pratt.Kulsrud, Test Bank 21st Century Astronomy, 3rd Edition, Blumenthal.Hester.Kay.Smith.Voss, Instructor Manual 21st Century Astronomy, 3rd Edition, Blumenthal.Hester.Kay.Smith.Voss, Test Bank A Concise Introduction to Logic, 11th Edition 2012, Hurle...

integer a function in matlab
Please what commande i must to use in matlab for integrate my function: dg/dt = f(t) thank you to orient me On Sep 2, 1:39=A0pm, ginafort <najl...@yahoo.fr> wrote: > Please what commande i must to use in matlab for integrate my function: d= g/dt =3D f(t) > thank you to orient me >> lookfor integral .... QUAD Numerically evaluate integral, adaptive Simpson quadrature. QUAD8 Numerically evaluate integral, higher order method. QUADL Numerically evaluate integral, adaptive Lobatto quadrature. .... Hope this helps. Greg ...

Second largest
Can anybody tell me a method to Use only N + O(log n) comparisons to find the second largest (or smallest) element in a list of N elements. Thnx in advance ravi wrote: > Can anybody tell me a method to > > Use only N + O(log n) comparisons to find the second largest (or > smallest) element in a list of N elements. Does this look like alt.do.my.homework? First point - neither of the questions you have asked are specific to C programming. Second point - your homework assignments are intended to make you think, do research and master the subject. It's not just about gett...

The Largest Collection of Solution Manuals & Test Banks 2014 Over The Net...!!!
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=20 Hello,=20 We would like to inform you that we have more than 20,000 of solutions manu= als, instructor manuals, and test banks available for sale for 2014. We are= able to send the files within few hours.=20 You can conta...

Smallest real positive root
Is there a quick way in matlab to give me the smallest possible real root of something I am casting a ray with. Newtons, seecannt are too slow. "Robert Maxim" <toejama1@gmail.com> wrote in message <hqgd7l$t74$1@fred.mathworks.com>... > Is there a quick way in matlab to give me the smallest possible real root of something I am casting a ray with. Newtons, seecannt are too slow. ---------------- Could you please go into greater detail regarding that phrase "something I am casting a ray with"? Roger Stafford "Robert Maxim" <toejama1@gmai...

single integer reads as array type wire
&nbsp; Im have an array and Im taking just one element from the array. The new element should be size 1x1, or a double since the array is class double Yet, Im getting a broken wire, I beleive since its still reading&nbsp; the single number as&nbsp;an array (thicker orangle wire) as fucntion taking this input needs a single number. Rebreaking the wires and rewiring is not helping. &nbsp; Specifically, im trying to get a single gaussian random variable from "gaussian white noise" by taking one element each iteration of the main loop. &nbsp; here is a screen shot of ...

dicomwrite
Hi, I have an image matrix cointaining doubles with value range between 0 - 87. I want to store it as a dicom and maintain the original values. I have tried rescaling to 16 bit range and setting the MaxPixelIntensity Property to 87 but it does not work. Does anyone know if it is possible to save these non-integers as dicom using matlab? Best regards Soren ...

Play Poker! $100 Free At EmpirePoker.com
<HTML> <HEAD> <META NAME="GENERATOR" Content="Microsoft DHTML Editing Control"> <TITLE></TITLE> </HEAD> <BODY> <P><STRONG>EmpirePoker.Com is the biggest Poker Room in the WORLD! Here is an exclusive offer for up to $100 free. Signup at <A href="http://www.empirepoker.com/indexnp.htm?wm=1707919">EMPIREPOKER.COM</A> using the signup code "BOOKSTORE" and receive $25 free on your first deposit. Signup using the code "CHIPS4184" and receive up to $100 on your first depos...

String to long integer strtol
I tried to convert a string to long integer using the following code but it is not working. I tried with strtolI and strtod. I think the input exceeds long integer range. What function shall i use in c to accomplish this ? Please help me. void main() { char a[20]="4051592851"; long int i; double d; i = strtoll(a,NULL,10); printf("%ld\n",i); d = strtod(a,NULL,10); printf("%lf\n",d); } O/p -243374445 -765460480.000000 "knight" <vimal3271@gmail.com> wrote in message news:0de5da9f-9b92-47ca-b6c0-5bdce1a03316@n32g2000pre.googlegroups.com=20 > ...

0x80000000 Integer not supported??
Hi everybody, I'm designing a VHDL testbench for a VHDL module. I have to generate values to be written into a 32 bit register of my module. I decided tu use integer variables to compose my data and than convert them to std_logic_vector to perform the write operation on the module. The issue is that I discovered that VHDL integer range is from -2147483647 to 2147483647, that is to say 0x80000000 integer is not supported. Is there any way to work out this limitation without using directly std_logic_vector type? Thank you in advance for any help Claudia ...

Subscript indices must either be real positive integers or logicals Error + Code
was wondering if someone can explain to me what this error means. And, if possible, how to resolve it? ??? Subscript indices must either be real positive integers or logicals. Error in ==> interp2>linear at 344 F = ( arg3(ndx).*(onemt) + arg3(ndx+1).*t ).*(1-s) + ... Error in ==> interp2 at 220 zi = linear(ExtrapVal,x,y,z,xi,yi); Error in ==> snake at 71 ssx = gamma*xs - kappa*interp2(fx,xs,ys); This is my complete code: image = imread('image.jpg'); %parameters alpha = 0.001; beta = 0.4; kappa=0.0001; gamma = 100; N = 100; wl = 10; we = 10; wt...

Updated List 2012 Solutions Manuals, Instructor Manuals & Test Banks Collection. Largest Collection Over The Net !!! #5
Hello, We would like to inform you that we have updated our list with the following new titles. You can contact us directly at tbwork.ads(at)gmail.com . =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 2011 Federal Taxation, 5th Edition 2011, Pratt, Kulsrud, Instructor Manual & Solutions Manual 2011 Federal Taxation, 5th Edition 2011, Pratt, Kulsrud, Test Bank A Concise Introduction to Logic, 11th Edition 2012, Hurley, Test Bank A History of Modern Psychology, 10th Edition 2012, Schultz, Schultz, Instructor Manual A History of Modern Psychology, 10th Edition 2012, Schultz, Schultz,...

FindInstance over Integers
Hello -- I'm working on a project which requires the program to determine whether a given set of equalities and inequalities is satisfiable over the integers. Of course, this problem is not decidable in general. But I just need a "good enough" function that will at least report that a set of constraints is satisfiable only if it actually is, and work across some fairly easy cases. FindInstance is the obvious function to use, but it seems to fail for constraints that are very easy to satisfy. The simplest example I can come up with is this: FindInstance[x == 2^y &a...

Re: Smallest SAS program? #3
Hi friends, I think a 0-byte program file isn't actually a program, neither is a single space. And a single character macro call needs a macro definition somewhere. Even null statements like ';' are not really programs, because they do not tell SAS to do _something_ at all. So even my current suggestion, a single asterisk (without a semicolon and run in batch), which only starts a comment actually should not be regarded a _program_. Examples of programs doing at least something already have been given (like 'x;'). But I have liked the ideas on how to let SAS do (almost) n...

largest no
how can i pick up largest no from 5 rows by 5 column matrix???? <bele_harshad2006@yahoo.co.in> schrieb im Newsbeitrag news:1181123442.757983.117760@x35g2000prf.googlegroups.com... > how can i pick up largest no from 5 rows by 5 column matrix???? By copmaring the first with the send, then the larted of that comparisn with the 3rd, the larger of that with the 4th and so on until the 25th Bye, Jojo On 6 Jun, 10:50, bele_harshad2...@yahoo.co.in wrote: > how can i pick up largest no from 5 rows by 5 column matrix???? Step 1. Sort the columns of each row into ascending order. S...

What is the largest value that an autoincremented PK can get ?
Hello, I would like to know what is the size of an integer value. What is the chances of a MyIsam table with an autoincremented field reaching the end ? What is the largest value that an autoincremented PK can get. Thanks a lot in advance. Aggelos wrote: > Hello, > I would like to know what is the size of an integer value. And of course you have looked at the manual? http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html > What is the chances of a MyIsam table with an autoincremented field > reaching the end ? To calculate this one would have to bring in factors such as the ...

Largest
Hello All, Does anyone know how to improve the Largest Contiguous Free Memory block ?? I used 'Clear all'. But even after doing this there is hardly a 10MB improvement. I tried reading earlier posts suggesting restarting Matlab may be the only option, just wanted to know if anyone else knows if there is any other efficient way to achieve this. Thanks in advance for any help. Thank you, Mathew Have you tried the PACK command? "Matt Fig" <spamanon@yahoo.com> wrote in message <idc7mc$8st$1@fred.mathworks.com>... > Have you tried the PACK command? ...

Matlab-integer
Hi, How can I use matlab to ask if a value is a positive integer? Also if possible how can I make it increase to the next highest positive integer?? i.e, if a ~= positive integer a = a + ? where a = value and 'a = a + ?'-increase a to next highest integer. Any ideas? Thanks in advance Dan Try help ceil help floor help round help fix Leandro email: char(eval('[0 -30 -5 -30 -10 21 38 21 30 21 39 -12 29 25 25 25 -30 35 38 27]')+upper('l')) Daniel Jones wrote: > > > Hi, > > How can I use matlab to ask if a value is a positive integer? Also &g...

A portable code to create a 4-bytes Big Endian twos complement signed integer in a misaligned address
I need a variable that can represents numbers between -100000 and +100000. int variables could be only 16-bit on some implementations, so I use int32_t type: int32_t x; Is it correct? Now I need to create a data packet (to send over a network) with the following syntax: - Byte 1: SOP (Start of Packet) - Byte 2-3-4-5: value in Big Endian twos complement - Byte 6: EOP (End of Packet) How can I do that in the most portable way, assuming only the same method to store negative numbers in memory (twos complement)? One solution could be: unsigned char data[6] = { SOP, 0, 0, 0, 0...

The largest Chinese SAS Forum on internet
Hi All, Welcome and enjoy our Chinese SAS Forum. Here is the new sub-forum for international SAS User Group. It is English only. Come on to join us! English sub-forum: http://www.mysas.net/forum/viewforum.php?f=5 ...

Is 2.0 Integer or Float?
I'd like to be able to do: x = 2.0 assert x.integral? the :integer method returns false in this case. What would be a good way to write a different method to check? On Nov 14, 2006, at 10:35 AM, S. Robert James wrote: > I'd like to be able to do: > > x = 2.0 > assert x.integral? > > the :integer method returns false in this case. > What would be a good way to write a different method to check? >> 2.0.is_a? Float => true >> 2.0.is_a? Integer => false James Edward Gray II Hope the following helps: irb(main):001:0> 2.0.class => Floa...

Largest HP Technical Training Conference!
Join us in Chicago this August for the largest HP Technical Training Conference of the Year! HP World 2004 Solutions and Technology Conference & Expo August 16 � 20 McCormick Place, Chicago The event delivers comprehensive technical content, real-world solutions and usable skills and has become largest HP users conference in the Americas. Hundreds of technical breakout sessions; hands-on workshops: training seminars and tutorials; Senior Technologist sessions and roundtable discussions will provide in-depth coverage of the multitude of technologies and solutions available today. ...

can Ada give run-time error or warning for integer division with non-zero remainder?
In Ada when dividing 2 integers, the result is an integer with the remainder ignored. Hence 3/2 gives 1 ---------------------------------- with Ada.Integer_Text_IO ; use Ada.Integer_Text_IO ; procedure foo4 is N : constant integer := 3; M : integer; begin M := N/2; put(M); end foo4; -------------------------- >gnatmake foo4.adb >./foo4 1 Now, suppose I want to know that a division between 2 integers has resulted in nonzero remainder that was thrown away. May be because my algorithm is meant to work only for even val...

128-bit integers
Are there any current compilers that provide 128 (or higher) built in integer types? If so, can anyone shed light on the implementations of the arithmetic operations? If not, are there any recommended libraries? Cheers Matthew Wilson STLSoft moderator and C++ monomaniac (http://www.stlsoft.org) Contributing editor, C/C++ Users Journal (www.synesis.com.au/articles.html#columns) "But if less is more, think how much more more will be!" -- Dr Frazier Crane ------------------------------------------------------------------------------- [ See http://www.gotw.ca/resource...

Updated List 2012 Solutions Manuals, Instructor Manuals & Test Banks Collection. Largest Collection Over The Net !!! #5
Hello, We would like to inform you that we have updated our list with the following new titles. You can contact us directly at tbwork.ads(at)gmail.com . =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 2011 Federal Taxation, 5th Edition 2011, Pratt.Kulsrud, Instructor Manual & Solutions Manual 2011 Federal Taxation, 5th Edition 2011, Pratt.Kulsrud, Test Bank 21st Century Astronomy, 3rd Edition, Blumenthal.Hester.Kay.Smith.Voss, Instructor Manual 21st Century Astronomy, 3rd Edition, Blumenthal.Hester.Kay.Smith.Voss, Test Bank A Concise Introduction to Logic, 11th Edition 2012, Hurley,...