Function sqrtl doesn't work here, also the printf of long double prints f for all given numbers:
#include <conf.h>
#include <kernel.h>
#include <math.h>
#include <float.h>
long double sqrtn;
unsigned long int n;
void xmain() {
unsigned long int n;
printf("Enter unsigned long integer:\n");
scanf("%lu", &n);
sqrtn = sqrtl(long double)n);
printf("\nsqrtn=%Lf\n", sqrtn);
} /* main */
I downloaded the Xinu source code for x86 from https://xinu.cs.purdue.edu/files/Xinu-code-Galileo.tar.gz .
Looking at the implementation for
printf(lib/printf.clib/doprnt.c), as far as I can tell it simply doesn't support length modifiers. That means that, for example, this:wouldn't work. I suggest trying that on your system.
This is not a conforming C implementation (and it's probably not intended to be).
It does appear to support most of the standard conversion specifiers (
"%d","%u","%x","%f", etc.).If you want to print a
long doublevalue, I think the best you can do is either convert it todoubleand use"%f"(which could lose range and/or precision) or write your own code to convert along doublevalue to a string. (Or run you code on a different system).Disclaimer: I haven't tried this, I've only examined the source code, and only for the x86 version of the system.