Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fmod and other math module functions are missing in js mode #4630

Closed
mcclure opened this issue Aug 20, 2016 · 6 comments

Comments

@mcclure
Copy link

commented Aug 20, 2016

I am using self-built nim from git. I tested the following with 0062077

I write this code:

import math
var x = fmod(1.0, 4.0)

And compile it with nim js -o:testNim.js testNim.nim, I get an error:

Hint: used config file 'C:\msys64\home\Andi\work\g\Nim\config\nim.cfg' [Conf]
Hint: system [Processing]
Hint: testnim [Processing]
Hint: math [Processing]
testnim.nim(2, 9) Error: undeclared identifier: 'fmod'

I do not get the same problem if I run with nim c.

Doing a quick sweep of the documentation http://nim-lang.org/docs/math.html, I find that documented functions trunc, lgamma, tgamma, erfc, erf, are also missing from the math module. I believe everything else is present.

The backends page http://nim-lang.org/docs/backends.html says "Features or modules that the JavaScript platform does not support are not available... However, the modules strutils, math, and times are available" so my expected behavior is that the entirety of the math module should be available. If this is for some reason not possible I expect it to be clearly documented.

@Araq Araq added the JS label Aug 26, 2016

@yglukhov

This comment has been minimized.

Copy link
Member

commented Aug 29, 2016

Why does fmod function exist at all, if there's mod operator?

@mcclure

This comment has been minimized.

Copy link
Author

commented Aug 30, 2016

@yglukhov From my reading of the docs they have different behavior with respect to operand sign.

@GULPF GULPF added the Stdlib label Feb 6, 2019

@define-private-public

This comment has been minimized.

Copy link
Contributor

commented Jun 20, 2019

Is this ticket still relevant, as the fmod function has been marked to be deprecated:

https://nim-lang.org/0.20.0/math.html#fmod%2Cfloat32%2Cfloat32

@Araq

This comment has been minimized.

Copy link
Member

commented Jun 23, 2019

Agreed.

@Araq Araq closed this Jun 23, 2019

@mcclure

This comment has been minimized.

Copy link
Author

commented Jun 23, 2019

I'm sorry late response, but… "trunc" was one of the impacted functions at my last test, and it is still in the documentation and not deprecated… I don't think it really matters as long as the documentation is accurate. If trunc, lgamma, tgamma, erfc, erf are unsupported in js mode then they should be labeled in the documentation as not fully supported.

@Araq Araq reopened this Jun 23, 2019

@narimiran narimiran closed this in 436f570 Jun 24, 2019

@define-private-public

This comment has been minimized.

Copy link
Contributor

commented Jun 25, 2019

Shouldn't a new ticket for those missing functions (in JS) be created?

narimiran added a commit that referenced this issue Jun 27, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.