0

windows 10, emacs 26.1

Open *scratch* buffer and do next:

(/ 15 6) press C-x C-e

Result is in minibuffer:

2 (#o2, #x2, ?\C-b)

As you can see the result is INTEGER value. But I need correct value = 2.5

How I can do this?

4

Assuming you're happy with floating point arithmetic then you just need to make one of the numbers a float. e.g.:

(/ 15.0 6)
=> 2.5

Refer to C-hig (elisp)Arithmetic Operations

each of these functions accepts both integer and floating-point arguments, and returns a floating-point number if any argument is floating point.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.