NEP 4.3.0
NetCDF Expansion Pack
Loading...
Searching...
No Matches
fun_float16.c File Reference
#include <netcdf.h>
#include <nep.h>
#include "nxcdf/nxcdf.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

Macros

#define FILENAME   "fun_float16.nc"
#define NDIM2   2
#define NY   3
#define NX   5
#define DIM_Y_NAME   "Y"
#define DIM_X_NAME   "X"
#define VAR1_NAME   "var1"
#define VAR2_NAME   "var2"
#define PI   3.1415927
#define BFLOAT16_EPSILON   (1.0f/16) /* 7 mantissa bits, spacing 1/8 */
#define FLOAT16_EPSILON   (1.0f/128) /* 10 mantissa bits, spacing 1/64 */
#define ERRCODE   2
#define ERR(e)

Functions

int main (int argc, char **argv)

Macro Definition Documentation

◆ BFLOAT16_EPSILON

#define BFLOAT16_EPSILON   (1.0f/16) /* 7 mantissa bits, spacing 1/8 */

◆ DIM_X_NAME

#define DIM_X_NAME   "X"

◆ DIM_Y_NAME

#define DIM_Y_NAME   "Y"

◆ ERR

#define ERR ( e)
Value:
{printf("Error: %s\n", nc_strerror(e)); exit(ERRCODE);}
#define ERRCODE
Definition bfloat16.c:84

◆ ERRCODE

#define ERRCODE   2

◆ FILENAME

#define FILENAME   "fun_float16.nc"

Fun with 16-bit floats.

16-bit floats come in two flavors. Let's have some fun with them.

Author
Edward Hartnett 11/26/26

◆ FLOAT16_EPSILON

#define FLOAT16_EPSILON   (1.0f/128) /* 10 mantissa bits, spacing 1/64 */

◆ NDIM2

#define NDIM2   2

◆ NX

#define NX   5

◆ NY

#define NY   3

◆ PI

#define PI   3.1415927

◆ VAR1_NAME

#define VAR1_NAME   "var1"

◆ VAR2_NAME

#define VAR2_NAME   "var2"

Function Documentation

◆ main()

int main ( int argc,
char ** argv )