Atlas - math.c

Home / lab / trail / c / header Lines: 5 | Size: 1755 bytes [Download] [Show on GitHub] [Search similar files] [Raw] [Raw (proxy)]
[FILE BEGIN]
1/* SPDX-License-Identifier: GPL-3.0 2 * The Language Trail 3 * 4 * math.c 5 * 6 * This is going to be quite long so buckle up! 7 * 8 * https://en.cppreference.com/w/c/header/math.html 9 * 10 * COPYRIGHT NOTICE 11 * Copyright (C) 2025 0x4248 and contributors 12 * Redistribution and use in source and binary forms, with or without 13 * modification, are permitted provided that the license is not changed. 14 * 15 * This software is free and open source. Licensed under the GNU general 16 * public license version 3.0 as published by the Free Software Foundation. 17*/ 18 19#include <math.h> 20#include <stdio.h> 21#include <float.h> 22 23// ########## CHECKLIST ########## 24// Contents: 25// - Constants 26// - Functions 27// - Basic 28// ##### CONSTANTS ##### 29// HUGE_VAL [X] 30// INFINITY [X] 31// NAN [TODO] 32// FP_FAST [TODO] 33// FP_ILOGB0 [TODO] 34// math_errhandling [TODO] 35// ##### FUNCTIONS ##### 36// ## BASIC ## 37// fabs [TODO] 38// fmod [TODO] 39// remainder [TODO] 40 41/* 42 * Lets have a look at the math constants 43 * 44 * https://en.cppreference.com/w/c/numeric/math/HUGE_VALL.html 45 * https://learn.microsoft.com/en-us/cpp/c-runtime-library/huge-val-huge 46 */ 47void test_mathConsts(){ 48 /* HUGE_VAL - Its a big value, more specifically its the biggest float 49 * value there is. Some people use it as an error e.g -HUGE_VAL. 50 */ 51 printf("%f\n", HUGE_VAL); /* This just prints inf */ 52 printf("%Lf\n", HUGE_VALL); /* HUGE_VAL but double; so even huger value */ 53 54 /* Very similar to HUGE_VAL but can be used with isinf() */ 55 printf("%f\n", INFINITY); 56 57 /* NAN - Not a number, but is a float; can be used with nan() and isnan() */ 58 printf("%f\n", NAN); 59} 60 61int main(){ 62 test_mathConsts(); 63 return 0; 64} 65
[FILE END]
(C) 2025 0x4248 (C) 2025 4248 Media and 4248 Systems, All part of 0x4248 See LICENCE files for more information. Not all files are by 0x4248 always check Licencing.