LEFT | RIGHT |
1 /* | 1 /* |
2 This file is part of LilyPond, the GNU music typesetter. | 2 This file is part of LilyPond, the GNU music typesetter. |
3 | 3 |
4 Copyright (C) 1997--2020 Han-Wen Nienhuys <hanwen@xs4all.nl> | 4 Copyright (C) 1997--2020 Han-Wen Nienhuys <hanwen@xs4all.nl> |
5 | 5 |
6 LilyPond is free software: you can redistribute it and/or modify | 6 LilyPond is free software: you can redistribute it and/or modify |
7 it under the terms of the GNU General Public License as published by | 7 it under the terms of the GNU General Public License as published by |
8 the Free Software Foundation, either version 3 of the License, or | 8 the Free Software Foundation, either version 3 of the License, or |
9 (at your option) any later version. | 9 (at your option) any later version. |
10 | 10 |
11 LilyPond is distributed in the hope that it will be useful, | 11 LilyPond is distributed in the hope that it will be useful, |
12 but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 GNU General Public License for more details. | 14 GNU General Public License for more details. |
15 | 15 |
16 You should have received a copy of the GNU General Public License | 16 You should have received a copy of the GNU General Public License |
17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>. | 17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>. |
18 */ | 18 */ |
19 | 19 |
20 #include "rational.hh" | 20 #include "rational.hh" |
21 | 21 |
22 #include <cmath> | 22 #include <cmath> |
23 #include <cassert> | 23 #include <cassert> |
24 #include <cstdlib> | 24 #include <cstdlib> |
25 | 25 |
26 #include "string-convert.hh" | 26 #include "string-convert.hh" |
27 #include "libc-extension.hh" | |
28 | 27 |
29 using std::string; | 28 using std::string; |
30 | 29 |
31 Rational::operator double () const | 30 Rational::operator double () const |
32 { | 31 { |
33 if (sign_ == -1 || sign_ == 1 || sign_ == 0) | 32 if (sign_ == -1 || sign_ == 1 || sign_ == 0) |
34 // FIXME: workaround: In GUB, g++ 4.9.4 for darwin-x86, | 33 // FIXME: workaround: In GUB, g++ 4.9.4 for darwin-x86, |
35 // it seems that static cast from `unsigned long long` to `double` | 34 // it seems that static cast from `unsigned long long` to `double` |
36 // by x86 SSE2 raises an internal compile error. | 35 // by x86 SSE2 raises an internal compile error. |
37 // However, static cast from `signed long long` to `double` | 36 // However, static cast from `signed long long` to `double` |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 sign (Rational r) | 386 sign (Rational r) |
388 { | 387 { |
389 return r.sign (); | 388 return r.sign (); |
390 } | 389 } |
391 | 390 |
392 bool | 391 bool |
393 Rational::is_infinity () const | 392 Rational::is_infinity () const |
394 { | 393 { |
395 return sign_ == 2 || sign_ == -2; | 394 return sign_ == 2 || sign_ == -2; |
396 } | 395 } |
LEFT | RIGHT |