Skip to main content
added 2 characters in body
Source Link
coredump
  • 6k
  • 1
  • 22
  • 29
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

This questionThis question has some nice answers about the behaviour before Python 3. Since the mathematical operators where wrappers around the C mathematical operators, it made sense to follow the convention of that language. Note that in C, the ceil function takes and returns a double. This makes sense because not all floats can be represented by integers (for values with a big exponent, there is no direct representation with integers).

This question has some nice answers about the behaviour before Python 3. Since the mathematical operators where wrappers around the C mathematical operators, it made sense to follow the convention of that language. Note that in C, the ceil function takes and returns a double. This makes sense because not all floats can be represented by integers (for values with a big exponent, there is no direct representation with integers).

This question has some nice answers about the behaviour before Python 3. Since the mathematical operators where wrappers around the C mathematical operators, it made sense to follow the convention of that language. Note that in C, the ceil function takes and returns a double. This makes sense because not all floats can be represented by integers (for values with a big exponent, there is no direct representation with integers).

replaced http://programmers.stackexchange.com/ with https://softwareengineering.stackexchange.com/
Source Link

By the way, I disagree with some parts of Robert Harvey's answerRobert Harvey's answer.

  • There are legitimate useslegitimate uses to return a value of a different type depending on an input parameter, especially with mathematical operations.

  • I don't think the return type should be based on a presupposed common usage of the value and I don't see how convenient it would be. And if it was relevant, I'd probably expect to be given an integer: I generally do not combine the result of floor with a floating point.

By the way, I disagree with some parts of Robert Harvey's answer.

  • There are legitimate uses to return a value of a different type depending on an input parameter, especially with mathematical operations.

  • I don't think the return type should be based on a presupposed common usage of the value and I don't see how convenient it would be. And if it was relevant, I'd probably expect to be given an integer: I generally do not combine the result of floor with a floating point.

By the way, I disagree with some parts of Robert Harvey's answer.

  • There are legitimate uses to return a value of a different type depending on an input parameter, especially with mathematical operations.

  • I don't think the return type should be based on a presupposed common usage of the value and I don't see how convenient it would be. And if it was relevant, I'd probably expect to be given an integer: I generally do not combine the result of floor with a floating point.

deleted 4 characters in body
Source Link
coredump
  • 6k
  • 1
  • 22
  • 29
Loading
added 13 characters in body
Source Link
coredump
  • 6k
  • 1
  • 22
  • 29
Loading
added 18 characters in body
Source Link
coredump
  • 6k
  • 1
  • 22
  • 29
Loading
deleted 1 character in body
Source Link
coredump
  • 6k
  • 1
  • 22
  • 29
Loading
added 11 characters in body
Source Link
coredump
  • 6k
  • 1
  • 22
  • 29
Loading
deleted 5 characters in body
Source Link
coredump
  • 6k
  • 1
  • 22
  • 29
Loading
added 1999 characters in body
Source Link
coredump
  • 6k
  • 1
  • 22
  • 29
Loading
added 95 characters in body
Source Link
coredump
  • 6k
  • 1
  • 22
  • 29
Loading
deleted 21 characters in body
Source Link
coredump
  • 6k
  • 1
  • 22
  • 29
Loading
deleted 21 characters in body
Source Link
coredump
  • 6k
  • 1
  • 22
  • 29
Loading
added 15 characters in body
Source Link
coredump
  • 6k
  • 1
  • 22
  • 29
Loading
Source Link
coredump
  • 6k
  • 1
  • 22
  • 29
Loading