``` #include <stdio.h> ``` morph_real_as_decimalstr_to_float () ℝ ~ <PosInt 10 BigEndian> ~ <Seq~<ValueTerminated 0> <Digit 10>~Char~Ascii~native.UInt8> --> ℝ ~ native.Float ``` sscanf(src, "%f", dst); return 0; ``` morph_real_as_decimalstr_to_double () ℝ ~ <PosInt 10 BigEndian> ~ <Seq~<ValueTerminated 0> <Digit 10>~Char~Ascii~native.UInt8> --> ℝ ~ native.Double ``` sscanf(src, "%lf", dst); return 0; ``` morph_real_as_float_to_decimalstr () ℝ ~ native.Float --> ℝ ~ <PosInt 10 BigEndian> ~ <Seq~<ValueTerminated 0> <Digit 10>~Char~Ascii~native.UInt8> ``` sprintf(dst, "%f", *src); return 0; ``` morph_real_as_double_to_decimalstr () ℝ ~ native.Double --> ℝ ~ <PosInt 10 BigEndian> ~ <Seq~<ValueTerminated 0> <Digit 10>~Char~Ascii~native.UInt8> ``` sprintf(dst, "%f", *src); return 0; ``` morph_real_as_float_to_double () ℝ ~ native.Float --> ℝ ~ native.Double ``` *dst = *src; return 0; ``` morph_real_as_double_to_float () ℝ ~ native.Double --> ℝ ~ native.Float ``` fprintf(stderr, "Warning: morphin Double -> Float. Precision loss!"); *dst = *src; return 0; ``` morph_real_as_u64_to_float () ℝ ~ ℕ ~ native.UInt64 --> ℝ ~ native.Float ``` fprintf(stderr, "Warning: morphin UInt64 -> Float. Precision loss!"); *dst = *src; return 0; ``` morph_real_as_u64_to_double () ℝ ~ ℕ ~ native.UInt64 --> ℝ ~ native.Double ``` fprintf(stderr, "Warning: morphin UInt64 -> Double. Precision loss!"); *dst = *src; return 0; ``` morph_real_as_quantized_linear_to_float (Begin: ℝ, End: ℝ, Steps: ℤ) ℝ ~ <QuantizedLinear Begin End Steps> ~ ℕ ~ native.UInt64 --> ℝ ~ native.Float ``` *dst = (float)Begin + ( *src * ((float)End - (float)Begin) ) / (float)Steps; return 0; ``` morph_real_as_float_to_quantized_linear (Begin: ℝ, End: ℝ, Steps: ℤ) ℝ ~ native.Float --> ℝ ~ <QuantizedLinear Begin End Steps> ~ ℕ ~ native.UInt64 ``` *dst = ((*src - (float)Begin) * (float)Steps) / ((float)End - (float)Begin); return 0; ``` morph_real_as_quantized_linear_to_double (Begin: ℝ, End: ℝ, Steps: ℤ) ℝ ~ <QuantizedLinear Begin End Steps> ~ ℕ ~ native.UInt64 --> ℝ ~ native.Double ``` *dst = (double)Begin + ( *src * ((double)End - (double)Begin) ) / (double)Steps; return 0; ``` morph_real_as_double_to_quantized_linear (Begin: ℝ, End: ℝ, Steps: ℤ) ℝ ~ native.Double --> ℝ ~ <QuantizedLinear Begin End Steps> ~ ℕ ~ native.UInt64 ``` *dst = ((*src - (double)Begin) * (double)Steps) / ((double)End - (double)Begin); return 0; ```