Consider this code

x = 0.109354682484;
IntegerPart[x/(x/2)]
(* 1 *)

Precision[x]
(* MachinePrecision *)


Why does it give 1 ?

Version number: 9.0 on Mac 10.9.2

screenshot



Update:

If we use an undefined variable, IntegerPart[x0/(x0/2)] gives 2. Since Mathematica never gives warnings about this x0, I'm assuming for any x0 it is true.

If we calculate the same integer part using fortran, we get 2 instead of 1.

program main
implicit none

real(8):: x=0.109354682484
real(8):: y=1.4

write(*,*) int(x/(x/2))
write(*,*) nint(x/(x/2))
write(*,*) int(y)

end program main


compiled with ifort -O0 main.f90

output of above fortran code is

       2
       2
       1


according to here, int is a fortran intrinsic function that calculate the integer part.

Is this a bug?


Question: keybinding in xterm to shift one line up using shift+up
Answer: Use the X resources documented in the XTerm man page, particularly the "ACTIONS" section about 80% of the way down.

Create a file ~/.Xresources and put in it:

XTerm.VT100.translations: #override \
    Shift &lt;Key&gt;Up: scroll-back(1) \n\
    Shift &lt;Key&gt;Down: scroll-forw(1) 


"Translations" is the base Xt library's name for key and mouse bindings. This sets bindings for the VT100 (terminal emulation) component of XTerm, overriding any existing bindings and setting Shift-Up to scroll up (or "back") one line, and Shift-Down to scroll down ("forw"ard) one line. We're making one long line so we're using backslashes at the end to mark continuation.

As with any use of .Xresources, you will need either to have the XENVIRONMENT variable set pointing to the right place, or use xrdb -merge ~/.Xresources to load the file into the resource manager explicitly.