msnm (Masahiro Nomoto)
- Login: msnm
- Registered on: 01/04/2019
- Last sign in: 09/15/2022
Issues
| open | closed | Total | |
|---|---|---|---|
| Assigned issues | 0 | 0 | 0 |
| Reported issues | 0 | 3 | 3 |
Activity
09/10/2022
-
05:46 PM Ruby Bug #19004 (Closed): Complex can be nested by Complex.polar
- `Complex.polar` with one argument can return a "nested" Complex instance, whose real part is also a Complex one.
```ruby
puts RUBY_DESCRIPTION
# ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux]
p Complex.polar(1+0i)
...
08/23/2022
-
11:00 PM Ruby Bug #18937: Inconsistent definitions of Complex#<=> and Numeric#<=> with others
- nobu (Nobuyoshi Nakada) wrote in #note-4:
> I agree that `Complex#<=>` should coerce the argument as well as other methods/classes.
> ...
Thanks @nobu .
But `#coerce` is not called when a custom numeric class has `def real? = false` f...
07/26/2022
-
01:39 PM Ruby Bug #18937: Inconsistent definitions of Complex#<=> and Numeric#<=> with others
- @mame
I have a motivation to create a "quaternion" class which is highly interoperable with other built-in numeric classes. (gem: [quaternion_c2](https://rubygems.org/gems/quaternion_c2))
I recently noticed that there was `Complex#...
07/24/2022
-
03:49 AM Ruby Bug #18937: Inconsistent definitions of Complex#<=> and Numeric#<=> with others
- I fix the last code as follows:
```ruby
class Complex
def <=>(other)
return (self == other ? 0 : nil) if self.imag != 0
if other.kind_of?(Complex)
if other.imag == 0
return self.real <=> other.real
... -
03:06 AM Ruby Bug #18937 (Closed): Inconsistent definitions of Complex#<=> and Numeric#<=> with others
- Object#<=> says "Returns 0 if `obj` and `other` are the same object or `obj == other`" .
https://ruby-doc.org/core-3.1.2/Object.html#method-i-3C-3D-3E
However, neither Complex#<=> nor Numeric#<=> satisfies that definition.
```ruby...
12/01/2019
-
11:13 AM Ruby Feature #9602: Logic with `Enumerable#grep`
- I agree with sawa's opinion. `Enumerable#grep` and other methods using `===` internally should accept more than one arguments, following `when` conditions.
Yukihiro Matsumoto wrote:
> We should use #select for more complex filtering...
10/31/2019
-
04:23 AM Ruby Feature #6362: Modular exponentiation/inverse
- FYI:
* Modular exponentiation is implemented in Ruby 2.5 . https://ruby-doc.org/core/Integer.html#method-i-pow
* I created a patch gem to calculate a usual/modular multiplicative inverse. https://www.rubydoc.info/gems/numeric_inver...
01/04/2019
-
09:06 PM Ruby Bug #15505: Complex#/ canonicalize rationals only when divisor is Complex
- In Ruby 2.6.0, Complex simplify division result when divisor is Complex, but does not when divisor is another class (Integer or Rational). This behavior seems to be less consistent: expected to simplify for all divisor.
https://bugs.ru... -
08:52 PM Ruby Bug #15505 (Closed): Complex#/ canonicalize rationals only when divisor is Complex