Yukihiro "Matz" Matsumoto
af3482d562
mruby-math: use erfc(x) instead of 1.0 - erf(x)
2024-01-09 08:01:28 +09:00
Yukihiro "Matz" Matsumoto
51c4c4716a
mruby-math: use log1p(x) instead of log(1.0+x)
2024-01-09 07:59:42 +09:00
Yukihiro "Matz" Matsumoto
8a2e88390b
mruby-math: reduce the scope of a local variable
2024-01-09 07:47:57 +09:00
Yukihiro "Matz" Matsumoto
c1fc3219db
mruby-math: fix spacing
2024-01-08 23:18:57 +09:00
Yukihiro "Matz" Matsumoto
b4c936b533
use new E_EXCEPTION and E_STANDARD_ERROR; ref #5924
2023-02-10 15:21:38 +09:00
Yukihiro "Matz" Matsumoto
d9bf3235d2
mruby-math/math.c: avoid mrb_get_args() if possible
...
When a method takes single argument, we can use lighter `mrb_get_arg1()`
instead of `mrb_get_args()`.
2023-01-24 09:15:20 +09:00
Yukihiro "Matz" Matsumoto
9c5dc42e59
small cosmetic changes.
...
I prefer `i++` style unless absolutely necessary.
This commit is an addition to 41e4148.
2022-11-19 17:11:56 +09:00
Yukihiro "Matz" Matsumoto
9f47f11abd
math.c: update prototype style.
2022-09-05 07:30:12 +09:00
dearblue
5a57602860
Organize the include of header files
...
- `#include <math.h>` is done in `mruby.h`.
Eliminate the need to worry about the `MRB_NO_FLOAT` macro.
- Include mruby header files before standard header files.
If the standard header file is already placed before `mruby.h`, the standard header file added in the future tends to be placed before `mruby.h`.
This change should some reduce the chances of macros that must be defined becoming undefined in C++ or including problematic header files in a particular mruby build configuration.
2021-08-21 15:42:57 +09:00
Yukihiro "Matz" Matsumoto
5c804cf68f
Remove redundant include headers.
...
- stdlib.h
- stddef.h
- stdint.h
- stdarg.h
- limits.h
- float.h
2021-07-25 13:07:10 +09:00
Yukihiro "Matz" Matsumoto
2268405fe6
test/math.rb: 10**30 could cause integer overflow; ref #5420
2021-04-21 22:04:20 +09:00
Yukihiro "Matz" Matsumoto
1cc20978cf
Enlarge tolerance limit for float32; close #5329
...
Along with some refactoring on `mruby-math` tests.
2021-02-07 14:56:34 +09:00
Yukihiro "Matz" Matsumoto
17ecf14511
Revert "Minimize the changes in #5277 "
...
This reverts commit dc51d89ac2 .
2021-01-26 10:57:07 +09:00
Yukihiro "Matz" Matsumoto
dc51d89ac2
Minimize the changes in #5277
...
Instead of including `mruby/presym.h` everywhere, we provided the
fallback `mruby/presym.inc` under `include/mruby` directory, and specify
`-I<build-dir>/include` before `-I<top-dir>/include` in `presym.rake`.
So even when someone drops `-I<build-dir>/include` in compiler options,
it just compiles without failure.
2021-01-22 18:38:53 +09:00
KOBAYASHI Shuji
90b53f4c29
Avoid including presym.inc in existing header files
...
Addressed an issue where existing programs linking `libmruby.a` could only
be built by adding `<build-dir>/include` to compiler's include path.
2021-01-11 09:21:07 +09:00
Yukihiro "Matz" Matsumoto
2e30c68562
Move MRB_NO_FLOAT detection in mruby-math; #5185
2020-11-24 20:43:56 +09:00
Yukihiro "Matz" Matsumoto
08f61db6ee
Skip some Math.atan2() tests.
...
Linux `atan2(3)` man page says:
```
If y is positive infinity (negative infinity) and x is positive infinity,
+pi/4 (-pi/4) is re‐ turned.
```
But on Microsoft VC/MinGW, `atan2()` returns `NaN` if either of
arguments is infinite. So we skip those tests on the platforms.
2020-10-12 18:20:14 +09:00
dearblue
80fe9838d2
Integrate Fixnum class into Integer class
...
* The `Fixnum` constant is now an alias for the `Integer` class.
* Remove `struct mrb_state::fixnum_class` member.
If necessary, use `struct mrb_state::integer_class` instead.
2020-10-12 16:21:44 +09:00
Yukihiro "Matz" Matsumoto
8a87549315
Rename float configuration option names.
...
- `MRB_WITHOUT_FLOAT` => `MRB_NO_FLOAT`
- `MRB_USE_FLOAT` => `MRB_USE_FLOAT32`
The former is to use `USE_XXX` naming convention. The latter is to make
sure `float` is 32bit float and not floating point number in general.
2020-10-12 16:21:40 +09:00
Yukihiro "Matz" Matsumoto
2a366ffba8
Use functions that take symbols to reduce string litrals in C.
2020-10-12 16:20:59 +09:00
KOBAYASHI Shuji
d908a73b04
Add tests to Math
2019-12-07 20:50:56 +09:00
KOBAYASHI Shuji
334afb167c
Use new specifiers/modifiers of mrb_vfromat()
...
The binary sizes (gems are only `mruby-bin-mruby`) are reduced slightly in
my environment than before the introduction of new specifiers/modifiers
(5116789a ) with this change.
------------+-------------------+-------------------+--------
BINARY | BEFORE (5116789a ) | AFTER (This PR) | RATIO
------------+-------------------+-------------------+--------
mruby | 593416 bytes | 593208 bytes | -0.04%
libmruby.a | 769048 bytes | 767264 bytes | -0.23%
------------+-------------------+-------------------+--------
BTW, I accidentally changed `tasks/toolchains/visualcpp.rake` at #4613 ,
so I put it back.
2019-08-05 13:18:50 +09:00
Yukihiro "Matz" Matsumoto
87d1b2a910
Improve conflict error message of Time and Math; ref #4576
2019-07-22 20:21:30 +09:00
dearblue
c96b517ea2
Error needed/conflicts configuration
...
The purpose is to clarify the error if there is a needed/conflicts
configuration at compile time.
2019-07-14 00:29:17 +09:00
KOBAYASHI Shuji
d1f937e1f4
Fix missing assertions in mruby-math test
2019-03-29 09:40:13 +09:00
Yukihiro "Matz" Matsumoto
42f240796f
Use Mrbtest::FLOAT_TOLERANCE instead of Math::TORELANCE; ref #4345
2019-03-28 23:22:32 +09:00
Yukihiro "Matz" Matsumoto
3b92b642eb
Break loop whem sum==0 to avoid zero division; ref #4345
2019-03-28 23:22:32 +09:00
Yukihiro "Matz" Matsumoto
a26856f883
Use DBL_EPSILON instead of 1E-12; ref #4345
2019-03-28 23:22:32 +09:00
dearblue
be980e9a7a
Suppress __FreeBSD_version warns for FreeBSD
2018-12-23 17:23:51 +09:00
Tomasz Dąbrowski
553dbad2c6
fix: mrbgems\mruby-math\src\math.c(660): warning C4244: 'function': conversion from 'mrb_int' to 'int', possible loss of data
2017-09-27 22:22:04 +02:00
Tomasz Dąbrowski
49e96a2e19
fix: mrbgems\mruby-math\src\math.c(491): warning C4244: '=': conversion from 'mrb_int' to 'int', possible loss of data
2017-09-27 22:22:04 +02:00
Yasuhiro Matsumoto
7cc33af2dc
fix build on VS2012
2015-12-22 17:46:20 +09:00
Yukihiro "Matz" Matsumoto
5c405dea3d
include changed from by quotes ("") to by brackets (<>); close #3032
2015-11-27 17:48:23 +09:00
Paolo Bosetti
470fce5c90
Fix check for VisualStudio Version in mruby-math gem
2015-11-19 12:01:23 +01:00
Seba Gamboa
25c8e95365
Revert "Mark core gems with mrbgem tag"
...
This reverts commit 5cdcce8dbd .
2015-10-21 14:31:13 -03:00
Seba Gamboa
13b552538a
Remove obvious warnings from docs
2015-10-20 12:48:31 -03:00
Seba Gamboa
5cdcce8dbd
Mark core gems with mrbgem tag
2015-10-20 12:16:47 -03:00
bggd
dc1dcba935
Update math.c
2014-08-22 16:51:04 +09:00
chasonr
e23deaafc2
Improve replacement math functions for Visual C++.
2014-08-15 23:15:45 -04:00
kkkkkt
9c78fc8443
added Math.cos and Math.tan test case
2014-08-05 11:27:50 +09:00
cremno
405e8fbcd5
mruby-math: define and use Math::DomainError
...
Domain errors are detected as per ISO C99 and may differ from CRuby.
2014-05-02 23:48:25 +02:00
take_cheeze
c73f8d4def
move summary of mrbgems in default gembox to its spec
2014-03-17 00:34:24 +09:00
cremno
b7899aa6ee
mruby-math: remove Cygwin compatibility macros
...
nan:
The first non-test release of Cygwin 1.5.x was over a decade ago:
<http://cygwin.com/ml/cygwin-announce/2003-09/msg00001.html >
log/log10:
This workaround is not needed anymore (1.2.6.1, 1.3 - both over 6 years ago):
<https://sourceware.org/cgi-bin/cvsweb.cgi/src/newlib/libm/math/w_log.c?cvsroot=src >
2014-02-12 00:03:12 +01:00
Julien Ammous
19f5430967
support freebsd versions without log2 function
2013-09-23 15:14:19 +02:00
wanabe
c9ac35f3ba
android doesn't have log2
2013-08-19 01:34:07 +09:00
Tomoyuki Sahara
116f75a8ce
"spec.author" is better for single-author gems.
...
"spec.author=" expects a String represents a single author.
"spec.authors=" expects an Array which is a list of multiple authors.
http://guides.rubygems.org/specification-reference/
2013-07-23 10:09:24 +09:00
Cremno
8728837478
Visual Studio 2013 support + strtof + inline
...
- VC12 has better C99 library support due to C++11
- defined strtof for VC11 or older
- define "inline" only if the C compiler is used
2013-06-27 12:18:35 +02:00
kimu_shu
e720782f81
Add MRB_WORD_BOXING mode (represent mrb_value as a word)
2013-05-26 10:09:17 +09:00
Yukihiro "Matz" Matsumoto
30d580ecbc
rename every ARGS_XXX to MRB_ARGS_XXX; ref #1206
2013-04-25 09:47:36 +09:00
Masaki Muranaka
6cd7017ec1
Remove trailing whitespaces. This is just a cosmetic change.
2013-03-03 10:54:00 +09:00