[#106355] [Ruby master Bug#18373] RBS build failure: '/include/x86_64-linux/ruby/config.h', needed by 'constants.o'. — "vo.x (Vit Ondruch)" <noreply@...>

Issue #18373 has been reported by vo.x (Vit Ondruch).

28 messages 2021/12/01

[#106356] [Ruby master Bug#18374] make: Circular spec/ruby/optional/capi/ext/array_spec.c <- spec/ruby/optional/capi/ext/array_spec.c dependency dropped. — "vo.x (Vit Ondruch)" <noreply@...>

Issue #18374 has been reported by vo.x (Vit Ondruch).

8 messages 2021/12/01

[#106360] [Ruby master Feature#18376] Version comparison API — "vo.x (Vit Ondruch)" <noreply@...>

Issue #18376 has been reported by vo.x (Vit Ondruch).

28 messages 2021/12/01

[#106543] [Ruby master Bug#18396] An unexpected "hash value omission" syntax error when parentheses call expr follows — "koic (Koichi ITO)" <noreply@...>

Issue #18396 has been reported by koic (Koichi ITO).

10 messages 2021/12/08

[#106596] [Ruby master Misc#18399] DevMeeting-2022-01-13 — "mame (Yusuke Endoh)" <noreply@...>

Issue #18399 has been reported by mame (Yusuke Endoh).

11 messages 2021/12/09

[#106621] [Ruby master Misc#18404] 3.1 documentation problems tracking ticket — "zverok (Victor Shepelev)" <noreply@...>

Issue #18404 has been reported by zverok (Victor Shepelev).

16 messages 2021/12/11

[#106634] [Ruby master Bug#18407] Behavior difference between integer and string flags to File creation — deivid <noreply@...>

Issue #18407 has been reported by deivid (David Rodr鱈guez).

12 messages 2021/12/13

[#106644] [Ruby master Bug#18408] Rightward assignment into instance variable — "Dan0042 (Daniel DeLorme)" <noreply@...>

Issue #18408 has been reported by Dan0042 (Daniel DeLorme).

23 messages 2021/12/13

[#106686] [Ruby master Bug#18409] Crash (free(): invalid pointer) if LD_PRELOAD doesn't explicitly include libjemalloc.so.2 — "itay-grudev (Itay Grudev)" <noreply@...>

Issue #18409 has been reported by itay-grudev (Itay Grudev).

7 messages 2021/12/15

[#106730] [Ruby master Bug#18417] IO::Buffer problems — "zverok (Victor Shepelev)" <noreply@...>

Issue #18417 has been reported by zverok (Victor Shepelev).

9 messages 2021/12/19

[#106784] [CommonRuby Feature#18429] Configure ruby-3.0.3 on Solaris 10 Unknown keyword 'URL' in './ruby.tmp.pc' — "dklein (Dmitri Klein)" <noreply@...>

Issue #18429 has been reported by dklein (Dmitri Klein).

32 messages 2021/12/23

[#106828] [Ruby master Bug#18435] Calling `protected` on ancestor method changes result of `instance_methods(false)` — "ufuk (Ufuk Kayserilioglu)" <noreply@...>

Issue #18435 has been reported by ufuk (Ufuk Kayserilioglu).

23 messages 2021/12/26

[#106833] [Ruby master Feature#18438] Add `Exception#additional_message` to show additional error information — "mame (Yusuke Endoh)" <noreply@...>

Issue #18438 has been reported by mame (Yusuke Endoh).

30 messages 2021/12/27

[#106834] [Ruby master Bug#18439] Support YJIT for VC++ — "usa (Usaku NAKAMURA)" <noreply@...>

Issue #18439 has been reported by usa (Usaku NAKAMURA).

11 messages 2021/12/27

[#106851] [Ruby master Bug#18442] Make Ruby 3.0.3 on Solaris 10 with "The following command caused the error: cc -D_STDC_C99= " — "dklein (Dmitri Klein)" <noreply@...>

Issue #18442 has been reported by dklein (Dmitri Klein).

8 messages 2021/12/27

[#106928] [Ruby master Bug#18454] YJIT slowing down key Discourse benchmarks — "sam.saffron (Sam Saffron)" <noreply@...>

Issue #18454 has been reported by sam.saffron (Sam Saffron).

8 messages 2021/12/31

[ruby-core:106428] [Ruby master Bug#8826] BigDecimal#div and #quo different behavior and inconsistencies

From: "mrkn (Kenta Murata)" <noreply@...>
Date: 2021-12-03 01:46:42 UTC
List: ruby-core #106428
Issue #8826 has been updated by mrkn (Kenta Murata).

Status changed from Assigned to Third Party's Issue

The behavior of `BigDecimal#div` to return an Integer isn't a bug but the specification of `Numeric#div`.  `Float#div` also always returns an Integer.

It is a bug that `BigDecimal#div` doesn't accept a Float without precision.  I'll fix it in https://github.com/ruby/bigdecimal/issues/212.

`BigDecimal#quo` should be different from `BigDecimal#div` as `Numeric#quo` is different from `Numeric#div`.  As `Float#quo` returns a Float, it is natural that `BigDecimal#quo` returns a BigDecimal.

`BigDecimal#quo` must accept a precision of the result like `BigDecimal#div`.  I'll fix it in https://github.com/ruby/bigdecimal/issues/214.

----------------------------------------
Bug #8826: BigDecimal#div and #quo different behavior and inconsistencies
https://bugs.ruby-lang.org/issues/8826#change-95069

* Author: karatedog (F旦ldes L叩szl坦)
* Status: Third Party's Issue
* Priority: Normal
* Assignee: mrkn (Kenta Murata)
* ruby -v: ruby 2.0.0p247 (2013-06-27 revision 41674) [i686-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
BigDecimal's #div and #quo method behave differently despite the #div documentation says: "See BigDecimal#quo"

#div returns Fixnum if there is no precision argument for #div (this parameter is not documented):

```
2.0.0-p247 :018 > BigDecimal(5).div(5).class
 => Fixnum 
2.0.0-p247 :031 > BigDecimal(5).div(5.1).class
 => Fixnum
```

#div returns Fixnum even for a Float argument:

```
2.0.0-p247 :118 > BigDecimal(5).div(5.01)
 => 0 
```

It returns Fixnum even if every argument is BigDecimal:

```
2.0.0-p247 :043 > BigDecimal(5).div(BigDecimal(5.1,5)).class
 => Fixnum
```

When provided the precision argument, #div returns BigDecimal:

```
2.0.0-p247 :036 > BigDecimal(5).div(5,8).class
 => BigDecimal 
2.0.0-p247 :131 > BigDecimal(5).div(BigDecimal(5.1,5),8).class
 => BigDecimal 
```

But first argument cannot be Float along with precision:

```
2.0.0-p247 :032 > BigDecimal(5).div(5.1,8).class
ArgumentError: Float can't be coerced into BigDecimal without a precision
	from (irb):32:in `div'
	from (irb):32
	from /home/karatedog/.rvm/rubies/ruby-2.0.0-p247/bin/irb:13:in `<main>'
```

Whereas #quo does not accept a precision argument and returns BigDecimal (hence no configurable precision here, although the documentation says that #quo applies round operation):

```
2.0.0-p247 :121 > BigDecimal(5).quo(5.01)
 => #<BigDecimal:8bacf68,'0.9980039920 1596806387 225549E0',27(45)> 
```

Circumventing the precision with class method does not work on #quo, it's like the limit is maxed:

```
2.0.0-p247 :135 > BigDecimal::limit(5)
 => 5 
2.0.0-p247 :136 > BigDecimal(1).quo(3)
 => #<BigDecimal:899c778,'0.33333E0',9(36)> 
2.0.0-p247 :080 > BigDecimal::limit(50)
 => 5 
2.0.0-p247 :081 > BigDecimal(1).quo(3)
 => #<BigDecimal:8a92d94,'0.3333333333 33333333E0',18(36)> 
```

Precision does not seem to be automatic:

```
2.0.0-p247 :141 > BigDecimal::limit(500)
 => 100 
2.0.0-p247 :142 > BigDecimal(1).quo(229)
 => #<BigDecimal:8be67f4,'0.4366812227 074236E-2',18(36)> 
```

229 is a full period prime, its reciprocal yields 228 fractional digits before repetition. 

Whereas #div's precision can be larger than #div's:

```
2.0.0-p247 :109 > BigDecimal(1).div(3,19)
 => #<BigDecimal:8acb2d4,'0.3333333333 333333333E0',27(54)>
```

And for 229:

```
2.0.0-p247 :144 > BigDecimal(1).div(229,250)
 => #<BigDecimal:8bc8b28,'0.4366812227 0742358078 6026200873 3624454148 4716157205 2401746724 8908296943 2314410480 3493449781 6593886462 8820960698 6899563318 7772925764 1921397379 9126637554 5851528384 2794759825 3275109170 3056768558 9519650655 0218340611 3537117903 9301310043 6681222707...
```

Expected behavior:
- One division method to rule them all :-) (#Division)
- Never truncate a result (aka no Fixnum/Bignum as result). If someone uses BigDecimal, they probably wanted large precision instead of truncating the results by default.
- #Division should accept Float, Rational, String, Complex, Integer, BigDecimal as divisor, even Float w/o precision. (This is intended as a full list of acceptable classes, #div and #quo can already take different classes as arguments). 
- #Division should accept a precision argument which would override ::Limit (as this happens in many instance method), this argument is optional. Without precision argument, use ::Limit

as for now proper calculation only happens if:
- method is #div
- the divisor is converted to BigDecimal
- a precision argument is given to #div




-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next