Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Julia includes code from the following projects, which have their own licenses:
- [MUSL](http://git.musl-libc.org/cgit/musl/tree/COPYRIGHT) (for getopt implementation on Windows) [MIT]
- [MINGW](https://sourceforge.net/p/mingw/mingw-org-wsl/ci/legacy/tree/mingwrt/mingwex/dirname.c) (for dirname implementation on Windows) [MIT]
- [NetBSD](http://www.netbsd.org/about/redistribution.html) (for setjmp, longjmp, and strptime implementations on Windows) [BSD-3]
- [Python](https://docs.python.org/2/license.html) (for strtod implementation on Windows) [BSD-3, effectively]
- [randmtzig.c](https://github.com/JuliaLang/julia/blob/master/test/perf/micro/randmtzig.c) for Gaussian random number generation (for C benchmarks only) [BSD-3]

The Julia language links to the following external libraries, which have their
Expand Down Expand Up @@ -70,9 +71,9 @@ their own licenses:

The following components of Julia's standard library have separate licenses:

- base/fftw.jl (see [FFTW](http://fftw.org/doc/License-and-Copyright.html))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping @JeffBezanson thoughts on this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file itself is not and never has been GPL – it's MIT like the rest of Julia. So: ✔️

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but it should still say something about the FFTW dependency if you call the fft etc. routines

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably covered by the "Julia's standard library uses the following external libraries" bullet above, same as for the rest of the ccall dependencies

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just want positive confirmation from Jeff on this, rather than implicit silence, since he originally wrote this line.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this is ok.

- base/linalg/umfpack.jl (see [SUITESPARSE](http://faculty.cse.tamu.edu/davis/suitesparse.html))
- base/linalg/cholmod.jl (see [SUITESPARSE](http://faculty.cse.tamu.edu/davis/suitesparse.html))
- base/grisu/* (see [double-conversion](https://github.com/google/double-conversion/blob/master/LICENSE))
- base/sparse/umfpack.jl (see [SUITESPARSE](http://faculty.cse.tamu.edu/davis/suitesparse.html))
- base/sparse/cholmod.jl (see [SUITESPARSE](http://faculty.cse.tamu.edu/davis/suitesparse.html))
- base/special/exp.jl (see [FREEBSD MSUN](https://github.com/freebsd/freebsd) [FreeBSD/2-clause BSD/Simplified BSD License])


Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,6 @@ Julia uses the following external libraries, which are automatically downloaded
[FemtoLisp]: https://github.com/JeffBezanson/femtolisp
[GMP]: http://gmplib.org
[MPFR]: http://www.mpfr.org
[double-conversion]: http://double-conversion.googlecode.com
[libuv]: https://github.com/JuliaLang/libuv
[libgit2]: https://libgit2.github.com/
[utf8proc]: http://julialang.org/utf8proc/
Expand Down
2 changes: 1 addition & 1 deletion base/grisu/bignum.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This file is a part of Julia, but is derived from
# https://github.com/floitsch/double-conversion which has the following license
# https://github.com/google/double-conversion which has the following license
#
# Copyright 2006-2014, the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion base/grisu/bignums.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This file is a part of Julia, but is derived from
# https://github.com/floitsch/double-conversion which has the following license
# https://github.com/google/double-conversion which has the following license
#
# Copyright 2006-2014, the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion base/grisu/fastfixed.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This file is a part of Julia, but is derived from
# https://github.com/floitsch/double-conversion which has the following license
# https://github.com/google/double-conversion which has the following license
#
# Copyright 2006-2014, the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion base/grisu/fastprecision.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This file is a part of Julia, but is derived from
# https://github.com/floitsch/double-conversion which has the following license
# https://github.com/google/double-conversion which has the following license
#
# Copyright 2006-2014, the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion base/grisu/fastshortest.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This file is a part of Julia, but is derived from
# https://github.com/floitsch/double-conversion which has the following license
# https://github.com/google/double-conversion which has the following license
#
# Copyright 2006-2014, the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion base/grisu/float.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This file is a part of Julia, but is derived from
# https://github.com/floitsch/double-conversion which has the following license
# https://github.com/google/double-conversion which has the following license
#
# Copyright 2006-2014, the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
Expand Down
167 changes: 78 additions & 89 deletions src/support/strtod.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,21 @@ static locale_t c_locale;

locale_t get_c_locale(void)
{
if(!c_locale_initialized)
{
c_locale_initialized = 1;
c_locale = newlocale(LC_ALL_MASK, "C", NULL);
}
return c_locale;
if (!c_locale_initialized) {
c_locale_initialized = 1;
c_locale = newlocale(LC_ALL_MASK, "C", NULL);
}
return c_locale;
}

JL_DLLEXPORT double jl_strtod_c(const char *nptr, char **endptr)
{
return strtod_l(nptr, endptr, get_c_locale());
return strtod_l(nptr, endptr, get_c_locale());
}

JL_DLLEXPORT float jl_strtof_c(const char *nptr, char **endptr)
{
return strtof_l(nptr, endptr, get_c_locale());
return strtof_l(nptr, endptr, get_c_locale());
}


Expand All @@ -58,7 +57,7 @@ JL_DLLEXPORT float jl_strtof_c(const char *nptr, char **endptr)

int case_insensitive_match(const char *s, const char *t)
{
while(*t && tolower(*s) == *t) {
while (*t && tolower(*s) == *t) {
s++;
t++;
}
Expand Down Expand Up @@ -147,84 +146,75 @@ JL_DLLEXPORT double jl_strtod_c(const char *nptr, char **endptr)
}

/* This code path is used for hex floats */
if (*p == '0' && (*(p+1) == 'x' || *(p+1) == 'X'))
{
digits_pos = p;
p += 2;
/* Check that what's left begins with a digit or decimal point */
if (!isxdigit(*p) && *p != '.')
goto invalid_string;


if (decimal_point[0] != '.' ||
decimal_point[1] != 0)
{
/* Look for a '.' in the input; if present, it'll need to be
swapped for the current locale's decimal point before we
call strtod. On the other hand, if we find the current
locale's decimal point then the input is invalid. */
while (isxdigit(*p))
p++;

if (*p == '.')
{
decimal_point_pos = p++;

/* locate end of number */
while (isxdigit(*p))
p++;

if (*p == 'p' || *p == 'P')
p++;
if (*p == '+' || *p == '-')
p++;
while (isdigit(*p))
p++;
end = p;
}
else if (strncmp(p, decimal_point, decimal_point_len) == 0)
goto invalid_string;
/* For the other cases, we need not convert the decimal
point */
}
} else
{
/* Check that what's left begins with a digit or decimal point */
if (!isdigit(*p) && *p != '.')
goto invalid_string;

digits_pos = p;
if (decimal_point[0] != '.' ||
decimal_point[1] != 0)
{
/* Look for a '.' in the input; if present, it'll need to be
swapped for the current locale's decimal point before we
call strtod. On the other hand, if we find the current
locale's decimal point then the input is invalid. */
while (isdigit(*p))
p++;

if (*p == '.')
{
decimal_point_pos = p++;

/* locate end of number */
while (isdigit(*p))
p++;

if (*p == 'e' || *p == 'E')
p++;
if (*p == '+' || *p == '-')
p++;
while (isdigit(*p))
p++;
end = p;
}
else if (strncmp(p, decimal_point, decimal_point_len) == 0)
if (*p == '0' && (*(p+1) == 'x' || *(p+1) == 'X')) {
digits_pos = p;
p += 2;
/* Check that what's left begins with a digit or decimal point */
if (!isxdigit(*p) && *p != '.')
goto invalid_string;


if (decimal_point[0] != '.' || decimal_point[1] != 0) {
/* Look for a '.' in the input; if present, it'll need to be
swapped for the current locale's decimal point before we
call strtod. On the other hand, if we find the current
locale's decimal point then the input is invalid. */
while (isxdigit(*p))
p++;

if (*p == '.') {
decimal_point_pos = p++;

/* locate end of number */
while (isxdigit(*p))
p++;

if (*p == 'p' || *p == 'P')
p++;
if (*p == '+' || *p == '-')
p++;
while (isdigit(*p))
p++;
end = p;
}
else if (strncmp(p, decimal_point, decimal_point_len) == 0)
goto invalid_string;
/* For the other cases, we need not convert the decimal point */
}
}
else {
/* Check that what's left begins with a digit or decimal point */
if (!isdigit(*p) && *p != '.')
goto invalid_string;
/* For the other cases, we need not convert the decimal
point */
}

digits_pos = p;
if (decimal_point[0] != '.' || decimal_point[1] != 0) {
/* Look for a '.' in the input; if present, it'll need to be
swapped for the current locale's decimal point before we
call strtod. On the other hand, if we find the current
locale's decimal point then the input is invalid. */
while (isdigit(*p))
p++;

if (*p == '.') {
decimal_point_pos = p++;

/* locate end of number */
while (isdigit(*p))
p++;

if (*p == 'e' || *p == 'E')
p++;
if (*p == '+' || *p == '-')
p++;
while (isdigit(*p))
p++;
end = p;
}
else if (strncmp(p, decimal_point, decimal_point_len) == 0)
goto invalid_string;
/* For the other cases, we need not convert the decimal point */
}
}

if (decimal_point_pos) {
Expand Down Expand Up @@ -263,7 +253,6 @@ JL_DLLEXPORT double jl_strtod_c(const char *nptr, char **endptr)
}

free(copy);

}
else {
val = strtod(digits_pos, &fail_pos);
Expand All @@ -278,7 +267,7 @@ JL_DLLEXPORT double jl_strtod_c(const char *nptr, char **endptr)

return val;

invalid_string:
invalid_string:
*endptr = (char*)nptr;
errno = EINVAL;
return -1.0;
Expand All @@ -287,7 +276,7 @@ JL_DLLEXPORT double jl_strtod_c(const char *nptr, char **endptr)

JL_DLLEXPORT float jl_strtof_c(const char *nptr, char **endptr)
{
return (float) jl_strtod_c(nptr, endptr);
return (float) jl_strtod_c(nptr, endptr);
}

#endif
Expand Down