Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename eps -> ulp #28301

Closed
wants to merge 2 commits into from
Closed

Rename eps -> ulp #28301

wants to merge 2 commits into from

Conversation

Keno
Copy link
Member

@Keno Keno commented Jul 27, 2018

As discussed on triage, this renames eps to ulp, because the former is a bit of a pun and even the docstring says this computes the unit in last place of the given value. Particularly, because we extend this function to things like Dates, eps is a bit of an awkward name.

@Keno Keno added this to the 0.7 milestone Jul 27, 2018
@ararslan ararslan mentioned this pull request Jul 27, 2018
13 tasks
@ararslan ararslan added maths Mathematical functions deprecation This change introduces or involves a deprecation labels Jul 27, 2018
eps(::Type{T}) where T<:AbstractFloat
eps()
ulp(::Type{T}) where T<:AbstractFloat
ulp()

Return the *machine epsilon* of the floating point type `T` (`T = Float64` by
Copy link
Contributor

@waldyrious waldyrious Jul 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't "machine epsilon" be changed (or adjusted to also mention ULP) here as well?

@stevengj
Copy link
Member

stevengj commented Jul 27, 2018

eps is nearly universal here: Matlab, Numpy, R, C, C++, Fortran, Ruby, Rust, JavaScript, and many other languages all use it or some other spelling of epsilon. (Rare popular exceptions are Mathematica, which uses MachinePrecision, Swift, which uses ulpOfOne, and C#, which uses both MachineEpsilon and DoublePrecision—leave it to Microsoft to try to please everyone and end up pleasing no one.) It seems crazy to me to abandon it in the 11th hour on the vague grounds that it is "a bit of a pun".

I also don't see any problem in using it for dates or other types — it seems just as easy to define eps as it is to define ulp for those types, since the term "ulp" is also rarely if ever used for anything but floating-point arithmetic.

@stevengj
Copy link
Member

stevengj commented Jul 27, 2018

I don't like the term "sine" — it's a bad Latin pun arising from an Arabic translation error, and "sin" is literally sinful. I propose that we rename the function to hac (for "half a chord"), which is more logical and agrees with the original Sanskrit. Let's just sneak in the rename right before the 0.7 release; I'm sure no one will mind.

Or we could accept that usage has normalized the term and continue to call this function what everyone else calls it.

@KristofferC
Copy link
Member

Or jiba?

@stevengj
Copy link
Member

Another problem with ulp is that eps(T) is a relative precision that must be dimensionless, whereas “unit in the last place” sounds dimensionful. Of course, we can define the ulp function to do whatever we want; it’s just a matter of documentation. But the same can be said for eps.

@ViralBShah
Copy link
Member

I knew eps/epsilon was generally used, but didn't realize it was this universal.

@JeffBezanson
Copy link
Member

Same here; if it's that widely used let's just close this.

@Keno Keno closed this Jul 27, 2018
@mbauman
Copy link
Member

mbauman commented Jul 27, 2018

Another problem with ulp is that eps(T) is a relative precision that must be dimensionless, whereas “unit in the last place” sounds dimensionful. Of course, we can define the ulp function to do whatever we want; it’s just a matter of documentation. But the same can be said for eps.

My reason for liking the name ulp is purely in its use for ulp(value) — I don't find the ulp() or ulp(T) forms compelling at all. The distinction between a dimensionless relative precision (for multiplication) and a dimensional measurement of precision (for addition) is extremely pertinent, not unlike one and oneunit. I've definitely seen confusion between "machine epsilon", eps(), and eps(value) (and vaguely remember having such confusion myself) — perhaps splitting this could help? Are there actually two names here, too?

Regardless, @stevengj is correct that — given that this isn't a unanimous slam dunk — it's far too late to try to squeeze it in now.

@DilumAluthge DilumAluthge deleted the kf/eps branch March 25, 2021 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecation This change introduces or involves a deprecation maths Mathematical functions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants