sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.47k stars 487 forks source link

Change string representation of RealField #24523

Open videlec opened 6 years ago

videlec commented 6 years ago

We change the string representation of RealField(XXX) from

Real Field with XX bits of precision

to

Real Floating-Point Field with XX bits of precision

The reason for this change is that "Real Field" is not precise enough. Beyond floating-point, "Real Field" could equivalently be used for fixed-point, intervals and balls. The standard terms in the literature are "floating-point arithmetic", "fixed-point arithmetic", "ball arithmetic" and "interval arithmetic", see eg

This ticket is part of a the refactorization #24457 that intends to clean computations involving the different kinds of real numbers.

The git branch was obtained by running the following command in $SAGE_ROOT/src

for file in $(grep -l "Real Field with" $(find . -name "*pyx" -o -name "*py" -o -name "*pxd" -o -name "*rst" -type f))
  do sed -i "s/Real Field with/Real Floating-Point Field with/g" $file
done

Tests work fine except for doctests that involves an output with a linebreak such as

sage: x = polygen(RR); r = (1 + x)/(1 - x^2); r.parent()
Fraction Field of Univariate Polynomial Ring in x over Real
Field with 53 bits of precision

(from src/sage/tests/french_book/polynomes.py line 218). These can also be handled using multiline sed replacement

for file in $(find . -name "*pyx" -o -name "*py" -o -name "*pxd" -o -name "*rst" -type f)
do
  sed -Ei '{N; s/Real(\s+)Field(\s+)with/Real\1Floating-Point Field\2with/; ty; P; D; :y}' $file
done

As part of this ticket, the printf percentage syntax has been changed to the newer Python 3 standard format syntax (see comment:22) in all real field representations.


Related discussion on sage-devel.

Component: basic arithmetic

Author: Vincent Delecroix, Ralf Stephan, Michael Jung

Branch/Commit: u/gh-mjungmath/24523 @ 7f7d902

Reviewer: Vincent Klein, Vincent Delecroix

Issue created by migration from https://trac.sagemath.org/ticket/24523

mjungmath commented 4 years ago
comment:42

I'll change it soon with a forced push.

videlec commented 4 years ago
comment:43

Good. If you update the ticket description as well it will even be better.

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 4 years ago

Changed commit from 1bc1b61 to e4a1d75

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 4 years ago

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

ca51262Trac 24523: "Real Field" -> "Real Floating-Point Field" + new formatting style
e4a1d75Trac #24523: doctests adapted
mjungmath commented 4 years ago

Description changed:

--- 
+++ 
@@ -6,7 +6,7 @@
 to

-Real Floating-point Field with XX bits of precision +Real Floating-Point Field with XX bits of precision


 The reason for this change is that "Real Field" is not precise enough. Beyond floating-point, "Real Field" could equivalently be used for fixed-point, intervals and balls. The standard terms in the literature are "floating-point arithmetic", "fixed-point arithmetic", "ball arithmetic" and "interval arithmetic", see eg
@@ -21,7 +21,7 @@

for file in $(grep -l "Real Field with" $(find . -name "pyx" -o -name "py" -o -name "pxd" -o -name "rst" -type f))

-As part of this ticket, the printf percentage syntax has been changed to the Python 3 standard format syntax (see comment:22) in all real field representations. +As part of this ticket, the printf percentage syntax has been changed to the newer Python 3 standard format syntax (see comment:22) in all real field representations.


mjungmath commented 4 years ago
comment:46

There we go.

videlec commented 4 years ago

Changed reviewer from Vincent Klein to Vincent Klein, Vincent Delecroix

videlec commented 4 years ago
comment:47

Thanks. If neither patchbot nor developers complain I will set a positive review.

dimpase commented 4 years ago
comment:48

Do we have a followup for Complex Field? Because it has the same problem.

dimpase commented 4 years ago
comment:49

rebase please

seblabbe commented 3 years ago

It was asked on the sage-devel discussion whether people have an opinion.

Replying to [ticket:24523 ticket description]:

We change the string representation of RealField(XXX) from

Real Field with XX bits of precision

to

Real Floating-Point Field with XX bits of precision

+1 from me

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 3 years ago

Changed commit from e4a1d75 to 93cb1a2

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 3 years ago

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

1fa235cTrac 24523: py3 format style + "Real Field" -> "Real Floating-Point Field"
93cb1a2Trac #24523: change string repr "Real Field" -> "Real Floating-Point Field"
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 3 years ago

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

e654661Trac 24523: "Real Field" -> "Real Floating-Point Field" + new formatting style
050aa3dTrac #24523: change string repr "Real Field" -> "Real Floating-Point Field"
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 3 years ago

Changed commit from 93cb1a2 to 050aa3d

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 3 years ago

Changed commit from 050aa3d to 7f7d902

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 3 years ago

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

8c89c3fTrac #24523: "Real Field" -> "Real Floating-Point Field" + new formatting style
7f7d902Trac #24523: change string repr "Real Field" -> "Real Floating-Point Field"
mjungmath commented 3 years ago
comment:54

Replying to @dimpase:

Do we have a followup for Complex Field? Because it has the same problem.

Yes. See #24489.

Replying to @dimpase:

rebase please

Done.

mjungmath commented 3 years ago
comment:55

I wonder a bit about the changes in src/sage/tests/books/. Is that how it should be?

seblabbe commented 3 years ago
comment:56

Replying to @mjungmath:

I wonder a bit about the changes in src/sage/tests/books/. Is that how it should be?

Yes

mkoeppe commented 3 years ago
comment:57

rebase

mkoeppe commented 3 years ago
comment:58

Setting new milestone based on a cursory review of ticket status, priority, and last modification date.

mkoeppe commented 3 years ago
comment:59

Setting a new milestone for this ticket based on a cursory review.