diff --git a/c-programming/experiments/floatscan-experiment.c b/c-programming/experiments/floatscan-experiment.c index 3e65af7..0e433cc 100644 --- a/c-programming/experiments/floatscan-experiment.c +++ b/c-programming/experiments/floatscan-experiment.c @@ -2,9 +2,35 @@ * This was an experiment to learn about how libc turn floating point strings * into actual values. * - * The original code is from musl libc: version 1.2.4, src/internal/floatscan.c + * The original code is licensed to and was taken from musl libc, originally + * stored at src/internal/floatscan.c * - * The added code: + * musl libc is licensed under MIT license: + * musl as a whole is licensed under the following standard MIT license: + * + * ---------------------------------------------------------------------- + * Copyright © 2005-2020 Rich Felker, et al. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * The license information of the added code and this modification: * Author: Intel A80486DX2-66 * License: Creative Commons Zero 1.0 Universal */ @@ -68,7 +94,7 @@ static long long scanexp(FILE *f, int pok) int x; long long y; int neg = 0; - + c = shgetc(f); if (c=='+' || c=='-') { neg = (c=='-'); @@ -214,7 +240,7 @@ static long double decfloat(FILE *f, int c, int bits, int emin, int sign, int po x[k] = x[k]/p10 + carry; carry = 1000000000/p10 * tmp; if (k==a && !x[k]) { - a = (a+1 & MASK); + a = ((a+1) & MASK); rp -= 9; } } @@ -226,7 +252,7 @@ static long double decfloat(FILE *f, int c, int bits, int emin, int sign, int po while (rp < 9*LD_B1B_DIG || (rp == 9*LD_B1B_DIG && x[a]